summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 11:40:17 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 12:42:11 +0000
commit5d87695f37678f96492b258bbab36486c59866b4 (patch)
treebe9783bbaf04fb930c4d74ca9c00b5e7954c8bc6 /chromium/chrome/browser
parent6c11fb357ec39bf087b8b632e2b1e375aef1b38b (diff)
BASELINE: Update Chromium to 75.0.3770.56
Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/chrome/browser')
-rw-r--r--chromium/chrome/browser/BUILD.gn289
-rw-r--r--chromium/chrome/browser/accessibility/OWNERS2
-rw-r--r--chromium/chrome/browser/accessibility/accessibility_extension_api.cc123
-rw-r--r--chromium/chrome/browser/accessibility/accessibility_extension_api.h8
-rw-r--r--chromium/chrome/browser/accessibility/accessibility_labels_service.cc10
-rw-r--r--chromium/chrome/browser/accessibility/accessibility_state_utils.cc3
-rw-r--r--chromium/chrome/browser/accessibility/accessibility_ui.cc11
-rw-r--r--chromium/chrome/browser/accessibility/image_annotation_browsertest.cc414
-rw-r--r--chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc5
-rw-r--r--chromium/chrome/browser/android/vr/BUILD.gn35
-rw-r--r--chromium/chrome/browser/apps/app_shim/BUILD.gn2
-rw-r--r--chromium/chrome/browser/apps/platform_apps/api/BUILD.gn4
-rw-r--r--chromium/chrome/browser/browser_resources.grd101
-rw-r--r--chromium/chrome/browser/browser_switcher/bho/BUILD.gn35
-rw-r--r--chromium/chrome/browser/chromeos/BUILD.gn216
-rw-r--r--chromium/chrome/browser/chromeos/kiosk_next_home/mojom/BUILD.gn17
-rw-r--r--chromium/chrome/browser/chromeos/kiosk_next_home/mojom/app_controller.mojom62
-rw-r--r--chromium/chrome/browser/chromeos/kiosk_next_home/mojom/kiosk_next_home_interface_broker.mojom19
-rw-r--r--chromium/chrome/browser/conflicts/BUILD.gn6
-rw-r--r--chromium/chrome/browser/devtools/chrome_devtools_session.cc16
-rw-r--r--chromium/chrome/browser/devtools/device/tcp_device_provider.cc7
-rw-r--r--chromium/chrome/browser/devtools/device/usb/android_usb_browsertest.cc32
-rw-r--r--chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc6
-rw-r--r--chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.h2
-rw-r--r--chromium/chrome/browser/devtools/devtools_file_helper.cc2
-rw-r--r--chromium/chrome/browser/devtools/devtools_file_watcher.cc51
-rw-r--r--chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc11
-rw-r--r--chromium/chrome/browser/devtools/devtools_ui_bindings.cc48
-rw-r--r--chromium/chrome/browser/devtools/devtools_ui_bindings.h2
-rw-r--r--chromium/chrome/browser/devtools/devtools_window.cc2
-rw-r--r--chromium/chrome/browser/devtools/devtools_window_testing.cc4
-rw-r--r--chromium/chrome/browser/devtools/inspector_protocol_config.json5
-rw-r--r--chromium/chrome/browser/devtools/protocol/page_handler.cc26
-rw-r--r--chromium/chrome/browser/devtools/protocol/page_handler.h6
-rw-r--r--chromium/chrome/browser/extensions/BUILD.gn17
-rw-r--r--chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc52
-rw-r--r--chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.h38
-rw-r--r--chromium/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc24
-rw-r--r--chromium/chrome/browser/extensions/api/autofill_private/autofill_util.cc29
-rw-r--r--chromium/chrome/browser/extensions/api/autofill_private/autofill_util.h10
-rw-r--r--chromium/chrome/browser/extensions/api/automation/OWNERS3
-rw-r--r--chromium/chrome/browser/extensions/api/automation/automation_apitest.cc22
-rw-r--r--chromium/chrome/browser/extensions/api/automation_internal/OWNERS3
-rw-r--r--chromium/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc54
-rw-r--r--chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc77
-rw-r--r--chromium/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc24
-rw-r--r--chromium/chrome/browser/extensions/api/cast_streaming/performance_test.cc16
-rw-r--r--chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc26
-rw-r--r--chromium/chrome/browser/extensions/api/chrome_extensions_api_client.cc9
-rw-r--r--chromium/chrome/browser/extensions/api/chrome_extensions_api_client_unittest.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/cookies/cookies_api.cc28
-rw-r--r--chromium/chrome/browser/extensions/api/cookies/cookies_api.h12
-rw-r--r--chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc29
-rw-r--r--chromium/chrome/browser/extensions/api/cookies/cookies_helpers_unittest.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/cookies/cookies_unittest.cc8
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_content/content_action.cc27
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_apitest.cc9
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc461
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_net_request/rule_indexing_unittest.cc118
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc208
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/desktop_capture/OWNERS2
-rw-r--r--chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc5
-rw-r--r--chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc14
-rw-r--r--chromium/chrome/browser/extensions/api/developer_private/developer_private_api.cc57
-rw-r--r--chromium/chrome/browser/extensions/api/developer_private/developer_private_api.h9
-rw-r--r--chromium/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc71
-rw-r--r--chromium/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc63
-rw-r--r--chromium/chrome/browser/extensions/api/device_permissions_manager_unittest.cc234
-rw-r--r--chromium/chrome/browser/extensions/api/downloads/downloads_api.cc3
-rw-r--r--chromium/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc3
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc18
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc7
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h4
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_reporting_private/OWNERS3
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/feedback_private/OWNERS1
-rw-r--r--chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.cc57
-rw-r--r--chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.h9
-rw-r--r--chromium/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc40
-rw-r--r--chromium/chrome/browser/extensions/api/file_system/request_file_system_notification.cc3
-rw-r--r--chromium/chrome/browser/extensions/api/gcm/gcm_apitest.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/identity/identity_apitest.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc67
-rw-r--r--chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h19
-rw-r--r--chromium/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/image_writer_private/operation.h2
-rw-r--r--chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc3
-rw-r--r--chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc118
-rw-r--r--chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.h10
-rw-r--r--chromium/chrome/browser/extensions/api/management/management_apitest.cc144
-rw-r--r--chromium/chrome/browser/extensions/api/mdns/mdns_api.cc13
-rw-r--r--chromium/chrome/browser/extensions/api/mdns/mdns_api.h2
-rw-r--r--chromium/chrome/browser/extensions/api/media_perception_private/OWNERS2
-rw-r--r--chromium/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/networking_cast_private/networking_cast_private_apitest.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/networking_config_chromeos_apitest_chromeos.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc14
-rw-r--r--chromium/chrome/browser/extensions/api/notifications/extension_notification_display_helper.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/page_capture/page_capture_api.cc7
-rw-r--r--chromium/chrome/browser/extensions/api/permissions/permissions_api_unittest.cc35
-rw-r--r--chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.cc16
-rw-r--r--chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.h2
-rw-r--r--chromium/chrome/browser/extensions/api/preference/preference_api.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/preference/preferences_private_apitest.cc29
-rw-r--r--chromium/chrome/browser/extensions/api/processes/processes_api.cc5
-rw-r--r--chromium/chrome/browser/extensions/api/processes/processes_apitest.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/resources_private/resources_private_api.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/sessions/sessions_api.cc5
-rw-r--r--chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc28
-rw-r--r--chromium/chrome/browser/extensions/api/settings_private/generated_time_zone_pref_base.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/settings_private/prefs_util.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc16
-rw-r--r--chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc55
-rw-r--r--chromium/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/socket/tls_socket_unittest.cc52
-rw-r--r--chromium/chrome/browser/extensions/api/socket/udp_socket_unittest.cc24
-rw-r--r--chromium/chrome/browser/extensions/api/storage/managed_value_store_cache.cc9
-rw-r--r--chromium/chrome/browser/extensions/api/storage/settings_apitest.cc37
-rw-r--r--chromium/chrome/browser/extensions/api/storage/sync_storage_backend.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/storage/sync_storage_backend.h1
-rw-r--r--chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.h2
-rw-r--r--chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.cc11
-rw-r--r--chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h4
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/OWNERS2
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_api.cc93
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_event_router.cc3
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_util.cc13
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_util.h24
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc66
-rw-r--r--chromium/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc13
-rw-r--r--chromium/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc94
-rw-r--r--chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc223
-rw-r--r--chromium/chrome/browser/extensions/api/web_request/web_request_apitest.cc75
-rw-r--r--chromium/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc8
-rw-r--r--chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc84
-rw-r--r--chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h25
-rw-r--r--chromium/chrome/browser/extensions/api/webrtc_desktop_capture_private/webrtc_desktop_capture_private_api.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc2
-rw-r--r--chromium/chrome/browser/flag-metadata.json822
-rw-r--r--chromium/chrome/browser/flag-never-expire-list.json66
-rw-r--r--chromium/chrome/browser/notifications/proto/BUILD.gn2
-rw-r--r--chromium/chrome/browser/notifications/scheduler/BUILD.gn75
-rw-r--r--chromium/chrome/browser/notifications/scheduler/test/BUILD.gn24
-rw-r--r--chromium/chrome/browser/printing/cloud_print/privet_notifications.cc3
-rw-r--r--chromium/chrome/browser/printing/pdf_to_emf_converter_browsertest.cc2
-rw-r--r--chromium/chrome/browser/printing/print_browsertest.cc56
-rw-r--r--chromium/chrome/browser/printing/print_preview_dialog_controller.cc10
-rw-r--r--chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc34
-rw-r--r--chromium/chrome/browser/printing/print_preview_dialog_controller_unittest.cc9
-rw-r--r--chromium/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc2
-rw-r--r--chromium/chrome/browser/printing/print_preview_test.cc4
-rw-r--r--chromium/chrome/browser/printing/print_preview_test.h2
-rw-r--r--chromium/chrome/browser/printing/printing_message_filter.cc17
-rw-r--r--chromium/chrome/browser/printing/printing_message_filter.h13
-rw-r--r--chromium/chrome/browser/printing/pwg_raster_converter_browsertest.cc2
-rw-r--r--chromium/chrome/browser/profiling_host/BUILD.gn1
-rw-r--r--chromium/chrome/browser/resource_coordinator/BUILD.gn15
-rw-r--r--chromium/chrome/browser/resource_coordinator/tab_ranker/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/BUILD.gn66
-rw-r--r--chromium/chrome/browser/resources/about_flash.html2
-rw-r--r--chromium/chrome/browser/resources/about_nacl/about_nacl.css (renamed from chromium/chrome/browser/resources/about_nacl.css)2
-rw-r--r--chromium/chrome/browser/resources/about_nacl/about_nacl.html (renamed from chromium/chrome/browser/resources/about_nacl.html)7
-rw-r--r--chromium/chrome/browser/resources/about_nacl/about_nacl.js (renamed from chromium/chrome/browser/resources/about_nacl.js)1
-rw-r--r--chromium/chrome/browser/resources/about_sys/about_sys.css11
-rw-r--r--chromium/chrome/browser/resources/about_sys/about_sys.html8
-rw-r--r--chromium/chrome/browser/resources/about_sys/about_sys.js2
-rw-r--r--chromium/chrome/browser/resources/accessibility/accessibility.html2
-rw-r--r--chromium/chrome/browser/resources/app_management/app.html1
-rw-r--r--chromium/chrome/browser/resources/app_management/app_item.html1
-rw-r--r--chromium/chrome/browser/resources/app_management/arc_permission_view.html24
-rw-r--r--chromium/chrome/browser/resources/app_management/chrome_app_permission_view.html7
-rw-r--r--chromium/chrome/browser/resources/app_management/expandable_app_list.html10
-rw-r--r--chromium/chrome/browser/resources/app_management/fake_page_handler.js6
-rw-r--r--chromium/chrome/browser/resources/app_management/main_view.html11
-rw-r--r--chromium/chrome/browser/resources/app_management/main_view.js3
-rw-r--r--chromium/chrome/browser/resources/app_management/notifications_view.html15
-rw-r--r--chromium/chrome/browser/resources/app_management/permission_item.html24
-rw-r--r--chromium/chrome/browser/resources/app_management/permission_item.js31
-rw-r--r--chromium/chrome/browser/resources/app_management/permission_view_header.html14
-rw-r--r--chromium/chrome/browser/resources/app_management/pwa_permission_view.html15
-rw-r--r--chromium/chrome/browser/resources/app_management/search_view.html6
-rw-r--r--chromium/chrome/browser/resources/autofill_internals/autofill_internals.html (renamed from chromium/chrome/browser/resources/autofill_internals.html)0
-rw-r--r--chromium/chrome/browser/resources/bookmarks/BUILD.gn10
-rw-r--r--chromium/chrome/browser/resources/bookmarks/app.html6
-rw-r--r--chromium/chrome/browser/resources/bookmarks/app.js5
-rw-r--r--chromium/chrome/browser/resources/bookmarks/command_manager.js16
-rw-r--r--chromium/chrome/browser/resources/bookmarks/folder_node.html28
-rw-r--r--chromium/chrome/browser/resources/bookmarks/folder_node.js10
-rw-r--r--chromium/chrome/browser/resources/bookmarks/images/folder.svg4
-rw-r--r--chromium/chrome/browser/resources/bookmarks/images/folder_open.svg4
-rw-r--r--chromium/chrome/browser/resources/bookmarks/item.html2
-rw-r--r--chromium/chrome/browser/resources/bookmarks/toast_manager.html36
-rw-r--r--chromium/chrome/browser/resources/bookmarks/toast_manager.js100
-rw-r--r--chromium/chrome/browser/resources/bookmarks/toolbar.html8
-rw-r--r--chromium/chrome/browser/resources/browser_switcher/OWNERS2
-rw-r--r--chromium/chrome/browser/resources/browser_switcher/app.js16
-rw-r--r--chromium/chrome/browser/resources/chromeos/BUILD.gn14
-rw-r--r--chromium/chrome/browser/resources/chromeos/braille_ime/BUILD.gn3
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/BUILD.gn197
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/_locales/en/messages.json28
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/manifest.json2
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd25
-rw-r--r--chromium/chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd25
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn134
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni3
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd56
-rw-r--r--chromium/chrome/browser/resources/chromeos/echo/manifest.json13
-rw-r--r--chromium/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json3
-rw-r--r--chromium/chrome/browser/resources/chromeos/kiosk_next_home/BUILD.gn13
-rw-r--r--chromium/chrome/browser/resources/chromeos/kiosk_next_home/kiosk_next_resources.grdp1
-rw-r--r--chromium/chrome/browser/resources/chromeos/kiosk_next_home/manifest.json6
-rw-r--r--chromium/chrome/browser/resources/chromeos/login/BUILD.gn288
-rw-r--r--chromium/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn30
-rw-r--r--chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn30
-rw-r--r--chromium/chrome/browser/resources/conflicts/about_conflicts.html11
-rw-r--r--chromium/chrome/browser/resources/device_log_ui/device_log_ui.html4
-rw-r--r--chromium/chrome/browser/resources/discards/generate_graph_tab.py3
-rw-r--r--chromium/chrome/browser/resources/discards/graph_doc.js152
-rw-r--r--chromium/chrome/browser/resources/domain_reliability_internals/domain_reliability_internals.css (renamed from chromium/chrome/browser/resources/domain_reliability_internals.css)0
-rw-r--r--chromium/chrome/browser/resources/domain_reliability_internals/domain_reliability_internals.html (renamed from chromium/chrome/browser/resources/domain_reliability_internals.html)2
-rw-r--r--chromium/chrome/browser/resources/domain_reliability_internals/domain_reliability_internals.js (renamed from chromium/chrome/browser/resources/domain_reliability_internals.js)0
-rw-r--r--chromium/chrome/browser/resources/download_internals/BUILD.gn1
-rw-r--r--chromium/chrome/browser/resources/download_internals/download_internals.html2
-rw-r--r--chromium/chrome/browser/resources/downloads/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/downloads/images/incognito_marker.svg2
-rw-r--r--chromium/chrome/browser/resources/downloads/images/no_downloads.svg2
-rw-r--r--chromium/chrome/browser/resources/downloads/item.html44
-rw-r--r--chromium/chrome/browser/resources/downloads/manager.html3
-rw-r--r--chromium/chrome/browser/resources/downloads/manager.js15
-rw-r--r--chromium/chrome/browser/resources/downloads/toolbar.html26
-rw-r--r--chromium/chrome/browser/resources/downloads/toolbar.js2
-rw-r--r--chromium/chrome/browser/resources/eoc_internals/BUILD.gn6
-rw-r--r--chromium/chrome/browser/resources/eoc_internals/eoc_internals.html4
-rw-r--r--chromium/chrome/browser/resources/eoc_internals/eoc_internals.js16
-rw-r--r--chromium/chrome/browser/resources/extensions/BUILD.gn (renamed from chromium/chrome/browser/resources/md_extensions/BUILD.gn)2
-rw-r--r--chromium/chrome/browser/resources/extensions/OWNERS (renamed from chromium/chrome/browser/resources/md_extensions/OWNERS)0
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/BUILD.gn (renamed from chromium/chrome/browser/resources/md_extensions/activity_log/BUILD.gn)5
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log.html (renamed from chromium/chrome/browser/resources/md_extensions/activity_log/activity_log.html)43
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log.js (renamed from chromium/chrome/browser/resources/md_extensions/activity_log/activity_log.js)22
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log_history.html (renamed from chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history.html)49
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log_history.js (renamed from chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history.js)67
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log_history_item.html (renamed from chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.html)47
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log_history_item.js (renamed from chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.js)11
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream.html (renamed from chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream.html)46
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream.js (renamed from chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream.js)98
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream_item.html132
-rw-r--r--chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream_item.js162
-rw-r--r--chromium/chrome/browser/resources/extensions/code_section.html (renamed from chromium/chrome/browser/resources/md_extensions/code_section.html)42
-rw-r--r--chromium/chrome/browser/resources/extensions/code_section.js (renamed from chromium/chrome/browser/resources/md_extensions/code_section.js)16
-rw-r--r--chromium/chrome/browser/resources/extensions/detail_view.html (renamed from chromium/chrome/browser/resources/md_extensions/detail_view.html)9
-rw-r--r--chromium/chrome/browser/resources/extensions/detail_view.js (renamed from chromium/chrome/browser/resources/md_extensions/detail_view.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/drag_and_drop_handler.html (renamed from chromium/chrome/browser/resources/md_extensions/drag_and_drop_handler.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/drag_and_drop_handler.js (renamed from chromium/chrome/browser/resources/md_extensions/drag_and_drop_handler.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/drop_overlay.html (renamed from chromium/chrome/browser/resources/md_extensions/drop_overlay.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/drop_overlay.js (renamed from chromium/chrome/browser/resources/md_extensions/drop_overlay.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/error_page.html (renamed from chromium/chrome/browser/resources/md_extensions/error_page.html)27
-rw-r--r--chromium/chrome/browser/resources/extensions/error_page.js (renamed from chromium/chrome/browser/resources/md_extensions/error_page.js)3
-rw-r--r--chromium/chrome/browser/resources/extensions/extensions.html (renamed from chromium/chrome/browser/resources/md_extensions/extensions.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/extensions_resources.grd (renamed from chromium/chrome/browser/resources/md_extensions/extensions_resources.grd)142
-rw-r--r--chromium/chrome/browser/resources/extensions/extensions_resources_vulcanized.grd37
-rw-r--r--chromium/chrome/browser/resources/extensions/host_permissions_toggle_list.html (renamed from chromium/chrome/browser/resources/md_extensions/host_permissions_toggle_list.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/host_permissions_toggle_list.js (renamed from chromium/chrome/browser/resources/md_extensions/host_permissions_toggle_list.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/icons.html (renamed from chromium/chrome/browser/resources/md_extensions/icons.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/install_warnings_dialog.html (renamed from chromium/chrome/browser/resources/md_extensions/install_warnings_dialog.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/install_warnings_dialog.js (renamed from chromium/chrome/browser/resources/md_extensions/install_warnings_dialog.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/item.html (renamed from chromium/chrome/browser/resources/md_extensions/item.html)13
-rw-r--r--chromium/chrome/browser/resources/extensions/item.js (renamed from chromium/chrome/browser/resources/md_extensions/item.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/item_behavior.html (renamed from chromium/chrome/browser/resources/md_extensions/item_behavior.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/item_behavior.js (renamed from chromium/chrome/browser/resources/md_extensions/item_behavior.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/item_list.html (renamed from chromium/chrome/browser/resources/md_extensions/item_list.html)2
-rw-r--r--chromium/chrome/browser/resources/extensions/item_list.js (renamed from chromium/chrome/browser/resources/md_extensions/item_list.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/item_util.html (renamed from chromium/chrome/browser/resources/md_extensions/item_util.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/item_util.js (renamed from chromium/chrome/browser/resources/md_extensions/item_util.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/keyboard_shortcuts.html (renamed from chromium/chrome/browser/resources/md_extensions/keyboard_shortcuts.html)2
-rw-r--r--chromium/chrome/browser/resources/extensions/keyboard_shortcuts.js (renamed from chromium/chrome/browser/resources/md_extensions/keyboard_shortcuts.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/kiosk_browser_proxy.html (renamed from chromium/chrome/browser/resources/md_extensions/kiosk_browser_proxy.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/kiosk_browser_proxy.js (renamed from chromium/chrome/browser/resources/md_extensions/kiosk_browser_proxy.js)1
-rw-r--r--chromium/chrome/browser/resources/extensions/kiosk_dialog.html (renamed from chromium/chrome/browser/resources/md_extensions/kiosk_dialog.html)13
-rw-r--r--chromium/chrome/browser/resources/extensions/kiosk_dialog.js (renamed from chromium/chrome/browser/resources/md_extensions/kiosk_dialog.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/load_error.html (renamed from chromium/chrome/browser/resources/md_extensions/load_error.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/load_error.js (renamed from chromium/chrome/browser/resources/md_extensions/load_error.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/manager.html (renamed from chromium/chrome/browser/resources/md_extensions/manager.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/manager.js (renamed from chromium/chrome/browser/resources/md_extensions/manager.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/navigation_helper.html (renamed from chromium/chrome/browser/resources/md_extensions/navigation_helper.html)2
-rw-r--r--chromium/chrome/browser/resources/extensions/navigation_helper.js (renamed from chromium/chrome/browser/resources/md_extensions/navigation_helper.js)8
-rw-r--r--chromium/chrome/browser/resources/extensions/options_dialog.html (renamed from chromium/chrome/browser/resources/md_extensions/options_dialog.html)24
-rw-r--r--chromium/chrome/browser/resources/extensions/options_dialog.js (renamed from chromium/chrome/browser/resources/md_extensions/options_dialog.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/pack_dialog.html (renamed from chromium/chrome/browser/resources/md_extensions/pack_dialog.html)3
-rw-r--r--chromium/chrome/browser/resources/extensions/pack_dialog.js (renamed from chromium/chrome/browser/resources/md_extensions/pack_dialog.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/pack_dialog_alert.html (renamed from chromium/chrome/browser/resources/md_extensions/pack_dialog_alert.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/pack_dialog_alert.js (renamed from chromium/chrome/browser/resources/md_extensions/pack_dialog_alert.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/runtime_host_permissions.html (renamed from chromium/chrome/browser/resources/md_extensions/runtime_host_permissions.html)14
-rw-r--r--chromium/chrome/browser/resources/extensions/runtime_host_permissions.js (renamed from chromium/chrome/browser/resources/md_extensions/runtime_host_permissions.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/runtime_hosts_dialog.html (renamed from chromium/chrome/browser/resources/md_extensions/runtime_hosts_dialog.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/runtime_hosts_dialog.js (renamed from chromium/chrome/browser/resources/md_extensions/runtime_hosts_dialog.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/service.html (renamed from chromium/chrome/browser/resources/md_extensions/service.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/service.js (renamed from chromium/chrome/browser/resources/md_extensions/service.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/shared_style.html (renamed from chromium/chrome/browser/resources/md_extensions/shared_style.html)11
-rw-r--r--chromium/chrome/browser/resources/extensions/shared_vars.html (renamed from chromium/chrome/browser/resources/md_extensions/shared_vars.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/shortcut_input.html (renamed from chromium/chrome/browser/resources/md_extensions/shortcut_input.html)16
-rw-r--r--chromium/chrome/browser/resources/extensions/shortcut_input.js (renamed from chromium/chrome/browser/resources/md_extensions/shortcut_input.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/shortcut_util.html (renamed from chromium/chrome/browser/resources/md_extensions/shortcut_util.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/shortcut_util.js (renamed from chromium/chrome/browser/resources/md_extensions/shortcut_util.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/sidebar.html (renamed from chromium/chrome/browser/resources/md_extensions/sidebar.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/sidebar.js (renamed from chromium/chrome/browser/resources/md_extensions/sidebar.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/strings.html (renamed from chromium/chrome/browser/resources/md_extensions/strings.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/toggle_row.html (renamed from chromium/chrome/browser/resources/md_extensions/toggle_row.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/toggle_row.js (renamed from chromium/chrome/browser/resources/md_extensions/toggle_row.js)0
-rw-r--r--chromium/chrome/browser/resources/extensions/toolbar.html (renamed from chromium/chrome/browser/resources/md_extensions/toolbar.html)0
-rw-r--r--chromium/chrome/browser/resources/extensions/toolbar.js (renamed from chromium/chrome/browser/resources/md_extensions/toolbar.js)0
-rw-r--r--chromium/chrome/browser/resources/feed_internals/feed_internals.css4
-rw-r--r--chromium/chrome/browser/resources/feed_internals/feed_internals.html43
-rw-r--r--chromium/chrome/browser/resources/feed_internals/feed_internals.js47
-rw-r--r--chromium/chrome/browser/resources/feedback/OWNERS1
-rw-r--r--chromium/chrome/browser/resources/feedback/css/feedback.css15
-rw-r--r--chromium/chrome/browser/resources/feedback/html/default.html12
-rw-r--r--chromium/chrome/browser/resources/feedback/js/event_handler.js8
-rw-r--r--chromium/chrome/browser/resources/feedback/js/feedback.js64
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/OWNERS4
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/authenticator.js11
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js167
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/post_message_channel.js3
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/saml_handler.js97
-rw-r--r--chromium/chrome/browser/resources/hangout_services/manifest.json2
-rw-r--r--chromium/chrome/browser/resources/hangout_services/thunk.js5
-rw-r--r--chromium/chrome/browser/resources/history/history_item.html52
-rw-r--r--chromium/chrome/browser/resources/history/history_item.js4
-rw-r--r--chromium/chrome/browser/resources/history/images/sign_in_promo.svg2
-rw-r--r--chromium/chrome/browser/resources/history/images/sign_in_promo_dark.svg2
-rw-r--r--chromium/chrome/browser/resources/history/lazy_load.html2
-rw-r--r--chromium/chrome/browser/resources/history/shared_style.html20
-rw-r--r--chromium/chrome/browser/resources/history/side_bar.html2
-rw-r--r--chromium/chrome/browser/resources/history/synced_device_card.html25
-rw-r--r--chromium/chrome/browser/resources/history/synced_device_card.js2
-rw-r--r--chromium/chrome/browser/resources/identity_internals/identity_internals.css (renamed from chromium/chrome/browser/resources/identity_internals.css)0
-rw-r--r--chromium/chrome/browser/resources/identity_internals/identity_internals.html (renamed from chromium/chrome/browser/resources/identity_internals.html)0
-rw-r--r--chromium/chrome/browser/resources/identity_internals/identity_internals.js (renamed from chromium/chrome/browser/resources/identity_internals.js)0
-rw-r--r--chromium/chrome/browser/resources/inline_login/inline_login.css3
-rw-r--r--chromium/chrome/browser/resources/inline_login/inline_login.html5
-rw-r--r--chromium/chrome/browser/resources/inline_login/inline_login.js9
-rw-r--r--chromium/chrome/browser/resources/local_ntp/BUILD.gn28
-rw-r--r--chromium/chrome/browser/resources/local_ntp/animations.css3
-rw-r--r--chromium/chrome/browser/resources/local_ntp/custom_backgrounds.css41
-rw-r--r--chromium/chrome/browser/resources/local_ntp/custom_backgrounds.js147
-rw-r--r--chromium/chrome/browser/resources/local_ntp/custom_links_edit.css4
-rw-r--r--chromium/chrome/browser/resources/local_ntp/custom_links_edit.js4
-rw-r--r--chromium/chrome/browser/resources/local_ntp/doodles.js24
-rw-r--r--chromium/chrome/browser/resources/local_ntp/externs.js382
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/add.svg7
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/add_link.svg7
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/add_link_white.svg7
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/chrome.svg9
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/close.svg2
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/copy.svg2
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/edit_menu.svg8
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/facebook.svg13
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/googlemic_clr_24px.svg8
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/icon_pencil.svg5
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/link.svg7
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/link_gray.svg7
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/mail.svg12
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/twitter.svg13
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/upload.svg7
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/wallpapers.svg59
-rw-r--r--chromium/chrome/browser/resources/local_ntp/local_ntp.css143
-rw-r--r--chromium/chrome/browser/resources/local_ntp/local_ntp.html26
-rw-r--r--chromium/chrome/browser/resources/local_ntp/local_ntp.js159
-rw-r--r--chromium/chrome/browser/resources/local_ntp/most_visited_single.css4
-rw-r--r--chromium/chrome/browser/resources/local_ntp/most_visited_single.js65
-rw-r--r--chromium/chrome/browser/resources/local_ntp/most_visited_util.js15
-rw-r--r--chromium/chrome/browser/resources/local_ntp/utils.js2
-rw-r--r--chromium/chrome/browser/resources/local_ntp/voice.css6
-rw-r--r--chromium/chrome/browser/resources/local_ntp/voice.js53
-rw-r--r--chromium/chrome/browser/resources/management/management.html3
-rw-r--r--chromium/chrome/browser/resources/management/management_browser_proxy.js45
-rw-r--r--chromium/chrome/browser/resources/management/management_ui.html337
-rw-r--r--chromium/chrome/browser/resources/management/management_ui.js85
-rw-r--r--chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream_item.html102
-rw-r--r--chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream_item.js98
-rw-r--r--chromium/chrome/browser/resources/md_extensions/extensions_resources_vulcanized.grd20
-rw-r--r--chromium/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.html7
-rw-r--r--chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.css8
-rw-r--r--chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.html14
-rw-r--r--chromium/chrome/browser/resources/media_router/elements/route_controls/route_controls.html16
-rw-r--r--chromium/chrome/browser/resources/media_router/media_router_common.css5
-rw-r--r--chromium/chrome/browser/resources/memory_internals/memory_internals.html (renamed from chromium/chrome/browser/resources/memory_internals.html)2
-rw-r--r--chromium/chrome/browser/resources/memory_internals/memory_internals.js (renamed from chromium/chrome/browser/resources/memory_internals.js)0
-rw-r--r--chromium/chrome/browser/resources/net_internals/index.html2
-rw-r--r--chromium/chrome/browser/resources/ntp4/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/ntp4/apps_page.js37
-rw-r--r--chromium/chrome/browser/resources/ntp4/guest_tab.html2
-rw-r--r--chromium/chrome/browser/resources/ntp4/incognito_and_guest_tab.css12
-rw-r--r--chromium/chrome/browser/resources/ntp4/incognito_tab.css3
-rw-r--r--chromium/chrome/browser/resources/ntp4/incognito_tab.js5
-rw-r--r--chromium/chrome/browser/resources/ntp4/nav_dot.css5
-rw-r--r--chromium/chrome/browser/resources/ntp4/new_tab.html3
-rw-r--r--chromium/chrome/browser/resources/ntp4/new_tab.js3
-rw-r--r--chromium/chrome/browser/resources/ntp4/new_tab_theme.css27
-rw-r--r--chromium/chrome/browser/resources/omnibox/omnibox_output.js21
-rw-r--r--chromium/chrome/browser/resources/page_not_available_for_guest/app.html10
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/shared-vars.html6
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html17
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js2
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html75
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/viewer-pen-options.html24
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.html38
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js4
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.html20
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js33
-rw-r--r--chromium/chrome/browser/resources/pdf/index.html2
-rw-r--r--chromium/chrome/browser/resources/pdf/ink/BUILD.gn11
-rw-r--r--chromium/chrome/browser/resources/pdf/main.js14
-rw-r--r--chromium/chrome/browser/resources/pdf/pdf_scripting_api.js16
-rw-r--r--chromium/chrome/browser/resources/pdf/pdf_viewer.js56
-rw-r--r--chromium/chrome/browser/resources/pdf/toolbar_manager.js23
-rw-r--r--chromium/chrome/browser/resources/plugin_metadata/plugins_linux.json6
-rw-r--r--chromium/chrome/browser/resources/plugin_metadata/plugins_mac.json6
-rw-r--r--chromium/chrome/browser/resources/plugin_metadata/plugins_win.json6
-rw-r--r--chromium/chrome/browser/resources/print_preview/BUILD.gn5
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/destination.js65
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/destination_store.js56
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/invitation_store.js5
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/user_info.js19
-rw-r--r--chromium/chrome/browser/resources/print_preview/icons.html14
-rw-r--r--chromium/chrome/browser/resources/print_preview/native_layer.js10
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/BUILD.gn91
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.html3
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.js5
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/advanced_settings_item.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/app.html181
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/app.js516
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/button_strip.html53
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/button_strip.js86
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/destination_dialog.html27
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/destination_dialog.js15
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/destination_list.html4
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/destination_list_item.html8
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/destination_select.html10
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/destination_select.js27
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/destination_settings.html36
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/destination_settings.js439
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/dpi_settings.js13
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/duplex_settings.html71
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/duplex_settings.js88
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/header.html11
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/header.js28
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/header_new.html65
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/header_new.js159
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/link_container.html46
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/link_container.js1
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/margin_control.html18
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/margin_control_container.js5
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/media_size_settings.js13
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/model.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/model.js880
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/more_settings.html7
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/other_options_settings.js13
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.html1
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.js2
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/pages_settings.js8
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/pin_settings.html65
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/pin_settings.js164
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/plugin_proxy.js9
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/preview_area.html17
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/preview_area.js428
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/print_preview_search_box.html7
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/print_preview_shared_css.html25
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/print_preview_sidebar.html207
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/print_preview_sidebar.js180
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/provisional_destination_resolver.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/scaling_settings.html1
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/scaling_settings.js34
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/select_behavior.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/settings_behavior.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/settings_behavior.js55
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/settings_section.html4
-rw-r--r--chromium/chrome/browser/resources/print_preview/new/state.js44
-rw-r--r--chromium/chrome/browser/resources/print_preview/print_preview_new.html49
-rw-r--r--chromium/chrome/browser/resources/print_preview/print_preview_resources.grd47
-rw-r--r--chromium/chrome/browser/resources/print_preview/print_preview_utils.html4
-rw-r--r--chromium/chrome/browser/resources/print_preview/print_preview_utils.js23
-rw-r--r--chromium/chrome/browser/resources/quota_internals/main.html2
-rw-r--r--chromium/chrome/browser/resources/reset_password/BUILD.gn6
-rw-r--r--chromium/chrome/browser/resources/reset_password/reset_password.html4
-rw-r--r--chromium/chrome/browser/resources/reset_password/reset_password.js6
-rw-r--r--chromium/chrome/browser/resources/safe_browsing/download_file_types.asciipb99
-rw-r--r--chromium/chrome/browser/resources/settings/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/settings/a11y_page/a11y_page.html25
-rw-r--r--chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html57
-rw-r--r--chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.js38
-rw-r--r--chromium/chrome/browser/resources/settings/a11y_page/tts_subpage.html13
-rw-r--r--chromium/chrome/browser/resources/settings/about_page/about_page.html46
-rw-r--r--chromium/chrome/browser/resources/settings/about_page/about_page.js17
-rw-r--r--chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.html15
-rw-r--r--chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.js2
-rw-r--r--chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.html9
-rw-r--r--chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.js2
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html24
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/autofill_page.html3
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/autofill_section.html15
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js2
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.html3
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/credit_card_list_entry.html18
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html22
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html31
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html24
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/passwords_shared_css.html4
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/payments_section.html21
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/payments_section.js137
-rw-r--r--chromium/chrome/browser/resources/settings/basic_page/basic_page.html13
-rw-r--r--chromium/chrome/browser/resources/settings/basic_page/basic_page.js2
-rw-r--r--chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.html10
-rw-r--r--chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html12
-rw-r--r--chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js2
-rw-r--r--chromium/chrome/browser/resources/settings/change_password_page/change_password_page.html4
-rw-r--r--chromium/chrome/browser/resources/settings/chrome_cleanup_page/items_to_remove_list.html2
-rw-r--r--chromium/chrome/browser/resources/settings/chromeos/BUILD.gn74
-rw-r--r--chromium/chrome/browser/resources/settings/chromeos/os_settings_main/BUILD.gn25
-rw-r--r--chromium/chrome/browser/resources/settings/chromeos/os_settings_menu/BUILD.gn19
-rw-r--r--chromium/chrome/browser/resources/settings/chromeos/os_settings_page/BUILD.gn26
-rw-r--r--chromium/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn27
-rw-r--r--chromium/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html5
-rw-r--r--chromium/chrome/browser/resources/settings/controls/controlled_radio_button.html15
-rw-r--r--chromium/chrome/browser/resources/settings/controls/settings_checkbox.html7
-rw-r--r--chromium/chrome/browser/resources/settings/controls/settings_checkbox.js10
-rw-r--r--chromium/chrome/browser/resources/settings/controls/settings_slider.html4
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/BUILD.gn10
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_browser_proxy.js39
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_export_import.html28
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_export_import.js23
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_page.html21
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_page.js17
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.html9
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.js35
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.html30
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.js40
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.html44
-rw-r--r--chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.js22
-rw-r--r--chromium/chrome/browser/resources/settings/date_time_page/date_time_page.html34
-rw-r--r--chromium/chrome/browser/resources/settings/date_time_page/date_time_page.js35
-rw-r--r--chromium/chrome/browser/resources/settings/default_browser_page/default_browser_browser_proxy.js3
-rw-r--r--chromium/chrome/browser/resources/settings/default_browser_page/default_browser_page.js3
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/device_page.html1
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/display.html7
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/display.js2
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/keyboard.html20
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/pointers.html7
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/storage.html86
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/storage.js10
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/stylus.html26
-rw-r--r--chromium/chrome/browser/resources/settings/downloads_page/downloads_page.html10
-rw-r--r--chromium/chrome/browser/resources/settings/downloads_page/downloads_page.js4
-rw-r--r--chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html30
-rw-r--r--chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js6
-rw-r--r--chromium/chrome/browser/resources/settings/icons.html1
-rw-r--r--chromium/chrome/browser/resources/settings/images/settings_icon_add_circle.svg2
-rw-r--r--chromium/chrome/browser/resources/settings/images/settings_icon_add_wifi.svg2
-rw-r--r--chromium/chrome/browser/resources/settings/images/sync_banner.svg2
-rw-r--r--chromium/chrome/browser/resources/settings/images/sync_banner_dark.svg2
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/OWNERS1
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html66
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js208
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.html43
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.js13
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_page.html29
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_page.js39
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_shared_css.html6
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_subpage.html55
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_subpage.js2
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/network_summary_item.html15
-rw-r--r--chromium/chrome/browser/resources/settings/kiosk_next_shell_page/BUILD.gn4
-rw-r--r--chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.html9
-rw-r--r--chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.js35
-rw-r--r--chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.html6
-rw-r--r--chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.js17
-rw-r--r--chromium/chrome/browser/resources/settings/languages_page/add_languages_dialog.html2
-rw-r--r--chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html8
-rw-r--r--chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.js6
-rw-r--r--chromium/chrome/browser/resources/settings/languages_page/languages.js44
-rw-r--r--chromium/chrome/browser/resources/settings/languages_page/languages_page.html261
-rw-r--r--chromium/chrome/browser/resources/settings/languages_page/languages_page.js210
-rw-r--r--chromium/chrome/browser/resources/settings/multidevice_page/multidevice_feature_item.html13
-rw-r--r--chromium/chrome/browser/resources/settings/multidevice_page/multidevice_page.html9
-rw-r--r--chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.html25
-rw-r--r--chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.js11
-rw-r--r--chromium/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html10
-rw-r--r--chromium/chrome/browser/resources/settings/os_settings_resources.grd1465
-rw-r--r--chromium/chrome/browser/resources/settings/os_settings_resources_vulcanized.grd58
-rw-r--r--chromium/chrome/browser/resources/settings/page_visibility.js24
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/account_manager.html37
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/account_manager.js24
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/account_manager_browser_proxy.js1
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/fingerprint_browser_proxy.js10
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/fingerprint_list.html11
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/fingerprint_list.js8
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/import_data_dialog.html3
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/lock_screen.html7
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/lock_screen.js11
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/manage_profile.html2
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/people_page.html84
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/people_page.js42
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/settings_icon_camera_alt.svg2
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/setup_fingerprint_dialog.js11
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/signout_dialog.html3
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/sync_account_control.html19
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/sync_browser_proxy.js2
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/sync_controls.html3
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/sync_page.html43
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/sync_page.js99
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/user_list.html14
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html7
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js59
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/users_page.html9
-rw-r--r--chromium/chrome/browser/resources/settings/plugin_vm_page/BUILD.gn28
-rw-r--r--chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_page.html36
-rw-r--r--chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_page.js39
-rw-r--r--chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_subpage.html14
-rw-r--r--chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_subpage.js22
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/BUILD.gn13
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cloud_printers.html8
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html15
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js103
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_elements.html6
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_util.html2
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html55
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.js209
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.html (renamed from chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial_proxy.html)2
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.js (renamed from chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_util.js)13
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printer_shared_css.html6
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers.js101
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_browser_proxy.js12
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_list.html8
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_set_manufacturer_model_behavior.html1
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_set_manufacturer_model_behavior.js123
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/printing_page.html1
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/BUILD.gn37
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/personalization_options.html2
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/personalization_options.js15
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/privacy_page.html151
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/privacy_page.js44
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_browser_proxy.html1
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_browser_proxy.js89
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.html59
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.js130
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.html107
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.js343
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_subpage.html39
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_subpage.js46
-rw-r--r--chromium/chrome/browser/resources/settings/reset_page/reset_page.html1
-rw-r--r--chromium/chrome/browser/resources/settings/route.js24
-rw-r--r--chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.html10
-rw-r--r--chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.js2
-rw-r--r--chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html10
-rw-r--r--chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js4
-rw-r--r--chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry_css.html5
-rw-r--r--chromium/chrome/browser/resources/settings/search_engines_page/search_engines_list.html7
-rw-r--r--chromium/chrome/browser/resources/settings/search_engines_page/search_engines_page.html4
-rw-r--r--chromium/chrome/browser/resources/settings/search_page/search_page.html10
-rw-r--r--chromium/chrome/browser/resources/settings/search_page/search_page.js2
-rw-r--r--chromium/chrome/browser/resources/settings/search_settings.js2
-rw-r--r--chromium/chrome/browser/resources/settings/settings_icons_css.html4
-rw-r--r--chromium/chrome/browser/resources/settings/settings_main/settings_main.html6
-rw-r--r--chromium/chrome/browser/resources/settings/settings_main/settings_main.js5
-rw-r--r--chromium/chrome/browser/resources/settings/settings_menu/settings_menu.html9
-rw-r--r--chromium/chrome/browser/resources/settings/settings_menu/settings_menu.js2
-rw-r--r--chromium/chrome/browser/resources/settings/settings_page/settings_subpage.html10
-rw-r--r--chromium/chrome/browser/resources/settings/settings_resources.grd58
-rw-r--r--chromium/chrome/browser/resources/settings/settings_resources_vulcanized.grd14
-rw-r--r--chromium/chrome/browser/resources/settings/settings_shared_css.html30
-rw-r--r--chromium/chrome/browser/resources/settings/settings_ui/settings_ui.html2
-rw-r--r--chromium/chrome/browser/resources/settings/settings_ui/settings_ui.js30
-rw-r--r--chromium/chrome/browser/resources/settings/settings_vars_css.html12
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/all_sites.html8
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/category_default_setting.js1
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/chooser_exception_list.js4
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/constants.js2
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/cookie_info.js4
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/protocol_handlers.html27
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_data.html1
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_data.js3
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_data_details_subpage.html7
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_data_entry.html17
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_details.html21
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_details.js8
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_details_permission.js10
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_entry.html42
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_entry.js2
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_list_entry.html34
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_settings_behavior.js6
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/zoom_levels.html10
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.html35
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.js16
-rw-r--r--chromium/chrome/browser/resources/settings/system_page/system_page.html9
-rw-r--r--chromium/chrome/browser/resources/signin/dice_sync_confirmation/images/sync_confirmation_illustration.svg2
-rw-r--r--chromium/chrome/browser/resources/signin/dice_sync_confirmation/images/sync_confirmation_illustration_dark.svg1
-rw-r--r--chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation.html13
-rw-r--r--chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation_app.html15
-rw-r--r--chromium/chrome/browser/resources/signin/signin_shared_css.html10
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.css322
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.html322
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.js2
-rw-r--r--chromium/chrome/browser/resources/snippets_internals/BUILD.gn7
-rw-r--r--chromium/chrome/browser/resources/snippets_internals/snippets_internals.html19
-rw-r--r--chromium/chrome/browser/resources/snippets_internals/snippets_internals.js48
-rw-r--r--chromium/chrome/browser/resources/supervised_user_internals/supervised_user_internals.css (renamed from chromium/chrome/browser/resources/supervised_user_internals.css)4
-rw-r--r--chromium/chrome/browser/resources/supervised_user_internals/supervised_user_internals.html (renamed from chromium/chrome/browser/resources/supervised_user_internals.html)1
-rw-r--r--chromium/chrome/browser/resources/supervised_user_internals/supervised_user_internals.js (renamed from chromium/chrome/browser/resources/supervised_user_internals.js)2
-rw-r--r--chromium/chrome/browser/resources/sync_file_system_internals/main.html2
-rw-r--r--chromium/chrome/browser/resources/translate_internals/OWNERS1
-rw-r--r--chromium/chrome/browser/resources/translate_internals/detection_logs.html34
-rw-r--r--chromium/chrome/browser/resources/translate_internals/error_logs.html18
-rw-r--r--chromium/chrome/browser/resources/translate_internals/event_logs.html18
-rw-r--r--chromium/chrome/browser/resources/translate_internals/prefs.html52
-rw-r--r--chromium/chrome/browser/resources/translate_internals/translate_internals.css144
-rw-r--r--chromium/chrome/browser/resources/translate_internals/translate_internals.html65
-rw-r--r--chromium/chrome/browser/resources/translate_internals/translate_internals.js529
-rw-r--r--chromium/chrome/browser/resources/translate_internals/translate_internals_resources.grd15
-rwxr-xr-xchromium/chrome/browser/resources/unpack_pak.py36
-rwxr-xr-xchromium/chrome/browser/resources/unpack_pak_test.py7
-rw-r--r--chromium/chrome/browser/resources/usb_internals/BUILD.gn9
-rw-r--r--chromium/chrome/browser/resources/usb_internals/descriptor_panel.js1261
-rw-r--r--chromium/chrome/browser/resources/usb_internals/devices_page.js382
-rw-r--r--chromium/chrome/browser/resources/usb_internals/usb_internals.css102
-rw-r--r--chromium/chrome/browser/resources/usb_internals/usb_internals.html59
-rw-r--r--chromium/chrome/browser/resources/usb_internals/usb_internals.js40
-rw-r--r--chromium/chrome/browser/resources/user_manager/BUILD.gn (renamed from chromium/chrome/browser/resources/md_user_manager/BUILD.gn)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/OWNERS (renamed from chromium/chrome/browser/resources/md_user_manager/OWNERS)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/control_bar.html (renamed from chromium/chrome/browser/resources/md_user_manager/control_bar.html)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/control_bar.js (renamed from chromium/chrome/browser/resources/md_user_manager/control_bar.js)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/create_profile.html (renamed from chromium/chrome/browser/resources/md_user_manager/create_profile.html)7
-rw-r--r--chromium/chrome/browser/resources/user_manager/create_profile.js (renamed from chromium/chrome/browser/resources/md_user_manager/create_profile.js)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/error_dialog.html (renamed from chromium/chrome/browser/resources/md_user_manager/error_dialog.html)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/error_dialog.js (renamed from chromium/chrome/browser/resources/md_user_manager/error_dialog.js)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/profile_browser_proxy.html (renamed from chromium/chrome/browser/resources/md_user_manager/profile_browser_proxy.html)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/profile_browser_proxy.js (renamed from chromium/chrome/browser/resources/md_user_manager/profile_browser_proxy.js)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/shared_styles.html (renamed from chromium/chrome/browser/resources/md_user_manager/shared_styles.html)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/strings.html (renamed from chromium/chrome/browser/resources/md_user_manager/strings.html)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/user_manager.html (renamed from chromium/chrome/browser/resources/md_user_manager/user_manager.html)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/user_manager.js (renamed from chromium/chrome/browser/resources/md_user_manager/user_manager.js)3
-rw-r--r--chromium/chrome/browser/resources/user_manager/user_manager_pages.html (renamed from chromium/chrome/browser/resources/md_user_manager/user_manager_pages.html)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/user_manager_pages.js (renamed from chromium/chrome/browser/resources/md_user_manager/user_manager_pages.js)2
-rw-r--r--chromium/chrome/browser/resources/user_manager/user_manager_tutorial.html (renamed from chromium/chrome/browser/resources/md_user_manager/user_manager_tutorial.html)0
-rw-r--r--chromium/chrome/browser/resources/user_manager/user_manager_tutorial.js (renamed from chromium/chrome/browser/resources/md_user_manager/user_manager_tutorial.js)0
-rw-r--r--chromium/chrome/browser/resources/welcome/OWNERS1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/BUILD.gn21
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/email/BUILD.gn34
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/email/email_app_proxy.html4
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/email/email_app_proxy.js42
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/email/nux_email.html43
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/email/nux_email.js33
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial.html58
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial.js76
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial_proxy.js75
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.html10
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/aol_1x.pngbin1883 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/aol_2x.pngbin4312 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/blue_circle.svg4
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/green_rectangle.svg4
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_oval.svg4
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_rounded_rectangle.svg4
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/red_triangle.svg4
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_dots.svg47
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_semicircle.svg4
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/chrome_store_1x.pngbin1156 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/chrome_store_2x.pngbin2281 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/email_provider_1x.pngbin1107 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/email_provider_2x.pngbin1956 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/google_apps_1x.pngbin1154 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/google_apps_2x.pngbin2207 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/icloud_1x.pngbin2075 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/icloud_2x.pngbin5289 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/google_dark.svg1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/google_light.svg1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/set_default_dark.svg1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/set_default_light.svg1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/wallpaper_dark.svg1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/wallpaper_light.svg1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/ntp_background_1x.pngbin1408 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/ntp_background_2x.pngbin2761 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/outlook_1x.pngbin1756 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/outlook_2x.pngbin3940 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_1x.pngbin1361 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_2x.pngbin2662 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_illustration_1x.pngbin6170 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_illustration_2x.pngbin13117 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_default_dark.svg1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_default_light.svg1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/yahoo_1x.pngbin385 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/images/yahoo_2x.pngbin739 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.html26
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.js14
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/navigation_behavior.html2
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/ntp_background_proxy.js33
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.html113
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.js36
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/onboarding_welcome_resources.grd293
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/BUILD.gn1
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.html29
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.js8
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default_proxy.js3
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/action_link_style_css.html4
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/animations_css.html39
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/app_chooser.html129
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/chooser_shared_css.html104
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/module_metrics_proxy.js38
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/navi_colors_css.html53
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/nux_types.js2
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/onboarding_background.html64
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/splash_pages_shared_css.html11
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/step_indicator.html10
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.html11
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.js31
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome.html11
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.html14
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.js70
-rw-r--r--chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_browser_proxy.js10
-rw-r--r--chromium/chrome/browser/safe_browsing/BUILD.gn11
-rw-r--r--chromium/chrome/browser/security_events/BUILD.gn19
-rw-r--r--chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc2
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc12
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.h3
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_factory.cc2
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc134
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.h34
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc65
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.h5
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_service.cc22
-rw-r--r--chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc480
-rw-r--r--chromium/chrome/browser/ui/BUILD.gn306
-rw-r--r--chromium/chrome/browser/ui/libgtkui/BUILD.gn1
-rw-r--r--chromium/chrome/browser/ui/views/BUILD.gn2
-rw-r--r--chromium/chrome/browser/ui/webui/app_management/app_management.mojom7
-rw-r--r--chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.cc21
-rw-r--r--chromium/chrome/browser/ui/webui/app_management/app_management_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.cc49
-rw-r--r--chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.h3
-rw-r--r--chromium/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/browser_switcher/OWNERS2
-rw-r--r--chromium/chrome/browser/ui/webui/browser_switcher/browser_switch_ui.cc43
-rw-r--r--chromium/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc48
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/OWNERS2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc15
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc464
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h89
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc66
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.h17
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/OWNERS2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.cc99
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.h48
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.cc27
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.h24
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc38
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.h30
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_dialog.cc (renamed from chromium/chrome/browser/ui/webui/chromeos/mobile_setup_dialog.cc)10
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_dialog.h (renamed from chromium/chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h)21
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc (renamed from chromium/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc)6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.h (renamed from chromium/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h)12
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc24
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/image_source.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.cc90
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.h40
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/insession_password_change_ui.cc47
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/insession_password_change_ui.h25
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/OWNERS7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.h17
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc37
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h44
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.cc23
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.h35
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc23
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc25
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h27
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.cc82
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h247
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc29
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.cc41
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.h8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.cc13
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.h3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_launch_help_app.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_redeem_offers.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_set_wallpaper.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_sync_files.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_welcome.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/discover_screen_handler.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc45
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc23
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc27
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc67
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc41
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc18
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h1
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc76
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h22
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc54
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h41
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container.cc52
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container.h84
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container_test_api.cc49
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container_test_api.h43
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc216
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h76
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/multidevice_setup_screen_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc98
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h25
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc94
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h24
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc135
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h18
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/supervision_transition_screen_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc82
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc187
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h81
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h38
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_handler.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/network_ui.cc38
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc62
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/set_time_ui_browsertest.js37
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/video_source.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc511
-rw-r--r--chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h84
-rw-r--r--chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.cc394
-rw-r--r--chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.h68
-rw-r--r--chromium/chrome/browser/ui/webui/cookies_tree_model_util.cc20
-rw-r--r--chromium/chrome/browser/ui/webui/crashes_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/dark_mode_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/dark_mode_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/dark_mode_handler_unittest.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/device_log_ui.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/download_internals/download_internals_ui.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc42
-rw-r--r--chromium/chrome/browser/ui/webui/eoc_internals/eoc_internals_ui.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc254
-rw-r--r--chromium/chrome/browser/ui/webui/favicon_source.cc63
-rw-r--r--chromium/chrome/browser/ui/webui/favicon_source.h5
-rw-r--r--chromium/chrome/browser/ui/webui/feed_internals/BUILD.gn4
-rw-r--r--chromium/chrome/browser/ui/webui/feed_internals/feed_internals.mojom34
-rw-r--r--chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.cc57
-rw-r--r--chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.h5
-rw-r--r--chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/flags_ui.cc12
-rw-r--r--chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler_unittest.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/log_web_ui_url.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/log_web_ui_url_browsertest.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/managed_ui_handler.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/managed_ui_handler_unittest.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/management_a11y_browsertest.cc26
-rw-r--r--chromium/chrome/browser/ui/webui/management_a11y_browsertest.h23
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui.cc120
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui.h3
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_browsertest.cc130
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_handler.cc454
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_handler.h31
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc365
-rw-r--r--chromium/chrome/browser/ui/webui/media/webrtc_logs_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.h2
-rw-r--r--chromium/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/nacl_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc28
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc21
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h6
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc37
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.h19
-rw-r--r--chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc23
-rw-r--r--chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom1
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/policy_indicator_localized_strings_provider.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/policy_ui_handler.cc27
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc49
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.h6
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc57
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc134
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.h28
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos_unittest.cc323
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc36
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.h8
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.cc17
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.h5
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.cc50
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.h8
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/printer_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/about_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc32
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc101
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h17
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc253
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h40
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc156
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc17
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler_browsertest.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc15
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc245
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h (renamed from chromium/chrome/browser/ui/webui/settings/md_settings_ui.h)20
-rw-r--r--chromium/chrome/browser/ui/webui/settings/people_handler.cc243
-rw-r--r--chromium/chrome/browser/ui/webui/settings/people_handler.h27
-rw-r--r--chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc740
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.cc12
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc (renamed from chromium/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc)268
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h (renamed from chromium/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.h)6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc251
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h78
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_ui.cc (renamed from chromium/chrome/browser/ui/webui/settings/md_settings_ui.cc)327
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_ui.h61
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_ui_browsertest.cc (renamed from chromium/chrome/browser/ui/webui/settings/md_settings_ui_browsertest.cc)6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/site_settings_handler.cc28
-rw-r--r--chromium/chrome/browser/ui/webui/settings/site_settings_handler.h3
-rw-r--r--chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc24
-rw-r--r--chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc57
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler.h6
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.cc30
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.h6
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.cc53
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h17
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.cc23
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.h38
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_ui.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/signin/login_ui_test_utils.cc20
-rw-r--r--chromium/chrome/browser/ui/webui/signin/signin_error_handler_unittest.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc17
-rw-r--r--chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc95
-rw-r--r--chromium/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/signin/user_manager_ui.cc (renamed from chromium/chrome/browser/ui/webui/signin/md_user_manager_ui.cc)50
-rw-r--r--chromium/chrome/browser/ui/webui/signin/user_manager_ui.h (renamed from chromium/chrome/browser/ui/webui/signin/md_user_manager_ui.h)14
-rw-r--r--chromium/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/signin_internals_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/site_settings_helper.cc13
-rw-r--r--chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom8
-rw-r--r--chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.cc82
-rw-r--r--chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.h8
-rw-r--r--chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/sync_internals_browsertest.js27
-rw-r--r--chromium/chrome/browser/ui/webui/sync_internals_message_handler.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/test_files_request_filter.cc33
-rw-r--r--chromium/chrome/browser/ui/webui/test_files_request_filter.h4
-rw-r--r--chromium/chrome/browser/ui/webui/theme_handler.cc37
-rw-r--r--chromium/chrome/browser/ui/webui/theme_handler.h26
-rw-r--r--chromium/chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.cc88
-rw-r--r--chromium/chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.h48
-rw-r--r--chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc277
-rw-r--r--chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.h105
-rw-r--r--chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc32
-rw-r--r--chromium/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/version_handler_win.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/version_handler_win_unittest.cc23
-rw-r--r--chromium/chrome/browser/ui/webui/web_ui_test_handler.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/web_ui_test_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/webapks_handler.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/webui_browsertest.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/OWNERS1
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux/constants.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux/constants.h2
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux/email_handler.cc92
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux/email_handler.h56
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux/email_providers_list.cc67
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux/email_providers_list.h21
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.cc88
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.h6
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux/set_as_default_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux_helper.cc139
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/nux_helper.h4
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/welcome_handler.cc16
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc99
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/welcome_ui.h4
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/welcome_ui_unittest.cc27
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/welcome_win10_handler.cc12
-rw-r--r--chromium/chrome/browser/vr/BUILD.gn43
-rw-r--r--chromium/chrome/browser/web_applications/BUILD.gn15
-rw-r--r--chromium/chrome/browser/web_applications/bookmark_apps/BUILD.gn2
-rw-r--r--chromium/chrome/browser/web_applications/components/BUILD.gn38
-rw-r--r--chromium/chrome/browser/web_applications/extensions/BUILD.gn5
1149 files changed, 27907 insertions, 15086 deletions
diff --git a/chromium/chrome/browser/BUILD.gn b/chromium/chrome/browser/BUILD.gn
index 0324e35f246..ed687fdfb15 100644
--- a/chromium/chrome/browser/BUILD.gn
+++ b/chromium/chrome/browser/BUILD.gn
@@ -146,6 +146,8 @@ jumbo_split_static_library("browser") {
"background_sync/background_sync_controller_factory.h",
"background_sync/background_sync_controller_impl.cc",
"background_sync/background_sync_controller_impl.h",
+ "background_sync/background_sync_metrics.cc",
+ "background_sync/background_sync_metrics.h",
"background_sync/background_sync_permission_context.cc",
"background_sync/background_sync_permission_context.h",
"bad_message.cc",
@@ -254,8 +256,6 @@ jumbo_split_static_library("browser") {
"browsing_data/site_data_size_collector.h",
"cache_stats_recorder.cc",
"cache_stats_recorder.h",
- "cached_image_fetcher/cached_image_fetcher_service_factory.cc",
- "cached_image_fetcher/cached_image_fetcher_service_factory.h",
"chooser_controller/chooser_controller.cc",
"chooser_controller/chooser_controller.h",
"chrome_browser_application_mac.h",
@@ -383,6 +383,8 @@ jumbo_split_static_library("browser") {
"data_reduction_proxy/data_reduction_proxy_chrome_settings.h",
"data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.cc",
"data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h",
+ "data_reduction_proxy/data_reduction_proxy_tab_helper.cc",
+ "data_reduction_proxy/data_reduction_proxy_tab_helper.h",
"data_use_measurement/chrome_data_use_ascriber.cc",
"data_use_measurement/chrome_data_use_ascriber.h",
"data_use_measurement/chrome_data_use_ascriber_service.cc",
@@ -395,16 +397,6 @@ jumbo_split_static_library("browser") {
"data_use_measurement/chrome_data_use_recorder.h",
"data_use_measurement/data_use_web_contents_observer.cc",
"data_use_measurement/data_use_web_contents_observer.h",
- "data_use_measurement/page_load_capping/chrome_page_load_capping_features.cc",
- "data_use_measurement/page_load_capping/chrome_page_load_capping_features.h",
- "data_use_measurement/page_load_capping/page_load_capping_blacklist.cc",
- "data_use_measurement/page_load_capping/page_load_capping_blacklist.h",
- "data_use_measurement/page_load_capping/page_load_capping_infobar_delegate.cc",
- "data_use_measurement/page_load_capping/page_load_capping_infobar_delegate.h",
- "data_use_measurement/page_load_capping/page_load_capping_service.cc",
- "data_use_measurement/page_load_capping/page_load_capping_service.h",
- "data_use_measurement/page_load_capping/page_load_capping_service_factory.cc",
- "data_use_measurement/page_load_capping/page_load_capping_service_factory.h",
"defaults.cc",
"defaults.h",
"dom_distiller/dom_distiller_service_factory.cc",
@@ -436,6 +428,8 @@ jumbo_split_static_library("browser") {
"download/download_item_model.h",
"download/download_location_dialog_result.h",
"download/download_location_dialog_type.h",
+ "download/download_manager_utils.cc",
+ "download/download_manager_utils.h",
"download/download_offline_content_provider.cc",
"download/download_offline_content_provider.h",
"download/download_permission_request.cc",
@@ -483,6 +477,8 @@ jumbo_split_static_library("browser") {
"download/offline_item_utils.h",
"download/save_package_file_picker.cc",
"download/save_package_file_picker.h",
+ "download/simple_download_manager_coordinator_factory.cc",
+ "download/simple_download_manager_coordinator_factory.h",
"download/thumbnail_util.cc",
"download/thumbnail_util.h",
"download/trusted_sources_manager.cc",
@@ -594,6 +590,10 @@ jumbo_split_static_library("browser") {
"idle/idle_detection_permission_context.h",
"image_decoder.cc",
"image_decoder.h",
+ "image_fetcher/image_decoder_impl.cc",
+ "image_fetcher/image_decoder_impl.h",
+ "image_fetcher/image_fetcher_service_factory.cc",
+ "image_fetcher/image_fetcher_service_factory.h",
"infobars/infobar_responder.cc",
"infobars/infobar_responder.h",
"infobars/infobar_service.cc",
@@ -715,6 +715,8 @@ jumbo_split_static_library("browser") {
"media/webrtc/desktop_media_picker.h",
"media/webrtc/desktop_media_picker_factory.cc",
"media/webrtc/desktop_media_picker_factory.h",
+ "media/webrtc/desktop_media_picker_manager.cc",
+ "media/webrtc/desktop_media_picker_manager.h",
"media/webrtc/media_capture_devices_dispatcher.cc",
"media/webrtc/media_capture_devices_dispatcher.h",
"media/webrtc/media_stream_capture_indicator.cc",
@@ -792,6 +794,8 @@ jumbo_split_static_library("browser") {
"metrics/google_update_metrics_provider_win.h",
"metrics/https_engagement_metrics_provider.cc",
"metrics/https_engagement_metrics_provider.h",
+ "metrics/incognito_observer.cc",
+ "metrics/incognito_observer.h",
"metrics/jumplist_metrics_win.cc",
"metrics/jumplist_metrics_win.h",
"metrics/live_tab_count_metrics.cc",
@@ -851,8 +855,6 @@ jumbo_split_static_library("browser") {
"net/dns_probe_service.h",
"net/dns_probe_service_factory.cc",
"net/dns_probe_service_factory.h",
- "net/failing_url_request_interceptor.cc",
- "net/failing_url_request_interceptor.h",
"net/file_downloader.cc",
"net/file_downloader.h",
"net/net_error_diagnostics_dialog.h",
@@ -873,8 +875,6 @@ jumbo_split_static_library("browser") {
"net/proxy_config_monitor.h",
"net/proxy_service_factory.cc",
"net/proxy_service_factory.h",
- "net/quota_policy_channel_id_store.cc",
- "net/quota_policy_channel_id_store.h",
"net/referrer.cc",
"net/referrer.h",
"net/reporting_permissions_checker.cc",
@@ -914,6 +914,8 @@ jumbo_split_static_library("browser") {
"notifications/notification_platform_bridge_mac.mm",
"notifications/notification_schedule_service_factory.cc",
"notifications/notification_schedule_service_factory.h",
+ "notifications/notification_trigger_scheduler.cc",
+ "notifications/notification_trigger_scheduler.h",
"notifications/notification_ui_manager.h",
"notifications/notifier_state_tracker.cc",
"notifications/notifier_state_tracker.h",
@@ -921,22 +923,18 @@ jumbo_split_static_library("browser") {
"notifications/notifier_state_tracker_factory.h",
"notifications/persistent_notification_handler.cc",
"notifications/persistent_notification_handler.h",
+ "notifications/platform_notification_service_factory.cc",
+ "notifications/platform_notification_service_factory.h",
"notifications/platform_notification_service_impl.cc",
"notifications/platform_notification_service_impl.h",
"notifications/system_notification_helper.cc",
"notifications/system_notification_helper.h",
- "ntp_snippets/bookmark_last_visit_updater.cc",
- "ntp_snippets/bookmark_last_visit_updater.h",
"ntp_snippets/content_suggestions_notifier_service_factory.cc",
"ntp_snippets/content_suggestions_notifier_service_factory.h",
"ntp_snippets/content_suggestions_service_factory.cc",
"ntp_snippets/content_suggestions_service_factory.h",
"ntp_snippets/contextual_content_suggestions_service_factory.cc",
"ntp_snippets/contextual_content_suggestions_service_factory.h",
- "ntp_snippets/dependent_features.cc",
- "ntp_snippets/dependent_features.h",
- "ntp_snippets/download_suggestions_provider.cc",
- "ntp_snippets/download_suggestions_provider.h",
"ntp_snippets/ntp_snippets_metrics.cc",
"ntp_snippets/ntp_snippets_metrics.h",
"ntp_tiles/chrome_custom_links_manager_factory.cc",
@@ -1007,8 +1005,6 @@ jumbo_split_static_library("browser") {
"page_load_metrics/observers/offline_page_previews_page_load_metrics_observer.h",
"page_load_metrics/observers/omnibox_suggestion_used_page_load_metrics_observer.cc",
"page_load_metrics/observers/omnibox_suggestion_used_page_load_metrics_observer.h",
- "page_load_metrics/observers/page_capping_page_load_metrics_observer.cc",
- "page_load_metrics/observers/page_capping_page_load_metrics_observer.h",
"page_load_metrics/observers/previews_lite_page_redirect_metrics_observer.cc",
"page_load_metrics/observers/previews_lite_page_redirect_metrics_observer.h",
"page_load_metrics/observers/previews_page_load_metrics_observer.cc",
@@ -1017,6 +1013,8 @@ jumbo_split_static_library("browser") {
"page_load_metrics/observers/previews_ukm_observer.h",
"page_load_metrics/observers/protocol_page_load_metrics_observer.cc",
"page_load_metrics/observers/protocol_page_load_metrics_observer.h",
+ "page_load_metrics/observers/resource_metrics_observer.cc",
+ "page_load_metrics/observers/resource_metrics_observer.h",
"page_load_metrics/observers/scheme_page_load_metrics_observer.cc",
"page_load_metrics/observers/scheme_page_load_metrics_observer.h",
"page_load_metrics/observers/security_state_page_load_metrics_observer.cc",
@@ -1025,8 +1023,6 @@ jumbo_split_static_library("browser") {
"page_load_metrics/observers/service_worker_page_load_metrics_observer.h",
"page_load_metrics/observers/signed_exchange_page_load_metrics_observer.cc",
"page_load_metrics/observers/signed_exchange_page_load_metrics_observer.h",
- "page_load_metrics/observers/stale_while_revalidate_page_load_metrics_observer.cc",
- "page_load_metrics/observers/stale_while_revalidate_page_load_metrics_observer.h",
"page_load_metrics/observers/tab_restore_page_load_metrics_observer.cc",
"page_load_metrics/observers/tab_restore_page_load_metrics_observer.h",
"page_load_metrics/observers/ukm_page_load_metrics_observer.cc",
@@ -1039,12 +1035,15 @@ jumbo_split_static_library("browser") {
"page_load_metrics/page_load_metrics_initialize.h",
"page_load_metrics/page_load_metrics_observer.cc",
"page_load_metrics/page_load_metrics_observer.h",
+ "page_load_metrics/page_load_metrics_observer_delegate.h",
"page_load_metrics/page_load_metrics_update_dispatcher.cc",
"page_load_metrics/page_load_metrics_update_dispatcher.h",
"page_load_metrics/page_load_metrics_util.cc",
"page_load_metrics/page_load_metrics_util.h",
"page_load_metrics/page_load_tracker.cc",
"page_load_metrics/page_load_tracker.h",
+ "page_load_metrics/resource_tracker.cc",
+ "page_load_metrics/resource_tracker.h",
"password_manager/chrome_password_manager_client.cc",
"password_manager/chrome_password_manager_client.h",
"password_manager/password_manager_util_linux.cc",
@@ -1063,54 +1062,49 @@ jumbo_split_static_library("browser") {
"payments/ssl_validity_checker.cc",
"performance_manager/browser_child_process_watcher.cc",
"performance_manager/browser_child_process_watcher.h",
+ "performance_manager/chrome_browser_main_extra_parts_performance_manager.cc",
+ "performance_manager/chrome_browser_main_extra_parts_performance_manager.h",
"performance_manager/chrome_content_browser_client_performance_manager_part.cc",
"performance_manager/chrome_content_browser_client_performance_manager_part.h",
- "performance_manager/common/page_almost_idle_data.cc",
- "performance_manager/common/page_almost_idle_data.h",
+ "performance_manager/decorators/frozen_frame_aggregator.cc",
+ "performance_manager/decorators/frozen_frame_aggregator.h",
"performance_manager/decorators/page_almost_idle_decorator.cc",
"performance_manager/decorators/page_almost_idle_decorator.h",
- "performance_manager/frame_resource_coordinator.cc",
- "performance_manager/frame_resource_coordinator.h",
"performance_manager/graph/frame_node_impl.cc",
"performance_manager/graph/frame_node_impl.h",
"performance_manager/graph/graph.cc",
"performance_manager/graph/graph.h",
- "performance_manager/graph/graph_introspector_impl.cc",
- "performance_manager/graph/graph_introspector_impl.h",
- "performance_manager/graph/graph_node_provider_impl.cc",
- "performance_manager/graph/graph_node_provider_impl.h",
+ "performance_manager/graph/node_attached_data.cc",
+ "performance_manager/graph/node_attached_data.h",
+ "performance_manager/graph/node_attached_data_impl.h",
"performance_manager/graph/node_base.cc",
"performance_manager/graph/node_base.h",
"performance_manager/graph/page_node_impl.cc",
"performance_manager/graph/page_node_impl.h",
"performance_manager/graph/process_node_impl.cc",
"performance_manager/graph/process_node_impl.h",
+ "performance_manager/graph/properties.h",
"performance_manager/graph/system_node_impl.cc",
"performance_manager/graph/system_node_impl.h",
"performance_manager/observers/background_metrics_reporter.h",
- "performance_manager/observers/coordination_unit_graph_observer.cc",
- "performance_manager/observers/coordination_unit_graph_observer.h",
+ "performance_manager/observers/graph_observer.cc",
+ "performance_manager/observers/graph_observer.h",
"performance_manager/observers/metrics_collector.cc",
"performance_manager/observers/metrics_collector.h",
"performance_manager/observers/page_signal_generator_impl.cc",
"performance_manager/observers/page_signal_generator_impl.h",
"performance_manager/observers/working_set_trimmer_win.cc",
"performance_manager/observers/working_set_trimmer_win.h",
- "performance_manager/page_resource_coordinator.cc",
- "performance_manager/page_resource_coordinator.h",
"performance_manager/performance_manager.cc",
"performance_manager/performance_manager.h",
+ "performance_manager/performance_manager_clock.cc",
+ "performance_manager/performance_manager_clock.h",
"performance_manager/performance_manager_tab_helper.cc",
"performance_manager/performance_manager_tab_helper.h",
- "performance_manager/process_resource_coordinator.cc",
- "performance_manager/process_resource_coordinator.h",
"performance_manager/render_process_user_data.cc",
"performance_manager/render_process_user_data.h",
- "performance_manager/resource_coordinator_clock.cc",
- "performance_manager/resource_coordinator_clock.h",
- "performance_manager/resource_coordinator_interface.h",
- "performance_manager/system_resource_coordinator.cc",
- "performance_manager/system_resource_coordinator.h",
+ "performance_manager/web_contents_proxy.cc",
+ "performance_manager/web_contents_proxy.h",
"performance_manager/webui_graph_dump_impl.cc",
"performance_manager/webui_graph_dump_impl.h",
"performance_monitor/metric_evaluator_helper_win.cc",
@@ -1121,6 +1115,8 @@ jumbo_split_static_library("browser") {
"performance_monitor/process_monitor.h",
"performance_monitor/system_monitor.cc",
"performance_monitor/system_monitor.h",
+ "performance_monitor/system_monitor_metrics_logger.cc",
+ "performance_monitor/system_monitor_metrics_logger.h",
"permissions/chooser_context_base.cc",
"permissions/chooser_context_base.h",
"permissions/permission_context_base.cc",
@@ -1206,8 +1202,10 @@ jumbo_split_static_library("browser") {
"policy/profile_policy_connector_factory.h",
"policy/schema_registry_service.cc",
"policy/schema_registry_service.h",
- "policy/schema_registry_service_factory.cc",
- "policy/schema_registry_service_factory.h",
+ "policy/schema_registry_service_profile_builder.cc",
+ "policy/schema_registry_service_profile_builder.h",
+ "policy/webusb_allow_devices_for_urls_policy_handler.cc",
+ "policy/webusb_allow_devices_for_urls_policy_handler.h",
"predictors/autocomplete_action_predictor.cc",
"predictors/autocomplete_action_predictor.h",
"predictors/autocomplete_action_predictor_factory.cc",
@@ -1303,6 +1301,7 @@ jumbo_split_static_library("browser") {
"prerender/prerender_util.h",
"previews/previews_content_util.cc",
"previews/previews_content_util.h",
+ "previews/previews_https_notification_infobar_decider.h",
"previews/previews_infobar_delegate.cc",
"previews/previews_infobar_delegate.h",
"previews/previews_lite_page_decider.cc",
@@ -1383,11 +1382,12 @@ jumbo_split_static_library("browser") {
"profiles/profile_info_interface.h",
"profiles/profile_io_data.cc",
"profiles/profile_io_data.h",
+ "profiles/profile_key.cc",
+ "profiles/profile_key.h",
"profiles/profile_manager.cc",
"profiles/profile_manager.h",
"profiles/profile_metrics.cc",
"profiles/profile_metrics.h",
- "profiles/profile_metrics_mac.mm",
"profiles/profile_shortcut_manager_win.cc",
"profiles/profile_shortcut_manager_win.h",
"profiles/profiles_state.cc",
@@ -1423,18 +1423,12 @@ jumbo_split_static_library("browser") {
"renderer_host/chrome_render_widget_host_view_mac_history_swiper.mm",
"renderer_preferences_util.cc",
"renderer_preferences_util.h",
- "resource_coordinator/chrome_browser_main_extra_parts_resource_coordinator.cc",
- "resource_coordinator/chrome_browser_main_extra_parts_resource_coordinator.h",
"resource_coordinator/discard_before_unload_helper.cc",
"resource_coordinator/discard_before_unload_helper.h",
"resource_coordinator/exponential_moving_average.cc",
"resource_coordinator/exponential_moving_average.h",
"resource_coordinator/page_signal_receiver.cc",
"resource_coordinator/page_signal_receiver.h",
- "resource_coordinator/performance_measurement_manager.cc",
- "resource_coordinator/performance_measurement_manager.h",
- "resource_coordinator/render_process_probe.cc",
- "resource_coordinator/render_process_probe.h",
"resource_coordinator/resource_coordinator_parts.cc",
"resource_coordinator/resource_coordinator_parts.h",
"resource_coordinator/session_restore_policy.cc",
@@ -1443,8 +1437,6 @@ jumbo_split_static_library("browser") {
"resource_coordinator/tab_helper.h",
"resource_coordinator/tab_load_tracker.cc",
"resource_coordinator/tab_load_tracker.h",
- "resource_coordinator/tab_manager_features.cc",
- "resource_coordinator/tab_manager_features.h",
"resource_coordinator/tab_memory_metrics_reporter.cc",
"resource_coordinator/tab_memory_metrics_reporter.h",
"resource_coordinator/time.cc",
@@ -1453,14 +1445,14 @@ jumbo_split_static_library("browser") {
"resource_coordinator/utils.h",
"resources_util.cc",
"resources_util.h",
+ "scoped_visibility_tracker.cc",
+ "scoped_visibility_tracker.h",
"search/instant_io_context.cc",
"search/instant_io_context.h",
"search/ntp_icon_source.cc",
"search/ntp_icon_source.h",
"search/search.cc",
"search/search.h",
- "search/suggestions/image_decoder_impl.cc",
- "search/suggestions/image_decoder_impl.h",
"search/suggestions/suggestions_service_factory.cc",
"search/suggestions/suggestions_service_factory.h",
"search/suggestions/suggestions_ui.cc",
@@ -1477,6 +1469,14 @@ jumbo_split_static_library("browser") {
"search_engines/ui_thread_search_terms_data_android.h",
"search_provider_logos/logo_service_factory.cc",
"search_provider_logos/logo_service_factory.h",
+ "security_events/security_event_recorder.h",
+ "security_events/security_event_recorder_factory.cc",
+ "security_events/security_event_recorder_factory.h",
+ "security_events/security_event_recorder_impl.cc",
+ "security_events/security_event_recorder_impl.h",
+ "security_events/security_event_sync_bridge.h",
+ "security_events/security_event_sync_bridge_impl.cc",
+ "security_events/security_event_sync_bridge_impl.h",
"send_tab_to_self/receiving_ui_handler.h",
"send_tab_to_self/receiving_ui_handler_registry.cc",
"send_tab_to_self/receiving_ui_handler_registry.h",
@@ -1484,6 +1484,8 @@ jumbo_split_static_library("browser") {
"send_tab_to_self/send_tab_to_self_client_service.h",
"send_tab_to_self/send_tab_to_self_client_service_factory.cc",
"send_tab_to_self/send_tab_to_self_client_service_factory.h",
+ "send_tab_to_self/send_tab_to_self_util.cc",
+ "send_tab_to_self/send_tab_to_self_util.h",
"sessions/chrome_serialized_navigation_driver.cc",
"sessions/chrome_serialized_navigation_driver.h",
"sessions/chrome_tab_restore_service_client.cc",
@@ -1512,8 +1514,6 @@ jumbo_split_static_library("browser") {
"signin/account_consistency_mode_manager.h",
"signin/account_consistency_mode_manager_factory.cc",
"signin/account_consistency_mode_manager_factory.h",
- "signin/account_fetcher_service_factory.cc",
- "signin/account_fetcher_service_factory.h",
"signin/account_investigator_factory.cc",
"signin/account_investigator_factory.h",
"signin/account_reconcilor_factory.cc",
@@ -1532,8 +1532,6 @@ jumbo_split_static_library("browser") {
"signin/chrome_signin_proxying_url_loader_factory.h",
"signin/chrome_signin_url_loader_throttle.cc",
"signin/chrome_signin_url_loader_throttle.h",
- "signin/gaia_cookie_manager_service_factory.cc",
- "signin/gaia_cookie_manager_service_factory.h",
"signin/header_modification_delegate.h",
"signin/header_modification_delegate_impl.cc",
"signin/header_modification_delegate_impl.h",
@@ -1543,12 +1541,10 @@ jumbo_split_static_library("browser") {
"signin/investigator_dependency_provider.h",
"signin/local_auth.cc",
"signin/local_auth.h",
- "signin/profile_oauth2_token_service_factory.cc",
- "signin/profile_oauth2_token_service_factory.h",
+ "signin/profile_oauth2_token_service_builder.cc",
+ "signin/profile_oauth2_token_service_builder.h",
"signin/signin_error_controller_factory.cc",
"signin/signin_error_controller_factory.h",
- "signin/signin_manager_factory.cc",
- "signin/signin_manager_factory.h",
"signin/signin_profile_attributes_updater.cc",
"signin/signin_profile_attributes_updater.h",
"signin/signin_profile_attributes_updater_factory.cc",
@@ -1559,10 +1555,12 @@ jumbo_split_static_library("browser") {
"signin/signin_status_metrics_provider_chromeos.h",
"signin/signin_util.cc",
"signin/signin_util.h",
- "site_details.cc",
- "site_details.h",
- "site_isolation_policy.cc",
- "site_isolation_policy.h",
+ "site_isolation/prefs_observer.cc",
+ "site_isolation/prefs_observer.h",
+ "site_isolation/site_details.cc",
+ "site_isolation/site_details.h",
+ "site_isolation/site_isolation_policy.cc",
+ "site_isolation/site_isolation_policy.h",
"speech/chrome_speech_recognition_manager_delegate.cc",
"speech/chrome_speech_recognition_manager_delegate.h",
"speech/speech_recognizer.cc",
@@ -1626,6 +1624,8 @@ jumbo_split_static_library("browser") {
"ssl/ssl_error_navigation_throttle.h",
"ssl/typed_navigation_timing_throttle.cc",
"ssl/typed_navigation_timing_throttle.h",
+ "startup_data.cc",
+ "startup_data.h",
"status_icons/status_icon.cc",
"status_icons/status_icon.h",
"status_icons/status_icon_menu_model.cc",
@@ -1681,14 +1681,10 @@ jumbo_split_static_library("browser") {
"task_manager/web_contents_tags.h",
"themes/theme_service_win.cc",
"themes/theme_service_win.h",
- "thumbnails/thumbnail_tab_helper.cc",
- "thumbnails/thumbnail_tab_helper.h",
- "thumbnails/thumbnail_utils.cc",
- "thumbnails/thumbnail_utils.h",
- "thumbnails/thumbnailing_context.cc",
- "thumbnails/thumbnailing_context.h",
"tracing/background_tracing_field_trial.cc",
"tracing/background_tracing_field_trial.h",
+ "tracing/background_tracing_metrics_provider.cc",
+ "tracing/background_tracing_metrics_provider.h",
"tracing/chrome_tracing_delegate.cc",
"tracing/chrome_tracing_delegate.h",
"tracing/crash_service_uploader.cc",
@@ -1697,6 +1693,8 @@ jumbo_split_static_library("browser") {
"tracing/navigation_tracing.h",
"tracing/trace_event_system_stats_monitor.cc",
"tracing/trace_event_system_stats_monitor.h",
+ "transition_manager/full_browser_transition_manager.cc",
+ "transition_manager/full_browser_transition_manager.h",
"translate/android/translate_utils.cc",
"translate/android/translate_utils.h",
"translate/chrome_translate_client.cc",
@@ -1801,6 +1799,7 @@ jumbo_split_static_library("browser") {
"//components/nacl/common:buildflags",
"//components/payments/core",
"//components/sync",
+ "//components/sync:device_info",
"//content/public/browser",
"//ipc",
"//sql",
@@ -1829,8 +1828,8 @@ jumbo_split_static_library("browser") {
"//chrome/browser/profiling_host",
"//chrome/browser/push_messaging:budget_proto",
"//chrome/browser/resource_coordinator:mojo_bindings",
+ "//chrome/browser/resource_coordinator:tab_manager_features",
"//chrome/browser/safe_browsing",
- "//chrome/browser/security_events",
"//chrome/browser/ssl:proto",
"//chrome/browser/ui",
"//chrome/browser/ui/webui/bluetooth_internals",
@@ -1896,6 +1895,7 @@ jumbo_split_static_library("browser") {
"//components/language/content/browser",
"//components/language/core/browser",
"//components/language/core/common",
+ "//components/leveldb_proto",
"//components/leveldb_proto/content:factory",
"//components/live_tab_count_metrics",
"//components/metrics:call_stack_profile_collector",
@@ -1970,7 +1970,7 @@ jumbo_split_static_library("browser") {
"//components/sync_bookmarks",
"//components/sync_preferences",
"//components/sync_sessions",
- "//components/task_scheduler_util",
+ "//components/thread_pool_util",
"//components/tracing:startup_tracing",
"//components/translate/content/browser",
"//components/translate/core/browser",
@@ -1980,8 +1980,10 @@ jumbo_split_static_library("browser") {
"//components/undo",
"//components/unified_consent",
"//components/update_client",
+ "//components/update_client:common_impl",
"//components/upload_list",
"//components/url_formatter",
+ "//components/url_formatter/top_domains:top500_domains",
"//components/url_formatter/top_domains:top500_domains_header",
"//components/url_matcher",
"//components/user_prefs",
@@ -2083,6 +2085,7 @@ jumbo_split_static_library("browser") {
"//ui/accessibility",
"//ui/base",
"//ui/base:ui_data_pack",
+ "//ui/base/idle",
"//ui/base/ime",
"//ui/events:events_base",
"//ui/gfx",
@@ -2116,8 +2119,6 @@ jumbo_split_static_library("browser") {
"android/android_theme_resources.h",
"android/app_hooks.cc",
"android/app_hooks.h",
- "android/autofill_assistant/assistant_header_delegate.cc",
- "android/autofill_assistant/assistant_header_delegate.h",
"android/autofill_assistant/assistant_overlay_delegate.cc",
"android/autofill_assistant/assistant_overlay_delegate.h",
"android/autofill_assistant/assistant_payment_request_delegate.cc",
@@ -2144,8 +2145,6 @@ jumbo_split_static_library("browser") {
"android/browsing_data/browsing_data_counter_bridge.h",
"android/browsing_data/url_filter_bridge.cc",
"android/browsing_data/url_filter_bridge.h",
- "android/cached_image_fetcher/cached_image_fetcher_bridge.cc",
- "android/cached_image_fetcher/cached_image_fetcher_bridge.h",
"android/chrome_backup_agent.cc",
"android/chrome_backup_agent.h",
"android/chrome_backup_watcher.cc",
@@ -2289,6 +2288,7 @@ jumbo_split_static_library("browser") {
"android/download/items/offline_content_aggregator_factory_android.cc",
"android/download/local_media_data_source_factory.cc",
"android/download/local_media_data_source_factory.h",
+ "android/download/rename_utils.cc",
"android/download/service/download_background_task.cc",
"android/download/service/download_task_scheduler.cc",
"android/download/service/download_task_scheduler.h",
@@ -2380,12 +2380,15 @@ jumbo_split_static_library("browser") {
"android/history_report/usage_reports_buffer_service.h",
"android/hung_renderer_infobar_delegate.cc",
"android/hung_renderer_infobar_delegate.h",
+ "android/image_fetcher/image_fetcher_bridge.cc",
+ "android/image_fetcher/image_fetcher_bridge.h",
"android/instantapps/instant_apps_infobar_delegate.cc",
"android/instantapps/instant_apps_infobar_delegate.h",
"android/instantapps/instant_apps_settings.cc",
"android/instantapps/instant_apps_settings.h",
"android/intent_helper.cc",
"android/intent_helper.h",
+ "android/intercept_navigation_delegate_impl.cc",
"android/large_icon_bridge.cc",
"android/large_icon_bridge.h",
"android/locale/locale_manager.cc",
@@ -2409,6 +2412,8 @@ jumbo_split_static_library("browser") {
"android/metrics/variations_session.cc",
"android/mojo/chrome_interface_registrar_android.cc",
"android/mojo/chrome_interface_registrar_android.h",
+ "android/net/nqe/network_quality_provider.cc",
+ "android/net/nqe/network_quality_provider.h",
"android/ntp/android_content_suggestions_notifier.cc",
"android/ntp/android_content_suggestions_notifier.h",
"android/ntp/content_suggestions_notifier.cc",
@@ -2443,10 +2448,6 @@ jumbo_split_static_library("browser") {
"android/oom_intervention/oom_intervention_tab_helper.h",
"android/partner_browser_customizations.cc",
"android/partner_browser_customizations.h",
- "android/password_manager/manual_filling_view_android.cc",
- "android/password_manager/manual_filling_view_android.h",
- "android/password_manager/password_generation_dialog_view_android.cc",
- "android/password_manager/password_generation_dialog_view_android.h",
"android/password_ui_view_android.cc",
"android/password_ui_view_android.h",
"android/payments/service_worker_payment_app_bridge.cc",
@@ -2491,8 +2492,11 @@ jumbo_split_static_library("browser") {
"android/search_permissions/search_permissions_service.h",
"android/seccomp_support_detector.cc",
"android/seccomp_support_detector.h",
+ "android/send_tab_to_self/android_notification_handler.cc",
+ "android/send_tab_to_self/android_notification_handler.h",
"android/send_tab_to_self/send_tab_to_self_android_bridge.cc",
- "android/send_tab_to_self/send_tab_to_self_android_bridge.h",
+ "android/send_tab_to_self/send_tab_to_self_infobar.cc",
+ "android/send_tab_to_self/send_tab_to_self_infobar.h",
"android/service_tab_launcher.cc",
"android/service_tab_launcher.h",
"android/sessions/session_tab_helper_android.cc",
@@ -2500,18 +2504,20 @@ jumbo_split_static_library("browser") {
"android/shortcut_helper.h",
"android/shortcut_info.cc",
"android/shortcut_info.h",
- "android/signin/account_management_screen_helper.cc",
- "android/signin/account_management_screen_helper.h",
"android/signin/signin_investigator_android.cc",
"android/signin/signin_investigator_android.h",
"android/signin/signin_manager_android.cc",
"android/signin/signin_manager_android.h",
"android/signin/signin_promo_util_android.cc",
"android/signin/signin_promo_util_android.h",
+ "android/signin/signin_utils.cc",
+ "android/signin/signin_utils.h",
"android/signin/unified_consent_service_bridge.cc",
"android/subresource_filter/test_subresource_filter_publisher.cc",
"android/tab_android.cc",
"android/tab_android.h",
+ "android/tab_browser_controls_state.cc",
+ "android/tab_browser_controls_state.h",
"android/tab_favicon.cc",
"android/tab_favicon.h",
"android/tab_printer.cc",
@@ -2571,6 +2577,8 @@ jumbo_split_static_library("browser") {
"autofill/android/personal_data_manager_android.cc",
"autofill/android/personal_data_manager_android.h",
"autofill/android/phone_number_util_android.cc",
+ "autofill/autofill_keyboard_accessory_adapter.cc",
+ "autofill/autofill_keyboard_accessory_adapter.h",
"autofill/manual_filling_controller.h",
"autofill/manual_filling_controller_impl.cc",
"autofill/manual_filling_controller_impl.h",
@@ -2601,6 +2609,10 @@ jumbo_split_static_library("browser") {
"history/android/sqlite_cursor.cc",
"history/android/sqlite_cursor.h",
"installable/installable_ambient_badge_infobar_delegate.cc",
+ "installable/installed_webapp_bridge.cc",
+ "installable/installed_webapp_bridge.h",
+ "installable/installed_webapp_provider.cc",
+ "installable/installed_webapp_provider.h",
"invalidation/invalidation_service_factory_android.cc",
"invalidation/invalidation_service_factory_android.h",
"lifetime/application_lifetime_android.cc",
@@ -2634,6 +2646,8 @@ jumbo_split_static_library("browser") {
"notifications/notification_background_task_scheduler_android.h",
"notifications/notification_platform_bridge_android.cc",
"notifications/notification_platform_bridge_android.h",
+ "notifications/notification_trigger_scheduler_android.cc",
+ "notifications/notification_trigger_scheduler_android.h",
"page_load_metrics/observers/android_page_load_metrics_observer.cc",
"page_load_metrics/observers/android_page_load_metrics_observer.h",
"password_manager/account_chooser_dialog_android.cc",
@@ -2728,7 +2742,7 @@ jumbo_split_static_library("browser") {
"//services/identity/public/cpp",
"//services/proxy_resolver:lib",
"//third_party/android_opengl/etc1",
- "//third_party/android_tools:cpu_features",
+ "//third_party/android_sdk:cpu_features",
"//third_party/libaddressinput:util",
"//third_party/libphonenumber",
"//third_party/smhasher:murmurhash2",
@@ -2752,12 +2766,26 @@ jumbo_split_static_library("browser") {
"apps/app_service/app_icon_factory.h",
"apps/app_service/app_icon_source.cc",
"apps/app_service/app_icon_source.h",
- "apps/app_service/app_service_proxy.cc",
- "apps/app_service/app_service_proxy.h",
"apps/app_service/app_service_proxy_factory.cc",
"apps/app_service/app_service_proxy_factory.h",
+ "apps/app_service/app_service_proxy_impl.cc",
+ "apps/app_service/app_service_proxy_impl.h",
"apps/app_service/dip_px_util.cc",
"apps/app_service/dip_px_util.h",
+ "apps/intent_helper/apps_navigation_throttle.cc",
+ "apps/intent_helper/apps_navigation_throttle.h",
+ "apps/intent_helper/apps_navigation_types.cc",
+ "apps/intent_helper/apps_navigation_types.h",
+ "apps/intent_helper/intent_picker_auto_display_pref.cc",
+ "apps/intent_helper/intent_picker_auto_display_pref.h",
+ "apps/intent_helper/intent_picker_auto_display_service.cc",
+ "apps/intent_helper/intent_picker_auto_display_service.h",
+ "apps/intent_helper/intent_picker_auto_display_service_factory.cc",
+ "apps/intent_helper/intent_picker_auto_display_service_factory.h",
+ "apps/intent_helper/intent_picker_controller.cc",
+ "apps/intent_helper/intent_picker_controller.h",
+ "apps/intent_helper/page_transition_util.cc",
+ "apps/intent_helper/page_transition_util.h",
"background/background_contents.cc",
"background/background_contents.h",
"badging/badge_manager.cc",
@@ -2843,7 +2871,8 @@ jumbo_split_static_library("browser") {
"first_run/first_run_internal_mac.mm",
"first_run/first_run_internal_win.cc",
"first_run/upgrade_util.h",
- "first_run/upgrade_util_mac.cc",
+ "first_run/upgrade_util_mac.h",
+ "first_run/upgrade_util_mac.mm",
"first_run/upgrade_util_win.cc",
"first_run/upgrade_util_win.h",
"font_family_cache.cc",
@@ -2881,6 +2910,8 @@ jumbo_split_static_library("browser") {
"media/webrtc/display_media_access_handler.h",
"media/webrtc/system_media_capture_permissions_mac.h",
"media/webrtc/system_media_capture_permissions_mac.mm",
+ "media/webrtc/system_media_capture_permissions_stats_mac.h",
+ "media/webrtc/system_media_capture_permissions_stats_mac.mm",
"media/webrtc/tab_desktop_media_list.cc",
"media/webrtc/tab_desktop_media_list.h",
"media_galleries/chromeos/mtp_device_delegate_impl_chromeos.cc",
@@ -2942,6 +2973,13 @@ jumbo_split_static_library("browser") {
"media_galleries/win/portable_device_map_service.h",
"media_galleries/win/snapshot_file_details.cc",
"media_galleries/win/snapshot_file_details.h",
+ "memory/memory_pressure_monitor.cc",
+ "memory/memory_pressure_monitor.h",
+ "memory/memory_pressure_monitor_utils.cc",
+ "memory/memory_pressure_monitor_utils.h",
+ "memory/memory_pressure_monitor_utils_impl.h",
+ "memory/memory_pressure_monitor_win.cc",
+ "memory/memory_pressure_monitor_win.h",
"memory/oom_memory_details.cc",
"memory/oom_memory_details.h",
"memory/swap_thrashing_monitor.cc",
@@ -2989,8 +3027,6 @@ jumbo_split_static_library("browser") {
"permissions/attestation_permission_request.h",
"policy/local_sync_policy_handler.cc",
"policy/local_sync_policy_handler.h",
- "policy/webusb_allow_devices_for_urls_policy_handler.cc",
- "policy/webusb_allow_devices_for_urls_policy_handler.h",
"process_singleton_modal_dialog_lock.cc",
"process_singleton_modal_dialog_lock.h",
"process_singleton_startup_lock.cc",
@@ -3155,8 +3191,8 @@ jumbo_split_static_library("browser") {
"search/search_suggest/search_suggest_service_observer.h",
"send_tab_to_self/desktop_notification_handler.cc",
"send_tab_to_self/desktop_notification_handler.h",
- "send_tab_to_self/send_tab_to_self_util.cc",
- "send_tab_to_self/send_tab_to_self_util.h",
+ "send_tab_to_self/send_tab_to_self_desktop_util.cc",
+ "send_tab_to_self/send_tab_to_self_desktop_util.h",
"serial/chrome_serial_delegate.cc",
"serial/chrome_serial_delegate.h",
"serial/serial_chooser_context.cc",
@@ -3199,6 +3235,10 @@ jumbo_split_static_library("browser") {
"task_manager/providers/fallback_task_provider.h",
"task_manager/providers/render_process_host_task_provider.cc",
"task_manager/providers/render_process_host_task_provider.h",
+ "task_manager/providers/service_worker_task.cc",
+ "task_manager/providers/service_worker_task.h",
+ "task_manager/providers/service_worker_task_provider.cc",
+ "task_manager/providers/service_worker_task_provider.h",
"task_manager/providers/task.cc",
"task_manager/providers/task.h",
"task_manager/providers/task_provider.cc",
@@ -3291,7 +3331,9 @@ jumbo_split_static_library("browser") {
"//chrome/browser/search:generated",
"//chrome/common/importer:interfaces",
"//chrome/services/app_service:lib",
+ "//chrome/services/app_service/public/cpp:app_service_proxy",
"//chrome/services/app_service/public/cpp:app_update",
+ "//chrome/services/app_service/public/cpp:icon_loader",
"//components/feedback",
"//components/keep_alive_registry",
"//components/vector_icons",
@@ -3372,6 +3414,8 @@ jumbo_split_static_library("browser") {
"metrics/perf/perf_events_collector.h",
"metrics/perf/perf_output.cc",
"metrics/perf/perf_output.h",
+ "metrics/perf/process_type_collector.cc",
+ "metrics/perf/process_type_collector.h",
"metrics/perf/profile_provider_chromeos.cc",
"metrics/perf/profile_provider_chromeos.h",
"metrics/perf/random_selector.cc",
@@ -3415,7 +3459,9 @@ jumbo_split_static_library("browser") {
deps += [
"//ash/public/cpp",
"//chrome/browser/chromeos",
+ "//chrome/browser/chromeos/kiosk_next_home/mojom",
"//chromeos/services/assistant/public:feature_flags",
+ "//chromeos/services/cellular_setup",
"//chromeos/services/device_sync",
"//chromeos/services/device_sync/public/mojom",
"//chromeos/services/ime/public/mojom",
@@ -3446,8 +3492,8 @@ jumbo_split_static_library("browser") {
"fullscreen.h",
"policy/browser_signin_policy_handler.cc",
"policy/browser_signin_policy_handler.h",
- "policy/cloud/user_cloud_policy_manager_factory.cc",
- "policy/cloud/user_cloud_policy_manager_factory.h",
+ "policy/cloud/user_cloud_policy_manager_builder.cc",
+ "policy/cloud/user_cloud_policy_manager_builder.h",
"policy/cloud/user_policy_signin_service_base.cc",
"policy/cloud/user_policy_signin_service_base.h",
"policy/cloud/user_policy_signin_service_factory.cc",
@@ -3457,6 +3503,13 @@ jumbo_split_static_library("browser") {
]
}
+ if (is_chromeos || enable_extensions) {
+ sources += [
+ "metrics/cached_metrics_profile.cc",
+ "metrics/cached_metrics_profile.h",
+ ]
+ }
+
if (is_win) {
sources += [
"badging/badge_manager_delegate_win.cc",
@@ -3543,6 +3596,8 @@ jumbo_split_static_library("browser") {
"conflicts/module_blacklist_cache_updater_win.h",
"conflicts/module_blacklist_cache_util_win.cc",
"conflicts/module_blacklist_cache_util_win.h",
+ "conflicts/module_list_component_updater_win.cc",
+ "conflicts/module_list_component_updater_win.h",
"conflicts/module_list_filter_win.cc",
"conflicts/module_list_filter_win.h",
"conflicts/module_load_attempt_log_listener_win.cc",
@@ -4052,8 +4107,6 @@ jumbo_split_static_library("browser") {
if (enable_extensions) {
sources += [
- "accessibility/accessibility_extension_api.cc",
- "accessibility/accessibility_extension_api.h",
"accessibility/animation_policy_prefs.cc",
"accessibility/animation_policy_prefs.h",
"autocomplete/keyword_extensions_delegate_impl.cc",
@@ -4271,6 +4324,8 @@ jumbo_split_static_library("browser") {
sources += [
"android/feed/feed_content_bridge.cc",
"android/feed/feed_content_bridge.h",
+ "android/feed/feed_debugging_bridge.cc",
+ "android/feed/feed_debugging_bridge.h",
"android/feed/feed_host_service_factory.cc",
"android/feed/feed_host_service_factory.h",
"android/feed/feed_journal_bridge.cc",
@@ -4515,6 +4570,8 @@ jumbo_split_static_library("browser") {
"plugins/chrome_content_browser_client_plugins_part.h",
"plugins/chrome_plugin_service_filter.cc",
"plugins/chrome_plugin_service_filter.h",
+ "plugins/flash_deprecation_infobar_delegate.cc",
+ "plugins/flash_deprecation_infobar_delegate.h",
"plugins/flash_download_interception.cc",
"plugins/flash_download_interception.h",
"plugins/flash_permission_context.cc",
@@ -4553,8 +4610,6 @@ jumbo_split_static_library("browser") {
"plugins/plugin_status_pref_setter.h",
"plugins/plugin_utils.cc",
"plugins/plugin_utils.h",
- "plugins/plugins_field_trial.cc",
- "plugins/plugins_field_trial.h",
"plugins/plugins_resource_service.cc",
"plugins/plugins_resource_service.h",
"plugins/reload_plugin_infobar_delegate.cc",
@@ -4705,6 +4760,8 @@ jumbo_split_static_library("browser") {
"spellchecker/spellcheck_factory.h",
"spellchecker/spellcheck_hunspell_dictionary.cc",
"spellchecker/spellcheck_hunspell_dictionary.h",
+ "spellchecker/spellcheck_language_blacklist_policy_handler.cc",
+ "spellchecker/spellcheck_language_blacklist_policy_handler.h",
"spellchecker/spellcheck_language_policy_handler.cc",
"spellchecker/spellcheck_language_policy_handler.h",
"spellchecker/spellcheck_service.cc",
@@ -4748,6 +4805,8 @@ jumbo_split_static_library("browser") {
"supervised_user/experimental/supervised_user_blacklist.h",
"supervised_user/experimental/supervised_user_filtering_switches.cc",
"supervised_user/experimental/supervised_user_filtering_switches.h",
+ "supervised_user/kids_management_url_checker_client.cc",
+ "supervised_user/kids_management_url_checker_client.h",
"supervised_user/permission_request_creator.h",
"supervised_user/supervised_user_constants.cc",
"supervised_user/supervised_user_constants.h",
@@ -4881,6 +4940,18 @@ jumbo_split_static_library("browser") {
if (use_udev) {
deps += [ "//device/udev_linux" ]
}
+
+ if (is_android && notouch_build) {
+ configs += [ ":notouch_config" ]
+ }
+}
+
+config("notouch_config") {
+ defines = [
+ "BROWSER_MEDIA_CONTROLS_MENU",
+ "ENABLE_SPATIAL_NAVIGATION_HOST",
+ "INCOGNITO_DEFAULT_DISABLED",
+ ]
}
if (is_android) {
@@ -5095,6 +5166,8 @@ static_library("test_support") {
visibility = [ "//chrome/test:test_support" ]
sources = [
+ "autofill/mock_autofill_popup_controller.cc",
+ "autofill/mock_autofill_popup_controller.h",
"autofill/mock_manual_filling_controller.cc",
"autofill/mock_manual_filling_controller.h",
"browsing_data/mock_browsing_data_appcache_helper.cc",
@@ -5167,8 +5240,6 @@ static_library("test_support") {
"ssl/ssl_client_auth_requestor_mock.h",
"subresource_filter/test_ruleset_publisher.cc",
"subresource_filter/test_ruleset_publisher.h",
- "sync/profile_sync_test_util.cc",
- "sync/profile_sync_test_util.h",
]
configs += [ "//build/config:precompiled_headers" ]
@@ -5263,8 +5334,12 @@ static_library("test_support") {
"chromeos/login/session/user_session_manager_test_api.h",
"chromeos/login/test/js_checker.cc",
"chromeos/login/test/js_checker.h",
+ "chromeos/login/test/oobe_auth_page_waiter.cc",
+ "chromeos/login/test/oobe_auth_page_waiter.h",
"chromeos/login/test/oobe_configuration_waiter.cc",
"chromeos/login/test/oobe_configuration_waiter.h",
+ "chromeos/login/test/oobe_screen_exit_waiter.cc",
+ "chromeos/login/test/oobe_screen_exit_waiter.h",
"chromeos/login/test/oobe_screen_waiter.cc",
"chromeos/login/test/oobe_screen_waiter.h",
"chromeos/login/ui/fake_login_display_host.cc",
@@ -5293,8 +5368,8 @@ static_library("test_support") {
"chromeos/policy/fake_device_cloud_policy_manager.h",
"chromeos/settings/device_settings_test_helper.cc",
"chromeos/settings/device_settings_test_helper.h",
- "chromeos/settings/stub_install_attributes.cc",
- "chromeos/settings/stub_install_attributes.h",
+ "ui/ash/ash_test_util.cc",
+ "ui/ash/ash_test_util.h",
"ui/ash/tablet_mode_client_test_util.cc",
"ui/ash/tablet_mode_client_test_util.h",
]
diff --git a/chromium/chrome/browser/accessibility/OWNERS b/chromium/chrome/browser/accessibility/OWNERS
index 84f2c836b39..2c85844e32c 100644
--- a/chromium/chrome/browser/accessibility/OWNERS
+++ b/chromium/chrome/browser/accessibility/OWNERS
@@ -1,6 +1,4 @@
file://ui/accessibility/OWNERS
-katie@chromium.org
-
# TEAM: chromium-accessibility@chromium.org
# COMPONENT: UI>Accessibility
diff --git a/chromium/chrome/browser/accessibility/accessibility_extension_api.cc b/chromium/chrome/browser/accessibility/accessibility_extension_api.cc
index 6970785a068..9862d5b579e 100644
--- a/chromium/chrome/browser/accessibility/accessibility_extension_api.cc
+++ b/chromium/chrome/browser/accessibility/accessibility_extension_api.cc
@@ -55,6 +55,9 @@ namespace {
const char kErrorNotSupported[] = "This API is not supported on this platform.";
#if defined(OS_CHROMEOS)
+constexpr int kBackButtonWidth = 45;
+constexpr int kBackButtonHeight = 45;
+
ash::mojom::AccessibilityControllerPtr GetAccessibilityController() {
// Connect to the accessibility mojo interface in ash.
ash::mojom::AccessibilityControllerPtr accessibility_controller;
@@ -84,41 +87,66 @@ AccessibilityPrivateSetNativeAccessibilityEnabledFunction::Run() {
ExtensionFunction::ResponseAction
AccessibilityPrivateSetFocusRingsFunction::Run() {
#if defined(OS_CHROMEOS)
-
std::unique_ptr<accessibility_private::SetFocusRings::Params> params(
accessibility_private::SetFocusRings::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
auto* accessibility_manager = chromeos::AccessibilityManager::Get();
- for (const accessibility_private::FocusRingInfo& focus_ring :
+ for (const accessibility_private::FocusRingInfo& focus_ring_info :
params->focus_rings) {
+ ash::mojom::FocusRingPtr focus_ring_ptr = ash::mojom::FocusRing::New();
+ focus_ring_ptr->behavior =
+ ash::mojom::FocusRingBehavior::PERSIST_FOCUS_RING;
+
// Convert the given rects into gfx::Rect objects.
- std::vector<gfx::Rect> rects;
- for (const accessibility_private::ScreenRect& rect : focus_ring.rects) {
- rects.push_back(gfx::Rect(rect.left, rect.top, rect.width, rect.height));
+ for (const accessibility_private::ScreenRect& rect :
+ focus_ring_info.rects) {
+ focus_ring_ptr->rects_in_screen.push_back(
+ gfx::Rect(rect.left, rect.top, rect.width, rect.height));
}
const std::string id = accessibility_manager->GetFocusRingId(
- extension_id(), focus_ring.id ? *(focus_ring.id) : "");
+ extension_id(), focus_ring_info.id ? *(focus_ring_info.id) : "");
- SkColor color;
- if (!extensions::image_util::ParseHexColorString(focus_ring.color, &color))
+ if (!extensions::image_util::ParseHexColorString(
+ focus_ring_info.color, &(focus_ring_ptr->color))) {
return RespondNow(Error("Could not parse hex color"));
- accessibility_manager->SetFocusRingColor(color, id);
+ }
- // Move the visible focus ring to cover all of these rects.
- accessibility_manager->SetFocusRing(
- rects, ash::mojom::FocusRingBehavior::PERSIST_FOCUS_RING, id);
+ if (focus_ring_info.secondary_color) {
+ if (!extensions::image_util::ParseHexColorString(
+ *(focus_ring_info.secondary_color),
+ &(focus_ring_ptr->secondary_color))) {
+ return RespondNow(Error("Could not parse secondary hex color"));
+ }
+ }
- // Also update the touch exploration controller so that synthesized
- // touch events are anchored within the focused object.
+ switch (focus_ring_info.type) {
+ case accessibility_private::FOCUS_TYPE_SOLID:
+ focus_ring_ptr->type = ash::mojom::FocusRingType::SOLID;
+ break;
+ case accessibility_private::FOCUS_TYPE_DASHED:
+ focus_ring_ptr->type = ash::mojom::FocusRingType::DASHED;
+ break;
+ case accessibility_private::FOCUS_TYPE_GLOW:
+ focus_ring_ptr->type = ash::mojom::FocusRingType::GLOW;
+ break;
+ default:
+ NOTREACHED();
+ }
+
+ // Update the touch exploration controller so that synthesized touch events
+ // are anchored within the focused object.
// NOTE: The final anchor point will be determined by the first rect of the
// final focus ring.
- if (!rects.empty()) {
+ if (!focus_ring_ptr->rects_in_screen.empty()) {
accessibility_manager->SetTouchAccessibilityAnchorPoint(
- rects[0].CenterPoint());
+ focus_ring_ptr->rects_in_screen[0].CenterPoint());
}
+
+ // Set the focus ring.
+ accessibility_manager->SetFocusRing(id, std::move(focus_ring_ptr));
}
return RespondNow(NoArguments());
@@ -130,15 +158,12 @@ AccessibilityPrivateSetFocusRingsFunction::Run() {
ExtensionFunction::ResponseAction
AccessibilityPrivateSetHighlightsFunction::Run() {
#if defined(OS_CHROMEOS)
- std::unique_ptr<extensions::api::accessibility_private::SetHighlights::Params>
- params(
- extensions::api::accessibility_private::SetHighlights::Params::Create(
- *args_));
+ std::unique_ptr<accessibility_private::SetHighlights::Params> params(
+ accessibility_private::SetHighlights::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
std::vector<gfx::Rect> rects;
- for (const extensions::api::accessibility_private::ScreenRect& rect :
- params->rects) {
+ for (const accessibility_private::ScreenRect& rect : params->rects) {
rects.push_back(gfx::Rect(rect.left, rect.top, rect.width, rect.height));
}
@@ -294,12 +319,6 @@ AccessibilityPrivateSendSyntheticMouseEventFunction::Run() {
EXTENSION_FUNCTION_VALIDATE(params);
accessibility_private::SyntheticMouseEvent* mouse_data = &params->mouse_event;
- // TODO(crbug/893752) Choose correct display
- display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
- int x = (int)(mouse_data->x * display.device_scale_factor());
- int y = (int)(mouse_data->y * display.device_scale_factor());
-
- gfx::Point location(x, y);
ui::EventType type;
switch (mouse_data->type) {
case accessibility_private::SYNTHETIC_MOUSE_EVENT_TYPE_PRESS:
@@ -326,6 +345,10 @@ AccessibilityPrivateSendSyntheticMouseEventFunction::Run() {
int flags = ui::EF_LEFT_MOUSE_BUTTON;
+ // Locations are assumed to be display relative (and in DIPs).
+ // TODO(crbug/893752) Choose correct display
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
+ gfx::Point location(mouse_data->x, mouse_data->y);
std::unique_ptr<ui::MouseEvent> synthetic_mouse_event =
std::make_unique<ui::MouseEvent>(type, location, location,
ui::EventTimeForNow(), flags,
@@ -394,10 +417,27 @@ AccessibilityPrivateSetSwitchAccessMenuStateFunction::Run() {
params = accessibility_private::SetSwitchAccessMenuState::Params::Create(
*args_);
EXTENSION_FUNCTION_VALIDATE(params);
- bool show_menu = params->show;
+ chromeos::AccessibilityManager* manager =
+ chromeos::AccessibilityManager::Get();
+
+ if (!params->show) {
+ manager->HideSwitchAccessMenu();
+ return RespondNow(NoArguments());
+ }
+
+ accessibility_private::ScreenRect elem = std::move(params->element_bounds);
+ gfx::Rect element_bounds(elem.left, elem.top, elem.width, elem.height);
int item_count = params->item_count;
+ // If we have an item count of 0, the panel is showing only the back button.
+ if (item_count == 0) {
+ manager->ShowSwitchAccessMenu(element_bounds, kBackButtonWidth,
+ kBackButtonHeight,
+ true /* back_button_only */);
+ return RespondNow(NoArguments());
+ }
+
int padding = 40;
int item_width = 88;
int item_height = 60;
@@ -411,18 +451,7 @@ AccessibilityPrivateSetSwitchAccessMenuStateFunction::Run() {
int width = padding + (item_width * cols);
int height = padding + (item_height * rows);
- extensions::api::accessibility_private::ScreenRect elem =
- std::move(params->element_bounds);
-
- gfx::Rect element_bounds(elem.left, elem.top, elem.width, elem.height);
-
- if (show_menu) {
- chromeos::AccessibilityManager::Get()->ShowSwitchAccessMenu(element_bounds,
- width, height);
- } else {
- chromeos::AccessibilityManager::Get()->HideSwitchAccessMenu();
- }
-
+ manager->ShowSwitchAccessMenu(element_bounds, width, height);
return RespondNow(NoArguments());
}
@@ -468,4 +497,16 @@ void AccessibilityPrivateGetBatteryDescriptionFunction::OnGotBatteryDescription(
controller_.reset();
}
+ExtensionFunction::ResponseAction
+AccessibilityPrivateSetVirtualKeyboardVisibleFunction::Run() {
+ std::unique_ptr<accessibility_private::SetVirtualKeyboardVisible::Params>
+ params = accessibility_private::SetVirtualKeyboardVisible::Params::Create(
+ *args_);
+ EXTENSION_FUNCTION_VALIDATE(params);
+
+ GetAccessibilityController()->SetVirtualKeyboardVisible(params->is_visible);
+
+ return RespondNow(NoArguments());
+}
+
#endif // defined (OS_CHROMEOS)
diff --git a/chromium/chrome/browser/accessibility/accessibility_extension_api.h b/chromium/chrome/browser/accessibility/accessibility_extension_api.h
index db273888c20..36bb5d7b992 100644
--- a/chromium/chrome/browser/accessibility/accessibility_extension_api.h
+++ b/chromium/chrome/browser/accessibility/accessibility_extension_api.h
@@ -164,6 +164,14 @@ class AccessibilityPrivateGetBatteryDescriptionFunction
ash::mojom::AccessibilityControllerPtr controller_ = nullptr;
};
+// API function that opens or closes the virtual keyboard.
+class AccessibilityPrivateSetVirtualKeyboardVisibleFunction
+ : public UIThreadExtensionFunction {
+ ~AccessibilityPrivateSetVirtualKeyboardVisibleFunction() override {}
+ ResponseAction Run() override;
+ DECLARE_EXTENSION_FUNCTION("accessibilityPrivate.setVirtualKeyboardVisible",
+ ACCESSIBILITY_PRIVATE_SETVIRTUALKEYBOARDVISIBLE)
+};
#endif // defined (OS_CHROMEOS)
#endif // CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_API_H_
diff --git a/chromium/chrome/browser/accessibility/accessibility_labels_service.cc b/chromium/chrome/browser/accessibility/accessibility_labels_service.cc
index 122e4ddc50c..dd31968ac6f 100644
--- a/chromium/chrome/browser/accessibility/accessibility_labels_service.cc
+++ b/chromium/chrome/browser/accessibility/accessibility_labels_service.cc
@@ -55,9 +55,10 @@ void AccessibilityLabelsService::Init() {
&AccessibilityLabelsService::OnImageLabelsEnabledChanged,
weak_factory_.GetWeakPtr()));
- // Log whether the feature is enabled after startup.
- content::BrowserAccessibilityState::GetInstance()->AddHistogramCallback(
- base::BindRepeating(
+ // Log whether the feature is enabled after startup. This must be run on the
+ // UI thread because it accesses prefs.
+ content::BrowserAccessibilityState::GetInstance()
+ ->AddUIThreadHistogramCallback(base::BindRepeating(
&AccessibilityLabelsService::UpdateAccessibilityLabelsHistograms,
weak_factory_.GetWeakPtr()));
}
@@ -124,6 +125,9 @@ void AccessibilityLabelsService::OnImageLabelsEnabledChanged() {
}
void AccessibilityLabelsService::UpdateAccessibilityLabelsHistograms() {
+ if (!profile_ || !profile_->GetPrefs())
+ return;
+
base::UmaHistogramBoolean("Accessibility.ImageLabels",
profile_->GetPrefs()->GetBoolean(
prefs::kAccessibilityImageLabelsEnabled));
diff --git a/chromium/chrome/browser/accessibility/accessibility_state_utils.cc b/chromium/chrome/browser/accessibility/accessibility_state_utils.cc
index aa248b06bf7..12e43e0c22d 100644
--- a/chromium/chrome/browser/accessibility/accessibility_state_utils.cc
+++ b/chromium/chrome/browser/accessibility/accessibility_state_utils.cc
@@ -15,7 +15,8 @@ namespace accessibility_state_utils {
bool IsScreenReaderEnabled() {
#if defined(OS_CHROMEOS)
- return chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled();
+ return chromeos::AccessibilityManager::Get() &&
+ chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled();
#else
// TODO(katie): Can we use AXMode in Chrome OS as well? May need to stop
// Switch Access and Select-to-Speak from setting kScreenReader.
diff --git a/chromium/chrome/browser/accessibility/accessibility_ui.cc b/chromium/chrome/browser/accessibility/accessibility_ui.cc
index d47d3d533d9..f87f85a8315 100644
--- a/chromium/chrome/browser/accessibility/accessibility_ui.cc
+++ b/chromium/chrome/browser/accessibility/accessibility_ui.cc
@@ -132,12 +132,15 @@ std::unique_ptr<base::DictionaryValue> BuildTargetDescriptor(Browser* browser) {
}
#endif // !defined(OS_ANDROID)
-bool HandleAccessibilityRequestCallback(
+bool ShouldHandleAccessibilityRequestCallback(const std::string& path) {
+ return path == kTargetsDataFile;
+}
+
+void HandleAccessibilityRequestCallback(
content::BrowserContext* current_context,
const std::string& path,
const content::WebUIDataSource::GotDataCallback& callback) {
- if (path != kTargetsDataFile)
- return false;
+ DCHECK(ShouldHandleAccessibilityRequestCallback(path));
base::DictionaryValue data;
PrefService* pref = Profile::FromBrowserContext(current_context)->GetPrefs();
@@ -224,7 +227,6 @@ bool HandleAccessibilityRequestCallback(
base::JSONWriter::Write(data, &json_string);
callback.Run(base::RefCountedString::TakeString(&json_string));
- return true;
}
std::string RecursiveDumpAXPlatformNodeAsString(ui::AXPlatformNode* node,
@@ -256,6 +258,7 @@ AccessibilityUI::AccessibilityUI(content::WebUI* web_ui)
html_source->AddResourcePath("accessibility.js", IDR_ACCESSIBILITY_JS);
html_source->SetDefaultResource(IDR_ACCESSIBILITY_HTML);
html_source->SetRequestFilter(
+ base::BindRepeating(&ShouldHandleAccessibilityRequestCallback),
base::Bind(&HandleAccessibilityRequestCallback,
web_ui->GetWebContents()->GetBrowserContext()));
diff --git a/chromium/chrome/browser/accessibility/image_annotation_browsertest.cc b/chromium/chrome/browser/accessibility/image_annotation_browsertest.cc
new file mode 100644
index 00000000000..3c084ed52e9
--- /dev/null
+++ b/chromium/chrome/browser/accessibility/image_annotation_browsertest.cc
@@ -0,0 +1,414 @@
+// Copyright (c) 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/feature_list.h"
+#include "base/logging.h"
+#include "base/strings/string_split.h"
+#include "base/strings/string_util.h"
+#include "base/test/scoped_feature_list.h"
+#include "build/build_config.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "components/language/core/browser/pref_names.h"
+#include "components/prefs/pref_service.h"
+#include "components/user_prefs/user_prefs.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/common/content_features.h"
+#include "content/public/common/service_manager_connection.h"
+#include "content/public/test/browser_test_utils.h"
+#include "content/public/test/content_browser_test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "net/test/embedded_test_server/request_handler_util.h"
+#include "services/image_annotation/public/cpp/image_processor.h"
+#include "services/image_annotation/public/mojom/constants.mojom.h"
+#include "services/image_annotation/public/mojom/image_annotation.mojom.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_binding.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/accessibility/ax_enum_util.h"
+#include "ui/accessibility/ax_tree.h"
+#include "url/gurl.h"
+
+constexpr base::FilePath::CharType kDocRoot[] =
+ FILE_PATH_LITERAL("chrome/test/data/accessibility");
+
+namespace {
+
+void DescribeNodesWithAnnotations(const ui::AXNode& node,
+ std::vector<std::string>* descriptions) {
+ std::string annotation =
+ node.GetStringAttribute(ax::mojom::StringAttribute::kImageAnnotation);
+ if (!annotation.empty()) {
+ descriptions->push_back(ui::ToString(node.data().role) + std::string(" ") +
+ annotation);
+ }
+ for (int i = 0; i < node.child_count(); i++)
+ DescribeNodesWithAnnotations(*node.children()[i], descriptions);
+}
+
+std::vector<std::string> DescribeNodesWithAnnotations(
+ const ui::AXTreeUpdate& tree_update) {
+ ui::AXTree tree(tree_update);
+ std::vector<std::string> descriptions;
+ DCHECK(tree.root());
+ DescribeNodesWithAnnotations(*tree.root(), &descriptions);
+ return descriptions;
+}
+
+// A fake implementation of the Annotator mojo interface that
+// returns predictable results based on the filename of the image
+// it's asked to annotate. Enables us to test the rest of the
+// system without using the real annotator that queries a back-end
+// API.
+class FakeAnnotator : public image_annotation::mojom::Annotator {
+ public:
+ static void SetReturnOcrResults(bool ocr) { return_ocr_results_ = ocr; }
+
+ static void SetReturnLabelResults(bool label) {
+ return_label_results_ = label;
+ }
+
+ static void SetReturnErrorCode(
+ image_annotation::mojom::AnnotateImageError error_code) {
+ return_error_code_ = error_code;
+ }
+
+ FakeAnnotator() = default;
+ ~FakeAnnotator() override = default;
+
+ void BindRequest(image_annotation::mojom::AnnotatorRequest request) {
+ bindings_.AddBinding(this, std::move(request));
+ }
+
+ void AnnotateImage(const std::string& image_id,
+ const std::string& description_language_tag,
+ image_annotation::mojom::ImageProcessorPtr image_processor,
+ AnnotateImageCallback callback) override {
+ if (return_error_code_) {
+ image_annotation::mojom::AnnotateImageResultPtr result =
+ image_annotation::mojom::AnnotateImageResult::NewErrorCode(
+ *return_error_code_);
+ std::move(callback).Run(std::move(result));
+ return;
+ }
+
+ // Use the filename to create an annotation string.
+ // Adds some trailing whitespace and punctuation to check that clean-up
+ // happens correctly when combining annotation strings.
+ std::string image_filename = GURL(image_id).ExtractFileName();
+ image_annotation::mojom::AnnotationPtr ocr_annotation =
+ image_annotation::mojom::Annotation::New(
+ image_annotation::mojom::AnnotationType::kOcr, 1.0,
+ image_filename + " Annotation . ");
+
+ image_annotation::mojom::AnnotationPtr label_annotation =
+ image_annotation::mojom::Annotation::New(
+ image_annotation::mojom::AnnotationType::kLabel, 1.0,
+ image_filename + " '" + description_language_tag + "' Label");
+
+ // Return enabled results as an annotation.
+ std::vector<image_annotation::mojom::AnnotationPtr> annotations;
+ if (return_ocr_results_)
+ annotations.push_back(std::move(ocr_annotation));
+ if (return_label_results_)
+ annotations.push_back(std::move(label_annotation));
+
+ image_annotation::mojom::AnnotateImageResultPtr result =
+ image_annotation::mojom::AnnotateImageResult::NewAnnotations(
+ std::move(annotations));
+ std::move(callback).Run(std::move(result));
+ }
+
+ private:
+ mojo::BindingSet<image_annotation::mojom::Annotator> bindings_;
+ static bool return_ocr_results_;
+ static bool return_label_results_;
+ static base::Optional<image_annotation::mojom::AnnotateImageError>
+ return_error_code_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeAnnotator);
+};
+
+// static
+bool FakeAnnotator::return_ocr_results_ = false;
+// static
+bool FakeAnnotator::return_label_results_ = false;
+// static
+base::Optional<image_annotation::mojom::AnnotateImageError>
+ FakeAnnotator::return_error_code_;
+
+// The fake ImageAnnotationService, which handles mojo calls from the renderer
+// process and passes them to FakeAnnotator.
+class FakeImageAnnotationService : public service_manager::Service {
+ public:
+ explicit FakeImageAnnotationService(
+ service_manager::mojom::ServiceRequest request)
+ : service_binding_(this, std::move(request)) {}
+
+ ~FakeImageAnnotationService() override = default;
+
+ private:
+ // service_manager::Service:
+ void OnBindInterface(const service_manager::BindSourceInfo& source_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe) override {
+ registry_.BindInterface(interface_name, std::move(interface_pipe));
+ }
+
+ void OnStart() override {
+ registry_.AddInterface<image_annotation::mojom::Annotator>(
+ base::BindRepeating(&FakeAnnotator::BindRequest,
+ base::Unretained(&annotator_)));
+ }
+
+ service_manager::BinderRegistry registry_;
+ service_manager::ServiceBinding service_binding_;
+
+ FakeAnnotator annotator_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeImageAnnotationService);
+};
+
+void HandleImageAnnotatorServiceRequest(
+ service_manager::mojom::ServiceRequest request) {
+ new FakeImageAnnotationService(std::move(request));
+}
+
+} // namespace
+
+class ImageAnnotationBrowserTest : public InProcessBrowserTest {
+ public:
+ ImageAnnotationBrowserTest()
+ : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {
+ https_server_.AddDefaultHandlers(base::FilePath(kDocRoot));
+ }
+
+ protected:
+ void SetUp() override {
+ scoped_feature_list_.InitAndEnableFeature(
+ features::kExperimentalAccessibilityLabels);
+ InProcessBrowserTest::SetUp();
+ }
+
+ void SetUpOnMainThread() override {
+ InProcessBrowserTest::SetUpOnMainThread();
+
+ ASSERT_TRUE(https_server_.Start());
+
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+
+ content::ServiceManagerConnection* service_manager_connection =
+ content::BrowserContext::GetServiceManagerConnectionFor(
+ web_contents->GetBrowserContext());
+
+ service_manager_connection->AddServiceRequestHandler(
+ image_annotation::mojom::kServiceName,
+ base::BindRepeating(&HandleImageAnnotatorServiceRequest));
+
+ ui::AXMode mode = ui::kAXModeComplete;
+ mode.set_mode(ui::AXMode::kLabelImages, true);
+ web_contents->SetAccessibilityMode(mode);
+
+ SetAcceptLanguages("en,fr");
+ }
+
+ void SetAcceptLanguages(const std::string& accept_languages) {
+ content::BrowserContext* context =
+ static_cast<content::BrowserContext*>(browser()->profile());
+ DCHECK(context);
+
+ PrefService* prefs = user_prefs::UserPrefs::Get(context);
+ DCHECK(prefs);
+
+ prefs->Set(language::prefs::kAcceptLanguages,
+ base::Value(accept_languages));
+ }
+
+ protected:
+ net::EmbeddedTestServer https_server_;
+
+ private:
+ base::test::ScopedFeatureList scoped_feature_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImageAnnotationBrowserTest);
+};
+
+IN_PROC_BROWSER_TEST_F(ImageAnnotationBrowserTest,
+ AnnotateImageInAccessibilityTree) {
+ FakeAnnotator::SetReturnOcrResults(true);
+ FakeAnnotator::SetReturnLabelResults(true);
+ ui_test_utils::NavigateToURL(browser(),
+ https_server_.GetURL("/image_annotation.html"));
+
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+
+ content::WaitForAccessibilityTreeToContainNodeWithName(
+ web_contents,
+ "Appears to say: red.png Annotation. Appears to be: red.png 'en' Label");
+}
+
+IN_PROC_BROWSER_TEST_F(ImageAnnotationBrowserTest, ImagesInLinks) {
+ FakeAnnotator::SetReturnOcrResults(true);
+ ui_test_utils::NavigateToURL(
+ browser(), https_server_.GetURL("/image_annotation_link.html"));
+
+ // Block until the accessibility tree has at least 8 annotations. If
+ // that never happens, the test will time out.
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ while (10 > DescribeNodesWithAnnotations(
+ content::GetAccessibilityTreeSnapshot(web_contents))
+ .size()) {
+ content::WaitForAccessibilityTreeToChange(web_contents);
+ }
+
+ // All images should be annotated. Only links that contain exactly one image
+ // should be annotated.
+ ui::AXTreeUpdate ax_tree_update =
+ content::GetAccessibilityTreeSnapshot(web_contents);
+ EXPECT_THAT(
+ DescribeNodesWithAnnotations(ax_tree_update),
+ testing::ElementsAre("image Appears to say: red.png Annotation",
+ "link Appears to say: green.png Annotation",
+ "image Appears to say: green.png Annotation",
+ "image Appears to say: red.png Annotation",
+ "image Appears to say: printer.png Annotation",
+ "image Appears to say: red.png Annotation",
+ "link Appears to say: printer.png Annotation",
+ "image Appears to say: printer.png Annotation",
+ "link Appears to say: green.png Annotation",
+ "image Appears to say: green.png Annotation"));
+}
+
+IN_PROC_BROWSER_TEST_F(ImageAnnotationBrowserTest, ImageDoc) {
+ FakeAnnotator::SetReturnOcrResults(true);
+ ui_test_utils::NavigateToURL(
+ browser(), https_server_.GetURL("/image_annotation_doc.html"));
+
+ // Block until the accessibility tree has at least 2 annotations. If
+ // that never happens, the test will time out.
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ while (2 > DescribeNodesWithAnnotations(
+ content::GetAccessibilityTreeSnapshot(web_contents))
+ .size()) {
+ content::WaitForAccessibilityTreeToChange(web_contents);
+ }
+
+ // When a document contains exactly one image, the document should be
+ // annotated with the image's annotation, too.
+ ui::AXTreeUpdate ax_tree_update =
+ content::GetAccessibilityTreeSnapshot(web_contents);
+ EXPECT_THAT(
+ DescribeNodesWithAnnotations(ax_tree_update),
+ testing::ElementsAre("rootWebArea Appears to say: red.png Annotation",
+ "image Appears to say: red.png Annotation"));
+}
+
+IN_PROC_BROWSER_TEST_F(ImageAnnotationBrowserTest, ImageUrl) {
+ FakeAnnotator::SetReturnOcrResults(true);
+ ui_test_utils::NavigateToURL(browser(), https_server_.GetURL("/red.png"));
+
+ // Block until the accessibility tree has at least 2 annotations. If
+ // that never happens, the test will time out.
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ while (2 > DescribeNodesWithAnnotations(
+ content::GetAccessibilityTreeSnapshot(web_contents))
+ .size()) {
+ content::WaitForAccessibilityTreeToChange(web_contents);
+ }
+
+ // When a document contains exactly one image, the document should be
+ // annotated with the image's annotation, too.
+ ui::AXTreeUpdate ax_tree_update =
+ content::GetAccessibilityTreeSnapshot(web_contents);
+ EXPECT_THAT(
+ DescribeNodesWithAnnotations(ax_tree_update),
+ testing::ElementsAre("rootWebArea Appears to say: red.png Annotation",
+ "image Appears to say: red.png Annotation"));
+}
+
+IN_PROC_BROWSER_TEST_F(ImageAnnotationBrowserTest, NoAnnotationsAvailable) {
+ // Don't return any results.
+ FakeAnnotator::SetReturnOcrResults(false);
+ FakeAnnotator::SetReturnLabelResults(false);
+
+ ui_test_utils::NavigateToURL(
+ browser(), https_server_.GetURL("/image_annotation_doc.html"));
+
+ // Block until the annotation status for the root is empty. If that
+ // never occurs then the test will time out.
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ ui::AXTreeUpdate snapshot =
+ content::GetAccessibilityTreeSnapshot(web_contents);
+ while (snapshot.nodes[0].GetImageAnnotationStatus() !=
+ ax::mojom::ImageAnnotationStatus::kAnnotationEmpty) {
+ content::WaitForAccessibilityTreeToChange(web_contents);
+ snapshot = content::GetAccessibilityTreeSnapshot(web_contents);
+ }
+}
+
+IN_PROC_BROWSER_TEST_F(ImageAnnotationBrowserTest, AnnotationError) {
+ // Return an error code.
+ FakeAnnotator::SetReturnErrorCode(
+ image_annotation::mojom::AnnotateImageError::kFailure);
+
+ ui_test_utils::NavigateToURL(
+ browser(), https_server_.GetURL("/image_annotation_doc.html"));
+
+ // Block until the annotation status for the root is empty. If that
+ // never occurs then the test will time out.
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ ui::AXTreeUpdate snapshot =
+ content::GetAccessibilityTreeSnapshot(web_contents);
+ while (snapshot.nodes[0].GetImageAnnotationStatus() !=
+ ax::mojom::ImageAnnotationStatus::kAnnotationProcessFailed) {
+ content::WaitForAccessibilityTreeToChange(web_contents);
+ snapshot = content::GetAccessibilityTreeSnapshot(web_contents);
+ }
+}
+
+IN_PROC_BROWSER_TEST_F(ImageAnnotationBrowserTest, ImageWithSrcSet) {
+ FakeAnnotator::SetReturnOcrResults(true);
+ FakeAnnotator::SetReturnLabelResults(true);
+ ui_test_utils::NavigateToURL(browser(),
+ https_server_.GetURL("/image_srcset.html"));
+
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ content::WaitForAccessibilityTreeToContainNodeWithName(
+ web_contents,
+ "Appears to say: red.png Annotation. Appears to be: red.png 'en' Label");
+}
+
+IN_PROC_BROWSER_TEST_F(ImageAnnotationBrowserTest, AnnotationLanguages) {
+ FakeAnnotator::SetReturnOcrResults(true);
+ FakeAnnotator::SetReturnLabelResults(true);
+
+ ui_test_utils::NavigateToURL(browser(),
+ https_server_.GetURL("/image_annotation.html"));
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ content::WaitForAccessibilityTreeToContainNodeWithName(
+ web_contents,
+ "Appears to say: red.png Annotation. Appears to be: red.png 'en' Label");
+
+ SetAcceptLanguages("fr,en");
+ ui_test_utils::NavigateToURL(browser(),
+ https_server_.GetURL("/image_annotation.html"));
+ web_contents = browser()->tab_strip_model()->GetActiveWebContents();
+ content::WaitForAccessibilityTreeToContainNodeWithName(
+ web_contents,
+ "Appears to say: red.png Annotation. Appears to be: red.png 'fr' Label");
+}
diff --git a/chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc b/chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc
index d51d8eb671b..b6088ffd705 100644
--- a/chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc
+++ b/chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc
@@ -18,16 +18,13 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/request_handler_util.h"
-const base::FilePath::CharType kDocRoot[] =
- FILE_PATH_LITERAL("chrome/test/data");
-
class InterstitialAccessibilityBrowserTest : public InProcessBrowserTest {
public:
InterstitialAccessibilityBrowserTest()
: https_server_mismatched_(net::EmbeddedTestServer::TYPE_HTTPS) {
https_server_mismatched_.SetSSLConfig(
net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
- https_server_mismatched_.AddDefaultHandlers(base::FilePath(kDocRoot));
+ https_server_mismatched_.AddDefaultHandlers(GetChromeTestDataDir());
}
std::string GetNameOfFocusedNode(content::WebContents* web_contents) {
diff --git a/chromium/chrome/browser/android/vr/BUILD.gn b/chromium/chrome/browser/android/vr/BUILD.gn
index bafa714b2ac..dcb6b173e88 100644
--- a/chromium/chrome/browser/android/vr/BUILD.gn
+++ b/chromium/chrome/browser/android/vr/BUILD.gn
@@ -87,11 +87,6 @@ static_library("vr_android") {
"arcore_device/arcore_shim.cc",
"arcore_device/arcore_shim.h",
]
-
- # TODO(https://crbug.com/936004): Remove this once arcore_c_api.h is
- # -Wextra-semi clean.
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
}
deps = [
@@ -179,6 +174,28 @@ source_set("ui_module_factory") {
]
}
+# Similar to the ui_default_factory but also tries to open a dummy lib for the
+# purpose of exercising the library loading mechanism.
+source_set("ui_module_dummy_factory") {
+ sources = [
+ "ui_module_dummy_factory.cc",
+ "ui_module_dummy_factory.h",
+ ]
+ deps = [
+ ":ui_factory",
+ "//chrome/browser/vr:vr_base",
+ "//chrome/browser/vr:vr_ui",
+ ]
+}
+
+# A dummy lib used to test the library loading mechanism.
+loadable_module("vr_ui_dummy_lib") {
+ sources = [
+ "ui_dummy.cc",
+ "ui_dummy.h",
+ ]
+}
+
android_library("ar_java") {
deps = [
"//third_party/android_deps:com_google_ar_core_java",
@@ -190,6 +207,14 @@ android_library("ar_java") {
"//base:base_java",
"//chrome/android:chrome_java",
]
+
+ # TODO(crbug.com/938909): chromium_code.flags is not used as a proguard
+ # config when proguarding asynchronously. This results in AR crashing
+ # chrome when AR is an async DFM. Should implement a more scalable
+ # solution to including chromium_code.flags with all async DFMs.
+ if (async_ar) {
+ proguard_configs = [ "//base/android/proguard/chromium_code.flags" ]
+ }
}
if (enable_arcore) {
diff --git a/chromium/chrome/browser/apps/app_shim/BUILD.gn b/chromium/chrome/browser/apps/app_shim/BUILD.gn
index ffd8a3e7ead..380edca554b 100644
--- a/chromium/chrome/browser/apps/app_shim/BUILD.gn
+++ b/chromium/chrome/browser/apps/app_shim/BUILD.gn
@@ -18,6 +18,8 @@ source_set("app_shim") {
"apps_page_shim_handler.mm",
"extension_app_shim_handler_mac.cc",
"extension_app_shim_handler_mac.h",
+ "mach_bootstrap_acceptor.cc",
+ "mach_bootstrap_acceptor.h",
"unix_domain_socket_acceptor.cc",
"unix_domain_socket_acceptor.h",
]
diff --git a/chromium/chrome/browser/apps/platform_apps/api/BUILD.gn b/chromium/chrome/browser/apps/platform_apps/api/BUILD.gn
index 792a9979b23..25355d0d05b 100644
--- a/chromium/chrome/browser/apps/platform_apps/api/BUILD.gn
+++ b/chromium/chrome/browser/apps/platform_apps/api/BUILD.gn
@@ -59,6 +59,10 @@ source_set("api") {
"//extensions/browser",
]
+ public_deps = [
+ "//chrome/browser/apps/platform_apps/api/music_manager_private",
+ ]
+
if (is_chromeos) {
sources += [
"arc_apps_private/arc_apps_private_api.cc",
diff --git a/chromium/chrome/browser/browser_resources.grd b/chromium/chrome/browser/browser_resources.grd
index 05d6fa88092..0000c47c5e0 100644
--- a/chromium/chrome/browser/browser_resources.grd
+++ b/chromium/chrome/browser/browser_resources.grd
@@ -28,16 +28,12 @@
<if expr="chromeos">
<structure name="IDR_OOBE_HTML" file="resources\chromeos\login\oobe.html" flattenhtml="true" type="chrome_html" variables="OOBE=oobe" expand_variables="true"/>
<structure name="IDR_OOBE_JS" file="resources\chromeos\login\oobe.js" flattenhtml="true" type="chrome_html" />
- <structure name="IDR_OOBE_ENROLLMENT_HTML" file="resources\chromeos\login\oobe_screen_oauth_enrollment.html" flattenhtml="true" type="chrome_html" />
- <structure name="IDR_OOBE_ENROLLMENT_CSS" file="resources\chromeos\login\oobe_screen_oauth_enrollment.css" flattenhtml="true" type="chrome_html" />
- <structure name="IDR_OOBE_ENROLLMENT_JS" file="resources\chromeos\login\oobe_screen_oauth_enrollment.js" flattenhtml="true" type="chrome_html" />
<structure name="IDR_KEYBOARD_UTILS_JS" file="resources\chromeos\keyboard\keyboard_utils.js" flattenhtml="true" type="chrome_html" />
<structure name="IDR_CHROMEOS_DISCOVER_APP_HTML" file="resources\chromeos\login\discover\discover_app.html" flattenhtml="true" type="chrome_html"/>
<structure name="IDR_CHROMEOS_DISCOVER_APP_JS" file="resources\chromeos\login\discover\discover_app.js" flattenhtml="true" type="chrome_html"/>
<structure name="IDR_CHROMEOS_DISCOVER_MANIFEST" file="resources\chromeos\login\discover\manifest.json" flattenhtml="true" type="chrome_html"/>
<structure name="IDR_CUSTOM_ELEMENTS_OOBE_HTML" file="resources\chromeos\login\custom_elements_oobe.html" flattenhtml="true" type="chrome_html" />
<structure name="IDR_CUSTOM_ELEMENTS_OOBE_JS" file="resources\chromeos\login\custom_elements_oobe.js" flattenhtml="true" type="chrome_html" />
- <structure name="IDR_CUSTOM_ELEMENTS_USER_POD_HTML" file="resources\chromeos\login\custom_elements_user_pod.html" flattenhtml="true" type="chrome_html" />
<structure name="IDR_CUSTOM_ELEMENTS_LOGIN_HTML" file="resources\chromeos\login\custom_elements_login.html" flattenhtml="true" type="chrome_html" />
<structure name="IDR_CUSTOM_ELEMENTS_LOGIN_JS" file="resources\chromeos\login\custom_elements_login.js" flattenhtml="true" type="chrome_html" />
<structure name="IDR_ASSISTANT_OPTIN_HTML" file="resources\chromeos\assistant_optin\assistant_optin.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" />
@@ -97,20 +93,20 @@
<include name="IDR_ABOUT_FLASH_JS" file="resources\about_flash.js" type="BINDATA" />
</if>
<if expr="not disable_nacl">
- <include name="IDR_ABOUT_NACL_HTML" file="resources\about_nacl.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
- <include name="IDR_ABOUT_NACL_CSS" file="resources\about_nacl.css" flattenhtml="true" type="chrome_html" />
- <include name="IDR_ABOUT_NACL_JS" file="resources\about_nacl.js" type="BINDATA" />
+ <include name="IDR_ABOUT_NACL_HTML" file="resources\about_nacl\about_nacl.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_ABOUT_NACL_CSS" file="resources\about_nacl\about_nacl.css" flattenhtml="true" type="chrome_html" />
+ <include name="IDR_ABOUT_NACL_JS" file="resources\about_nacl\about_nacl.js" type="BINDATA" />
</if>
<if expr="not is_android">
- <include name="IDR_ABOUT_SYS_HTML" file="resources\about_sys\about_sys.html" compress="gzip" flattenhtml="true" type="BINDATA" />
- <include name="IDR_ABOUT_SYS_CSS" file="resources\about_sys\about_sys.css" compress="gzip" type="BINDATA" />
+ <include name="IDR_ABOUT_SYS_HTML" file="resources\about_sys\about_sys.html" compress="gzip" type="BINDATA" />
+ <include name="IDR_ABOUT_SYS_CSS" file="resources\about_sys\about_sys.css" compress="gzip" flattenhtml="true" type="BINDATA" />
<include name="IDR_ABOUT_SYS_JS" file="resources\about_sys\about_sys.js" compress="gzip" type="BINDATA" />
</if>
<include name="IDR_ACCESSIBILITY_HTML" file="resources\accessibility\accessibility.html" flattenhtml="true" allowexternalscript="true" compress="gzip" type="BINDATA" />
<include name="IDR_ACCESSIBILITY_CSS" file="resources\accessibility\accessibility.css" compress="gzip" type="BINDATA" />
<include name="IDR_ACCESSIBILITY_JS" file="resources\accessibility\accessibility.js" flattenhtml="true" compress="gzip" type="BINDATA" />
<include name="IDR_AD_NETWORK_HASHES" file="resources\ad_networks.dat" type="BINDATA" />
- <include name="IDR_AUTOFILL_INTERNALS_HTML" file="resources\autofill_internals.html" compress="gzip" type="BINDATA" />
+ <include name="IDR_AUTOFILL_INTERNALS_HTML" file="resources\autofill_internals\autofill_internals.html" compress="gzip" type="BINDATA" />
<include name="IDR_BLUETOOTH_ADAPTER_MOJO_JS" file="${root_gen_dir}\device\bluetooth\public\mojom\adapter.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_BLUETOOTH_DEVICE_MOJO_JS" file="${root_gen_dir}\device\bluetooth\public\mojom\device.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_BLUETOOTH_UUID_MOJO_JS" file="${root_gen_dir}\device\bluetooth\public\mojom\uuid.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
@@ -145,9 +141,9 @@
<include name="IDR_CLOUDPRINT_MANIFEST" file="resources\cloud_print_app\manifest.json" type="BINDATA" />
</if>
<include name="IDR_DEVTOOLS_DISCOVERY_PAGE_HTML" file="devtools\frontend\devtools_discovery_page.html" type="BINDATA"/>
- <include name="IDR_DOMAIN_RELIABILITY_INTERNALS_HTML" file="resources\domain_reliability_internals.html" compress="gzip" type="BINDATA" />
- <include name="IDR_DOMAIN_RELIABILITY_INTERNALS_CSS" file="resources\domain_reliability_internals.css" compress="gzip" type="BINDATA" />
- <include name="IDR_DOMAIN_RELIABILITY_INTERNALS_JS" file="resources\domain_reliability_internals.js" compress="gzip" type="BINDATA" />
+ <include name="IDR_DOMAIN_RELIABILITY_INTERNALS_HTML" file="resources\domain_reliability_internals\domain_reliability_internals.html" compress="gzip" type="BINDATA" />
+ <include name="IDR_DOMAIN_RELIABILITY_INTERNALS_CSS" file="resources\domain_reliability_internals\domain_reliability_internals.css" compress="gzip" type="BINDATA" />
+ <include name="IDR_DOMAIN_RELIABILITY_INTERNALS_JS" file="resources\domain_reliability_internals\domain_reliability_internals.js" compress="gzip" type="BINDATA" />
<if expr="safe_browsing_mode != 0">
<include name="IDR_DOWNLOAD_FILE_TYPES_PB" file="${root_gen_dir}\chrome\browser\resources\safe_browsing\download_file_types.pb" use_base_dir="false" type="BINDATA" />
</if>
@@ -159,6 +155,8 @@
<include name="IDR_UKM_INTERNALS_HTML" file="../../components/ukm/debug/ukm_internals.html" flattenhtml="true" allowexternalscript="true" compress="gzip" type="BINDATA" />
<include name="IDR_UKM_INTERNALS_JS" file="../../components/ukm/debug/ukm_internals.js" flattenhtml="true" compress="gzip" type="BINDATA" />
<include name="IDR_UKM_INTERNALS_CSS" file="../../components/ukm/debug/ukm_internals.css" flattenhtml="true" compress="gzip" type="BINDATA" />
+ <include name="IDR_TRANSLATE_INTERNALS_HTML" file="../../components/translate/translate_internals/translate_internals.html" flattenhtml="true" allowexternalscript="true" compress="gzip" type="BINDATA" />
+ <include name="IDR_TRANSLATE_INTERNALS_JS" file="../../components/translate/translate_internals/translate_internals.js" flattenhtml="true" compress="gzip" type="BINDATA" />
<if expr="not is_android">
<include name="IDR_DOWNLOADS_IMAGES_INCOGNITO_MARKER_SVG" file="resources\downloads\images\incognito_marker.svg" type="BINDATA" />
<include name="IDR_DOWNLOADS_IMAGES_NO_DOWNLOADS_SVG" file="resources\downloads\images\no_downloads.svg" type="BINDATA" />
@@ -196,7 +194,7 @@
<include name="IDR_EOC_INTERNALS_HTML" file="resources\eoc_internals\eoc_internals.html" allowexternalscript="true" compress="gzip" type="BINDATA" />
<include name="IDR_EOC_INTERNALS_CSS" file="resources\eoc_internals\eoc_internals.css" compress="gzip" type="BINDATA" />
<include name="IDR_EOC_INTERNALS_JS" file="resources\eoc_internals\eoc_internals.js" compress="gzip" type="BINDATA" />
- <include name="IDR_EOC_INTERNALS_MOJO_JS" file="${root_gen_dir}\chrome\browser\ui\webui\eoc_internals\eoc_internals.mojom.js" use_base_dir="false" type="BINDATA" compress="gzip" />
+ <include name="IDR_EOC_INTERNALS_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\eoc_internals\eoc_internals.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_EXPLORE_SITES_INTERNALS_HTML" file="resources\explore_sites_internals\explore_sites_internals.html" allowexternalscript="true" compress="gzip" type="BINDATA" />
<include name="IDR_EXPLORE_SITES_INTERNALS_CSS" file="resources\explore_sites_internals\explore_sites_internals.css" compress="gzip" type="BINDATA" />
<include name="IDR_EXPLORE_SITES_INTERNALS_JS" file="resources\explore_sites_internals\explore_sites_internals.js" compress="gzip" type="BINDATA" />
@@ -212,11 +210,11 @@
<include name="IDR_SNIPPETS_INTERNALS_HTML" file="resources\snippets_internals\snippets_internals.html" allowexternalscript="true" compress="gzip" type="BINDATA" />
<include name="IDR_SNIPPETS_INTERNALS_CSS" file="resources\snippets_internals\snippets_internals.css" compress="gzip" type="BINDATA" />
<include name="IDR_SNIPPETS_INTERNALS_JS" file="resources\snippets_internals\snippets_internals.js" compress="gzip" type="BINDATA" />
- <include name="IDR_SNIPPETS_INTERNALS_MOJO_JS" file="${root_gen_dir}\chrome\browser\ui\webui\snippets_internals\snippets_internals.mojom.js" use_base_dir="false" type="BINDATA" compress="gzip" />
+ <include name="IDR_SNIPPETS_INTERNALS_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\snippets_internals\snippets_internals.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
</if>
- <include name="IDR_SUPERVISED_USER_INTERNALS_HTML" file="resources\supervised_user_internals.html" allowexternalscript="true" compress="gzip" type="BINDATA" />
- <include name="IDR_SUPERVISED_USER_INTERNALS_CSS" file="resources\supervised_user_internals.css" compress="gzip" type="BINDATA" />
- <include name="IDR_SUPERVISED_USER_INTERNALS_JS" file="resources\supervised_user_internals.js" compress="gzip" type="BINDATA" />
+ <include name="IDR_SUPERVISED_USER_INTERNALS_HTML" file="resources\supervised_user_internals\supervised_user_internals.html" allowexternalscript="true" compress="gzip" type="BINDATA" />
+ <include name="IDR_SUPERVISED_USER_INTERNALS_CSS" file="resources\supervised_user_internals\supervised_user_internals.css" compress="gzip" type="BINDATA" />
+ <include name="IDR_SUPERVISED_USER_INTERNALS_JS" file="resources\supervised_user_internals\supervised_user_internals.js" compress="gzip" type="BINDATA" />
<if expr="enable_hangout_services_extension">
<!-- Hangout Services extension, included in Google Chrome builds only. -->
<include name="IDR_HANGOUT_SERVICES_MANIFEST" file="resources\hangout_services\manifest.json" type="BINDATA" />
@@ -333,8 +331,6 @@
<include name="IDR_BOOKMARKS_STORE_JS" file="resources\bookmarks\store.js" type="BINDATA" />
<include name="IDR_BOOKMARKS_STRINGS_HTML" file="resources\bookmarks\strings.html" type="BINDATA" />
- <include name="IDR_BOOKMARKS_TOAST_MANAGER_HTML" file="resources\bookmarks\toast_manager.html" type="BINDATA" />
- <include name="IDR_BOOKMARKS_TOAST_MANAGER_JS" file="resources\bookmarks\toast_manager.js" type="BINDATA" />
<include name="IDR_BOOKMARKS_TOOLBAR_HTML" file="resources\bookmarks\toolbar.html" type="BINDATA" />
<include name="IDR_BOOKMARKS_TOOLBAR_JS" file="resources\bookmarks\toolbar.js" type="BINDATA" />
<include name="IDR_BOOKMARKS_UTIL_HTML" file="resources\bookmarks\util.html" type="BINDATA" />
@@ -436,8 +432,8 @@
<include name="IDR_ORIGIN_MOJO_JS" file="${root_gen_dir}\url\mojom\origin.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip"/>
<include name="IDR_COMPONENTS_HTML" file="resources\components.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_COMPONENTS_JS" file="resources\components.js" type="BINDATA" compress="gzip" />
- <include name="IDR_MEMORY_INTERNALS_HTML" file="resources\memory_internals.html" flattenhtml="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MEMORY_INTERNALS_JS" file="resources\memory_internals.js" type="BINDATA" compress="gzip" />
+ <include name="IDR_MEMORY_INTERNALS_HTML" file="resources\memory_internals\memory_internals.html" flattenhtml="true" type="BINDATA" compress="gzip" />
+ <include name="IDR_MEMORY_INTERNALS_JS" file="resources\memory_internals\memory_internals.js" type="BINDATA" compress="gzip" />
<if expr="enable_plugins">
<include name="IDR_PDF_MANIFEST" file="resources\pdf\manifest.json" type="BINDATA" />
</if>
@@ -469,7 +465,6 @@
<include name="IDR_SITE_ENGAGEMENT_JS" file="resources\engagement\site_engagement.js" flattenhtml="true" type="BINDATA" compress="gzip" />
<include name="IDR_SITE_ENGAGEMENT_DETAILS_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\engagement\site_engagement_details.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_URL_MOJOM_LITE_JS" file="${root_gen_dir}\url\mojom\url.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
- <include name="IDR_SYNC_CONFIRMATION_CSS" file="resources\signin\sync_confirmation\sync_confirmation.css" type="BINDATA" />
<include name="IDR_SYNC_CONFIRMATION_HTML" file="resources\signin\sync_confirmation\sync_confirmation.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_SYNC_CONFIRMATION_JS" file="resources\signin\sync_confirmation\sync_confirmation.js" type="BINDATA" />
<include name="IDR_DICE_SYNC_CONFIRMATION_HTML" file="resources\signin\dice_sync_confirmation\sync_confirmation.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
@@ -488,6 +483,7 @@
<include name="IDR_USB_DEVICE_MANAGER_TEST_MOJOM_LITE_JS" file="${root_gen_dir}\device\usb\public\mojom\device_manager_test.mojom-lite.js" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_USB_DEVICE_MOJOM_LITE_JS" file="${root_gen_dir}\device\usb\public\mojom\device.mojom-lite.js" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_CSS" file="resources\usb_internals\usb_internals.css" type="BINDATA" compress="gzip" />
+ <include name="IDR_USB_INTERNALS_DESCRIPTOR_PANEL_JS" file="resources\usb_internals\descriptor_panel.js" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_DEVICES_PAGE_JS" file="resources\usb_internals\devices_page.js" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_HTML" file="resources\usb_internals\usb_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_JS" file="resources\usb_internals\usb_internals.js" type="BINDATA" compress="gzip" />
@@ -517,6 +513,11 @@
<include name="IDR_ACCOUNT_MANAGER_WELCOME_2X_PNG" file="resources\chromeos\account_manager_welcome_2x.png" type="BINDATA" compress="gzip" />
<include name="IDR_ACCOUNT_MANAGER_WELCOME_GOOGLE_LOGO_SVG" file="resources\chromeos\googleg.svg" type="BINDATA" compress="gzip" />
+ <include name="IDR_PASSWORD_CHANGE_HTML" file="resources\chromeos\password_change\password_change.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_PASSWORD_CHANGE_JS" file="resources\chromeos\password_change\password_change.js" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_PASSWORD_CHANGE_CSS" file="resources\chromeos\password_change\password_change.css" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_PASSWORD_CHANGE_AUTHENTICATOR_JS" file="resources\gaia_auth_host\password_change_authenticator.js" flattenhtml="true" type="BINDATA" />
+
<include name="IDR_CROSH_BUILTIN_MANIFEST" file="resources\chromeos\crosh_builtin\manifest.json" type="BINDATA" />
<include name="IDR_CRYPTOHOME_HTML" file="resources\chromeos\cryptohome.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_CRYPTOHOME_JS" file="resources\chromeos\cryptohome.js" type="BINDATA" />
@@ -549,11 +550,10 @@
</else>
</if>
<include name="IDR_CERT_MANAGER_DIALOG_HTML" file="resources\chromeos\certificate_manager_dialog.html" flattenhtml="true" type="BINDATA" />
- <include name="IDR_SLOW_HTML" file="resources\chromeos\slow.html" flattenhtml="true" type="BINDATA" />
- <include name="IDR_SLOW_JS" file="resources\chromeos\slow.js" type="BINDATA" />
+ <include name="IDR_SLOW_CSS" file="resources\chromeos\slow.css" type="BINDATA" compress="gzip" />
+ <include name="IDR_SLOW_HTML" file="resources\chromeos\slow.html" type="BINDATA" compress="gzip" />
+ <include name="IDR_SLOW_JS" file="resources\chromeos\slow.js" type="BINDATA" compress="gzip" />
<include name="IDR_HATS_HTML" file="resources\chromeos\hats\hats.html" flattenhtml="false" type="BINDATA" />
- </if>
- <if expr="chromeos">
<include name="IDR_DEMO_APP_MANIFEST" file="resources\chromeos\demo_app\manifest.json" type="BINDATA" />
<include name="IDR_WALLPAPERMANAGER_MANIFEST" file="resources\chromeos\wallpaper_manager\manifest.json" type="BINDATA" />
<include name="IDR_FIRST_RUN_DIALOG_MANIFEST" file="resources\chromeos\first_run\app/manifest.json" type="BINDATA" />
@@ -571,27 +571,27 @@
<include name="IDR_SET_AS_DEFAULT_BROWSER_HTML" file="resources\set_as_default_browser.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
</if>
<if expr="not is_android and not chromeos">
- <include name="IDR_MD_CONTROL_BAR_HTML" file="resources\md_user_manager\control_bar.html" type="BINDATA" />
- <include name="IDR_MD_CONTROL_BAR_JS" file="resources\md_user_manager\control_bar.js" type="BINDATA" />
- <include name="IDR_MD_CREATE_PROFILE_HTML" file="resources\md_user_manager\create_profile.html" type="BINDATA" />
- <include name="IDR_MD_CREATE_PROFILE_JS" file="resources\md_user_manager\create_profile.js" type="BINDATA" />
- <include name="IDR_MD_ERROR_DIALOG_HTML" file="resources\md_user_manager\error_dialog.html" type="BINDATA" />
- <include name="IDR_MD_ERROR_DIALOG_JS" file="resources\md_user_manager\error_dialog.js" type="BINDATA" />
- <include name="IDR_MD_PROFILE_BROWSER_PROXY_HTML" file="resources\md_user_manager\profile_browser_proxy.html" type="BINDATA" />
- <include name="IDR_MD_PROFILE_BROWSER_PROXY_JS" file="resources\md_user_manager\profile_browser_proxy.js" type="BINDATA" />
- <include name="IDR_MD_USER_MANAGER_HTML" file="resources\md_user_manager\user_manager.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
- <include name="IDR_MD_USER_MANAGER_JS" file="resources\md_user_manager\user_manager.js" flattenhtml="true" type="BINDATA" />
- <include name="IDR_MD_USER_MANAGER_PAGES_HTML" file="resources\md_user_manager\user_manager_pages.html" type="BINDATA" />
- <include name="IDR_MD_USER_MANAGER_PAGES_JS" file="resources\md_user_manager\user_manager_pages.js" type="BINDATA" />
- <include name="IDR_MD_USER_MANAGER_SHARED_STYLES_HTML" file="resources\md_user_manager\shared_styles.html" flattenhtml="true" type="BINDATA" />
- <include name="IDR_MD_USER_MANAGER_STRINGS_HTML" file="resources\md_user_manager\strings.html" type="BINDATA" />
- <include name="IDR_MD_USER_MANAGER_TUTORIAL_HTML" file="resources\md_user_manager\user_manager_tutorial.html" type="BINDATA" />
- <include name="IDR_MD_USER_MANAGER_TUTORIAL_JS" file="resources\md_user_manager\user_manager_tutorial.js" type="BINDATA" />
+ <include name="IDR_CONTROL_BAR_HTML" file="resources\user_manager\control_bar.html" type="BINDATA" />
+ <include name="IDR_CONTROL_BAR_JS" file="resources\user_manager\control_bar.js" type="BINDATA" />
+ <include name="IDR_CREATE_PROFILE_HTML" file="resources\user_manager\create_profile.html" type="BINDATA" />
+ <include name="IDR_CREATE_PROFILE_JS" file="resources\user_manager\create_profile.js" type="BINDATA" />
+ <include name="IDR_ERROR_DIALOG_HTML" file="resources\user_manager\error_dialog.html" type="BINDATA" />
+ <include name="IDR_ERROR_DIALOG_JS" file="resources\user_manager\error_dialog.js" type="BINDATA" />
+ <include name="IDR_PROFILE_BROWSER_PROXY_HTML" file="resources\user_manager\profile_browser_proxy.html" type="BINDATA" />
+ <include name="IDR_PROFILE_BROWSER_PROXY_JS" file="resources\user_manager\profile_browser_proxy.js" type="BINDATA" />
+ <include name="IDR_USER_MANAGER_HTML" file="resources\user_manager\user_manager.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_USER_MANAGER_JS" file="resources\user_manager\user_manager.js" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_USER_MANAGER_PAGES_HTML" file="resources\user_manager\user_manager_pages.html" type="BINDATA" />
+ <include name="IDR_USER_MANAGER_PAGES_JS" file="resources\user_manager\user_manager_pages.js" type="BINDATA" />
+ <include name="IDR_USER_MANAGER_SHARED_STYLES_HTML" file="resources\user_manager\shared_styles.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_USER_MANAGER_STRINGS_HTML" file="resources\user_manager\strings.html" type="BINDATA" />
+ <include name="IDR_USER_MANAGER_TUTORIAL_HTML" file="resources\user_manager\user_manager_tutorial.html" type="BINDATA" />
+ <include name="IDR_USER_MANAGER_TUTORIAL_JS" file="resources\user_manager\user_manager_tutorial.js" type="BINDATA" />
</if>
<if expr="not is_android">
- <include name="IDR_IDENTITY_INTERNALS_HTML" file="resources\identity_internals.html" type="BINDATA" />
- <include name="IDR_IDENTITY_INTERNALS_CSS" file="resources\identity_internals.css" type="BINDATA" />
- <include name="IDR_IDENTITY_INTERNALS_JS" file="resources\identity_internals.js" type="BINDATA" />
+ <include name="IDR_IDENTITY_INTERNALS_HTML" file="resources\identity_internals\identity_internals.html" type="BINDATA" />
+ <include name="IDR_IDENTITY_INTERNALS_CSS" file="resources\identity_internals\identity_internals.css" type="BINDATA" />
+ <include name="IDR_IDENTITY_INTERNALS_JS" file="resources\identity_internals\identity_internals.js" type="BINDATA" />
</if>
<include name="IDR_DEVICE_LOG_UI_HTML" file="resources\device_log_ui\device_log_ui.html" type="BINDATA" compress="gzip" />
<include name="IDR_DEVICE_LOG_UI_JS" file="resources\device_log_ui\device_log_ui.js" type="BINDATA" compress="gzip" />
@@ -651,9 +651,10 @@
<include name="IDR_DEVICE_EMULATOR_SHARED_STYLES_HTML" file="resources\chromeos\emulator\shared_styles.html" type="BINDATA" />
</if>
<if expr="chromeos">
- <include name="IDR_SET_TIME_HTML" file="resources\chromeos\set_time\set_time.html" type="BINDATA" />
- <include name="IDR_SET_TIME_CSS" file="resources\chromeos\set_time\set_time.css" type="BINDATA" />
- <include name="IDR_SET_TIME_JS" file="resources\chromeos\set_time\set_time.js" type="BINDATA" />
+ <include name="IDR_SET_TIME_DIALOG_HTML" file="resources\chromeos\set_time_dialog\set_time_dialog.html" type="BINDATA" compress="gzip" />
+ <include name="IDR_SET_TIME_DIALOG_JS" file="resources\chromeos\set_time_dialog\set_time_dialog.js" type="BINDATA" compress="gzip" />
+ <include name="IDR_SET_TIME_BROWSER_PROXY_HTML" file="resources\chromeos\set_time_dialog\set_time_browser_proxy.html" type="BINDATA" compress="gzip" />
+ <include name="IDR_SET_TIME_BROWSER_PROXY_JS" file="resources\chromeos\set_time_dialog\set_time_browser_proxy.js" type="BINDATA" compress="gzip" />
</if>
<if expr="chromeos">
<if expr="_google_chrome">
@@ -723,7 +724,7 @@
<if expr="safe_browsing_mode == 1">
<include name="IDR_RESET_PASSWORD_HTML" file="resources\reset_password\reset_password.html" type="BINDATA" compress="gzip" />
<include name="IDR_RESET_PASSWORD_JS" file="resources\reset_password\reset_password.js" type="BINDATA" compress="gzip" />
- <include name="IDR_RESET_PASSWORD_MOJO_JS" file="${root_gen_dir}\chrome\browser\ui\webui\reset_password\reset_password.mojom.js" use_base_dir="false" type="BINDATA" compress="gzip" />
+ <include name="IDR_RESET_PASSWORD_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\reset_password\reset_password.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
</if>
<if expr="not is_android">
<include name="IDR_TAB_RANKER_EXAMPLE_PREPROCESSOR_CONFIG_PB" file="resource_coordinator\tab_ranker\example_preprocessor_config.pb" type="BINDATA" />
diff --git a/chromium/chrome/browser/browser_switcher/bho/BUILD.gn b/chromium/chrome/browser/browser_switcher/bho/BUILD.gn
new file mode 100644
index 00000000000..beeeaec81fc
--- /dev/null
+++ b/chromium/chrome/browser/browser_switcher/bho/BUILD.gn
@@ -0,0 +1,35 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/toolchain/win/midl.gni")
+
+assert(is_win)
+
+shared_library("browser_switcher_bho") {
+ # TODO(nicolaso): Reduce binary size as much as possible.
+ #
+ # TODO(nicolaso): Use ie_bho.def and ie_bho.rc.
+ #
+ # TODO(nicolaso): avoid code duplication, by using BrowserSwitcherSitelist and
+ # AlternativeBrowserDriver classes from chrome/browser_switcher/.
+ sources = [
+ "//base/win/atl.h",
+ "bho.cc",
+ "bho.h",
+ "browser_switcher_core.cc",
+ "browser_switcher_core.h",
+ "logging.cc",
+ "logging.h",
+ "resource.h",
+ ]
+ deps = [
+ ":ie_bho_idl",
+ ]
+}
+
+midl("ie_bho_idl") {
+ sources = [
+ "ie_bho_idl.idl",
+ ]
+}
diff --git a/chromium/chrome/browser/chromeos/BUILD.gn b/chromium/chrome/browser/chromeos/BUILD.gn
index 34f999b0fac..655483b2c13 100644
--- a/chromium/chrome/browser/chromeos/BUILD.gn
+++ b/chromium/chrome/browser/chromeos/BUILD.gn
@@ -30,10 +30,10 @@ source_set("chromeos") {
"//chrome/browser/chromeos/power/ml:user_activity_ukm_logger_helpers",
"//chromeos/dbus:cicerone_proto",
"//chromeos/dbus:concierge_proto",
- "//chromeos/dbus:power_manager_proto",
"//chromeos/dbus:runtime_probe_proto",
"//chromeos/dbus:seneschal_proto",
"//chromeos/dbus:vm_applications_apps_proto",
+ "//chromeos/dbus/power:power_manager_proto",
"//chromeos/strings",
"//components/policy/proto",
"//content/app/resources",
@@ -58,6 +58,7 @@ source_set("chromeos") {
"//chrome/app:command_ids",
"//chrome/browser/apps/platform_apps",
"//chrome/browser/apps/platform_apps/api",
+ "//chrome/browser/chromeos/kiosk_next_home/mojom",
"//chrome/browser/chromeos/power/ml/smart_dim",
"//chrome/browser/devtools",
"//chrome/browser/extensions",
@@ -70,33 +71,49 @@ source_set("chromeos") {
"//chrome/common",
"//chrome/common/extensions/api",
"//chrome/services/app_service:lib",
- "//chrome/services/diagnosticsd/public/mojom",
+ "//chrome/services/app_service/public/cpp:app_service_proxy",
+ "//chrome/services/app_service/public/cpp:app_update",
"//chrome/services/file_util/public/cpp",
+ "//chrome/services/wilco_dtc_supportd/public/mojom",
"//chromeos",
"//chromeos/assistant:buildflags",
"//chromeos/attestation",
"//chromeos/audio",
+ "//chromeos/components/account_manager",
"//chromeos/components/drivefs",
"//chromeos/components/drivefs/mojom",
"//chromeos/components/multidevice",
"//chromeos/components/multidevice/logging",
+ "//chromeos/components/power",
"//chromeos/components/proximity_auth",
"//chromeos/components/tether",
"//chromeos/cryptohome",
"//chromeos/dbus",
- "//chromeos/dbus:attestation_proto",
- "//chromeos/dbus:authpolicy_proto",
- "//chromeos/dbus:biod_proto",
- "//chromeos/dbus:cryptohome_proto",
- "//chromeos/dbus:cryptohome_signkey_proto",
- "//chromeos/dbus:login_manager_proto",
- "//chromeos/dbus:media_perception_proto",
"//chromeos/dbus:metrics_event_proto",
"//chromeos/dbus:oobe_config_proto",
"//chromeos/dbus:plugin_vm_service_proto",
+ "//chromeos/dbus/audio",
+ "//chromeos/dbus/auth_policy",
+ "//chromeos/dbus/auth_policy:authpolicy_proto",
+ "//chromeos/dbus/biod",
"//chromeos/dbus/constants",
+ "//chromeos/dbus/cryptohome",
+ "//chromeos/dbus/cryptohome:attestation_proto",
+ "//chromeos/dbus/cryptohome:cryptohome_proto",
+ "//chromeos/dbus/cryptohome:cryptohome_signkey_proto",
+ "//chromeos/dbus/cups_proxy",
+ "//chromeos/dbus/kerberos",
+ "//chromeos/dbus/kerberos:kerberos_proto",
+ "//chromeos/dbus/machine_learning",
+ "//chromeos/dbus/media_analytics",
+ "//chromeos/dbus/media_analytics:media_perception_proto",
+ "//chromeos/dbus/permission_broker",
+ "//chromeos/dbus/power",
"//chromeos/dbus/services:services",
+ "//chromeos/dbus/session_manager",
+ "//chromeos/dbus/session_manager:login_manager_proto",
"//chromeos/dbus/system_clock",
+ "//chromeos/dbus/upstart",
"//chromeos/disks",
"//chromeos/geolocation",
"//chromeos/login/auth",
@@ -113,6 +130,7 @@ source_set("chromeos") {
"//chromeos/services/multidevice_setup/public/cpp:prefs",
"//chromeos/services/secure_channel/public/cpp/client",
"//chromeos/settings",
+ "//chromeos/system",
"//chromeos/timezone",
"//chromeos/tpm",
"//components/arc",
@@ -153,6 +171,7 @@ source_set("chromeos") {
"//components/policy:generated",
"//components/policy/core/browser",
"//components/policy/core/common:common",
+ "//components/policy/core/common:common_constants",
"//components/pref_registry",
"//components/proxy_config",
"//components/quirks",
@@ -171,6 +190,7 @@ source_set("chromeos") {
"//components/translate/core/browser:browser",
"//components/ukm/content",
"//components/user_manager",
+ "//components/vector_icons",
# This depends directly on the variations target, rather than just
# transitively via the common target because the proto sources need to
@@ -205,9 +225,11 @@ source_set("chromeos") {
# TODO: care about enable_basic_printing and enable_print_preview.
"//printing",
"//remoting/host/it2me:chrome_os_host",
+ "//services/audio/public/cpp",
"//services/data_decoder/public/cpp",
"//services/device/public/mojom",
"//services/identity/public/cpp",
+ "//services/identity/public/mojom",
"//services/metrics/public/cpp:ukm_builders",
"//services/preferences/public/mojom",
"//services/resource_coordinator/public/cpp:resource_coordinator_cpp",
@@ -229,6 +251,8 @@ source_set("chromeos") {
"//ui/accessibility",
"//ui/aura",
"//ui/base",
+ "//ui/base/idle",
+ "//ui/base/ime/chromeos",
"//ui/chromeos",
"//ui/chromeos/events",
"//ui/compositor",
@@ -261,6 +285,7 @@ source_set("chromeos") {
"//chrome/browser/extensions",
"//chrome/browser/apps/platform_apps/api",
"//chrome/browser/web_applications",
+ "//chrome/browser/web_applications/components",
]
sources = [
@@ -295,6 +320,10 @@ source_set("chromeos") {
"accessibility/switch_access_panel.h",
"account_manager/account_manager_migrator.cc",
"account_manager/account_manager_migrator.h",
+ "account_manager/account_manager_policy_controller.cc",
+ "account_manager/account_manager_policy_controller.h",
+ "account_manager/account_manager_policy_controller_factory.cc",
+ "account_manager/account_manager_policy_controller_factory.h",
"account_manager/account_manager_util.cc",
"account_manager/account_manager_util.h",
"account_manager/account_migration_runner.cc",
@@ -382,18 +411,8 @@ source_set("chromeos") {
"apps/apk_web_app_service.h",
"apps/apk_web_app_service_factory.cc",
"apps/apk_web_app_service_factory.h",
- "apps/intent_helper/apps_navigation_throttle.cc",
- "apps/intent_helper/apps_navigation_throttle.h",
- "apps/intent_helper/apps_navigation_types.cc",
- "apps/intent_helper/apps_navigation_types.h",
- "apps/intent_helper/intent_picker_auto_display_pref.cc",
- "apps/intent_helper/intent_picker_auto_display_pref.h",
- "apps/intent_helper/intent_picker_auto_display_service.cc",
- "apps/intent_helper/intent_picker_auto_display_service.h",
- "apps/intent_helper/intent_picker_auto_display_service_factory.cc",
- "apps/intent_helper/intent_picker_auto_display_service_factory.h",
- "apps/intent_helper/page_transition_util.cc",
- "apps/intent_helper/page_transition_util.h",
+ "apps/intent_helper/chromeos_apps_navigation_throttle.cc",
+ "apps/intent_helper/chromeos_apps_navigation_throttle.h",
"arc/accessibility/accessibility_node_info_data_wrapper.cc",
"arc/accessibility/accessibility_node_info_data_wrapper.h",
"arc/accessibility/accessibility_window_info_data_wrapper.cc",
@@ -465,6 +484,8 @@ source_set("chromeos") {
"arc/fileapi/arc_content_file_system_backend_delegate.h",
"arc/fileapi/arc_content_file_system_file_stream_reader.cc",
"arc/fileapi/arc_content_file_system_file_stream_reader.h",
+ "arc/fileapi/arc_content_file_system_file_stream_writer.cc",
+ "arc/fileapi/arc_content_file_system_file_stream_writer.h",
"arc/fileapi/arc_content_file_system_url_util.cc",
"arc/fileapi/arc_content_file_system_url_util.h",
"arc/fileapi/arc_documents_provider_async_file_util.cc",
@@ -473,6 +494,8 @@ source_set("chromeos") {
"arc/fileapi/arc_documents_provider_backend_delegate.h",
"arc/fileapi/arc_documents_provider_file_stream_reader.cc",
"arc/fileapi/arc_documents_provider_file_stream_reader.h",
+ "arc/fileapi/arc_documents_provider_file_stream_writer.cc",
+ "arc/fileapi/arc_documents_provider_file_stream_writer.h",
"arc/fileapi/arc_documents_provider_root.cc",
"arc/fileapi/arc_documents_provider_root.h",
"arc/fileapi/arc_documents_provider_root_map.cc",
@@ -514,8 +537,6 @@ source_set("chromeos") {
"arc/intent_helper/arc_intent_picker_app_fetcher.h",
"arc/intent_helper/arc_settings_service.cc",
"arc/intent_helper/arc_settings_service.h",
- "arc/intent_helper/intent_picker_controller.cc",
- "arc/intent_helper/intent_picker_controller.h",
"arc/intent_helper/open_with_menu.cc",
"arc/intent_helper/open_with_menu.h",
"arc/intent_helper/start_smart_selection_action_menu.cc",
@@ -561,6 +582,14 @@ source_set("chromeos") {
"arc/screen_capture/arc_screen_capture_bridge.h",
"arc/screen_capture/arc_screen_capture_session.cc",
"arc/screen_capture/arc_screen_capture_session.h",
+ "arc/tracing/arc_cpu_event.cc",
+ "arc/tracing/arc_cpu_event.h",
+ "arc/tracing/arc_graphics_jank_detector.cc",
+ "arc/tracing/arc_graphics_jank_detector.h",
+ "arc/tracing/arc_system_model.cc",
+ "arc/tracing/arc_system_model.h",
+ "arc/tracing/arc_system_stat_collector.cc",
+ "arc/tracing/arc_system_stat_collector.h",
"arc/tracing/arc_tracing_bridge.cc",
"arc/tracing/arc_tracing_bridge.h",
"arc/tracing/arc_tracing_event.cc",
@@ -571,6 +600,10 @@ source_set("chromeos") {
"arc/tracing/arc_tracing_graphics_model.h",
"arc/tracing/arc_tracing_model.cc",
"arc/tracing/arc_tracing_model.h",
+ "arc/tracing/arc_value_event.cc",
+ "arc/tracing/arc_value_event.h",
+ "arc/tracing/arc_value_event_trimmer.cc",
+ "arc/tracing/arc_value_event_trimmer.h",
"arc/tts/arc_tts_service.cc",
"arc/tts/arc_tts_service.h",
"arc/user_session/arc_user_session_service.cc",
@@ -595,6 +628,12 @@ source_set("chromeos") {
"attestation/platform_verification_flow.h",
"authpolicy/auth_policy_credentials_manager.cc",
"authpolicy/auth_policy_credentials_manager.h",
+ "authpolicy/authpolicy_helper.cc",
+ "authpolicy/authpolicy_helper.h",
+ "authpolicy/data_pipe_utils.cc",
+ "authpolicy/data_pipe_utils.h",
+ "authpolicy/kerberos_files_handler.cc",
+ "authpolicy/kerberos_files_handler.h",
"base/file_flusher.cc",
"base/file_flusher.h",
"base/locale_util.cc",
@@ -717,6 +756,8 @@ source_set("chromeos") {
"dbus/drive_file_stream_service_provider.h",
"dbus/kiosk_info_service_provider.cc",
"dbus/kiosk_info_service_provider.h",
+ "dbus/libvda_service_provider.cc",
+ "dbus/libvda_service_provider.h",
"dbus/metrics_event_service_provider.cc",
"dbus/metrics_event_service_provider.h",
"dbus/plugin_vm_service_provider.cc",
@@ -731,14 +772,6 @@ source_set("chromeos") {
"dbus/vm_applications_service_provider.h",
"device_sync/device_sync_client_factory.cc",
"device_sync/device_sync_client_factory.h",
- "diagnosticsd/diagnosticsd_bridge.cc",
- "diagnosticsd/diagnosticsd_bridge.h",
- "diagnosticsd/diagnosticsd_messaging.cc",
- "diagnosticsd/diagnosticsd_messaging.h",
- "diagnosticsd/diagnosticsd_web_request_service.cc",
- "diagnosticsd/diagnosticsd_web_request_service.h",
- "diagnosticsd/mojo_utils.cc",
- "diagnosticsd/mojo_utils.h",
"display/output_protection_controller_ash.cc",
"display/output_protection_controller_ash.h",
"display/output_protection_controller_mus.cc",
@@ -834,6 +867,11 @@ source_set("chromeos") {
"file_manager/file_manager_string_util.h",
"file_manager/file_tasks.cc",
"file_manager/file_tasks.h",
+ "file_manager/file_tasks_notifier.cc",
+ "file_manager/file_tasks_notifier.h",
+ "file_manager/file_tasks_notifier_factory.cc",
+ "file_manager/file_tasks_notifier_factory.h",
+ "file_manager/file_tasks_observer.h",
"file_manager/file_watcher.cc",
"file_manager/file_watcher.h",
"file_manager/fileapi_util.cc",
@@ -1032,6 +1070,14 @@ source_set("chromeos") {
"input_method/input_method_persistence.h",
"input_method/input_method_syncer.cc",
"input_method/input_method_syncer.h",
+ "kerberos/kerberos_credentials_manager.cc",
+ "kerberos/kerberos_credentials_manager.h",
+ "kiosk_next_home/app_controller_service.cc",
+ "kiosk_next_home/app_controller_service.h",
+ "kiosk_next_home/app_controller_service_factory.cc",
+ "kiosk_next_home/app_controller_service_factory.h",
+ "kiosk_next_home/kiosk_next_home_interface_broker_impl.cc",
+ "kiosk_next_home/kiosk_next_home_interface_broker_impl.h",
"language_preferences.cc",
"language_preferences.h",
"launcher_search_provider/error_reporter.cc",
@@ -1196,13 +1242,12 @@ source_set("chromeos") {
"login/saml/saml_offline_signin_limiter.h",
"login/saml/saml_offline_signin_limiter_factory.cc",
"login/saml/saml_offline_signin_limiter_factory.h",
+ "login/saml/saml_profile_prefs.cc",
+ "login/saml/saml_profile_prefs.h",
"login/screen_manager.cc",
"login/screen_manager.h",
"login/screens/app_downloading_screen.cc",
"login/screens/app_downloading_screen.h",
- "login/screens/app_downloading_screen_view.h",
- "login/screens/app_launch_splash_screen_view.h",
- "login/screens/arc_kiosk_splash_screen_view.h",
"login/screens/arc_terms_of_service_screen.cc",
"login/screens/arc_terms_of_service_screen.h",
"login/screens/arc_terms_of_service_screen_view.h",
@@ -1259,7 +1304,6 @@ source_set("chromeos") {
"login/screens/marketing_opt_in_screen.cc",
"login/screens/marketing_opt_in_screen.h",
"login/screens/marketing_opt_in_screen_view.h",
- "login/screens/model_view_channel.h",
"login/screens/multidevice_setup_screen.cc",
"login/screens/multidevice_setup_screen.h",
"login/screens/multidevice_setup_screen_view.h",
@@ -1271,6 +1315,9 @@ source_set("chromeos") {
"login/screens/network_screen_view.h",
"login/screens/recommend_apps/recommend_apps_fetcher.cc",
"login/screens/recommend_apps/recommend_apps_fetcher.h",
+ "login/screens/recommend_apps/recommend_apps_fetcher_delegate.h",
+ "login/screens/recommend_apps/recommend_apps_fetcher_impl.cc",
+ "login/screens/recommend_apps/recommend_apps_fetcher_impl.h",
"login/screens/recommend_apps_screen.cc",
"login/screens/recommend_apps_screen.h",
"login/screens/recommend_apps_screen_view.h",
@@ -1292,14 +1339,10 @@ source_set("chromeos") {
"login/screens/update_screen.cc",
"login/screens/update_screen.h",
"login/screens/update_view.h",
- "login/screens/user_image_screen.cc",
- "login/screens/user_image_screen.h",
- "login/screens/user_image_view.h",
"login/screens/user_selection_screen.cc",
"login/screens/user_selection_screen.h",
"login/screens/welcome_screen.cc",
"login/screens/welcome_screen.h",
- "login/screens/welcome_view.h",
"login/screens/wrong_hwid_screen.cc",
"login/screens/wrong_hwid_screen.h",
"login/screens/wrong_hwid_screen_view.h",
@@ -1456,8 +1499,6 @@ source_set("chromeos") {
"note_taking_controller_client.h",
"note_taking_helper.cc",
"note_taking_helper.h",
- "oauth2_token_service_delegate.cc",
- "oauth2_token_service_delegate.h",
"ownership/fake_owner_settings_service.cc",
"ownership/fake_owner_settings_service.h",
"ownership/owner_settings_service_chromeos.cc",
@@ -1568,10 +1609,12 @@ source_set("chromeos") {
"policy/device_policy_decoder_chromeos.cc",
"policy/device_policy_decoder_chromeos.h",
"policy/device_policy_remover.h",
- "policy/device_status_collector.cc",
- "policy/device_status_collector.h",
"policy/device_wallpaper_image_handler.cc",
"policy/device_wallpaper_image_handler.h",
+ "policy/device_wifi_allowed_handler.cc",
+ "policy/device_wifi_allowed_handler.h",
+ "policy/device_wilco_dtc_configuration_handler.cc",
+ "policy/device_wilco_dtc_configuration_handler.h",
"policy/display_resolution_handler.cc",
"policy/display_resolution_handler.h",
"policy/display_rotation_default_handler.cc",
@@ -1644,12 +1687,16 @@ source_set("chromeos") {
"policy/server_backed_state_keys_broker.h",
"policy/single_app_install_event_log.cc",
"policy/single_app_install_event_log.h",
+ "policy/status_collector/device_status_collector.cc",
+ "policy/status_collector/device_status_collector.h",
+ "policy/status_collector/status_collector.cc",
+ "policy/status_collector/status_collector.h",
"policy/status_uploader.cc",
"policy/status_uploader.h",
"policy/system_log_uploader.cc",
"policy/system_log_uploader.h",
- "policy/ticl_device_settings_provider.cc",
- "policy/ticl_device_settings_provider.h",
+ "policy/tpm_auto_update_mode_policy_handler.cc",
+ "policy/tpm_auto_update_mode_policy_handler.h",
"policy/upload_job.h",
"policy/upload_job_impl.cc",
"policy/upload_job_impl.h",
@@ -1752,6 +1799,12 @@ source_set("chromeos") {
"preferences.h",
"prefs/pref_connector_service.cc",
"prefs/pref_connector_service.h",
+ "printing/bulk_printers_calculator.cc",
+ "printing/bulk_printers_calculator.h",
+ "printing/bulk_printers_calculator_factory.cc",
+ "printing/bulk_printers_calculator_factory.h",
+ "printing/calculators_policies_binder.cc",
+ "printing/calculators_policies_binder.h",
"printing/cups_print_job.cc",
"printing/cups_print_job.h",
"printing/cups_print_job_manager.cc",
@@ -1766,19 +1819,14 @@ source_set("chromeos") {
"printing/cups_printers_manager.h",
"printing/cups_printers_manager_factory.cc",
"printing/cups_printers_manager_factory.h",
- "printing/device_external_printers_factory.cc",
- "printing/device_external_printers_factory.h",
- "printing/device_external_printers_settings_bridge.cc",
- "printing/device_external_printers_settings_bridge.h",
- "printing/external_printers.cc",
- "printing/external_printers.h",
- "printing/external_printers_factory.cc",
- "printing/external_printers_factory.h",
- "printing/external_printers_policies.h",
- "printing/external_printers_pref_bridge.cc",
- "printing/external_printers_pref_bridge.h",
+ "printing/enterprise_printers_provider.cc",
+ "printing/enterprise_printers_provider.h",
"printing/ppd_provider_factory.cc",
"printing/ppd_provider_factory.h",
+ "printing/ppd_resolution_state.cc",
+ "printing/ppd_resolution_state.h",
+ "printing/ppd_resolution_tracker.cc",
+ "printing/ppd_resolution_tracker.h",
"printing/printer_configurer.cc",
"printing/printer_configurer.h",
"printing/printer_detector.h",
@@ -1884,6 +1932,8 @@ source_set("chromeos") {
"smb_client/smb_url.h",
"smb_client/temp_file_manager.cc",
"smb_client/temp_file_manager.h",
+ "startup_settings_cache.cc",
+ "startup_settings_cache.h",
"system/automatic_reboot_manager.cc",
"system/automatic_reboot_manager.h",
"system/automatic_reboot_manager_observer.h",
@@ -1953,10 +2003,22 @@ source_set("chromeos") {
"ui/request_pin_view.h",
"ui/screen_capture_notification_ui_chromeos.cc",
"ui/screen_capture_notification_ui_chromeos.h",
+ "ui/tpm_auto_update_notification.cc",
+ "ui/tpm_auto_update_notification.h",
"usb/cros_usb_detector.cc",
"usb/cros_usb_detector.h",
"virtual_machines/virtual_machines_util.cc",
"virtual_machines/virtual_machines_util.h",
+ "wilco_dtc_supportd/mojo_utils.cc",
+ "wilco_dtc_supportd/mojo_utils.h",
+ "wilco_dtc_supportd/wilco_dtc_supportd_bridge.cc",
+ "wilco_dtc_supportd/wilco_dtc_supportd_bridge.h",
+ "wilco_dtc_supportd/wilco_dtc_supportd_manager.cc",
+ "wilco_dtc_supportd/wilco_dtc_supportd_manager.h",
+ "wilco_dtc_supportd/wilco_dtc_supportd_messaging.cc",
+ "wilco_dtc_supportd/wilco_dtc_supportd_messaging.h",
+ "wilco_dtc_supportd/wilco_dtc_supportd_web_request_service.cc",
+ "wilco_dtc_supportd/wilco_dtc_supportd_web_request_service.h",
# Extension API implementations.
"extensions/autotest_private/autotest_private_api.cc",
@@ -2048,6 +2110,7 @@ copy("dbus_service_files") {
"dbus/org.chromium.ComponentUpdaterService.conf",
"dbus/org.chromium.DriveFileStreamService.conf",
"dbus/org.chromium.KioskAppService.conf",
+ "dbus/org.chromium.LibvdaService.conf",
"dbus/org.chromium.MetricsEventService.conf",
"dbus/org.chromium.NetworkProxyService.conf",
"dbus/org.chromium.PluginVmService.conf",
@@ -2108,8 +2171,6 @@ static_library("test_support") {
"login/screens/mock_base_screen_delegate.h",
"login/screens/mock_error_screen.cc",
"login/screens/mock_error_screen.h",
- "login/screens/mock_model_view_channel.cc",
- "login/screens/mock_model_view_channel.h",
"login/screens/mock_network_screen.cc",
"login/screens/mock_network_screen.h",
"login/screens/mock_supervision_transition_screen.cc",
@@ -2118,9 +2179,14 @@ static_library("test_support") {
"login/screens/mock_update_screen.h",
"login/screens/mock_welcome_screen.cc",
"login/screens/mock_welcome_screen.h",
+ "login/screens/recommend_apps/fake_recommend_apps_fetcher_delegate.cc",
+ "login/screens/recommend_apps/fake_recommend_apps_fetcher_delegate.h",
+ "login/test/help_app_test_helper.cc",
+ "login/test/help_app_test_helper.h",
"login/test/test_condition_waiter.h",
"login/test/test_predicate_waiter.cc",
"login/test/test_predicate_waiter.h",
+ "printing/printing_fakes.h",
"scoped_set_running_on_chromeos_for_testing.cc",
"scoped_set_running_on_chromeos_for_testing.h",
"settings/scoped_testing_cros_settings.cc",
@@ -2177,8 +2243,6 @@ source_set("unit_tests") {
"android_sms/streaming_connection_establisher_unittest.cc",
"app_mode/startup_app_launcher_unittest.cc",
"apps/apk_web_app_installer_unittest.cc",
- "apps/intent_helper/apps_navigation_throttle_unittest.cc",
- "apps/intent_helper/page_transition_util_unittest.cc",
"arc/accessibility/arc_accessibility_helper_bridge_unittest.cc",
"arc/accessibility/ax_tree_source_arc_unittest.cc",
"arc/app_shortcuts/arc_app_shortcuts_menu_builder_unittest.cc",
@@ -2195,6 +2259,7 @@ source_set("unit_tests") {
"arc/file_system_watcher/arc_file_system_watcher_service_unittest.cc",
"arc/fileapi/arc_content_file_system_async_file_util_unittest.cc",
"arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc",
+ "arc/fileapi/arc_content_file_system_file_stream_writer_unittest.cc",
"arc/fileapi/arc_content_file_system_url_util_unittest.cc",
"arc/fileapi/arc_documents_provider_root_unittest.cc",
"arc/fileapi/arc_documents_provider_util_unittest.cc",
@@ -2218,7 +2283,12 @@ source_set("unit_tests") {
"arc/pip/arc_pip_bridge_unittest.cc",
"arc/policy/arc_policy_bridge_unittest.cc",
"arc/process/arc_process_unittest.cc",
+ "arc/tracing/arc_cpu_event_unittest.cc",
+ "arc/tracing/arc_graphics_jank_detector_unittest.cc",
+ "arc/tracing/arc_system_model_unittest.cc",
+ "arc/tracing/arc_system_stat_collector_unittest.cc",
"arc/tracing/arc_tracing_model_unittest.cc",
+ "arc/tracing/arc_value_event_unittest.cc",
"arc/tts/arc_tts_service_unittest.cc",
"arc/voice_interaction/fake_voice_interaction_controller.cc",
"arc/voice_interaction/voice_interaction_controller_client_unittest.cc",
@@ -2231,6 +2301,7 @@ source_set("unit_tests") {
"attestation/fake_certificate.h",
"attestation/platform_verification_flow_unittest.cc",
"authpolicy/auth_policy_credentials_manager_unittest.cc",
+ "authpolicy/authpolicy_helper.unittest.cc",
"base/file_flusher_unittest.cc",
"certificate_provider/certificate_provider_service_unittest.cc",
"child_accounts/event_based_status_reporting_service_unittest.cc",
@@ -2251,11 +2322,6 @@ source_set("unit_tests") {
"cryptauth/client_app_metadata_provider_service_unittest.cc",
"customization/customization_document_unittest.cc",
"dbus/proxy_resolution_service_provider_unittest.cc",
- "diagnosticsd/diagnosticsd_bridge_unittest.cc",
- "diagnosticsd/diagnosticsd_messaging_unittest.cc",
- "diagnosticsd/diagnosticsd_web_request_service_unittest.cc",
- "diagnosticsd/testing_diagnosticsd_bridge.cc",
- "diagnosticsd/testing_diagnosticsd_bridge.h",
"drive/download_handler_unittest.cc",
"drive/drive_file_stream_reader_unittest.cc",
"drive/drive_integration_service_unittest.cc",
@@ -2283,6 +2349,7 @@ source_set("unit_tests") {
"extensions/wallpaper_private_api_unittest.cc",
"external_metrics_unittest.cc",
"file_manager/documents_provider_root_manager_unittest.cc",
+ "file_manager/file_tasks_notifier_unittest.cc",
"file_manager/file_tasks_unittest.cc",
"file_manager/file_watcher_unittest.cc",
"file_manager/fileapi_util_unittest.cc",
@@ -2348,6 +2415,7 @@ source_set("unit_tests") {
"input_method/input_method_engine_unittest.cc",
"input_method/input_method_manager_impl_unittest.cc",
"input_method/input_method_persistence_unittest.cc",
+ "kiosk_next_home/app_controller_service_unittest.cc",
"locale_change_guard_unittest.cc",
"lock_screen_apps/app_manager_impl_unittest.cc",
"lock_screen_apps/lock_screen_profile_creator_impl_unittest.cc",
@@ -2376,6 +2444,7 @@ source_set("unit_tests") {
"login/saml/saml_offline_signin_limiter_unittest.cc",
"login/screens/multidevice_setup_screen_unittest.cc",
"login/screens/network_screen_unittest.cc",
+ "login/screens/recommend_apps/recommend_apps_fetcher_impl_unittest.cc",
"login/screens/update_screen_unittest.cc",
"login/signin_partition_manager_unittest.cc",
"login/supervised/supervised_user_authentication_unittest.cc",
@@ -2391,7 +2460,6 @@ source_set("unit_tests") {
"network_change_manager_client_unittest.cc",
"night_light/night_light_client_unittest.cc",
"note_taking_helper_unittest.cc",
- "oauth2_token_service_delegate_unittest.cc",
"ownership/owner_settings_service_chromeos_unittest.cc",
"plugin_vm/plugin_vm_image_manager_unittest.cc",
"policy/active_directory_policy_manager_unittest.cc",
@@ -2442,6 +2510,7 @@ source_set("unit_tests") {
"policy/single_app_install_event_log_unittest.cc",
"policy/status_uploader_unittest.cc",
"policy/system_log_uploader_unittest.cc",
+ "policy/tpm_auto_update_mode_policy_handler_unittest.cc",
"policy/upload_job_unittest.cc",
"policy/user_cloud_policy_manager_chromeos_unittest.cc",
"policy/user_cloud_policy_store_chromeos_unittest.cc",
@@ -2473,8 +2542,10 @@ source_set("unit_tests") {
"power/process_data_collector_unittest.cc",
"power/renderer_freezer_unittest.cc",
"preferences_unittest.cc",
+ "printing/bulk_printers_calculator_unittest.cc",
"printing/cups_printers_manager_unittest.cc",
- "printing/external_printers_unittest.cc",
+ "printing/ppd_resolution_state_unittest.cc",
+ "printing/ppd_resolution_tracker_unittest.cc",
"printing/printer_detector_test_util.h",
"printing/printer_event_tracker_unittest.cc",
"printing/printers_sync_bridge_unittest.cc",
@@ -2508,6 +2579,7 @@ source_set("unit_tests") {
"smb_client/smb_task_queue_unittest.cc",
"smb_client/smb_url_unittest.cc",
"smb_client/temp_file_manager_unittest.cc",
+ "startup_settings_cache_unittest.cc",
"system/automatic_reboot_manager_unittest.cc",
"system/device_disabling_manager_unittest.cc",
"system/procfs_util_unittest.cc",
@@ -2518,6 +2590,12 @@ source_set("unit_tests") {
"tpm_firmware_update_unittest.cc",
"ui/idle_app_name_notification_view_unittest.cc",
"ui/low_disk_notification_unittest.cc",
+ "wilco_dtc_supportd/testing_wilco_dtc_supportd_bridge_wrapper.cc",
+ "wilco_dtc_supportd/testing_wilco_dtc_supportd_bridge_wrapper.h",
+ "wilco_dtc_supportd/wilco_dtc_supportd_bridge_unittest.cc",
+ "wilco_dtc_supportd/wilco_dtc_supportd_manager_unittest.cc",
+ "wilco_dtc_supportd/wilco_dtc_supportd_messaging_unittest.cc",
+ "wilco_dtc_supportd/wilco_dtc_supportd_web_request_service_unittest.cc",
# TODO(zturner): Enable this on Windows. See
# BrowserWithTestWindowTest::SetUp() for a comment explaining why this is
@@ -2597,7 +2675,6 @@ source_set("unit_tests") {
"//chrome/common",
"//chromeos/components/multidevice:test_support",
"//chromeos/components/tether:test_support",
- "//chromeos/dbus:login_manager_proto",
"//chromeos/dbus:test_support",
"//chromeos/dbus/services:test_support",
"//chromeos/ime:gencode",
@@ -2631,7 +2708,8 @@ source_set("unit_tests") {
"//third_party/blink/public:blink_headers",
"//third_party/icu",
"//third_party/leveldatabase",
- "//ui/base/ime",
+ "//ui/base/ime/chromeos",
+ "//ui/base/ime/init",
"//ui/chromeos/resources",
]
data = [
diff --git a/chromium/chrome/browser/chromeos/kiosk_next_home/mojom/BUILD.gn b/chromium/chrome/browser/chromeos/kiosk_next_home/mojom/BUILD.gn
new file mode 100644
index 00000000000..198be69223c
--- /dev/null
+++ b/chromium/chrome/browser/chromeos/kiosk_next_home/mojom/BUILD.gn
@@ -0,0 +1,17 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//mojo/public/tools/bindings/mojom.gni")
+
+mojom("mojom") {
+ sources = [
+ "app_controller.mojom",
+ "kiosk_next_home_interface_broker.mojom",
+ ]
+
+ public_deps = [
+ "//chrome/services/app_service/public/mojom:types",
+ "//services/identity/public/mojom",
+ ]
+}
diff --git a/chromium/chrome/browser/chromeos/kiosk_next_home/mojom/app_controller.mojom b/chromium/chrome/browser/chromeos/kiosk_next_home/mojom/app_controller.mojom
new file mode 100644
index 00000000000..64acad32a6c
--- /dev/null
+++ b/chromium/chrome/browser/chromeos/kiosk_next_home/mojom/app_controller.mojom
@@ -0,0 +1,62 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module chromeos.kiosk_next_home.mojom;
+
+import "chrome/services/app_service/public/mojom/types.mojom";
+
+// Represents an app on Chrome OS. This struct has all the information
+// necessary to display the app in the Kiosk Next Home app list/grid, including
+// readiness, thumbnail image, display name, etc.
+struct App {
+ // Stable and unique identifier for this app.
+ string app_id;
+
+ // The type of this app (e.g. ARC, Crostini, extension, etc).
+ apps.mojom.AppType type;
+
+ // Name used when displaying the app in an app list or grid.
+ string display_name;
+
+ // Android package name for this app.
+ // This field will only be present if this is an ARC app.
+ string android_package_name;
+
+ // The current state of readiness for this app.
+ // It can tell if the app is suspended, uninstalled, etc.
+ apps.mojom.Readiness readiness;
+};
+
+// Interface used by AppController clients to receive app related events.
+interface AppControllerClient {
+ // Called when any field from the given app changes.
+ OnAppChanged(App app);
+};
+
+// Interface for managing Chrome OS apps from the Kiosk Next Home.
+interface AppController {
+ // Returns all the local apps installed on this Chrome OS device.
+ // It reads from all the app sources, including ARC++ (Android),
+ // Crostini (Linux), extensions and PWAs.
+ // Note that as soon as this method returns, some of the apps might have
+ // changed. To always get the most updated information, attach an app
+ // observer through the AddObserver method.
+ GetApps() => (array<App> apps);
+
+ // Sets the client that will be notified when an app changes.
+ SetClient(AppControllerClient client);
+
+ // Launches the app with the given app_id.
+ LaunchApp(string app_id);
+
+ // Shows a prompt to uninstall the app with the given app_id.
+ UninstallApp(string app_id);
+
+ // Gets the Android ID for the ARC container.
+ GetArcAndroidId() => (bool success, string android_id);
+
+ // Launches URL prefixed by chromeos::switches::kKioskNextHomeUrlPrefix with
+ // the given suffix.
+ LaunchHomeUrl(string suffix) => (bool launched, string? error_message);
+};
diff --git a/chromium/chrome/browser/chromeos/kiosk_next_home/mojom/kiosk_next_home_interface_broker.mojom b/chromium/chrome/browser/chromeos/kiosk_next_home/mojom/kiosk_next_home_interface_broker.mojom
new file mode 100644
index 00000000000..21ecd8381e0
--- /dev/null
+++ b/chromium/chrome/browser/chromeos/kiosk_next_home/mojom/kiosk_next_home_interface_broker.mojom
@@ -0,0 +1,19 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module chromeos.kiosk_next_home.mojom;
+
+import "chrome/browser/chromeos/kiosk_next_home/mojom/app_controller.mojom";
+import "services/identity/public/mojom/identity_accessor.mojom";
+
+// Single entry point for any interface requests issued by the Kiosk Next
+// Home app and brokered by the browser for services needed to support
+// its functionality.
+interface KioskNextHomeInterfaceBroker {
+ // Binds IdentityAccessor service request.
+ GetIdentityAccessor(identity.mojom.IdentityAccessor& request);
+
+ // Binds the AppController service request.
+ GetAppController(AppController& request);
+};
diff --git a/chromium/chrome/browser/conflicts/BUILD.gn b/chromium/chrome/browser/conflicts/BUILD.gn
index aae7ab7e11a..ab0d8bfdc0b 100644
--- a/chromium/chrome/browser/conflicts/BUILD.gn
+++ b/chromium/chrome/browser/conflicts/BUILD.gn
@@ -10,8 +10,12 @@ source_set("module_info") {
"module_info_win.h",
]
- deps = [
+ public_deps = [
"//base",
+ "//content/public/common",
+ ]
+
+ deps = [
"//base:i18n",
"//chrome/common/safe_browsing:binary_feature_extractor",
]
diff --git a/chromium/chrome/browser/devtools/chrome_devtools_session.cc b/chromium/chrome/browser/devtools/chrome_devtools_session.cc
index 80388aa3328..eff328b8b95 100644
--- a/chromium/chrome/browser/devtools/chrome_devtools_session.cc
+++ b/chromium/chrome/browser/devtools/chrome_devtools_session.cc
@@ -11,6 +11,7 @@
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_agent_host_client.h"
#include "content/public/browser/devtools_manager_delegate.h"
+#include "content/public/common/content_switches.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/devtools/protocol/window_manager_handler.h"
@@ -52,6 +53,12 @@ void ChromeDevToolsSession::sendProtocolResponse(
client_->DispatchProtocolMessage(agent_host_, message->serialize(binary));
}
+static bool EnableInternalDevToolsBinaryProtocol() {
+ static bool disabled = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableInternalDevToolsBinaryProtocol);
+ return !disabled;
+}
+
void ChromeDevToolsSession::HandleCommand(
const std::string& method,
const std::string& message,
@@ -63,9 +70,14 @@ void ChromeDevToolsSession::HandleCommand(
int call_id;
std::string unused;
+ // We also check for --enable-internal-dev-tools-binary-protocol here,
+ // because if this flag is set, then content::DevToolsSession will
+ // send us binary even if the |client_| did not ask for it.
+ bool binary =
+ client_->UsesBinaryProtocol() || EnableInternalDevToolsBinaryProtocol();
std::unique_ptr<protocol::DictionaryValue> value =
- protocol::DictionaryValue::cast(protocol::StringUtil::parseMessage(
- message, client_->UsesBinaryProtocol()));
+ protocol::DictionaryValue::cast(
+ protocol::StringUtil::parseMessage(message, binary));
if (!dispatcher_->parseCommand(value.get(), &call_id, &unused))
return;
pending_commands_[call_id] = std::move(callback);
diff --git a/chromium/chrome/browser/devtools/device/tcp_device_provider.cc b/chromium/chrome/browser/devtools/device/tcp_device_provider.cc
index c761a0bb1e7..c949036fbbc 100644
--- a/chromium/chrome/browser/devtools/device/tcp_device_provider.cc
+++ b/chromium/chrome/browser/devtools/device/tcp_device_provider.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
@@ -18,6 +19,7 @@
#include "chrome/browser/net/system_network_context_manager.h"
#include "content/public/browser/browser_task_traits.h"
#include "mojo/public/cpp/bindings/binding.h"
+#include "net/base/completion_repeating_callback.h"
#include "net/base/net_errors.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_with_source.h"
@@ -65,8 +67,9 @@ class ResolveHostAndOpenSocket final : public network::ResolveHostClientBase {
std::unique_ptr<net::StreamSocket> socket(new net::TCPClientSocket(
resolved_addresses.value(), nullptr, nullptr, net::NetLogSource()));
net::StreamSocket* socket_ptr = socket.get();
- net::CompletionCallback on_connect =
- base::Bind(&RunSocketCallback, callback_, base::Passed(&socket));
+ net::CompletionRepeatingCallback on_connect =
+ base::AdaptCallbackForRepeating(
+ base::BindOnce(&RunSocketCallback, callback_, std::move(socket)));
result = socket_ptr->Connect(on_connect);
if (result != net::ERR_IO_PENDING)
on_connect.Run(result);
diff --git a/chromium/chrome/browser/devtools/device/usb/android_usb_browsertest.cc b/chromium/chrome/browser/devtools/device/usb/android_usb_browsertest.cc
index be377e62dee..59515f21266 100644
--- a/chromium/chrome/browser/devtools/device/usb/android_usb_browsertest.cc
+++ b/chromium/chrome/browser/devtools/device/usb/android_usb_browsertest.cc
@@ -98,20 +98,30 @@ UsbConfigurationInfoPtr ConstructAndroidConfig(uint8_t class_code,
uint8_t subclass_code,
uint8_t protocol_code) {
std::vector<UsbEndpointInfoPtr> endpoints;
- endpoints.push_back(UsbEndpointInfo::New(
- /*endpoint_number=*/0x01, UsbTransferDirection::INBOUND,
- UsbTransferType::BULK,
- /*packet_size=*/512));
- endpoints.push_back(UsbEndpointInfo::New(
- /*endpoint_number=*/0x01, UsbTransferDirection::OUTBOUND,
- UsbTransferType::BULK,
- /*packet_size=*/512));
+ auto endpoint_1 = UsbEndpointInfo::New();
+ endpoint_1->endpoint_number = 0x01;
+ endpoint_1->direction = UsbTransferDirection::INBOUND;
+ endpoint_1->type = UsbTransferType::BULK;
+ endpoint_1->packet_size = 512;
+ endpoints.push_back(std::move(endpoint_1));
+
+ auto endpoint_2 = UsbEndpointInfo::New();
+ endpoint_2->endpoint_number = 0x01;
+ endpoint_2->direction = UsbTransferDirection::OUTBOUND;
+ endpoint_2->type = UsbTransferType::BULK;
+ endpoint_2->packet_size = 512;
+ endpoints.push_back(std::move(endpoint_2));
+
+ auto alternate = UsbAlternateInterfaceInfo::New();
+ alternate->alternate_setting = 0;
+ alternate->class_code = class_code;
+ alternate->subclass_code = subclass_code;
+ alternate->protocol_code = protocol_code;
+ alternate->endpoints = std::move(endpoints);
auto interface = UsbInterfaceInfo::New();
interface->interface_number = 0;
- interface->alternates.push_back(UsbAlternateInterfaceInfo::New(
- /*alternate_setting=*/0, class_code, subclass_code, protocol_code,
- /*interface_name=*/base::nullopt, std::move(endpoints)));
+ interface->alternates.push_back(std::move(alternate));
auto config = UsbConfigurationInfo::New();
config->configuration_value = kAndroidConfigValue;
diff --git a/chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc b/chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc
index 7c0aff83067..7e1f1dbb551 100644
--- a/chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc
+++ b/chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc
@@ -21,6 +21,10 @@ bool GetValue(const base::Value& value, int* result) {
return value.GetAsInteger(result);
}
+bool GetValue(const base::Value& value, double* result) {
+ return value.GetAsDouble(result);
+}
+
bool GetValue(const base::Value& value, bool* result) {
return value.GetAsBoolean(result);
}
@@ -206,6 +210,8 @@ DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
delegate);
d->RegisterHandler("recordEnumeratedHistogram",
&Delegate::RecordEnumeratedHistogram, delegate);
+ d->RegisterHandler("recordPerformanceHistogram",
+ &Delegate::RecordPerformanceHistogram, delegate);
d->RegisterHandlerWithCallback("sendJsonRequest",
&Delegate::SendJsonRequest, delegate);
d->RegisterHandlerWithCallback("getPreferences",
diff --git a/chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.h b/chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.h
index db793386181..f9494747cf9 100644
--- a/chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.h
+++ b/chromium/chrome/browser/devtools/devtools_embedder_message_dispatcher.h
@@ -92,6 +92,8 @@ class DevToolsEmbedderMessageDispatcher {
virtual void RecordEnumeratedHistogram(const std::string& name,
int sample,
int boundary_value) = 0;
+ virtual void RecordPerformanceHistogram(const std::string& name,
+ double duration) = 0;
virtual void SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id,
const std::string& url) = 0;
diff --git a/chromium/chrome/browser/devtools/devtools_file_helper.cc b/chromium/chrome/browser/devtools/devtools_file_helper.cc
index c4dc0244e92..7497a31a8b0 100644
--- a/chromium/chrome/browser/devtools/devtools_file_helper.cc
+++ b/chromium/chrome/browser/devtools/devtools_file_helper.cc
@@ -10,9 +10,9 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_util.h"
+#include "base/hash/md5.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
-#include "base/md5.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/threading/sequenced_task_runner_handle.h"
diff --git a/chromium/chrome/browser/devtools/devtools_file_watcher.cc b/chromium/chrome/browser/devtools/devtools_file_watcher.cc
index a54a10134a4..ccfe022e0c9 100644
--- a/chromium/chrome/browser/devtools/devtools_file_watcher.cc
+++ b/chromium/chrome/browser/devtools/devtools_file_watcher.cc
@@ -17,8 +17,11 @@
#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
+#include "base/strings/stringprintf.h"
#include "base/task/lazy_task_runner.h"
#include "base/threading/sequenced_task_runner_handle.h"
+#include "base/trace_event/memory_dump_manager.h"
+#include "base/trace_event/memory_dump_provider.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
@@ -28,8 +31,9 @@ static constexpr int kDefaultThrottleTimeout = 200;
// DevToolsFileWatcher::SharedFileWatcher --------------------------------------
-class DevToolsFileWatcher::SharedFileWatcher :
- public base::RefCounted<SharedFileWatcher> {
+class DevToolsFileWatcher::SharedFileWatcher
+ : public base::RefCounted<SharedFileWatcher>,
+ public base::trace_event::MemoryDumpProvider {
public:
SharedFileWatcher();
@@ -38,10 +42,14 @@ class DevToolsFileWatcher::SharedFileWatcher :
void AddWatch(const base::FilePath& path);
void RemoveWatch(const base::FilePath& path);
+ // base::trace_event::MemoryDumpProvider implementation:
+ bool OnMemoryDump(
+ const base::trace_event::MemoryDumpArgs& args,
+ base::trace_event::ProcessMemoryDump* process_memory_dump) override;
+
private:
- friend class base::RefCounted<
- DevToolsFileWatcher::SharedFileWatcher>;
- ~SharedFileWatcher();
+ friend class base::RefCounted<SharedFileWatcher>;
+ ~SharedFileWatcher() override;
using FilePathTimesMap = std::unordered_map<base::FilePath, base::Time>;
FilePathTimesMap GetModificationTimes(const base::FilePath& path);
@@ -61,13 +69,42 @@ DevToolsFileWatcher::SharedFileWatcher::SharedFileWatcher()
: last_dispatch_cost_(
base::TimeDelta::FromMilliseconds(kDefaultThrottleTimeout)) {
DevToolsFileWatcher::s_shared_watcher_ = this;
+ base::trace_event::MemoryDumpManager::GetInstance()
+ ->RegisterDumpProviderWithSequencedTaskRunner(
+ this, "DevTools", base::SequencedTaskRunnerHandle::Get(),
+ base::trace_event::MemoryDumpProvider::Options());
}
DevToolsFileWatcher::SharedFileWatcher::~SharedFileWatcher() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
+ this);
DevToolsFileWatcher::s_shared_watcher_ = nullptr;
}
+bool DevToolsFileWatcher::SharedFileWatcher::OnMemoryDump(
+ const base::trace_event::MemoryDumpArgs& args,
+ base::trace_event::ProcessMemoryDump* process_memory_dump) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ int index = 0;
+ for (auto& file_path : file_path_times_) {
+ size_t file_paths_size = 0;
+ for (auto& path_and_time : file_path.second) {
+ file_paths_size += path_and_time.first.value().length() *
+ sizeof(base::FilePath::StringType::value_type);
+ }
+ auto* dump = process_memory_dump->CreateAllocatorDump(
+ base::StringPrintf("devtools/file_watcher_%d", index++));
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount,
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ file_path.second.size());
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ file_paths_size);
+ }
+ return true;
+}
+
void DevToolsFileWatcher::SharedFileWatcher::AddListener(
DevToolsFileWatcher* watcher) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -191,14 +228,12 @@ base::SequencedTaskRunner* impl_task_runner() {
base::MayBlock(), base::TaskPriority::BEST_EFFORT};
static base::LazySequencedTaskRunner s_file_task_runner =
LAZY_SEQUENCED_TASK_RUNNER_INITIALIZER(kImplTaskTraits);
-
return s_file_task_runner.Get().get();
}
} // namespace
// static
-DevToolsFileWatcher::SharedFileWatcher*
-DevToolsFileWatcher::s_shared_watcher_ = nullptr;
+DevToolsFileWatcher::SharedFileWatcher* DevToolsFileWatcher::s_shared_watcher_;
// static
void DevToolsFileWatcher::Deleter::operator()(const DevToolsFileWatcher* ptr) {
diff --git a/chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc
index 2a2cef21ca4..c624fe05faf 100644
--- a/chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc
+++ b/chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -1656,6 +1656,14 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest,
CloseDevToolsWindow();
}
+// Tests that whitelisted unhandled shortcuts are forwarded from inspected page
+// into devtools frontend
+IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, testKeyEventUnhandled) {
+ OpenDevToolsWindow("about:blank", true);
+ RunTestFunction(window_, "testKeyEventUnhandled");
+ CloseDevToolsWindow();
+}
+
// Tests that settings are stored in profile correctly.
IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestSettings) {
OpenDevToolsWindow("about:blank", true);
@@ -2176,7 +2184,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestRawHeadersWithRedirectAndHSTS) {
net::EmbeddedTestServer::TYPE_HTTPS);
https_test_server.SetSSLConfig(
net::EmbeddedTestServer::CERT_COMMON_NAME_IS_DOMAIN);
- https_test_server.ServeFilesFromSourceDirectory("chrome/test/data");
+ https_test_server.ServeFilesFromSourceDirectory(GetChromeTestDataDir());
ASSERT_TRUE(https_test_server.Start());
GURL https_url = https_test_server.GetURL("localhost", "/devtools/image.png");
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
@@ -2282,7 +2290,6 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, LoadNetworkResourceForFrontend) {
// TODO(crbug.com/921608) Disabled for flakiness.
IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, DISABLED_CreateBrowserContext) {
- embedded_test_server()->ServeFilesFromSourceDirectory("chrome/test/data");
ASSERT_TRUE(embedded_test_server()->Start());
GURL url(embedded_test_server()->GetURL("/devtools/empty.html"));
window_ = DevToolsWindowTesting::OpenDiscoveryDevToolsWindowSync(
diff --git a/chromium/chrome/browser/devtools/devtools_ui_bindings.cc b/chromium/chrome/browser/devtools/devtools_ui_bindings.cc
index 9fc56a56a08..656c6eaad91 100644
--- a/chromium/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chromium/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -11,11 +11,13 @@
#include "base/base64.h"
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/guid.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/json/string_escape.h"
#include "base/macros.h"
+#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -27,6 +29,7 @@
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/devtools/devtools_file_watcher.h"
+#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/devtools/url_constants.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/infobars/infobar_service.h"
@@ -60,7 +63,9 @@
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_ui_url_loader_factory.h"
#include "content/public/common/url_constants.h"
+#include "content/public/common/url_utils.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/constants.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -167,7 +172,6 @@ class DefaultBindingsDelegate : public DevToolsUIBindings::Delegate {
InfoBarService* GetInfoBarService() override;
void RenderProcessGone(bool crashed) override {}
void ShowCertificateViewer(const std::string& cert_chain) override {}
-
content::WebContents* web_contents_;
DISALLOW_COPY_AND_ASSIGN(DefaultBindingsDelegate);
};
@@ -605,7 +609,8 @@ void DevToolsUIBindings::DispatchProtocolMessage(
base::EscapeJSONString(message, true, &param);
base::string16 javascript =
base::UTF8ToUTF16("DevToolsAPI.dispatchMessage(" + param + ");");
- web_contents_->GetMainFrame()->ExecuteJavaScript(javascript);
+ web_contents_->GetMainFrame()->ExecuteJavaScript(javascript,
+ base::NullCallback());
return;
}
@@ -729,12 +734,36 @@ void DevToolsUIBindings::LoadNetworkResource(const DispatchCallback& callback,
std::unique_ptr<network::mojom::URLLoaderFactory> file_url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> network_url_loader_factory;
+ std::unique_ptr<network::mojom::URLLoaderFactory> webui_url_loader_factory;
network::mojom::URLLoaderFactory* url_loader_factory;
if (gurl.SchemeIsFile()) {
file_url_loader_factory = content::CreateFileURLLoaderFactory(
base::FilePath() /* profile_path */,
nullptr /* shared_cors_origin_access_list */);
url_loader_factory = file_url_loader_factory.get();
+ } else if (content::HasWebUIScheme(gurl)) {
+#ifndef NDEBUG
+ // In debug builds, allow retrieving files from the chrome:// scheme
+ content::WebContents* target_tab =
+ DevToolsWindow::AsDevToolsWindow(web_contents_)
+ ->GetInspectedWebContents();
+ const bool allow_web_ui_scheme =
+ target_tab && content::HasWebUIScheme(target_tab->GetURL());
+#else
+ const bool allow_web_ui_scheme = false;
+#endif
+ if (allow_web_ui_scheme) {
+ std::vector<std::string> allowed_webui_hosts;
+ content::RenderFrameHost* frame_host = web_contents()->GetMainFrame();
+ webui_url_loader_factory = content::CreateWebUIURLLoader(
+ frame_host, content::kChromeUIScheme, std::move(allowed_webui_hosts));
+ url_loader_factory = webui_url_loader_factory.get();
+ } else {
+ base::DictionaryValue response;
+ response.SetInteger("statusCode", 403);
+ callback.Run(&response);
+ return;
+ }
} else {
auto* partition = content::BrowserContext::GetStoragePartitionForSite(
web_contents_->GetBrowserContext(), gurl);
@@ -1107,6 +1136,19 @@ void DevToolsUIBindings::RecordEnumeratedHistogram(const std::string& name,
frontend_host_->BadMessageRecieved();
}
+void DevToolsUIBindings::RecordPerformanceHistogram(const std::string& name,
+ double duration) {
+ if (!frontend_host_)
+ return;
+ if (duration < 0) {
+ return;
+ }
+ // Use histogram_functions.h instead of macros as the name comes from the
+ // DevTools frontend javascript and so will always have the same call site.
+ base::TimeDelta delta = base::TimeDelta::FromMilliseconds(duration);
+ base::UmaHistogramTimes(name, delta);
+}
+
void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id,
const std::string& url) {
@@ -1359,7 +1401,7 @@ void DevToolsUIBindings::CallClientFunction(const std::string& function_name,
}
javascript.append(");");
web_contents_->GetMainFrame()->ExecuteJavaScript(
- base::UTF8ToUTF16(javascript));
+ base::UTF8ToUTF16(javascript), base::NullCallback());
}
void DevToolsUIBindings::ReadyToCommitNavigation(
diff --git a/chromium/chrome/browser/devtools/devtools_ui_bindings.h b/chromium/chrome/browser/devtools/devtools_ui_bindings.h
index a22164239dc..68e045fe106 100644
--- a/chromium/chrome/browser/devtools/devtools_ui_bindings.h
+++ b/chromium/chrome/browser/devtools/devtools_ui_bindings.h
@@ -150,6 +150,8 @@ class DevToolsUIBindings : public DevToolsEmbedderMessageDispatcher::Delegate,
void RecordEnumeratedHistogram(const std::string& name,
int sample,
int boundary_value) override;
+ void RecordPerformanceHistogram(const std::string& name,
+ double duration) override;
void SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id,
const std::string& url) override;
diff --git a/chromium/chrome/browser/devtools/devtools_window.cc b/chromium/chrome/browser/devtools/devtools_window.cc
index 4578696df6c..be110f6cdea 100644
--- a/chromium/chrome/browser/devtools/devtools_window.cc
+++ b/chromium/chrome/browser/devtools/devtools_window.cc
@@ -1545,6 +1545,8 @@ void DevToolsWindow::SetOpenNewWindowForPopups(bool value) {
void DevToolsWindow::CreateDevToolsBrowser() {
PrefService* prefs = profile_->GetPrefs();
if (!prefs->GetDictionary(prefs::kAppWindowPlacement)->HasKey(kDevToolsApp)) {
+ // Ensure there is always a default size so that
+ // BrowserFrame::InitBrowserFrame can retrieve it later.
DictionaryPrefUpdate update(prefs, prefs::kAppWindowPlacement);
base::DictionaryValue* wp_prefs = update.Get();
auto dev_tools_defaults = std::make_unique<base::DictionaryValue>();
diff --git a/chromium/chrome/browser/devtools/devtools_window_testing.cc b/chromium/chrome/browser/devtools/devtools_window_testing.cc
index 2bb49cd5904..2589d6ddbcc 100644
--- a/chromium/chrome/browser/devtools/devtools_window_testing.cc
+++ b/chromium/chrome/browser/devtools/devtools_window_testing.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/devtools/devtools_window_testing.h"
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/lazy_instance.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/devtools/chrome_devtools_manager_delegate.h"
@@ -112,7 +113,8 @@ void DevToolsWindowTesting::WaitForDevToolsWindowLoad(DevToolsWindow* window) {
}
base::string16 harness = base::UTF8ToUTF16(
content::DevToolsFrontendHost::GetFrontendResource(kHarnessScript));
- window->main_web_contents_->GetMainFrame()->ExecuteJavaScript(harness);
+ window->main_web_contents_->GetMainFrame()->ExecuteJavaScript(
+ harness, base::NullCallback());
}
// static
diff --git a/chromium/chrome/browser/devtools/inspector_protocol_config.json b/chromium/chrome/browser/devtools/inspector_protocol_config.json
index 6e98d2516f1..2137e85a0e5 100644
--- a/chromium/chrome/browser/devtools/inspector_protocol_config.json
+++ b/chromium/chrome/browser/devtools/inspector_protocol_config.json
@@ -8,8 +8,9 @@
"options": [
{
"domain": "Page",
- "include": [ "enable", "disable", "setAdBlockingEnabled" ],
- "include_events": []
+ "include": [ "enable", "disable", "setAdBlockingEnabled", "getInstallabilityErrors" ],
+ "include_events": [],
+ "async": ["getInstallabilityErrors"]
},
{
"domain": "Browser",
diff --git a/chromium/chrome/browser/devtools/protocol/page_handler.cc b/chromium/chrome/browser/devtools/protocol/page_handler.cc
index 1020609c17f..eea7f9cee10 100644
--- a/chromium/chrome/browser/devtools/protocol/page_handler.cc
+++ b/chromium/chrome/browser/devtools/protocol/page_handler.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/devtools/protocol/page_handler.h"
+#include "chrome/browser/installable/installable_manager.h"
#include "chrome/browser/subresource_filter/chrome_subresource_filter_client.h"
PageHandler::PageHandler(content::WebContents* web_contents,
@@ -47,3 +48,28 @@ protocol::Response PageHandler::SetAdBlockingEnabled(bool enabled) {
ToggleAdBlocking(enabled);
return protocol::Response::OK();
}
+
+void PageHandler::GetInstallabilityErrors(
+ std::unique_ptr<GetInstallabilityErrorsCallback> callback) {
+ auto errors = protocol::Array<std::string>::create();
+ InstallableManager* manager =
+ web_contents() ? InstallableManager::FromWebContents(web_contents())
+ : nullptr;
+ if (!manager) {
+ callback->sendFailure(
+ protocol::Response::Error("Unable to fetch errors for target"));
+ return;
+ }
+ manager->GetAllErrors(base::BindOnce(&PageHandler::GotInstallabilityErrors,
+ std::move(callback)));
+}
+
+// static
+void PageHandler::GotInstallabilityErrors(
+ std::unique_ptr<GetInstallabilityErrorsCallback> callback,
+ std::vector<std::string> errors) {
+ auto result = protocol::Array<std::string>::create();
+ for (const auto& error : errors)
+ result->addItem(error);
+ callback->sendSuccess(std::move(result));
+}
diff --git a/chromium/chrome/browser/devtools/protocol/page_handler.h b/chromium/chrome/browser/devtools/protocol/page_handler.h
index bc0d62cceba..42251937243 100644
--- a/chromium/chrome/browser/devtools/protocol/page_handler.h
+++ b/chromium/chrome/browser/devtools/protocol/page_handler.h
@@ -26,8 +26,14 @@ class PageHandler : public protocol::Page::Backend,
protocol::Response Enable() override;
protocol::Response Disable() override;
protocol::Response SetAdBlockingEnabled(bool enabled) override;
+ void GetInstallabilityErrors(
+ std::unique_ptr<GetInstallabilityErrorsCallback> callback) override;
private:
+ static void GotInstallabilityErrors(
+ std::unique_ptr<GetInstallabilityErrorsCallback> callback,
+ std::vector<std::string> errors);
+
bool enabled_ = false;
DISALLOW_COPY_AND_ASSIGN(PageHandler);
diff --git a/chromium/chrome/browser/extensions/BUILD.gn b/chromium/chrome/browser/extensions/BUILD.gn
index 5056e906fd4..5aea5589b99 100644
--- a/chromium/chrome/browser/extensions/BUILD.gn
+++ b/chromium/chrome/browser/extensions/BUILD.gn
@@ -18,6 +18,8 @@ jumbo_static_library("extensions") {
sources = [
# TODO These references to files in //chrome/browser/ should either be
# moved to the browser target or the files moved to this directory.
+ "../accessibility/accessibility_extension_api.cc",
+ "../accessibility/accessibility_extension_api.h",
"../ui/app_icon_loader.cc",
"../ui/app_icon_loader.h",
"../ui/toolbar/toolbar_actions_model.cc",
@@ -383,6 +385,8 @@ jumbo_static_library("extensions") {
"api/tabs/tabs_constants.h",
"api/tabs/tabs_event_router.cc",
"api/tabs/tabs_event_router.h",
+ "api/tabs/tabs_util.h",
+ "api/tabs/tabs_util_chromeos.cc",
"api/tabs/tabs_windows_api.cc",
"api/tabs/tabs_windows_api.h",
"api/tabs/windows_event_router.cc",
@@ -750,6 +754,9 @@ jumbo_static_library("extensions") {
defines = []
allow_circular_includes_from = [
+ # Lots of APIs use headers from the list above.
+ "//chrome/browser/extensions/api:api_registration",
+
# TODO(loyso): Remove this circular dependency. http://crbug.com/876576.
"//chrome/browser/web_applications/extensions",
@@ -847,6 +854,7 @@ jumbo_static_library("extensions") {
"//components/undo",
"//components/unified_consent",
"//components/update_client",
+ "//components/update_client:common_impl",
"//components/url_matcher",
"//components/user_prefs",
"//components/vector_icons",
@@ -967,11 +975,16 @@ jumbo_static_library("extensions") {
}
deps += [
"//ash/public/cpp",
+ "//chrome/browser/chromeos/kiosk_next_home/mojom",
"//chrome/browser/resources/chromeos/camera:chrome_camera_app",
+ "//chromeos",
"//chromeos/attestation",
"//chromeos/components/proximity_auth",
+ "//chromeos/constants",
"//chromeos/cryptohome",
"//chromeos/dbus",
+ "//chromeos/dbus/cryptohome",
+ "//chromeos/dbus/power",
"//chromeos/disks",
"//chromeos/login/login_state",
"//chromeos/network",
@@ -980,16 +993,19 @@ jumbo_static_library("extensions") {
"//chromeos/services/machine_learning/public/mojom",
"//chromeos/services/media_perception/public/mojom",
"//chromeos/settings",
+ "//chromeos/system",
"//chromeos/tpm",
"//components/arc",
"//components/constrained_window",
"//components/drive",
"//components/user_manager",
+ "//media/capture:capture_lib",
"//media/capture/video/chromeos/mojo:cros_camera",
"//remoting/base",
"//remoting/host",
"//remoting/host/it2me:chrome_os_host",
"//third_party/protobuf:protobuf_lite",
+ "//ui/base/ime/chromeos",
"//ui/chromeos",
"//ui/chromeos/events",
"//ui/file_manager",
@@ -1016,6 +1032,7 @@ jumbo_static_library("extensions") {
"api/messaging/native_process_launcher.cc",
"api/messaging/native_process_launcher.h",
"api/messaging/native_process_launcher_win.cc",
+ "api/tabs/tabs_util.cc",
"chrome_kiosk_delegate.cc",
"default_apps.cc",
"default_apps.h",
diff --git a/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc b/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
index 0a3e56561f0..1d0e5f584bb 100644
--- a/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
@@ -20,7 +20,7 @@
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/form_data_importer.h"
-#include "components/autofill/core/browser/local_card_migration_manager.h"
+#include "components/autofill/core/browser/payments/local_card_migration_manager.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/common/autofill_features.h"
#include "content/public/browser/web_contents.h"
@@ -544,56 +544,6 @@ AutofillPrivateGetCreditCardListFunction::Run() {
}
////////////////////////////////////////////////////////////////////////////////
-// AutofillPrivateGetLocalCreditCardListFunction
-
-AutofillPrivateGetLocalCreditCardListFunction::
- AutofillPrivateGetLocalCreditCardListFunction()
- : chrome_details_(this) {}
-
-AutofillPrivateGetLocalCreditCardListFunction::
- ~AutofillPrivateGetLocalCreditCardListFunction() {}
-
-ExtensionFunction::ResponseAction
-AutofillPrivateGetLocalCreditCardListFunction::Run() {
- autofill::PersonalDataManager* personal_data =
- autofill::PersonalDataManagerFactory::GetForProfile(
- chrome_details_.GetProfile());
-
- DCHECK(personal_data && personal_data->IsDataLoaded());
-
- autofill_util::CreditCardEntryList local_credit_card_list =
- autofill_util::GenerateLocalCreditCardList(*personal_data);
- return RespondNow(ArgumentList(
- api::autofill_private::GetLocalCreditCardList::Results::Create(
- local_credit_card_list)));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// AutofillPrivateGetServerCreditCardListFunction
-
-AutofillPrivateGetServerCreditCardListFunction::
- AutofillPrivateGetServerCreditCardListFunction()
- : chrome_details_(this) {}
-
-AutofillPrivateGetServerCreditCardListFunction::
- ~AutofillPrivateGetServerCreditCardListFunction() {}
-
-ExtensionFunction::ResponseAction
-AutofillPrivateGetServerCreditCardListFunction::Run() {
- autofill::PersonalDataManager* personal_data =
- autofill::PersonalDataManagerFactory::GetForProfile(
- chrome_details_.GetProfile());
-
- DCHECK(personal_data && personal_data->IsDataLoaded());
-
- autofill_util::CreditCardEntryList server_credit_card_list =
- autofill_util::GenerateServerCreditCardList(*personal_data);
- return RespondNow(ArgumentList(
- api::autofill_private::GetServerCreditCardList::Results::Create(
- server_credit_card_list)));
-}
-
-////////////////////////////////////////////////////////////////////////////////
// AutofillPrivateMigrateCreditCardsFunction
AutofillPrivateMigrateCreditCardsFunction::
diff --git a/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.h b/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.h
index 2cd1533543c..20a4924315b 100644
--- a/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.h
+++ b/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.h
@@ -174,44 +174,6 @@ class AutofillPrivateGetCreditCardListFunction
DISALLOW_COPY_AND_ASSIGN(AutofillPrivateGetCreditCardListFunction);
};
-class AutofillPrivateGetLocalCreditCardListFunction
- : public UIThreadExtensionFunction {
- public:
- AutofillPrivateGetLocalCreditCardListFunction();
- DECLARE_EXTENSION_FUNCTION("autofillPrivate.getLocalCreditCardList",
- AUTOFILLPRIVATE_GETLOCALCREDITCARDLIST)
-
- protected:
- ~AutofillPrivateGetLocalCreditCardListFunction() override;
-
- // ExtensionFunction overrides.
- ResponseAction Run() override;
-
- private:
- ChromeExtensionFunctionDetails chrome_details_;
-
- DISALLOW_COPY_AND_ASSIGN(AutofillPrivateGetLocalCreditCardListFunction);
-};
-
-class AutofillPrivateGetServerCreditCardListFunction
- : public UIThreadExtensionFunction {
- public:
- AutofillPrivateGetServerCreditCardListFunction();
- DECLARE_EXTENSION_FUNCTION("autofillPrivate.getServerCreditCardList",
- AUTOFILLPRIVATE_GETSERVERCREDITCARDLIST)
-
- protected:
- ~AutofillPrivateGetServerCreditCardListFunction() override;
-
- // ExtensionFunction overrides.
- ResponseAction Run() override;
-
- private:
- ChromeExtensionFunctionDetails chrome_details_;
-
- DISALLOW_COPY_AND_ASSIGN(AutofillPrivateGetServerCreditCardListFunction);
-};
-
class AutofillPrivateMigrateCreditCardsFunction
: public UIThreadExtensionFunction {
public:
diff --git a/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc b/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc
index 31cee78dd9a..c90d6a5f45a 100644
--- a/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc
+++ b/chromium/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc
@@ -50,7 +50,7 @@ void AutofillPrivateEventRouter::Shutdown() {
personal_data_->RemoveObserver(this);
}
-// TODO(crbug.com/923868): Change the 4 calls to a single OnPersonalDataChanged.
+// TODO(crbug.com/923868): Change the 2 calls to a single OnPersonalDataChanged.
void AutofillPrivateEventRouter::OnPersonalDataChanged() {
// Ignore any updates before data is loaded. This can happen in tests.
if (!(personal_data_ && personal_data_->IsDataLoaded()))
@@ -77,28 +77,6 @@ void AutofillPrivateEventRouter::OnPersonalDataChanged() {
api::autofill_private::OnCreditCardListChanged::kEventName,
std::move(args)));
event_router_->BroadcastEvent(std::move(extension_event));
-
- autofill_util::CreditCardEntryList localCreditCardList =
- extensions::autofill_util::GenerateLocalCreditCardList(*personal_data_);
- args.reset(api::autofill_private::OnLocalCreditCardListChanged::Create(
- localCreditCardList)
- .release());
- extension_event.reset(
- new Event(events::AUTOFILL_PRIVATE_ON_LOCAL_CREDIT_CARD_LIST_CHANGED,
- api::autofill_private::OnLocalCreditCardListChanged::kEventName,
- std::move(args)));
- event_router_->BroadcastEvent(std::move(extension_event));
-
- autofill_util::CreditCardEntryList serverCreditCardList =
- extensions::autofill_util::GenerateServerCreditCardList(*personal_data_);
- args.reset(api::autofill_private::OnLocalCreditCardListChanged::Create(
- serverCreditCardList)
- .release());
- extension_event.reset(new Event(
- events::AUTOFILL_PRIVATE_ON_SERVER_CREDIT_CARD_LIST_CHANGED,
- api::autofill_private::OnServerCreditCardListChanged::kEventName,
- std::move(args)));
- event_router_->BroadcastEvent(std::move(extension_event));
}
AutofillPrivateEventRouter* AutofillPrivateEventRouter::Create(
diff --git a/chromium/chrome/browser/extensions/api/autofill_private/autofill_util.cc b/chromium/chrome/browser/extensions/api/autofill_private/autofill_util.cc
index 46c50c8d1b8..157f6c089b9 100644
--- a/chromium/chrome/browser/extensions/api/autofill_private/autofill_util.cc
+++ b/chromium/chrome/browser/extensions/api/autofill_private/autofill_util.cc
@@ -221,35 +221,6 @@ CreditCardEntryList GenerateCreditCardList(
return list;
}
-CreditCardEntryList GenerateLocalCreditCardList(
- const autofill::PersonalDataManager& personal_data) {
- const std::vector<autofill::CreditCard*>& all_cards =
- personal_data.GetCreditCards();
-
- CreditCardEntryList list;
- for (const autofill::CreditCard* card : all_cards) {
- // Keep only local and full server cards.
- if (card->record_type() == autofill::CreditCard::LOCAL_CARD ||
- card->record_type() == autofill::CreditCard::FULL_SERVER_CARD) {
- list.push_back(CreditCardToCreditCardEntry(*card, personal_data));
- }
- }
-
- return list;
-}
-
-CreditCardEntryList GenerateServerCreditCardList(
- const autofill::PersonalDataManager& personal_data) {
- const std::vector<autofill::CreditCard*>& server_cards =
- personal_data.GetServerCreditCards();
-
- CreditCardEntryList list;
- for (const autofill::CreditCard* card : server_cards)
- list.push_back(CreditCardToCreditCardEntry(*card, personal_data));
-
- return list;
-}
-
} // namespace autofill_util
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/autofill_private/autofill_util.h b/chromium/chrome/browser/extensions/api/autofill_private/autofill_util.h
index 180d88859c1..7dabff64058 100644
--- a/chromium/chrome/browser/extensions/api/autofill_private/autofill_util.h
+++ b/chromium/chrome/browser/extensions/api/autofill_private/autofill_util.h
@@ -34,16 +34,6 @@ CountryEntryList GenerateCountryList(
CreditCardEntryList GenerateCreditCardList(
const autofill::PersonalDataManager& personal_data);
-// Uses |personal_data| to generate a list of up-to-date local CreditCardEntry
-// objects.
-CreditCardEntryList GenerateLocalCreditCardList(
- const autofill::PersonalDataManager& personal_data);
-
-// Uses |personal_data| to generate a list of up-to-date server CreditCardEntry
-// objects.
-CreditCardEntryList GenerateServerCreditCardList(
- const autofill::PersonalDataManager& personal_data);
-
} // namespace autofill_util
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/automation/OWNERS b/chromium/chrome/browser/extensions/api/automation/OWNERS
index e6cc90e5262..292ee758ffe 100644
--- a/chromium/chrome/browser/extensions/api/automation/OWNERS
+++ b/chromium/chrome/browser/extensions/api/automation/OWNERS
@@ -1,4 +1,3 @@
-aboxhall@chromium.org
-dtseng@chromium.org
+file://ui/accessibility/OWNERS
# COMPONENT: UI>Accessibility
diff --git a/chromium/chrome/browser/extensions/api/automation/automation_apitest.cc b/chromium/chrome/browser/extensions/api/automation/automation_apitest.cc
index 1e3cd8022aa..8728681ad5e 100644
--- a/chromium/chrome/browser/extensions/api/automation/automation_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/automation/automation_apitest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/path_service.h"
@@ -30,6 +31,7 @@
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/accessibility/accessibility_switches.h"
#include "ui/accessibility/ax_node.h"
#include "ui/accessibility/ax_serializable_tree.h"
#include "ui/accessibility/ax_tree.h"
@@ -142,7 +144,8 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, ImageLabels) {
EXPECT_EQ(expected_mode, web_contents->GetAccessibilityMode());
}
-IN_PROC_BROWSER_TEST_F(AutomationApiTest, GetTreeByTabId) {
+// TODO(aboxhall): Fix flakiness
+IN_PROC_BROWSER_TEST_F(AutomationApiTest, DISABLED_GetTreeByTabId) {
StartEmbeddedTestServer();
ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "tab_id.html"))
<< message_;
@@ -377,6 +380,23 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, HitTest) {
<< message_;
}
+class AutomationApiTestWithLanguageDetection : public AutomationApiTest {
+ protected:
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ AutomationApiTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitch(
+ ::switches::kEnableExperimentalAccessibilityLanguageDetection);
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(AutomationApiTestWithLanguageDetection,
+ DetectedLanguage) {
+ StartEmbeddedTestServer();
+ ASSERT_TRUE(
+ RunExtensionSubtest("automation/tests/tabs", "detected_language.html"))
+ << message_;
+}
+
#if defined(OS_CHROMEOS)
class AutomationApiTestWithDeviceScaleFactor : public AutomationApiTest {
diff --git a/chromium/chrome/browser/extensions/api/automation_internal/OWNERS b/chromium/chrome/browser/extensions/api/automation_internal/OWNERS
index e6cc90e5262..292ee758ffe 100644
--- a/chromium/chrome/browser/extensions/api/automation_internal/OWNERS
+++ b/chromium/chrome/browser/extensions/api/automation_internal/OWNERS
@@ -1,4 +1,3 @@
-aboxhall@chromium.org
-dtseng@chromium.org
+file://ui/accessibility/OWNERS
# COMPONENT: UI>Accessibility
diff --git a/chromium/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc b/chromium/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
index 255ab9db3b4..e7970e28a32 100644
--- a/chromium/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
+++ b/chromium/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
@@ -28,6 +28,7 @@
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager.h"
+#include "content/public/browser/media_player_id.h"
#include "content/public/browser/media_session.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -193,13 +194,29 @@ class AutomationWebContentsObserver
void RenderFrameDeleted(
content::RenderFrameHost* render_frame_host) override {
ui::AXTreeID tree_id = render_frame_host->GetAXTreeID();
+ if (tree_id == ui::AXTreeIDUnknown())
+ return;
+
AutomationEventRouter::GetInstance()->DispatchTreeDestroyedEvent(
tree_id,
browser_context_);
}
+ void RenderFrameHostChanged(content::RenderFrameHost* old_host,
+ content::RenderFrameHost* new_host) override {
+ if (!old_host)
+ return;
+
+ ui::AXTreeID tree_id = old_host->GetAXTreeID();
+ if (tree_id == ui::AXTreeIDUnknown())
+ return;
+
+ AutomationEventRouter::GetInstance()->DispatchTreeDestroyedEvent(
+ tree_id, browser_context_);
+ }
+
void MediaStartedPlaying(const MediaPlayerInfo& video_type,
- const MediaPlayerId& id) override {
+ const content::MediaPlayerId& id) override {
content::AXEventNotificationDetails content_event_bundle;
content_event_bundle.ax_tree_id = id.render_frame_host->GetAXTreeID();
content_event_bundle.events.resize(1);
@@ -210,7 +227,7 @@ class AutomationWebContentsObserver
void MediaStoppedPlaying(
const MediaPlayerInfo& video_type,
- const MediaPlayerId& id,
+ const content::MediaPlayerId& id,
WebContentsObserver::MediaStoppedReason reason) override {
content::AXEventNotificationDetails content_event_bundle;
content_event_bundle.ax_tree_id = id.render_frame_host->GetAXTreeID();
@@ -258,8 +275,9 @@ AutomationInternalEnableTabFunction::Run() {
std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
content::WebContents* contents = NULL;
+ int tab_id = -1;
if (params->args.tab_id.get()) {
- int tab_id = *params->args.tab_id;
+ tab_id = *params->args.tab_id;
if (!ExtensionTabUtil::GetTabById(
tab_id, browser_context(), include_incognito_information(),
NULL, /* browser out param*/
@@ -275,6 +293,8 @@ AutomationInternalEnableTabFunction::Run() {
->GetActiveWebContents();
if (!contents)
return RespondNow(Error("No active tab"));
+
+ tab_id = ExtensionTabUtil::GetTabId(contents);
}
content::RenderFrameHost* rfh = contents->GetMainFrame();
@@ -298,7 +318,7 @@ AutomationInternalEnableTabFunction::Run() {
return RespondNow(
ArgumentList(api::automation_internal::EnableTab::Results::Create(
- ax_tree_id.ToString())));
+ ax_tree_id.ToString(), tab_id)));
}
ExtensionFunction::ResponseAction AutomationInternalEnableFrameFunction::Run() {
@@ -308,8 +328,22 @@ ExtensionFunction::ResponseAction AutomationInternalEnableFrameFunction::Run() {
std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- content::RenderFrameHost* rfh = content::RenderFrameHost::FromAXTreeID(
- ui::AXTreeID::FromString(params->tree_id));
+ ui::AXTreeID ax_tree_id = ui::AXTreeID::FromString(params->tree_id);
+ ui::AXTreeIDRegistry* registry = ui::AXTreeIDRegistry::GetInstance();
+ ui::AXActionHandler* action_handler = registry->GetActionHandler(ax_tree_id);
+ if (action_handler) {
+ // Explicitly invalidate the pre-existing source tree first. This ensures
+ // the source tree sends a complete tree when the next event occurs. This
+ // is required whenever the client extension is reloaded.
+ ui::AXActionData action;
+ action.target_tree_id = ax_tree_id;
+ action.source_extension_id = extension_id();
+ action.action = ax::mojom::Action::kInternalInvalidateTree;
+ action_handler->PerformAction(action);
+ }
+
+ content::RenderFrameHost* rfh =
+ content::RenderFrameHost::FromAXTreeID(ax_tree_id);
if (!rfh)
return RespondNow(Error("unable to load tab"));
@@ -478,7 +512,15 @@ AutomationInternalPerformActionFunction::ConvertToAXActionData(
action->end_index = get_text_location_params.end_index;
break;
}
+ case api::automation::ACTION_TYPE_SHOWTOOLTIP:
+ action->action = ax::mojom::Action::kShowTooltip;
+ break;
+ case api::automation::ACTION_TYPE_HIDETOOLTIP:
+ action->action = ax::mojom::Action::kHideTooltip;
+ break;
case api::automation::ACTION_TYPE_ANNOTATEPAGEIMAGES:
+ case api::automation::ACTION_TYPE_SIGNALENDOFTEST:
+ case api::automation::ACTION_TYPE_INTERNALINVALIDATETREE:
case api::automation::ACTION_TYPE_NONE:
break;
}
diff --git a/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc b/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc
deleted file mode 100644
index ad4ac598a5b..00000000000
--- a/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h"
-
-#include <memory>
-#include <utility>
-
-#include "base/command_line.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
-#include "chrome/browser/bookmarks/bookmark_model_factory.h"
-#include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
-#include "chrome/browser/extensions/extension_apitest.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/common/pref_names.h"
-#include "components/bookmarks/browser/bookmark_model.h"
-#include "components/bookmarks/common/bookmark_pref_names.h"
-#include "components/bookmarks/managed/managed_bookmark_service.h"
-#include "components/bookmarks/test/bookmark_test_helpers.h"
-#include "components/prefs/pref_service.h"
-#include "components/user_prefs/user_prefs.h"
-
-using bookmarks::BookmarkModel;
-using bookmarks::BookmarkNode;
-
-namespace extensions {
-
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManager) {
- // Add managed bookmarks.
- Profile* profile = browser()->profile();
- BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile);
- bookmarks::ManagedBookmarkService* managed =
- ManagedBookmarkServiceFactory::GetForProfile(profile);
- bookmarks::test::WaitForBookmarkModelToLoad(model);
-
- base::ListValue list;
- std::unique_ptr<base::DictionaryValue> node(new base::DictionaryValue());
- node->SetString("name", "Managed Bookmark");
- node->SetString("url", "http://www.chromium.org");
- list.Append(std::move(node));
- node.reset(new base::DictionaryValue());
- node->SetString("name", "Managed Folder");
- node->Set("children", std::make_unique<base::ListValue>());
- list.Append(std::move(node));
- profile->GetPrefs()->Set(bookmarks::prefs::kManagedBookmarks, list);
- ASSERT_EQ(2, managed->managed_node()->child_count());
-
- ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/standard"))
- << message_;
-}
-
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) {
- Profile* profile = browser()->profile();
-
- // Provide some testing data here, since bookmark editing will be disabled
- // within the extension.
- BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile);
- bookmarks::test::WaitForBookmarkModelToLoad(model);
- const BookmarkNode* bar = model->bookmark_bar_node();
- const BookmarkNode* folder =
- model->AddFolder(bar, 0, base::ASCIIToUTF16("Folder"));
- model->AddURL(bar, 1, base::ASCIIToUTF16("AAA"),
- GURL("http://aaa.example.com"));
- model->AddURL(folder, 0, base::ASCIIToUTF16("BBB"),
- GURL("http://bbb.example.com"));
-
- PrefService* prefs = user_prefs::UserPrefs::Get(profile);
- prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false);
-
- ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled"))
- << message_;
-}
-
-} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc b/chromium/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
index 9aa0c4ce184..5868403c777 100644
--- a/chromium/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
+++ b/chromium/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
@@ -55,23 +55,30 @@ bool SetGaiaCookieForProfile(Profile* profile) {
GURL google_url = GaiaUrls::GetInstance()->google_url();
net::CanonicalCookie cookie("APISID", std::string(), "." + google_url.host(),
"/", base::Time(), base::Time(), base::Time(),
- false, false, net::CookieSameSite::DEFAULT_MODE,
+ false, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT);
bool success = false;
base::RunLoop loop;
base::OnceClosure loop_quit = loop.QuitClosure();
- base::OnceCallback<void(bool)> callback =
- base::BindLambdaForTesting([&success, &loop_quit](bool s) {
- success = s;
- std::move(loop_quit).Run();
- });
+ base::OnceCallback<void(net::CanonicalCookie::CookieInclusionStatus)>
+ callback = base::BindLambdaForTesting(
+ [&success,
+ &loop_quit](net::CanonicalCookie::CookieInclusionStatus s) {
+ success =
+ (s == net::CanonicalCookie::CookieInclusionStatus::INCLUDE);
+ std::move(loop_quit).Run();
+ });
network::mojom::CookieManager* cookie_manager =
content::BrowserContext::GetDefaultStoragePartition(profile)
->GetCookieManagerForBrowserProcess();
+ net::CookieOptions options;
+ options.set_include_httponly();
cookie_manager->SetCanonicalCookie(
- cookie, google_url.scheme(), true,
- mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(callback), false));
+ cookie, google_url.scheme(), options,
+ mojo::WrapCallbackWithDefaultInvokeIfNotRun(
+ std::move(callback),
+ net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR));
loop.Run();
return success;
}
@@ -99,6 +106,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, Syncing) {
// Sync is running.
syncer::SyncService* sync_service =
ProfileSyncServiceFactory::GetForProfile(profile);
+ sync_service->GetUserSettings()->SetSyncRequested(true);
sync_service->GetUserSettings()->SetFirstSetupComplete();
ASSERT_EQ(sync_ui_util::SYNCED, sync_ui_util::GetStatus(profile));
diff --git a/chromium/chrome/browser/extensions/api/cast_streaming/performance_test.cc b/chromium/chrome/browser/extensions/api/cast_streaming/performance_test.cc
index 8d3d46ce029..bda71aad0c7 100644
--- a/chromium/chrome/browser/extensions/api/cast_streaming/performance_test.cc
+++ b/chromium/chrome/browser/extensions/api/cast_streaming/performance_test.cc
@@ -67,13 +67,14 @@ constexpr int kMinDataPointsForQuickRun = 3;
// long enough to collect sufficient tracing data; and, unfortunately, there's
// nothing we can do about that.
#define EXPECT_FOR_PERFORMANCE_RUN(expr) \
- do { \
+ if (!(expr)) { \
+ const char *_out = #expr; \
if (is_full_performance_run()) { \
- EXPECT_TRUE(expr); \
- } else if (!(expr)) { \
- LOG(WARNING) << "Allowing failure: " << #expr; \
+ LOG(ERROR) << "Failure: " << _out; \
+ } else { \
+ LOG(WARNING) << "Allowing failure: " << _out; \
} \
- } while (false)
+ }
enum TestFlags {
kSmallWindow = 1 << 2, // Window size: 1 = 800x600, 0 = 2000x1000
@@ -168,7 +169,7 @@ class MeanAndError {
const std::string& modifier,
const std::string& trace,
const std::string& unit) {
- if (num_values_ >= 20) {
+ if (num_values_ > 0) {
perf_test::PrintResultMeanAndError(measurement,
modifier,
trace,
@@ -176,8 +177,7 @@ class MeanAndError {
unit,
true);
} else {
- LOG(ERROR) << "Not enough events (" << num_values_ << ") for "
- << measurement << modifier << " " << trace;
+ LOG(ERROR) << "No events for " << measurement << modifier << " " << trace;
}
}
diff --git a/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc b/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc
index 38232950d07..26a9d407d94 100644
--- a/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc
+++ b/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc
@@ -16,9 +16,9 @@
#include "chrome/browser/chromeos/certificate_provider/certificate_provider_service_factory.h"
#include "chrome/common/extensions/api/certificate_provider.h"
#include "chrome/common/extensions/api/certificate_provider_internal.h"
-#include "content/public/common/console_message_level.h"
#include "net/cert/x509_certificate.h"
#include "net/ssl/ssl_private_key.h"
+#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
namespace api_cp = extensions::api::certificate_provider;
@@ -125,7 +125,7 @@ bool CertificateProviderInternalReportCertificatesFunction::
chromeos::certificate_provider::CertificateInfo* out_info) {
const std::vector<uint8_t>& cert_der = info.certificate;
if (cert_der.empty()) {
- WriteToConsole(content::CONSOLE_MESSAGE_LEVEL_ERROR,
+ WriteToConsole(blink::mojom::ConsoleMessageLevel::kError,
kCertificateProviderErrorInvalidX509Cert);
return false;
}
@@ -137,7 +137,7 @@ bool CertificateProviderInternalReportCertificatesFunction::
out_info->certificate = net::X509Certificate::CreateFromBytesUnsafeOptions(
reinterpret_cast<const char*>(cert_der.data()), cert_der.size(), options);
if (!out_info->certificate) {
- WriteToConsole(content::CONSOLE_MESSAGE_LEVEL_ERROR,
+ WriteToConsole(blink::mojom::ConsoleMessageLevel::kError,
kCertificateProviderErrorInvalidX509Cert);
return false;
}
@@ -152,11 +152,11 @@ bool CertificateProviderInternalReportCertificatesFunction::
case net::X509Certificate::kPublicKeyTypeRSA:
break;
case net::X509Certificate::kPublicKeyTypeECDSA:
- WriteToConsole(content::CONSOLE_MESSAGE_LEVEL_ERROR,
+ WriteToConsole(blink::mojom::ConsoleMessageLevel::kError,
kCertificateProviderErrorECDSANotSupported);
return false;
default:
- WriteToConsole(content::CONSOLE_MESSAGE_LEVEL_ERROR,
+ WriteToConsole(blink::mojom::ConsoleMessageLevel::kError,
kCertificateProviderErrorUnknownKeyType);
return false;
}
diff --git a/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc b/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc
index f2343d730b8..f8fba437e17 100644
--- a/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc
@@ -53,29 +53,27 @@ using testing::_;
namespace {
-void IgnoreResult(const base::Closure& callback, const base::Value* value) {
+void IgnoreResult(const base::Closure& callback, base::Value value) {
callback.Run();
}
-void StoreBool(bool* result,
- const base::Closure& callback,
- const base::Value* value) {
- value->GetAsBoolean(result);
+void StoreBool(bool* result, const base::Closure& callback, base::Value value) {
+ value.GetAsBoolean(result);
callback.Run();
}
void StoreString(std::string* result,
const base::Closure& callback,
- const base::Value* value) {
- value->GetAsString(result);
+ base::Value value) {
+ value.GetAsString(result);
callback.Run();
}
void StoreDigest(std::vector<uint8_t>* digest,
const base::Closure& callback,
- const base::Value* value) {
- ASSERT_TRUE(value->is_blob()) << "Unexpected value in StoreDigest";
- digest->assign(value->GetBlob().begin(), value->GetBlob().end());
+ base::Value value) {
+ ASSERT_TRUE(value.is_blob()) << "Unexpected value in StoreDigest";
+ digest->assign(value.GetBlob().begin(), value.GetBlob().end());
callback.Run();
}
@@ -249,7 +247,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, Basic) {
base::RunLoop run_loop;
extension_contents->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("signDigestRequest.digest;"),
- base::Bind(&StoreDigest, &request_digest, run_loop.QuitClosure()));
+ base::BindOnce(&StoreDigest, &request_digest, run_loop.QuitClosure()));
run_loop.Run();
}
@@ -277,7 +275,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, Basic) {
"replyWithSignature(" + JsUint8Array(signature) + ");";
extension_contents->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16(code),
- base::Bind(&IgnoreResult, run_loop.QuitClosure()));
+ base::BindOnce(&IgnoreResult, run_loop.QuitClosure()));
run_loop.Run();
}
@@ -291,7 +289,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, Basic) {
std::string https_reply;
https_contents->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("document.body.textContent;"),
- base::Bind(&StoreString, &https_reply, run_loop.QuitClosure()));
+ base::BindOnce(&StoreString, &https_reply, run_loop.QuitClosure()));
run_loop.Run();
// Expect the server to return the fingerprint of the client cert that we
// presented, which should be the fingerprint of 'l1_leaf.der'.
@@ -311,7 +309,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, Basic) {
bool result = false;
extension_contents->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16(code),
- base::Bind(&StoreBool, &result, run_loop.QuitClosure()));
+ base::BindOnce(&StoreBool, &result, run_loop.QuitClosure()));
run_loop.Run();
EXPECT_TRUE(result);
}
diff --git a/chromium/chrome/browser/extensions/api/chrome_extensions_api_client.cc b/chromium/chrome/browser/extensions/api/chrome_extensions_api_client.cc
index d1c8040c81a..4e43c5bfd8a 100644
--- a/chromium/chrome/browser/extensions/api/chrome_extensions_api_client.cc
+++ b/chromium/chrome/browser/extensions/api/chrome_extensions_api_client.cc
@@ -33,6 +33,7 @@
#include "chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.h"
#include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h"
#include "chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.h"
+#include "chrome/browser/performance_manager/performance_manager.h"
#include "chrome/browser/performance_manager/performance_manager_tab_helper.h"
#include "chrome/browser/search/instant_io_context.h"
#include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
@@ -101,8 +102,10 @@ void ChromeExtensionsAPIClient::AttachWebContentsHelpers(
web_contents);
extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
web_contents);
- performance_manager::PerformanceManagerTabHelper::CreateForWebContents(
- web_contents);
+ if (performance_manager::PerformanceManager::GetInstance()) {
+ performance_manager::PerformanceManagerTabHelper::CreateForWebContents(
+ web_contents);
+ }
}
bool ChromeExtensionsAPIClient::ShouldHideResponseHeader(
@@ -128,7 +131,7 @@ bool ChromeExtensionsAPIClient::ShouldHideBrowserNetworkRequest(
// requests.
// Exclude main frame navigation requests.
bool is_browser_request = request.render_process_id == -1 &&
- request.type != content::RESOURCE_TYPE_MAIN_FRAME;
+ request.type != content::ResourceType::kMainFrame;
// Hide requests made by the Devtools frontend.
bool is_sensitive_request =
diff --git a/chromium/chrome/browser/extensions/api/chrome_extensions_api_client_unittest.cc b/chromium/chrome/browser/extensions/api/chrome_extensions_api_client_unittest.cc
index 45762a579c3..2146dfc5fd7 100644
--- a/chromium/chrome/browser/extensions/api/chrome_extensions_api_client_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/chrome_extensions_api_client_unittest.cc
@@ -44,15 +44,15 @@ TEST_F(ChromeExtensionsAPIClientTest, ShouldHideBrowserNetworkRequest) {
request.url = GURL("https://example.com/script.js");
request.initiator = url::Origin::Create(GURL(chrome::kChromeUINewTabURL));
request.render_process_id = -1;
- request.type = content::ResourceType::RESOURCE_TYPE_SCRIPT;
+ request.type = content::ResourceType::kScript;
EXPECT_TRUE(client.ShouldHideBrowserNetworkRequest(request));
// Main frame requests should always be visible to extensions.
- request.type = content::ResourceType::RESOURCE_TYPE_MAIN_FRAME;
+ request.type = content::ResourceType::kMainFrame;
EXPECT_FALSE(client.ShouldHideBrowserNetworkRequest(request));
// Similar requests made by the renderer should be visible to extensions.
- request.type = content::ResourceType::RESOURCE_TYPE_SCRIPT;
+ request.type = content::ResourceType::kScript;
request.render_process_id = 2;
EXPECT_FALSE(client.ShouldHideBrowserNetworkRequest(request));
}
diff --git a/chromium/chrome/browser/extensions/api/cookies/cookies_api.cc b/chromium/chrome/browser/extensions/api/cookies/cookies_api.cc
index 564eb040853..663e72c0e6a 100644
--- a/chromium/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chromium/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -212,7 +212,9 @@ ExtensionFunction::ResponseAction CookiesGetFunction::Run() {
return RespondLater();
}
-void CookiesGetFunction::GetCookieCallback(const net::CookieList& cookie_list) {
+void CookiesGetFunction::GetCookieCallback(
+ const net::CookieList& cookie_list,
+ const net::CookieStatusList& excluded_cookies) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
for (const net::CanonicalCookie& cookie : cookie_list) {
// Return the first matching cookie. Relies on the fact that the
@@ -267,7 +269,8 @@ ExtensionFunction::ResponseAction CookiesGetAllFunction::Run() {
}
void CookiesGetAllFunction::GetAllCookiesCallback(
- const net::CookieList& cookie_list) {
+ const net::CookieList& cookie_list,
+ const net::CookieStatusList& excluded_cookies) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
ResponseValue response;
if (extension()) {
@@ -320,11 +323,11 @@ ExtensionFunction::ResponseAction CookiesSetFunction::Run() {
base::Time::FromDoubleT(*parsed_args_->details.expiration_date);
}
- net::CookieSameSite same_site = net::CookieSameSite::DEFAULT_MODE;
+ net::CookieSameSite same_site = net::CookieSameSite::NO_RESTRICTION;
switch (parsed_args_->details.same_site) {
case api::cookies::SAME_SITE_STATUS_NONE:
case api::cookies::SAME_SITE_STATUS_NO_RESTRICTION:
- same_site = net::CookieSameSite::DEFAULT_MODE;
+ same_site = net::CookieSameSite::NO_RESTRICTION;
break;
case api::cookies::SAME_SITE_STATUS_LAX:
same_site = net::CookieSameSite::LAX_MODE;
@@ -361,15 +364,19 @@ ExtensionFunction::ResponseAction CookiesSetFunction::Run() {
// is generated.
success_ = false;
state_ = SET_COMPLETED;
- GetCookieListCallback(net::CookieList());
+ GetCookieListCallback(net::CookieList(), net::CookieStatusList());
return AlreadyResponded();
}
// Dispatch the setter, immediately followed by the getter. This
// plus FIFO ordering on the cookie_manager_ pipe means that no
// other extension function will affect the get result.
+ net::CookieOptions options;
+ options.set_include_httponly();
+ options.set_same_site_cookie_context(
+ net::CookieOptions::SameSiteCookieContext::SAME_SITE_STRICT);
cookie_manager->SetCanonicalCookie(
- *cc, url_.scheme(), true /*modify_http_only*/,
+ *cc, url_.scheme(), options,
base::BindOnce(&CookiesSetFunction::SetCanonicalCookieCallback, this));
cookies_helpers::GetCookieListFromManager(
cookie_manager, url_,
@@ -379,15 +386,18 @@ ExtensionFunction::ResponseAction CookiesSetFunction::Run() {
return RespondLater();
}
-void CookiesSetFunction::SetCanonicalCookieCallback(bool set_cookie_result) {
+void CookiesSetFunction::SetCanonicalCookieCallback(
+ net::CanonicalCookie::CookieInclusionStatus set_cookie_result) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK_EQ(NO_RESPONSE, state_);
state_ = SET_COMPLETED;
- success_ = set_cookie_result;
+ success_ = (set_cookie_result ==
+ net::CanonicalCookie::CookieInclusionStatus::INCLUDE);
}
void CookiesSetFunction::GetCookieListCallback(
- const net::CookieList& cookie_list) {
+ const net::CookieList& cookie_list,
+ const net::CookieStatusList& excluded_cookies) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK_EQ(SET_COMPLETED, state_);
state_ = GET_COMPLETED;
diff --git a/chromium/chrome/browser/extensions/api/cookies/cookies_api.h b/chromium/chrome/browser/extensions/api/cookies/cookies_api.h
index ae46fa4715d..f149cb5fcd7 100644
--- a/chromium/chrome/browser/extensions/api/cookies/cookies_api.h
+++ b/chromium/chrome/browser/extensions/api/cookies/cookies_api.h
@@ -73,7 +73,8 @@ class CookiesGetFunction : public UIThreadExtensionFunction {
ResponseAction Run() override;
private:
- void GetCookieCallback(const net::CookieList& cookie_list);
+ void GetCookieCallback(const net::CookieList& cookie_list,
+ const net::CookieStatusList& excluded_cookies);
GURL url_;
network::mojom::CookieManagerPtr store_browser_cookie_manager_;
@@ -94,7 +95,8 @@ class CookiesGetAllFunction : public UIThreadExtensionFunction {
ResponseAction Run() override;
private:
- void GetAllCookiesCallback(const net::CookieList& cookie_list);
+ void GetAllCookiesCallback(const net::CookieList& cookie_list,
+ const net::CookieStatusList& excluded_cookies);
GURL url_;
network::mojom::CookieManagerPtr store_browser_cookie_manager_;
@@ -113,8 +115,10 @@ class CookiesSetFunction : public UIThreadExtensionFunction {
ResponseAction Run() override;
private:
- void SetCanonicalCookieCallback(bool set_cookie_);
- void GetCookieListCallback(const net::CookieList& cookie_list);
+ void SetCanonicalCookieCallback(
+ net::CanonicalCookie::CookieInclusionStatus set_cookie_result);
+ void GetCookieListCallback(const net::CookieList& cookie_list,
+ const net::CookieStatusList& excluded_cookies);
enum { NO_RESPONSE, SET_COMPLETED, GET_COMPLETED } state_;
GURL url_;
diff --git a/chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc b/chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc
index bb8cce5810b..c0261872774 100644
--- a/chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc
+++ b/chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc
@@ -82,15 +82,19 @@ Cookie CreateCookie(const net::CanonicalCookie& canonical_cookie,
cookie.http_only = canonical_cookie.IsHttpOnly();
switch (canonical_cookie.SameSite()) {
- case net::CookieSameSite::DEFAULT_MODE:
- cookie.same_site = api::cookies::SAME_SITE_STATUS_NO_RESTRICTION;
- break;
- case net::CookieSameSite::LAX_MODE:
- cookie.same_site = api::cookies::SAME_SITE_STATUS_LAX;
- break;
- case net::CookieSameSite::STRICT_MODE:
- cookie.same_site = api::cookies::SAME_SITE_STATUS_STRICT;
- break;
+ // TODO(chlily): UNSPECIFIED should map to SAME_SITE_STATUS_NONE and vice
+ // versa.
+ case net::CookieSameSite::NO_RESTRICTION:
+ case net::CookieSameSite::UNSPECIFIED:
+ cookie.same_site = api::cookies::SAME_SITE_STATUS_NO_RESTRICTION;
+ break;
+ case net::CookieSameSite::LAX_MODE:
+ case net::CookieSameSite::EXTENDED_MODE:
+ cookie.same_site = api::cookies::SAME_SITE_STATUS_LAX;
+ break;
+ case net::CookieSameSite::STRICT_MODE:
+ cookie.same_site = api::cookies::SAME_SITE_STATUS_STRICT;
+ break;
}
cookie.session = !canonical_cookie.IsPersistent();
@@ -126,7 +130,12 @@ void GetCookieListFromManager(
const GURL& url,
network::mojom::CookieManager::GetCookieListCallback callback) {
if (url.is_empty()) {
- manager->GetAllCookies(std::move(callback));
+ // GetAllCookies has a different callback signature than GetCookieList, but
+ // can be treated as the same, just returning no excluded cookies.
+ // |AddCookieStatusList| takes a |GetCookieListCallback| and returns a
+ // callback that calls the input callback with an empty excluded list.
+ manager->GetAllCookies(
+ net::cookie_util::AddCookieStatusList(std::move(callback)));
} else {
net::CookieOptions options;
options.set_include_httponly();
diff --git a/chromium/chrome/browser/extensions/api/cookies/cookies_helpers_unittest.cc b/chromium/chrome/browser/extensions/api/cookies/cookies_helpers_unittest.cc
index bc008139bcd..f6aeace58d2 100644
--- a/chromium/chrome/browser/extensions/api/cookies/cookies_helpers_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/cookies/cookies_helpers_unittest.cc
@@ -24,7 +24,7 @@ TEST(CookiesHelperUnittest, CookieConversionWithInfiniteExpirationDate) {
const base::Time kExpirationDate = base::Time::Max();
net::CanonicalCookie cookie("cookiename", "cookievalue", "example.com", "/",
base::Time::Now(), kExpirationDate, base::Time(),
- false, false, net::CookieSameSite::DEFAULT_MODE,
+ false, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT);
// Serialize the cookie to JSON. We need to gracefully handle the infinite
diff --git a/chromium/chrome/browser/extensions/api/cookies/cookies_unittest.cc b/chromium/chrome/browser/extensions/api/cookies/cookies_unittest.cc
index c6952d4c576..fbfc9935aa7 100644
--- a/chromium/chrome/browser/extensions/api/cookies/cookies_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/cookies/cookies_unittest.cc
@@ -88,7 +88,7 @@ TEST_F(ExtensionCookiesTest, ExtensionTypeCreation) {
std::unique_ptr<net::CanonicalCookie> canonical_cookie1(
std::make_unique<net::CanonicalCookie>(
"ABC", "DEF", "www.example.com", "/", base::Time(), base::Time(),
- base::Time(), false, false, net::CookieSameSite::DEFAULT_MODE,
+ base::Time(), false, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT));
ASSERT_NE(nullptr, canonical_cookie1.get());
Cookie cookie1 =
@@ -132,7 +132,7 @@ TEST_F(ExtensionCookiesTest, GetURLFromCanonicalCookie) {
std::unique_ptr<net::CanonicalCookie> cookie1(
std::make_unique<net::CanonicalCookie>(
"ABC", "DEF", ".example.com", "/", base::Time(), base::Time(),
- base::Time(), false, false, net::CookieSameSite::DEFAULT_MODE,
+ base::Time(), false, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT));
ASSERT_NE(nullptr, cookie1.get());
EXPECT_EQ("http://example.com/",
@@ -141,7 +141,7 @@ TEST_F(ExtensionCookiesTest, GetURLFromCanonicalCookie) {
std::unique_ptr<net::CanonicalCookie> cookie2(
std::make_unique<net::CanonicalCookie>(
"ABC", "DEF", ".helloworld.com", "/", base::Time(), base::Time(),
- base::Time(), true, false, net::CookieSameSite::DEFAULT_MODE,
+ base::Time(), true, false, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT));
ASSERT_NE(nullptr, cookie2.get());
EXPECT_EQ("https://helloworld.com/",
@@ -178,7 +178,7 @@ TEST_F(ExtensionCookiesTest, DomainMatching) {
std::make_unique<net::CanonicalCookie>(
"name", std::string(), tests[i].domain, "/", base::Time(),
base::Time(), base::Time(), false, false,
- net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
+ net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT));
ASSERT_NE(nullptr, cookie.get());
EXPECT_EQ(tests[i].matches, filter.MatchesCookie(*cookie)) << " test " << i;
}
diff --git a/chromium/chrome/browser/extensions/api/declarative_content/content_action.cc b/chromium/chrome/browser/extensions/api/declarative_content/content_action.cc
index a06733455a6..55c66774656 100644
--- a/chromium/chrome/browser/extensions/api/declarative_content/content_action.cc
+++ b/chromium/chrome/browser/extensions/api/declarative_content/content_action.cc
@@ -69,8 +69,7 @@ class ShowExtensionAction : public ContentAction {
// TODO(devlin): We should probably throw an error if the extension has no
// action specified in the manifest. Currently, this is allowed since
// extensions will have a synthesized page action.
- if (!ActionInfo::GetPageActionInfo(extension) &&
- !ActionInfo::GetBrowserActionInfo(extension)) {
+ if (!ActionInfo::GetAnyActionInfo(extension)) {
*error = kNoAction;
return nullptr;
}
@@ -109,8 +108,7 @@ class ShowExtensionAction : public ContentAction {
// Action that sets an extension's action icon.
class SetIcon : public ContentAction {
public:
- SetIcon(const gfx::Image& icon, ActionInfo::Type action_type)
- : icon_(icon), action_type_(action_type) {}
+ explicit SetIcon(const gfx::Image& icon) : icon_(icon) {}
~SetIcon() override {}
static std::unique_ptr<ContentAction> Create(
@@ -152,20 +150,10 @@ class SetIcon : public ContentAction {
private:
ExtensionAction* GetExtensionAction(Profile* profile,
const Extension* extension) const {
- switch (action_type_) {
- case ActionInfo::TYPE_BROWSER:
- return ExtensionActionManager::Get(profile)
- ->GetBrowserAction(*extension);
- case ActionInfo::TYPE_PAGE:
- return ExtensionActionManager::Get(profile)->GetPageAction(*extension);
- default:
- NOTREACHED();
- }
- return NULL;
+ return ExtensionActionManager::Get(profile)->GetExtensionAction(*extension);
}
gfx::Image icon_;
- ActionInfo::Type action_type_;
DISALLOW_COPY_AND_ASSIGN(SetIcon);
};
@@ -398,12 +386,7 @@ std::unique_ptr<ContentAction> SetIcon::Create(
const base::DictionaryValue* dict,
std::string* error) {
// We can't set a page or action's icon if the extension doesn't have one.
- ActionInfo::Type type;
- if (ActionInfo::GetPageActionInfo(extension) != NULL) {
- type = ActionInfo::TYPE_PAGE;
- } else if (ActionInfo::GetBrowserActionInfo(extension) != NULL) {
- type = ActionInfo::TYPE_BROWSER;
- } else {
+ if (!ActionInfo::GetAnyActionInfo(extension)) {
*error = kNoPageOrBrowserAction;
return nullptr;
}
@@ -431,7 +414,7 @@ std::unique_ptr<ContentAction> SetIcon::Create(
*error = kIconNotSufficientlyVisible;
return nullptr;
}
- return base::WrapUnique(new SetIcon(image, type));
+ return std::make_unique<SetIcon>(image);
}
//
diff --git a/chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_apitest.cc b/chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_apitest.cc
index b5659c455a1..16cb327e49d 100644
--- a/chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_apitest.cc
@@ -9,6 +9,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
#include "base/threading/thread_restrictions.h"
+#include "net/dns/mock_host_resolver.h"
namespace {
@@ -20,6 +21,10 @@ class DeclarativeNetRequestAPItest : public extensions::ExtensionApiTest {
// ExtensionApiTest override.
void SetUpOnMainThread() override {
extensions::ExtensionApiTest::SetUpOnMainThread();
+ ASSERT_TRUE(StartEmbeddedTestServer());
+
+ // Map all hosts to localhost.
+ host_resolver()->AddRule("*", "127.0.0.1");
base::FilePath test_data_dir =
test_data_dir_.AppendASCII("declarative_net_request");
@@ -54,4 +59,8 @@ IN_PROC_BROWSER_TEST_F(DeclarativeNetRequestAPItest, DynamicRules) {
ASSERT_TRUE(RunExtensionTest("dynamic_rules")) << message_;
}
+IN_PROC_BROWSER_TEST_F(DeclarativeNetRequestAPItest, HeaderRemoval) {
+ ASSERT_TRUE(RunExtensionTest("header_removal")) << message_;
+}
+
} // namespace
diff --git a/chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc b/chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
index 7d1001e2f82..84a039dcf4f 100644
--- a/chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
+++ b/chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <memory>
#include <set>
+#include <string>
#include <utility>
#include <vector>
@@ -25,7 +26,6 @@
#include "base/synchronization/lock.h"
#include "base/task/post_task.h"
#include "base/test/metrics/histogram_tester.h"
-#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -60,8 +60,10 @@
#include "extensions/browser/api/declarative_net_request/rules_monitor_service.h"
#include "extensions/browser/api/declarative_net_request/ruleset_manager.h"
#include "extensions/browser/api/declarative_net_request/ruleset_matcher.h"
+#include "extensions/browser/api/declarative_net_request/ruleset_source.h"
#include "extensions/browser/api/declarative_net_request/test_utils.h"
#include "extensions/browser/api/declarative_net_request/utils.h"
+#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/api/web_request/web_request_info.h"
#include "extensions/browser/blocked_action_type.h"
#include "extensions/browser/extension_prefs.h"
@@ -80,10 +82,12 @@
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/url_pattern.h"
#include "extensions/common/url_pattern_set.h"
+#include "extensions/common/value_builder.h"
#include "extensions/test/extension_test_message_listener.h"
#include "ipc/ipc_message.h"
#include "net/base/net_errors.h"
#include "net/dns/mock_host_resolver.h"
+#include "net/test/embedded_test_server/default_handlers.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
#include "net/test/test_data_directory.h"
@@ -251,7 +255,9 @@ class DeclarativeNetRequestBrowserTest
: public ExtensionBrowserTest,
public ::testing::WithParamInterface<ExtensionLoadType> {
public:
- DeclarativeNetRequestBrowserTest() {}
+ DeclarativeNetRequestBrowserTest() {
+ net::test_server::RegisterDefaultHandlers(embedded_test_server());
+ }
// ExtensionBrowserTest overrides:
void SetUpOnMainThread() override {
@@ -319,6 +325,15 @@ class DeclarativeNetRequestBrowserTest
content::PageType GetPageType() const { return GetPageType(browser()); }
+ std::string GetPageBody() const {
+ std::string result;
+ const char* script =
+ "domAutomationController.send(document.body.innerText.trim())";
+ EXPECT_TRUE(content::ExecuteScriptAndExtractString(web_contents(), script,
+ &result));
+ return result;
+ }
+
// Sets whether the extension should have a background script.
void set_has_background_script(bool has_background_script) {
has_background_script_ = has_background_script;
@@ -358,10 +373,13 @@ class DeclarativeNetRequestBrowserTest
// Ensure the ruleset is also loaded on the IO thread.
content::RunAllTasksUntilIdle();
- tester.ExpectTotalCount(kIndexRulesTimeHistogram, 1);
- tester.ExpectTotalCount(kIndexAndPersistRulesTimeHistogram, 1);
- tester.ExpectUniqueSample(kManifestRulesCountHistogram,
- rules.size() /*sample*/, 1 /*count*/);
+ // The histograms below are not logged for unpacked extensions.
+ if (GetParam() == ExtensionLoadType::PACKED) {
+ tester.ExpectTotalCount(kIndexAndPersistRulesTimeHistogram,
+ 1 /* count */);
+ tester.ExpectBucketCount(kManifestRulesCountHistogram,
+ rules.size() /*sample*/, 1 /* count */);
+ }
tester.ExpectTotalCount(
"Extensions.DeclarativeNetRequest.CreateVerifiedMatcherTime", 1);
tester.ExpectUniqueSample(
@@ -389,6 +407,12 @@ class DeclarativeNetRequestBrowserTest
background_page_ready_listener_->Reset();
}
+ // Returns true if the navigation to given |url| is blocked.
+ bool IsNavigationBlocked(const GURL& url) {
+ ui_test_utils::NavigateToURL(browser(), url);
+ return !WasFrameWithScriptLoaded(GetMainFrame());
+ }
+
void AddAllowedPages(const ExtensionId& extension_id,
const std::vector<std::string>& patterns) {
UpdateAllowedPages(extension_id, patterns, "addAllowedPages");
@@ -430,6 +454,46 @@ class DeclarativeNetRequestBrowserTest
EXPECT_EQ(expected_patterns, patterns);
}
+ void AddDynamicRules(const ExtensionId& extension_id,
+ const std::vector<TestRule>& rules) {
+ static constexpr char kScript[] = R"(
+ chrome.declarativeNetRequest.addDynamicRules($1, function () {
+ window.domAutomationController.send(chrome.runtime.lastError ?
+ chrome.runtime.lastError.message : 'success');
+ });
+ )";
+
+ // Serialize |rules|.
+ ListBuilder builder;
+ for (const auto& rule : rules)
+ builder.Append(rule.ToValue());
+
+ // A cast is necessary from ListValue to Value, else this fails to compile.
+ const std::string script = content::JsReplace(
+ kScript, static_cast<const base::Value&>(*builder.Build()));
+ ASSERT_EQ("success", ExecuteScriptInBackgroundPage(extension_id, script));
+ }
+
+ void RemoveDynamicRules(const ExtensionId& extension_id,
+ const std::vector<int> rule_ids) {
+ static constexpr char kScript[] = R"(
+ chrome.declarativeNetRequest.removeDynamicRules($1, function () {
+ window.domAutomationController.send(chrome.runtime.lastError ?
+ chrome.runtime.lastError.message : 'success');
+ });
+ )";
+
+ // Serialize |rule_ids|.
+ ListBuilder builder;
+ for (int rule_id : rule_ids)
+ builder.Append(rule_id);
+
+ // A cast is necessary from ListValue to Value, else this fails to compile.
+ const std::string script = content::JsReplace(
+ kScript, static_cast<const base::Value&>(*builder.Build()));
+ ASSERT_EQ("success", ExecuteScriptInBackgroundPage(extension_id, script));
+ }
+
std::set<GURL> GetAndResetRequestsToServer() {
base::AutoLock lock(requests_to_server_lock_);
std::set<GURL> results = requests_to_server_;
@@ -855,15 +919,24 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest, Allow) {
// enabled.
IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
Enable_Disable_Reload_Uninstall) {
- // Block all main frame requests to example.com
+ set_has_background_script(true);
+
+ // Block all main frame requests to "index.html".
TestRule rule = CreateGenericRule();
- rule.condition->url_filter = std::string("example.com");
+ rule.condition->url_filter = std::string("index.html");
rule.condition->resource_types = std::vector<std::string>({"main_frame"});
ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules({rule}));
const ExtensionId extension_id = last_loaded_extension_id();
- GURL url = embedded_test_server()->GetURL("example.com",
- "/pages_with_script/page.html");
+ // Add dynamic rule to block requests to "page.html".
+ rule.condition->url_filter = std::string("page.html");
+ ASSERT_NO_FATAL_FAILURE(AddDynamicRules(extension_id, {rule}));
+
+ GURL static_rule_url = embedded_test_server()->GetURL(
+ "example.com", "/pages_with_script/index.html");
+ GURL dynamic_rule_url = embedded_test_server()->GetURL(
+ "example.com", "/pages_with_script/page.html");
+
auto test_extension_enabled = [&](bool expected_enabled) {
// Wait for any pending actions caused by extension state change.
content::RunAllTasksUntilIdle();
@@ -871,13 +944,10 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
ExtensionRegistry::Get(profile())->enabled_extensions().Contains(
extension_id));
- ui_test_utils::NavigateToURL(browser(), url);
-
- // If the extension is enabled, the |url| should be blocked.
- EXPECT_EQ(!expected_enabled, WasFrameWithScriptLoaded(GetMainFrame()));
- content::PageType expected_page_type =
- expected_enabled ? content::PAGE_TYPE_ERROR : content::PAGE_TYPE_NORMAL;
- EXPECT_EQ(expected_page_type, GetPageType());
+ // If the extension is enabled, both the |static_rule_url| and
+ // |dynamic_rule_url| should be blocked.
+ EXPECT_EQ(expected_enabled, IsNavigationBlocked(static_rule_url));
+ EXPECT_EQ(expected_enabled, IsNavigationBlocked(dynamic_rule_url));
};
{
@@ -1243,14 +1313,25 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest_Packed,
// directory won't be persisted across browser restarts.
ASSERT_EQ(ExtensionLoadType::PACKED, GetParam());
+ set_has_background_script(true);
+
+ // Block all main frame requests to "index.html".
TestRule rule = CreateGenericRule();
- rule.condition->url_filter = std::string("example.com");
+ rule.condition->url_filter = std::string("index.html");
+ rule.condition->resource_types = std::vector<std::string>({"main_frame"});
ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules({rule}));
+ const ExtensionId extension_id = last_loaded_extension_id();
- GURL url = embedded_test_server()->GetURL("example.com",
- "/pages_with_script/page.html");
- ui_test_utils::NavigateToURL(browser(), url);
- EXPECT_FALSE(WasFrameWithScriptLoaded(GetMainFrame()));
+ // Add dynamic rule to block main-frame requests to "page.html".
+ rule.condition->url_filter = std::string("page.html");
+ ASSERT_NO_FATAL_FAILURE(AddDynamicRules(extension_id, {rule}));
+
+ EXPECT_TRUE(IsNavigationBlocked(embedded_test_server()->GetURL(
+ "example.com", "/pages_with_script/index.html")));
+ EXPECT_TRUE(IsNavigationBlocked(embedded_test_server()->GetURL(
+ "example.com", "/pages_with_script/page.html")));
+ EXPECT_FALSE(IsNavigationBlocked(embedded_test_server()->GetURL(
+ "example.com", "/pages_with_script/page2.html")));
}
IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest_Packed,
@@ -1261,10 +1342,12 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest_Packed,
// Ensure that the DNR extension enabled in previous browser session still
// correctly blocks network requests.
- GURL url = embedded_test_server()->GetURL("example.com",
- "/pages_with_script/page.html");
- ui_test_utils::NavigateToURL(browser(), url);
- EXPECT_FALSE(WasFrameWithScriptLoaded(GetMainFrame()));
+ EXPECT_TRUE(IsNavigationBlocked(embedded_test_server()->GetURL(
+ "example.com", "/pages_with_script/index.html")));
+ EXPECT_TRUE(IsNavigationBlocked(embedded_test_server()->GetURL(
+ "example.com", "/pages_with_script/page.html")));
+ EXPECT_FALSE(IsNavigationBlocked(embedded_test_server()->GetURL(
+ "example.com", "/pages_with_script/page2.html")));
}
// Ensure that Blink's in-memory cache is cleared on adding/removing rulesets.
@@ -1746,88 +1829,139 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest_Packed,
&ruleset_count_waiter,
base::WrapRefCounted(ExtensionSystem::Get(profile())->info_map()));
- const GURL url = embedded_test_server()->GetURL(
- "google.com", "/pages_with_script/index.html");
-
- // Verifies whether |url| was successfully loaded.
- auto verify_page_load = [this, &url](bool success) {
- ui_test_utils::NavigateToURL(browser(), url);
- EXPECT_EQ(success, WasFrameWithScriptLoaded(GetMainFrame()));
-
- content::PageType expected_page_type =
- success ? content::PAGE_TYPE_NORMAL : content::PAGE_TYPE_ERROR;
- EXPECT_EQ(expected_page_type, GetPageType());
- };
-
- // Initially no main frame requests should be blocked.
- {
- SCOPED_TRACE("Initial page load");
- verify_page_load(true);
- }
+ set_has_background_script(true);
- // Load an extension which blocks all main frame requests.
+ // Load an extension which blocks all main-frame requests to "google.com".
TestRule rule = CreateGenericRule();
- rule.condition->url_filter = std::string("*");
+ rule.condition->url_filter = std::string("||google.com");
rule.condition->resource_types = std::vector<std::string>({"main_frame"});
ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules({rule}));
ruleset_count_waiter.WaitForRulesetCount(1);
const ExtensionId extension_id = last_loaded_extension_id();
- const base::FilePath extension_path =
- extension_service()
- ->GetExtensionById(extension_id, false /*include_disabled*/)
- ->path();
- // Loading the extension should cause main frame requests to be blocked.
- {
- SCOPED_TRACE("Page load after loading extension");
- verify_page_load(false);
- }
+ // Add a dynamic rule to block main-frame requests to "example.com".
+ rule.condition->url_filter = std::string("||example.com");
+ ASSERT_NO_FATAL_FAILURE(AddDynamicRules(extension_id, {rule}));
- // Overwrite the indexed ruleset file with arbitrary data to mimic corruption,
- // while maintaining the correct version header.
- {
- base::ScopedAllowBlockingForTesting scoped_allow_blocking;
- std::string corrupted_data = GetVersionHeaderForTesting() + "data";
- ASSERT_EQ(static_cast<int>(corrupted_data.size()),
- base::WriteFile(file_util::GetIndexedRulesetPath(extension_path),
- corrupted_data.c_str(), corrupted_data.size()));
- }
+ const GURL static_rule_url = embedded_test_server()->GetURL(
+ "google.com", "/pages_with_script/index.html");
+ const GURL dynamic_rule_url = embedded_test_server()->GetURL(
+ "example.com", "/pages_with_script/index.html");
+ const GURL unblocked_url = embedded_test_server()->GetURL(
+ "yahoo.com", "/pages_with_script/index.html");
- // The extension should still continue to work since it doesn't need the
- // indexed ruleset while it is loaded.
- verify_page_load(false);
+ const Extension* extension = extension_service()->GetExtensionById(
+ extension_id, false /*include_disabled*/);
+ RulesetSource static_source = RulesetSource::CreateStatic(*extension);
+ RulesetSource dynamic_source =
+ RulesetSource::CreateDynamic(profile(), *extension);
- // Now reload the extension and verify that we detect indexed ruleset
- // corruption and reindex the JSON ruleset.
+ // Loading the extension should cause some main frame requests to be blocked.
{
+ SCOPED_TRACE("Page load after loading extension");
+ EXPECT_TRUE(IsNavigationBlocked(static_rule_url));
+ EXPECT_TRUE(IsNavigationBlocked(dynamic_rule_url));
+ EXPECT_FALSE(IsNavigationBlocked(unblocked_url));
+ }
+
+ // Helper to overwrite an indexed ruleset file with arbitrary data to mimic
+ // corruption, while maintaining the correct version header.
+ auto corrupt_file_for_checksum_mismatch =
+ [](const base::FilePath& indexed_path) {
+ base::ScopedAllowBlockingForTesting scoped_allow_blocking;
+ std::string corrupted_data = GetVersionHeaderForTesting() + "data";
+ ASSERT_EQ(static_cast<int>(corrupted_data.size()),
+ base::WriteFile(indexed_path, corrupted_data.c_str(),
+ corrupted_data.size()));
+ };
+
+ // Helper to reload the extension and ensure it is working.
+ auto test_extension_works_after_reload = [&]() {
DisableExtension(extension_id);
ruleset_count_waiter.WaitForRulesetCount(0);
- base::HistogramTester tester;
EnableExtension(extension_id);
ruleset_count_waiter.WaitForRulesetCount(1);
- // Verify that loading the ruleset would have failed initially due to
- // checksum mismatch and later succeeded.
- EXPECT_EQ(1, tester.GetBucketCount(
- "Extensions.DeclarativeNetRequest.LoadRulesetResult",
- RulesetMatcher::LoadRulesetResult::
- kLoadErrorChecksumMismatch /*sample*/));
- EXPECT_EQ(1,
- tester.GetBucketCount(
- "Extensions.DeclarativeNetRequest.LoadRulesetResult",
- RulesetMatcher::LoadRulesetResult::kLoadSuccess /*sample*/));
-
- // Verify that reindexing succeeded.
- tester.ExpectUniqueSample(
- "Extensions.DeclarativeNetRequest.RulesetReindexSuccessful",
- true /*sample*/, 1 /*count*/);
+ EXPECT_TRUE(IsNavigationBlocked(static_rule_url));
+ EXPECT_TRUE(IsNavigationBlocked(dynamic_rule_url));
+ EXPECT_FALSE(IsNavigationBlocked(unblocked_url));
+ };
+
+ const char* kLoadRulesetResultHistogram =
+ "Extensions.DeclarativeNetRequest.LoadRulesetResult";
+ const char* kReindexHistogram =
+ "Extensions.DeclarativeNetRequest.RulesetReindexSuccessful";
+
+ // Test static ruleset re-indexing.
+ {
+ SCOPED_TRACE("Static ruleset corruption");
+ corrupt_file_for_checksum_mismatch(static_source.indexed_path());
+
+ base::HistogramTester tester;
+ test_extension_works_after_reload();
+
+ // Loading the ruleset would have failed initially due to checksum mismatch
+ // and later succeeded.
+ tester.ExpectBucketCount(kLoadRulesetResultHistogram,
+ RulesetMatcher::LoadRulesetResult::
+ kLoadErrorChecksumMismatch /* sample */,
+ 1 /* count */);
+ // Count of 2 because we load both static and dynamic rulesets.
+ tester.ExpectBucketCount(
+ kLoadRulesetResultHistogram,
+ RulesetMatcher::LoadRulesetResult::kLoadSuccess /* sample */,
+ 2 /* count */);
+ // Verify that reindexing of the static ruleset succeeded.
+ tester.ExpectBucketCount(kReindexHistogram, true /*sample*/, 1 /*count*/);
+ }
+
+ // Test dynamic ruleset re-indexing.
+ {
+ SCOPED_TRACE("Dynamic ruleset corruption");
+ corrupt_file_for_checksum_mismatch(dynamic_source.indexed_path());
+
+ base::HistogramTester tester;
+ test_extension_works_after_reload();
+
+ // Loading the ruleset would have failed initially due to checksum mismatch
+ // and later succeeded.
+ tester.ExpectBucketCount(kLoadRulesetResultHistogram,
+ RulesetMatcher::LoadRulesetResult::
+ kLoadErrorChecksumMismatch /* sample */,
+ 1 /* count */);
+ // Count of 2 because we load both static and dynamic rulesets.
+ tester.ExpectBucketCount(
+ kLoadRulesetResultHistogram,
+ RulesetMatcher::LoadRulesetResult::kLoadSuccess /* sample */,
+ 2 /* count */);
+ // Verify that reindexing of the dynamic ruleset succeeded.
+ tester.ExpectBucketCount(kReindexHistogram, true /*sample*/, 1 /*count*/);
+ }
+
+ // Go crazy and corrupt both static and dynamic rulesets.
+ {
+ SCOPED_TRACE("Static and dynamic ruleset corruption");
+ corrupt_file_for_checksum_mismatch(dynamic_source.indexed_path());
+ corrupt_file_for_checksum_mismatch(static_source.indexed_path());
- // The reindexing of the ruleset should cause the extension to work
- // correctly.
- SCOPED_TRACE("Page load after ruleset corruption");
- verify_page_load(false);
+ base::HistogramTester tester;
+ test_extension_works_after_reload();
+
+ // Loading the ruleset would have failed initially due to checksum mismatch
+ // and later succeeded.
+ tester.ExpectBucketCount(kLoadRulesetResultHistogram,
+ RulesetMatcher::LoadRulesetResult::
+ kLoadErrorChecksumMismatch /* sample */,
+ 2 /* count */);
+ // Count of 2 because we load both static and dynamic rulesets.
+ tester.ExpectBucketCount(
+ kLoadRulesetResultHistogram,
+ RulesetMatcher::LoadRulesetResult::kLoadSuccess /* sample */,
+ 2 /* count */);
+ // Verify that reindexing of both the rulesets succeeded.
+ tester.ExpectBucketCount(kReindexHistogram, true /*sample*/, 2 /*count*/);
}
}
@@ -1885,6 +2019,8 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
// version is not the same as one used by Chrome.
IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest_Packed,
ReindexOnRulesetVersionMismatch) {
+ set_has_background_script(true);
+
// Set up an observer for RulesetMatcher to monitor the number of extension
// rulesets.
RulesetCountWaiter ruleset_count_waiter;
@@ -1902,6 +2038,9 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest_Packed,
declarative_net_request::RulesMonitorService>::Get(profile());
EXPECT_TRUE(rules_monitor_service->HasRegisteredRuleset(extension_id));
+ // Add a dynamic rule.
+ AddDynamicRules(extension_id, {rule});
+
DisableExtension(extension_id);
ruleset_count_waiter.WaitForRulesetCount(0);
EXPECT_FALSE(rules_monitor_service->HasRegisteredRuleset(extension_id));
@@ -1919,30 +2058,26 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest_Packed,
ruleset_count_waiter.WaitForRulesetCount(1);
EXPECT_TRUE(rules_monitor_service->HasRegisteredRuleset(extension_id));
- // Verify that loading the ruleset would have failed initially due to
- // version header mismatch and later succeeded.
- EXPECT_EQ(1, tester.GetBucketCount(
+ // Verify that loading the static and dynamic rulesets would have failed
+ // initially due to version header mismatch and later succeeded.
+ EXPECT_EQ(2, tester.GetBucketCount(
"Extensions.DeclarativeNetRequest.LoadRulesetResult",
RulesetMatcher::LoadRulesetResult::
kLoadErrorVersionMismatch /*sample*/));
- EXPECT_EQ(1, tester.GetBucketCount(
+ EXPECT_EQ(2, tester.GetBucketCount(
"Extensions.DeclarativeNetRequest.LoadRulesetResult",
RulesetMatcher::LoadRulesetResult::kLoadSuccess /*sample*/));
// Verify that reindexing succeeded.
tester.ExpectUniqueSample(
"Extensions.DeclarativeNetRequest.RulesetReindexSuccessful",
- true /*sample*/, 1 /*count*/);
+ true /*sample*/, 2 /*count*/);
}
// Tests that redirecting requests using the declarativeNetRequest API works
-// with extensions_features::kRuntimeHostPermissions.
+// with runtime host permissions.
IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
WithheldPermissions_Redirect) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
// Load an extension which redirects all script requests made to
// "b.com/subresources/not_a_valid_script.js", to
// "b.com/subresources/script.js".
@@ -2075,10 +2210,6 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
// the declarative net request API.
IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
WithheldPermissions_Block) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
// Load an extension with access to <all_urls> which blocks all script
// requests made on example.com.
TestRule rule = CreateGenericRule();
@@ -2120,6 +2251,130 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
EXPECT_TRUE(WasFrameWithScriptLoaded(GetMainFrame()));
}
+// Tests the dynamic rule support.
+IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest, DynamicRules) {
+ set_has_background_script(true);
+
+ // Add an extension which blocks main-frame requests to "yahoo.com".
+ TestRule block_static_rule = CreateGenericRule();
+ block_static_rule.condition->resource_types =
+ std::vector<std::string>({"main_frame"});
+ block_static_rule.condition->url_filter = std::string("||yahoo.com");
+ ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules(
+ {block_static_rule}, "test_extension", {URLPattern::kAllUrlsPattern}));
+
+ const char* kUrlPath = "/pages_with_script/index.html";
+ GURL yahoo_url = embedded_test_server()->GetURL("yahoo.com", kUrlPath);
+ GURL google_url = embedded_test_server()->GetURL("google.com", kUrlPath);
+ EXPECT_TRUE(IsNavigationBlocked(yahoo_url));
+ EXPECT_FALSE(IsNavigationBlocked(google_url));
+
+ // Add dynamic rules to block "google.com" and redirect pages on "example.com"
+ // to |dynamic_redirect_url|.
+ TestRule block_dynamic_rule = block_static_rule;
+ block_dynamic_rule.condition->url_filter = std::string("||google.com");
+ block_dynamic_rule.id = kMinValidID;
+
+ GURL dynamic_redirect_url =
+ embedded_test_server()->GetURL("dynamic.com", kUrlPath);
+ TestRule redirect_rule = CreateGenericRule();
+ redirect_rule.condition->url_filter = std::string("||example.com");
+ redirect_rule.condition->resource_types =
+ std::vector<std::string>({"main_frame"});
+ redirect_rule.priority = kMinValidPriority;
+ redirect_rule.action->type = std::string("redirect");
+ redirect_rule.action->redirect_url = dynamic_redirect_url.spec();
+ redirect_rule.id = kMinValidID + 1;
+
+ ASSERT_NO_FATAL_FAILURE(AddDynamicRules(last_loaded_extension_id(),
+ {block_dynamic_rule, redirect_rule}));
+
+ EXPECT_TRUE(IsNavigationBlocked(google_url));
+ EXPECT_TRUE(IsNavigationBlocked(yahoo_url));
+
+ // Navigate to a page on "example.com". It should be redirected to
+ // |dynamic_redirect_url|.
+ GURL example_url = embedded_test_server()->GetURL("example.com", kUrlPath);
+ ui_test_utils::NavigateToURL(browser(), example_url);
+ EXPECT_EQ(content::PAGE_TYPE_NORMAL, GetPageType());
+ EXPECT_TRUE(WasFrameWithScriptLoaded(GetMainFrame()));
+ EXPECT_EQ(dynamic_redirect_url, web_contents()->GetLastCommittedURL());
+
+ // Now add a dynamic rule to allow requests to yahoo.com.
+ TestRule allow_rule = block_static_rule;
+ allow_rule.id = kMinValidID + 2;
+ allow_rule.action->type = std::string("allow");
+ ASSERT_NO_FATAL_FAILURE(
+ AddDynamicRules(last_loaded_extension_id(), {allow_rule}));
+
+ // Dynamic ruleset gets more priority over the static ruleset and yahoo.com is
+ // not blocked.
+ EXPECT_FALSE(IsNavigationBlocked(yahoo_url));
+
+ // Now remove the |block_rule| and |allow_rule|. Rule ids not present will be
+ // ignored.
+ ASSERT_NO_FATAL_FAILURE(RemoveDynamicRules(
+ last_loaded_extension_id(),
+ {*block_dynamic_rule.id, *allow_rule.id, kMinValidID + 100}));
+ EXPECT_FALSE(IsNavigationBlocked(google_url));
+ EXPECT_TRUE(IsNavigationBlocked(yahoo_url));
+}
+
+// Tests removal of the 'Referer' request header.
+IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
+ BlockRefererRequestHeader) {
+ auto test_referrer_blocked = [this](bool expected_referrer_blocked) {
+ const GURL initial_url =
+ embedded_test_server()->GetURL("example.com", "/simulate_click.html");
+ const GURL url_with_referrer =
+ embedded_test_server()->GetURL("example.com", "/echoheader?referer");
+ content::TestNavigationObserver observer(web_contents(),
+ 2 /* number_of_navigations */);
+ observer.set_wait_event(
+ content::TestNavigationObserver::WaitEvent::kNavigationFinished);
+ ui_test_utils::NavigateToURL(browser(), initial_url);
+ observer.WaitForNavigationFinished();
+ ASSERT_EQ(url_with_referrer, observer.last_navigation_url());
+
+ std::string expected_referrer =
+ expected_referrer_blocked ? "None" : initial_url.spec();
+ EXPECT_EQ(expected_referrer, GetPageBody());
+ };
+
+ test_referrer_blocked(false);
+
+ // Load an extension which blocks the Referer header for requests to
+ // "example.com".
+ TestRule rule = CreateGenericRule();
+ rule.condition->url_filter = std::string("||example.com");
+ rule.condition->resource_types = std::vector<std::string>({"main_frame"});
+ rule.action->type = std::string("removeHeaders");
+ rule.action->remove_headers_list = std::vector<std::string>({"referer"});
+
+ // Set up an observer for RulesetMatcher to monitor the number of extension
+ // rulesets.
+ RulesetCountWaiter ruleset_count_waiter;
+ ScopedRulesetManagerTestObserver scoped_observer(
+ &ruleset_count_waiter,
+ base::WrapRefCounted(ExtensionSystem::Get(profile())->info_map()));
+
+ EXPECT_FALSE(ExtensionWebRequestEventRouter::GetInstance()
+ ->HasAnyExtraHeadersListenerOnUI(profile()));
+ ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules({rule}));
+ ruleset_count_waiter.WaitForRulesetCount(1);
+ content::RunAllTasksUntilIdle();
+ EXPECT_TRUE(ExtensionWebRequestEventRouter::GetInstance()
+ ->HasAnyExtraHeadersListenerOnUI(profile()));
+ test_referrer_blocked(true);
+
+ DisableExtension(last_loaded_extension_id());
+ ruleset_count_waiter.WaitForRulesetCount(0);
+ content::RunAllTasksUntilIdle();
+ EXPECT_FALSE(ExtensionWebRequestEventRouter::GetInstance()
+ ->HasAnyExtraHeadersListenerOnUI(profile()));
+ test_referrer_blocked(false);
+}
+
// Test fixture to verify that host permissions for the request url and the
// request initiator are properly checked when redirecting requests. Loads an
// example.com url with four sub-frames named frame_[1..4] from hosts
diff --git a/chromium/chrome/browser/extensions/api/declarative_net_request/rule_indexing_unittest.cc b/chromium/chrome/browser/extensions/api/declarative_net_request/rule_indexing_unittest.cc
index 0191dbe110d..eb626a6c874 100644
--- a/chromium/chrome/browser/extensions/api/declarative_net_request/rule_indexing_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/declarative_net_request/rule_indexing_unittest.cc
@@ -29,6 +29,7 @@
#include "extensions/common/install_warning.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/url_pattern.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
@@ -79,13 +80,20 @@ class RuleIndexingTest : public DNRTestBase {
// Ensure no load errors were reported.
EXPECT_TRUE(error_reporter()->GetErrors()->empty());
- tester.ExpectTotalCount(kIndexRulesTimeHistogram, 1);
- tester.ExpectTotalCount(kIndexAndPersistRulesTimeHistogram, 1);
- tester.ExpectBucketCount(kManifestRulesCountHistogram,
- expected_indexed_rules_count, 1);
+ // The histograms below are not logged for unpacked extensions.
+ if (GetParam() == ExtensionLoadType::PACKED) {
+ tester.ExpectTotalCount(kIndexAndPersistRulesTimeHistogram,
+ 1 /* count */);
+ tester.ExpectBucketCount(kManifestRulesCountHistogram,
+ expected_indexed_rules_count, 1 /* count */);
+ }
}
void LoadAndExpectError(const std::string& expected_error) {
+ // The error should be prepended with the JSON filename.
+ std::string error_with_filename = base::StringPrintf(
+ "%s: %s", kJSONRulesFilename, expected_error.c_str());
+
base::HistogramTester tester;
WriteExtensionData();
@@ -103,10 +111,9 @@ class RuleIndexingTest : public DNRTestBase {
const std::vector<base::string16>* errors = error_reporter()->GetErrors();
ASSERT_EQ(1u, errors->size());
EXPECT_NE(base::string16::npos,
- errors->at(0).find(base::UTF8ToUTF16(expected_error)))
- << "expected: " << expected_error << " actual: " << errors->at(0);
+ errors->at(0).find(base::UTF8ToUTF16(error_with_filename)))
+ << "expected: " << error_with_filename << " actual: " << errors->at(0);
- tester.ExpectTotalCount(kIndexRulesTimeHistogram, 0u);
tester.ExpectTotalCount(kIndexAndPersistRulesTimeHistogram, 0u);
tester.ExpectTotalCount(kManifestRulesCountHistogram, 0u);
}
@@ -178,7 +185,7 @@ TEST_P(RuleIndexingTest, DuplicateResourceTypes) {
AddRule(rule);
LoadAndExpectError(
ParseInfo(ParseResult::ERROR_RESOURCE_TYPE_DUPLICATED, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, EmptyRedirectRulePriority) {
@@ -188,7 +195,7 @@ TEST_P(RuleIndexingTest, EmptyRedirectRulePriority) {
AddRule(rule);
LoadAndExpectError(
ParseInfo(ParseResult::ERROR_EMPTY_REDIRECT_RULE_PRIORITY, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, EmptyRedirectRuleUrl) {
@@ -202,7 +209,7 @@ TEST_P(RuleIndexingTest, EmptyRedirectRuleUrl) {
AddRule(rule);
LoadAndExpectError(ParseInfo(ParseResult::ERROR_EMPTY_REDIRECT_URL, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, InvalidRuleID) {
@@ -210,7 +217,7 @@ TEST_P(RuleIndexingTest, InvalidRuleID) {
rule.id = kMinValidID - 1;
AddRule(rule);
LoadAndExpectError(ParseInfo(ParseResult::ERROR_INVALID_RULE_ID, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, InvalidRedirectRulePriority) {
@@ -221,7 +228,7 @@ TEST_P(RuleIndexingTest, InvalidRedirectRulePriority) {
AddRule(rule);
LoadAndExpectError(
ParseInfo(ParseResult::ERROR_INVALID_REDIRECT_RULE_PRIORITY, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, NoApplicableResourceTypes) {
@@ -233,7 +240,7 @@ TEST_P(RuleIndexingTest, NoApplicableResourceTypes) {
AddRule(rule);
LoadAndExpectError(
ParseInfo(ParseResult::ERROR_NO_APPLICABLE_RESOURCE_TYPES, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, EmptyDomainsList) {
@@ -241,7 +248,7 @@ TEST_P(RuleIndexingTest, EmptyDomainsList) {
rule.condition->domains = std::vector<std::string>();
AddRule(rule);
LoadAndExpectError(ParseInfo(ParseResult::ERROR_EMPTY_DOMAINS_LIST, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, EmptyResourceTypeList) {
@@ -250,7 +257,7 @@ TEST_P(RuleIndexingTest, EmptyResourceTypeList) {
AddRule(rule);
LoadAndExpectError(
ParseInfo(ParseResult::ERROR_EMPTY_RESOURCE_TYPES_LIST, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, EmptyURLFilter) {
@@ -258,7 +265,7 @@ TEST_P(RuleIndexingTest, EmptyURLFilter) {
rule.condition->url_filter = std::string();
AddRule(rule);
LoadAndExpectError(ParseInfo(ParseResult::ERROR_EMPTY_URL_FILTER, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, InvalidRedirectURL) {
@@ -269,13 +276,12 @@ TEST_P(RuleIndexingTest, InvalidRedirectURL) {
AddRule(rule);
LoadAndExpectError(
ParseInfo(ParseResult::ERROR_INVALID_REDIRECT_URL, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
TEST_P(RuleIndexingTest, ListNotPassed) {
SetRules(std::make_unique<base::DictionaryValue>());
- LoadAndExpectError(ParseInfo(ParseResult::ERROR_LIST_NOT_PASSED)
- .GetErrorDescription(kJSONRulesFilename));
+ LoadAndExpectError(kErrorListNotPassed);
}
TEST_P(RuleIndexingTest, DuplicateIDS) {
@@ -283,7 +289,7 @@ TEST_P(RuleIndexingTest, DuplicateIDS) {
AddRule(rule);
AddRule(rule);
LoadAndExpectError(ParseInfo(ParseResult::ERROR_DUPLICATE_IDS, *rule.id)
- .GetErrorDescription(kJSONRulesFilename));
+ .GetErrorDescription());
}
// Ensure that we limit the number of parse failure warnings shown.
@@ -323,11 +329,10 @@ TEST_P(RuleIndexingTest, TooManyParseFailures) {
// The initial warnings should correspond to the first
// |kMaxUnparsedRulesWarnings| rules, which couldn't be parsed.
for (size_t i = 0; i < kMaxUnparsedRulesWarnings; i++) {
- warning.message = ErrorUtils::FormatErrorMessage(
- kRuleNotParsedWarning, base::StringPrintf("id %zu", i + 1),
- "'RuleActionType': expected \"block\" or \"redirect\" or \"allow\", "
- "got \"invalid_action_type\"");
- EXPECT_EQ(expected_warnings[i], warning);
+ EXPECT_EQ(expected_warnings[i].key, warning.key);
+ EXPECT_EQ(expected_warnings[i].specific, warning.specific);
+ EXPECT_THAT(expected_warnings[i].message,
+ ::testing::HasSubstr("Parse error"));
}
warning.message = ErrorUtils::FormatErrorMessage(
@@ -375,21 +380,13 @@ TEST_P(RuleIndexingTest, InvalidJSONRules_StrongTypes) {
ASSERT_EQ(2u, extension()->install_warnings().size());
std::vector<InstallWarning> expected_warnings;
- expected_warnings.emplace_back(
- ErrorUtils::FormatErrorMessage(
- kRuleNotParsedWarning, "id 2",
- "'RuleActionType': expected \"block\" or \"redirect\" or \"allow\","
- " got \"invalid action\""),
- manifest_keys::kDeclarativeNetRequestKey,
- manifest_keys::kDeclarativeRuleResourcesKey);
- expected_warnings.emplace_back(
- ErrorUtils::FormatErrorMessage(
- kRuleNotParsedWarning, "id 4",
- "'DomainType': expected \"firstParty\" or \"thirdParty\", got "
- "\"invalid_domain_type\""),
- manifest_keys::kDeclarativeNetRequestKey,
- manifest_keys::kDeclarativeRuleResourcesKey);
- EXPECT_EQ(expected_warnings, extension()->install_warnings());
+ for (const auto& warning : extension()->install_warnings()) {
+ EXPECT_EQ(extensions::manifest_keys::kDeclarativeNetRequestKey,
+ warning.key);
+ EXPECT_EQ(extensions::manifest_keys::kDeclarativeRuleResourcesKey,
+ warning.specific);
+ EXPECT_THAT(warning.message, ::testing::HasSubstr("Parse error"));
+ }
}
}
@@ -490,9 +487,9 @@ TEST_P(RuleIndexingTest, RuleCountLimitExceeded) {
TEST_P(RuleIndexingTest, InvalidJSONFile) {
set_persist_invalid_json_file();
- // The error is returned by the JSON parser we use. Hence just test that it's
- // prepended with |kJSONRulesFilename|.
- LoadAndExpectError(base::StringPrintf("%s: ", kJSONRulesFilename));
+ // The error is returned by the JSON parser we use. Hence just test an error
+ // is raised.
+ LoadAndExpectError("");
}
TEST_P(RuleIndexingTest, EmptyRuleset) {
@@ -513,41 +510,6 @@ TEST_P(RuleIndexingTest, AddTwoRules) {
LoadAndExpectSuccess(2 /* rules count */);
}
-TEST_P(RuleIndexingTest, ReloadExtension) {
- AddRule(CreateGenericRule());
- LoadAndExpectSuccess(1 /* rules count */);
-
- base::HistogramTester tester;
- TestExtensionRegistryObserver registry_observer(registry());
-
- service()->ReloadExtension(extension()->id());
- // Reloading should invalidate pointers to existing extension(). Hence reset
- // it.
- set_extension(
- base::WrapRefCounted(registry_observer.WaitForExtensionLoaded()));
-
- // Reloading the extension should cause the rules to be re-indexed in the
- // case of unpacked extensions.
- int expected_histogram_count = -1;
- switch (GetParam()) {
- case ExtensionLoadType::PACKED:
- expected_histogram_count = 0;
- break;
- case ExtensionLoadType::UNPACKED:
- expected_histogram_count = 1;
- break;
- }
-
- tester.ExpectTotalCount(kIndexRulesTimeHistogram, expected_histogram_count);
- tester.ExpectTotalCount(kIndexAndPersistRulesTimeHistogram,
- expected_histogram_count);
- tester.ExpectBucketCount(kManifestRulesCountHistogram, 1 /* rules count */,
- expected_histogram_count);
-
- // Ensure no install warnings were raised on reload.
- EXPECT_TRUE(extension()->install_warnings().empty());
-}
-
// Test that we do not use an extension provided indexed ruleset.
TEST_P(RuleIndexingTest, ExtensionWithIndexedRuleset) {
set_persist_initial_indexed_ruleset();
diff --git a/chromium/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc b/chromium/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc
index 16b23591f86..77fc55a988e 100644
--- a/chromium/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc
@@ -14,7 +14,9 @@
#include "chrome/browser/extensions/api/declarative_net_request/dnr_test_base.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/extensions/extension_util.h"
+#include "extensions/browser/api/declarative_net_request/composite_matcher.h"
#include "extensions/browser/api/declarative_net_request/ruleset_matcher.h"
+#include "extensions/browser/api/declarative_net_request/ruleset_source.h"
#include "extensions/browser/api/declarative_net_request/test_utils.h"
#include "extensions/browser/api/web_request/web_request_info.h"
#include "extensions/browser/extension_prefs.h"
@@ -44,12 +46,13 @@ class RulesetManagerTest : public DNRTestBase {
protected:
using Action = RulesetManager::Action;
+ using ActionType = Action::Type;
- // Helper to create a ruleset matcher instance for the given |rules|.
+ // Helper to create a composite matcher instance for the given |rules|.
void CreateMatcherForRules(
const std::vector<TestRule>& rules,
const std::string& extension_dirname,
- std::unique_ptr<RulesetMatcher>* matcher,
+ std::unique_ptr<CompositeMatcher>* matcher,
const std::vector<std::string>& host_permissions = {},
bool has_background_script = false) {
base::FilePath extension_dir =
@@ -74,11 +77,12 @@ class RulesetManagerTest : public DNRTestBase {
->GetDNRRulesetChecksum(last_loaded_extension_->id(),
&expected_checksum));
- EXPECT_EQ(
- RulesetMatcher::kLoadSuccess,
- RulesetMatcher::CreateVerifiedMatcher(
- file_util::GetIndexedRulesetPath(last_loaded_extension_->path()),
- expected_checksum, matcher));
+ std::vector<std::unique_ptr<RulesetMatcher>> matchers(1);
+ EXPECT_EQ(RulesetMatcher::kLoadSuccess,
+ RulesetMatcher::CreateVerifiedMatcher(
+ RulesetSource::CreateStatic(*last_loaded_extension_),
+ expected_checksum, &matchers[0]));
+ *matcher = std::make_unique<CompositeMatcher>(std::move(matchers));
}
void SetIncognitoEnabled(const Extension* extension, bool incognito_enabled) {
@@ -139,9 +143,8 @@ TEST_P(RulesetManagerTest, MultipleRulesets) {
WebRequestInfo request_three_info = GetRequestForURL("http://three.com");
auto should_block_request = [manager](const WebRequestInfo& request) {
- GURL redirect_url;
- return manager->EvaluateRequest(request, false /*is_incognito_context*/,
- &redirect_url) == Action::BLOCK;
+ return manager->EvaluateRequest(request, false /*is_incognito_context*/) ==
+ Action(ActionType::BLOCK);
};
for (int mask = 0; mask < 4; mask++) {
@@ -155,7 +158,7 @@ TEST_P(RulesetManagerTest, MultipleRulesets) {
// Add the required rulesets.
if (mask & kEnableRulesetOne) {
++expected_matcher_count;
- std::unique_ptr<RulesetMatcher> matcher;
+ std::unique_ptr<CompositeMatcher> matcher;
ASSERT_NO_FATAL_FAILURE(CreateMatcherForRules(
{rule_one}, std::to_string(mask) + "_one", &matcher));
extension_id_one = last_loaded_extension()->id();
@@ -164,7 +167,7 @@ TEST_P(RulesetManagerTest, MultipleRulesets) {
}
if (mask & kEnableRulesetTwo) {
++expected_matcher_count;
- std::unique_ptr<RulesetMatcher> matcher;
+ std::unique_ptr<CompositeMatcher> matcher;
ASSERT_NO_FATAL_FAILURE(CreateMatcherForRules(
{rule_two}, std::to_string(mask) + "_two", &matcher));
extension_id_two = last_loaded_extension()->id();
@@ -197,7 +200,7 @@ TEST_P(RulesetManagerTest, IncognitoRequests) {
// Add an extension ruleset blocking "example.com".
TestRule rule_one = CreateGenericRule();
rule_one.condition->url_filter = std::string("example.com");
- std::unique_ptr<RulesetMatcher> matcher;
+ std::unique_ptr<CompositeMatcher> matcher;
ASSERT_NO_FATAL_FAILURE(
CreateMatcherForRules({rule_one}, "test_extension", &matcher));
manager->AddRuleset(last_loaded_extension()->id(), std::move(matcher),
@@ -205,30 +208,28 @@ TEST_P(RulesetManagerTest, IncognitoRequests) {
WebRequestInfo request_info = GetRequestForURL("http://example.com");
- GURL redirect_url;
-
// By default, the extension is disabled in incognito mode. So requests from
// incognito contexts should not be evaluated.
EXPECT_FALSE(util::IsIncognitoEnabled(last_loaded_extension()->id(),
browser_context()));
- EXPECT_EQ(Action::NONE,
- manager->EvaluateRequest(
- request_info, true /*is_incognito_context*/, &redirect_url));
- EXPECT_EQ(Action::BLOCK,
- manager->EvaluateRequest(
- request_info, false /*is_incognito_context*/, &redirect_url));
+ EXPECT_EQ(
+ Action(ActionType::NONE),
+ manager->EvaluateRequest(request_info, true /*is_incognito_context*/));
+ EXPECT_EQ(
+ Action(ActionType::BLOCK),
+ manager->EvaluateRequest(request_info, false /*is_incognito_context*/));
// Enabling the extension in incognito mode, should cause requests from
// incognito contexts to also be evaluated.
SetIncognitoEnabled(last_loaded_extension(), true /*incognito_enabled*/);
EXPECT_TRUE(util::IsIncognitoEnabled(last_loaded_extension()->id(),
browser_context()));
- EXPECT_EQ(Action::BLOCK,
- manager->EvaluateRequest(
- request_info, true /*is_incognito_context*/, &redirect_url));
- EXPECT_EQ(Action::BLOCK,
- manager->EvaluateRequest(
- request_info, false /*is_incognito_context*/, &redirect_url));
+ EXPECT_EQ(
+ Action(ActionType::BLOCK),
+ manager->EvaluateRequest(request_info, true /*is_incognito_context*/));
+ EXPECT_EQ(
+ Action(ActionType::BLOCK),
+ manager->EvaluateRequest(request_info, false /*is_incognito_context*/));
}
// Tests that
@@ -240,25 +241,24 @@ TEST_P(RulesetManagerTest, TotalEvaluationTimeHistogram) {
WebRequestInfo example_com_request = GetRequestForURL("http://example.com");
WebRequestInfo google_com_request = GetRequestForURL("http://google.com");
- GURL redirect_url;
bool is_incognito_context = false;
const char* kHistogramName =
"Extensions.DeclarativeNetRequest.EvaluateRequestTime.AllExtensions2";
{
base::HistogramTester tester;
- EXPECT_EQ(Action::NONE,
- manager->EvaluateRequest(example_com_request,
- is_incognito_context, &redirect_url));
- EXPECT_EQ(Action::NONE,
- manager->EvaluateRequest(google_com_request, is_incognito_context,
- &redirect_url));
+ EXPECT_EQ(
+ Action(ActionType::NONE),
+ manager->EvaluateRequest(example_com_request, is_incognito_context));
+ EXPECT_EQ(
+ Action(ActionType::NONE),
+ manager->EvaluateRequest(google_com_request, is_incognito_context));
tester.ExpectTotalCount(kHistogramName, 0);
}
// Add an extension ruleset which blocks requests to "example.com".
TestRule rule = CreateGenericRule();
rule.condition->url_filter = std::string("example.com");
- std::unique_ptr<RulesetMatcher> matcher;
+ std::unique_ptr<CompositeMatcher> matcher;
ASSERT_NO_FATAL_FAILURE(
CreateMatcherForRules({rule}, "test_extension", &matcher));
manager->AddRuleset(last_loaded_extension()->id(), std::move(matcher),
@@ -266,13 +266,13 @@ TEST_P(RulesetManagerTest, TotalEvaluationTimeHistogram) {
{
base::HistogramTester tester;
- EXPECT_EQ(Action::BLOCK,
- manager->EvaluateRequest(example_com_request,
- is_incognito_context, &redirect_url));
+ EXPECT_EQ(
+ Action(ActionType::BLOCK),
+ manager->EvaluateRequest(example_com_request, is_incognito_context));
tester.ExpectTotalCount(kHistogramName, 1);
- EXPECT_EQ(Action::NONE,
- manager->EvaluateRequest(google_com_request, is_incognito_context,
- &redirect_url));
+ EXPECT_EQ(
+ Action(ActionType::NONE),
+ manager->EvaluateRequest(google_com_request, is_incognito_context));
tester.ExpectTotalCount(kHistogramName, 2);
}
}
@@ -288,7 +288,7 @@ TEST_P(RulesetManagerTest, Redirect) {
rule.priority = kMinValidPriority;
rule.action->type = std::string("redirect");
rule.action->redirect_url = std::string("http://google.com");
- std::unique_ptr<RulesetMatcher> matcher;
+ std::unique_ptr<CompositeMatcher> matcher;
ASSERT_NO_FATAL_FAILURE(
CreateMatcherForRules({rule}, "test_extension", &matcher,
{"*://example.com/*", "*://abc.com/*"}));
@@ -298,36 +298,30 @@ TEST_P(RulesetManagerTest, Redirect) {
// Create a request to "example.com" with an empty initiator. It should be
// redirected to "google.com".
const bool is_incognito_context = false;
- GURL redirect_url1;
WebRequestInfo request = GetRequestForURL("http://example.com");
request.initiator = base::nullopt;
- EXPECT_EQ(
- Action::REDIRECT,
- manager->EvaluateRequest(request, is_incognito_context, &redirect_url1));
- EXPECT_EQ(GURL("http://google.com"), redirect_url1);
+ Action action = manager->EvaluateRequest(request, is_incognito_context);
+ EXPECT_EQ(ActionType::REDIRECT, action.type);
+ EXPECT_EQ(GURL("http://google.com"), action.redirect_url);
// Change the initiator to "xyz.com". It should not be redirected since we
// don't have host permissions to the request initiator.
- GURL redirect_url2;
request.initiator = url::Origin::Create(GURL("http://xyz.com"));
- EXPECT_EQ(Action::NONE, manager->EvaluateRequest(
- request, is_incognito_context, &redirect_url2));
+ action = manager->EvaluateRequest(request, is_incognito_context);
+ EXPECT_EQ(Action(ActionType::NONE), action);
// Change the initiator to "abc.com". It should be redirected since we have
// the required host permissions.
- GURL redirect_url3;
request.initiator = url::Origin::Create(GURL("http://abc.com"));
- EXPECT_EQ(
- Action::REDIRECT,
- manager->EvaluateRequest(request, is_incognito_context, &redirect_url3));
- EXPECT_EQ(GURL("http://google.com"), redirect_url3);
+ action = manager->EvaluateRequest(request, is_incognito_context);
+ EXPECT_EQ(ActionType::REDIRECT, action.type);
+ EXPECT_EQ(GURL("http://google.com"), action.redirect_url);
// Ensure web-socket requests are not redirected.
- GURL redirect_url4;
request = GetRequestForURL("ws://example.com");
request.initiator = base::nullopt;
- EXPECT_EQ(Action::NONE, manager->EvaluateRequest(
- request, is_incognito_context, &redirect_url4));
+ action = manager->EvaluateRequest(request, is_incognito_context);
+ EXPECT_EQ(Action(ActionType::NONE), action);
}
// Tests that an extension can't block or redirect resources on the chrome-
@@ -340,7 +334,7 @@ TEST_P(RulesetManagerTest, ExtensionScheme) {
const Extension* extension_2 = nullptr;
// Add an extension with a background page which blocks all requests.
{
- std::unique_ptr<RulesetMatcher> matcher;
+ std::unique_ptr<CompositeMatcher> matcher;
TestRule rule = CreateGenericRule();
rule.condition->url_filter = std::string("*");
ASSERT_NO_FATAL_FAILURE(CreateMatcherForRules(
@@ -354,7 +348,7 @@ TEST_P(RulesetManagerTest, ExtensionScheme) {
// Add another extension with a background page which redirects all requests
// to "http://google.com".
{
- std::unique_ptr<RulesetMatcher> matcher;
+ std::unique_ptr<CompositeMatcher> matcher;
TestRule rule = CreateGenericRule();
rule.condition->url_filter = std::string("*");
rule.priority = kMinValidPriority;
@@ -373,36 +367,31 @@ TEST_P(RulesetManagerTest, ExtensionScheme) {
// Ensure that "http://example.com" will be blocked (with blocking taking
// priority over redirection).
WebRequestInfo request = GetRequestForURL("http://example.com");
- GURL redirect_url;
- EXPECT_EQ(Action::BLOCK,
- manager->EvaluateRequest(request, false /*is_incognito_context*/,
- &redirect_url));
+ EXPECT_EQ(Action(ActionType::BLOCK),
+ manager->EvaluateRequest(request, false /*is_incognito_context*/));
// Ensure that the background page for |extension_1| won't be blocked or
// redirected.
GURL background_page_url_1 = BackgroundInfo::GetBackgroundURL(extension_1);
EXPECT_TRUE(!background_page_url_1.is_empty());
request = GetRequestForURL(background_page_url_1.spec());
- EXPECT_EQ(Action::NONE,
- manager->EvaluateRequest(request, false /*is_incognito_context*/,
- &redirect_url));
+ EXPECT_EQ(Action(ActionType::NONE),
+ manager->EvaluateRequest(request, false /*is_incognito_context*/));
// Ensure that the background page for |extension_2| won't be blocked or
// redirected.
GURL background_page_url_2 = BackgroundInfo::GetBackgroundURL(extension_2);
EXPECT_TRUE(!background_page_url_2.is_empty());
request = GetRequestForURL(background_page_url_2.spec());
- EXPECT_EQ(Action::NONE,
- manager->EvaluateRequest(request, false /*is_incognito_context*/,
- &redirect_url));
+ EXPECT_EQ(Action(ActionType::NONE),
+ manager->EvaluateRequest(request, false /*is_incognito_context*/));
// Also ensure that an arbitrary url on the chrome extension scheme is also
// not blocked or redirected.
request = GetRequestForURL(base::StringPrintf("%s://%s/%s", kExtensionScheme,
"extension_id", "path"));
- EXPECT_EQ(Action::NONE,
- manager->EvaluateRequest(request, false /*is_incognito_context*/,
- &redirect_url));
+ EXPECT_EQ(Action(ActionType::NONE),
+ manager->EvaluateRequest(request, false /*is_incognito_context*/));
}
TEST_P(RulesetManagerTest, PageAllowingAPI) {
@@ -412,7 +401,7 @@ TEST_P(RulesetManagerTest, PageAllowingAPI) {
// Add an extension which blocks all requests except for requests from
// http://google.com/allow* which are allowed.
{
- std::unique_ptr<RulesetMatcher> matcher;
+ std::unique_ptr<CompositeMatcher> matcher;
// This blocks all subresource requests. By default the main-frame resource
// type is excluded.
@@ -458,13 +447,13 @@ TEST_P(RulesetManagerTest, PageAllowingAPI) {
bool expect_blocked_with_allowed_pages;
} test_cases[] = {
// Main frame requests. Allowed based on request url.
- {kAllowedPageURL, content::RESOURCE_TYPE_MAIN_FRAME, base::nullopt,
+ {kAllowedPageURL, content::ResourceType::kMainFrame, base::nullopt,
MSG_ROUTING_NONE,
FrameDataParams({ExtensionApiFrameIdMap::kTopFrameId,
ExtensionApiFrameIdMap::kInvalidFrameId,
"http://google.com/xyz", base::nullopt}),
false},
- {"http://google.com/xyz", content::RESOURCE_TYPE_MAIN_FRAME,
+ {"http://google.com/xyz", content::ResourceType::kMainFrame,
base::nullopt, MSG_ROUTING_NONE,
FrameDataParams({ExtensionApiFrameIdMap::kTopFrameId,
ExtensionApiFrameIdMap::kInvalidFrameId,
@@ -473,17 +462,17 @@ TEST_P(RulesetManagerTest, PageAllowingAPI) {
// Non-navigation browser or service worker request. Not allowed,
// since the request doesn't correspond to a frame.
- {"http://google.com/xyz", content::RESOURCE_TYPE_SCRIPT, base::nullopt,
+ {"http://google.com/xyz", content::ResourceType::kScript, base::nullopt,
MSG_ROUTING_NONE, base::nullopt, true},
// Renderer requests - with no |pending_main_frame_url|. Allowed based
// on the |last_committed_main_frame_url|.
- {kAllowedPageURL, content::RESOURCE_TYPE_SCRIPT, "http://google.com",
+ {kAllowedPageURL, content::ResourceType::kScript, "http://google.com",
kDummyFrameRoutingId,
FrameDataParams({kDummyFrameId, kDummyParentFrameId,
"http://google.com/xyz", base::nullopt}),
true},
- {"http://google.com/xyz", content::RESOURCE_TYPE_SCRIPT,
+ {"http://google.com/xyz", content::ResourceType::kScript,
"http://google.com", kDummyFrameRoutingId,
FrameDataParams({kDummyFrameId, kDummyParentFrameId, kAllowedPageURL,
base::nullopt}),
@@ -494,7 +483,7 @@ TEST_P(RulesetManagerTest, PageAllowingAPI) {
// Here we'll determine "http://example.com/xyz" to be the main frame url
// due to the origin.
- {"http://example.com/script.js", content::RESOURCE_TYPE_SCRIPT,
+ {"http://example.com/script.js", content::ResourceType::kScript,
"http://example.com", kDummyFrameRoutingId,
FrameDataParams({ExtensionApiFrameIdMap::kTopFrameId,
ExtensionApiFrameIdMap::kInvalidFrameId,
@@ -503,7 +492,7 @@ TEST_P(RulesetManagerTest, PageAllowingAPI) {
// Here we'll determine |kAllowedPageURL| to be the main
// frame url due to the origin.
- {"http://example.com/script.js", content::RESOURCE_TYPE_SCRIPT,
+ {"http://example.com/script.js", content::ResourceType::kScript,
"http://google.com", kDummyFrameRoutingId,
FrameDataParams({ExtensionApiFrameIdMap::kTopFrameId,
ExtensionApiFrameIdMap::kInvalidFrameId,
@@ -513,19 +502,19 @@ TEST_P(RulesetManagerTest, PageAllowingAPI) {
// In these cases both |pending_main_frame_url| and
// |last_committed_main_frame_url| will be tested since we won't be able
// to determine the correct top level frame url using origin.
- {"http://example.com/script.js", content::RESOURCE_TYPE_SCRIPT,
+ {"http://example.com/script.js", content::ResourceType::kScript,
"http://google.com", kDummyFrameRoutingId,
FrameDataParams({ExtensionApiFrameIdMap::kTopFrameId,
ExtensionApiFrameIdMap::kInvalidFrameId,
"http://google.com/abc", kAllowedPageURL}),
false},
- {"http://example.com/script.js", content::RESOURCE_TYPE_SCRIPT,
+ {"http://example.com/script.js", content::ResourceType::kScript,
base::nullopt, kDummyFrameRoutingId,
FrameDataParams({ExtensionApiFrameIdMap::kTopFrameId,
ExtensionApiFrameIdMap::kInvalidFrameId,
kAllowedPageURL, "http://google.com/abc"}),
false},
- {"http://example.com/script.js", content::RESOURCE_TYPE_SCRIPT,
+ {"http://example.com/script.js", content::ResourceType::kScript,
base::nullopt, kDummyFrameRoutingId,
FrameDataParams({ExtensionApiFrameIdMap::kTopFrameId,
ExtensionApiFrameIdMap::kInvalidFrameId,
@@ -557,14 +546,11 @@ TEST_P(RulesetManagerTest, PageAllowingAPI) {
GURL(*params.pending_main_frame_url);
}
- GURL redirect_url;
- RulesetManager::Action expected_action =
- test_case.expect_blocked_with_allowed_pages
- ? RulesetManager::Action::BLOCK
- : RulesetManager::Action::NONE;
+ Action expected_action = test_case.expect_blocked_with_allowed_pages
+ ? Action(ActionType::BLOCK)
+ : Action(ActionType::NONE);
EXPECT_EQ(expected_action,
- manager->EvaluateRequest(info, false /*is_incognito_context*/,
- &redirect_url));
+ manager->EvaluateRequest(info, false /*is_incognito_context*/));
}
}
@@ -575,7 +561,7 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
// Add an extension which redirects all sub-resource and sub-frame requests
// made to example.com, to foo.com. By default, the "main_frame" type is
// excluded if no "resource_types" are specified.
- std::unique_ptr<RulesetMatcher> redirect_matcher;
+ std::unique_ptr<CompositeMatcher> redirect_matcher;
{
TestRule rule = CreateGenericRule();
rule.id = kMinValidID;
@@ -594,7 +580,7 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
// Add an extension which blocks all sub-resource and sub-frame requests to
// example.com. By default, the "main_frame" type is excluded if no
// "resource_types" are specified. The extension has no host permissions.
- std::unique_ptr<RulesetMatcher> blocking_matcher;
+ std::unique_ptr<CompositeMatcher> blocking_matcher;
{
TestRule rule = CreateGenericRule();
rule.id = kMinValidID;
@@ -608,29 +594,31 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
struct TestCase {
std::string url;
base::Optional<url::Origin> initiator;
- Action expected_action_redirect_extension;
- Action expected_action_blocking_extension;
+ ActionType expected_action_redirect_extension;
+ ActionType expected_action_blocking_extension;
} cases[] = {
// Empty initiator. Has access.
- {"https://example.com", base::nullopt, Action::REDIRECT, Action::BLOCK},
+ {"https://example.com", base::nullopt, ActionType::REDIRECT,
+ ActionType::BLOCK},
// Opaque origin as initiator. Has access.
- {"https://example.com", url::Origin(), Action::REDIRECT, Action::BLOCK},
+ {"https://example.com", url::Origin(), ActionType::REDIRECT,
+ ActionType::BLOCK},
// yahoo.com as initiator. Has access.
{"https://example.com", url::Origin::Create(GURL("http://yahoo.com")),
- Action::REDIRECT, Action::BLOCK},
+ ActionType::REDIRECT, ActionType::BLOCK},
// No matching rule.
{"https://yahoo.com", url::Origin::Create(GURL("http://example.com")),
- Action::NONE, Action::NONE},
+ ActionType::NONE, ActionType::NONE},
// Doesn't have access to initiator. But blocking a request doesn't
// require host permissions.
{"https://example.com", url::Origin::Create(GURL("http://google.com")),
- Action::NONE, Action::BLOCK},
+ ActionType::NONE, ActionType::BLOCK},
};
auto verify_test_case = [this, manager](
const std::string& url,
const base::Optional<url::Origin>& initiator,
- Action expected_action, GURL* redirect_url) {
+ const Action& expected_action) {
SCOPED_TRACE(base::StringPrintf(
"Url-%s initiator-%s", url.c_str(),
initiator ? initiator->Serialize().c_str() : "empty"));
@@ -639,9 +627,8 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
request.initiator = initiator;
bool is_incognito_context = false;
- EXPECT_EQ(
- expected_action,
- manager->EvaluateRequest(request, is_incognito_context, redirect_url));
+ EXPECT_EQ(expected_action,
+ manager->EvaluateRequest(request, is_incognito_context));
};
// Test redirect extension.
@@ -650,11 +637,11 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
manager->AddRuleset(redirect_extension_id, std::move(redirect_matcher),
URLPatternSet());
for (const auto& test : cases) {
- GURL redirect_url;
- verify_test_case(test.url, test.initiator,
- test.expected_action_redirect_extension, &redirect_url);
- if (test.expected_action_redirect_extension == Action::REDIRECT)
- EXPECT_EQ("https://foo.com/", redirect_url.spec());
+ Action expected_action(test.expected_action_redirect_extension);
+ if (test.expected_action_redirect_extension == ActionType::REDIRECT)
+ expected_action.redirect_url = GURL("https://foo.com/");
+
+ verify_test_case(test.url, test.initiator, expected_action);
}
manager->RemoveRuleset(redirect_extension_id);
}
@@ -665,9 +652,8 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
manager->AddRuleset(blocking_extension_id, std::move(blocking_matcher),
URLPatternSet());
for (const auto& test : cases) {
- GURL redirect_url;
verify_test_case(test.url, test.initiator,
- test.expected_action_blocking_extension, &redirect_url);
+ Action(test.expected_action_blocking_extension));
}
manager->RemoveRuleset(blocking_extension_id);
}
diff --git a/chromium/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc b/chromium/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
index 4bb494bca82..7cf3c6be1f2 100644
--- a/chromium/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
@@ -54,7 +54,7 @@ WebRequestInfo CreateRequest(const GURL& url) {
WebRequestInfo info;
info.url = url;
info.is_browser_side_navigation = true;
- info.type = content::RESOURCE_TYPE_MAIN_FRAME;
+ info.type = content::ResourceType::kMainFrame;
info.web_request_type = WebRequestResourceType::MAIN_FRAME;
return info;
}
diff --git a/chromium/chrome/browser/extensions/api/desktop_capture/OWNERS b/chromium/chrome/browser/extensions/api/desktop_capture/OWNERS
index 62e34f14d33..ba9bb80c060 100644
--- a/chromium/chrome/browser/extensions/api/desktop_capture/OWNERS
+++ b/chromium/chrome/browser/extensions/api/desktop_capture/OWNERS
@@ -3,5 +3,5 @@ sergeyu@chromium.org
wez@chromium.org
braveyao@chromium.org
-# TEAM: media-capture-and-streams@grotations.appspotmail.com
+# TEAM: webrtc-dev@chromium.org
# COMPONENT: Blink>GetUserMedia>Desktop
diff --git a/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc b/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc
index 52de951fa7f..13b8da3d41e 100644
--- a/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc
+++ b/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc
@@ -9,7 +9,6 @@
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
-#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/origin_util.h"
@@ -42,8 +41,8 @@ bool DesktopCaptureChooseDesktopMediaFunction::RunAsync() {
EXTENSION_FUNCTION_VALIDATE(args_->GetSize() > 0);
EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &request_id_));
- DesktopCaptureRequestsRegistry::GetInstance()->AddRequest(
- render_frame_host()->GetProcess()->GetID(), request_id_, this);
+ DesktopCaptureRequestsRegistry::GetInstance()->AddRequest(source_process_id(),
+ request_id_, this);
args_->Remove(0, NULL);
diff --git a/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc b/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
index 088fc86f00d..07369df425c 100644
--- a/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
+++ b/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
@@ -57,11 +57,8 @@ DesktopCaptureChooseDesktopMediaFunctionBase::
DesktopCaptureChooseDesktopMediaFunctionBase::
~DesktopCaptureChooseDesktopMediaFunctionBase() {
- // RenderFrameHost may be already destroyed.
- if (render_frame_host()) {
- DesktopCaptureRequestsRegistry::GetInstance()->RemoveRequest(
- render_frame_host()->GetProcess()->GetID(), request_id_);
- }
+ DesktopCaptureRequestsRegistry::GetInstance()->RemoveRequest(
+ source_process_id(), request_id_);
}
void DesktopCaptureChooseDesktopMediaFunctionBase::Cancel() {
@@ -112,10 +109,6 @@ bool DesktopCaptureChooseDesktopMediaFunctionBase::Execute(
break;
}
case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_TAB: {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- extensions::switches::kDisableTabForDesktopShare)) {
- continue;
- }
media_types.push_back(content::DesktopMediaID::TYPE_WEB_CONTENTS);
break;
}
@@ -155,7 +148,6 @@ bool DesktopCaptureChooseDesktopMediaFunctionBase::Execute(
picker_params.app_name = base::UTF8ToUTF16(GetCallerDisplayName());
picker_params.target_name = target_name;
picker_params.request_audio = request_audio;
- picker_params.created_by_extension = true;
picker_->Show(picker_params, std::move(source_lists), callback);
origin_ = origin;
return true;
@@ -218,7 +210,7 @@ DesktopCaptureCancelChooseDesktopMediaFunctionBase::Run() {
EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &request_id));
DesktopCaptureRequestsRegistry::GetInstance()->CancelRequest(
- render_frame_host()->GetProcess()->GetID(), request_id);
+ source_process_id(), request_id);
return RespondNow(NoArguments());
}
diff --git a/chromium/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chromium/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index a64389d9ab3..99e44945f48 100644
--- a/chromium/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -59,7 +59,6 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/render_process_host.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
@@ -226,26 +225,6 @@ void PerformVerificationCheck(content::BrowserContext* context) {
InstallVerifier::Get(context)->VerifyAllExtensions();
}
-std::unique_ptr<developer::ProfileInfo> CreateProfileInfo(Profile* profile) {
- std::unique_ptr<developer::ProfileInfo> info(new developer::ProfileInfo());
- info->is_supervised = profile->IsSupervised();
- PrefService* prefs = profile->GetPrefs();
- const PrefService::Preference* pref =
- prefs->FindPreference(prefs::kExtensionsUIDeveloperMode);
- info->is_incognito_available =
- IncognitoModePrefs::GetAvailability(prefs) !=
- IncognitoModePrefs::DISABLED;
- info->is_developer_mode_controlled_by_policy = pref->IsManaged();
- info->in_developer_mode =
- !info->is_supervised &&
- prefs->GetBoolean(prefs::kExtensionsUIDeveloperMode);
- info->app_info_dialog_enabled = CanShowAppInfoDialog();
- info->can_load_unpacked =
- !ExtensionManagementFactory::GetForBrowserContext(profile)
- ->BlacklistedByDefault();
- return info;
-}
-
// Creates a developer::LoadError from the provided data.
developer::LoadError CreateLoadError(
const base::FilePath& file_path,
@@ -331,6 +310,27 @@ DeveloperPrivateAPI::GetFactoryInstance() {
return g_developer_private_api_factory.Pointer();
}
+// static
+std::unique_ptr<developer::ProfileInfo> DeveloperPrivateAPI::CreateProfileInfo(
+ Profile* profile) {
+ std::unique_ptr<developer::ProfileInfo> info(new developer::ProfileInfo());
+ info->is_supervised = profile->IsSupervised();
+ PrefService* prefs = profile->GetPrefs();
+ const PrefService::Preference* pref =
+ prefs->FindPreference(prefs::kExtensionsUIDeveloperMode);
+ info->is_incognito_available = IncognitoModePrefs::GetAvailability(prefs) !=
+ IncognitoModePrefs::DISABLED;
+ info->is_developer_mode_controlled_by_policy = pref->IsManaged();
+ info->in_developer_mode =
+ !info->is_supervised &&
+ prefs->GetBoolean(prefs::kExtensionsUIDeveloperMode);
+ info->app_info_dialog_enabled = CanShowAppInfoDialog();
+ info->can_load_unpacked =
+ ExtensionManagementFactory::GetForBrowserContext(profile)
+ ->HasWhitelistedExtension();
+ return info;
+}
+
template <>
void BrowserContextKeyedAPIFactory<
DeveloperPrivateAPI>::DeclareFactoryDependencies() {
@@ -502,7 +502,8 @@ void DeveloperPrivateEventRouter::OnExtensionRuntimePermissionsChanged(
void DeveloperPrivateEventRouter::OnExtensionManagementSettingsChanged() {
std::unique_ptr<base::ListValue> args(new base::ListValue());
- args->Append(CreateProfileInfo(profile_)->ToValue());
+ args->Append(DeveloperPrivateAPI::CreateProfileInfo(profile_)->ToValue());
+
std::unique_ptr<Event> event(
new Event(events::DEVELOPER_PRIVATE_ON_PROFILE_STATE_CHANGED,
developer::OnProfileStateChanged::kEventName, std::move(args)));
@@ -529,7 +530,7 @@ void DeveloperPrivateEventRouter::Observe(
void DeveloperPrivateEventRouter::OnProfilePrefChanged() {
std::unique_ptr<base::ListValue> args(new base::ListValue());
- args->Append(CreateProfileInfo(profile_)->ToValue());
+ args->Append(DeveloperPrivateAPI::CreateProfileInfo(profile_)->ToValue());
std::unique_ptr<Event> event(
new Event(events::DEVELOPER_PRIVATE_ON_PROFILE_STATE_CHANGED,
developer::OnProfileStateChanged::kEventName, std::move(args)));
@@ -852,7 +853,8 @@ DeveloperPrivateGetProfileConfigurationFunction::
ExtensionFunction::ResponseAction
DeveloperPrivateGetProfileConfigurationFunction::Run() {
std::unique_ptr<developer::ProfileInfo> info =
- CreateProfileInfo(Profile::FromBrowserContext(browser_context()));
+ DeveloperPrivateAPI::CreateProfileInfo(
+ Profile::FromBrowserContext(browser_context()));
// If this is called from the chrome://extensions page, we use this as a
// heuristic that it's a good time to verify installs. We do this on startup,
@@ -1414,11 +1416,10 @@ bool DeveloperPrivateLoadDirectoryFunction::RunAsync() {
}
return LoadByFileSystemAPI(directory_url);
} else {
- // Check if the DirecotryEntry is the instance of chrome filesystem.
+ // Check if the DirectoryEntry is the instance of chrome filesystem.
if (!app_file_handler_util::ValidateFileEntryAndGetPath(
- filesystem_name, filesystem_path,
- render_frame_host()->GetProcess()->GetID(), &project_base_path_,
- &error_)) {
+ filesystem_name, filesystem_path, source_process_id(),
+ &project_base_path_, &error_)) {
SetError("DirectoryEntry of unsupported filesystem.");
return false;
}
diff --git a/chromium/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chromium/chrome/browser/extensions/api/developer_private/developer_private_api.h
index 773ddf68901..9785abc3336 100644
--- a/chromium/chrome/browser/extensions/api/developer_private/developer_private_api.h
+++ b/chromium/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -50,6 +50,12 @@ class ProcessManager;
namespace api {
+namespace developer_private {
+
+struct ProfileInfo;
+
+}
+
class EntryPickerClient;
} // namespace api
@@ -183,6 +189,9 @@ class DeveloperPrivateAPI : public BrowserContextKeyedAPI,
static BrowserContextKeyedAPIFactory<DeveloperPrivateAPI>*
GetFactoryInstance();
+ static std::unique_ptr<api::developer_private::ProfileInfo> CreateProfileInfo(
+ Profile* profile);
+
// Convenience method to get the DeveloperPrivateAPI for a profile.
static DeveloperPrivateAPI* Get(content::BrowserContext* context);
diff --git a/chromium/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc b/chromium/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
index 680e055e42e..b3d60b9ec88 100644
--- a/chromium/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
@@ -13,7 +13,6 @@
#include "base/scoped_observer.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
-#include "base/test/scoped_feature_list.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/extensions/error_console/error_console.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
@@ -52,7 +51,6 @@
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
-#include "extensions/common/extension_features.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/permissions/permission_set.h"
@@ -388,9 +386,6 @@ void DeveloperPrivateApiUnitTest::TearDown() {
// Test developerPrivate.updateExtensionConfiguration.
TEST_F(DeveloperPrivateApiUnitTest,
DeveloperPrivateUpdateExtensionConfiguration) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
// Sadly, we need a "real" directory here, because toggling prefs causes
// a reload (which needs a path).
const Extension* extension = LoadUnpackedExtension();
@@ -694,7 +689,7 @@ TEST_F(DeveloperPrivateApiUnitTest, LoadUnpackedRetryId) {
// Trying to reload the same extension, again to fail, should result in the
// same retry id. This is somewhat an implementation detail, but is
// important to ensure we don't allocate crazy numbers of ids if the user
- // just retries continously.
+ // just retries continuously.
scoped_refptr<UIThreadExtensionFunction> function(
new api::DeveloperPrivateLoadUnpackedFunction());
function->SetRenderFrameHost(web_contents->GetMainFrame());
@@ -1250,6 +1245,14 @@ TEST_F(DeveloperPrivateApiUnitTest, LoadUnpackedFailsWithBlacklistingPolicy) {
ExtensionManagementFactory::GetForBrowserContext(browser_context())
->BlacklistedByDefault());
+ EXPECT_FALSE(
+ ExtensionManagementFactory::GetForBrowserContext(browser_context())
+ ->HasWhitelistedExtension());
+
+ auto info = DeveloperPrivateAPI::CreateProfileInfo(testing_profile());
+
+ EXPECT_FALSE(info->can_load_unpacked);
+
scoped_refptr<UIThreadExtensionFunction> function =
base::MakeRefCounted<api::DeveloperPrivateLoadUnpackedFunction>();
function->SetRenderFrameHost(web_contents->GetMainFrame());
@@ -1258,6 +1261,34 @@ TEST_F(DeveloperPrivateApiUnitTest, LoadUnpackedFailsWithBlacklistingPolicy) {
EXPECT_THAT(error, testing::HasSubstr("policy"));
}
+TEST_F(DeveloperPrivateApiUnitTest,
+ LoadUnpackedWorksWithBlacklistingPolicyAlongWhitelistingPolicy) {
+ std::unique_ptr<content::WebContents> web_contents(
+ content::WebContentsTester::CreateTestWebContents(profile(), nullptr));
+
+ base::FilePath path = data_dir().AppendASCII("simple_with_popup");
+ api::EntryPicker::SkipPickerAndAlwaysSelectPathForTest(&path);
+
+ {
+ ExtensionManagementPrefUpdater<sync_preferences::TestingPrefServiceSyncable>
+ pref_updater(testing_profile()->GetTestingPrefService());
+ pref_updater.SetBlacklistedByDefault(true);
+ pref_updater.SetIndividualExtensionInstallationAllowed(kGoodCrx, true);
+ }
+
+ EXPECT_TRUE(
+ ExtensionManagementFactory::GetForBrowserContext(browser_context())
+ ->BlacklistedByDefault());
+
+ EXPECT_TRUE(
+ ExtensionManagementFactory::GetForBrowserContext(browser_context())
+ ->HasWhitelistedExtension());
+
+ auto info = DeveloperPrivateAPI::CreateProfileInfo(testing_profile());
+
+ EXPECT_TRUE(info->can_load_unpacked);
+}
+
TEST_F(DeveloperPrivateApiUnitTest, InstallDroppedFileNoDraggedPath) {
extensions::ExtensionInstallUI::set_disable_ui_for_tests();
ScopedTestDialogAutoConfirm auto_confirm(ScopedTestDialogAutoConfirm::ACCEPT);
@@ -1327,10 +1358,6 @@ TEST_F(DeveloperPrivateApiUnitTest, InstallDroppedFileUserScript) {
}
TEST_F(DeveloperPrivateApiUnitTest, GrantHostPermission) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
ExtensionBuilder("test").AddPermission("<all_urls>").Build();
service()->AddExtension(extension.get());
@@ -1387,10 +1414,6 @@ TEST_F(DeveloperPrivateApiUnitTest, GrantHostPermission) {
}
TEST_F(DeveloperPrivateApiUnitTest, RemoveHostPermission) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
ExtensionBuilder("test").AddPermission("<all_urls>").Build();
service()->AddExtension(extension.get());
@@ -1462,10 +1485,6 @@ TEST_F(DeveloperPrivateApiUnitTest, RemoveHostPermission) {
#define MAYBE_UpdateHostAccess UpdateHostAccess
#endif
TEST_F(DeveloperPrivateApiUnitTest, MAYBE_UpdateHostAccess) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
ExtensionBuilder("test").AddPermission("<all_urls>").Build();
service()->AddExtension(extension.get());
@@ -1485,10 +1504,6 @@ TEST_F(DeveloperPrivateApiUnitTest, MAYBE_UpdateHostAccess) {
TEST_F(DeveloperPrivateApiUnitTest,
UpdateHostAccess_SpecificSitesRemovedOnTransitionToOnClick) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
ExtensionBuilder("test").AddPermission("<all_urls>").Build();
service()->AddExtension(extension.get());
@@ -1529,10 +1544,6 @@ TEST_F(DeveloperPrivateApiUnitTest,
TEST_F(DeveloperPrivateApiUnitTest,
UpdateHostAccess_SpecificSitesRemovedOnTransitionToAllSites) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
ExtensionBuilder("test").AddPermission("<all_urls>").Build();
service()->AddExtension(extension.get());
@@ -1556,10 +1567,6 @@ TEST_F(DeveloperPrivateApiUnitTest,
TEST_F(DeveloperPrivateApiUnitTest,
UpdateHostAccess_GrantScopeGreaterThanRequestedScope) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
ExtensionBuilder("test").AddPermission("http://*/*").Build();
service()->AddExtension(extension.get());
@@ -1622,10 +1629,6 @@ TEST_F(DeveloperPrivateApiUnitTest,
TEST_F(DeveloperPrivateApiUnitTest,
UpdateHostAccess_UnrequestedHostsDispatchUpdateEvents) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
ExtensionBuilder("test").AddPermission("http://google.com/*").Build();
service()->AddExtension(extension.get());
diff --git a/chromium/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc b/chromium/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
index ddbb015aa23..0761394d958 100644
--- a/chromium/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
@@ -17,7 +17,6 @@
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/developer_private/inspectable_views_finder.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
@@ -36,7 +35,6 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
-#include "extensions/common/extension_features.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/permissions/permission_message.h"
#include "extensions/common/permissions/permission_set.h"
@@ -236,10 +234,6 @@ TEST_F(ExtensionInfoGeneratorUnitTest, BasicInfoTest) {
// Enable error console for testing.
FeatureSwitch::ScopedOverride error_console_override(
FeatureSwitch::error_console(), true);
- // Disable runtime host permissions - they are tested extensively below.
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndDisableFeature(
- extensions_features::kRuntimeHostPermissions);
profile()->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true);
const char kName[] = "extension name";
@@ -307,6 +301,22 @@ TEST_F(ExtensionInfoGeneratorUnitTest, BasicInfoTest) {
EXPECT_FALSE(info->incognito_access.is_active);
PermissionMessages messages =
extension->permissions_data()->GetPermissionMessages();
+
+ // Strip out the kHostReadWrite permission created by the extension requesting
+ // host permissions above; runtime host permissions mean these are always
+ // present but not necessarily operative. There should only be one entry,
+ // though. This is necessary because the code below wants to assert that every
+ // entry in |messages| has a matching entry in
+ // |info->permissions.simple_permissions|, and kHostReadWrite is not a simple
+ // permission.
+ for (auto it = messages.begin(); it != messages.end(); ++it) {
+ if (it->permissions().ContainsID(
+ extensions::APIPermission::kHostReadWrite)) {
+ messages.erase(it);
+ break;
+ }
+ }
+
ASSERT_EQ(messages.size(), info->permissions.simple_permissions.size());
size_t i = 0;
for (const PermissionMessage& message : messages) {
@@ -321,7 +331,7 @@ TEST_F(ExtensionInfoGeneratorUnitTest, BasicInfoTest) {
}
++i;
}
- EXPECT_FALSE(info->permissions.runtime_host_permissions);
+ EXPECT_TRUE(info->permissions.runtime_host_permissions);
ASSERT_EQ(2u, info->runtime_errors.size());
const api::developer_private::RuntimeError& runtime_error =
@@ -422,11 +432,6 @@ TEST_F(ExtensionInfoGeneratorUnitTest, GenerateExtensionsJSONData) {
// Tests the generation of the runtime host permissions entries.
TEST_F(ExtensionInfoGeneratorUnitTest, RuntimeHostPermissions) {
- // Start with the switch enabled.
- auto scoped_feature_list = std::make_unique<base::test::ScopedFeatureList>();
- scoped_feature_list->InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> all_urls_extension = CreateExtension(
"all_urls", ListBuilder().Append(kAllHostsPermission).Build(),
Manifest::INTERNAL);
@@ -481,33 +486,11 @@ TEST_F(ExtensionInfoGeneratorUnitTest, RuntimeHostPermissions) {
EXPECT_FALSE(info->permissions.runtime_host_permissions);
}
-TEST_F(ExtensionInfoGeneratorUnitTest, RuntimeHostPermissionsWithoutFeature) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndDisableFeature(
- extensions_features::kRuntimeHostPermissions);
-
- // Without the runtime host permissions feature enabled, the runtime host
- // permissions entry should always be empty.
- scoped_refptr<const Extension> all_urls_extension = CreateExtension(
- "all_urls", ListBuilder().Append(kAllHostsPermission).Build(),
- Manifest::INTERNAL);
- std::unique_ptr<developer::ExtensionInfo> info =
- GenerateExtensionInfo(all_urls_extension->id());
- EXPECT_FALSE(info->permissions.runtime_host_permissions);
- ASSERT_EQ(1u, info->permissions.simple_permissions.size());
- EXPECT_EQ("Read and change all your data on the websites you visit",
- info->permissions.simple_permissions[0].message);
-}
-
// Tests that specific_site_controls is correctly populated when permissions
// are granted by the user beyond what the extension originally requested in the
// manifest.
TEST_F(ExtensionInfoGeneratorUnitTest,
RuntimeHostPermissionsBeyondRequestedScope) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
CreateExtension("extension", ListBuilder().Append("http://*/*").Build(),
Manifest::INTERNAL);
@@ -552,10 +535,6 @@ TEST_F(ExtensionInfoGeneratorUnitTest,
// Tests that specific_site_controls is correctly populated when the extension
// requests access to specific hosts.
TEST_F(ExtensionInfoGeneratorUnitTest, RuntimeHostPermissionsSpecificHosts) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
CreateExtension("extension",
ListBuilder()
@@ -596,10 +575,6 @@ TEST_F(ExtensionInfoGeneratorUnitTest, RuntimeHostPermissionsSpecificHosts) {
// Tests the population of withheld runtime hosts when they overlap with granted
// patterns.
TEST_F(ExtensionInfoGeneratorUnitTest, WithheldUrlsOverlapping) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
CreateExtension("extension",
ListBuilder()
@@ -708,10 +683,6 @@ TEST_F(ExtensionInfoGeneratorUnitTest, WithheldUrlsOverlapping) {
// patterns.
TEST_F(ExtensionInfoGeneratorUnitTest,
WithheldUrlsOverlappingWithContentScript) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
scoped_refptr<const Extension> extension =
ExtensionBuilder("extension")
.AddPermissions({"*://example.com/*", "*://chromium.org/*"})
diff --git a/chromium/chrome/browser/extensions/api/device_permissions_manager_unittest.cc b/chromium/chrome/browser/extensions/api/device_permissions_manager_unittest.cc
index 1beb2238405..b8555d62fad 100644
--- a/chromium/chrome/browser/extensions/api/device_permissions_manager_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/device_permissions_manager_unittest.cc
@@ -12,13 +12,14 @@
#include "base/test/values_test_util.h"
#include "chrome/browser/extensions/test_extension_environment.h"
#include "chrome/test/base/testing_profile.h"
-#include "device/base/mock_device_client.h"
-#include "device/usb/public/cpp/fake_usb_device_info.h"
+#include "device/usb/public/cpp/fake_usb_device_manager.h"
#include "device/usb/public/mojom/device.mojom.h"
#include "extensions/browser/api/device_permissions_manager.h"
#include "extensions/browser/api/hid/hid_device_manager.h"
+#include "extensions/browser/api/usb/usb_device_manager.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/common/extension.h"
+#include "services/device/public/cpp/hid/fake_hid_manager.h"
#include "services/device/public/mojom/hid.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -28,26 +29,12 @@ namespace extensions {
namespace {
using device::FakeUsbDeviceInfo;
+using device::mojom::HidBusType;
using testing::_;
using testing::DoAll;
using testing::Return;
using testing::SetArgPointee;
-const char* kTestDeviceGuids[] = {"A", "B", "C", "D"};
-
-class FakeHidDeviceManager : public HidDeviceManager {
- public:
- explicit FakeHidDeviceManager(content::BrowserContext* context)
- : HidDeviceManager(context) {}
-
- void LazyInitialize() override {}
-};
-
-std::unique_ptr<KeyedService> CreateHidDeviceManager(
- content::BrowserContext* context) {
- return std::make_unique<FakeHidDeviceManager>(context);
-}
-
} // namespace
class DevicePermissionsManagerTest : public testing::Test {
@@ -65,51 +52,49 @@ class DevicePermissionsManagerTest : public testing::Test {
" \"permissions\": [ \"hid\", \"usb\" ]"
"}"));
- HidDeviceManager::GetFactoryInstance()->SetTestingFactory(
- env_->profile(), base::BindRepeating(&CreateHidDeviceManager));
- device0_ = base::MakeRefCounted<FakeUsbDeviceInfo>(
- 0, 0, "Test Manufacturer", "Test Product", "ABCDE");
- device1_ = base::MakeRefCounted<FakeUsbDeviceInfo>(
- 0, 0, "Test Manufacturer", "Test Product", "");
- device2_ = base::MakeRefCounted<FakeUsbDeviceInfo>(
- 0, 0, "Test Manufacturer", "Test Product", "12345");
- device3_ = base::MakeRefCounted<FakeUsbDeviceInfo>(
- 0, 0, "Test Manufacturer", "Test Product", "");
-
- device4_ = device::mojom::HidDeviceInfo::New();
- device4_->guid = kTestDeviceGuids[0];
- device4_->product_name = "Test HID Device";
- device4_->serial_number = "abcde";
- device4_->bus_type = device::mojom::HidBusType::kHIDBusTypeUSB;
-
- device5_ = device::mojom::HidDeviceInfo::New();
- device5_->guid = kTestDeviceGuids[1];
- device5_->product_name = "Test HID Device";
- device5_->serial_number = "";
- device5_->bus_type = device::mojom::HidBusType::kHIDBusTypeUSB;
-
- device6_ = device::mojom::HidDeviceInfo::New();
- device6_->guid = kTestDeviceGuids[2];
- device6_->product_name = "Test HID Device";
- device6_->serial_number = "67890";
- device6_->bus_type = device::mojom::HidBusType::kHIDBusTypeUSB;
-
- device7_ = device::mojom::HidDeviceInfo::New();
- device7_->guid = kTestDeviceGuids[3];
- device7_->product_name = "Test HID Device";
- device7_->serial_number = "";
- device7_->bus_type = device::mojom::HidBusType::kHIDBusTypeUSB;
+ // Set fake device manager for extensions::UsbDeviceManager.
+ device::mojom::UsbDeviceManagerPtr usb_manager_ptr;
+ fake_usb_manager_.AddBinding(mojo::MakeRequest(&usb_manager_ptr));
+ UsbDeviceManager::Get(env_->profile())
+ ->SetDeviceManagerForTesting(std::move(usb_manager_ptr));
+ base::RunLoop().RunUntilIdle();
+
+ device0_ = fake_usb_manager_.CreateAndAddDevice(0, 0, "Test Manufacturer",
+ "Test Product", "ABCDE");
+ device1_ = fake_usb_manager_.CreateAndAddDevice(0, 0, "Test Manufacturer",
+ "Test Product", "");
+ device2_ = fake_usb_manager_.CreateAndAddDevice(0, 0, "Test Manufacturer",
+ "Test Product", "12345");
+ device3_ = fake_usb_manager_.CreateAndAddDevice(0, 0, "Test Manufacturer",
+ "Test Product", "");
+
+ device::mojom::HidManagerPtr hid_manager_ptr;
+ fake_hid_manager_.Bind(mojo::MakeRequest(&hid_manager_ptr));
+ HidDeviceManager::Get(env_->profile())
+ ->SetFakeHidManagerForTesting(std::move(hid_manager_ptr));
+ base::RunLoop().RunUntilIdle();
+
+ device4_ = fake_hid_manager_.CreateAndAddDevice("Test HID Device", "abcde",
+ HidBusType::kHIDBusTypeUSB);
+ device5_ = fake_hid_manager_.CreateAndAddDevice("Test HID Device", "",
+ HidBusType::kHIDBusTypeUSB);
+ device6_ = fake_hid_manager_.CreateAndAddDevice("Test HID Device", "67890",
+ HidBusType::kHIDBusTypeUSB);
+ device7_ = fake_hid_manager_.CreateAndAddDevice("Test HID Device", "",
+ HidBusType::kHIDBusTypeUSB);
}
void TearDown() override { env_.reset(nullptr); }
std::unique_ptr<extensions::TestExtensionEnvironment> env_;
const extensions::Extension* extension_;
- device::MockDeviceClient device_client_;
- scoped_refptr<device::FakeUsbDeviceInfo> device0_;
- scoped_refptr<device::FakeUsbDeviceInfo> device1_;
- scoped_refptr<device::FakeUsbDeviceInfo> device2_;
- scoped_refptr<device::FakeUsbDeviceInfo> device3_;
+ device::FakeUsbDeviceManager fake_usb_manager_;
+ device::mojom::UsbDeviceInfoPtr device0_;
+ device::mojom::UsbDeviceInfoPtr device1_;
+ device::mojom::UsbDeviceInfoPtr device2_;
+ device::mojom::UsbDeviceInfoPtr device3_;
+
+ device::FakeHidManager fake_hid_manager_;
device::mojom::HidDeviceInfoPtr device4_;
device::mojom::HidDeviceInfoPtr device5_;
device::mojom::HidDeviceInfoPtr device6_;
@@ -119,23 +104,21 @@ class DevicePermissionsManagerTest : public testing::Test {
TEST_F(DevicePermissionsManagerTest, AllowAndClearDevices) {
DevicePermissionsManager* manager =
DevicePermissionsManager::Get(env_->profile());
- manager->AllowUsbDevice(extension_->id(), device0_->GetDeviceInfo());
- manager->AllowUsbDevice(extension_->id(), device1_->GetDeviceInfo());
+ manager->AllowUsbDevice(extension_->id(), *device0_);
+ manager->AllowUsbDevice(extension_->id(), *device1_);
manager->AllowHidDevice(extension_->id(), *device4_);
manager->AllowHidDevice(extension_->id(), *device5_);
DevicePermissions* device_permissions =
manager->GetForExtension(extension_->id());
scoped_refptr<DevicePermissionEntry> device0_entry =
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo());
+ device_permissions->FindUsbDeviceEntry(*device0_);
ASSERT_TRUE(device0_entry);
scoped_refptr<DevicePermissionEntry> device1_entry =
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo());
+ device_permissions->FindUsbDeviceEntry(*device1_);
ASSERT_TRUE(device1_entry);
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device2_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device3_->GetDeviceInfo()));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device2_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device3_));
scoped_refptr<DevicePermissionEntry> device4_entry =
device_permissions->FindHidDeviceEntry(*device4_);
ASSERT_TRUE(device4_entry);
@@ -160,14 +143,10 @@ TEST_F(DevicePermissionsManagerTest, AllowAndClearDevices) {
// The device_permissions object is deleted by Clear.
device_permissions = manager->GetForExtension(extension_->id());
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device2_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device3_->GetDeviceInfo()));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device0_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device1_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device2_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device3_));
EXPECT_FALSE(device_permissions->FindHidDeviceEntry(*device4_));
EXPECT_FALSE(device_permissions->FindHidDeviceEntry(*device5_));
EXPECT_FALSE(device_permissions->FindHidDeviceEntry(*device6_));
@@ -175,19 +154,15 @@ TEST_F(DevicePermissionsManagerTest, AllowAndClearDevices) {
EXPECT_EQ(0U, device_permissions->entries().size());
// After clearing device it should be possible to grant permission again.
- manager->AllowUsbDevice(extension_->id(), device0_->GetDeviceInfo());
- manager->AllowUsbDevice(extension_->id(), device1_->GetDeviceInfo());
+ manager->AllowUsbDevice(extension_->id(), *device0_);
+ manager->AllowUsbDevice(extension_->id(), *device1_);
manager->AllowHidDevice(extension_->id(), *device4_);
manager->AllowHidDevice(extension_->id(), *device5_);
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo()));
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device2_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device3_->GetDeviceInfo()));
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device0_));
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device1_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device2_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device3_));
EXPECT_TRUE(device_permissions->FindHidDeviceEntry(*device4_));
EXPECT_TRUE(device_permissions->FindHidDeviceEntry(*device5_));
EXPECT_FALSE(device_permissions->FindHidDeviceEntry(*device6_));
@@ -197,51 +172,39 @@ TEST_F(DevicePermissionsManagerTest, AllowAndClearDevices) {
TEST_F(DevicePermissionsManagerTest, DisconnectDevice) {
DevicePermissionsManager* manager =
DevicePermissionsManager::Get(env_->profile());
- manager->AllowUsbDevice(extension_->id(), device0_->GetDeviceInfo());
- manager->AllowUsbDevice(extension_->id(), device1_->GetDeviceInfo());
+ manager->AllowUsbDevice(extension_->id(), *device0_);
+ manager->AllowUsbDevice(extension_->id(), *device1_);
manager->AllowHidDevice(extension_->id(), *device4_);
manager->AllowHidDevice(extension_->id(), *device5_);
DevicePermissions* device_permissions =
manager->GetForExtension(extension_->id());
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo()));
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device2_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device3_->GetDeviceInfo()));
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device0_));
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device1_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device2_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device3_));
EXPECT_TRUE(device_permissions->FindHidDeviceEntry(*device4_));
EXPECT_TRUE(device_permissions->FindHidDeviceEntry(*device5_));
EXPECT_FALSE(device_permissions->FindHidDeviceEntry(*device6_));
EXPECT_FALSE(device_permissions->FindHidDeviceEntry(*device7_));
- // TODO(donna.wu@intel.com): Remove the device entry through the observer
- // interface on UsbDeviceManager, so it can test the real disconnect path.
- manager->RemoveEntryByDeviceGUID(DevicePermissionEntry::Type::USB,
- device0_->guid());
- manager->RemoveEntryByDeviceGUID(DevicePermissionEntry::Type::USB,
- device1_->guid());
+ fake_usb_manager_.RemoveDevice(device0_->guid);
+ fake_usb_manager_.RemoveDevice(device1_->guid);
+
+ fake_hid_manager_.RemoveDevice(device4_->guid);
+ fake_hid_manager_.RemoveDevice(device5_->guid);
- manager->RemoveEntryByDeviceGUID(DevicePermissionEntry::Type::HID,
- device4_->guid);
- manager->RemoveEntryByDeviceGUID(DevicePermissionEntry::Type::HID,
- device5_->guid);
+ base::RunLoop().RunUntilIdle();
// Device 0 will be accessible when it is reconnected because it can be
// recognized by its serial number.
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo()));
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device0_));
// Device 1 does not have a serial number and cannot be distinguished from
// any other device of the same model so the app must request permission again
// when it is reconnected.
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device2_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device3_->GetDeviceInfo()));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device1_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device2_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device3_));
// Device 4 is like device 0, but HID.
EXPECT_TRUE(device_permissions->FindHidDeviceEntry(*device4_));
// Device 5 is like device 1, but HID.
@@ -253,18 +216,18 @@ TEST_F(DevicePermissionsManagerTest, DisconnectDevice) {
TEST_F(DevicePermissionsManagerTest, RevokeAndRegrantAccess) {
DevicePermissionsManager* manager =
DevicePermissionsManager::Get(env_->profile());
- manager->AllowUsbDevice(extension_->id(), device0_->GetDeviceInfo());
- manager->AllowUsbDevice(extension_->id(), device1_->GetDeviceInfo());
+ manager->AllowUsbDevice(extension_->id(), *device0_);
+ manager->AllowUsbDevice(extension_->id(), *device1_);
manager->AllowHidDevice(extension_->id(), *device4_);
manager->AllowHidDevice(extension_->id(), *device5_);
DevicePermissions* device_permissions =
manager->GetForExtension(extension_->id());
scoped_refptr<DevicePermissionEntry> device0_entry =
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo());
+ device_permissions->FindUsbDeviceEntry(*device0_);
ASSERT_TRUE(device0_entry);
scoped_refptr<DevicePermissionEntry> device1_entry =
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo());
+ device_permissions->FindUsbDeviceEntry(*device1_);
ASSERT_TRUE(device1_entry);
scoped_refptr<DevicePermissionEntry> device4_entry =
device_permissions->FindHidDeviceEntry(*device4_);
@@ -274,28 +237,20 @@ TEST_F(DevicePermissionsManagerTest, RevokeAndRegrantAccess) {
ASSERT_TRUE(device5_entry);
manager->RemoveEntry(extension_->id(), device0_entry);
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo()));
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo()));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device0_));
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device1_));
- manager->AllowUsbDevice(extension_->id(), device0_->GetDeviceInfo());
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo()));
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo()));
+ manager->AllowUsbDevice(extension_->id(), *device0_);
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device0_));
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device1_));
manager->RemoveEntry(extension_->id(), device1_entry);
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo()));
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device0_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device1_));
- manager->AllowUsbDevice(extension_->id(), device1_->GetDeviceInfo());
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo()));
- EXPECT_TRUE(
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo()));
+ manager->AllowUsbDevice(extension_->id(), *device1_);
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device0_));
+ EXPECT_TRUE(device_permissions->FindUsbDeviceEntry(*device1_));
manager->RemoveEntry(extension_->id(), device4_entry);
EXPECT_FALSE(device_permissions->FindHidDeviceEntry(*device4_));
@@ -317,13 +272,13 @@ TEST_F(DevicePermissionsManagerTest, RevokeAndRegrantAccess) {
TEST_F(DevicePermissionsManagerTest, UpdateLastUsed) {
DevicePermissionsManager* manager =
DevicePermissionsManager::Get(env_->profile());
- manager->AllowUsbDevice(extension_->id(), device0_->GetDeviceInfo());
+ manager->AllowUsbDevice(extension_->id(), *device0_);
manager->AllowHidDevice(extension_->id(), *device4_);
DevicePermissions* device_permissions =
manager->GetForExtension(extension_->id());
scoped_refptr<DevicePermissionEntry> device0_entry =
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo());
+ device_permissions->FindUsbDeviceEntry(*device0_);
EXPECT_TRUE(device0_entry->last_used().is_null());
scoped_refptr<DevicePermissionEntry> device4_entry =
device_permissions->FindHidDeviceEntry(*device4_);
@@ -362,14 +317,11 @@ TEST_F(DevicePermissionsManagerTest, LoadPrefs) {
DevicePermissions* device_permissions =
manager->GetForExtension(extension_->id());
scoped_refptr<DevicePermissionEntry> device0_entry =
- device_permissions->FindUsbDeviceEntry(device0_->GetDeviceInfo());
+ device_permissions->FindUsbDeviceEntry(*device0_);
ASSERT_TRUE(device0_entry);
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device1_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device2_->GetDeviceInfo()));
- EXPECT_FALSE(
- device_permissions->FindUsbDeviceEntry(device3_->GetDeviceInfo()));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device1_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device2_));
+ EXPECT_FALSE(device_permissions->FindUsbDeviceEntry(*device3_));
scoped_refptr<DevicePermissionEntry> device4_entry =
device_permissions->FindHidDeviceEntry(*device4_);
ASSERT_TRUE(device4_entry);
diff --git a/chromium/chrome/browser/extensions/api/downloads/downloads_api.cc b/chromium/chrome/browser/extensions/api/downloads/downloads_api.cc
index 40e574da5f5..9b7a6503f7c 100644
--- a/chromium/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chromium/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -65,7 +65,6 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
@@ -1029,7 +1028,7 @@ bool DownloadsDownloadFunction::RunAsync() {
})");
std::unique_ptr<download::DownloadUrlParameters> download_params(
new download::DownloadUrlParameters(
- download_url, render_frame_host()->GetProcess()->GetID(),
+ download_url, source_process_id(),
render_frame_host()->GetRenderViewHost()->GetRoutingID(),
render_frame_host()->GetRoutingID(), traffic_annotation));
diff --git a/chromium/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chromium/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
index b75af54a1b3..923a5565161 100644
--- a/chromium/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
+++ b/chromium/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -50,6 +50,7 @@
#include "content/public/browser/download_manager.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_process_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
@@ -672,6 +673,8 @@ class DownloadExtensionTest : public ExtensionApiTest {
current_browser(), url, ui::PAGE_TRANSITION_LINK);
function->set_extension(extension_);
function->SetRenderFrameHost(tab->GetMainFrame());
+ function->set_source_process_id(
+ tab->GetMainFrame()->GetProcess()->GetID());
}
}
diff --git a/chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc b/chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
index 54c97d98291..75ff22fb010 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
@@ -14,13 +14,13 @@
#include "chrome/browser/chromeos/policy/affiliation_test_helper.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
-#include "chrome/browser/chromeos/settings/stub_install_attributes.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "chromeos/dbus/fake_session_manager_client.h"
+#include "chromeos/dbus/session_manager/fake_session_manager_client.h"
#include "chromeos/system/fake_statistics_provider.h"
#include "chromeos/system/statistics_provider.h"
+#include "chromeos/tpm/stub_install_attributes.h"
#include "components/account_id/account_id.h"
#include "components/policy/core/common/cloud/device_management_service.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
@@ -138,15 +138,10 @@ class EnterpriseDeviceAttributesTest
void SetUpInProcessBrowserTestFixture() override {
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
- chromeos::FakeSessionManagerClient* fake_session_manager_client =
- new chromeos::FakeSessionManagerClient;
- chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient(
- std::unique_ptr<chromeos::SessionManagerClient>(
- fake_session_manager_client));
-
+ chromeos::SessionManagerClient::InitializeFakeInMemory();
policy::AffiliationTestHelper affiliation_helper =
policy::AffiliationTestHelper::CreateForCloud(
- fake_session_manager_client);
+ chromeos::FakeSessionManagerClient::Get());
std::set<std::string> device_affiliation_ids;
device_affiliation_ids.insert(kAffiliationID);
@@ -172,8 +167,9 @@ class EnterpriseDeviceAttributesTest
device_policy->policy_data().set_annotated_location(kAnnotatedLocation);
device_policy->Build();
- fake_session_manager_client->set_device_policy(device_policy->GetBlob());
- fake_session_manager_client->OnPropertyChangeComplete(true);
+ chromeos::FakeSessionManagerClient::Get()->set_device_policy(
+ device_policy->GetBlob());
+ chromeos::FakeSessionManagerClient::Get()->OnPropertyChangeComplete(true);
// Init the user policy provider.
EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_))
diff --git a/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc b/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc
index 9c503664dcb..8e7a0466dff 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h"
-#include "chrome/browser/chromeos/settings/stub_install_attributes.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/browser.h"
@@ -27,9 +26,10 @@
#include "chromeos/cryptohome/async_method_caller.h"
#include "chromeos/cryptohome/cryptohome_parameters.h"
#include "chromeos/cryptohome/mock_async_method_caller.h"
-#include "chromeos/dbus/attestation_constants.h"
+#include "chromeos/dbus/constants/attestation_constants.h"
+#include "chromeos/dbus/cryptohome/fake_cryptohome_client.h"
#include "chromeos/dbus/dbus_method_call_status.h"
-#include "chromeos/dbus/fake_cryptohome_client.h"
+#include "chromeos/tpm/stub_install_attributes.h"
#include "components/account_id/account_id.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/prefs/pref_service.h"
diff --git a/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc b/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
index fb6f4471f9e..08affbf89ef 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
@@ -25,8 +25,8 @@
#include "chromeos/attestation/attestation_flow.h"
#include "chromeos/cryptohome/async_method_caller.h"
#include "chromeos/cryptohome/cryptohome_parameters.h"
-#include "chromeos/dbus/attestation_constants.h"
-#include "chromeos/dbus/cryptohome_client.h"
+#include "chromeos/dbus/constants/attestation_constants.h"
+#include "chromeos/dbus/cryptohome/cryptohome_client.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/settings/cros_settings_names.h"
@@ -83,8 +83,7 @@ EPKPChallengeKeyBase::PrepareKeyContext::~PrepareKeyContext() {
}
EPKPChallengeKeyBase::EPKPChallengeKeyBase()
- : cryptohome_client_(
- chromeos::DBusThreadManager::Get()->GetCryptohomeClient()),
+ : cryptohome_client_(chromeos::CryptohomeClient::Get()),
async_caller_(cryptohome::AsyncMethodCaller::GetInstance()),
install_attributes_(g_browser_process->platform_part()
->browser_policy_connector_chromeos()
diff --git a/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h b/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
index 8161a91f53d..821da1af97d 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
+++ b/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
@@ -16,8 +16,8 @@
#include "base/optional.h"
#include "chrome/common/extensions/api/enterprise_platform_keys_private.h"
#include "chromeos/attestation/attestation_flow.h"
-#include "chromeos/dbus/attestation_constants.h"
-#include "chromeos/dbus/cryptohome_client.h"
+#include "chromeos/dbus/constants/attestation_constants.h"
+#include "chromeos/dbus/cryptohome/cryptohome_client.h"
#include "components/account_id/account_id.h"
#include "extensions/browser/extension_function.h"
#include "extensions/common/extension.h"
diff --git a/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc b/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
index cd85e422c06..599b76fb7e4 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h"
-#include "chrome/browser/chromeos/settings/stub_install_attributes.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/browser.h"
@@ -29,8 +28,9 @@
#include "chromeos/cryptohome/async_method_caller.h"
#include "chromeos/cryptohome/cryptohome_parameters.h"
#include "chromeos/cryptohome/mock_async_method_caller.h"
-#include "chromeos/dbus/attestation_constants.h"
-#include "chromeos/dbus/fake_cryptohome_client.h"
+#include "chromeos/dbus/constants/attestation_constants.h"
+#include "chromeos/dbus/cryptohome/fake_cryptohome_client.h"
+#include "chromeos/tpm/stub_install_attributes.h"
#include "components/account_id/account_id.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/prefs/pref_service.h"
diff --git a/chromium/chrome/browser/extensions/api/enterprise_reporting_private/OWNERS b/chromium/chrome/browser/extensions/api/enterprise_reporting_private/OWNERS
index 11fc6d24a77..c5b6aac77ec 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_reporting_private/OWNERS
+++ b/chromium/chrome/browser/extensions/api/enterprise_reporting_private/OWNERS
@@ -1,4 +1,5 @@
-georgesak@chromium.org
mad@chromium.org
pastarmovj@chromium.org
zmin@chromium.org
+
+# COMPONENT: Enterprise
diff --git a/chromium/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc b/chromium/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
index e53e39dd4f7..538751dcb26 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
@@ -61,7 +61,9 @@ EnterpriseReportingPrivateUploadChromeDesktopReportFunction::
cloud_policy_client_ = std::make_unique<policy::CloudPolicyClient>(
std::string() /* machine_id */, std::string() /* machine_model */,
- std::string() /* brand_code */, device_management_service,
+ std::string() /* brand_code */, std::string() /* ethernet_mac_address */,
+ std::string() /* dock_mac_address */,
+ std::string() /* manufacture_date */, device_management_service,
std::move(url_loader_factory), nullptr,
policy::CloudPolicyClient::DeviceDMTokenCallback());
dm_token_ = policy::BrowserDMTokenStorage::Get()->RetrieveDMToken();
diff --git a/chromium/chrome/browser/extensions/api/feedback_private/OWNERS b/chromium/chrome/browser/extensions/api/feedback_private/OWNERS
index 806a1cef4fb..c32d77036ab 100644
--- a/chromium/chrome/browser/extensions/api/feedback_private/OWNERS
+++ b/chromium/chrome/browser/extensions/api/feedback_private/OWNERS
@@ -1,4 +1,5 @@
afakhry@chromium.org
rkc@chromium.org
+jkardatzke@chromium.org
# COMPONENT: Platform>Apps>Feedback
diff --git a/chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.cc b/chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.cc
index 0e9dad5ae55..b4891f15197 100644
--- a/chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.cc
+++ b/chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.cc
@@ -29,8 +29,12 @@
#include "chrome/browser/chromeos/system_logs/iwlwifi_dump_log_source.h"
#include "chrome/browser/chromeos/system_logs/single_debug_daemon_log_source.h"
#include "chrome/browser/chromeos/system_logs/single_log_file_log_source.h"
+#include "chrome/browser/extensions/component_loader.h"
+#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "components/feedback/system_logs/system_logs_source.h"
+#include "extensions/browser/extension_system.h"
+#include "extensions/common/constants.h"
#endif // defined(OS_CHROMEOS)
namespace extensions {
@@ -99,10 +103,6 @@ ChromeFeedbackPrivateDelegate::GetStrings(
SET_STRING("sysinfoPageExpandBtn", IDS_ABOUT_SYS_EXPAND);
SET_STRING("sysinfoPageCollapseBtn", IDS_ABOUT_SYS_COLLAPSE);
SET_STRING("sysinfoPageStatusLoading", IDS_FEEDBACK_SYSINFO_PAGE_LOADING);
- // And the localized strings needed for the SRT Download Prompt.
- SET_STRING("srtPromptBody", IDS_FEEDBACK_SRT_PROMPT_BODY);
- SET_STRING("srtPromptAcceptButton", IDS_FEEDBACK_SRT_PROMPT_ACCEPT_BUTTON);
- SET_STRING("srtPromptDeclineButton", IDS_FEEDBACK_SRT_PROMPT_DECLINE_BUTTON);
#undef SET_STRING
const std::string& app_locale = g_browser_process->GetApplicationLocale();
@@ -177,24 +177,43 @@ ChromeFeedbackPrivateDelegate::CreateSingleLogSource(
}
}
-void ChromeFeedbackPrivateDelegate::FetchAndMergeIwlwifiDumpLogsIfPresent(
- std::unique_ptr<FeedbackCommon::SystemLogsMap> original_sys_logs,
- content::BrowserContext* context,
- system_logs::SysLogsFetcherCallback callback) const {
- if (!original_sys_logs ||
- !system_logs::ContainsIwlwifiLogs(original_sys_logs.get())) {
+void OnFetchedExtraLogs(
+ scoped_refptr<feedback::FeedbackData> feedback_data,
+ FetchExtraLogsCallback callback,
+ std::unique_ptr<system_logs::SystemLogsResponse> response) {
+ using system_logs::kIwlwifiDumpKey;
+ if (response && response->count(kIwlwifiDumpKey)) {
+ feedback_data->AddLog(kIwlwifiDumpKey,
+ std::move(response->at(kIwlwifiDumpKey)));
+ }
+ std::move(callback).Run(feedback_data);
+}
+
+void ChromeFeedbackPrivateDelegate::FetchExtraLogs(
+ scoped_refptr<feedback::FeedbackData> feedback_data,
+ FetchExtraLogsCallback callback) const {
+ // Anonymize data.
+ constexpr bool scrub = true;
+
+ if (system_logs::ContainsIwlwifiLogs(feedback_data->sys_info())) {
+ VLOG(1) << "Fetching WiFi dump logs.";
+ system_logs::SystemLogsFetcher* fetcher =
+ new system_logs::SystemLogsFetcher(scrub);
+ fetcher->AddSource(std::make_unique<system_logs::IwlwifiDumpLogSource>());
+ fetcher->Fetch(base::BindOnce(&OnFetchedExtraLogs, feedback_data,
+ std::move(callback)));
+ } else {
VLOG(1) << "WiFi dump logs are not present.";
- std::move(callback).Run(std::move(original_sys_logs));
- return;
+ std::move(callback).Run(feedback_data);
}
+}
- VLOG(1) << "Fetching WiFi dump logs.";
- system_logs::SystemLogsFetcher* fetcher =
- new system_logs::SystemLogsFetcher(true /* scrub_data */);
- fetcher->AddSource(std::make_unique<system_logs::IwlwifiDumpLogSource>());
- fetcher->Fetch(base::BindOnce(&system_logs::MergeIwlwifiLogs,
- std::move(original_sys_logs),
- std::move(callback)));
+void ChromeFeedbackPrivateDelegate::UnloadFeedbackExtension(
+ content::BrowserContext* context) const {
+ extensions::ExtensionSystem::Get(context)
+ ->extension_service()
+ ->component_loader()
+ ->Remove(extension_misc::kFeedbackExtensionId);
}
#endif // defined(OS_CHROMEOS)
diff --git a/chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.h b/chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.h
index b900965523e..2469dad25e8 100644
--- a/chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.h
+++ b/chromium/chrome/browser/extensions/api/feedback_private/chrome_feedback_private_delegate.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_CHROME_FEEDBACK_PRIVATE_DELEGATE_H_
#define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_CHROME_FEEDBACK_PRIVATE_DELEGATE_H_
-#include "components/feedback/feedback_common.h"
+#include "components/feedback/feedback_data.h"
#include "extensions/browser/api/feedback_private/feedback_private_delegate.h"
#include "base/macros.h"
@@ -26,10 +26,9 @@ class ChromeFeedbackPrivateDelegate : public FeedbackPrivateDelegate {
#if defined(OS_CHROMEOS)
std::unique_ptr<system_logs::SystemLogsSource> CreateSingleLogSource(
api::feedback_private::LogSource source_type) const override;
- void FetchAndMergeIwlwifiDumpLogsIfPresent(
- std::unique_ptr<FeedbackCommon::SystemLogsMap> original_sys_logs,
- content::BrowserContext* context,
- system_logs::SysLogsFetcherCallback callback) const override;
+ void FetchExtraLogs(scoped_refptr<feedback::FeedbackData> feedback_data,
+ FetchExtraLogsCallback callback) const override;
+ void UnloadFeedbackExtension(content::BrowserContext* context) const override;
#endif // defined(OS_CHROMEOS)
std::string GetSignedInUserEmail(
content::BrowserContext* context) const override;
diff --git a/chromium/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc b/chromium/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc
index 8bfbf82d3ec..d3eb91ea973 100644
--- a/chromium/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc
+++ b/chromium/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc
@@ -6,12 +6,15 @@
#include "base/run_loop.h"
#include "chrome/browser/apps/platform_apps/app_browsertest_util.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/devtools/devtools_window_testing.h"
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/extension_browsertest.h"
+#include "chrome/browser/feedback/feedback_dialog_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
@@ -244,4 +247,41 @@ IN_PROC_BROWSER_TEST_F(FeedbackTest, MAYBE_ShowFeedbackFromAssistant) {
&bool_result));
EXPECT_TRUE(bool_result);
}
+
+IN_PROC_BROWSER_TEST_F(FeedbackTest, GetTargetTabUrl) {
+ const std::pair<std::string, std::string> test_cases[] = {
+ {"https://www.google.com/", "https://www.google.com/"},
+ {"about://version/", "chrome://version/"},
+ {"chrome://bookmarks/", "chrome://bookmarks/"},
+ };
+
+ for (const auto& test_case : test_cases) {
+ GURL expected_url = GURL(test_case.second);
+
+ ui_test_utils::NavigateToURL(browser(), GURL(test_case.first));
+
+ // Sanity check that we always have one tab in the browser.
+ ASSERT_EQ(browser()->tab_strip_model()->count(), 1);
+
+ ASSERT_EQ(expected_url,
+ browser()->tab_strip_model()->GetWebContentsAt(0)->GetURL());
+
+ ASSERT_EQ(expected_url,
+ chrome::GetTargetTabUrl(browser()->session_id(), 0));
+
+ // Open a DevTools window.
+ DevToolsWindow* devtools_window =
+ DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), false);
+
+ // Verify the expected url returned from GetTargetTabUrl against a
+ // DevTools window.
+ ASSERT_EQ(expected_url, chrome::GetTargetTabUrl(
+ DevToolsWindowTesting::Get(devtools_window)
+ ->browser()
+ ->session_id(),
+ 0));
+
+ DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window);
+ }
+}
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/file_system/request_file_system_notification.cc b/chromium/chrome/browser/extensions/api/file_system/request_file_system_notification.cc
index cbb73bbb99e..f4672d8dbe0 100644
--- a/chromium/chrome/browser/extensions/api/file_system/request_file_system_notification.cc
+++ b/chromium/chrome/browser/extensions/api/file_system/request_file_system_notification.cc
@@ -60,7 +60,8 @@ class AppNotificationLauncher : public AppIconLoaderDelegate {
pending_notification_->set_icon(*extension_icon_);
NotificationDisplayService::GetForProfile(profile_)->Display(
- NotificationHandler::Type::TRANSIENT, *pending_notification_);
+ NotificationHandler::Type::TRANSIENT, *pending_notification_,
+ /*metadata=*/nullptr);
delete this;
}
diff --git a/chromium/chrome/browser/extensions/api/gcm/gcm_apitest.cc b/chromium/chrome/browser/extensions/api/gcm/gcm_apitest.cc
index 651da3a4877..1357ae0d862 100644
--- a/chromium/chrome/browser/extensions/api/gcm/gcm_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/gcm/gcm_apitest.cc
@@ -12,8 +12,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "components/browser_sync/browser_sync_switches.h"
#include "components/gcm_driver/fake_gcm_profile_service.h"
+#include "components/sync/driver/sync_driver_switches.h"
#include "extensions/test/result_catcher.h"
using extensions::ResultCatcher;
diff --git a/chromium/chrome/browser/extensions/api/identity/identity_apitest.cc b/chromium/chrome/browser/extensions/api/identity/identity_apitest.cc
index e3203f283d6..44129fe709e 100644
--- a/chromium/chrome/browser/extensions/api/identity/identity_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -67,7 +67,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/mock_user_manager.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
-#include "chrome/browser/chromeos/settings/stub_install_attributes.h"
+#include "chromeos/tpm/stub_install_attributes.h"
#include "components/user_manager/scoped_user_manager.h"
#endif
diff --git a/chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc b/chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
index 4403b6fdd1d..e2a13a15a17 100644
--- a/chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
+++ b/chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
@@ -26,12 +26,9 @@
#include "components/signin/core/browser/signin_pref_names.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/common/service_manager_connection.h"
#include "extensions/common/extension_l10n_util.h"
#include "google_apis/gaia/gaia_urls.h"
#include "services/identity/public/cpp/scope_set.h"
-#include "services/identity/public/mojom/constants.mojom.h"
-#include "services/service_manager/public/cpp/connector.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/app_mode/app_mode_utils.h"
@@ -152,11 +149,10 @@ bool IdentityGetAuthTokenFunction::RunAsync() {
weak_ptr_factory_.GetWeakPtr(), gaia_id));
} else {
// Get the AccountInfo for the account that the extension wishes to use.
- GetMojoIdentityAccessor()->GetAccountInfoFromGaiaId(
- gaia_id,
- base::BindOnce(
- &IdentityGetAuthTokenFunction::OnReceivedExtensionAccountInfo, this,
- gaia_id));
+ base::PostTaskWithTraits(
+ FROM_HERE, {content::BrowserThread::UI},
+ base::BindOnce(&IdentityGetAuthTokenFunction::FetchExtensionAccountInfo,
+ weak_ptr_factory_.GetWeakPtr(), gaia_id));
}
return true;
@@ -164,9 +160,9 @@ bool IdentityGetAuthTokenFunction::RunAsync() {
void IdentityGetAuthTokenFunction::GetAuthTokenForPrimaryAccount(
const std::string& extension_gaia_id) {
- AccountInfo primary_account_info =
- IdentityManagerFactory::GetForProfile(GetProfile())
- ->GetPrimaryAccountInfo();
+ auto* identity_manager = IdentityManagerFactory::GetForProfile(GetProfile());
+ CoreAccountInfo primary_account_info =
+ identity_manager->GetPrimaryAccountInfo();
bool primary_account_only = IsPrimaryAccountOnly();
// Detect and handle the case where the extension is using an account other
@@ -178,16 +174,9 @@ void IdentityGetAuthTokenFunction::GetAuthTokenForPrimaryAccount(
return;
}
- auto* identity_manager = IdentityManagerFactory::GetForProfile(GetProfile());
if (primary_account_only || !primary_account_info.gaia.empty()) {
// The extension is using the primary account.
- ::identity::AccountState account_state;
- account_state.has_refresh_token =
- identity_manager->HasAccountWithRefreshToken(
- primary_account_info.account_id);
- OnReceivedExtensionAccountInfo(
- primary_account_info.gaia,
- base::Optional<AccountInfo>(primary_account_info), account_state);
+ OnReceivedExtensionAccountInfo(&primary_account_info);
} else {
// No primary account, try the first account in cookies.
DCHECK_EQ(AccountListeningMode::kNotListening, account_listening_mode_);
@@ -203,11 +192,15 @@ void IdentityGetAuthTokenFunction::GetAuthTokenForPrimaryAccount(
}
}
+void IdentityGetAuthTokenFunction::FetchExtensionAccountInfo(
+ const std::string& gaia_id) {
+ OnReceivedExtensionAccountInfo(base::OptionalOrNullptr(
+ IdentityManagerFactory::GetForProfile(GetProfile())
+ ->FindAccountInfoForAccountWithRefreshTokenByGaiaId(gaia_id)));
+}
+
void IdentityGetAuthTokenFunction::OnReceivedExtensionAccountInfo(
- const std::string& extension_gaia_id,
- const base::Optional<AccountInfo>& account_info,
- const identity::AccountState& account_state) {
- DCHECK(!account_info || (account_info->gaia == extension_gaia_id));
+ const CoreAccountInfo* account_info) {
token_key_.account_id = account_info ? account_info->account_id : "";
#if defined(OS_CHROMEOS)
@@ -228,7 +221,9 @@ void IdentityGetAuthTokenFunction::OnReceivedExtensionAccountInfo(
}
#endif
- if (!account_state.has_refresh_token) {
+ if (!account_info ||
+ !IdentityManagerFactory::GetForProfile(GetProfile())
+ ->HasAccountWithRefreshToken(account_info->account_id)) {
if (!ShouldStartSigninFlow()) {
CompleteFunctionWithError(
IsBrowserSigninAllowed(GetProfile())
@@ -261,15 +256,12 @@ void IdentityGetAuthTokenFunction::OnAccountsInCookieUpdated(
// If the account is in auth error, it won't be in the identity manager.
// Save the email now to use as email hint for the login prompt.
email_for_default_web_account_ = account.email;
- GetMojoIdentityAccessor()->GetAccountInfoFromGaiaId(
- account.gaia_id,
- base::BindOnce(
- &IdentityGetAuthTokenFunction::OnReceivedExtensionAccountInfo, this,
- account.gaia_id));
+ OnReceivedExtensionAccountInfo(base::OptionalOrNullptr(
+ IdentityManagerFactory::GetForProfile(GetProfile())
+ ->FindAccountInfoForAccountWithRefreshTokenByGaiaId(
+ account.gaia_id)));
} else {
- OnReceivedExtensionAccountInfo(
- /*extension_gaia_id=*/std::string(), base::Optional<AccountInfo>(),
- identity::AccountState());
+ OnReceivedExtensionAccountInfo(nullptr);
}
}
@@ -729,7 +721,6 @@ void IdentityGetAuthTokenFunction::OnIdentityAPIShutdown() {
gaia_web_auth_flow_.reset();
device_access_token_request_.reset();
token_key_account_access_token_fetcher_.reset();
- mojo_identity_accessor_.reset();
scoped_identity_manager_observer_.RemoveAll();
extensions::IdentityAPI::GetFactoryInstance()
->Get(GetProfile())
@@ -873,16 +864,6 @@ std::string IdentityGetAuthTokenFunction::GetOAuth2ClientId() const {
return client_id;
}
-::identity::mojom::IdentityAccessor*
-IdentityGetAuthTokenFunction::GetMojoIdentityAccessor() {
- if (!mojo_identity_accessor_.is_bound()) {
- content::BrowserContext::GetConnectorFor(GetProfile())
- ->BindInterface(::identity::mojom::kServiceName,
- mojo::MakeRequest(&mojo_identity_accessor_));
- }
- return mojo_identity_accessor_.get();
-}
-
bool IdentityGetAuthTokenFunction::IsPrimaryAccountOnly() const {
return IdentityAPI::GetFactoryInstance()
->Get(GetProfile())
diff --git a/chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h b/chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h
index d9dc69a9921..6ff40e6af18 100644
--- a/chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h
+++ b/chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h
@@ -19,9 +19,7 @@
#include "google_apis/gaia/google_service_auth_error.h"
#include "google_apis/gaia/oauth2_mint_token_flow.h"
#include "google_apis/gaia/oauth2_token_service.h"
-#include "services/identity/public/cpp/account_state.h"
#include "services/identity/public/cpp/identity_manager.h"
-#include "services/identity/public/mojom/identity_accessor.mojom.h"
namespace identity {
class AccessTokenFetcher;
@@ -130,11 +128,12 @@ class IdentityGetAuthTokenFunction : public ChromeAsyncExtensionFunction,
// instance, or empty if this was not in the parameters.
void GetAuthTokenForPrimaryAccount(const std::string& extension_gaia_id);
+ // Wrapper to FindAccountInfoForAccountWithRefreshTokenByGaiaId() to avoid a
+ // synchronous call to IdentityManager in RunAsync().
+ void FetchExtensionAccountInfo(const std::string& gaia_id);
+
// Called when the AccountInfo that this instance should use is available.
- void OnReceivedExtensionAccountInfo(
- const std::string& extension_gaia_id,
- const base::Optional<AccountInfo>& account_info,
- const identity::AccountState& account_state);
+ void OnReceivedExtensionAccountInfo(const CoreAccountInfo* account_info);
// identity::IdentityManager::Observer implementation:
void OnRefreshTokenUpdatedForAccount(
@@ -194,13 +193,6 @@ class IdentityGetAuthTokenFunction : public ChromeAsyncExtensionFunction,
std::string GetOAuth2ClientId() const;
- // Gets the IdentityAccessor mojo interface, lazily binding it.
- // TODO(https://crbug.com/913853): As of Dec 2018, the chrome.identity
- // API is the only client of the Identity Service. It should be migrated to
- // the IdentityManager soon after the IdentityManager is backed by the
- // Identity Service.
- ::identity::mojom::IdentityAccessor* GetMojoIdentityAccessor();
-
// Returns true if extensions are restricted to the primary account.
bool IsPrimaryAccountOnly() const;
@@ -225,7 +217,6 @@ class IdentityGetAuthTokenFunction : public ChromeAsyncExtensionFunction,
std::unique_ptr<base::CallbackList<void()>::Subscription>
identity_api_shutdown_subscription_;
- identity::mojom::IdentityAccessorPtr mojo_identity_accessor_;
ScopedObserver<identity::IdentityManager, identity::IdentityManager::Observer>
scoped_identity_manager_observer_;
diff --git a/chromium/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc b/chromium/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc
index 0556e1d3714..952862996d3 100644
--- a/chromium/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc
@@ -12,8 +12,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
-#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/render_process_host.h"
#include "extensions/browser/api/file_handlers/app_file_handler_util.h"
namespace image_writer_api = extensions::api::image_writer_private;
@@ -97,8 +95,8 @@ bool ImageWriterPrivateWriteFromFileFunction::RunAsync() {
base::FilePath path;
if (!extensions::app_file_handler_util::ValidateFileEntryAndGetPath(
- filesystem_name, filesystem_path,
- render_frame_host()->GetProcess()->GetID(), &path, &error_))
+ filesystem_name, filesystem_path, source_process_id(), &path,
+ &error_))
return false;
image_writer::OperationManager::Get(GetProfile())
diff --git a/chromium/chrome/browser/extensions/api/image_writer_private/operation.h b/chromium/chrome/browser/extensions/api/image_writer_private/operation.h
index ba12212379a..cfc95222395 100644
--- a/chromium/chrome/browser/extensions/api/image_writer_private/operation.h
+++ b/chromium/chrome/browser/extensions/api/image_writer_private/operation.h
@@ -12,7 +12,7 @@
#include "base/callback.h"
#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/md5.h"
+#include "base/hash/md5.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner.h"
diff --git a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
index e3d79a429c5..1135dd14cae 100644
--- a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
+++ b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
@@ -224,8 +224,7 @@ class ImeObserverChromeOS : public ui::ImeObserver {
// There is both a public and private OnFocus event. The private OnFocus
// event is only for ChromeOS and contains additional information about pen
// inputs. We ensure that we only trigger one OnFocus event.
- if (ExtensionHasListener(input_method_private::OnFocus::kEventName) &&
- base::FeatureList::IsEnabled(features::kEnableStylusVirtualKeyboard)) {
+ if (ExtensionHasListener(input_method_private::OnFocus::kEventName)) {
input_method_private::InputContext input_context;
input_context.context_id = context.id;
input_context.type = input_method_private::ParseInputContextType(
diff --git a/chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
index 883ce717413..c4d58486a4d 100644
--- a/chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
+++ b/chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
@@ -10,19 +10,30 @@
#include "base/callback_helpers.h"
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/extensions/bookmark_app_helper.h"
+#include "base/task/post_task.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
+#include "chrome/browser/installable/installable_manager.h"
+#include "chrome/browser/installable/installable_metrics.h"
+#include "chrome/browser/installable/installable_params.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ssl/security_state_tab_helper.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/app_launch_params.h"
#include "chrome/browser/ui/extensions/application_launch.h"
+#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+#include "chrome/browser/ui/web_applications/web_app_dialog_utils.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
+#include "chrome/browser/web_applications/components/install_manager.h"
+#include "chrome/browser/web_applications/components/web_app_constants.h"
+#include "chrome/browser/web_applications/components/web_app_provider_base.h"
+#include "chrome/browser/web_applications/components/web_app_utils.h"
+#include "chrome/browser/web_applications/extensions/bookmark_app_util.h"
#include "chrome/common/extensions/extension_metrics.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/web_application_info.h"
@@ -45,6 +56,11 @@
namespace {
+using InstallWebAppCallback =
+ extensions::ManagementAPIDelegate::InstallWebAppCallback;
+using InstallWebAppResult =
+ extensions::ManagementAPIDelegate::InstallWebAppResult;
+
class ManagementSetEnabledFunctionInstallPromptDelegate
: public extensions::InstallPromptDelegate {
public:
@@ -141,6 +157,14 @@ class ManagementUninstallFunctionUninstallDialogDelegate
DISALLOW_COPY_AND_ASSIGN(ManagementUninstallFunctionUninstallDialogDelegate);
};
+void OnGenerateAppForLinkCompleted(
+ extensions::ManagementGenerateAppForLinkFunction* function,
+ const web_app::AppId& app_id,
+ web_app::InstallResultCode code) {
+ const bool install_success = code == web_app::InstallResultCode::kSuccess;
+ function->FinishCreateWebApp(app_id, install_success);
+}
+
class ChromeAppForLinkDelegate : public extensions::AppForLinkDelegate {
public:
ChromeAppForLinkDelegate() {}
@@ -152,33 +176,72 @@ class ChromeAppForLinkDelegate : public extensions::AppForLinkDelegate {
const std::string& title,
const GURL& launch_url,
const favicon_base::FaviconImageResult& image_result) {
- WebApplicationInfo web_app;
- web_app.title = base::UTF8ToUTF16(title);
- web_app.app_url = launch_url;
+ auto web_app_info = std::make_unique<WebApplicationInfo>();
+ web_app_info->title = base::UTF8ToUTF16(title);
+ web_app_info->app_url = launch_url;
if (!image_result.image.IsEmpty()) {
WebApplicationInfo::IconInfo icon;
icon.data = image_result.image.AsBitmap();
icon.width = icon.data.width();
icon.height = icon.data.height();
- web_app.icons.push_back(icon);
+ web_app_info->icons.push_back(icon);
}
- bookmark_app_helper_.reset(new extensions::BookmarkAppHelper(
- Profile::FromBrowserContext(context), web_app, nullptr,
- WebappInstallSource::MANAGEMENT_API));
- bookmark_app_helper_->Create(
- base::Bind(&extensions::ManagementGenerateAppForLinkFunction::
- FinishCreateBookmarkApp,
- function));
- }
+ auto* provider = web_app::WebAppProviderBase::GetProviderBase(
+ Profile::FromBrowserContext(context));
+ DCHECK(provider);
- std::unique_ptr<extensions::BookmarkAppHelper> bookmark_app_helper_;
+ provider->install_manager().InstallWebAppFromInfo(
+ std::move(web_app_info), /*no_network_install=*/false,
+ WebappInstallSource::MANAGEMENT_API,
+ base::BindOnce(OnGenerateAppForLinkCompleted,
+ base::RetainedRef(function)));
+ }
// Used for favicon loading tasks.
base::CancelableTaskTracker cancelable_task_tracker_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ChromeAppForLinkDelegate);
};
+void OnWebAppInstallCompleted(InstallWebAppCallback callback,
+ const web_app::AppId& app_id,
+ web_app::InstallResultCode code) {
+ InstallWebAppResult result;
+ // TODO(loyso): Update this when more of the web_app::InstallResultCodes are
+ // actually set.
+ switch (code) {
+ case web_app::InstallResultCode::kSuccess:
+ result = InstallWebAppResult::kSuccess;
+ break;
+ default:
+ result = InstallWebAppResult::kUnknownError;
+ }
+ std::move(callback).Run(result);
+}
+
+void OnDidInstallWebAppInstallableCheck(
+ Profile* profile,
+ InstallWebAppCallback callback,
+ std::unique_ptr<content::WebContents> web_contents,
+ bool is_installable) {
+ if (!is_installable) {
+ std::move(callback).Run(InstallWebAppResult::kInvalidWebApp);
+ return;
+ }
+
+ content::WebContents* containing_contents = web_contents.get();
+ chrome::ScopedTabbedBrowserDisplayer displayer(profile);
+ chrome::AddWebContents(displayer.browser(), nullptr, std::move(web_contents),
+ WindowOpenDisposition::NEW_FOREGROUND_TAB,
+ gfx::Rect());
+ web_app::CreateWebAppFromManifest(
+ containing_contents, WebappInstallSource::MANAGEMENT_API,
+ base::BindOnce(&OnWebAppInstallCompleted, std::move(callback)));
+}
+
} // namespace
ChromeManagementAPIDelegate::ChromeManagementAPIDelegate() {
@@ -302,12 +365,29 @@ ChromeManagementAPIDelegate::GenerateAppForLinkFunctionDelegate(
return std::unique_ptr<extensions::AppForLinkDelegate>(delegate);
}
-bool ChromeManagementAPIDelegate::CanHostedAppsOpenInWindows() const {
- return extensions::util::CanHostedAppsOpenInWindows();
+bool ChromeManagementAPIDelegate::IsWebAppInstalled(
+ content::BrowserContext* context,
+ const GURL& web_app_url) const {
+ return extensions::BookmarkOrHostedAppInstalled(context, web_app_url);
}
-bool ChromeManagementAPIDelegate::IsNewBookmarkAppsEnabled() const {
- return extensions::util::IsNewBookmarkAppsEnabled();
+bool ChromeManagementAPIDelegate::CanContextInstallWebApps(
+ content::BrowserContext* context) const {
+ return web_app::AreWebAppsUserInstallable(
+ Profile::FromBrowserContext(context));
+}
+
+void ChromeManagementAPIDelegate::InstallReplacementWebApp(
+ content::BrowserContext* context,
+ const GURL& web_app_url,
+ InstallWebAppCallback callback) const {
+ Profile* profile = Profile::FromBrowserContext(context);
+ auto* provider = web_app::WebAppProviderBase::GetProviderBase(profile);
+ DCHECK(provider);
+
+ provider->install_manager().LoadWebAppAndCheckInstallability(
+ web_app_url, base::BindOnce(&OnDidInstallWebAppInstallableCheck, profile,
+ std::move(callback)));
}
void ChromeManagementAPIDelegate::EnableExtension(
diff --git a/chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.h b/chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.h
index eb53b3d9d8a..8088380e0bb 100644
--- a/chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.h
+++ b/chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.h
@@ -46,8 +46,14 @@ class ChromeManagementAPIDelegate : public extensions::ManagementAPIDelegate {
content::BrowserContext* context,
const std::string& title,
const GURL& launch_url) const override;
- bool CanHostedAppsOpenInWindows() const override;
- bool IsNewBookmarkAppsEnabled() const override;
+ bool IsWebAppInstalled(content::BrowserContext* context,
+ const GURL& web_app_url) const override;
+ bool CanContextInstallWebApps(
+ content::BrowserContext* context) const override;
+ void InstallReplacementWebApp(
+ content::BrowserContext* context,
+ const GURL& web_app_url,
+ ManagementAPIDelegate::InstallWebAppCallback callback) const override;
void EnableExtension(content::BrowserContext* context,
const std::string& extension_id) const override;
void DisableExtension(
diff --git a/chromium/chrome/browser/extensions/api/management/management_apitest.cc b/chromium/chrome/browser/extensions/api/management/management_apitest.cc
index cfea99a7de3..1616369c7ed 100644
--- a/chromium/chrome/browser/extensions/api/management/management_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/management/management_apitest.cc
@@ -4,17 +4,19 @@
#include <map>
+#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
+#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/web_applications/extensions/bookmark_app_util.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "extensions/browser/api/management/management_api.h"
@@ -23,6 +25,9 @@
#include "extensions/browser/test_management_policy.h"
#include "extensions/common/manifest.h"
#include "extensions/test/extension_test_message_listener.h"
+#include "extensions/test/result_catcher.h"
+#include "extensions/test/test_extension_dir.h"
+#include "net/dns/mock_host_resolver.h"
using extensions::Extension;
using extensions::Manifest;
@@ -140,11 +145,128 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, CreateAppShortcut) {
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, GenerateAppForLink) {
- LoadExtensions();
ASSERT_TRUE(RunExtensionSubtest("management/test",
"generateAppForLink.html"));
}
+class InstallReplacementWebAppApiTest : public ExtensionManagementApiTest {
+ public:
+ InstallReplacementWebAppApiTest()
+ : https_test_server_(net::EmbeddedTestServer::TYPE_HTTPS) {}
+ ~InstallReplacementWebAppApiTest() override = default;
+
+ protected:
+ void SetUpOnMainThread() override {
+ ExtensionManagementApiTest::SetUpOnMainThread();
+ https_test_server_.ServeFilesFromDirectory(test_data_dir_);
+ ASSERT_TRUE(https_test_server_.Start());
+ }
+
+ void RunTest(const char* web_app_path,
+ const char* background_script,
+ bool from_webstore) {
+ static constexpr char kManifest[] =
+ R"({
+ "name": "Management API Test",
+ "version": "0.1",
+ "manifest_version": 2,
+ "background": { "scripts": ["background.js"] },
+ "replacement_web_app": "%s"
+ })";
+ extensions::TestExtensionDir extension_dir;
+ extension_dir.WriteManifest(base::StringPrintf(
+ kManifest, https_test_server_.GetURL(web_app_path).spec().c_str()));
+ extension_dir.WriteFile(FILE_PATH_LITERAL("background.js"),
+ background_script);
+ extensions::ResultCatcher catcher;
+ if (from_webstore) {
+ // |expected_change| is the expected change in the number of installed
+ // extensions.
+ ASSERT_TRUE(InstallExtensionFromWebstore(extension_dir.UnpackedPath(),
+ 1 /* expected_change */));
+ } else {
+ ASSERT_TRUE(LoadExtension(extension_dir.UnpackedPath()));
+ }
+
+ ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
+ }
+
+ net::EmbeddedTestServer https_test_server_;
+};
+
+IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotWebstore) {
+ static constexpr char kBackground[] = R"(
+ chrome.management.installReplacementWebApp(function() {
+ chrome.test.assertLastError(
+ 'Only extensions from the web store can install replacement web apps.');
+ chrome.test.notifyPass();
+ });)";
+
+ RunTest("/management/install_replacement_web_app/good_web_app/index.html",
+ kBackground, false /* from_webstore */);
+}
+
+IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NoGesture) {
+ static constexpr char kBackground[] = R"(
+ chrome.management.installReplacementWebApp(function() {
+ chrome.test.assertLastError(
+ 'chrome.management.installReplacementWebApp requires a user gesture.');
+ chrome.test.notifyPass();
+ });)";
+
+ RunTest("/management/install_replacement_web_app/good_web_app/index.html",
+ kBackground, true /* from_webstore */);
+}
+
+IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotInstallableWebApp) {
+ static constexpr char kBackground[] =
+ R"(chrome.test.runWithUserGesture(function() {
+ chrome.management.installReplacementWebApp(function() {
+ chrome.test.assertLastError(
+ 'Web app is not a valid installable web app.');
+ chrome.test.notifyPass();
+ });
+ });)";
+
+ RunTest("/management/install_replacement_web_app/bad_web_app/index.html",
+ kBackground, true /* from_webstore */);
+}
+
+IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, InstallableWebApp) {
+ static constexpr char kBackground[] =
+ R"(chrome.test.runTests([
+ function runInstall() {
+ chrome.test.runWithUserGesture(function() {
+ chrome.management.installReplacementWebApp(function() {
+ chrome.test.assertNoLastError();
+ chrome.test.succeed();
+ });
+ });
+ },
+ function runInstallWhenAlreadyInstalled() {
+ chrome.test.runWithUserGesture(function() {
+ chrome.management.installReplacementWebApp(function() {
+ chrome.test.assertLastError(
+ 'Web app is already installed.');
+ chrome.test.succeed();
+ });
+ });
+ }
+ ]);)";
+ static constexpr char kGoodWebAppURL[] =
+ "/management/install_replacement_web_app/good_web_app/index.html";
+
+ chrome::SetAutoAcceptPWAInstallConfirmationForTesting(true);
+ const GURL good_web_app_url = https_test_server_.GetURL(kGoodWebAppURL);
+ EXPECT_FALSE(extensions::BookmarkOrHostedAppInstalled(browser()->profile(),
+ good_web_app_url));
+
+ RunTest(kGoodWebAppURL, kBackground, true /* from_webstore */);
+ EXPECT_TRUE(extensions::BookmarkOrHostedAppInstalled(browser()->profile(),
+ good_web_app_url));
+ chrome::SetAutoAcceptPWAInstallConfirmationForTesting(false);
+}
+
// Fails often on Windows dbg bots. http://crbug.com/177163
#if defined(OS_WIN)
#define MAYBE_ManagementPolicyAllowed DISABLED_ManagementPolicyAllowed
@@ -301,23 +423,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, MAYBE_LaunchTabApp) {
// If the ID changed, then the pref will not apply to the app.
ASSERT_EQ(app_id, app_id_new);
- unsigned expected_browser_count = 2;
-#if defined(OS_MACOSX)
- // Without the new Bookmark Apps, Mac has no way of making standalone browser
- // windows for apps, so it will add to the tabstrip instead.
- EXPECT_FALSE(extensions::util::IsNewBookmarkAppsEnabled());
- EXPECT_FALSE(extensions::util::CanHostedAppsOpenInWindows());
- expected_browser_count = 1;
- ASSERT_EQ(2, browser()->tab_strip_model()->count());
-#endif
// Find the app's browser. Opening in a new window will create
// a new browser.
- ASSERT_EQ(expected_browser_count,
- chrome::GetBrowserCount(browser()->profile()));
- if (expected_browser_count == 2) {
- Browser* app_browser = FindOtherBrowser(browser());
- ASSERT_TRUE(app_browser->is_app());
- }
+ ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile()));
+ Browser* app_browser = FindOtherBrowser(browser());
+ ASSERT_TRUE(app_browser->is_app());
}
// Flaky on MacOS: crbug.com/915339
diff --git a/chromium/chrome/browser/extensions/api/mdns/mdns_api.cc b/chromium/chrome/browser/extensions/api/mdns/mdns_api.cc
index e20b7ae3326..1656dfd9838 100644
--- a/chromium/chrome/browser/extensions/api/mdns/mdns_api.cc
+++ b/chromium/chrome/browser/extensions/api/mdns/mdns_api.cc
@@ -156,12 +156,11 @@ void MDnsAPI::OnDnsSdEvent(const std::string& service_type,
// the wiser. Instead, changing the event to pass the number of
// discovered instances would allow the caller to know when the list is
// truncated and tell the user something meaningful in the extension/app.
- WriteToConsole(service_type,
- content::CONSOLE_MESSAGE_LEVEL_WARNING,
- base::StringPrintf(
- "Truncating number of service instances in "
- "onServiceList to maximum allowed: %d",
- api::mdns::MAX_SERVICE_INSTANCES_PER_EVENT));
+ WriteToConsole(
+ service_type, blink::mojom::ConsoleMessageLevel::kWarning,
+ base::StringPrintf("Truncating number of service instances in "
+ "onServiceList to maximum allowed: %d",
+ api::mdns::MAX_SERVICE_INSTANCES_PER_EVENT));
break;
}
mdns::MDnsService mdns_service;
@@ -232,7 +231,7 @@ void MDnsAPI::GetValidOnServiceListListeners(
}
void MDnsAPI::WriteToConsole(const std::string& service_type,
- content::ConsoleMessageLevel level,
+ blink::mojom::ConsoleMessageLevel level,
const std::string& message) {
// Get all the extensions with an onServiceList listener for a particular
// service type.
diff --git a/chromium/chrome/browser/extensions/api/mdns/mdns_api.h b/chromium/chrome/browser/extensions/api/mdns/mdns_api.h
index a32095e76b7..19464a2ef76 100644
--- a/chromium/chrome/browser/extensions/api/mdns/mdns_api.h
+++ b/chromium/chrome/browser/extensions/api/mdns/mdns_api.h
@@ -87,7 +87,7 @@ class MDnsAPI : public BrowserContextKeyedAPI,
// Write a message to the consoles of extensions listening to a given service
// type.
void WriteToConsole(const std::string& service_type,
- content::ConsoleMessageLevel level,
+ blink::mojom::ConsoleMessageLevel level,
const std::string& message);
// Returns true if an extension or platform app |extension_id| is allowed to
diff --git a/chromium/chrome/browser/extensions/api/media_perception_private/OWNERS b/chromium/chrome/browser/extensions/api/media_perception_private/OWNERS
new file mode 100644
index 00000000000..f55ea18f54f
--- /dev/null
+++ b/chromium/chrome/browser/extensions/api/media_perception_private/OWNERS
@@ -0,0 +1,2 @@
+lasoren@chromium.org
+tbarzic@chromium.org
diff --git a/chromium/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc b/chromium/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
index 8c33f171949..e4116adadc8 100644
--- a/chromium/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
+++ b/chromium/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
@@ -20,7 +20,7 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/arc/extensions/arc_support_message_host.h"
-#include "chrome/browser/chromeos/diagnosticsd/diagnosticsd_messaging.h"
+#include "chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_messaging.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/common/constants.h"
@@ -127,8 +127,8 @@ static const BuiltInHost kBuiltInHost[] = {
{arc::ArcSupportMessageHost::kHostName,
arc::ArcSupportMessageHost::kHostOrigin, 1,
&arc::ArcSupportMessageHost::Create},
- {chromeos::kDiagnosticsdUiMessageHost, nullptr, 0,
- &chromeos::CreateExtensionOwnedDiagnosticsdMessageHost},
+ {chromeos::kWilcoDtcSupportdUiMessageHost, nullptr, 0,
+ &chromeos::CreateExtensionOwnedWilcoDtcSupportdMessageHost},
};
bool MatchesSecurityOrigin(const BuiltInHost& host,
diff --git a/chromium/chrome/browser/extensions/api/networking_cast_private/networking_cast_private_apitest.cc b/chromium/chrome/browser/extensions/api/networking_cast_private/networking_cast_private_apitest.cc
index 5dbe11e7880..c39fd6e8256 100644
--- a/chromium/chrome/browser/extensions/api/networking_cast_private/networking_cast_private_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/networking_cast_private/networking_cast_private_apitest.cc
@@ -20,8 +20,8 @@
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/shill_device_client.h"
-#include "chromeos/dbus/shill_service_client.h"
+#include "chromeos/dbus/shill/shill_device_client.h"
+#include "chromeos/dbus/shill/shill_service_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#endif
diff --git a/chromium/chrome/browser/extensions/api/networking_config_chromeos_apitest_chromeos.cc b/chromium/chrome/browser/extensions/api/networking_config_chromeos_apitest_chromeos.cc
index 02c0f7c57e3..c27a9c45862 100644
--- a/chromium/chrome/browser/extensions/api/networking_config_chromeos_apitest_chromeos.cc
+++ b/chromium/chrome/browser/extensions/api/networking_config_chromeos_apitest_chromeos.cc
@@ -17,9 +17,9 @@
#include "chrome/browser/notifications/notification_display_service_tester.h"
#include "chrome/browser/ui/ash/network/network_portal_notification_controller.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/shill_device_client.h"
-#include "chromeos/dbus/shill_profile_client.h"
-#include "chromeos/dbus/shill_service_client.h"
+#include "chromeos/dbus/shill/shill_device_client.h"
+#include "chromeos/dbus/shill/shill_profile_client.h"
+#include "chromeos/dbus/shill/shill_service_client.h"
#include "components/captive_portal/captive_portal_testing_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/test/result_catcher.h"
diff --git a/chromium/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc b/chromium/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
index 23d4a382561..d21e9f5eb97 100644
--- a/chromium/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
@@ -23,13 +23,13 @@
#include "chrome/browser/extensions/extension_apitest.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/cryptohome/cryptohome_parameters.h"
-#include "chromeos/dbus/cryptohome_client.h"
+#include "chromeos/dbus/cryptohome/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/shill_device_client.h"
-#include "chromeos/dbus/shill_ipconfig_client.h"
-#include "chromeos/dbus/shill_manager_client.h"
-#include "chromeos/dbus/shill_profile_client.h"
-#include "chromeos/dbus/shill_service_client.h"
+#include "chromeos/dbus/shill/shill_device_client.h"
+#include "chromeos/dbus/shill/shill_ipconfig_client.h"
+#include "chromeos/dbus/shill/shill_manager_client.h"
+#include "chromeos/dbus/shill/shill_profile_client.h"
+#include "chromeos/dbus/shill/shill_service_client.h"
#include "chromeos/network/managed_network_configuration_handler.h"
#include "chromeos/network/network_certificate_handler.h"
#include "chromeos/network/network_handler.h"
@@ -225,7 +225,7 @@ class NetworkingPrivateChromeOSApiTest : public extensions::ExtensionApiTest {
user_manager::User* user = user_manager->GetActiveUser();
CHECK(user);
std::string userhash;
- DBusThreadManager::Get()->GetCryptohomeClient()->GetSanitizedUsername(
+ CryptohomeClient::Get()->GetSanitizedUsername(
cryptohome::CreateAccountIdentifierFromAccountId(user->GetAccountId()),
base::BindOnce(
[](std::string* out, base::Optional<std::string> result) {
diff --git a/chromium/chrome/browser/extensions/api/notifications/extension_notification_display_helper.cc b/chromium/chrome/browser/extensions/api/notifications/extension_notification_display_helper.cc
index 1e3bff2588d..b140a5d1c14 100644
--- a/chromium/chrome/browser/extensions/api/notifications/extension_notification_display_helper.cc
+++ b/chromium/chrome/browser/extensions/api/notifications/extension_notification_display_helper.cc
@@ -31,7 +31,7 @@ void ExtensionNotificationDisplayHelper::Display(
std::make_unique<message_center::Notification>(notification));
GetDisplayService()->Display(NotificationHandler::Type::EXTENSION,
- notification);
+ notification, /*metadata=*/nullptr);
}
message_center::Notification*
diff --git a/chromium/chrome/browser/extensions/api/page_capture/page_capture_api.cc b/chromium/chrome/browser/extensions/api/page_capture/page_capture_api.cc
index 3edc8b9f1ce..0d7ad81a62c 100644
--- a/chromium/chrome/browser/extensions/api/page_capture/page_capture_api.cc
+++ b/chromium/chrome/browser/extensions/api/page_capture/page_capture_api.cc
@@ -23,8 +23,6 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
-#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/mhtml_generation_params.h"
#include "extensions/common/extension_messages.h"
@@ -278,9 +276,8 @@ void PageCaptureSaveAsMHTMLFunction::ReturnSuccess(int64_t file_size) {
return;
}
- int child_id = render_frame_host()->GetProcess()->GetID();
- ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(
- child_id, mhtml_path_);
+ ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(source_process_id(),
+ mhtml_path_);
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("mhtmlFilePath", mhtml_path_.value());
diff --git a/chromium/chrome/browser/extensions/api/permissions/permissions_api_unittest.cc b/chromium/chrome/browser/extensions/api/permissions/permissions_api_unittest.cc
index dfb7fcfd7db..4a2b0dfcc5b 100644
--- a/chromium/chrome/browser/extensions/api/permissions/permissions_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/permissions/permissions_api_unittest.cc
@@ -7,7 +7,6 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/strings/stringprintf.h"
-#include "base/test/scoped_feature_list.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/extensions/extension_api_unittest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
@@ -21,7 +20,6 @@
#include "components/crx_file/id_util.h"
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/common/extension_builder.h"
-#include "extensions/common/extension_features.h"
#include "extensions/common/manifest_handlers/permissions_parser.h"
#include "extensions/test/test_extension_dir.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -201,11 +199,6 @@ TEST_F(PermissionsAPIUnitTest, Contains) {
}
TEST_F(PermissionsAPIUnitTest, ContainsAndGetAllWithRuntimeHostPermissions) {
- // This test relies on the click-to-script feature.
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
constexpr char kExampleCom[] = "https://example.com/*";
constexpr char kContentScriptCom[] = "https://contentscript.com/*";
scoped_refptr<const Extension> extension =
@@ -312,10 +305,6 @@ TEST_F(PermissionsAPIUnitTest, ContainsAndGetAllWithRuntimeHostPermissions) {
// Tests requesting withheld permissions with the permissions.request() API.
TEST_F(PermissionsAPIUnitTest, RequestingWithheldPermissions) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
// Create an extension with required host permissions, and withhold those
// permissions.
scoped_refptr<const Extension> extension =
@@ -353,10 +342,6 @@ TEST_F(PermissionsAPIUnitTest, RequestingWithheldPermissions) {
// Tests requesting withheld content script permissions with the
// permissions.request() API.
TEST_F(PermissionsAPIUnitTest, RequestingWithheldContentScriptPermissions) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
constexpr char kContentScriptPattern[] = "https://contentscript.com/*";
// Create an extension with required host permissions, and withhold those
// permissions.
@@ -395,10 +380,6 @@ TEST_F(PermissionsAPIUnitTest, RequestingWithheldContentScriptPermissions) {
// scriptable host with the permissions.request() API.
TEST_F(PermissionsAPIUnitTest,
RequestingWithheldExplicitAndScriptablePermissionsInTheSameCall) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
constexpr char kContentScriptPattern[] = "https://example.com/*";
// Create an extension with required host permissions, and withhold those
// permissions.
@@ -437,10 +418,6 @@ TEST_F(PermissionsAPIUnitTest,
// Tests an extension re-requesting an optional host after the user removes it.
TEST_F(PermissionsAPIUnitTest, ReRequestingWithheldOptionalPermissions) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
// Create an extension an optional host permissions, and withhold those
// permissions.
scoped_refptr<const Extension> extension =
@@ -497,10 +474,6 @@ TEST_F(PermissionsAPIUnitTest, ReRequestingWithheldOptionalPermissions) {
// Tests requesting both optional and withheld permissions in the same call to
// permissions.request().
TEST_F(PermissionsAPIUnitTest, RequestingWithheldAndOptionalPermissions) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
// Create an extension with required and optional host permissions, and
// withhold the required permissions.
scoped_refptr<const Extension> extension =
@@ -547,10 +520,6 @@ TEST_F(PermissionsAPIUnitTest, RequestingWithheldAndOptionalPermissions) {
// Tests requesting permissions that weren't specified in the manifest (either
// in optional permissions or in required permissions).
TEST_F(PermissionsAPIUnitTest, RequestingPermissionsNotSpecifiedInManifest) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
// Create an extension with required and optional host permissions, and
// withhold the required permissions.
scoped_refptr<const Extension> extension =
@@ -590,10 +559,6 @@ TEST_F(PermissionsAPIUnitTest, RequestingPermissionsNotSpecifiedInManifest) {
// Tests requesting withheld permissions that have already been granted.
TEST_F(PermissionsAPIUnitTest, RequestingAlreadyGrantedWithheldPermissions) {
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
// Create an extension with required host permissions, withhold host
// permissions, and then grant one of the hosts.
scoped_refptr<const Extension> extension =
diff --git a/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.cc b/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.cc
index 1ade97a33f5..e52211c6fd8 100644
--- a/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.cc
+++ b/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.cc
@@ -14,10 +14,9 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_session_manager_client.h"
-#include "chromeos/dbus/session_manager_client.h"
+#include "chromeos/dbus/session_manager/fake_session_manager_client.h"
#include "components/policy/core/browser/browser_policy_connector.h"
+#include "components/policy/core/common/cloud/policy_builder.h"
#include "components/policy/policy_constants.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@@ -94,21 +93,20 @@ void PlatformKeysTestBase::SetUpCommandLine(base::CommandLine* command_line) {
void PlatformKeysTestBase::SetUpInProcessBrowserTestFixture() {
extensions::ExtensionApiTest::SetUpInProcessBrowserTestFixture();
- chromeos::FakeSessionManagerClient* fake_session_manager_client =
- new chromeos::FakeSessionManagerClient;
- chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient(
- std::unique_ptr<chromeos::SessionManagerClient>(
- fake_session_manager_client));
+ chromeos::SessionManagerClient::InitializeFakeInMemory();
policy::AffiliationTestHelper affiliation_helper =
policy::AffiliationTestHelper::CreateForCloud(
- fake_session_manager_client);
+ chromeos::FakeSessionManagerClient::Get());
if (enrollment_status() == EnrollmentStatus::ENROLLED) {
std::set<std::string> device_affiliation_ids;
device_affiliation_ids.insert(kAffiliationID);
ASSERT_NO_FATAL_FAILURE(affiliation_helper.SetDeviceAffiliationIDs(
&device_policy_test_helper_, device_affiliation_ids));
+ install_attributes_.Get()->SetCloudManaged(
+ policy::PolicyBuilder::kFakeDomain,
+ policy::PolicyBuilder::kFakeDeviceId);
}
if (user_status() == UserStatus::MANAGED_AFFILIATED_DOMAIN) {
diff --git a/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.h b/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.h
index 75f525973bd..02f70c5effe 100644
--- a/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.h
+++ b/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_test_base.h
@@ -11,6 +11,7 @@
#include "chrome/browser/chromeos/login/test/https_forwarder.h"
#include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
#include "chrome/browser/extensions/extension_apitest.h"
+#include "chromeos/tpm/stub_install_attributes.h"
#include "components/account_id/account_id.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "google_apis/gaia/fake_gaia.h"
@@ -99,6 +100,7 @@ class PlatformKeysTestBase : public extensions::ExtensionApiTest {
policy::MockConfigurationPolicyProvider mock_policy_provider_;
FakeGaia fake_gaia_;
chromeos::HTTPSForwarder gaia_https_forwarder_;
+ chromeos::ScopedStubInstallAttributes install_attributes_;
DISALLOW_COPY_AND_ASSIGN(PlatformKeysTestBase);
};
diff --git a/chromium/chrome/browser/extensions/api/preference/preference_api.cc b/chromium/chrome/browser/extensions/api/preference/preference_api.cc
index 287a4d9e925..a66fafe99fb 100644
--- a/chromium/chrome/browser/extensions/api/preference/preference_api.cc
+++ b/chromium/chrome/browser/extensions/api/preference/preference_api.cc
@@ -82,7 +82,7 @@ const char kConversionErrorMessage[] =
"properly.";
const PrefMappingEntry kPrefMapping[] = {
- {"spdy_proxy.enabled", prefs::kDataSaverEnabled,
+ {"spdy_proxy.enabled", data_reduction_proxy::prefs::kDataSaverEnabled,
APIPermission::kDataReductionProxy, APIPermission::kDataReductionProxy},
{"data_reduction.daily_original_length",
data_reduction_proxy::prefs::kDailyHttpOriginalContentLength,
diff --git a/chromium/chrome/browser/extensions/api/preference/preferences_private_apitest.cc b/chromium/chrome/browser/extensions/api/preference/preferences_private_apitest.cc
deleted file mode 100644
index 0dd2f8c7dc0..00000000000
--- a/chromium/chrome/browser/extensions/api/preference/preferences_private_apitest.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/extensions/extension_apitest.h"
-#include "extensions/common/switches.h"
-
-namespace extensions {
-
-class PreferencesPrivateApiTest : public ExtensionApiTest {
- public:
- PreferencesPrivateApiTest() {}
- ~PreferencesPrivateApiTest() override {}
-
- void SetUpCommandLine(base::CommandLine* command_line) override {
- ExtensionApiTest::SetUpCommandLine(command_line);
- command_line->AppendSwitchASCII(switches::kWhitelistedExtensionID,
- "cpfhkdbjfdgdebcjlifoldbijinjfifp");
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PreferencesPrivateApiTest);
-};
-
-IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, TestEasyUnlockEvent) {
- ASSERT_TRUE(RunExtensionTest("preferences_private")) << message_;
-}
-
-} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/processes/processes_api.cc b/chromium/chrome/browser/extensions/api/processes/processes_api.cc
index d2f3c290e86..462bda64f31 100644
--- a/chromium/chrome/browser/extensions/api/processes/processes_api.cc
+++ b/chromium/chrome/browser/extensions/api/processes/processes_api.cc
@@ -94,6 +94,9 @@ api::processes::ProcessType GetProcessType(
case task_manager::Task::NACL:
return api::processes::PROCESS_TYPE_NACL;
+ case task_manager::Task::SERVICE_WORKER:
+ return api::processes::PROCESS_TYPE_SERVICE_WORKER;
+
case task_manager::Task::UTILITY:
return api::processes::PROCESS_TYPE_UTILITY;
@@ -681,7 +684,7 @@ void ProcessesGetProcessInfoFunction::GatherDataAndRespond(
// Report the invalid host ids sent in the arguments.
for (const auto& host_id : process_host_ids_) {
WriteToConsole(
- content::CONSOLE_MESSAGE_LEVEL_ERROR,
+ blink::mojom::ConsoleMessageLevel::kError,
ErrorUtils::FormatErrorMessage(errors::kProcessNotFound,
base::NumberToString(host_id)));
}
diff --git a/chromium/chrome/browser/extensions/api/processes/processes_apitest.cc b/chromium/chrome/browser/extensions/api/processes/processes_apitest.cc
index c470ed46677..b8febd5f821 100644
--- a/chromium/chrome/browser/extensions/api/processes/processes_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/processes/processes_apitest.cc
@@ -33,7 +33,7 @@ IN_PROC_BROWSER_TEST_F(ProcessesApiTest, DISABLED_Processes) {
ASSERT_TRUE(RunExtensionTest("processes/api")) << message_;
}
-IN_PROC_BROWSER_TEST_F(ProcessesApiTest, ProcessesApiListeners) {
+IN_PROC_BROWSER_TEST_F(ProcessesApiTest, DISABLED_ProcessesApiListeners) {
EXPECT_EQ(0, GetListenersCount());
// Load extension that adds a listener in background page
diff --git a/chromium/chrome/browser/extensions/api/resources_private/resources_private_api.cc b/chromium/chrome/browser/extensions/api/resources_private/resources_private_api.cc
index cc6e3d5bb51..ab229e48872 100644
--- a/chromium/chrome/browser/extensions/api/resources_private/resources_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/resources_private/resources_private_api.cc
@@ -14,6 +14,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "pdf/buildflags.h"
+#include "printing/buildflags/buildflags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
@@ -21,6 +22,10 @@
#include "pdf/pdf_features.h"
#endif
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
+#include "chrome/common/chrome_features.h"
+#endif
+
// To add a new component to this API, simply:
// 1. Add your component to the Component enum in
// chrome/common/extensions/api/resources_private.idl
@@ -121,6 +126,11 @@ void AddAdditionalDataForPdf(base::DictionaryValue* dict) {
base::Value(base::FeatureList::IsEnabled(
chrome_pdf::features::kPDFAnnotations)));
#endif
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
+ dict->SetKey("newPrintPreviewLayoutEnabled",
+ base::Value(base::FeatureList::IsEnabled(
+ features::kNewPrintPreviewLayout)));
+#endif
}
} // namespace
diff --git a/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc b/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc
index d755321a27b..06c58128a08 100644
--- a/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc
+++ b/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc
@@ -40,7 +40,7 @@
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/power_manager_client.h"
+#include "chromeos/dbus/power/power_manager_client.h"
#include "components/user_manager/user_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#endif
diff --git a/chromium/chrome/browser/extensions/api/sessions/sessions_api.cc b/chromium/chrome/browser/extensions/api/sessions/sessions_api.cc
index 0fc05940719..7156357f02b 100644
--- a/chromium/chrome/browser/extensions/api/sessions/sessions_api.cc
+++ b/chromium/chrome/browser/extensions/api/sessions/sessions_api.cc
@@ -246,8 +246,9 @@ SessionsGetDevicesFunction::CreateWindowModel(
continue;
const sessions::SerializedNavigationEntry& current_navigation =
tab->navigations.at(tab->normalized_navigation_index());
- if (search::IsNTPURL(current_navigation.virtual_url(),
- Profile::FromBrowserContext(browser_context()))) {
+ if (search::IsNTPOrRelatedURL(
+ current_navigation.virtual_url(),
+ Profile::FromBrowserContext(browser_context()))) {
continue;
}
tabs_in_window.push_back(tab);
diff --git a/chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc b/chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc
index c25e1372721..f8fc80c5b23 100644
--- a/chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc
@@ -22,14 +22,12 @@
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/sync/device_info_sync_service_factory.h"
#include "chrome/browser/sync/session_sync_service_factory.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_browser_process.h"
#include "components/sync/base/hash_util.h"
-#include "components/sync/device_info/device_info_sync_service.h"
#include "components/sync/engine/data_type_activation_response.h"
#include "components/sync/model/data_type_activation_request.h"
#include "components/sync/model/model_type_controller_delegate.h"
@@ -182,8 +180,6 @@ void ExtensionSessionsTest::SetUpCommandLine(base::CommandLine* command_line) {
void ExtensionSessionsTest::SetUpOnMainThread() {
CreateTestExtension();
- DeviceInfoSyncServiceFactory::GetForProfile(browser()->profile())
- ->InitLocalCacheGuid(kTestCacheGuid, "machine name");
}
void ExtensionSessionsTest::CreateTestExtension() {
@@ -237,19 +233,21 @@ void ExtensionSessionsTest::CreateSessionModels() {
// sessions (anything older than 14 days), so we cannot use
// MockModelTypeWorker's convenience functions, which internally use very
// old timestamps.
- syncer::EntityData header_entity_data;
- header_entity_data.client_tag_hash =
+ auto header_entity_data = std::make_unique<syncer::EntityData>();
+ header_entity_data->client_tag_hash =
TagHashFromSpecifics(header_entity.session());
- header_entity_data.id = "FakeId:" + header_entity_data.client_tag_hash;
- header_entity_data.specifics = header_entity;
- header_entity_data.creation_time =
+ header_entity_data->id = "FakeId:" + header_entity_data->client_tag_hash;
+ header_entity_data->specifics = header_entity;
+ header_entity_data->creation_time =
time_now - base::TimeDelta::FromSeconds(index);
- header_entity_data.modification_time = header_entity_data.creation_time;
-
- syncer::UpdateResponseData header_update;
- header_update.entity = header_entity_data.PassToPtr();
- header_update.response_version = 1;
- worker.UpdateFromServer({header_update});
+ header_entity_data->modification_time = header_entity_data->creation_time;
+
+ auto header_update = std::make_unique<syncer::UpdateResponseData>();
+ header_update->entity = std::move(header_entity_data);
+ header_update->response_version = 1;
+ syncer::UpdateResponseDataList updates;
+ updates.push_back(std::move(header_update));
+ worker.UpdateFromServer(std::move(updates));
for (size_t i = 0; i < tabs.size(); i++) {
sync_pb::EntitySpecifics tab_entity;
diff --git a/chromium/chrome/browser/extensions/api/settings_private/generated_time_zone_pref_base.cc b/chromium/chrome/browser/extensions/api/settings_private/generated_time_zone_pref_base.cc
index de95d889123..133958aba26 100644
--- a/chromium/chrome/browser/extensions/api/settings_private/generated_time_zone_pref_base.cc
+++ b/chromium/chrome/browser/extensions/api/settings_private/generated_time_zone_pref_base.cc
@@ -37,7 +37,7 @@ void GeneratedTimeZonePrefBase::OnTimeZoneResolverUpdated() {
void GeneratedTimeZonePrefBase::UpdateTimeZonePrefControlledBy(
settings_api::PrefObject* out_pref) const {
if (profile_->IsChild()) {
- out_pref->controlled_by = settings_api::CONTROLLED_BY_USER_POLICY;
+ out_pref->controlled_by = settings_api::ControlledBy::CONTROLLED_BY_PARENT;
out_pref->enforcement = settings_api::ENFORCEMENT_ENFORCED;
} else if (chromeos::system::TimeZoneResolverManager::
IsTimeZoneResolutionPolicyControlled()) {
diff --git a/chromium/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chromium/chrome/browser/extensions/api/settings_private/prefs_util.cc
index 3f396fcd232..a69f602826a 100644
--- a/chromium/chrome/browser/extensions/api/settings_private/prefs_util.cc
+++ b/chromium/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -230,11 +230,13 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_api::PrefType::PREF_TYPE_LIST;
(*s_whitelist)[spellcheck::prefs::kSpellCheckForcedDictionaries] =
settings_api::PrefType::PREF_TYPE_LIST;
+ (*s_whitelist)[spellcheck::prefs::kSpellCheckBlacklistedDictionaries] =
+ settings_api::PrefType::PREF_TYPE_LIST;
(*s_whitelist)[spellcheck::prefs::kSpellCheckUseSpellingService] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[::prefs::kOfferTranslateEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
- (*s_whitelist)[translate::TranslatePrefs::kPrefTranslateBlockedLanguages] =
+ (*s_whitelist)[language::prefs::kFluentLanguages] =
settings_api::PrefType::PREF_TYPE_LIST;
#if defined(OS_CHROMEOS)
(*s_whitelist)[::prefs::kLanguageImeMenuActivated] =
@@ -323,6 +325,8 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_api::PrefType::PREF_TYPE_NUMBER;
(*s_whitelist)[ash::prefs::kAccessibilityAutoclickRevertToLeftClick] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
+ (*s_whitelist)[ash::prefs::kAccessibilityAutoclickStabilizePosition] =
+ settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[ash::prefs::kAccessibilityAutoclickMovementThreshold] =
settings_api::PrefType::PREF_TYPE_NUMBER;
(*s_whitelist)[ash::prefs::kAccessibilityCaretHighlightEnabled] =
@@ -369,8 +373,8 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
// Crostini
(*s_whitelist)[crostini::prefs::kCrostiniEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
- (*s_whitelist)[crostini::prefs::kCrostiniSharedPaths] =
- settings_api::PrefType::PREF_TYPE_LIST;
+ (*s_whitelist)[crostini::prefs::kGuestOSPathsSharedToVms] =
+ settings_api::PrefType::PREF_TYPE_DICTIONARY;
(*s_whitelist)[crostini::prefs::kCrostiniSharedUsbDevices] =
settings_api::PrefType::PREF_TYPE_LIST;
(*s_whitelist)[crostini::prefs::kCrostiniContainers] =
diff --git a/chromium/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc b/chromium/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
index 6f296a9a38f..688b3d057ff 100644
--- a/chromium/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
@@ -16,10 +16,9 @@
using syncer::DeviceInfo;
namespace extensions {
-bool VerifyDictionary(
- const std::string& path,
- const std::string& expected_value,
- const base::DictionaryValue& dictionary) {
+bool VerifyDictionary(const std::string& path,
+ const std::string& expected_value,
+ const base::DictionaryValue& dictionary) {
std::string out;
if (dictionary.GetString(path, &out)) {
return (out == expected_value);
@@ -33,11 +32,13 @@ TEST(IdMappingHelperTest, SetIdsForDevices) {
devices.push_back(std::make_unique<DeviceInfo>(
base::GenerateGUID(), "abc Device", "XYZ v1", "XYZ SyncAgent v1",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id1"));
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id1",
+ /*send_tab_to_self_receiving_enabled=*/true));
devices.push_back(std::make_unique<DeviceInfo>(
base::GenerateGUID(), "def Device", "XYZ v1", "XYZ SyncAgent v1",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id2"));
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id2",
+ /*send_tab_to_self_receiving_enabled=*/true));
base::DictionaryValue dictionary;
@@ -54,7 +55,8 @@ TEST(IdMappingHelperTest, SetIdsForDevices) {
// Now add a third device.
devices.push_back(std::make_unique<DeviceInfo>(
base::GenerateGUID(), "ghi Device", "XYZ v1", "XYZ SyncAgent v1",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id3"));
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id3",
+ /*send_tab_to_self_receiving_enabled=*/true));
CreateMappingForUnmappedDevices(devices, &dictionary);
diff --git a/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc b/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
index 5aad72b5aac..6bd0b8b49ba 100644
--- a/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
@@ -47,7 +47,8 @@ class MockDeviceInfoTracker : public DeviceInfoTracker {
return std::make_unique<DeviceInfo>(
device_info.guid(), device_info.client_name(),
device_info.chrome_version(), device_info.sync_user_agent(),
- device_info.device_type(), device_info.signin_scoped_device_id());
+ device_info.device_type(), device_info.signin_scoped_device_id(),
+ device_info.send_tab_to_self_receiving_enabled());
}
std::vector<std::unique_ptr<DeviceInfo>> GetAllDeviceInfo() const override {
@@ -70,6 +71,8 @@ class MockDeviceInfoTracker : public DeviceInfoTracker {
void Add(const DeviceInfo* device) { devices_.push_back(device); }
+ void ForcePulseForTest() override { NOTREACHED(); }
+
private:
// DeviceInfo stored here are not owned.
std::vector<const DeviceInfo*> devices_;
@@ -86,19 +89,13 @@ TEST(SignedInDevicesAPITest, GetSignedInDevices) {
scoped_refptr<Extension> extension_test =
extension_prefs.AddExtension(extension_name);
- DeviceInfo device_info1(base::GenerateGUID(),
- "abc Device",
- "XYZ v1",
- "XYZ SyncAgent v1",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
- "device_id");
+ DeviceInfo device_info1(
+ base::GenerateGUID(), "abc Device", "XYZ v1", "XYZ SyncAgent v1",
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", true);
- DeviceInfo device_info2(base::GenerateGUID(),
- "def Device",
- "XYZ v2",
- "XYZ SyncAgent v2",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
- "device_id");
+ DeviceInfo device_info2(
+ base::GenerateGUID(), "def Device", "XYZ v2", "XYZ SyncAgent v2",
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", true);
device_tracker.Add(&device_info1);
device_tracker.Add(&device_info2);
@@ -115,12 +112,9 @@ TEST(SignedInDevicesAPITest, GetSignedInDevices) {
// Add a third device and make sure the first 2 ids are retained and a new
// id is generated for the third device.
- DeviceInfo device_info3(base::GenerateGUID(),
- "def Device",
- "jkl v2",
- "XYZ SyncAgent v2",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
- "device_id");
+ DeviceInfo device_info3(
+ base::GenerateGUID(), "def Device", "jkl v2", "XYZ SyncAgent v2",
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", true);
device_tracker.Add(&device_info3);
@@ -154,9 +148,6 @@ class MockDeviceInfoSyncService : public syncer::DeviceInfoSyncService {
override {
return nullptr;
}
- void InitLocalCacheGuid(const std::string& cache_guid,
- const std::string& session_name) override {}
- void ClearLocalCacheGuid() override {}
private:
MockDeviceInfoTracker tracker_;
@@ -209,19 +200,13 @@ TEST_F(ExtensionSignedInDevicesTest, GetAll) {
DeviceInfoSyncServiceFactory::GetForProfile(profile()))
->mock_tracker();
- DeviceInfo device_info1(base::GenerateGUID(),
- "abc Device",
- "XYZ v1",
- "XYZ SyncAgent v1",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
- "device_id");
-
- DeviceInfo device_info2(base::GenerateGUID(),
- "def Device",
- "XYZ v2",
- "XYZ SyncAgent v2",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
- "device_id");
+ DeviceInfo device_info1(
+ base::GenerateGUID(), "abc Device", "XYZ v1", "XYZ SyncAgent v1",
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", true);
+
+ DeviceInfo device_info2(
+ base::GenerateGUID(), "def Device", "XYZ v2", "XYZ SyncAgent v2",
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", true);
device_tracker->Add(&device_info1);
device_tracker->Add(&device_info2);
diff --git a/chromium/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc b/chromium/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
index 678bf64f1e2..539c1a8a395 100644
--- a/chromium/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
@@ -13,7 +13,6 @@
#include "content/public/test/test_storage_partition.h"
#include "extensions/browser/api/socket/tcp_socket.h"
#include "net/base/address_list.h"
-#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
@@ -91,7 +90,8 @@ class TCPSocketUnitTestBase : public extensions::ExtensionServiceTestBase {
url_request_context_.Init();
network_context_ = std::make_unique<network::NetworkContext>(
nullptr, mojo::MakeRequest(&network_context_ptr_),
- &url_request_context_);
+ &url_request_context_,
+ /*cors_exempt_header_list=*/std::vector<std::string>());
partition_.set_network_context(network_context_ptr_.get());
}
diff --git a/chromium/chrome/browser/extensions/api/socket/tls_socket_unittest.cc b/chromium/chrome/browser/extensions/api/socket/tls_socket_unittest.cc
index dadab9219d0..bab030e25d8 100644
--- a/chromium/chrome/browser/extensions/api/socket/tls_socket_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/socket/tls_socket_unittest.cc
@@ -13,7 +13,6 @@
#include "content/public/test/test_storage_partition.h"
#include "extensions/browser/api/socket/tls_socket.h"
#include "net/base/address_list.h"
-#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
@@ -91,7 +90,8 @@ class TLSSocketTestBase : public extensions::ExtensionServiceTestBase {
url_request_context_.Init();
network_context_ = std::make_unique<network::NetworkContext>(
nullptr, mojo::MakeRequest(&network_context_ptr_),
- &url_request_context_);
+ &url_request_context_,
+ /*cors_exempt_header_list=*/std::vector<std::string>());
partition_.set_network_context(network_context_ptr_.get());
}
@@ -133,7 +133,6 @@ TEST_F(TLSSocketTest, DestroyWhileReadPending) {
net::StaticSocketDataProvider data_provider(kReads, kWrites);
mock_client_socket_factory()->AddSocketDataProvider(&data_provider);
net::SSLSocketDataProvider ssl_socket(net::ASYNC, net::OK);
- ssl_socket.expected_ssl_version_max = net::SSL_PROTOCOL_VERSION_TLS1_2;
mock_client_socket_factory()->AddSSLSocketDataProvider(&ssl_socket);
std::unique_ptr<TLSSocket> socket = CreateSocket();
@@ -227,6 +226,47 @@ TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptions) {
EXPECT_TRUE(ssl_socket.ConnectDataConsumed());
}
+// Test the API can parse "tls1.3".
+TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptionsTLS13) {
+ // Mock data are not consumed. These are here so that net::StreamSocket::Read
+ // is always pending and blocked on the write. Otherwise, mock socket data
+ // will complains that there aren't any data to read.
+ const net::MockRead kReads[] = {
+ net::MockRead(net::ASYNC, kTestMsg, kTestMsgLength, 1),
+ net::MockRead(net::ASYNC, net::OK, 2)};
+ const net::MockWrite kWrites[] = {
+ net::MockWrite(net::ASYNC, kTestMsg, kTestMsgLength, 0)};
+ net::SequencedSocketData data_provider(kReads, kWrites);
+ net::SSLSocketDataProvider ssl_socket(net::ASYNC, net::OK);
+ ssl_socket.expected_ssl_version_min = net::SSL_PROTOCOL_VERSION_TLS1_3;
+ ssl_socket.expected_ssl_version_max = net::SSL_PROTOCOL_VERSION_TLS1_3;
+ mock_client_socket_factory()->AddSocketDataProvider(&data_provider);
+ mock_client_socket_factory()->AddSSLSocketDataProvider(&ssl_socket);
+
+ auto socket = CreateTCPSocket();
+ network::mojom::TLSClientSocketPtr tls_socket_ptr;
+ api::socket::SecureOptions options;
+ options.tls_version = std::make_unique<api::socket::TLSVersionConstraints>();
+ options.tls_version->min = std::make_unique<std::string>("tls1.3");
+ options.tls_version->max = std::make_unique<std::string>("tls1.3");
+ int net_error = net::ERR_FAILED;
+ base::RunLoop run_loop;
+ socket->UpgradeToTLS(
+ &options,
+ base::BindLambdaForTesting(
+ [&](int result, network::mojom::TLSClientSocketPtr tls_socket_ptr,
+ const net::IPEndPoint& local_addr,
+ const net::IPEndPoint& peer_addr,
+ mojo::ScopedDataPipeConsumerHandle receive_handle,
+ mojo::ScopedDataPipeProducerHandle send_handle) {
+ net_error = result;
+ run_loop.Quit();
+ }));
+ run_loop.Run();
+ EXPECT_EQ(net::OK, net_error);
+ EXPECT_TRUE(ssl_socket.ConnectDataConsumed());
+}
+
INSTANTIATE_TEST_SUITE_P(/* no prefix */,
TLSSocketTest,
testing::Values(net::SYNCHRONOUS, net::ASYNC));
@@ -240,7 +280,6 @@ TEST_P(TLSSocketTest, ReadWrite) {
net::MockWrite(net::SYNCHRONOUS, kTestMsg, kTestMsgLength, 0)};
net::SequencedSocketData data_provider(kReads, kWrites);
net::SSLSocketDataProvider ssl_socket(io_mode, net::OK);
- ssl_socket.expected_ssl_version_max = net::SSL_PROTOCOL_VERSION_TLS1_2;
mock_client_socket_factory()->AddSocketDataProvider(&data_provider);
mock_client_socket_factory()->AddSSLSocketDataProvider(&ssl_socket);
std::unique_ptr<TLSSocket> socket = CreateSocket();
@@ -285,7 +324,6 @@ TEST_P(TLSSocketTest, PartialRead) {
net::MockWrite(net::SYNCHRONOUS, kTestMsg, kTestMsgLength, 0)};
net::SequencedSocketData data_provider(kReads, kWrites);
net::SSLSocketDataProvider ssl_socket(io_mode, net::OK);
- ssl_socket.expected_ssl_version_max = net::SSL_PROTOCOL_VERSION_TLS1_2;
mock_client_socket_factory()->AddSocketDataProvider(&data_provider);
mock_client_socket_factory()->AddSSLSocketDataProvider(&ssl_socket);
std::unique_ptr<TLSSocket> socket = CreateSocket();
@@ -330,7 +368,6 @@ TEST_P(TLSSocketTest, ReadError) {
net::MockWrite(net::SYNCHRONOUS, kTestMsg, kTestMsgLength, 0)};
net::SequencedSocketData data_provider(kReads, kWrites);
net::SSLSocketDataProvider ssl_socket(io_mode, net::OK);
- ssl_socket.expected_ssl_version_max = net::SSL_PROTOCOL_VERSION_TLS1_2;
mock_client_socket_factory()->AddSocketDataProvider(&data_provider);
mock_client_socket_factory()->AddSSLSocketDataProvider(&ssl_socket);
@@ -387,7 +424,6 @@ TEST_P(TLSSocketTest, MultipleWrite) {
1)};
net::SequencedSocketData data_provider(kReads, kWrites);
net::SSLSocketDataProvider ssl_socket(io_mode, net::OK);
- ssl_socket.expected_ssl_version_max = net::SSL_PROTOCOL_VERSION_TLS1_2;
mock_client_socket_factory()->AddSocketDataProvider(&data_provider);
mock_client_socket_factory()->AddSSLSocketDataProvider(&ssl_socket);
std::unique_ptr<TLSSocket> socket = CreateSocket();
@@ -422,7 +458,6 @@ TEST_P(TLSSocketTest, PartialWrite) {
net::SequencedSocketData data_provider(kReads, kWrites);
net::SSLSocketDataProvider ssl_socket(io_mode, net::OK);
- ssl_socket.expected_ssl_version_max = net::SSL_PROTOCOL_VERSION_TLS1_2;
mock_client_socket_factory()->AddSocketDataProvider(&data_provider);
mock_client_socket_factory()->AddSSLSocketDataProvider(&ssl_socket);
@@ -462,7 +497,6 @@ TEST_P(TLSSocketTest, WriteError) {
net::SequencedSocketData data_provider(kReads, kWrites);
net::SSLSocketDataProvider ssl_socket(io_mode, net::OK);
- ssl_socket.expected_ssl_version_max = net::SSL_PROTOCOL_VERSION_TLS1_2;
mock_client_socket_factory()->AddSocketDataProvider(&data_provider);
mock_client_socket_factory()->AddSSLSocketDataProvider(&ssl_socket);
std::unique_ptr<TLSSocket> socket = CreateSocket();
diff --git a/chromium/chrome/browser/extensions/api/socket/udp_socket_unittest.cc b/chromium/chrome/browser/extensions/api/socket/udp_socket_unittest.cc
index 826e89e5a37..5baa299ebe1 100644
--- a/chromium/chrome/browser/extensions/api/socket/udp_socket_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/socket/udp_socket_unittest.cc
@@ -79,9 +79,9 @@ TEST_F(UDPSocketUnitTest, TestUDPSocketRecvFrom) {
// Confirm that we can call two RecvFroms in quick succession without
// triggering crbug.com/146606.
socket->Connect(CreateAddressList("127.0.0.1", 40000),
- base::BindRepeating(&OnConnected));
- socket->RecvFrom(4096, base::BindRepeating(&OnCompleted));
- socket->RecvFrom(4096, base::BindRepeating(&OnCompleted));
+ base::BindOnce(&OnConnected));
+ socket->RecvFrom(4096, base::BindOnce(&OnCompleted));
+ socket->RecvFrom(4096, base::BindOnce(&OnCompleted));
}
TEST_F(UDPSocketUnitTest, TestUDPMulticastJoinGroup) {
@@ -123,7 +123,7 @@ TEST_F(UDPSocketUnitTest, TestUDPMulticastTimeToLive) {
EXPECT_NE(0, socket->SetMulticastTimeToLive(-1)); // Negative TTL shall fail.
EXPECT_EQ(0, socket->SetMulticastTimeToLive(3));
socket->Connect(CreateAddressList(kGroup, 13333),
- base::BindRepeating(&OnConnected));
+ base::BindOnce(&OnConnected));
}
TEST_F(UDPSocketUnitTest, TestUDPMulticastLoopbackMode) {
@@ -132,7 +132,7 @@ TEST_F(UDPSocketUnitTest, TestUDPMulticastLoopbackMode) {
EXPECT_EQ(0, socket->SetMulticastLoopbackMode(false));
socket->Connect(CreateAddressList(kGroup, 13333),
- base::BindRepeating(&OnConnected));
+ base::BindOnce(&OnConnected));
}
// Send a test multicast packet every second.
@@ -143,7 +143,7 @@ static void SendMulticastPacket(const base::Closure& quit_run_loop,
if (result == 0) {
scoped_refptr<net::IOBuffer> data =
base::MakeRefCounted<net::WrappedIOBuffer>(kTestMessage);
- src->Write(data, kTestMessageLength, base::BindRepeating(&OnSendCompleted));
+ src->Write(data, kTestMessageLength, base::BindOnce(&OnSendCompleted));
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::BindOnce(&SendMulticastPacket, quit_run_loop, src, result),
@@ -187,15 +187,15 @@ TEST_F(UDPSocketUnitTest, TestUDPMulticastRecv) {
}
base::RunLoop run_loop;
// |dest| is used with Bind(), so use RecvFrom() instead of Read().
- dest->RecvFrom(1024,
- base::BindRepeating(&OnMulticastReadCompleted,
- run_loop.QuitClosure(), &packet_received));
+ dest->RecvFrom(
+ 1024, base::BindOnce(&OnMulticastReadCompleted, run_loop.QuitClosure(),
+ &packet_received));
// Sender
EXPECT_EQ(0, src->SetMulticastTimeToLive(0));
- src->Connect(CreateAddressList(kGroup, kPort),
- base::BindRepeating(&SendMulticastPacket, run_loop.QuitClosure(),
- src.get()));
+ src->Connect(
+ CreateAddressList(kGroup, kPort),
+ base::BindOnce(&SendMulticastPacket, run_loop.QuitClosure(), src.get()));
// If not received within the test action timeout, quit the message loop.
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
diff --git a/chromium/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chromium/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
index ba3dfb2c234..d553819af02 100644
--- a/chromium/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
+++ b/chromium/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -13,13 +13,13 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/one_shot_event.h"
#include "base/scoped_observer.h"
#include "base/task/post_task.h"
#include "chrome/browser/extensions/api/storage/policy_value_store.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/policy/schema_registry_service.h"
-#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/storage/storage_schema_manifest_handler.h"
#include "components/policy/core/common/schema.h"
@@ -41,7 +41,6 @@
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
-#include "extensions/common/one_shot_event.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/profiles/profile_helper.h"
@@ -114,9 +113,7 @@ ManagedValueStoreCache::ExtensionTracker::ExtensionTracker(
: profile_(profile),
policy_domain_(policy_domain),
extension_registry_observer_(this),
- schema_registry_(
- policy::SchemaRegistryServiceFactory::GetForContext(profile)
- ->registry()),
+ schema_registry_(profile->GetPolicySchemaRegistryService()->registry()),
weak_factory_(this) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
// Load schemas when the extension system is ready. It might be ready now.
@@ -295,7 +292,7 @@ void ManagedValueStoreCache::OnPolicyServiceInitialized(
// The PolicyService now has all the initial policies ready. Send policy
// for all the managed extensions to their backing stores now.
policy::SchemaRegistry* registry =
- policy::SchemaRegistryServiceFactory::GetForContext(profile_)->registry();
+ profile_->GetPolicySchemaRegistryService()->registry();
const policy::ComponentMap* map =
registry->schema_map()->GetComponents(policy_domain_);
if (!map)
diff --git a/chromium/chrome/browser/extensions/api/storage/settings_apitest.cc b/chromium/chrome/browser/extensions/api/storage/settings_apitest.cc
index 4b1e25f7a40..52fdd9b11e4 100644
--- a/chromium/chrome/browser/extensions/api/storage/settings_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/storage/settings_apitest.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_system_factory.h"
#include "chrome/browser/policy/schema_registry_service.h"
-#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "components/policy/core/browser/browser_policy_connector.h"
@@ -35,7 +34,6 @@
#include "extensions/browser/api/storage/settings_namespace.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/extension_features.h"
#include "extensions/common/value_builder.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
@@ -420,7 +418,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ExtensionsSchemas) {
message_.clear();
policy::SchemaRegistry* registry =
- policy::SchemaRegistryServiceFactory::GetForContext(profile)->registry();
+ profile->GetPolicySchemaRegistryService()->registry();
ASSERT_TRUE(registry);
EXPECT_FALSE(registry->schema_map()->GetSchema(policy::PolicyNamespace(
policy::POLICY_DOMAIN_EXTENSIONS, kManagedStorageExtensionId)));
@@ -571,39 +569,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorageDisabled) {
<< message_;
}
-class StorageAreaApiTest : public ExtensionSettingsApiTest,
- public ::testing::WithParamInterface<bool> {
- public:
- StorageAreaApiTest() = default;
- ~StorageAreaApiTest() override = default;
-
- void SetUp() override {
- if (GetParam()) {
- scoped_feature_list_.InitAndEnableFeature(
- extensions_features::kNativeCrxBindings);
- } else {
- scoped_feature_list_.InitAndDisableFeature(
- extensions_features::kNativeCrxBindings);
- }
- ExtensionSettingsApiTest::SetUp();
- }
-
- private:
- base::test::ScopedFeatureList scoped_feature_list_;
-
- DISALLOW_COPY_AND_ASSIGN(StorageAreaApiTest);
-};
-
-IN_PROC_BROWSER_TEST_P(StorageAreaApiTest, StorageAreaOnChanged) {
+IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, StorageAreaOnChanged) {
ASSERT_TRUE(RunExtensionTest("settings/storage_area")) << message_;
}
-INSTANTIATE_TEST_SUITE_P(StorageAreaNativeBindings,
- StorageAreaApiTest,
- ::testing::Values(true));
-
-INSTANTIATE_TEST_SUITE_P(StorageAreaJSBindings,
- StorageAreaApiTest,
- ::testing::Values(false));
-
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/storage/sync_storage_backend.cc b/chromium/chrome/browser/extensions/api/storage/sync_storage_backend.cc
index 57c384a5b56..6e1cd48a154 100644
--- a/chromium/chrome/browser/extensions/api/storage/sync_storage_backend.cc
+++ b/chromium/chrome/browser/extensions/api/storage/sync_storage_backend.cc
@@ -140,6 +140,12 @@ std::set<std::string> SyncStorageBackend::GetKnownExtensionIDs(
return result;
}
+void SyncStorageBackend::WaitUntilReadyToSync(base::OnceClosure done) {
+ DCHECK(IsOnBackendSequence());
+ // This class is ready to sync immediately upon construction.
+ std::move(done).Run();
+}
+
syncer::SyncDataList SyncStorageBackend::GetAllSyncData(syncer::ModelType type)
const {
DCHECK(IsOnBackendSequence());
diff --git a/chromium/chrome/browser/extensions/api/storage/sync_storage_backend.h b/chromium/chrome/browser/extensions/api/storage/sync_storage_backend.h
index 5147da38111..f57cedb5f56 100644
--- a/chromium/chrome/browser/extensions/api/storage/sync_storage_backend.h
+++ b/chromium/chrome/browser/extensions/api/storage/sync_storage_backend.h
@@ -48,6 +48,7 @@ class SyncStorageBackend : public syncer::SyncableService {
virtual void DeleteStorage(const std::string& extension_id);
// syncer::SyncableService implementation.
+ void WaitUntilReadyToSync(base::OnceClosure done) override;
syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override;
syncer::SyncMergeResult MergeDataAndStartSyncing(
syncer::ModelType type,
diff --git a/chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.cc b/chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.cc
index 2e8503191f4..f23382b04c8 100644
--- a/chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.cc
+++ b/chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.cc
@@ -60,7 +60,7 @@ base::WeakPtr<SyncValueStoreCache> SyncValueStoreCache::AsWeakPtr() {
}
syncer::SyncableService* SyncValueStoreCache::GetSyncableService(
- syncer::ModelType type) const {
+ syncer::ModelType type) {
DCHECK(IsOnBackendSequence());
DCHECK(initialized_);
diff --git a/chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.h b/chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.h
index 9fa8516e093..39c0dab7633 100644
--- a/chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.h
+++ b/chromium/chrome/browser/extensions/api/storage/sync_value_store_cache.h
@@ -39,7 +39,7 @@ class SyncValueStoreCache : public ValueStoreCache {
~SyncValueStoreCache() override;
base::WeakPtr<SyncValueStoreCache> AsWeakPtr();
- syncer::SyncableService* GetSyncableService(syncer::ModelType type) const;
+ syncer::SyncableService* GetSyncableService(syncer::ModelType type);
// ValueStoreCache implementation:
void RunWithValueStoreForExtension(
diff --git a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.cc b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.cc
index 7b455d2834a..fe7bf28a214 100644
--- a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.cc
+++ b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.cc
@@ -22,6 +22,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/tracing.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/common/content_features.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
@@ -32,6 +33,7 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
+#include "services/service_manager/sandbox/features.h"
#include "third_party/zlib/google/compression_utils.h"
#include "ui/gl/gl_switches.h"
@@ -47,6 +49,15 @@ void TabCapturePerformanceTestBase::SetUp() {
// Because screen capture is involved, require pixel output.
EnablePixelOutput();
+ feature_list_.InitWithFeatures(
+ {
+ service_manager::features::kAudioServiceSandbox,
+ features::kAudioServiceAudioStreams,
+ features::kAudioServiceLaunchOnStartup,
+ features::kAudioServiceOutOfProcess,
+ },
+ {});
+
InProcessBrowserTest::SetUp();
}
diff --git a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h
index 51d0fd49dba..8a1c7146e19 100644
--- a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h
+++ b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/strings/string_piece.h"
+#include "base/test/scoped_feature_list.h"
#include "base/test/trace_event_analyzer.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -135,6 +136,9 @@ class TabCapturePerformanceTestBase : public InProcessBrowserTest {
const extensions::Extension* extension_ = nullptr;
+ // Manages the Audio Service feature set, enabled for these performance tests.
+ base::test::ScopedFeatureList feature_list_;
+
DISALLOW_COPY_AND_ASSIGN(TabCapturePerformanceTestBase);
};
diff --git a/chromium/chrome/browser/extensions/api/tabs/OWNERS b/chromium/chrome/browser/extensions/api/tabs/OWNERS
new file mode 100644
index 00000000000..53f28c0f19d
--- /dev/null
+++ b/chromium/chrome/browser/extensions/api/tabs/OWNERS
@@ -0,0 +1,2 @@
+# For Locked Fullscreen mode.
+per-file tabs_util*=isandrk@chromium.org
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc
index 08610ed2572..22717b0f96c 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
+#include "chrome/browser/extensions/api/tabs/tabs_util.h"
#include "chrome/browser/extensions/api/tabs/windows_util.h"
#include "chrome/browser/extensions/browser_extension_window_controller.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -35,6 +36,7 @@
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/extensions/window_controller_list.h"
+#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/resource_coordinator/tab_lifecycle_unit_external.h"
@@ -96,21 +98,6 @@
#include "ui/base/models/list_selection_model.h"
#include "ui/base/ui_base_types.h"
-#if defined(OS_CHROMEOS)
-#include "ash/public/cpp/window_pin_type.h"
-#include "ash/public/cpp/window_properties.h"
-#include "ash/public/interfaces/window_pin_type.mojom.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
-#include "chrome/browser/chromeos/arc/arc_util.h"
-#include "chrome/browser/ui/ash/chrome_screenshot_grabber.h"
-#include "chrome/browser/ui/browser_command_controller.h"
-#include "content/public/browser/devtools_agent_host.h"
-#include "ui/aura/window.h"
-#include "ui/base/clipboard/clipboard.h"
-#include "ui/base/clipboard/clipboard_types.h"
-#include "ui/base/ui_base_features.h"
-#endif
-
using content::BrowserThread;
using content::NavigationController;
using content::NavigationEntry;
@@ -290,51 +277,6 @@ bool ExtensionHasLockedFullscreenPermission(const Extension* extension) {
APIPermission::kLockWindowFullscreenPrivate);
}
-#if defined(OS_CHROMEOS)
-// TODO(isandrk, crbug.com/937786): Move platform specific code out of this
-// file.
-void SetLockedFullscreenState(Browser* browser, bool locked) {
- UMA_HISTOGRAM_BOOLEAN("Extensions.LockedFullscreenStateRequest", locked);
-
- aura::Window* window = browser->window()->GetNativeWindow();
- // TRUSTED_PINNED is used here because that one locks the window fullscreen
- // without allowing the user to exit (as opposed to regular PINNED).
- window->SetProperty(ash::kWindowPinTypeKey,
- locked ? ash::mojom::WindowPinType::TRUSTED_PINNED
- : ash::mojom::WindowPinType::NONE);
-
- // Update the set of available browser commands.
- browser->command_controller()->LockedFullscreenStateChanged();
-
- // Disallow screenshots in locked fullscreen mode.
- // TODO(isandrk, 816900): ChromeScreenshotGrabber isn't implemented in Mash
- // yet, remove this conditional when it becomes available.
- if (!features::IsMultiProcessMash())
- ChromeScreenshotGrabber::Get()->set_screenshots_allowed(!locked);
-
- // Reset the clipboard and kill dev tools when entering or exiting locked
- // fullscreen (security concerns).
- ui::Clipboard::GetForCurrentThread()->Clear(ui::CLIPBOARD_TYPE_COPY_PASTE);
- content::DevToolsAgentHost::DetachAllClients();
-
- // Disable ARC while in the locked fullscreen mode.
- arc::ArcSessionManager* const arc_session_manager =
- arc::ArcSessionManager::Get();
- Profile* const profile = browser->profile();
- if (arc_session_manager && arc::IsArcAllowedForProfile(profile)) {
- if (locked) {
- // Disable ARC, preserve data.
- arc_session_manager->RequestDisable();
- } else {
- // Re-enable ARC if needed.
- if (arc::IsArcPlayStoreEnabledForProfile(profile))
- arc_session_manager->RequestEnable();
- }
- }
-}
-
-#endif // defined(OS_CHROMEOS)
-
} // namespace
void ZoomModeToZoomSettings(ZoomController::ZoomMode zoom_mode,
@@ -697,15 +639,13 @@ ExtensionFunction::ResponseAction WindowsCreateFunction::Run() {
else
new_window->window()->ShowInactive();
-#if defined(OS_CHROMEOS)
// Lock the window fullscreen only after the new tab has been created
// (otherwise the tabstrip is empty), and window()->show() has been called
// (otherwise that resets the locked mode for devices in tablet mode).
if (create_data &&
create_data->state == windows::WINDOW_STATE_LOCKED_FULLSCREEN) {
- SetLockedFullscreenState(new_window, true);
+ tabs_util::SetLockedFullscreenState(new_window, true);
}
-#endif
std::unique_ptr<base::Value> result;
if (new_window->profile()->IsOffTheRecord() &&
@@ -739,35 +679,28 @@ ExtensionFunction::ResponseAction WindowsUpdateFunction::Run() {
// state (crbug.com/703733).
ReportRequestedWindowState(params->update_info.state);
- if (params->update_info.state == windows::WINDOW_STATE_LOCKED_FULLSCREEN &&
- !ExtensionHasLockedFullscreenPermission(extension())) {
- return RespondNow(
- Error(tabs_constants::kMissingLockWindowFullscreenPrivatePermission));
- }
-
-#if defined(OS_CHROMEOS)
- const bool is_window_trusted_pinned =
- ash::IsWindowTrustedPinned(browser->window());
// Don't allow locked fullscreen operations on a window without the proper
// permission (also don't allow any operations on a locked window if the
// extension doesn't have the permission).
- if (is_window_trusted_pinned &&
+ const bool is_locked_fullscreen =
+ platform_util::IsBrowserLockedFullscreen(browser);
+ if ((params->update_info.state == windows::WINDOW_STATE_LOCKED_FULLSCREEN ||
+ is_locked_fullscreen) &&
!ExtensionHasLockedFullscreenPermission(extension())) {
return RespondNow(
Error(tabs_constants::kMissingLockWindowFullscreenPrivatePermission));
}
// state will be WINDOW_STATE_NONE if the state parameter wasn't passed from
// the JS side, and in that case we don't want to change the locked state.
- if (is_window_trusted_pinned &&
+ if (is_locked_fullscreen &&
params->update_info.state != windows::WINDOW_STATE_LOCKED_FULLSCREEN &&
params->update_info.state != windows::WINDOW_STATE_NONE) {
- SetLockedFullscreenState(browser, false);
- } else if (!is_window_trusted_pinned &&
+ tabs_util::SetLockedFullscreenState(browser, false);
+ } else if (!is_locked_fullscreen &&
params->update_info.state ==
windows::WINDOW_STATE_LOCKED_FULLSCREEN) {
- SetLockedFullscreenState(browser, true);
+ tabs_util::SetLockedFullscreenState(browser, true);
}
-#endif
ui::WindowShowState show_state =
ConvertToWindowShowState(params->update_info.state);
@@ -873,13 +806,11 @@ ExtensionFunction::ResponseAction WindowsRemoveFunction::Run() {
return RespondNow(Error(error));
}
-#if defined(OS_CHROMEOS)
- if (ash::IsWindowTrustedPinned(browser->window()) &&
+ if (platform_util::IsBrowserLockedFullscreen(browser) &&
!ExtensionHasLockedFullscreenPermission(extension())) {
return RespondNow(
Error(tabs_constants::kMissingLockWindowFullscreenPrivatePermission));
}
-#endif
WindowController* controller = browser->extension_window_controller();
WindowController::Reason reason;
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.cc
index 5a173d489cd..88a4fc52aed 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.cc
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.cc
@@ -219,6 +219,9 @@ void TabsEventRouter::OnTabStripModelChanged(
}
break;
}
+ case TabStripModelChange::kGroupChanged:
+ // TODO(crbug.com/930988): Dispatch Tab Group-related events.
+ break;
case TabStripModelChange::kSelectionOnly:
break;
}
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_util.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_util.cc
new file mode 100644
index 00000000000..799ee4fcf28
--- /dev/null
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_util.cc
@@ -0,0 +1,13 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/api/tabs/tabs_util.h"
+
+namespace extensions {
+namespace tabs_util {
+
+void SetLockedFullscreenState(Browser* browser, bool locked) {}
+
+} // namespace tabs_util
+} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_util.h b/chromium/chrome/browser/extensions/api/tabs/tabs_util.h
new file mode 100644
index 00000000000..8b6e133a145
--- /dev/null
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_util.h
@@ -0,0 +1,24 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_UTIL_H_
+#define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_UTIL_H_
+
+// Use this file for platform specific code. Declare any functions in here, and
+// then define an empty implementation in tabs_util.cc, and put the actual code
+// in eg. tabs_util_chromeos.cc.
+
+class Browser;
+
+namespace extensions {
+namespace tabs_util {
+
+// Set up the browser in the locked fullscreen state, and do any additional
+// necessary adjustments.
+void SetLockedFullscreenState(Browser* browser, bool locked);
+
+} // namespace tabs_util
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_UTIL_H_
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
new file mode 100644
index 00000000000..d09e42c33d2
--- /dev/null
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
@@ -0,0 +1,66 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/api/tabs/tabs_util.h"
+
+#include "ash/public/cpp/window_properties.h"
+#include "ash/public/interfaces/window_pin_type.mojom.h"
+#include "base/metrics/histogram_macros.h"
+#include "chrome/browser/chromeos/arc/arc_session_manager.h"
+#include "chrome/browser/chromeos/arc/arc_util.h"
+#include "chrome/browser/ui/ash/chrome_screenshot_grabber.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_command_controller.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "content/public/browser/devtools_agent_host.h"
+#include "ui/aura/window.h"
+#include "ui/base/clipboard/clipboard.h"
+#include "ui/base/clipboard/clipboard_types.h"
+#include "ui/base/ui_base_features.h"
+
+namespace extensions {
+namespace tabs_util {
+
+void SetLockedFullscreenState(Browser* browser, bool locked) {
+ UMA_HISTOGRAM_BOOLEAN("Extensions.LockedFullscreenStateRequest", locked);
+
+ aura::Window* window = browser->window()->GetNativeWindow();
+ // TRUSTED_PINNED is used here because that one locks the window fullscreen
+ // without allowing the user to exit (as opposed to regular PINNED).
+ window->SetProperty(ash::kWindowPinTypeKey,
+ locked ? ash::mojom::WindowPinType::TRUSTED_PINNED
+ : ash::mojom::WindowPinType::NONE);
+
+ // Update the set of available browser commands.
+ browser->command_controller()->LockedFullscreenStateChanged();
+
+ // Disallow screenshots in locked fullscreen mode.
+ // TODO(isandrk, 816900): ChromeScreenshotGrabber isn't implemented in Mash
+ // yet, remove this conditional when it becomes available.
+ if (!features::IsMultiProcessMash())
+ ChromeScreenshotGrabber::Get()->set_screenshots_allowed(!locked);
+
+ // Reset the clipboard and kill dev tools when entering or exiting locked
+ // fullscreen (security concerns).
+ ui::Clipboard::GetForCurrentThread()->Clear(ui::CLIPBOARD_TYPE_COPY_PASTE);
+ content::DevToolsAgentHost::DetachAllClients();
+
+ // Disable ARC while in the locked fullscreen mode.
+ arc::ArcSessionManager* const arc_session_manager =
+ arc::ArcSessionManager::Get();
+ Profile* const profile = browser->profile();
+ if (arc_session_manager && arc::IsArcAllowedForProfile(profile)) {
+ if (locked) {
+ // Disable ARC, preserve data.
+ arc_session_manager->RequestDisable();
+ } else {
+ // Re-enable ARC if needed.
+ if (arc::IsArcPlayStoreEnabledForProfile(profile))
+ arc_session_manager->RequestEnable();
+ }
+ }
+}
+
+} // namespace tabs_util
+} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc b/chromium/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
index 8b8787e3cfe..1aa88fcd3c2 100644
--- a/chromium/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
+++ b/chromium/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
@@ -362,10 +362,7 @@ void ChromeVirtualKeyboardDelegate::OnHasInputDevices(
keyboard::switches::kDisableGestureTyping)));
// TODO(https://crbug.com/890134): Implement gesture editing.
features->AppendString(GenerateFeatureFlag("gestureediting", false));
- features->AppendString(GenerateFeatureFlag(
- "fullscreenhandwriting",
- base::FeatureList::IsEnabled(
- features::kEnableFullscreenHandwritingVirtualKeyboard)));
+ features->AppendString(GenerateFeatureFlag("fullscreenhandwriting", false));
features->AppendString(GenerateFeatureFlag("virtualkeyboardmdui", true));
features->AppendString(GenerateFeatureFlag(
"imeservice", base::FeatureList::IsEnabled(
@@ -374,9 +371,7 @@ void ChromeVirtualKeyboardDelegate::OnHasInputDevices(
keyboard::mojom::KeyboardConfig config = keyboard_client->GetKeyboardConfig();
// TODO(oka): Change this to use config.voice_input.
features->AppendString(GenerateFeatureFlag(
- "voiceinput", has_audio_input_devices && config.voice_input &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- keyboard::switches::kDisableVoiceInput)));
+ "voiceinput", has_audio_input_devices && config.voice_input));
features->AppendString(
GenerateFeatureFlag("autocomplete", config.auto_complete));
features->AppendString(
@@ -388,8 +383,8 @@ void ChromeVirtualKeyboardDelegate::OnHasInputDevices(
"handwritinggesture",
base::FeatureList::IsEnabled(features::kHandwritingGesture)));
features->AppendString(GenerateFeatureFlag(
- "fstinputlogic", base::GetFieldTrialParamByFeatureAsBool(
- chromeos::features::kImeInputLogic, "fst", false)));
+ "fstinputlogic",
+ base::FeatureList::IsEnabled(chromeos::features::kImeInputLogicFst)));
results->Set("features", std::move(features));
diff --git a/chromium/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc b/chromium/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
index c0830facf71..f7f0ce9b47f 100644
--- a/chromium/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
@@ -13,10 +13,10 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_shill_profile_client.h"
-#include "chromeos/dbus/fake_shill_service_client.h"
-#include "chromeos/dbus/fake_shill_third_party_vpn_driver_client.h"
+#include "chromeos/dbus/shill/fake_shill_third_party_vpn_driver_client.h"
+#include "chromeos/dbus/shill/shill_clients.h"
+#include "chromeos/dbus/shill/shill_profile_client.h"
+#include "chromeos/dbus/shill/shill_service_client.h"
#include "chromeos/network/network_configuration_handler.h"
#include "chromeos/network/network_profile_handler.h"
#include "content/public/browser/browser_context.h"
@@ -122,17 +122,15 @@ class VpnProviderApiTest : public extensions::ExtensionApiTest {
void SetUpInProcessBrowserTestFixture() override {
extensions::ExtensionApiTest::SetUpInProcessBrowserTestFixture();
+ // Destroy the existing client and create a test specific fake client. It
+ // will be destroyed in ChromeBrowserMain.
test_client_ = new TestShillThirdPartyVpnDriverClient();
- DBusThreadManager::GetSetterForTesting()->SetShillThirdPartyVpnDriverClient(
- base::WrapUnique(test_client_));
}
void AddNetworkProfileForUser() {
- static_cast<FakeShillProfileClient*>(
- DBusThreadManager::Get()->GetShillProfileClient())
- ->AddProfile(
- kNetworkProfilePath,
- chromeos::ProfileHelper::GetUserIdHashFromProfile(profile()));
+ ShillProfileClient::Get()->GetTestInterface()->AddProfile(
+ kNetworkProfilePath,
+ chromeos::ProfileHelper::GetUserIdHashFromProfile(profile()));
content::RunAllPendingInMessageLoop();
}
@@ -191,7 +189,7 @@ class VpnProviderApiTest : public extensions::ExtensionApiTest {
}
protected:
- TestShillThirdPartyVpnDriverClient* test_client_ = nullptr;
+ TestShillThirdPartyVpnDriverClient* test_client_ = nullptr; // Unowned
VpnService* service_ = nullptr;
std::string extension_id_;
std::string service_path_;
@@ -217,10 +215,8 @@ IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, CreateConfig) {
const std::string service_path = GetSingleServicePath();
std::string profile_path;
base::DictionaryValue properties;
- EXPECT_TRUE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_TRUE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
}
IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, DestroyConfig) {
@@ -231,17 +227,13 @@ IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, DestroyConfig) {
const std::string service_path = GetSingleServicePath();
std::string profile_path;
base::DictionaryValue properties;
- EXPECT_TRUE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_TRUE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
EXPECT_TRUE(RunExtensionTest("destroyConfigSuccess"));
EXPECT_FALSE(DoesConfigExist(kTestConfig));
- EXPECT_FALSE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_FALSE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
}
IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, DestroyConnectedConfig) {
@@ -253,10 +245,8 @@ IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, DestroyConnectedConfig) {
const std::string service_path = GetSingleServicePath();
std::string profile_path;
base::DictionaryValue properties;
- EXPECT_TRUE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_TRUE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
EXPECT_FALSE(IsConfigConnected());
const std::string object_path = shill::kObjectPathBase + GetKey(kTestConfig);
@@ -268,10 +258,8 @@ IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, DestroyConnectedConfig) {
EXPECT_TRUE(DestroyConfigForTest(kTestConfig));
EXPECT_FALSE(DoesConfigExist(kTestConfig));
- EXPECT_FALSE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_FALSE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
extensions::ResultCatcher catcher;
ASSERT_TRUE(catcher.GetNextResult());
@@ -285,10 +273,8 @@ IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, VpnSuccess) {
const std::string service_path = GetSingleServicePath();
std::string profile_path;
base::DictionaryValue properties;
- EXPECT_TRUE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_TRUE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
EXPECT_FALSE(IsConfigConnected());
const std::string object_path = shill::kObjectPathBase + GetKey(kTestConfig);
@@ -384,18 +370,14 @@ IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, CreateUninstall) {
const std::string service_path = GetSingleServicePath();
std::string profile_path;
base::DictionaryValue properties;
- EXPECT_TRUE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_TRUE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
UninstallExtension(extension_id_);
content::RunAllPendingInMessageLoop();
EXPECT_FALSE(DoesConfigExist(kTestConfig));
- EXPECT_FALSE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_FALSE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
}
IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, CreateDisable) {
@@ -407,10 +389,8 @@ IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, CreateDisable) {
const std::string service_path = GetSingleServicePath();
std::string profile_path;
base::DictionaryValue properties;
- EXPECT_TRUE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_TRUE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
extensions::ExtensionService* extension_service =
extensions::ExtensionSystem::Get(profile())->extension_service();
@@ -418,10 +398,8 @@ IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, CreateDisable) {
extension_id_, extensions::disable_reason::DISABLE_USER_ACTION);
content::RunAllPendingInMessageLoop();
EXPECT_FALSE(DoesConfigExist(kTestConfig));
- EXPECT_FALSE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_FALSE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
}
IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, CreateBlacklist) {
@@ -433,20 +411,16 @@ IN_PROC_BROWSER_TEST_F(VpnProviderApiTest, CreateBlacklist) {
const std::string service_path = GetSingleServicePath();
std::string profile_path;
base::DictionaryValue properties;
- EXPECT_TRUE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_TRUE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
extensions::ExtensionService* extension_service =
extensions::ExtensionSystem::Get(profile())->extension_service();
extension_service->BlacklistExtensionForTest(extension_id_);
content::RunAllPendingInMessageLoop();
EXPECT_FALSE(DoesConfigExist(kTestConfig));
- EXPECT_FALSE(DBusThreadManager::Get()
- ->GetShillProfileClient()
- ->GetTestInterface()
- ->GetService(service_path, &profile_path, &properties));
+ EXPECT_FALSE(ShillProfileClient::Get()->GetTestInterface()->GetService(
+ service_path, &profile_path, &properties));
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
index 04714c431b7..183514c8fb5 100644
--- a/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -6,6 +6,7 @@
#include <set>
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
@@ -112,7 +113,8 @@ class DelayLoadStartAndExecuteJavascript
rfh_->ExecuteJavaScriptWithUserGestureForTests(
base::UTF8ToUTF16(script_));
} else {
- rfh_->ExecuteJavaScriptForTests(base::UTF8ToUTF16(script_));
+ rfh_->ExecuteJavaScriptForTests(base::UTF8ToUTF16(script_),
+ base::NullCallback());
}
script_was_executed_ = true;
}
diff --git a/chromium/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chromium/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
index 4afd2d6e276..bb40cff88ca 100644
--- a/chromium/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -48,6 +48,7 @@
#include "extensions/browser/api/web_request/web_request_api_constants.h"
#include "extensions/browser/api/web_request/web_request_api_helpers.h"
#include "extensions/common/api/web_request.h"
+#include "extensions/common/constants.h"
#include "extensions/common/extension_messages.h"
#include "extensions/common/features/feature.h"
#include "google_apis/gaia/gaia_urls.h"
@@ -65,6 +66,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest-message.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-forward.h"
#if defined(OS_CHROMEOS)
#include "chromeos/login/login_state/scoped_test_public_session_login_state.h"
@@ -106,6 +108,8 @@ constexpr const char kExampleUrl[] = "http://example.com";
static void EventHandledOnIOThread(
void* profile,
+ int worker_thread_id,
+ int64_t service_worker_version_id,
const std::string& extension_id,
const std::string& event_name,
const std::string& sub_event_name,
@@ -113,7 +117,8 @@ static void EventHandledOnIOThread(
ExtensionWebRequestEventRouter::EventResponse* response) {
ExtensionWebRequestEventRouter::GetInstance()->OnEventHandled(
profile, extension_id, event_name, sub_event_name, request_id,
- 0 /* embedder_process_id */, 0 /* web_view_instance_id */, response);
+ 0 /* render_process_id */, 0 /* web_view_instance_id */, worker_thread_id,
+ service_worker_version_id, response);
}
// Returns whether |warnings| contains an extension for |extension_id|.
@@ -166,7 +171,7 @@ std::unique_ptr<net::URLRequest> CreateRequestHelper(
std::unique_ptr<net::URLRequest> request = context->CreateRequest(
url, net::DEFAULT_PRIORITY, delegate, TRAFFIC_ANNOTATION_FOR_TESTS);
content::ResourceRequestInfo::AllocateForTesting(
- request.get(), content::RESOURCE_TYPE_MAIN_FRAME, /*context*/ nullptr,
+ request.get(), content::ResourceType::kMainFrame, /*context*/ nullptr,
-1 /* render_process_id */, -1 /* render_view_id */,
-1 /* render_frame_id */, true /* is_main_frame */,
content::ResourceInterceptPolicy::kAllowNone, false /* is_async */,
@@ -296,10 +301,12 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceRedirect) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension1_id, extension1_id, events::FOR_TEST, kEventName,
kEventName + "/1", filter, ExtraInfoSpec::BLOCKING, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension2_id, extension2_id, events::FOR_TEST, kEventName,
kEventName + "/2", filter, ExtraInfoSpec::BLOCKING, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
net::URLRequestJobFactoryImpl job_factory;
@@ -323,35 +330,35 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceRedirect) {
response = new ExtensionWebRequestEventRouter::EventResponse(
extension1_id, base::Time::FromDoubleT(1));
response->new_url = not_chosen_redirect_url;
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension1_id, kEventName, kEventName + "/1",
- request->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension1_id, kEventName,
+ kEventName + "/1", request->identifier(), response));
// Extension2 response. Arrives second, and chosen because of install_time.
response = new ExtensionWebRequestEventRouter::EventResponse(
extension2_id, base::Time::FromDoubleT(2));
response->new_url = redirect_url;
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension2_id, kEventName, kEventName + "/2",
- request->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension2_id, kEventName,
+ kEventName + "/2", request->identifier(), response));
// Extension2 response to the redirected URL. Arrives first, and chosen.
response = new ExtensionWebRequestEventRouter::EventResponse(
extension2_id, base::Time::FromDoubleT(2));
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension2_id, kEventName, kEventName + "/2",
- request->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension2_id, kEventName,
+ kEventName + "/2", request->identifier(), response));
// Extension1 response to the redirected URL. Arrives second, and ignored.
response = new ExtensionWebRequestEventRouter::EventResponse(
extension1_id, base::Time::FromDoubleT(1));
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension1_id, kEventName, kEventName + "/1",
- request->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension1_id, kEventName,
+ kEventName + "/1", request->identifier(), response));
request->Start();
base::RunLoop().Run();
@@ -373,35 +380,35 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceRedirect) {
response = new ExtensionWebRequestEventRouter::EventResponse(
extension2_id, base::Time::FromDoubleT(2));
response->new_url = redirect_url;
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension2_id, kEventName, kEventName + "/2",
- request2->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension2_id, kEventName,
+ kEventName + "/2", request2->identifier(), response));
// Extension1 response. Arrives second, but ignored due to install_time.
response = new ExtensionWebRequestEventRouter::EventResponse(
extension1_id, base::Time::FromDoubleT(1));
response->new_url = not_chosen_redirect_url;
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension1_id, kEventName, kEventName + "/1",
- request2->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension1_id, kEventName,
+ kEventName + "/1", request2->identifier(), response));
// Extension2 response to the redirected URL. Arrives first, and chosen.
response = new ExtensionWebRequestEventRouter::EventResponse(
extension2_id, base::Time::FromDoubleT(2));
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension2_id, kEventName, kEventName + "/2",
- request2->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension2_id, kEventName,
+ kEventName + "/2", request2->identifier(), response));
// Extension1 response to the redirected URL. Arrives second, and ignored.
response = new ExtensionWebRequestEventRouter::EventResponse(
extension1_id, base::Time::FromDoubleT(1));
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension1_id, kEventName, kEventName + "/1",
- request2->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension1_id, kEventName,
+ kEventName + "/1", request2->identifier(), response));
request2->Start();
base::RunLoop().Run();
@@ -414,9 +421,11 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceRedirect) {
}
ExtensionWebRequestEventRouter::EventListener::ID id1(
- &profile_, extension1_id, kEventName + "/1", 0, 0);
+ &profile_, extension1_id, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener::ID id2(
- &profile_, extension2_id, kEventName + "/2", 0, 0);
+ &profile_, extension2_id, kEventName + "/2", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id1,
false);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id2,
@@ -434,10 +443,12 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceCancel) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension1_id, extension1_id, events::FOR_TEST, kEventName,
kEventName + "/1", filter, ExtraInfoSpec::BLOCKING, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension2_id, extension2_id, events::FOR_TEST, kEventName,
kEventName + "/2", filter, ExtraInfoSpec::BLOCKING, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
GURL request_url("about:blank");
@@ -454,20 +465,20 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceCancel) {
response = new ExtensionWebRequestEventRouter::EventResponse(
extension1_id, base::Time::FromDoubleT(1));
response->cancel = true;
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension1_id, kEventName, kEventName + "/1",
- request->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension1_id, kEventName,
+ kEventName + "/1", request->identifier(), response));
// Extension2 response. Arrives second, but has higher precedence
// due to its later install_time.
response = new ExtensionWebRequestEventRouter::EventResponse(
extension2_id, base::Time::FromDoubleT(2));
response->new_url = redirect_url;
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension2_id, kEventName, kEventName + "/2",
- request->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension2_id, kEventName,
+ kEventName + "/2", request->identifier(), response));
request->Start();
@@ -480,9 +491,11 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceCancel) {
EXPECT_EQ(0U, ipc_sender_.GetNumTasks());
ExtensionWebRequestEventRouter::EventListener::ID id1(
- &profile_, extension1_id, kEventName + "/1", 0, 0);
+ &profile_, extension1_id, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener::ID id2(
- &profile_, extension2_id, kEventName + "/2", 0, 0);
+ &profile_, extension2_id, kEventName + "/2", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id1,
false);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id2,
@@ -505,10 +518,13 @@ TEST_F(ExtensionWebRequestTest, SimulateChancelWhileBlocked) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id, extension_id, events::FOR_TEST, kEventName,
kEventName + "/1", filter, ExtraInfoSpec::BLOCKING, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id, extension_id, events::FOR_TEST, kEventName2,
- kEventName2 + "/1", filter, 0, 0, 0, ipc_sender_factory.GetWeakPtr());
+ kEventName2 + "/1", filter, 0, 0, 0, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId,
+ ipc_sender_factory.GetWeakPtr());
GURL request_url("about:blank");
std::unique_ptr<net::URLRequest> request = CreateRequest(request_url);
@@ -521,18 +537,18 @@ TEST_F(ExtensionWebRequestTest, SimulateChancelWhileBlocked) {
extension_id, base::Time::FromDoubleT(1));
GURL redirect_url("about:redirected");
response->new_url = redirect_url;
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, extension_id, kEventName, kEventName + "/1",
- request->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, extension_id, kEventName,
+ kEventName + "/1", request->identifier(), response));
base::RunLoop run_loop;
// Extension response for OnErrorOccurred: Terminate the message loop.
- ipc_sender_.PushTask(
- base::Bind(base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask),
- base::ThreadTaskRunnerHandle::Get(), FROM_HERE,
- run_loop.QuitWhenIdleClosure()));
+ ipc_sender_.PushTask(base::BindRepeating(
+ base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask),
+ base::ThreadTaskRunnerHandle::Get(), FROM_HERE,
+ run_loop.QuitWhenIdleClosure()));
request->Start();
// request->Start() will have submitted OnBeforeRequest by the time we cancel.
@@ -546,9 +562,11 @@ TEST_F(ExtensionWebRequestTest, SimulateChancelWhileBlocked) {
EXPECT_EQ(0U, ipc_sender_.GetNumTasks());
ExtensionWebRequestEventRouter::EventListener::ID id1(
- &profile_, extension_id, kEventName + "/1", 0, 0);
+ &profile_, extension_id, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener::ID id2(
- &profile_, extension_id, kEventName2 + "/1", 0, 0);
+ &profile_, extension_id, kEventName2 + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id1,
false);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id2,
@@ -719,6 +737,7 @@ TEST_F(ExtensionWebRequestTest, AccessRequestBodyData) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id, extension_id, events::FOR_TEST, kEventName,
kEventName + "/1", filter, extra_info_spec_body, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2);
@@ -727,7 +746,8 @@ TEST_F(ExtensionWebRequestTest, AccessRequestBodyData) {
base::RunLoop().RunUntilIdle();
ExtensionWebRequestEventRouter::EventListener::ID id1(
- &profile_, extension_id, kEventName + "/1", 0, 0);
+ &profile_, extension_id, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id1,
false);
@@ -738,6 +758,7 @@ TEST_F(ExtensionWebRequestTest, AccessRequestBodyData) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id, extension_id, events::FOR_TEST, kEventName,
kEventName + "/1", filter, extra_info_spec_empty, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2);
@@ -749,6 +770,7 @@ TEST_F(ExtensionWebRequestTest, AccessRequestBodyData) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id, extension_id, events::FOR_TEST, kEventName,
kEventName + "/1", filter, extra_info_spec_body, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
// Part 3.
@@ -809,24 +831,28 @@ TEST_F(ExtensionWebRequestTest, MinimalAccessRequestBodyData) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id1, extension_id1, events::FOR_TEST, kEventName,
kEventName + "/1", filter, extra_info_spec_body, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
// Extension 1 without requestBody spec.
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id1, extension_id1, events::FOR_TEST, kEventName,
kEventName + "/2", filter, extra_info_spec_empty, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
// Extension 2, without requestBody spec.
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id2, extension_id2, events::FOR_TEST, kEventName,
kEventName + "/1", filter, extra_info_spec_empty, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
// Extension 2, with requestBody spec.
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id2, extension_id2, events::FOR_TEST, kEventName,
kEventName + "/2", filter, extra_info_spec_body, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
// Only one request is sent, but more than one event will be triggered.
@@ -840,13 +866,17 @@ TEST_F(ExtensionWebRequestTest, MinimalAccessRequestBodyData) {
// Clean-up
ExtensionWebRequestEventRouter::EventListener::ID id1(
- &profile_, extension_id1, kEventName + "/1", 0, 0);
+ &profile_, extension_id1, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener::ID id2(
- &profile_, extension_id1, kEventName + "/2", 0, 0);
+ &profile_, extension_id1, kEventName + "/2", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener::ID id3(
- &profile_, extension_id2, kEventName + "/1", 0, 0);
+ &profile_, extension_id2, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener::ID id4(
- &profile_, extension_id2, kEventName + "/2", 0, 0);
+ &profile_, extension_id2, kEventName + "/2", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id1,
false);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id2,
@@ -896,10 +926,12 @@ TEST_F(ExtensionWebRequestTest, ProperFilteringInPublicSession) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id1, extension_id1, events::FOR_TEST, kEventName,
kEventName + "/1", filter, extra_info_spec_body, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id2, extension_id2, events::FOR_TEST, kEventName,
kEventName + "/1", filter, extra_info_spec_body, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
// Only one request is sent, but more than one event will be triggered.
@@ -913,9 +945,11 @@ TEST_F(ExtensionWebRequestTest, ProperFilteringInPublicSession) {
// Clean-up
ExtensionWebRequestEventRouter::EventListener::ID id1(
- &profile_, extension_id1, kEventName + "/1", 0, 0);
+ &profile_, extension_id1, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener::ID id2(
- &profile_, extension_id2, kEventName + "/1", 0, 0);
+ &profile_, extension_id2, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id1,
false);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id2,
@@ -959,6 +993,7 @@ TEST_F(ExtensionWebRequestTest, NoAccessRequestBodyData) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id, extension_id, events::FOR_TEST, kEventName,
kEventName + "/1", filter, extra_info_spec, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
// The request URL can be arbitrary but must have an HTTP or HTTPS scheme.
@@ -975,7 +1010,8 @@ TEST_F(ExtensionWebRequestTest, NoAccessRequestBodyData) {
base::RunLoop().RunUntilIdle();
ExtensionWebRequestEventRouter::EventListener::ID id1(
- &profile_, extension_id, kEventName + "/1", 0, 0);
+ &profile_, extension_id, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id1,
false);
@@ -994,7 +1030,7 @@ TEST_F(ExtensionWebRequestTest, NoAccessRequestBodyData) {
EXPECT_EQ(i, ipc_sender_.sent_end());
}
-// Tests that |embedder_process_id| is not relevant for adding and removing
+// Tests that |render_process_id| is not relevant for adding and removing
// listeners with |web_view_instance_id| = 0.
TEST_F(ExtensionWebRequestTest, AddAndRemoveListeners) {
std::string ext_id("abcdefghijklmnopabcdefghijklmnop");
@@ -1010,11 +1046,13 @@ TEST_F(ExtensionWebRequestTest, AddAndRemoveListeners) {
// Add two non-webview listeners.
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, ext_id, ext_id, events::FOR_TEST, kEventName, kSubEventName,
- filter, 0, 1 /* embedder_process_id */, 0,
+ filter, 0, 1 /* render_process_id */, 0, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, ext_id, ext_id, events::FOR_TEST, kEventName, kSubEventName,
- filter, 0, 2 /* embedder_process_id */, 0,
+ filter, 0, 2 /* render_process_id */, 0, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
EXPECT_EQ(
2u,
@@ -1022,8 +1060,9 @@ TEST_F(ExtensionWebRequestTest, AddAndRemoveListeners) {
&profile_, kEventName));
// Now remove the events without passing an explicit process ID.
- ExtensionWebRequestEventRouter::EventListener::ID id1(&profile_, ext_id,
- kSubEventName, 0, 0);
+ ExtensionWebRequestEventRouter::EventListener::ID id1(
+ &profile_, ext_id, kSubEventName, 0, 0, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id1,
false);
EXPECT_EQ(
@@ -1050,9 +1089,11 @@ TEST_F(ExtensionWebRequestTest, BlockedRequestsAreRemoved) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension_id, extension_id, events::FOR_TEST, kEventName,
kEventName + "/1", filter, ExtraInfoSpec::BLOCKING, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
- ExtensionWebRequestEventRouter::EventListener::ID id(&profile_, extension_id,
- kEventName + "/1", 0, 0);
+ ExtensionWebRequestEventRouter::EventListener::ID id(
+ &profile_, extension_id, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener* listener =
ExtensionWebRequestEventRouter::GetInstance()->FindEventListener(id);
ASSERT_NE(nullptr, listener);
@@ -1064,10 +1105,10 @@ TEST_F(ExtensionWebRequestTest, BlockedRequestsAreRemoved) {
// Extension response for OnErrorOccurred: Terminate the message loop.
{
base::RunLoop run_loop;
- ipc_sender_.PushTask(
- base::Bind(base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask),
- base::ThreadTaskRunnerHandle::Get(), FROM_HERE,
- run_loop.QuitWhenIdleClosure()));
+ ipc_sender_.PushTask(base::BindRepeating(
+ base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask),
+ base::ThreadTaskRunnerHandle::Get(), FROM_HERE,
+ run_loop.QuitWhenIdleClosure()));
request->Start();
run_loop.Run();
}
@@ -1082,8 +1123,9 @@ TEST_F(ExtensionWebRequestTest, BlockedRequestsAreRemoved) {
response->cancel = true;
ExtensionWebRequestEventRouter::GetInstance()->OnEventHandled(
&profile_, extension_id, kEventName, kEventName + "/1",
- request->identifier(), 0 /* embedder_process_id */,
- 0 /* web_view_instance_id */, response);
+ request->identifier(), 0 /* render_process_id */,
+ 0 /* web_view_instance_id */, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId, response);
{
base::RunLoop run_loop;
run_loop.RunUntilIdle();
@@ -1178,17 +1220,20 @@ TEST_P(ExtensionWebRequestHeaderModificationTest, TestModifications) {
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension1_id, extension1_id, events::FOR_TEST, kEventName,
kEventName + "/1", filter, ExtraInfoSpec::BLOCKING, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension2_id, extension2_id, events::FOR_TEST, kEventName,
kEventName + "/2", filter, ExtraInfoSpec::BLOCKING, 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
// Install one extension that observes the final headers.
ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
&profile_, extension3_id, extension3_id, events::FOR_TEST,
keys::kOnSendHeadersEvent, std::string(keys::kOnSendHeadersEvent) + "/3",
- filter, ExtraInfoSpec::REQUEST_HEADERS, 0, 0,
+ filter, ExtraInfoSpec::REQUEST_HEADERS, 0, 0, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId,
ipc_sender_factory.GetWeakPtr());
GURL request_url("http://doesnotexist/does_not_exist.html");
@@ -1229,11 +1274,12 @@ TEST_P(ExtensionWebRequestHeaderModificationTest, TestModifications) {
// the block of modifications for the next extension starts.
if (i+1 == test.modification_size ||
mod.extension_id != test.modification[i+1].extension_id) {
- ipc_sender_.PushTask(
- base::Bind(&EventHandledOnIOThread,
- &profile_, mod.extension_id == 1 ? extension1_id : extension2_id,
- kEventName, kEventName + (mod.extension_id == 1 ? "/1" : "/2"),
- request->identifier(), response));
+ ipc_sender_.PushTask(base::BindRepeating(
+ &EventHandledOnIOThread, &profile_, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId,
+ mod.extension_id == 1 ? extension1_id : extension2_id, kEventName,
+ kEventName + (mod.extension_id == 1 ? "/1" : "/2"),
+ request->identifier(), response));
response = NULL;
}
}
@@ -1306,12 +1352,15 @@ TEST_P(ExtensionWebRequestHeaderModificationTest, TestModifications) {
}
EXPECT_EQ(1, num_headers_observed);
ExtensionWebRequestEventRouter::EventListener::ID id1(
- &profile_, extension1_id, kEventName + "/1", 0, 0);
+ &profile_, extension1_id, kEventName + "/1", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener::ID id2(
- &profile_, extension2_id, kEventName + "/2", 0, 0);
+ &profile_, extension2_id, kEventName + "/2", 0, 0,
+ extensions::kMainThreadId, blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::EventListener::ID id3(
&profile_, extension3_id, std::string(keys::kOnSendHeadersEvent) + "/3",
- 0, 0);
+ 0, 0, extensions::kMainThreadId,
+ blink::mojom::kInvalidServiceWorkerVersionId);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id1,
false);
ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(id2,
diff --git a/chromium/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chromium/chrome/browser/extensions/api/web_request/web_request_apitest.cc
index c65fa81940f..4373dff71ae 100644
--- a/chromium/chrome/browser/extensions/api/web_request/web_request_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -17,7 +17,6 @@
#include "base/task/post_task.h"
#include "base/test/bind_test_util.h"
#include "base/test/metrics/histogram_tester.h"
-#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "base/time/time_override.h"
#include "base/values.h"
@@ -551,25 +550,62 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
message_;
}
-IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestAuthRequired) {
+enum class ProfileMode {
+ kUserProfile,
+ kIncognito,
+};
+
+class ExtensionWebRequestApiAuthRequiredTest
+ : public ExtensionWebRequestApiTest,
+ public testing::WithParamInterface<ProfileMode> {
+ public:
+ int GetFlags() {
+ switch (GetParam()) {
+ case ProfileMode::kUserProfile:
+ return kFlagEnableFileAccess;
+ case ProfileMode::kIncognito:
+ return kFlagEnableIncognito | kFlagUseIncognito | kFlagEnableFileAccess;
+ }
+ }
+};
+
+IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest,
+ WebRequestAuthRequired) {
CancelLoginDialog login_dialog_helper;
ASSERT_TRUE(StartEmbeddedTestServer());
- ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_auth_required.html")) <<
- message_;
+ ASSERT_TRUE(RunExtensionSubtestWithArgAndFlags(
+ "webrequest", "test_auth_required.html", nullptr, GetFlags()))
+ << message_;
}
-IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
- WebRequestAuthRequiredIncognito) {
+IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest,
+ WebRequestAuthRequiredAsync) {
CancelLoginDialog login_dialog_helper;
ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunExtensionSubtestWithArgAndFlags(
- "webrequest", "test_auth_required.html", nullptr,
- kFlagEnableIncognito | kFlagUseIncognito | kFlagEnableFileAccess))
+ "webrequest", "test_auth_required_async.html", nullptr, GetFlags()))
<< message_;
}
+IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest,
+ WebRequestAuthRequiredParallel) {
+ CancelLoginDialog login_dialog_helper;
+
+ ASSERT_TRUE(StartEmbeddedTestServer());
+ ASSERT_TRUE(RunExtensionSubtestWithArgAndFlags(
+ "webrequest", "test_auth_required_parallel.html", nullptr, GetFlags()))
+ << message_;
+}
+
+INSTANTIATE_TEST_SUITE_P(UserProfile,
+ ExtensionWebRequestApiAuthRequiredTest,
+ ::testing::Values(ProfileMode::kUserProfile));
+INSTANTIATE_TEST_SUITE_P(Incognito,
+ ExtensionWebRequestApiAuthRequiredTest,
+ ::testing::Values(ProfileMode::kIncognito));
+
// This test times out regularly on win_rel trybots. See http://crbug.com/122178
// Also on Linux/ChromiumOS debug, ASAN and MSAN builds.
// https://crbug.com/670415
@@ -989,14 +1025,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, HostedAppRequest) {
EXPECT_TRUE(listener2.WaitUntilSatisfied());
}
-// Tests that webRequest works with
-// extensions_features::kRuntimeHostPermissions.
+// Tests that WebRequest works with runtime host permissions.
IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
WebRequestWithWithheldPermissions) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
content::SetupCrossSiteRedirector(embedded_test_server());
ASSERT_TRUE(embedded_test_server()->Start());
@@ -1121,10 +1152,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
// intercept cross-origin requests from that tab.
IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
WebRequestWithheldPermissionsCrossOriginRequests) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
content::SetupCrossSiteRedirector(embedded_test_server());
ASSERT_TRUE(embedded_test_server()->Start());
@@ -1176,10 +1203,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
// https://crbug.com/891586.
IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
WithheldHostPermissionsForCrossOriginWithoutInitiator) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
content::SetupCrossSiteRedirector(embedded_test_server());
ASSERT_TRUE(embedded_test_server()->Start());
@@ -1299,7 +1322,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
auto make_browser_request = [this](const GURL& url) {
auto request = std::make_unique<network::ResourceRequest>();
request->url = url;
- request->resource_type = content::RESOURCE_TYPE_SUB_RESOURCE;
+ request->resource_type =
+ static_cast<int>(content::ResourceType::kSubResource);
auto* url_loader_factory =
content::BrowserContext::GetDefaultStoragePartition(profile())
@@ -1536,6 +1560,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
->CreateWebSocket(std::move(request), network::mojom::kBrowserProcessId,
host->GetProcess()->GetID(),
url::Origin::Create(GURL("http://example.com")),
+ network::mojom::kWebSocketOptionNone,
std::move(auth_handler), nullptr);
web_socket.reset();
}
@@ -2245,10 +2270,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTestWithManagementPolicy,
// specific permission shouldn't bypass our policy.
IN_PROC_BROWSER_TEST_F(ExtensionApiTestWithManagementPolicy,
WebRequestProtectedByPolicy) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndEnableFeature(
- extensions_features::kRuntimeHostPermissions);
-
// Host protected by policy.
const std::string protected_domain = "example.com";
diff --git a/chromium/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc b/chromium/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
index 5e25be05b05..cf759c37dad 100644
--- a/chromium/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
@@ -135,14 +135,14 @@ TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, LocalNTPRequests) {
info.render_process_id = -1;
// Sub-resource browser initiated requests are hidden from extensions.
- info.type = content::RESOURCE_TYPE_SUB_RESOURCE;
+ info.type = content::ResourceType::kSubResource;
info.web_request_type = extensions::WebRequestResourceType::OTHER;
info.is_browser_side_navigation = false;
EXPECT_TRUE(
WebRequestPermissions::HideRequest(extension_info_map_.get(), info));
// Sub-frame navigations initiated from the local ntp should be hidden.
- info.type = content::RESOURCE_TYPE_SUB_FRAME;
+ info.type = content::ResourceType::kSubFrame;
info.web_request_type = extensions::WebRequestResourceType::SUB_FRAME;
info.is_browser_side_navigation = true;
EXPECT_TRUE(
@@ -163,7 +163,7 @@ TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest,
NULL, TRAFFIC_ANNOTATION_FOR_TESTS));
const content::ResourceType kResourceType =
- content::RESOURCE_TYPE_SUB_RESOURCE;
+ content::ResourceType::kSubResource;
EXPECT_EQ(PermissionsData::PageAccess::kAllowed,
WebRequestPermissions::CanExtensionAccessURL(
@@ -254,7 +254,7 @@ TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest,
false, // crosses_incognito
WebRequestPermissions::REQUIRE_HOST_PERMISSION_FOR_URL_AND_INITIATOR,
request_with_initiator->initiator(),
- content::RESOURCE_TYPE_SUB_FRAME));
+ content::ResourceType::kSubFrame));
EXPECT_EQ(PermissionsData::PageAccess::kDenied,
WebRequestPermissions::CanExtensionAccessURL(
diff --git a/chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc b/chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
index b2ab47ed380..0799d4a36b2 100644
--- a/chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
@@ -36,8 +36,6 @@ namespace extensions {
using content::BrowserThread;
namespace wap = api::webrtc_audio_private;
-using api::webrtc_audio_private::RequestInfo;
-
static base::LazyInstance<BrowserContextKeyedAPIFactory<
WebrtcAudioPrivateEventService>>::DestructorAtExit
g_webrtc_audio_private_api_factory = LAZY_INSTANCE_INITIALIZER;
@@ -145,43 +143,6 @@ media::AudioSystem* WebrtcAudioPrivateFunction::GetAudioSystem() {
return audio_system_.get();
}
-// TODO(hlundin): Stolen from WebrtcLoggingPrivateFunction.
-// Consolidate and improve. http://crbug.com/710371
-content::RenderProcessHost*
-WebrtcAudioPrivateFunction::GetRenderProcessHostFromRequest(
- const RequestInfo& request,
- const std::string& security_origin) {
- // If |guest_process_id| is defined, directly use this id to find the
- // corresponding RenderProcessHost.
- if (request.guest_process_id)
- return content::RenderProcessHost::FromID(*request.guest_process_id);
-
- // Otherwise, use the |tab_id|. If there's no |tab_id| and no
- // |guest_process_id|, we can't look up the RenderProcessHost.
- if (!request.tab_id) {
- error_ = "No tab ID or guest process ID specified.";
- return nullptr;
- }
-
- int tab_id = *request.tab_id;
- content::WebContents* contents = nullptr;
- if (!ExtensionTabUtil::GetTabById(tab_id, GetProfile(), true, nullptr,
- nullptr, &contents, nullptr)) {
- error_ = extensions::ErrorUtils::FormatErrorMessage(
- extensions::tabs_constants::kTabNotFoundError,
- base::NumberToString(tab_id));
- return nullptr;
- }
- GURL expected_origin = contents->GetLastCommittedURL().GetOrigin();
- if (expected_origin.spec() != security_origin) {
- error_ = base::StringPrintf(
- "Invalid security origin. Expected=%s, actual=%s",
- expected_origin.spec().c_str(), security_origin.c_str());
- return nullptr;
- }
- return contents->GetMainFrame()->GetProcess();
-}
-
bool WebrtcAudioPrivateGetSinksFunction::RunAsync() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
InitDeviceIDSalt();
@@ -278,49 +239,4 @@ void WebrtcAudioPrivateGetAssociatedSinkFunction::Reply(
SendResponse(true);
}
-WebrtcAudioPrivateSetAudioExperimentsFunction::
- WebrtcAudioPrivateSetAudioExperimentsFunction() {}
-
-WebrtcAudioPrivateSetAudioExperimentsFunction::
- ~WebrtcAudioPrivateSetAudioExperimentsFunction() {}
-
-bool WebrtcAudioPrivateSetAudioExperimentsFunction::RunAsync() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- std::unique_ptr<wap::SetAudioExperiments::Params> params(
- wap::SetAudioExperiments::Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params.get());
-
- // Currently the only available experiment is AEC3, so we expect this to be
- // set if this extension is called.
- if (!params->audio_experiments.enable_aec3.get()) {
- SetError("No experiment specified");
- SendResponse(false);
- return false;
- }
-
- content::RenderProcessHost* host =
- GetRenderProcessHostFromRequest(params->request, params->security_origin);
- if (!host) {
- // Error message has been set in GetRenderProcessHostFromRequest().
- SendResponse(false);
- return false;
- }
-
- host->SetEchoCanceller3(
- *params->audio_experiments.enable_aec3,
- base::BindOnce(
- &WebrtcAudioPrivateSetAudioExperimentsFunction::FireCallback, this));
-
- return true;
-}
-
-void WebrtcAudioPrivateSetAudioExperimentsFunction::FireCallback(
- bool success,
- const std::string& error_message) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (!success)
- SetError(error_message);
- SendResponse(success);
-}
-
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h b/chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
index ab9395834c9..303734c30a0 100644
--- a/chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
+++ b/chromium/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
@@ -71,13 +71,6 @@ class WebrtcAudioPrivateFunction : public ChromeAsyncExtensionFunction {
media::AudioSystem* GetAudioSystem();
- // Returns the RenderProcessHost associated with the given |request|
- // authorized by the |security_origin|. Returns null if unauthorized or
- // the RPH does not exist.
- content::RenderProcessHost* GetRenderProcessHostFromRequest(
- const api::webrtc_audio_private::RequestInfo& request,
- const std::string& security_origin);
-
private:
std::string device_id_salt_;
std::unique_ptr<media::AudioSystem> audio_system_;
@@ -132,24 +125,6 @@ class WebrtcAudioPrivateGetAssociatedSinkFunction
std::unique_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_;
};
-class WebrtcAudioPrivateSetAudioExperimentsFunction
- : public WebrtcAudioPrivateFunction {
- public:
- WebrtcAudioPrivateSetAudioExperimentsFunction();
-
- protected:
- ~WebrtcAudioPrivateSetAudioExperimentsFunction() override;
-
- private:
- DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.setAudioExperiments",
- WEBRTC_AUDIO_PRIVATE_SET_AUDIO_EXPERIMENTS)
-
- bool RunAsync() override;
-
- // Must be called on the UI thread.
- void FireCallback(bool success, const std::string& error_message);
-};
-
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVATE_API_H_
diff --git a/chromium/chrome/browser/extensions/api/webrtc_desktop_capture_private/webrtc_desktop_capture_private_api.cc b/chromium/chrome/browser/extensions/api/webrtc_desktop_capture_private/webrtc_desktop_capture_private_api.cc
index 298ee34db95..cc33832c845 100644
--- a/chromium/chrome/browser/extensions/api/webrtc_desktop_capture_private/webrtc_desktop_capture_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/webrtc_desktop_capture_private/webrtc_desktop_capture_private_api.cc
@@ -11,8 +11,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/tabs.h"
#include "chrome/common/extensions/api/webrtc_desktop_capture_private.h"
-#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/origin_util.h"
#include "net/base/url_util.h"
@@ -42,8 +40,8 @@ bool WebrtcDesktopCapturePrivateChooseDesktopMediaFunction::RunAsync() {
EXTENSION_FUNCTION_VALIDATE(args_->GetSize() > 0);
EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &request_id_));
- DesktopCaptureRequestsRegistry::GetInstance()->AddRequest(
- render_frame_host()->GetProcess()->GetID(), request_id_, this);
+ DesktopCaptureRequestsRegistry::GetInstance()->AddRequest(source_process_id(),
+ request_id_, this);
args_->Remove(0, NULL);
diff --git a/chromium/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc b/chromium/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
index 284f941308b..8efee8786a5 100644
--- a/chromium/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
@@ -8,7 +8,7 @@
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/hash.h"
+#include "base/hash/hash.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
diff --git a/chromium/chrome/browser/flag-metadata.json b/chromium/chrome/browser/flag-metadata.json
index 674ec7b9677..680b312bcab 100644
--- a/chromium/chrome/browser/flag-metadata.json
+++ b/chromium/chrome/browser/flag-metadata.json
@@ -11,7 +11,8 @@
// used as a primary key. The value is a string.
//
// owners: the person(s) or team(s) responsible for this flag. The value is a
-// nonempty list of strings, each of which is either:
+// nonempty list of strings, in order of specificity (i.e., the first entry
+// on the list is the best contact). Each entry is either:
//
// - A string containing '@', which is treated as an email address;
// - A string beginning with '//', which is treated as a path to a file
@@ -28,13 +29,8 @@
[
{
- "name": "AffiliationBasedMatching",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "BundledConnectionHelp",
- // "owners": [ "your-team" ],
+ "owners": [ "carlosil" ],
"expiry_milestone": 76
},
{
@@ -44,8 +40,8 @@
},
{
"name": "SupervisedUserCommittedInterstitials",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "carlosil" ],
+ "expiry_milestone": 77
},
{
"name": "account-consistency",
@@ -58,6 +54,12 @@
"expiry_milestone": 76
},
{
+ "name": "allow-popups-during-page-unload",
+ "owners": [ "avi", "pastarmovj" ],
+ // Bound to the timelene of the AllowPopupsDuringPageUnload policy.
+ "expiry_milestone": 82
+ },
+ {
"name": "allow-previews",
"owners": [ "//components/data_reduction_proxy/OWNERS" ],
"expiry_milestone": 76
@@ -78,13 +80,8 @@
"expiry_milestone": 76
},
{
- "name": "allow-touchpad-three-finger-click",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "android-files-in-files-app",
- // "owners": [ "your-team" ],
+ "owners": [ "fukino" ],
"expiry_milestone": 76
},
{
@@ -113,6 +110,11 @@
"expiry_milestone": 76
},
{
+ "name": "arc-custom-tabs-experiment",
+ "owners": [ "hashimoto" ],
+ "expiry_milestone": 76
+ },
+ {
"name": "arc-documents-provider",
"owners": [ "fukino" ],
"expiry_milestone": 76
@@ -172,19 +174,9 @@
"expiry_milestone": 75
},
{
- "name": "ash-shelf-color",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "ash-shelf-color-scheme",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "auto-fetch-on-net-error-page",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "harringtond", "offline-dev" ],
+ "expiry_milestone": 82
},
{
"name": "autofill-always-show-server-cards-in-sync-transport",
@@ -202,11 +194,6 @@
"expiry_milestone": 72
},
{
- "name": "autofill-dropdown-layout",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "autofill-dynamic-forms",
"owners": [ "sebsg" ],
"expiry_milestone": 72
@@ -217,6 +204,16 @@
"expiry_milestone": 73
},
{
+ "name": "autofill-enable-local-card-migration-for-non-sync-user",
+ "owners": [ "siyua" ],
+ "expiry_milestone": 76
+ },
+ {
+ "name": "autofill-enable-toolbar-status-chip",
+ "owners": [ "siyua" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "autofill-enforce-min-required-fields-for-heuristics",
"owners": [ "rogerm" ],
"expiry_milestone": 73
@@ -237,14 +234,18 @@
"expiry_milestone": 74
},
{
- "name": "autofill-no-local-save-on-upload-success",
- "owners": [ "sebsg" ],
- "expiry_milestone": 71
+ "name": "autofill-no-local-save-on-unmask-success",
+ "owners": [ "jsaul@google.com" ],
+ // Currently unclear if this is launching independently with M75 or
+ // alongside the Autofill Auth Project, which could be as late as ~Q3.
+ "expiry_milestone": 79
},
{
- "name": "autofill-prefilled-fields",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "name": "autofill-no-local-save-on-upload-success",
+ "owners": [ "jsaul@google.com", "annelim@google.com" ],
+ // Currently unclear if this is launching independently with M75 or
+ // alongside the Autofill Auth Project, which could be as late as ~Q3.
+ "expiry_milestone": 79
},
{
"name": "autofill-profile-client-validation",
@@ -257,6 +258,11 @@
"expiry_milestone": 77
},
{
+ "name": "autofill-reject-company-birthyear",
+ "owners": [ "parastoog" ],
+ "expiry_milestone": 79
+ },
+ {
"name": "autofill-restrict-formless-form-extraction",
"owners": [ "rogerm" ],
"expiry_milestone": 76
@@ -267,12 +273,17 @@
"expiry_milestone": 76
},
{
+ "name": "omnibox-local-entity-suggestions",
+ "owners": [ "manukh", "chrome-omnibox-team@google.com" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "autofill-settings-split-by-card-type",
"owners": [ "sebsg" ],
"expiry_milestone": 75
},
{
- "name": "autofill-show-full-disclosure-label",
+ "name": "autofill-use-improved-label-disambiguation",
"owners": [ "ftirelo", "tmartino" ],
"expiry_milestone": 77
},
@@ -282,34 +293,19 @@
"expiry_milestone": 76
},
{
- "name": "automatic-tab-discarding",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "autoplay-policy",
// "owners": [ "your-team" ],
"expiry_milestone": 76
},
{
- "name": "background-loader-for-downloads",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "background-task-component-update",
"owners": [ "sorin", "waffles", "tiborg" ],
"expiry_milestone": 76
},
{
- "name": "bookmark-apps",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "bypass-app-banner-engagement-checks",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "dominickn" ],
+ "expiry_milestone": 78
},
{
"name": "calculate-native-win-occlusion",
@@ -318,37 +314,37 @@
},
{
"name": "cct-module",
- // "owners": [ "your-team" ],
+ "owners": [ "mvanouwerkerk", "//chrome/android/java/src/org/chromium/chrome/browser/customtabs/OWNERS" ],
"expiry_milestone": 76
},
{
"name": "cct-module-cache",
- "owners": [ "mvanouwerkerk" ],
+ "owners": [ "mvanouwerkerk", "//chrome/android/java/src/org/chromium/chrome/browser/customtabs/OWNERS" ],
"expiry_milestone": 76
},
{
"name": "cct-module-custom-header",
- "owners": [ "mvanouwerkerk" ],
+ "owners": [ "mvanouwerkerk", "//chrome/android/java/src/org/chromium/chrome/browser/customtabs/OWNERS" ],
"expiry_milestone": 76
},
{
"name": "cct-module-custom-request-header",
- "owners": [ "mvanouwerkerk" ],
+ "owners": [ "mvanouwerkerk", "//chrome/android/java/src/org/chromium/chrome/browser/customtabs/OWNERS" ],
"expiry_milestone": 76
},
{
"name": "cct-module-dex-loading",
- "owners": [ "mvanouwerkerk" ],
+ "owners": [ "mvanouwerkerk", "//chrome/android/java/src/org/chromium/chrome/browser/customtabs/OWNERS" ],
"expiry_milestone": 76
},
{
"name": "cct-module-post-message",
- "owners": [ "mvanouwerkerk" ],
+ "owners": [ "mvanouwerkerk", "//chrome/android/java/src/org/chromium/chrome/browser/customtabs/OWNERS" ],
"expiry_milestone": 76
},
{
"name": "cct-module-use-intent-extras",
- "owners": [ "mvanouwerkerk" ],
+ "owners": [ "mvanouwerkerk", "//chrome/android/java/src/org/chromium/chrome/browser/customtabs/OWNERS" ],
"expiry_milestone": 76
},
{
@@ -363,12 +359,7 @@
},
{
"name": "click-to-open-pdf",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "clipboard-content-setting",
- // "owners": [ "your-team" ],
+ "owners": [ "tommycli" ],
"expiry_milestone": 76
},
{
@@ -377,23 +368,8 @@
"expiry_milestone": 76
},
{
- "name": "concurrent-background-loading-on-svelte",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "content-suggestions-category-order",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "content-suggestions-category-ranker",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "content-suggestions-debug-log",
- // "owners": [ "your-team" ],
+ "owners": [ "fgorski" ],
"expiry_milestone": 76
},
{
@@ -422,6 +398,16 @@
"expiry_milestone": 76
},
{
+ "name": "contextual-search-simplified-server",
+ "owners": [ "//chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/OWNERS" ],
+ "expiry_milestone": 78
+ },
+ {
+ "name": "contextual-search-translation-model",
+ "owners": [ "//chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/OWNERS" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "contextual-search-unity-integration",
"owners": [ "//chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/OWNERS" ],
"expiry_milestone": 76
@@ -442,11 +428,6 @@
"expiry_milestone": 74
},
{
- "name": "create-app-windows-in-app",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "cros-regions-mode",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -462,6 +443,11 @@
"expiry_milestone": 77
},
{
+ "name": "crostini-usb-allow-unsupported",
+ "owners": [ "nverne", "benwells" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "crostini-usb-support",
"owners": [ "jopra", "nverne", "benwells" ],
"expiry_milestone": 76
@@ -494,6 +480,11 @@
"expiry_milestone": 88
},
{
+ "name": "delegate-overscroll-swipes",
+ "owners": [ "chrome-android-app@chromium.org" ],
+ "expiry_milestone": 88
+ },
+ {
"name": "device-discovery-notifications",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -523,26 +514,11 @@
"expiry_milestone": -1
},
{
- "name": "disable-audio-support-for-desktop-share",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "disable-best-effort-tasks",
"owners": [ "catan-team@chromium.org" ],
"expiry_milestone": 75
},
{
- "name": "disable-captive-portal-bypass-proxy",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "disable-cloud-import",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "disable-eol-notification",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -556,13 +532,8 @@
},
{
"name": "disable-hosted-app-shim-creation",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "disable-hosted-apps-in-windows",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "ccameron" ],
+ "expiry_milestone": 77
},
{
// See https://crbug.com/882238.
@@ -586,22 +557,12 @@
"expiry_milestone": 76
},
{
- "name": "disable-pull-to-refresh-effect",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
// See https://crbug.com/882238.
"name": "disable-pushstate-throttle",
"owners": [ "arthursonzogni@chromium.org", "palmer@chromium.org" ],
"expiry_milestone": 76
},
{
- "name": "disable-system-timezone-automatic-detection",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "disable-tablet-splitview",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -619,11 +580,6 @@
"expiry_milestone": 76
},
{
- "name": "disable-voice-input",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "disable-webrtc-hw-decoding",
"owners": [ "hiroh", "chromeos-video-eng@google.com" ],
// This flag does not expire because it allows users to disable HW video
@@ -690,6 +646,21 @@
"expiry_milestone": 75
},
{
+ "name": "download-rename",
+ "owners": [ "hesen", "dtrainor" ],
+ "expiry_milestone": 76
+ },
+ {
+ "name": "draw-vertically-edge-to-edge",
+ "owners": [ "chrome-android-app@chromium.org" ],
+ "expiry_milestone": 88
+ },
+ {
+ "name": "enable-accessibility-image-descriptions",
+ "owners": [ "//ui/accessibility/OWNERS" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "enable-accessibility-object-model",
"owners": [ "//ui/accessibility/OWNERS" ],
"expiry_milestone": 76
@@ -726,8 +697,8 @@
},
{
"name": "enable-app-data-search",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "jennyz", "kaznacheev" ],
+ "expiry_milestone": 78
},
{
"name": "enable-app-grid-ghost",
@@ -745,11 +716,6 @@
"expiry_milestone": 74
},
{
- "name": "enable-app-shortcut-search",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-appcontainer",
"owners": [ "forshaw", "wfh" ],
"expiry_milestone": 76
@@ -815,6 +781,11 @@
"expiry_milestone": 76
},
{
+ "name": "enable-autofill-credit-card-authentication",
+ "owners": [ "jsaul@google.com", "manasverma@google.com" ],
+ "expiry_milestone": 79
+ },
+ {
"name": "enable-autofill-credit-card-local-card-migration",
"owners": [ "jiahuiguo@google.com", "siyua@google.com" ],
"expiry_milestone": 76
@@ -843,6 +814,11 @@
"expiry_milestone": 76
},
{
+ "name": "enable-autofill-import-dynamic-forms",
+ "owners": [ "hozhng@google.com", "jiahuiguo@google.com" ],
+ "expiry_milestone": 76
+ },
+ {
"name": "enable-autofill-import-non-focusable-credit-card-forms",
"owners": [ "hozhng@google.com", "jiahuiguo@google.com" ],
"expiry_milestone": 76
@@ -859,13 +835,13 @@
},
{
"name": "enable-autofill-manual-fallback",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "tmartino@chromium.org" ],
+ "expiry_milestone": 78
},
{
"name": "enable-autofill-refresh-style",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "tmartino@chromium.org" ],
+ "expiry_milestone": 78
},
{
"name": "enable-autofill-save-card-dialog-unlabeled-expiration-date",
@@ -903,6 +879,11 @@
"expiry_milestone": 77
},
{
+ "name": "autofill-off-no-server-data",
+ "owners": [ "seblalancette" ],
+ "expiry_milestone": 79
+ },
+ {
"name": "enable-autoplay-ignore-web-audio",
"owners": [ "beccahughes", "mlamouri", "media-dev" ],
"expiry_milestone": 73
@@ -918,26 +899,11 @@
"expiry_milestone": 76
},
{
- "name": "enable-ble-advertising-in-apps",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "enable-blink-heap-unified-garbage-collection",
- "owners": [ "mlippautz" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-bloated-renderer-detection",
"owners": [ "ulan" ],
"expiry_milestone": 75
},
{
- "name": "enable-block-tab-unders",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-brotli",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -949,8 +915,13 @@
},
{
"name": "enable-chrome-duet",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "mdjones" ],
+ "expiry_milestone": 79
+ },
+ {
+ "name": "enable-chrome-duet-labels",
+ "owners": [ "amaralp" ],
+ "expiry_milestone": 79
},
{
"name": "enable-chromeos-account-manager",
@@ -983,16 +954,21 @@
"expiry_milestone": 76
},
{
- "name": "enable-content-suggestions-thumbnail-dominant-color",
- // "owners": [ "your-team" ],
+ "name": "enable-immersive-fullscreen-toolbar",
+ "owners": [ "sdy", "chrome/browser/ui/cocoa/OWNERS" ],
"expiry_milestone": 76
},
{
"name": "enable-credit-card-assist",
- // "owners": [ "your-team" ],
+ "owners": [ "ftirelo", "gogerald" ],
"expiry_milestone": 76
},
{
+ "name": "enable-cros-ime-input-logic-fst",
+ "owners": [ "essential-inputs-team@google.com" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "enable-cros-ime-service",
"owners": [ "essential-inputs-team@google.com" ],
"expiry_milestone": 76
@@ -1004,8 +980,8 @@
},
{
"name": "enable-custom-context-menu",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "chrome-android-app" ],
+ "expiry_milestone": 77
},
{
"name": "enable-custom-mac-paper-sizes",
@@ -1064,11 +1040,6 @@
"expiry_milestone": 76
},
{
- "name": "enable-drag-tabs-in-tablet-mode",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-drive-fs",
"owners": [ "sammc", "dats" ],
"expiry_milestone": 76
@@ -1080,7 +1051,7 @@
},
{
"name": "enable-encryption-migration",
- // "owners": [ "your-team" ],
+ "owners": [ "fukino" ],
"expiry_milestone": 76
},
{
@@ -1119,6 +1090,11 @@
"expiry_milestone": 78
},
{
+ "name": "enable-experimental-accessibility-chromevox-rich-text-indication",
+ "owners": [ "akihiroota", "dtseng" ],
+ "expiry_milestone": 78
+ },
+ {
"name": "enable-experimental-productivity-features",
"owners": [ "feature-control@chromium.org" ],
"expiry_milestone": 76
@@ -1136,31 +1112,16 @@
"expiry_milestone": 76
},
{
- "name": "enable-first-run-ui-transitions",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-font-cache-scaling",
// "owners": [ "your-team" ],
"expiry_milestone": 76
},
{
- "name": "enable-framebusting-needs-sameorigin-or-usergesture",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-fs-nosymfollow",
"owners": [ "mortonm@chromium.org" ],
"expiry_milestone": 76
},
{
- "name": "enable-fullscreen-handwriting-virtual-keyboard",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-future-v8-vm-features",
"owners": [ "hablich" ],
// This flag enables the rolling set of upcoming V8 features, for early
@@ -1207,6 +1168,11 @@
"expiry_milestone": 76
},
{
+ "name": "enable-hide-arc-media-notifications",
+ "owners": [ "beccahughes", "media-dev" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "enable-history-entry-requires-user-gesture",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -1228,13 +1194,13 @@
},
{
"name": "enable-hosted-app-quit-notification",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "ccameron" ],
+ "expiry_milestone": 77
},
{
- "name": "enable-html-base-username-detector",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "name": "enable-compositor-threaded-scrollbar-scrolling",
+ "owners": [ "arakeri@microsoft.com" ],
+ "expiry_milestone": 80
},
{
"name": "enable-implicit-root-scroller",
@@ -1262,6 +1228,11 @@
"expiry_milestone": 76
},
{
+ "name": "enable-intent-picker",
+ "owners": [ "chromeos-apps-foundation-team@google.com" ],
+ "expiry_milestone": 78
+ },
+ {
"name": "enable-javascript-harmony",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -1322,9 +1293,17 @@
"expiry_milestone": 76
},
{
+ "name": "enable-logging-js-console-messages",
+ "owners": [ "hazems" ],
+ // Never expires because it is used by developers to enable logging JS
+ // console messages in system logs for debugging purposes. It's disabled by
+ // default because logs may contain PII.
+ "expiry_milestone": -1
+ },
+ {
"name": "enable-lookalike-url-navigation-suggestions",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "jdeblasio", "meacer" ],
+ "expiry_milestone": 78
},
{
"name": "enable-mark-http-as",
@@ -1332,6 +1311,16 @@
"expiry_milestone": 76
},
{
+ "name": "enable-md-rounded-corners-on-dialogs",
+ "owners": ["bsep", "sajadm"],
+ "expiry_milestone": 78
+ },
+ {
+ "name": "enable-media-session-notifications",
+ "owners": [ "beccahughes", "media-dev" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "enable-media-session-service",
"owners": [ "beccahughes", "media-dev" ],
"expiry_milestone": 76
@@ -1342,16 +1331,16 @@
"expiry_milestone": 76
},
{
- "name": "enable-modal-permission-dialog-view",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-myfiles-volume",
"owners": [ "lucmult", "noel" ],
"expiry_milestone": 76
},
{
+ "name": "enable-nacl",
+ "owners": [ "dschuff", "native-client-dev@googlegroups.com" ],
+ "expiry_milestone": 87
+ },
+ {
"name": "enable-native-controls",
"owners": [ "chrome-media-ux@google.com" ],
"expiry_milestone": 75
@@ -1373,13 +1362,10 @@
},
{
"name": "enable-network-logging-to-file",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "enable-new-contacts-picker",
- "owners": [ "finnur", "peter" ],
- "expiry_milestone": 74
+ "owners": [ "eroman", "net-dev" ],
+ // This flag is used to capture early-browser network logging on platforms
+ // without easy access to startup time configuration.
+ "expiry_milestone": -1
},
{
"name": "download-auto-resumption-native",
@@ -1397,6 +1383,11 @@
"expiry_milestone": 72
},
{
+ "name": "enable-new-print-preview-layout",
+ "owners": [ "//printing/OWNERS" ],
+ "expiry_milestone": 78
+ },
+ {
"name": "enable-noscript-previews",
"owners": [ "//components/data_reduction_proxy/OWNERS" ],
"expiry_milestone": 76
@@ -1417,43 +1408,23 @@
"expiry_milestone": 76
},
{
- "name": "enable-ntp-asset-download-suggestions",
- "owners": [ "fgorski" ],
- "expiry_milestone": 76
- },
- {
- "name": "enable-ntp-bookmark-suggestions",
- "owners": [ "fgorski" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-ntp-button",
"owners": [ "twellington" ],
"expiry_milestone": 78
},
{
- "name": "enable-ntp-offline-page-download-suggestions",
- "owners": [ "fgorski" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-ntp-remote-suggestions",
"owners": [ "fgorski" ],
"expiry_milestone": 76
},
{
- "name": "enable-ntp-snippets-increased-visibility",
- "owners": [ "fgorski" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-ntp-suggestions-notifications",
"owners": [ "fgorski" ],
"expiry_milestone": 76
},
{
"name": "enable-offer-store-unmasked-wallet-cards",
- // "owners": [ "your-team" ],
+ "owners": [ "jsaul@google.com" ],
"expiry_milestone": 76
},
{
@@ -1472,11 +1443,6 @@
"expiry_milestone": 76
},
{
- "name": "enable-omnibox-voice-search-always-visible",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-oobe-recommend-apps-screen",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -1492,24 +1458,16 @@
"expiry_milestone": 76
},
{
- "name": "enable-origin-trials",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-osk-overscroll",
// "owners": [ "your-team" ],
"expiry_milestone": 76
},
{
"name": "enable-parallel-downloading",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "enable-per-user-timezone",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "qinmin", "xingliu", "dtrainor" ],
+ // This flag is used by dev teams on Android to disable this feature, since
+ // it can badly break pages under test.
+ "expiry_milestone": -1
},
{
"name": "enable-physical-keyboard-autocorrect",
@@ -1517,24 +1475,19 @@
"expiry_milestone": 76
},
{
- "name": "enable-picture-in-picture",
- "owners": [ "beaufort.francois@gmail.com", "mlamouri", "media-dev" ],
- "expiry_milestone": 76
- },
- {
- "name": "enable-pinch",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-pixel-canvas-recording",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "malaykeshav", "oshima" ],
+ "expiry_milestone": 77
},
{
"name": "enable-play-store-search",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "jennyz", "kaznacheev" ],
+ "expiry_milestone": 78
+ },
+ {
+ "name": "enable-portals",
+ "owners": [ "adithyas", "jbroman", "lfg" ],
+ "expiry_milestone": 80
},
{
"name": "enable-previews-android-omnibox-ui",
@@ -1552,17 +1505,17 @@
"expiry_milestone": 76
},
{
- "name": "enable-reader-mode-in-cct",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "name": "enable-reader-mode",
+ "owners": [ "gilmanmh@google.com" ],
+ "expiry_milestone": 78
},
{
- "name": "enable-recurrent-interstitial",
+ "name": "enable-reader-mode-in-cct",
// "owners": [ "your-team" ],
"expiry_milestone": 76
},
{
- "name": "enable-regional-locales-as-display-ui",
+ "name": "enable-recurrent-interstitial",
// "owners": [ "your-team" ],
"expiry_milestone": 76
},
@@ -1588,8 +1541,8 @@
},
{
"name": "enable-resource-load-scheduler",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "toyoshim" ],
+ "expiry_milestone": 78
},
{
"name": "enable-resource-loading-hints",
@@ -1597,11 +1550,21 @@
"expiry_milestone": 76
},
{
+ "name": "enable-revamped-context-menu",
+ "owners": [ "twellington" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "enable-safe-browsing-ap-download-verdicts",
"owners": [ "drubery" ],
"expiry_milestone": 76
},
{
+ "name": "enable-save-data",
+ "owners": [ "//components/data_reduction_proxy/OWNERS" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "enable-scroll-anchor-serialization",
"owners": [ "pnoland" ],
"expiry_milestone": 76
@@ -1613,7 +1576,22 @@
},
{
"name": "enable-send-tab-to-self",
- // "owners": [ "your-team" ],
+ "owners": [ "//components/send_tab_to_self/OWNERS" ],
+ "expiry_milestone": 77
+ },
+ {
+ "name": "enable-send-tab-to-self-broadcast",
+ "owners": [ "//components/send_tab_to_self/OWNERS" ],
+ "expiry_milestone": 76
+ },
+ {
+ "name": "enable-send-tab-to-self-show-sending-ui",
+ "owners": [ "//components/send_tab_to_self/OWNERS" ],
+ "expiry_milestone": 77
+ },
+ {
+ "name": "enable-sensor-content-setting",
+ "owners": [ "reillyg@chromium.org", "raphael.kubo.da.costa@intel.com" ],
"expiry_milestone": 76
},
{
@@ -1624,13 +1602,13 @@
},
{
"name": "enable-service-worker-long-running-message",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "azeemarshad", "jlklein", "falken" ],
+ "expiry_milestone": 77
},
{
"name": "enable-shill-sandboxing",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "mortonm" ],
+ "expiry_milestone": 77
},
{
"name": "enable-show-autofill-signatures",
@@ -1639,11 +1617,6 @@
"expiry_milestone": -1
},
{
- "name": "enable-signed-http-exchange",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-site-exploration-ui",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -1651,7 +1624,7 @@
{
"name": "enable-site-isolation-for-password-sites",
"owners": [ "site-isolation-dev", "alexmos", "lukasza" ],
- "expiry_milestone": 77
+ "expiry_milestone": 79
},
{
"name": "enable-site-per-process",
@@ -1662,22 +1635,17 @@
"expiry_milestone": -1
},
{
- "name": "enable-sole-integration",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "enable-speculative-service-worker-start-on-query-input",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "name": "enable-skia-renderer",
+ "owners": [ "backer"],
+ "expiry_milestone": 80
},
{
- "name": "enable-spelling-feedback-field-trial",
+ "name": "enable-sole-integration",
// "owners": [ "your-team" ],
"expiry_milestone": 76
},
{
- "name": "enable-stylus-virtual-keyboard",
+ "name": "enable-speculative-service-worker-start-on-query-input",
// "owners": [ "your-team" ],
"expiry_milestone": 76
},
@@ -1787,6 +1755,11 @@
"expiry_milestone": 76
},
{
+ "name": "enable-tab-engagement-reporting",
+ "owners": [ "memex-team@google.com" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "enable-text-fragment-anchor",
"owners": [ "bokan", "input-dev" ],
"expiry_milestone": 77
@@ -1812,8 +1785,8 @@
},
{
"name": "enable-usbguard",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "allenwebb", "mnissler", "jorgelo" ],
+ "expiry_milestone": 80
},
{
"name": "enable-use-zoom-for-dsf",
@@ -1836,29 +1809,19 @@
"expiry_milestone": 76
},
{
- "name": "enable-video-player-chromecast-support",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-virtual-keyboard",
"owners": [ "//ui/keyboard/OWNERS" ],
// Useful for debugging the virtual keyboard on non-tablet devices.
"expiry_milestone": -1
},
{
- "name": "enable-virtual-keyboard-ukm",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-viz-display-compositor",
"owners": [ "fsamuel", "kylechar" ],
"expiry_milestone": 76
},
{
- "name": "enable-viz-hit-test-draw-quad",
- "owners": [ "riajiang", "rjkroege" ],
+ "name": "enable-viz-hit-test",
+ "owners": [ "riajiang", "sunxd", "rjkroege" ],
"expiry_milestone": 76
},
{
@@ -1878,6 +1841,11 @@
"expiry_milestone": -1
},
{
+ "name": "enable-web-authentication-pin-support",
+ "owners": [ "webauthn-team@google.com" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "enable-webassembly",
"owners": [ "titzer", "wasm-team@google.com" ],
"expiry_milestone": 72
@@ -1915,11 +1883,6 @@
"expiry_milestone": 79
},
{
- "name": "enable-webrtc-h264-with-openh264-ffmpeg",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-webrtc-hide-local-ips-with-mdns",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -1941,13 +1904,13 @@
},
{
"name": "enable-webrtc-hybrid-agc",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "aleloi" ],
+ "expiry_milestone": 83
},
{
"name": "enable-webrtc-new-encode-cpu-load-estimator",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "nisse" ],
+ "expiry_milestone": 77
},
{
"name": "enable-webrtc-pipewire-capturer",
@@ -1995,6 +1958,11 @@
"expiry_milestone": 75
},
{
+ "name": "updated_cellular_activation_ui",
+ "owners": [ "azeemarshad", "khorimoto" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "use_messages_google_com_domain",
"owners": [ "azeemarshad", "khorimoto" ],
"expiry_milestone": 76
@@ -2016,18 +1984,13 @@
},
{
"name": "expensive-background-timer-throttling",
- // "owners": [ "your-team" ],
+ "owners": [ "altimin" ],
"expiry_milestone": 76
},
{
"name": "explore-sites",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "extension-active-script-permission",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "chili", "dewittj" ],
+ "expiry_milestone": 83
},
{
"name": "extension-apis",
@@ -2040,8 +2003,20 @@
"expiry_milestone": 76
},
{
+ "name": "extensions-toolbar-menu",
+ "owners": [ "//extensions/OWNERS", "pbos" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "extensions-on-chrome-urls",
- // "owners": [ "your-team" ],
+ "owners": [ "//extensions/OWNERS" ],
+ // This enables the use of extensions on chrome:// URLs. This is useful for
+ // a11y extensions as well as for debugging.
+ "expiry_milestone": -1
+ },
+ {
+ "name": "force-use-chrome-camera",
+ "owners": [ "shenghao", "chromeos-camera-app-eng@google.com" ],
"expiry_milestone": 76
},
{
@@ -2050,6 +2025,11 @@
"expiry_milestone": 76
},
{
+ "name": "file-manager-feedback-panel",
+ "owners": [ "adanilo" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "fill-on-account-select",
"owners": [ "jdoerrie" ],
"expiry_milestone": 76
@@ -2141,11 +2121,6 @@
"expiry_milestone": 76
},
{
- "name": "grant-notifications-to-dse",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "handwriting-gesture",
"owners": [ "shend" ],
"expiry_milestone": 76
@@ -2185,24 +2160,39 @@
"expiry_milestone": 76
},
{
+ "name": "in-session-password-change",
+ // "owners": [ "rsorokin" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "incognito-strings",
// "owners": [ "your-team" ],
"expiry_milestone": 76
},
{
+ "name": "installable-ink-drop",
+ "owners": [ "collinbaker", "pbos" ],
+ "expiry_milestone": 77
+ },
+ {
"name": "instant-tethering",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "khorimoto" ],
+ "expiry_milestone": 80
},
{
"name": "interest-feed-content-suggestions",
"owners": [ "//chrome/android/feed/OWNERS" ],
- "expiry_milestone": 74
+ "expiry_milestone": 76
},
{
- "name": "keep-prefetched-content-suggestions",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "name": "isolate-origins",
+ "owners": [ "site-isolation-dev", "alexmos", "creis", "lukasza" ],
+ "expiry_milestone": 79
+ },
+ {
+ "name": "kids-management-url-classification",
+ "owners": [ "alanwink", "vtrmc", "unichromeos-eng" ],
+ "expiry_milestone": 80
},
{
"name": "language-settings",
@@ -2215,11 +2205,6 @@
"expiry_milestone": 76
},
{
- "name": "link-managed-notice-to-management-page",
- "owners": [ "chrome-enterprise-team-core@google.com" ],
- "expiry_milestone": 76
- },
- {
"name": "list-all-display-modes",
"owners": [ "//ui/display/OWNERS" ],
// This flag is used for debugging and development purposes to list all
@@ -2246,9 +2231,14 @@
"expiry_milestone": 78
},
{
+ "name": "mac-system-media-permissions-info-ui",
+ "owners": [ "grunell", "engedy", "hkamila" ],
+ "expiry_milestone": 78
+ },
+ {
"name": "mac-views-task-manager",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "ellyjones" ],
+ "expiry_milestone": 77
},
{
"name": "manual-password-generation-android",
@@ -2266,11 +2256,6 @@
"expiry_milestone": 74
},
{
- "name": "material-design-ink-drop-animation-speed",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "media-router-cast-allow-all-ips",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -2285,24 +2270,6 @@
"expiry_milestone": -1
},
{
- "name": "memlog-keep-small-allocations",
- "owners": [ "erikchen", "ssid", "etienneb", "alph" ],
- // Memlog is Chrome's heap profiler. It is used for both automated and
- // manual performance analysis. This flag allows a user or developer to
- // capture a memlog without disturbing the situation under test by
- // restarting to apply a switch. It should not be removed.
- "expiry_milestone": -1
- },
- {
- "name": "memlog-in-process",
- "owners": [ "erikchen", "ssid", "etienneb", "alph" ],
- // Memlog is Chrome's heap profiler. It is used for both automated and
- // manual performance analysis. This flag allows a user or developer to
- // capture a memlog without disturbing the situation under test by
- // restarting to apply a switch. It should not be removed.
- "expiry_milestone": -1
- },
- {
"name": "memlog-sampling-rate",
"owners": [ "erikchen", "ssid", "etienneb", "alph" ],
// Memlog is Chrome's heap profiler. It is used for both automated and
@@ -2326,23 +2293,33 @@
"expiry_milestone": 76
},
{
+ "name": "mime-handler-view-in-cross-process-frame",
+ "owners": [ "ekaramad" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "mobile-identity-consistency",
"owners": [ "bsazonov", "droger", "msarda" ],
"expiry_milestone": 80
},
{
+ "name": "mojo-imf",
+ "owners": [ "shuchen" ],
+ "expiry_milestone": 78
+ },
+ {
"name": "native-filesystem-api",
"owners": [ "mek", "pwnall" ],
"expiry_milestone": 80
},
{
"name": "network-service",
- // "owners": [ "your-team" ],
+ "owners": [ "network-service-dev" ],
"expiry_milestone": 76
},
{
"name": "network-service-in-process",
- // "owners": [ "your-team" ],
+ "owners": [ "network-service-dev" ],
"expiry_milestone": 76
},
{
@@ -2361,11 +2338,6 @@
"expiry_milestone": 76
},
{
- "name": "new-tab-button-position",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "new-tab-loading-animation",
"owners": [ "pbos@chromium.org" ],
"expiry_milestone": 76
@@ -2386,6 +2358,11 @@
"expiry_milestone": 76
},
{
+ "name": "ntp-customization-menu-v2",
+ "owners": ["kmilka", "ramyan"],
+ "expiry_milestone": 77
+ },
+ {
"name": "oculus-vr",
"owners": [ "//device/vr/OWNERS", "xr-dev@chromium.org" ],
"expiry_milestone": 76
@@ -2521,6 +2498,11 @@
"expiry_milestone": 76
},
{
+ "name": "omnibox-suggestion-transparency-options",
+ "owners": [ "tommycli", "chrome-omnibox-team@google.com" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "omnibox-tab-switch-suggestions",
"owners": [ "krb", "chrome-omnibox-team@google.com" ],
"expiry_milestone": 76
@@ -2611,6 +2593,11 @@
"expiry_milestone": 80
},
{
+ "name": "omnibox-zero-suggestions-on-ntp",
+ "omners": [ "chrome-android-omnibox-team@google.com" ],
+ "expiry_milestone": 81
+ },
+ {
"name": "only-new-password-form-parsing",
"owners": [ "dvadym" ],
"expiry_milestone": 76
@@ -2627,7 +2614,7 @@
},
{
"name": "out-of-blink-cors",
- // "owners": [ "your-team" ],
+ "owners": [ "toyoshim" ],
"expiry_milestone": 76
},
{
@@ -2654,8 +2641,8 @@
},
{
"name": "overscroll-history-navigation",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "mohsen", "jinsukkim" ],
+ "expiry_milestone": 77
},
{
"name": "overscroll-start-threshold",
@@ -2663,11 +2650,6 @@
"expiry_milestone": 76
},
{
- "name": "page-almost-idle",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "passive-event-listeners-due-to-fling",
"owners": [ "sahel", "input-dev" ],
"expiry_milestone": 76
@@ -2694,12 +2676,12 @@
},
{
"name": "pdf-form-save",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "thestig" ],
+ "expiry_milestone": 78
},
{
"name": "pdf-isolation",
- // "owners": [ "your-team" ],
+ "owners": [ "tsepez" ],
"expiry_milestone": 76
},
{
@@ -2758,11 +2740,6 @@
"expiry_milestone": 76
},
{
- "name": "reset-app-list-install-state",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "rewrite-leveldb-on-deletion",
"owners": [ "dullweber" ],
"expiry_milestone": 75
@@ -2788,11 +2765,6 @@
"expiry_milestone": 76
},
{
- "name": "save-page-as-mhtml",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "scheduler-configuration",
"owners": [ "kerrnel", "mnissler" ],
"expiry_milestone": 76
@@ -2821,8 +2793,8 @@
},
{
"name": "shelf-hover-previews",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "manucornet" ],
+ "expiry_milestone": 77
},
{
"name": "show-autofill-type-predictions",
@@ -2836,11 +2808,6 @@
"expiry_milestone": 76
},
{
- "name": "show-overdraw-feedback",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "show-taps",
"owners": [ "//ash/OWNERS" ],
// This is a debug flag, so that video bug reports can show input taps to
@@ -2897,11 +2864,6 @@
"expiry_milestone": 80
},
{
- "name": "spannable-inline-autocomplete",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "ssl-committed-interstitials",
// "owners": [ "your-team" ],
"expiry_milestone": 76
@@ -2942,24 +2904,24 @@
"expiry_milestone": 79
},
{
- "name": "tab-for-desktop-share",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "tab-groups",
"owners": [ "chrome-desktop-ui-seattle@google.com", "bsep" ],
- "expiry_milestone": 76
+ "expiry_milestone": 82
},
{
"name": "tab-hover-cards",
"owners": [ "corising", "//chrome/browser/ui/views/tabs/OWNERS" ],
- "expiry_milestone": 76
+ "expiry_milestone": 82
},
{
"name": "tab-hover-card-images",
"owners": [ "dfried", "corising", "//chrome/browser/ui/views/tabs/OWNERS" ],
- "expiry_milestone": 76
+ "expiry_milestone": 82
+ },
+ {
+ "name": "scrollable-tabstrip",
+ "owners": ["chrome-desktop-ui-seattle@google.com", "tbergquist"],
+ "expiry_milestone": 82
},
{
"name": "tint-gl-composited-content",
@@ -3029,8 +2991,10 @@
},
{
"name": "ui-slow-animations",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "oshima", "sammiequon", "afakhry" ],
+ // This flag is used for in-the-field debugging of animation issues on
+ // Chrome OS.
+ "expiry_milestone": -1
},
{
"name": "unfiltered-bluetooth-devices",
@@ -3048,11 +3012,6 @@
"expiry_milestone": 76
},
{
- "name": "upcoming-ui-features",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "update-menu-item-custom-summary",
"owners": [ "//chrome/android/java/src/org/chromium/chrome/browser/omaha/OWNERS" ],
// This is required by test teams to verify functionality on devices which
@@ -3074,18 +3033,13 @@
"expiry_milestone": 75
},
{
- "name": "use-monitor-color-space",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "use-multilogin-endpoint",
"owners": [ "droger", "msarda" ],
"expiry_milestone": 78
},
{
"name": "use-new-accept-language-header",
- // "owners": [ "your-team" ],
+ "owners": [ "claudiomagni" ],
"expiry_milestone": 76
},
{
@@ -3101,7 +3055,9 @@
{
"name": "use-sync-sandbox",
"owners": [ "//components/sync/OWNERS" ],
- "expiry_milestone": 76
+ // This flag is required for testing with the related
+ // wallet-service-use-sandbox on Android.
+ "expiry_milestone": -1
},
{
"name": "use-winrt-midi-api",
@@ -3124,34 +3080,21 @@
"expiry_milestone": 76
},
{
- "name": "video-fullscreen-orientation-lock",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
- "name": "video-rotate-to-fullscreen",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "views-cast-dialog",
"owners": [ "//chrome/browser/media/router/OWNERS" ],
"expiry_milestone": 76
},
{
- "name": "virtual-keyboard-overscroll",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
- },
- {
"name": "wake-on-wifi-packet",
"owners": [ "abhishekbh", "chirantan" ],
"expiry_milestone": 76
},
{
"name": "wallet-service-use-sandbox",
- // "owners": [ "your-team" ],
- "expiry_milestone": 76
+ "owners": [ "jsaul@google.com", "jiahuiguo", "payments-autofill-team@google.com" ],
+ // This flag is used by testing teams to run Google Payments calls against
+ // the development server environment.
+ "expiry_milestone": -1
},
{
"name": "web-contents-occlusion",
@@ -3159,21 +3102,11 @@
"expiry_milestone": 77
},
{
- "name": "webrtc-unified-plan-by-default",
- "owners": [ "//third_party/blink/renderer/modules/peerconnection/OWNERS", "hbos@chromium.org" ],
- "expiry_milestone": 75
- },
- {
"name": "webxr",
"owners": [ "//third_party/blink/renderer/modules/xr/OWNERS", "xr-dev@chromium.org" ],
"expiry_milestone": 79
},
{
- "name": "webxr-gamepad-support",
- "owners": [ "//third_party/blink/renderer/modules/xr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 76
- },
- {
"name": "webxr-hit-test",
"owners": [ "//third_party/blink/renderer/modules/xr/OWNERS", "xr-dev@chromium.org" ],
"expiry_milestone": 76
@@ -3192,6 +3125,11 @@
"name": "xr-sandbox",
"owners": [ "//chrome/services/isolated_xr_device/OWNERS", "xr-dev@chromium.org" ],
"expiry_milestone": 76
+ },
+ {
+ "name": "enable-streamlined-usb-printer-setup",
+ "owners": [ "baileyberro" ],
+ "expiry_milestone": 77
}
// This is an alphabetized list; please do your part to keep it organized by
diff --git a/chromium/chrome/browser/flag-never-expire-list.json b/chromium/chrome/browser/flag-never-expire-list.json
new file mode 100644
index 00000000000..54615858411
--- /dev/null
+++ b/chromium/chrome/browser/flag-never-expire-list.json
@@ -0,0 +1,66 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This file contains a list of flags that are permitted to have the
+// never-expire flag set (i.e., expiration milestone set to -1). This is a
+// separate file from flag-metadata.json so that that file can have per-file
+// owners set to * while still having flags-team policy about unexpiring flags
+// applied via ownership of this file. Note that these flags are not *required*
+// to have never-expire set; they are simply permitted to (i.e., there is no
+// enforcement the other direction).
+//
+// The format of this file is a list of flag names; it is validated by a unit
+// test (AboutFlagsTest.OnlyPermittedFlagsNeverExpire).
+[
+ "ash-debug-shortcuts",
+ "ash-enable-unified-desktop",
+ "dcheck-is-fatal",
+ "disable-accelerated-2d-canvas",
+ "disable-accelerated-mjpeg-decode",
+ "disable-accelerated-video-decode",
+ "disable-explicit-dma-fences",
+ "disable-threaded-scrolling",
+ "disable-webrtc-hw-decoding",
+ "disable-webrtc-hw-encoding",
+ "enable-autofill-credit-card-upload",
+ "enable-devtools-experiments",
+ "enable-experimental-web-platform-features",
+ "enable-future-v8-vm-features",
+ "enable-gpu-rasterization",
+ "enable-gpu-service-logging",
+ "enable-logging-js-console-messages",
+ "enable-network-logging-to-file",
+ "enable-parallel-downloading",
+ "enable-show-autofill-signatures",
+ "enable-site-per-process",
+ "enable-touchscreen-calibration",
+ "enable-ui-devtools",
+ "enable-virtual-keyboard",
+ "enable-web-authentication-testing-api",
+ "enable-webgl-draft-extensions",
+ "extensions-on-chrome-urls",
+ "force-effective-connection-type",
+ "force-show-update-menu-badge",
+ "force-update-menu-type",
+ "ignore-gpu-blacklist",
+ "ignore-previews-blocklist",
+ "list-all-display-modes",
+ "load-media-router-component-extension",
+ "memlog",
+ "memlog-sampling-rate",
+ "memlog-stack-mode",
+ "overlay-strategies",
+ "set-market-url-for-testing",
+ "show-autofill-type-predictions",
+ "show-taps",
+ "show-touch-hud",
+ "tint-gl-composited-content",
+ "translate-android-manual-trigger",
+ "ui-disable-partial-swap",
+ "ui-slow-animations",
+ "update-menu-item-custom-summary",
+ "use-angle",
+ "use-sync-sandbox",
+ "wallet-service-use-sandbox"
+]
diff --git a/chromium/chrome/browser/notifications/proto/BUILD.gn b/chromium/chrome/browser/notifications/proto/BUILD.gn
index 647f3927d12..8e80255f0ec 100644
--- a/chromium/chrome/browser/notifications/proto/BUILD.gn
+++ b/chromium/chrome/browser/notifications/proto/BUILD.gn
@@ -6,7 +6,9 @@ import("//third_party/protobuf/proto_library.gni")
proto_library("proto") {
sources = [
+ "client_state.proto",
"icon.proto",
+ "impression.proto",
"notification_data.proto",
]
}
diff --git a/chromium/chrome/browser/notifications/scheduler/BUILD.gn b/chromium/chrome/browser/notifications/scheduler/BUILD.gn
index 46880a6b175..967b18b8731 100644
--- a/chromium/chrome/browser/notifications/scheduler/BUILD.gn
+++ b/chromium/chrome/browser/notifications/scheduler/BUILD.gn
@@ -9,10 +9,8 @@ if (is_android) {
}
group("scheduler") {
- # TODO(xingliu): Change this to a source set when we have code to be used by
- # NotificationScheduleServiceFactory.
deps = [
- ":lib",
+ ":factory",
]
public_deps = [
@@ -28,6 +26,7 @@ source_set("public") {
"notification_params.cc",
"notification_params.h",
"notification_schedule_service.h",
+ "notification_scheduler_types.h",
"schedule_params.cc",
"schedule_params.h",
]
@@ -38,19 +37,73 @@ source_set("public") {
]
}
+# The embedder can depend on this target to get the internal library.
+source_set("factory") {
+ sources = [
+ "schedule_service_factory_helper.cc",
+ "schedule_service_factory_helper.h",
+ ]
+
+ deps = [
+ ":lib",
+ ":public",
+ "//base",
+ "//components/keyed_service/core",
+ "//components/leveldb_proto",
+ ]
+}
+
# Internal library that embedders should not directly depend on.
source_set("lib") {
+ visibility = [
+ ":factory",
+ ":scheduler",
+ ":unit_tests",
+ "//chrome/browser/notifications/scheduler/test:test_lib",
+ ]
+
sources = [
"collection_store.h",
+ "display_decider.cc",
+ "display_decider.h",
+ "distribution_policy.cc",
+ "distribution_policy.h",
+ "icon_entry.cc",
+ "icon_entry.h",
+ "icon_store.cc",
+ "icon_store.h",
+ "impression_history_tracker.cc",
+ "impression_history_tracker.h",
+ "impression_store.cc",
+ "impression_store.h",
+ "impression_types.cc",
+ "impression_types.h",
+ "init_aware_scheduler.cc",
+ "init_aware_scheduler.h",
+ "internal_types.h",
+ "notification_entry.cc",
+ "notification_entry.h",
"notification_schedule_service_impl.cc",
"notification_schedule_service_impl.h",
- "proto_db_collection_store.cc",
- "proto_db_collection_store.h",
+ "notification_scheduler.cc",
+ "notification_scheduler.h",
+ "notification_scheduler_context.cc",
+ "notification_scheduler_context.h",
+ "proto_conversion.cc",
+ "proto_conversion.h",
+ "scheduled_notification_manager.cc",
+ "scheduled_notification_manager.h",
+ "scheduler_config.cc",
+ "scheduler_config.h",
+ "scheduler_utils.cc",
+ "scheduler_utils.h",
]
+ # This target should not depend on anything in //chrome/* except the proto library.
deps = [
":public",
"//base",
+ "//chrome/browser/notifications/proto",
"//components/keyed_service/core",
"//components/leveldb_proto",
]
@@ -59,12 +112,22 @@ source_set("lib") {
source_set("unit_tests") {
testonly = true
sources = [
- "proto_db_collection_store_unittest.cc",
+ "display_decider_unittest.cc",
+ "distribution_policy_unittest.cc",
+ "icon_store_unittest.cc",
+ "impression_history_tracker_unittest.cc",
+ "impression_store_unittest.cc",
+ "init_aware_scheduler_unittest.cc",
+ "proto_conversion_unittest.cc",
+ "scheduled_notification_manager_unittest.cc",
+ "scheduler_utils_unittest.cc",
]
deps = [
":lib",
":public",
+ "//chrome/browser/notifications/proto",
+ "//chrome/browser/notifications/scheduler/test:test_lib",
"//components/leveldb_proto:test_support",
"//testing/gmock",
"//testing/gtest",
diff --git a/chromium/chrome/browser/notifications/scheduler/test/BUILD.gn b/chromium/chrome/browser/notifications/scheduler/test/BUILD.gn
new file mode 100644
index 00000000000..ac37ed52dc0
--- /dev/null
+++ b/chromium/chrome/browser/notifications/scheduler/test/BUILD.gn
@@ -0,0 +1,24 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/buildflag_header.gni")
+
+if (is_android) {
+ import("//build/config/android/rules.gni")
+}
+
+source_set("test_lib") {
+ visibility = [ "//chrome/browser/notifications/scheduler:unit_tests" ]
+
+ sources = [
+ "test_utils.cc",
+ "test_utils.h",
+ ]
+
+ deps = [
+ "//base",
+ "//chrome/browser/notifications/scheduler:lib",
+ "//chrome/browser/notifications/scheduler:public",
+ ]
+}
diff --git a/chromium/chrome/browser/printing/cloud_print/privet_notifications.cc b/chromium/chrome/browser/printing/cloud_print/privet_notifications.cc
index 39b3868e9b8..8087b4f7ee5 100644
--- a/chromium/chrome/browser/printing/cloud_print/privet_notifications.cc
+++ b/chromium/chrome/browser/printing/cloud_print/privet_notifications.cc
@@ -295,7 +295,8 @@ void PrivetNotificationService::AddNotification(
NotificationDisplayService::GetForProfile(
Profile::FromBrowserContext(profile_))
- ->Display(NotificationHandler::Type::TRANSIENT, notification);
+ ->Display(NotificationHandler::Type::TRANSIENT, notification,
+ /*metadata=*/nullptr);
}
void PrivetNotificationService::PrivetRemoveNotification() {
diff --git a/chromium/chrome/browser/printing/pdf_to_emf_converter_browsertest.cc b/chromium/chrome/browser/printing/pdf_to_emf_converter_browsertest.cc
index 2b9a3e2a4f7..b038a8c7628 100644
--- a/chromium/chrome/browser/printing/pdf_to_emf_converter_browsertest.cc
+++ b/chromium/chrome/browser/printing/pdf_to_emf_converter_browsertest.cc
@@ -8,10 +8,10 @@
#include "base/bind.h"
#include "base/files/file_util.h"
+#include "base/hash/sha1.h"
#include "base/memory/ref_counted_memory.h"
#include "base/path_service.h"
#include "base/run_loop.h"
-#include "base/sha1.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
diff --git a/chromium/chrome/browser/printing/print_browsertest.cc b/chromium/chrome/browser/printing/print_browsertest.cc
index a511f7243af..a2f6e6af032 100644
--- a/chromium/chrome/browser/printing/print_browsertest.cc
+++ b/chromium/chrome/browser/printing/print_browsertest.cc
@@ -47,10 +47,12 @@ namespace {
constexpr int kDefaultDocumentCookie = 1234;
-class PrintPreviewObserver : PrintPreviewUI::TestingDelegate {
+class PrintPreviewObserver : PrintPreviewUI::TestDelegate {
public:
PrintPreviewObserver() { PrintPreviewUI::SetDelegateForTesting(this); }
- ~PrintPreviewObserver() { PrintPreviewUI::SetDelegateForTesting(nullptr); }
+ ~PrintPreviewObserver() override {
+ PrintPreviewUI::SetDelegateForTesting(nullptr);
+ }
void WaitUntilPreviewIsReady() {
if (rendered_page_count_ >= total_page_count_)
@@ -62,12 +64,12 @@ class PrintPreviewObserver : PrintPreviewUI::TestingDelegate {
}
private:
- // PrintPreviewUI::TestingDelegate implementation.
+ // PrintPreviewUI::TestDelegate:
void DidGetPreviewPageCount(int page_count) override {
total_page_count_ = page_count;
}
- // PrintPreviewUI::TestingDelegate implementation.
+ // PrintPreviewUI::TestDelegate:
void DidRenderPreviewPage(content::WebContents* preview_dialog) override {
++rendered_page_count_;
CHECK(rendered_page_count_ <= total_page_count_);
@@ -79,6 +81,35 @@ class PrintPreviewObserver : PrintPreviewUI::TestingDelegate {
int total_page_count_ = 1;
int rendered_page_count_ = 0;
base::RunLoop* run_loop_ = nullptr;
+
+ DISALLOW_COPY_AND_ASSIGN(PrintPreviewObserver);
+};
+
+class NupPrintingTestDelegate : public PrintingMessageFilter::TestDelegate {
+ public:
+ NupPrintingTestDelegate() {
+ PrintingMessageFilter::SetDelegateForTesting(this);
+ }
+ ~NupPrintingTestDelegate() override {
+ PrintingMessageFilter::SetDelegateForTesting(nullptr);
+ }
+
+ // PrintingMessageFilter::TestDelegate:
+ PrintMsg_Print_Params GetPrintParams() override {
+ PrintMsg_Print_Params params;
+ params.page_size = gfx::Size(612, 792);
+ params.content_size = gfx::Size(540, 720);
+ params.printable_area = gfx::Rect(612, 792);
+ params.dpi = gfx::Size(72, 72);
+ params.document_cookie = kDefaultDocumentCookie;
+ params.pages_per_sheet = 4;
+ params.printed_doc_type =
+ IsOopifEnabled() ? SkiaDocumentType::MSKP : SkiaDocumentType::PDF;
+ return params;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NupPrintingTestDelegate);
};
class TestPrintFrameContentMsgFilter : public content::BrowserMessageFilter {
@@ -204,19 +235,6 @@ class PrintBrowserTest : public InProcessBrowserTest {
return params;
}
- static PrintMsg_Print_Params GetNupPrintParams() {
- PrintMsg_Print_Params params;
- params.page_size = gfx::Size(612, 792);
- params.content_size = gfx::Size(612, 792);
- params.printable_area = gfx::Rect(612, 792);
- params.dpi = gfx::Size(72, 72);
- params.document_cookie = kDefaultDocumentCookie;
- params.pages_per_sheet = 4;
- params.printed_doc_type =
- IsOopifEnabled() ? SkiaDocumentType::MSKP : SkiaDocumentType::PDF;
- return params;
- }
-
private:
unsigned int num_expected_messages_;
unsigned int num_received_messages_;
@@ -587,21 +605,21 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessPrintExtensionBrowserTest,
// Printing frame content for the main frame of a generic webpage with N-up
// priting. This is a regression test for https://crbug.com/937247
IN_PROC_BROWSER_TEST_F(PrintBrowserTest, PrintNup) {
+ NupPrintingTestDelegate test_delegate;
ASSERT_TRUE(embedded_test_server()->Started());
GURL url(embedded_test_server()->GetURL("/printing/test1.html"));
ui_test_utils::NavigateToURL(browser(), url);
- PrintingMessageFilter::SetTestUpdatePrintSettingsReply(GetNupPrintParams());
PrintAndWaitUntilPreviewIsReady(/*print_only_selection=*/false);
}
// Site per process version of PrintBrowserTest.PrintNup.
IN_PROC_BROWSER_TEST_F(SitePerProcessPrintBrowserTest, PrintNup) {
+ NupPrintingTestDelegate test_delegate;
ASSERT_TRUE(embedded_test_server()->Started());
GURL url(embedded_test_server()->GetURL("/printing/test1.html"));
ui_test_utils::NavigateToURL(browser(), url);
- PrintingMessageFilter::SetTestUpdatePrintSettingsReply(GetNupPrintParams());
PrintAndWaitUntilPreviewIsReady(/*print_only_selection=*/false);
}
diff --git a/chromium/chrome/browser/printing/print_preview_dialog_controller.cc b/chromium/chrome/browser/printing/print_preview_dialog_controller.cc
index 5d7878eb7fb..ab6f9f4d19e 100644
--- a/chromium/chrome/browser/printing/print_preview_dialog_controller.cc
+++ b/chromium/chrome/browser/printing/print_preview_dialog_controller.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
@@ -142,12 +143,17 @@ void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const {
size->SetToMax(outermost_web_contents->GetContainerBounds().size());
size->Enlarge(-2 * kBorder, -kBorder);
+ static const gfx::Size kMaxDialogSize(1000, 660);
+ bool should_limit_dialog_size =
+ base::FeatureList::IsEnabled(::features::kNewPrintPreviewLayout);
#if defined(OS_MACOSX)
// Limit the maximum size on MacOS X.
// http://crbug.com/105815
- const gfx::Size kMaxDialogSize(1000, 660);
- size->SetToMin(kMaxDialogSize);
+ should_limit_dialog_size = true;
#endif
+ if (should_limit_dialog_size) {
+ size->SetToMin(kMaxDialogSize);
+ }
}
std::string PrintPreviewDialogDelegate::GetDialogArgs() const {
diff --git a/chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc b/chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc
index 30b35d1de66..98fb0002f4a 100644
--- a/chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc
+++ b/chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc
@@ -50,9 +50,8 @@ namespace {
class RequestPrintPreviewObserver : public WebContentsObserver {
public:
explicit RequestPrintPreviewObserver(WebContents* dialog)
- : WebContentsObserver(dialog) {
- }
- ~RequestPrintPreviewObserver() override {}
+ : WebContentsObserver(dialog) {}
+ ~RequestPrintPreviewObserver() override = default;
void set_quit_closure(const base::Closure& quit_closure) {
quit_closure_ = quit_closure;
@@ -83,9 +82,8 @@ class RequestPrintPreviewObserver : public WebContentsObserver {
class PrintPreviewDialogClonedObserver : public WebContentsObserver {
public:
explicit PrintPreviewDialogClonedObserver(WebContents* dialog)
- : WebContentsObserver(dialog) {
- }
- ~PrintPreviewDialogClonedObserver() override {}
+ : WebContentsObserver(dialog) {}
+ ~PrintPreviewDialogClonedObserver() override = default;
RequestPrintPreviewObserver* request_preview_dialog_observer() {
return request_preview_dialog_observer_.get();
@@ -107,10 +105,8 @@ class PrintPreviewDialogClonedObserver : public WebContentsObserver {
class PrintPreviewDialogDestroyedObserver : public WebContentsObserver {
public:
explicit PrintPreviewDialogDestroyedObserver(WebContents* dialog)
- : WebContentsObserver(dialog),
- dialog_destroyed_(false) {
- }
- ~PrintPreviewDialogDestroyedObserver() override {}
+ : WebContentsObserver(dialog) {}
+ ~PrintPreviewDialogDestroyedObserver() override = default;
bool dialog_destroyed() const { return dialog_destroyed_; }
@@ -118,7 +114,7 @@ class PrintPreviewDialogDestroyedObserver : public WebContentsObserver {
// content::WebContentsObserver implementation.
void WebContentsDestroyed() override { dialog_destroyed_ = true; }
- bool dialog_destroyed_;
+ bool dialog_destroyed_ = false;
DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogDestroyedObserver);
};
@@ -157,8 +153,8 @@ void CheckPdfPluginForRenderFrame(content::RenderFrameHost* frame) {
class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest {
public:
- PrintPreviewDialogControllerBrowserTest() : initiator_(nullptr) {}
- ~PrintPreviewDialogControllerBrowserTest() override {}
+ PrintPreviewDialogControllerBrowserTest() = default;
+ ~PrintPreviewDialogControllerBrowserTest() override = default;
WebContents* initiator() {
return initiator_;
@@ -177,9 +173,9 @@ class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest {
return dialog_controller->GetPrintPreviewForContents(initiator_);
}
- void SetAlwaysOpenPdfExternallyForTests(bool always_open_pdf_externally) {
+ void SetAlwaysOpenPdfExternallyForTests() {
PluginPrefs::GetForProfile(browser()->profile())
- ->SetAlwaysOpenPdfExternallyForTests(always_open_pdf_externally);
+ ->SetAlwaysOpenPdfExternallyForTests(true);
}
private:
@@ -219,7 +215,7 @@ class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest {
}
std::unique_ptr<PrintPreviewDialogClonedObserver> cloned_tab_observer_;
- WebContents* initiator_;
+ WebContents* initiator_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogControllerBrowserTest);
};
@@ -304,7 +300,7 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest,
ASSERT_TRUE(GetPdfPluginInfo(&pdf_plugin_info));
// Disable the PDF plugin.
- SetAlwaysOpenPdfExternallyForTests(true);
+ SetAlwaysOpenPdfExternallyForTests();
// Make sure it is actually disabled for webpages.
ChromePluginServiceFilter* filter = ChromePluginServiceFilter::GetInstance();
@@ -354,6 +350,8 @@ const std::vector<task_manager::WebContentsTag*>& GetTrackedTags() {
return task_manager::WebContentsTagsManager::GetInstance()->tracked_tags();
}
+} // namespace
+
IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest,
TaskManagementTest) {
// This test starts with two tabs open.
@@ -404,5 +402,3 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest,
WebContents* preview_dialog = GetPrintPreviewDialog();
WaitForAccessibilityTreeToContainNodeWithName(preview_dialog, "HelloWorld");
}
-
-} // namespace
diff --git a/chromium/chrome/browser/printing/print_preview_dialog_controller_unittest.cc b/chromium/chrome/browser/printing/print_preview_dialog_controller_unittest.cc
index dba60bb8c4f..8c1ad0e1f88 100644
--- a/chromium/chrome/browser/printing/print_preview_dialog_controller_unittest.cc
+++ b/chromium/chrome/browser/printing/print_preview_dialog_controller_unittest.cc
@@ -34,10 +34,8 @@ class TestWebContentsDelegate : public content::WebContentsDelegate {};
class PrintPreviewDialogDestroyedObserver : public WebContentsObserver {
public:
explicit PrintPreviewDialogDestroyedObserver(WebContents* dialog)
- : WebContentsObserver(dialog),
- dialog_destroyed_(false) {
- }
- ~PrintPreviewDialogDestroyedObserver() override {}
+ : WebContentsObserver(dialog) {}
+ ~PrintPreviewDialogDestroyedObserver() override = default;
bool dialog_destroyed() const { return dialog_destroyed_; }
@@ -45,7 +43,7 @@ class PrintPreviewDialogDestroyedObserver : public WebContentsObserver {
// content::WebContentsObserver implementation.
void WebContentsDestroyed() override { dialog_destroyed_ = true; }
- bool dialog_destroyed_;
+ bool dialog_destroyed_ = false;
DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogDestroyedObserver);
};
@@ -371,4 +369,5 @@ TEST_F(PrintPreviewDialogControllerUnitTest, MultiplePreviewDialogsClose) {
web_contents_2->GetMainFrame()->GetProcess());
rph->SimulateCrash();
}
+
} // namespace printing
diff --git a/chromium/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc b/chromium/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc
index 23b6b3e58e7..d328244da2f 100644
--- a/chromium/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc
+++ b/chromium/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc
@@ -21,10 +21,10 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/hash/md5.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/md5.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
diff --git a/chromium/chrome/browser/printing/print_preview_test.cc b/chromium/chrome/browser/printing/print_preview_test.cc
index c67659c64e4..d5de67f8b13 100644
--- a/chromium/chrome/browser/printing/print_preview_test.cc
+++ b/chromium/chrome/browser/printing/print_preview_test.cc
@@ -9,6 +9,6 @@
PrintPreviewTest::PrintPreviewTest() {}
PrintPreviewTest::~PrintPreviewTest() {}
-BrowserWindow* PrintPreviewTest::CreateBrowserWindow() {
- return new DialogTestBrowserWindow;
+std::unique_ptr<BrowserWindow> PrintPreviewTest::CreateBrowserWindow() {
+ return std::make_unique<DialogTestBrowserWindow>();
}
diff --git a/chromium/chrome/browser/printing/print_preview_test.h b/chromium/chrome/browser/printing/print_preview_test.h
index 4f8034d2b39..6df878507fb 100644
--- a/chromium/chrome/browser/printing/print_preview_test.h
+++ b/chromium/chrome/browser/printing/print_preview_test.h
@@ -15,7 +15,7 @@ class PrintPreviewTest : public BrowserWithTestWindowTest {
protected:
// Create a browser window to provide parenting for web contents modal dialog.
- BrowserWindow* CreateBrowserWindow() override;
+ std::unique_ptr<BrowserWindow> CreateBrowserWindow() override;
private:
DISALLOW_COPY_AND_ASSIGN(PrintPreviewTest);
diff --git a/chromium/chrome/browser/printing/printing_message_filter.cc b/chromium/chrome/browser/printing/printing_message_filter.cc
index 3f6007d5c09..0291dfdec6a 100644
--- a/chromium/chrome/browser/printing/printing_message_filter.cc
+++ b/chromium/chrome/browser/printing/printing_message_filter.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/memory/singleton.h"
-#include "base/no_destructor.h"
#include "base/task/post_task.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
@@ -42,10 +41,7 @@ namespace printing {
namespace {
-PrintMsg_Print_Params& GetTestUpdatePrintSettingsReply() {
- static base::NoDestructor<PrintMsg_Print_Params> params;
- return *params;
-}
+PrintingMessageFilter::TestDelegate* g_test_delegate = nullptr;
class PrintingMessageFilterShutdownNotifierFactory
: public BrowserContextKeyedServiceShutdownNotifierFactory {
@@ -89,10 +85,8 @@ PrintViewManager* GetPrintViewManager(int render_process_id,
} // namespace
// static
-void PrintingMessageFilter::SetTestUpdatePrintSettingsReply(
- const PrintMsg_Print_Params& print_params) {
- auto& test_params = GetTestUpdatePrintSettingsReply();
- test_params = print_params;
+void PrintingMessageFilter::SetDelegateForTesting(TestDelegate* delegate) {
+ g_test_delegate = delegate;
}
PrintingMessageFilter::PrintingMessageFilter(int render_process_id,
@@ -282,9 +276,8 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
}
#endif
- auto& test_params = GetTestUpdatePrintSettingsReply();
- if (test_params.document_cookie > 0)
- params.params = test_params;
+ if (g_test_delegate)
+ params.params = g_test_delegate->GetPrintParams();
PrintHostMsg_UpdatePrintSettings::WriteReplyParams(reply_msg, params,
canceled);
diff --git a/chromium/chrome/browser/printing/printing_message_filter.h b/chromium/chrome/browser/printing/printing_message_filter.h
index 4607c9af91b..04b76398ebe 100644
--- a/chromium/chrome/browser/printing/printing_message_filter.h
+++ b/chromium/chrome/browser/printing/printing_message_filter.h
@@ -33,9 +33,16 @@ class PrinterQuery;
// renderer process on the IPC thread.
class PrintingMessageFilter : public content::BrowserMessageFilter {
public:
- // Sets a global override for print params in OnUpdatePrintSettingsReply().
- static void SetTestUpdatePrintSettingsReply(
- const PrintMsg_Print_Params& print_params);
+ class TestDelegate {
+ public:
+ // Returns the print params to be used in OnUpdatePrintSettingsReply().
+ virtual PrintMsg_Print_Params GetPrintParams() = 0;
+
+ protected:
+ virtual ~TestDelegate() = default;
+ };
+
+ static void SetDelegateForTesting(TestDelegate* delegate);
PrintingMessageFilter(int render_process_id, Profile* profile);
diff --git a/chromium/chrome/browser/printing/pwg_raster_converter_browsertest.cc b/chromium/chrome/browser/printing/pwg_raster_converter_browsertest.cc
index c1e192c5f49..b2e3f2bf203 100644
--- a/chromium/chrome/browser/printing/pwg_raster_converter_browsertest.cc
+++ b/chromium/chrome/browser/printing/pwg_raster_converter_browsertest.cc
@@ -6,10 +6,10 @@
#include "base/bind.h"
#include "base/files/file_util.h"
+#include "base/hash/sha1.h"
#include "base/memory/ref_counted_memory.h"
#include "base/path_service.h"
#include "base/run_loop.h"
-#include "base/sha1.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
diff --git a/chromium/chrome/browser/profiling_host/BUILD.gn b/chromium/chrome/browser/profiling_host/BUILD.gn
index 9fd1b0b4680..5c73c19a024 100644
--- a/chromium/chrome/browser/profiling_host/BUILD.gn
+++ b/chromium/chrome/browser/profiling_host/BUILD.gn
@@ -19,6 +19,7 @@ static_library("profiling_host") {
"//chrome/common:non_code_constants",
"//components/heap_profiling",
"//components/services/heap_profiling/public/cpp",
+ "//components/signin/core/browser",
"//content/public/browser",
"//content/public/common",
]
diff --git a/chromium/chrome/browser/resource_coordinator/BUILD.gn b/chromium/chrome/browser/resource_coordinator/BUILD.gn
index beea134e774..e30f3386e1a 100644
--- a/chromium/chrome/browser/resource_coordinator/BUILD.gn
+++ b/chromium/chrome/browser/resource_coordinator/BUILD.gn
@@ -29,3 +29,18 @@ proto_library("intervention_policy_database_proto") {
"intervention_policy_database.proto",
]
}
+
+source_set("tab_manager_features") {
+ public = [
+ "tab_manager_features.h",
+ ]
+
+ sources = [
+ "tab_manager_features.cc",
+ ]
+
+ deps = [
+ "//base",
+ "//chrome/common:chrome_features",
+ ]
+}
diff --git a/chromium/chrome/browser/resource_coordinator/tab_ranker/BUILD.gn b/chromium/chrome/browser/resource_coordinator/tab_ranker/BUILD.gn
index 45f67a00783..2c9c59937ca 100644
--- a/chromium/chrome/browser/resource_coordinator/tab_ranker/BUILD.gn
+++ b/chromium/chrome/browser/resource_coordinator/tab_ranker/BUILD.gn
@@ -22,12 +22,12 @@ source_set("tab_ranker") {
deps = [
"//base",
"//chrome/browser:resources",
+ "//chrome/browser/resource_coordinator:tab_manager_features",
"//chrome/browser/resource_coordinator:tab_metrics_event_proto",
"//components/assist_ranker",
"//components/assist_ranker/proto",
"//components/sessions",
"//services/metrics/public/cpp:ukm_builders",
- "//ui/base",
]
}
diff --git a/chromium/chrome/browser/resources/BUILD.gn b/chromium/chrome/browser/resources/BUILD.gn
index 89b9888eb9a..0c2ed3373dc 100644
--- a/chromium/chrome/browser/resources/BUILD.gn
+++ b/chromium/chrome/browser/resources/BUILD.gn
@@ -20,9 +20,9 @@ if (closure_compile) {
"discards:closure_compile",
"downloads:closure_compile",
"history:closure_compile",
+ "local_ntp:closure_compile",
"local_state:closure_compile",
"management:closure_compile",
- "md_user_manager:closure_compile",
"media_router:closure_compile",
"ntp4:closure_compile",
"omnibox:closure_compile",
@@ -31,6 +31,7 @@ if (closure_compile) {
"quota_internals:closure_compile",
"settings:closure_compile",
"signin/dice_sync_confirmation:closure_compile",
+ "user_manager:closure_compile",
"welcome/dice_welcome:closure_compile",
"welcome/onboarding_welcome:closure_compile",
]
@@ -39,7 +40,7 @@ if (closure_compile) {
deps += [ "chromeos:closure_compile" ]
}
if (enable_extensions) {
- deps += [ "md_extensions:closure_compile" ]
+ deps += [ "extensions:closure_compile" ]
}
if (is_android) {
deps += [
@@ -87,16 +88,6 @@ grit("quota_internals_resources") {
output_dir = "$root_gen_dir/chrome"
}
-grit("translate_internals_resources") {
- source = "translate_internals/translate_internals_resources.grd"
- defines = chrome_grit_defines
- outputs = [
- "grit/translate_internals_resources.h",
- "translate_internals_resources.pak",
- ]
- output_dir = "$root_gen_dir/chrome"
-}
-
grit("webapks_ui_resources") {
source = "webapks/webapks_ui_resources.grd"
defines = chrome_grit_defines
@@ -115,6 +106,20 @@ if (!is_android) {
defines += [ "enable_hangout_services_extension" ]
}
+ if (is_chromeos) {
+ # The .grd contains references to generated files.
+ source_is_generated = true
+
+ deps = [
+ "//chrome/browser/resources/chromeos/kiosk_next_home:mojom_bin",
+ ]
+
+ grit_flags = [
+ "-E",
+ "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
+ ]
+ }
+
outputs = [
"grit/component_extension_resources.h",
"grit/component_extension_resources_map.cc",
@@ -163,6 +168,37 @@ if (!is_android) {
}
}
+if (is_chromeos) {
+ grit("os_settings_resources") {
+ if (optimize_webui) {
+ source = "settings/os_settings_resources_vulcanized.grd"
+
+ # The .grd contains references to generated files.
+ source_is_generated = true
+
+ deps = [
+ "//chrome/browser/resources/settings/chromeos:build",
+ ]
+
+ grit_flags = [
+ "-E",
+ "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
+ ]
+ } else {
+ source = "settings/os_settings_resources.grd"
+ }
+
+ defines = chrome_grit_defines
+ outputs = [
+ "grit/os_settings_resources.h",
+ "grit/os_settings_resources_map.cc",
+ "grit/os_settings_resources_map.h",
+ "os_settings_resources.pak",
+ ]
+ output_dir = "$root_gen_dir/chrome"
+ }
+}
+
if (!is_android && !is_chromeos) {
grit("onboarding_welcome_resources") {
source = "welcome/onboarding_welcome/onboarding_welcome_resources.grd"
@@ -181,20 +217,20 @@ if (!is_android && !is_chromeos) {
if (enable_extensions) {
grit("extensions_resources") {
if (optimize_webui) {
- source = "md_extensions/extensions_resources_vulcanized.grd"
+ source = "extensions/extensions_resources_vulcanized.grd"
# The .grd contains references to generated files.
source_is_generated = true
deps = [
- "//chrome/browser/resources/md_extensions:build",
+ "//chrome/browser/resources/extensions:build",
]
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
} else {
- source = "md_extensions/extensions_resources.grd"
+ source = "extensions/extensions_resources.grd"
}
defines = chrome_grit_defines
diff --git a/chromium/chrome/browser/resources/about_flash.html b/chromium/chrome/browser/resources/about_flash.html
index da4f5f65e45..cd190135b5a 100644
--- a/chromium/chrome/browser/resources/about_flash.html
+++ b/chromium/chrome/browser/resources/about_flash.html
@@ -27,9 +27,7 @@
</table>
</div>
</div>
-<script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://flash/about_flash.js"></script>
-<script src="chrome://flash/strings.js"></script>
<script src="chrome://resources/js/jstemplate_compiled.js"></script>
<script src="chrome://resources/js/util.js"></script>
</body>
diff --git a/chromium/chrome/browser/resources/about_nacl.css b/chromium/chrome/browser/resources/about_nacl/about_nacl.css
index 9d16ecd6905..7740798d8c3 100644
--- a/chromium/chrome/browser/resources/about_nacl.css
+++ b/chromium/chrome/browser/resources/about_nacl/about_nacl.css
@@ -8,5 +8,5 @@
}
.value {
- margin-left: 10px;
+ margin-inline-start: 10px;
}
diff --git a/chromium/chrome/browser/resources/about_nacl.html b/chromium/chrome/browser/resources/about_nacl/about_nacl.html
index 53b9da1734a..a67298c446d 100644
--- a/chromium/chrome/browser/resources/about_nacl.html
+++ b/chromium/chrome/browser/resources/about_nacl/about_nacl.html
@@ -12,18 +12,15 @@
<h1>About NaCl</h1>
</div>
<div id="naclInfoTemplate">
- <span jsselect="naclInfo">
+ <div jsselect="naclInfo">
<span jscontent="key" class="key"></span>
<span jscontent="value" class="value"></span>
- <br>
- </span>
+ </div>
</div>
</div>
<script src="chrome://resources/js/promise_resolver.js"></script>
<script src="chrome://resources/js/cr.js"></script>
-<script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://nacl/about_nacl.js"></script>
-<script src="chrome://nacl/strings.js"></script>
<script src="chrome://resources/js/jstemplate_compiled.js"></script>
<script src="chrome://resources/js/util.js"></script>
</body>
diff --git a/chromium/chrome/browser/resources/about_nacl.js b/chromium/chrome/browser/resources/about_nacl/about_nacl.js
index c0e0bc8710f..3ff098ec357 100644
--- a/chromium/chrome/browser/resources/about_nacl.js
+++ b/chromium/chrome/browser/resources/about_nacl/about_nacl.js
@@ -30,5 +30,4 @@ function requestNaClInfo() {
// Get data and have it displayed upon loading.
document.addEventListener('DOMContentLoaded', requestNaClInfo);
-
})();
diff --git a/chromium/chrome/browser/resources/about_sys/about_sys.css b/chromium/chrome/browser/resources/about_sys/about_sys.css
index 8b626b54036..6048d803a58 100644
--- a/chromium/chrome/browser/resources/about_sys/about_sys.css
+++ b/chromium/chrome/browser/resources/about_sys/about_sys.css
@@ -132,16 +132,11 @@ div#header h1::before {
.number-expanded,
.number-collapsed {
- text-align: left;
+ text-align: start;
text-overflow: ellipsis;
width: 80%;
}
-html[dir='rtl'] .number-expanded,
-html[dir='rtl'] .number-collapsed {
- text-align: right;
-}
-
tr > *:nth-child(1),
tr > *:nth-child(2) {
border-inline-end: 1px solid rgb(181, 198, 222);
@@ -171,7 +166,7 @@ html[dir='rtl'] #details .name {
}
.spinner {
- -webkit-animation: rotate 2s linear infinite;
+ animation: rotate 2s linear infinite;
border: 4px solid rgb(239, 243, 255);
border-radius: 50%;
border-top: 4px solid rgb(82, 150, 222);
@@ -179,7 +174,7 @@ html[dir='rtl'] #details .name {
width: 20px;
}
-@-webkit-keyframes rotate {
+@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
diff --git a/chromium/chrome/browser/resources/about_sys/about_sys.html b/chromium/chrome/browser/resources/about_sys/about_sys.html
index 412a5689517..2c36477146a 100644
--- a/chromium/chrome/browser/resources/about_sys/about_sys.html
+++ b/chromium/chrome/browser/resources/about_sys/about_sys.html
@@ -4,13 +4,11 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>$i18n{title}</title>
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
- <link rel="stylesheet" href="chrome://system/about_sys.css">
+ <link rel="stylesheet" href="about_sys.css">
<script src="chrome://resources/js/util.js"></script>
- <script src="chrome://resources/js/i18n_template_no_process.js"></script>
- <script src="chrome://resources/js/jstemplate_compiled.js"></script>
<script src="chrome://resources/js/load_time_data.js"></script>
- <script src="chrome://system/about_sys.js"></script>
- <script src="chrome://system/strings.js"></script>
+ <script src="about_sys.js"></script>
+ <script src="strings.js"></script>
</head>
<body>
<div id="header">
diff --git a/chromium/chrome/browser/resources/about_sys/about_sys.js b/chromium/chrome/browser/resources/about_sys/about_sys.js
index 097abdb2004..ec28d40c486 100644
--- a/chromium/chrome/browser/resources/about_sys/about_sys.js
+++ b/chromium/chrome/browser/resources/about_sys/about_sys.js
@@ -174,7 +174,7 @@ function returnSystemInfo(systemInfo) {
updateLogEntries(systemInfo);
const spinner = $('loadingIndicator');
spinner.style.display = 'none';
- spinner.style.webkitAnimationPlayState = 'paused';
+ spinner.style.animationPlayState = 'paused';
}
/**
diff --git a/chromium/chrome/browser/resources/accessibility/accessibility.html b/chromium/chrome/browser/resources/accessibility/accessibility.html
index a755471c71d..478c0c27385 100644
--- a/chromium/chrome/browser/resources/accessibility/accessibility.html
+++ b/chromium/chrome/browser/resources/accessibility/accessibility.html
@@ -11,10 +11,8 @@ found in the LICENSE file.
<link rel="stylesheet" href="chrome://resources/css/chrome_shared.css">
<link rel="stylesheet" href="accessibility.css">
<script src="chrome://resources/js/cr.js"></script>
- <script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://resources/js/action_link.js"></script>
<script src="chrome://resources/js/util.js"></script>
- <script src="strings.js"></script>
<script src="accessibility.js"></script>
</head>
<body>
diff --git a/chromium/chrome/browser/resources/app_management/app.html b/chromium/chrome/browser/resources/app_management/app.html
index ddda32b3bc2..81dbfb2c436 100644
--- a/chromium/chrome/browser/resources/app_management/app.html
+++ b/chromium/chrome/browser/resources/app_management/app.html
@@ -29,6 +29,7 @@
}
#main-container {
+ flex: 1;
overflow: auto;
padding: 0 40px;
}
diff --git a/chromium/chrome/browser/resources/app_management/app_item.html b/chromium/chrome/browser/resources/app_management/app_item.html
index a9683bf2a25..b7a7576080d 100644
--- a/chromium/chrome/browser/resources/app_management/app_item.html
+++ b/chromium/chrome/browser/resources/app_management/app_item.html
@@ -5,7 +5,6 @@
<link rel="import" href="shared_vars.html">
<link rel="import" href="store_client.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<dom-module id="app-management-app-item">
<template>
diff --git a/chromium/chrome/browser/resources/app_management/arc_permission_view.html b/chromium/chrome/browser/resources/app_management/arc_permission_view.html
index 496f068731e..42af5d38da0 100644
--- a/chromium/chrome/browser/resources/app_management/arc_permission_view.html
+++ b/chromium/chrome/browser/resources/app_management/arc_permission_view.html
@@ -6,12 +6,12 @@
<link rel="import" href="permission_view_header.html">
<link rel="import" href="shared_style.html">
<link rel="import" href="store_client.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<dom-module id="app-management-arc-permission-view">
<template>
@@ -23,9 +23,8 @@
<paper-button class="native-settings-button secondary-text"
on-click="onClickNativeSettingsButton_">
$i18n{openAndroidSettings}
- <paper-icon-button-light class="native-settings-icon icon-external">
- <button></button>
- </paper-icon-button-light>
+ <cr-icon-button class="native-settings-icon icon-external" noink>
+ </cr-icon-button>
</paper-button>
</div>
</app-management-permission-view-header>
@@ -33,25 +32,20 @@
<!--TODO(crbug.com/906508): Factor the expandable card into a separate
element. -->
<div class="permission-list card-container">
-<!-- TODO(rekanorman): Uncomment once notifications permissions are
- implemented for ARCs. -->
-<!-- <app-management-permission-item
+ <app-management-permission-item
class="permission-card-row separated-row header-text"
permission-label="$i18n{notifications}"
permission-type="NOTIFICATIONS">
- </app-management-permission-item> -->
+ </app-management-permission-item>
<div class="permission-card-row">
<div class="subpermission-list">
- <div class="subpermission-row separated-row"
+ <div id="subpermission-expand-row"
+ class="subpermission-row separated-row"
on-click="toggleListExpanded_">
<div class="header-text">$i18n{permissions}</div>
<div class="permission-row-controls">
- <paper-icon-button-light>
- <button>
- <iron-icon icon="[[getCollapsedIcon_(listExpanded_)]]">
- </iron-icon>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button iron-icon="[[getCollapsedIcon_(listExpanded_)]]">
+ </cr-icon-button>
</div>
</div>
diff --git a/chromium/chrome/browser/resources/app_management/chrome_app_permission_view.html b/chromium/chrome/browser/resources/app_management/chrome_app_permission_view.html
index 25da9976fad..258b0ba2020 100644
--- a/chromium/chrome/browser/resources/app_management/chrome_app_permission_view.html
+++ b/chromium/chrome/browser/resources/app_management/chrome_app_permission_view.html
@@ -3,8 +3,8 @@
<link rel="import" href="shared_style.html">
<link rel="import" href="store_client.html">
<link rel="import" href="util.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<dom-module id="app-management-chrome-app-permission-view">
@@ -44,9 +44,8 @@
<paper-button class="native-settings-button secondary-text"
on-click="onClickExtensionsSettingsButton_">
$i18n{openExtensionsSettings}
- <paper-icon-button-light class="native-settings-icon icon-external">
- <button></button>
- </paper-icon-button-light>
+ <cr-icon-button class="native-settings-icon icon-external" noink>
+ </cr-icon-button>
</paper-button>
</div>
</app-management-permission-view-header>
diff --git a/chromium/chrome/browser/resources/app_management/expandable_app_list.html b/chromium/chrome/browser/resources/app_management/expandable_app_list.html
index 57e3e2e0771..357bba442cc 100644
--- a/chromium/chrome/browser/resources/app_management/expandable_app_list.html
+++ b/chromium/chrome/browser/resources/app_management/expandable_app_list.html
@@ -6,7 +6,7 @@
<link rel="import" href="store_client.html">
<link rel="import" href="permission_toggle.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<dom-module id="app-management-expandable-app-list">
<template>
@@ -30,12 +30,8 @@
<div id="expander-row" class="expander-list-row"
on-click="toggleListExpanded_">
<span>[[moreAppsString_(apps.length, listExpanded_)]]</span>
- <paper-icon-button-light class="expand-button">
- <button>
- <iron-icon icon="[[getCollapsedIcon_(listExpanded_)]]">
- </iron-icon>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="expand-button"
+ iron-icon="[[getCollapsedIcon_(listExpanded_)]]"></cr-icon-button>
</div>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/app_management/fake_page_handler.js b/chromium/chrome/browser/resources/app_management/fake_page_handler.js
index 115aa6f743e..7a630384869 100644
--- a/chromium/chrome/browser/resources/app_management/fake_page_handler.js
+++ b/chromium/chrome/browser/resources/app_management/fake_page_handler.js
@@ -29,13 +29,15 @@ cr.define('app_management', function() {
}
/**
+ * @param {Array<number>=} optIds
* @return {!Object<number, Permission>}
*/
- static createArcPermissions() {
- const permissionIds = [
+ static createArcPermissions(optIds) {
+ const permissionIds = optIds || [
ArcPermissionType.CAMERA,
ArcPermissionType.LOCATION,
ArcPermissionType.MICROPHONE,
+ ArcPermissionType.NOTIFICATIONS,
];
const permissions = {};
diff --git a/chromium/chrome/browser/resources/app_management/main_view.html b/chromium/chrome/browser/resources/app_management/main_view.html
index 2b00ca8addf..d5e1f19dd2f 100644
--- a/chromium/chrome/browser/resources/app_management/main_view.html
+++ b/chromium/chrome/browser/resources/app_management/main_view.html
@@ -4,7 +4,7 @@
<link rel="import" href="shared_style.html">
<link rel="import" href="store_client.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<dom-module id="app-management-main-view">
<template>
@@ -49,10 +49,9 @@
list-title="$i18n{appListTitle}">
<template is="dom-repeat" items="[[appsList]]" as="app" notify-dom-change>
<app-management-app-item app="[[app]]">
- <paper-icon-button-light slot="right-content"
+ <cr-icon-button slot="right-content"
class="subpage-arrow app-management-item-arrow" actionable>
- <button></button>
- </paper-icon-button-light>
+ </cr-icon-button>
</app-management-app-item>
</template>
</app-management-expandable-app-list>
@@ -65,9 +64,7 @@
</div>
<div id="notifications-sublabel" class="secondary-text"></div>
</div>
- <paper-icon-button-light class="subpage-arrow" actionable>
- <button></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow" actionable></cr-icon-button>
</span>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/app_management/main_view.js b/chromium/chrome/browser/resources/app_management/main_view.js
index c2a28116bed..59e0dacfc89 100644
--- a/chromium/chrome/browser/resources/app_management/main_view.js
+++ b/chromium/chrome/browser/resources/app_management/main_view.js
@@ -47,7 +47,8 @@ Polymer({
* @private
*/
onAppsChanged_: function() {
- this.appsList = Object.values(this.apps_);
+ this.appsList = Object.values(this.apps_)
+ .sort((a, b) => a.title.localeCompare(assert(b.title)));
},
/** @private */
diff --git a/chromium/chrome/browser/resources/app_management/notifications_view.html b/chromium/chrome/browser/resources/app_management/notifications_view.html
index bc2f84d80d9..e3bb6e6fd5b 100644
--- a/chromium/chrome/browser/resources/app_management/notifications_view.html
+++ b/chromium/chrome/browser/resources/app_management/notifications_view.html
@@ -3,13 +3,13 @@
<link rel="import" href="expandable_app_list.html">
<link rel="import" href="shared_style.html">
<link rel="import" href="store_client.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<dom-module id="app-management-notifications-view">
<template>
<style include="app-management-shared-css">
- paper-icon-button-light {
- margin-inline-start: 0;
+ cr-icon-button {
+ margin: 0;
}
app-management-permission-toggle {
@@ -30,12 +30,9 @@
<!-- TODO(crbug.com/906508): Implement display when there is no apps at
all -->
<div id="notification-view-header">
- <paper-icon-button-light class="icon-arrow-back">
- <button id="closeButton" on-click="onClickBackButton_"
- aria-label="$i18n{back}">
- <paper-ripple class="circle"></paper-ripple>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-arrow-back" id="closeButton"
+ on-click="onClickBackButton_" aria-label="$i18n{back}">
+ </cr-icon-button>
<div id="notification-title" class="page-title">$i18n{notifications}</div>
</div>
<app-management-expandable-app-list
diff --git a/chromium/chrome/browser/resources/app_management/permission_item.html b/chromium/chrome/browser/resources/app_management/permission_item.html
index 55b8054c016..915351268c6 100644
--- a/chromium/chrome/browser/resources/app_management/permission_item.html
+++ b/chromium/chrome/browser/resources/app_management/permission_item.html
@@ -15,6 +15,10 @@
justify-content: space-between;
}
+ :host(:not([available_])) {
+ display: none;
+ }
+
#permission-icon {
color: var(--permission-icon-color);
padding-inline-end: var(--permission-icon-padding);
@@ -22,15 +26,17 @@
</style>
<!-- `permission-item` does not include any icon-set, so containing
elements should import the icon-set needed for the specified |icon|. -->
- <div class="permission-row-controls">
- <template is="dom-if" if="[[icon]]">
- <iron-icon id="permission-icon" icon="[[icon]]"></iron-icon>
- </template>
- <div id="permission-label">[[permissionLabel]]</div>
- </div>
- <app-management-permission-toggle id="permission-toggle"
- app="[[app_]]" permission-type="[[permissionType]]">
- </app-management-permission-toggle>
+ <template is="dom-if" if="[[available_]]">
+ <div class="permission-row-controls">
+ <template is="dom-if" if="[[icon]]">
+ <iron-icon id="permission-icon" icon="[[icon]]"></iron-icon>
+ </template>
+ <div id="permission-label">[[permissionLabel]]</div>
+ </div>
+ <app-management-permission-toggle id="permission-toggle"
+ app="[[app_]]" permission-type="[[permissionType]]">
+ </app-management-permission-toggle>
+ </template>
</template>
<script src="permission_item.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/app_management/permission_item.js b/chromium/chrome/browser/resources/app_management/permission_item.js
index 5700c4beeac..20592d65ef8 100644
--- a/chromium/chrome/browser/resources/app_management/permission_item.js
+++ b/chromium/chrome/browser/resources/app_management/permission_item.js
@@ -32,12 +32,39 @@ Polymer({
* @type {string}
*/
icon: String,
+
+ /**
+ * True if the permission type is available for the app.
+ * @private
+ */
+ available_: {
+ type: Boolean,
+ computed: 'isAvailable_(app_, permissionType)',
+ reflectToAttribute: true,
+ },
},
listeners: {
'click': 'onClick_',
},
+ /**
+ * Returns true if the permission type is available for the app.
+ *
+ * @param {App} app
+ * @param {string} permissionType
+ * @private
+ */
+ isAvailable_: function(app, permissionType) {
+ if (app === undefined || permissionType === undefined) {
+ return false;
+ }
+
+ assert(app);
+
+ return app_management.util.getPermission(app, permissionType) !== undefined;
+ },
+
attached: function() {
this.watch('app_', state => app_management.util.getSelectedApp(state));
this.updateFromStore();
@@ -49,8 +76,8 @@ Polymer({
onClick_: function(e) {
e.preventDefault();
- const /** @type {AppManagementPermissionToggleElement} */ toggle =
- this.$['permission-toggle'];
+ const toggle = /** @type {AppManagementPermissionToggleElement} */
+ assert(this.$$('#permission-toggle'));
toggle.togglePermission_();
},
});
diff --git a/chromium/chrome/browser/resources/app_management/permission_view_header.html b/chromium/chrome/browser/resources/app_management/permission_view_header.html
index 7a35bad6969..1f7e2c9411d 100644
--- a/chromium/chrome/browser/resources/app_management/permission_view_header.html
+++ b/chromium/chrome/browser/resources/app_management/permission_view_header.html
@@ -3,7 +3,7 @@
<link rel="import" href="shared_style.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<dom-module id="app-management-permission-view-header">
<template>
@@ -29,20 +29,16 @@
text-overflow: ellipsis;
}
- paper-icon-button-light {
- margin-inline-start: 0;
+ cr-icon-button {
+ margin: 0;
}
#uninstall-button {
background: white;
}
</style>
- <paper-icon-button-light class="icon-arrow-back">
- <button id="closeButton" on-click="onClickBackButton_"
- aria-label="$i18n{back}">
- <paper-ripple class="circle"></paper-ripple>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-arrow-back" id="closeButton"
+ on-click="onClickBackButton_" aria-label="$i18n{back}"></cr-icon-button>
<img id="permission-view-header-icon" src="[[iconUrlFromId_(app_)]]">
<div class="page-title">[[app_.title]]</div>
<slot name="extra-right-buttons"></slot>
diff --git a/chromium/chrome/browser/resources/app_management/pwa_permission_view.html b/chromium/chrome/browser/resources/app_management/pwa_permission_view.html
index 286a30e9799..cc5e5813812 100644
--- a/chromium/chrome/browser/resources/app_management/pwa_permission_view.html
+++ b/chromium/chrome/browser/resources/app_management/pwa_permission_view.html
@@ -7,11 +7,11 @@
<link rel="import" href="shared_style.html">
<link rel="import" href="store_client.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<dom-module id="app-management-pwa-permission-view">
<template>
@@ -23,9 +23,8 @@
<paper-button class="native-settings-button secondary-text"
on-click="onClickSiteSettingsButton_">
$i18n{openSiteSettings}
- <paper-icon-button-light class="native-settings-icon icon-external">
- <button></button>
- </paper-icon-button-light>
+ <cr-icon-button class="native-settings-icon icon-external" noink>
+ </cr-icon-button>
</paper-button>
</div>
</app-management-permission-view-header>
@@ -43,12 +42,8 @@
on-click="toggleListExpanded_">
<div class="header-text">$i18n{permissions}</div>
<div class="permission-row-controls">
- <paper-icon-button-light>
- <button>
- <iron-icon icon="[[getCollapsedIcon_(listExpanded_)]]">
- </iron-icon>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button iron-icon="[[getCollapsedIcon_(listExpanded_)]]">
+ </cr-icon-button>
</div>
</div>
diff --git a/chromium/chrome/browser/resources/app_management/search_view.html b/chromium/chrome/browser/resources/app_management/search_view.html
index 3fa410b229e..c2d94266af7 100644
--- a/chromium/chrome/browser/resources/app_management/search_view.html
+++ b/chromium/chrome/browser/resources/app_management/search_view.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="app_item.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar.html">
<dom-module id="app-management-search-view">
@@ -27,10 +28,9 @@
<div class="card-container" hidden$="[[isEmptyList_(apps_)]]">
<template is="dom-repeat" items="[[apps_]]">
<app-management-app-item app="[[item]]">
- <paper-icon-button-light slot="right-content"
+ <cr-icon-button slot="right-content"
class="subpage-arrow app-management-item-arrow" actionable>
- <button></button>
- </paper-icon-button-light>
+ </cr-icon-button>
</app-management-app-item>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/autofill_internals.html b/chromium/chrome/browser/resources/autofill_internals/autofill_internals.html
index 4c69c10f634..4c69c10f634 100644
--- a/chromium/chrome/browser/resources/autofill_internals.html
+++ b/chromium/chrome/browser/resources/autofill_internals/autofill_internals.html
diff --git a/chromium/chrome/browser/resources/bookmarks/BUILD.gn b/chromium/chrome/browser/resources/bookmarks/BUILD.gn
index 9d900e0e08d..c405c90594d 100644
--- a/chromium/chrome/browser/resources/bookmarks/BUILD.gn
+++ b/chromium/chrome/browser/resources/bookmarks/BUILD.gn
@@ -36,7 +36,6 @@ js_type_check("closure_compile") {
":router",
":store",
":store_client",
- ":toast_manager",
":toolbar",
":types",
":util",
@@ -86,10 +85,10 @@ js_library("command_manager") {
":dialog_focus_manager",
":edit_dialog",
":store_client",
- ":toast_manager",
"//third_party/polymer/v1_0/components-chromium/iron-a11y-keys-behavior:iron-a11y-keys-behavior-extracted",
"//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu",
"//ui/webui/resources/cr_elements/cr_lazy_render:cr_lazy_render",
+ "//ui/webui/resources/cr_elements/cr_toast:cr_toast_manager",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js/cr/ui:command",
@@ -213,13 +212,6 @@ js_library("store_client") {
]
}
-js_library("toast_manager") {
- deps = [
- "//third_party/polymer/v1_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer-extracted",
- "//ui/webui/resources/js:cr",
- ]
-}
-
js_library("toolbar") {
deps = [
":command_manager",
diff --git a/chromium/chrome/browser/resources/bookmarks/app.html b/chromium/chrome/browser/resources/bookmarks/app.html
index f6c37d866ea..93a5080fcdc 100644
--- a/chromium/chrome/browser/resources/bookmarks/app.html
+++ b/chromium/chrome/browser/resources/bookmarks/app.html
@@ -2,6 +2,7 @@
<link rel="import" href="chrome://resources/cr_components/managed_footnote/managed_footnote.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_toast/cr_toast_manager.html">
<link rel="import" href="chrome://resources/html/cr/ui/splitter.html">
<link rel="import" href="chrome://resources/html/find_shortcut_behavior.html">
<link rel="import" href="api_listener.html">
@@ -15,7 +16,6 @@
<link rel="import" href="shared_vars.html">
<link rel="import" href="store.html">
<link rel="import" href="strings.html">
-<link rel="import" href="toast_manager.html">
<link rel="import" href="toolbar.html">
<link rel="import" href="util.html">
@@ -99,7 +99,9 @@
</div>
<bookmarks-router></bookmarks-router>
<bookmarks-command-manager></bookmarks-command-manager>
- <bookmarks-toast-manager duration="10000"></bookmarks-toast-manager>
+ <cr-toast-manager duration="10000" on-undo-click="onUndoClick_"
+ undo-label="$i18n{undo}" undo-description="$i18n{undoDescription}">
+ </cr-toast-manager>
</template>
<script src="app.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/bookmarks/app.js b/chromium/chrome/browser/resources/bookmarks/app.js
index ad764826bb2..d18765a5df5 100644
--- a/chromium/chrome/browser/resources/bookmarks/app.js
+++ b/chromium/chrome/browser/resources/bookmarks/app.js
@@ -160,4 +160,9 @@ Polymer({
searchInputHasFocus: function() {
return this.$$('bookmarks-toolbar').searchField.isSearchFocused();
},
+
+ /** @private */
+ onUndoClick_: function() {
+ this.fire('command-undo');
+ },
});
diff --git a/chromium/chrome/browser/resources/bookmarks/command_manager.js b/chromium/chrome/browser/resources/bookmarks/command_manager.js
index 2eaa22f5458..8f153dd70e4 100644
--- a/chromium/chrome/browser/resources/bookmarks/command_manager.js
+++ b/chromium/chrome/browser/resources/bookmarks/command_manager.js
@@ -347,7 +347,7 @@ cr.define('bookmarks', function() {
}
case Command.UNDO:
chrome.bookmarkManagerPrivate.undo();
- bookmarks.ToastManager.getInstance().hide();
+ cr.toastManager.getInstance().hide();
break;
case Command.REDO:
chrome.bookmarkManagerPrivate.redo();
@@ -391,7 +391,7 @@ cr.define('bookmarks', function() {
case Command.SORT:
chrome.bookmarkManagerPrivate.sortChildren(
assert(state.selectedFolder));
- bookmarks.ToastManager.getInstance().show(
+ cr.toastManager.getInstance().show(
loadTimeData.getString('toastFolderSorted'), true);
break;
case Command.ADD_BOOKMARK:
@@ -751,7 +751,7 @@ cr.define('bookmarks', function() {
return p;
});
- bookmarks.ToastManager.getInstance().showForStringPieces(pieces, canUndo);
+ cr.toastManager.getInstance().showForStringPieces(pieces, canUndo);
},
////////////////////////////////////////////////////////////////////////////
@@ -789,10 +789,14 @@ cr.define('bookmarks', function() {
* @private
*/
onKeydown_: function(e) {
- const selection = this.getState().selection.items;
- if (e.target == document.body &&
+ const path = e.composedPath();
+ if (path[0].tagName == 'INPUT') {
+ return;
+ }
+ if ((e.target == document.body ||
+ path.some(el => el.tagName == 'BOOKMARKS-TOOLBAR')) &&
!bookmarks.DialogFocusManager.getInstance().hasOpenDialog()) {
- this.handleKeyEvent(e, selection);
+ this.handleKeyEvent(e, this.getState().selection.items);
}
},
diff --git a/chromium/chrome/browser/resources/bookmarks/folder_node.html b/chromium/chrome/browser/resources/bookmarks/folder_node.html
index 32fb58afa0e..80ed7c127c6 100644
--- a/chromium/chrome/browser/resources/bookmarks/folder_node.html
+++ b/chromium/chrome/browser/resources/bookmarks/folder_node.html
@@ -1,9 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/cr_elements/icons.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="actions.html">
<link rel="import" href="command_manager.html">
<link rel="import" href="shared_style.html">
@@ -54,25 +52,20 @@
color: var(--google-grey-refresh-700);
}
- iron-icon {
- flex-shrink: 0;
- }
-
#arrow {
- color: var(--cr-secondary-text-color);
margin: 0 8px;
}
- #arrow iron-icon {
+ #arrow:not([is-open]) {
transform: rotate(-90deg);
transition: transform 150ms;
}
- :host-context([dir='rtl']) #arrow iron-icon {
+ :host-context([dir='rtl']) #arrow:not([is-open]) {
transform: rotate(90deg);
}
- #arrow iron-icon[is-open] {
+ #arrow[is-open] {
transform: initial;
}
@@ -91,15 +84,10 @@
role="treeitem"
aria-owns="descendants">
<template is="dom-if" if="[[hasChildFolder_]]">
- <paper-icon-button-light id="arrow">
- <button on-click="toggleFolder_"
- on-mousedown="preventDefault_"
- tabindex="-1"
- aria-label$="[[getButtonAriaLabel_(isOpen, item_)]]">
- <iron-icon icon="cr:arrow-drop-down" is-open$="[[isOpen]]">
- </iron-icon>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="arrow" iron-icon="cr:arrow-drop-down"
+ on-click="toggleFolder_" on-mousedown="preventDefault_"
+ tabindex="-1" is-open$="[[isOpen]]" noink aria-hidden="true">
+ </cr-icon-button>
</template>
<div id="folder-label" class="v-centered">
<div class="folder-icon"
diff --git a/chromium/chrome/browser/resources/bookmarks/folder_node.js b/chromium/chrome/browser/resources/bookmarks/folder_node.js
index f680493f229..dea00a6ebae 100644
--- a/chromium/chrome/browser/resources/bookmarks/folder_node.js
+++ b/chromium/chrome/browser/resources/bookmarks/folder_node.js
@@ -409,14 +409,4 @@ Polymer({
return openState != null ? openState :
depth <= FOLDER_OPEN_BY_DEFAULT_DEPTH;
},
-
- /**
- * @private
- * @return {string}
- */
- getButtonAriaLabel_: function() {
- return loadTimeData.getStringF(
- this.isOpen ? 'sidebarNodeCollapseAxLabel' : 'sidebarNodeExpandAxLabel',
- this.item_.title);
- },
});
diff --git a/chromium/chrome/browser/resources/bookmarks/images/folder.svg b/chromium/chrome/browser/resources/bookmarks/images/folder.svg
index d9c142650e4..d3a9e54f3e4 100644
--- a/chromium/chrome/browser/resources/bookmarks/images/folder.svg
+++ b/chromium/chrome/browser/resources/bookmarks/images/folder.svg
@@ -1,3 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#757575">
- <path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"></path>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#757575"><path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/bookmarks/images/folder_open.svg b/chromium/chrome/browser/resources/bookmarks/images/folder_open.svg
index 0ad4331c9aa..ed7ffe4b9a0 100644
--- a/chromium/chrome/browser/resources/bookmarks/images/folder_open.svg
+++ b/chromium/chrome/browser/resources/bookmarks/images/folder_open.svg
@@ -1,3 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#4285F4">
- <path d="M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"></path>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#4285F4"><path d="M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/bookmarks/item.html b/chromium/chrome/browser/resources/bookmarks/item.html
index d5e5f2abae3..9eb10affc08 100644
--- a/chromium/chrome/browser/resources/bookmarks/item.html
+++ b/chromium/chrome/browser/resources/bookmarks/item.html
@@ -74,7 +74,7 @@
}
:host-context([dark]):host([is-selected-item_]) cr-icon-button {
- --cr-icon-button-ripple-color: var(--google-grey-700);
+ --cr-icon-button-color: var(--google-grey-700);
}
:host(:focus) {
diff --git a/chromium/chrome/browser/resources/bookmarks/toast_manager.html b/chromium/chrome/browser/resources/bookmarks/toast_manager.html
deleted file mode 100644
index e37d6e3d9c0..00000000000
--- a/chromium/chrome/browser/resources/bookmarks/toast_manager.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-announcer/iron-a11y-announcer.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_toast/cr_toast.html">
-<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
-<link rel="import" href="shared_style.html">
-
-<dom-module id="bookmarks-toast-manager">
- <template>
- <style include="shared-style paper-button-style">
- #content {
- display: flex;
- flex: 1;
- }
-
- .collapsible {
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- span {
- white-space: pre;
- }
- </style>
- <cr-toast id="toast" duration="[[duration]]" role="alert">
- <div id="content" class="elided-text"></div>
- <paper-button id="button"
- hidden$="[[!showUndo_]]"
- on-click="onUndoTap_"
- aria-label="$i18n{undoDescription}">
- $i18n{undo}
- </paper-button>
- </cr-toast>
- </template>
- <script src="toast_manager.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/bookmarks/toast_manager.js b/chromium/chrome/browser/resources/bookmarks/toast_manager.js
deleted file mode 100644
index 3f5d8ada5f5..00000000000
--- a/chromium/chrome/browser/resources/bookmarks/toast_manager.js
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Element which shows toasts.
- */
-cr.define('bookmarks', function() {
-
- const ToastManager = Polymer({
- is: 'bookmarks-toast-manager',
-
- properties: {
- duration: {
- type: Number,
- value: 0,
- },
-
- /** @private */
- showUndo_: Boolean,
- },
-
- /** @override */
- attached: function() {
- assert(ToastManager.instance_ == null);
- ToastManager.instance_ = this;
- },
-
- /** @override */
- detached: function() {
- ToastManager.instance_ = null;
- },
-
- /**
- * @param {string} label The label to display inside the toast.
- * @param {boolean} showUndo Whether the undo button should be shown.
- */
- show: function(label, showUndo) {
- this.$.content.textContent = label;
- this.showInternal_(showUndo);
- this.$.toast.show();
- },
-
- /**
- * Shows the toast, making certain text fragments collapsible.
- * @param {!Array<!{value: string, collapsible: boolean}>} pieces
- * @param {boolean} showUndo Whether the undo button should be shown.
- */
- showForStringPieces: function(pieces, showUndo) {
- const content = this.$.content;
- content.textContent = '';
- pieces.forEach(function(p) {
- if (p.value.length == 0) {
- return;
- }
-
- const span = document.createElement('span');
- span.textContent = p.value;
- if (p.collapsible) {
- span.classList.add('collapsible');
- }
-
- content.appendChild(span);
- });
-
- this.showInternal_(showUndo);
- },
-
- /**
- * @param {boolean} showUndo Whether the undo button should be shown.
- * @private
- */
- showInternal_: function(showUndo) {
- this.showUndo_ = showUndo;
- this.$.toast.show();
- },
-
- hide: function() {
- this.$.toast.hide();
- },
-
- /** @private */
- onUndoTap_: function() {
- // Will hide the toast.
- this.fire('command-undo');
- },
- });
-
- /** @private {?bookmarks.ToastManager} */
- ToastManager.instance_ = null;
-
- /** @return {!bookmarks.ToastManager} */
- ToastManager.getInstance = function() {
- return assert(ToastManager.instance_);
- };
-
- return {
- ToastManager: ToastManager,
- };
-});
diff --git a/chromium/chrome/browser/resources/bookmarks/toolbar.html b/chromium/chrome/browser/resources/bookmarks/toolbar.html
index d6579e9783a..989db07d3c1 100644
--- a/chromium/chrome/browser/resources/bookmarks/toolbar.html
+++ b/chromium/chrome/browser/resources/bookmarks/toolbar.html
@@ -21,14 +21,12 @@
}
cr-icon-button {
- --cr-icon-button-color: white;
- --cr-icon-button-ripple-color: white;
- display: inline-block;
+ justify-content: flex-end;
margin: 4px;
}
- :host-context([dark]) cr-icon-button {
- --cr-icon-button-color: var(--google-grey-200);
+ :host-context(html:not([dark])) cr-icon-button {
+ --cr-icon-button-color: currentColor;
}
:host(:not([narrow_])) cr-toolbar-selection-overlay {
diff --git a/chromium/chrome/browser/resources/browser_switcher/OWNERS b/chromium/chrome/browser/resources/browser_switcher/OWNERS
index 3bfa6d85787..02916cd005d 100644
--- a/chromium/chrome/browser/resources/browser_switcher/OWNERS
+++ b/chromium/chrome/browser/resources/browser_switcher/OWNERS
@@ -1,2 +1,4 @@
pastarmovj@chromium.org
nicolaso@chromium.org
+
+# COMPONENT: Enterprise>BrowserSwitcher
diff --git a/chromium/chrome/browser/resources/browser_switcher/app.js b/chromium/chrome/browser/resources/browser_switcher/app.js
index 4f2d80b088e..6613847524d 100644
--- a/chromium/chrome/browser/resources/browser_switcher/app.js
+++ b/chromium/chrome/browser/resources/browser_switcher/app.js
@@ -107,12 +107,12 @@ Polymer({
*/
computeTitle_: function() {
if (this.error_) {
- return this.i18n('errorTitle');
+ return this.i18n('errorTitle', getBrowserName());
}
if (this.secondCounter_ > 0) {
- return this.i18n('countdownTitle', this.secondCounter_);
+ return this.i18n('countdownTitle', this.secondCounter_, getBrowserName());
}
- return this.i18n('openingTitle');
+ return this.i18n('openingTitle', getBrowserName());
},
/**
@@ -121,12 +121,18 @@ Polymer({
*/
computeDescription_: function() {
if (this.error_) {
- return this.i18n(this.error_, getUrlHostname(this.url_));
+ return this.i18n(
+ this.error_, getUrlHostname(this.url_), getBrowserName());
}
- return this.i18n('description', getUrlHostname(this.url_));
+ return this.i18n(
+ 'description', getUrlHostname(this.url_), getBrowserName());
},
});
+function getBrowserName() {
+ return loadTimeData.getString('browserName');
+}
+
function getUrlHostname(url) {
const anchor = document.createElement('a');
anchor.href = url;
diff --git a/chromium/chrome/browser/resources/chromeos/BUILD.gn b/chromium/chrome/browser/resources/chromeos/BUILD.gn
index 8f349ca1f7c..bd1e0a4ffa4 100644
--- a/chromium/chrome/browser/resources/chromeos/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/BUILD.gn
@@ -8,6 +8,19 @@ import("//tools/grit/grit_rule.gni")
assert(is_chromeos, "Only Chrome OS resources in //c/b/resources//chromeos.")
+grit("cellular_setup_resources") {
+ source = "cellular_setup/cellular_setup_resources.grd"
+
+ defines = chrome_grit_defines
+ outputs = [
+ "grit/cellular_setup_resources.h",
+ "grit/cellular_setup_resources_map.cc",
+ "grit/cellular_setup_resources_map.h",
+ "cellular_setup_resources.pak",
+ ]
+ output_dir = "$root_gen_dir/chrome"
+}
+
grit("multidevice_setup_resources") {
source = "multidevice_setup/multidevice_setup_resources.grd"
@@ -32,6 +45,7 @@ group("closure_compile") {
"multidevice_setup:closure_compile",
"network_ui:closure_compile",
"select_to_speak:closure_compile",
+ "set_time_dialog:closure_compile",
"smb_shares:closure_compile",
"switch_access:closure_compile",
"sys_internals:closure_compile",
diff --git a/chromium/chrome/browser/resources/chromeos/braille_ime/BUILD.gn b/chromium/chrome/browser/resources/chromeos/braille_ime/BUILD.gn
index b91d293128b..823b74cf0e3 100644
--- a/chromium/chrome/browser/resources/chromeos/braille_ime/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/braille_ime/BUILD.gn
@@ -2,9 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//chromecast/chromecast.gni")
import("//third_party/closure_compiler/compile_js.gni")
-assert(is_chromeos)
+assert(is_chromeos || is_chromecast)
copy("braille_ime_manifest") {
sources = [
diff --git a/chromium/chrome/browser/resources/chromeos/camera/BUILD.gn b/chromium/chrome/browser/resources/chromeos/camera/BUILD.gn
index 1acc2594aaf..019ea1c7e04 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/camera/BUILD.gn
@@ -5,23 +5,208 @@
chrome_camera_app_dir = "$root_out_dir/resources/chromeos/camera"
group("chrome_camera_app") {
+ # According to crbug.com/855747, we should list all the files we want to copy
+ # rather than list only the folders to avoid potential building issue and ease
+ # the difficulty to diagnose.
deps = [
- ":chrome_camera_app_base",
"//chrome/browser/resources/chromeos/camera/src/strings:camera_strings",
]
+
+ data_deps = [
+ ":chrome_camera_app_base",
+ ":chrome_camera_app_css",
+ ":chrome_camera_app_images",
+ ":chrome_camera_app_js",
+ ":chrome_camera_app_js_models",
+ ":chrome_camera_app_js_mojo",
+ ":chrome_camera_app_js_views",
+ ":chrome_camera_app_js_views_camera",
+ ":chrome_camera_app_mojo_generated",
+ ":chrome_camera_app_sounds",
+ ":chrome_camera_app_views",
+ ]
}
copy("chrome_camera_app_base") {
sources = [
- "src/css",
- "src/images",
- "src/js",
"src/manifest.json",
- "src/sounds",
- "src/views",
]
outputs = [
"$chrome_camera_app_dir/{{source_file_part}}",
]
}
+
+copy("chrome_camera_app_css") {
+ sources = [
+ "src/css/main.css",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/css/{{source_file_part}}",
+ ]
+}
+
+copy("chrome_camera_app_images") {
+ sources = [
+ "src/images/browser_button_back.svg",
+ "src/images/browser_button_delete.svg",
+ "src/images/browser_button_export.svg",
+ "src/images/browser_button_print.svg",
+ "src/images/camera_app_icons_128.png",
+ "src/images/camera_app_icons_48.png",
+ "src/images/camera_button_grid_off.svg",
+ "src/images/camera_button_grid_on.svg",
+ "src/images/camera_button_mic_off.svg",
+ "src/images/camera_button_mic_on.svg",
+ "src/images/camera_button_mirror_off.svg",
+ "src/images/camera_button_mirror_on.svg",
+ "src/images/camera_button_settings.svg",
+ "src/images/camera_button_switch_device.svg",
+ "src/images/camera_button_switch_photo.svg",
+ "src/images/camera_button_switch_video.svg",
+ "src/images/camera_button_timer_off.svg",
+ "src/images/camera_button_timer_on_10s.svg",
+ "src/images/camera_button_timer_on_3s.svg",
+ "src/images/camera_focus_aim.svg",
+ "src/images/camera_mode_photo.svg",
+ "src/images/camera_mode_portrait.svg",
+ "src/images/camera_mode_square.svg",
+ "src/images/camera_mode_video.svg",
+ "src/images/camera_shutter_photo_start.svg",
+ "src/images/camera_shutter_photo_start_active.svg",
+ "src/images/camera_shutter_photo_start_hover.svg",
+ "src/images/camera_shutter_photo_stop.svg",
+ "src/images/camera_shutter_photo_stop_hover.svg",
+ "src/images/camera_shutter_video_start.svg",
+ "src/images/camera_shutter_video_start_hover.svg",
+ "src/images/camera_shutter_video_stop.svg",
+ "src/images/camera_shutter_video_stop_hover.svg",
+ "src/images/settings_button_back.svg",
+ "src/images/settings_button_expand.svg",
+ "src/images/settings_feedback.svg",
+ "src/images/settings_grid_type.svg",
+ "src/images/settings_help.svg",
+ "src/images/settings_timer_duration.svg",
+ "src/images/spinner.svg",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/images/{{source_file_part}}",
+ ]
+}
+
+copy("chrome_camera_app_js") {
+ sources = [
+ "src/js/background.js",
+ "src/js/gallerybutton.js",
+ "src/js/google-analytics-bundle.js",
+ "src/js/main.js",
+ "src/js/metrics.js",
+ "src/js/nav.js",
+ "src/js/scrollbar.js",
+ "src/js/sound.js",
+ "src/js/state.js",
+ "src/js/toast.js",
+ "src/js/tooltip.js",
+ "src/js/util.js",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/js/{{source_file_part}}",
+ ]
+}
+
+copy("chrome_camera_app_js_models") {
+ sources = [
+ "src/js/models/filenamer.js",
+ "src/js/models/filesystem.js",
+ "src/js/models/gallery.js",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/js/models/{{source_file_part}}",
+ ]
+}
+
+copy("chrome_camera_app_js_mojo") {
+ sources = [
+ "src/js/mojo/imagecapture.js",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/js/mojo/{{source_file_part}}",
+ ]
+}
+
+copy("chrome_camera_app_js_views") {
+ sources = [
+ "src/js/views/browser.js",
+ "src/js/views/camera.js",
+ "src/js/views/dialog.js",
+ "src/js/views/gallery_base.js",
+ "src/js/views/settings.js",
+ "src/js/views/view.js",
+ "src/js/views/warning.js",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/js/views/{{source_file_part}}",
+ ]
+}
+
+copy("chrome_camera_app_js_views_camera") {
+ sources = [
+ "src/js/views/camera/layout.js",
+ "src/js/views/camera/modes.js",
+ "src/js/views/camera/options.js",
+ "src/js/views/camera/preview.js",
+ "src/js/views/camera/recordtime.js",
+ "src/js/views/camera/timertick.js",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/js/views/camera/{{source_file_part}}",
+ ]
+}
+
+copy("chrome_camera_app_sounds") {
+ sources = [
+ "src/sounds/record_end.ogg",
+ "src/sounds/record_start.ogg",
+ "src/sounds/shutter.ogg",
+ "src/sounds/tick.ogg",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/sounds/{{source_file_part}}",
+ ]
+}
+
+copy("chrome_camera_app_views") {
+ sources = [
+ "src/views/main.html",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/views/{{source_file_part}}",
+ ]
+}
+
+copy("chrome_camera_app_mojo_generated") {
+ sources = [
+ "$root_gen_dir/media/capture/mojom/image_capture.mojom-lite.js",
+ "$root_gen_dir/media/capture/video/chromeos/mojo/cros_image_capture.mojom-lite.js",
+ "$root_gen_dir/mojo/public/js/mojo_bindings_lite.js",
+ ]
+
+ deps = [
+ "//media/capture/mojom:image_capture_js",
+ "//media/capture/video/chromeos/mojo:cros_camera_js",
+ "//mojo/public/js:bindings_lite",
+ ]
+
+ outputs = [
+ "$chrome_camera_app_dir/js/mojo/{{source_file_part}}",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/chromeos/camera/src/_locales/en/messages.json b/chromium/chrome/browser/resources/chromeos/camera/src/_locales/en/messages.json
index 4e9f00a5587..d0e8d217046 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/src/_locales/en/messages.json
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/_locales/en/messages.json
@@ -33,6 +33,10 @@
"message": "Unable to take photo",
"description": "Error message shown when failing to take photo."
},
+ "ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED": {
+ "message": "Unable to take portrait photo",
+ "description": "Error message shown when failing to take portrait photo."
+ },
"ERROR_MSG_RECORD_START_FAILED": {
"message": "Unable to start recording",
"description": "Error message shown when failing to start recording video."
@@ -149,12 +153,36 @@
},
"SWITCH_RECORD_VIDEO_BUTTON": {
"message": "Switch to record video",
+ "description": "Label for spoken feedback to read out switch to record video mode button."
+ },
+ "LABEL_SWITCH_RECORD_VIDEO_BUTTON": {
+ "message": "Video",
"description": "Label for the button to switch to record video mode."
},
"SWITCH_TAKE_PHOTO_BUTTON": {
"message": "Switch to take photo",
+ "description": "Label for spoken feedback to read out switch to take photo mode button."
+ },
+ "LABEL_SWITCH_TAKE_PHOTO_BUTTON": {
+ "message": "Photo",
"description": "Label for the button to switch to take photo mode."
},
+ "SWITCH_TAKE_SQUARE_PHOTO_BUTTON": {
+ "message": "Switch to take square photo",
+ "description": "Label for spoken feedback to read out switch to take square photo mode button."
+ },
+ "LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON": {
+ "message": "Square",
+ "description": "Label for the button to switch to take square photo mode."
+ },
+ "SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON": {
+ "message": "Switch to take portrait photo",
+ "description": "Label for spoken feedback to read out switch to take portrait photo mode button."
+ },
+ "LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON": {
+ "message": "Portrait",
+ "description": "Label for the button to switch to take portrait photo mode."
+ },
"TOGGLE_TIMER_BUTTON": {
"message": "Timer",
"description": "Label for the checkbox to toggle the countdown timer."
diff --git a/chromium/chrome/browser/resources/chromeos/camera/src/manifest.json b/chromium/chrome/browser/resources/chromeos/camera/src/manifest.json
index 8b02855f4b9..412686f9bed 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/src/manifest.json
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/manifest.json
@@ -3,7 +3,7 @@
"manifest_version": 2,
"name": "__MSG_name__",
"description": "__MSG_description__",
- "version": "6.0.0",
+ "version": "6.1.0",
"default_locale": "en",
"minimum_chrome_version": "60.0.0.0",
"icons": {
diff --git a/chromium/chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd b/chromium/chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd
index ea64d7829e2..a5eac502283 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd
@@ -173,9 +173,12 @@
<message desc="Confirmation message before removing a selected item from the gallery. Expects a file name to be passed in." name="IDS_DELETE_CONFIRMATION_MSG">
Do you really want to remove <ph name="file">$1<ex>IMG_20160520_000000.jpg</ex></ph>?
</message>
- <message desc="Label for the button to switch to take photo mode." name="IDS_SWITCH_TAKE_PHOTO_BUTTON">
+ <message desc="Label for spoken feedback to read out switch to take photo mode button." name="IDS_SWITCH_TAKE_PHOTO_BUTTON">
Switch to take photo
</message>
+ <message desc="Label for switch to take photo mode button." name="IDS_LABEL_SWITCH_TAKE_PHOTO_BUTTON">
+ Photo
+ </message>
<message desc="Label for the checkbox to toggle the grid shown on preview." name="IDS_TOGGLE_GRID_BUTTON">
Grid
</message>
@@ -198,6 +201,9 @@
<message desc="Error message shown when failing to take photo." name="IDS_ERROR_MSG_TAKE_PHOTO_FAILED">
Unable to take photo
</message>
+ <message desc="Error message shown when failing to take portrait photo." name="IDS_ERROR_MSG_TAKE_PORTRAIT_PHOTO_FAILED">
+ Unable to take portrait photo
+ </message>
<message desc="Short description of the Camera App." name="IDS_DESCRIPTION">
Take photos and record videos with your camera.
</message>
@@ -240,9 +246,12 @@
<message desc="Label for grid-type: golden ratio." name="IDS_LABEL_GRID_GOLDEN">
Golden ratio
</message>
- <message desc="Label for the button to switch to record video mode." name="IDS_SWITCH_RECORD_VIDEO_BUTTON">
+ <message desc="Label for spoken feedback to read out switch to record video mode button." name="IDS_SWITCH_RECORD_VIDEO_BUTTON">
Switch to record video
</message>
+ <message desc="Label for switch to record video mode button." name="IDS_LABEL_SWITCH_RECORD_VIDEO_BUTTON">
+ Video
+ </message>
<message desc="Label for the checkbox to toggle the preview mirroring. Eg. if mirroring is toggled on, preview will be flipped horizontally." name="IDS_TOGGLE_MIRROR_BUTTON">
Mirroring
</message>
@@ -252,6 +261,18 @@
<message desc="Label for the back button." name="IDS_BACK_BUTTON">
Go back
</message>
+ <message desc="Label for spoken feedback to read out switch to take square photo mode button." name="IDS_SWITCH_TAKE_SQUARE_PHOTO_BUTTON">
+ Switch to take square photo
+ </message>
+ <message desc="Label for switch to take square photo mode button." name="IDS_LABEL_SWITCH_TAKE_SQUARE_PHOTO_BUTTON">
+ Square
+ </message>
+ <message desc="Label for spoken feedback to read out switch to take portrait photo mode button." name="IDS_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON">
+ Switch to take portrait photo
+ </message>
+ <message desc="Label for switch to take portrait photo mode button." name="IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON">
+ Portrait
+ </message>
</messages>
</release>
</grit>
diff --git a/chromium/chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd b/chromium/chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd
new file mode 100644
index 00000000000..319dbda9028
--- /dev/null
+++ b/chromium/chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
+ <outputs>
+ <output filename="grit/cellular_setup_resources.h" type="rc_header">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="grit/cellular_setup_resources_map.cc"
+ type="resource_file_map_source" />
+ <output filename="grit/cellular_setup_resources_map.h"
+ type="resource_map_header" />
+ <output filename="cellular_setup_resources.pak" type="data_package" />
+ </outputs>
+ <release seq="1">
+ <structures>
+ <structure name="IDR_CELLULAR_SETUP_I18N_SETUP_HTML"
+ file="i18n_setup.html"
+ type="chrome_html" />
+ <structure name="IDR_CELLULAR_SETUP_CELLULAR_SETUP_DIALOG_HTML"
+ file="cellular_setup_dialog.html"
+ flattenhtml="true"
+ allowexternalscript="true"
+ type="chrome_html" />
+ </structures>
+ </release>
+</grit>
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn b/chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn
index b6707a26086..0327edc3710 100644
--- a/chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn
@@ -5,12 +5,13 @@
import("//build/config/features.gni")
import("//chrome/common/features.gni")
import("//chrome/test/base/js2gtest.gni")
+import("//chromecast/chromecast.gni")
import("//components/nacl/features.gni")
import("//testing/test.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("run_jsbundler.gni")
-assert(is_chromeos)
+assert(is_chromeos || is_chromecast)
declare_args() {
# Whether to compress the main Chromevox javascript files or load the
@@ -132,6 +133,7 @@ chromevox_modules = [
"cvox2/background/cursors.js",
"cvox2/background/custom_automation_event.js",
"cvox2/background/desktop_automation_handler.js",
+ "cvox2/background/download_handler.js",
"cvox2/background/earcon_engine.js",
"cvox2/background/editing.js",
"cvox2/background/event_source.js",
@@ -489,34 +491,36 @@ if (chromevox_compress_js) {
}
}
-source_set("browser_tests") {
- testonly = true
- assert(enable_extensions)
+if (is_chromeos) {
+ source_set("browser_tests") {
+ testonly = true
+ assert(enable_extensions)
- deps = [
- ":chromevox_extjs_tests",
- ":chromevox_unitjs_tests",
- ]
+ deps = [
+ ":chromevox_extjs_tests",
+ ":chromevox_unitjs_tests",
+ ]
- # TODO(jamescook): Figure out which of these are really necessary.
- data = [
- "$root_out_dir/chrome_100_percent.pak",
- "$root_out_dir/chrome_200_percent.pak",
- "$root_out_dir/locales/en-US.pak",
- "$root_out_dir/locales/fr.pak",
- "$root_out_dir/resources.pak",
- "$root_out_dir/resources/chromeos/chromevox/",
- "$root_out_dir/test_data/chrome/browser/resources/chromeos/chromevox/",
-
- # Surprisingly, the test uses data from the original location, not the
- # copied one.
- "//chrome/browser/resources/chromeos/chromevox/",
- "//chrome/test/data/webui/test_api.js",
- "//third_party/chromevox/",
- "//chrome/third_party/mock4js/",
- "//third_party/accessibility-audit/axs_testing.js",
- "//third_party/chaijs/chai.js",
- ]
+ # TODO(jamescook): Figure out which of these are really necessary.
+ data = [
+ "$root_out_dir/chrome_100_percent.pak",
+ "$root_out_dir/chrome_200_percent.pak",
+ "$root_out_dir/locales/en-US.pak",
+ "$root_out_dir/locales/fr.pak",
+ "$root_out_dir/resources.pak",
+ "$root_out_dir/resources/chromeos/chromevox/",
+ "$root_out_dir/test_data/chrome/browser/resources/chromeos/chromevox/",
+
+ # Surprisingly, the test uses data from the original location, not the
+ # copied one.
+ "//chrome/browser/resources/chromeos/chromevox/",
+ "//chrome/test/data/webui/test_api.js",
+ "//third_party/chromevox/",
+ "//chrome/third_party/mock4js/",
+ "//third_party/accessibility-audit/axs_testing.js",
+ "//third_party/chaijs/chai.js",
+ ]
+ }
}
action("chromevox_test_messages_js") {
@@ -611,43 +615,47 @@ js2gtest("chromevox_unitjs_tests") {
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
}
-js2gtest("chromevox_extjs_tests") {
- test_type = "extension"
- sources = [
- "braille/braille_table_test.extjs",
- "braille/braille_translator_manager_test.extjs",
- "braille/liblouis_test.extjs",
- "cvox2/background/automation_util_test.extjs",
- "cvox2/background/background_test.extjs",
- "cvox2/background/color_test.extjs",
- "cvox2/background/cursors_test.extjs",
- "cvox2/background/editing_test.extjs",
- "cvox2/background/i_search_test.extjs",
- "cvox2/background/language_switching_test.extjs",
- "cvox2/background/live_regions_test.extjs",
- "cvox2/background/log_store_test.extjs",
- "cvox2/background/output_test.extjs",
- "cvox2/background/panel_test.extjs",
- "cvox2/background/recovery_strategy_test.extjs",
- "cvox2/background/tree_walker_test.extjs",
- "host/chrome/tts_background_test.extjs",
- ]
- gen_include_files = [
- "testing/assert_additions.js",
- "testing/callback_helper.js",
- "testing/chromevox_e2e_test_base.js",
- "testing/chromevox_next_e2e_test_base.js",
- "testing/mock_feedback.js",
- ]
+if (is_chromeos) {
+ js2gtest("chromevox_extjs_tests") {
+ test_type = "extension"
+ sources = [
+ "braille/braille_table_test.extjs",
+ "braille/braille_translator_manager_test.extjs",
+ "braille/liblouis_test.extjs",
+ "cvox2/background/automation_util_test.extjs",
+ "cvox2/background/background_test.extjs",
+ "cvox2/background/braille_command_data_test.extjs",
+ "cvox2/background/color_test.extjs",
+ "cvox2/background/cursors_test.extjs",
+ "cvox2/background/download_handler_test.extjs",
+ "cvox2/background/editing_test.extjs",
+ "cvox2/background/i_search_test.extjs",
+ "cvox2/background/language_switching_test.extjs",
+ "cvox2/background/live_regions_test.extjs",
+ "cvox2/background/log_store_test.extjs",
+ "cvox2/background/output_test.extjs",
+ "cvox2/background/panel_test.extjs",
+ "cvox2/background/recovery_strategy_test.extjs",
+ "cvox2/background/tree_walker_test.extjs",
+ "host/chrome/tts_background_test.extjs",
+ ]
+ gen_include_files = [
+ "testing/assert_additions.js",
+ "testing/callback_helper.js",
+ "testing/chromevox_e2e_test_base.js",
+ "testing/chromevox_next_e2e_test_base.js",
+ "testing/mock_feedback.js",
+ ]
- # The test base classes generate C++ code with these deps.
- deps = [
- "//ash",
- "//base",
- "//chrome/browser/chromeos",
- "//chrome/common",
- ]
- defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
+ # The test base classes generate C++ code with these deps.
+ deps = [
+ "//ash",
+ "//base",
+ "//chrome/browser/chromeos",
+ "//chrome/common",
+ ]
+ defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
+ }
}
js_library("tree_walker") {
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni b/chromium/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni
index 9f309395f2f..0ae15629e8b 100644
--- a/chromium/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni
+++ b/chromium/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni
@@ -1,8 +1,9 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//chromecast/chromecast.gni")
-assert(is_chromeos)
+assert(is_chromeos || is_chromecast)
closure_library_dir =
"//third_party/chromevox/third_party/closure-library/closure/goog"
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd b/chromium/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
index 5a01cb85443..0a00944226d 100644
--- a/chromium/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
+++ b/chromium/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
@@ -3223,7 +3223,6 @@ If you're done with the tutorial, use ChromeVox to navigate to the Close button
name="IDS_CHROMEVOX_OPTIONS_LANG_SWITCHING_CHECKBOX_LABEL">
Automatically detect and switch ChromeVox language.
</message>
-
<message desc="Spoken to describe all rich text attributes of a node." name="IDS_CHROMEVOX_RICH_TEXT_ATTRIBUTES">
Text formatting.
<ph name="font_size_string">$1<ex>Size 12</ex></ph>
@@ -3656,6 +3655,61 @@ If you're done with the tutorial, use ChromeVox to navigate to the Close button
<message desc="Spoken to describe color of text" name="IDS_CHROMEVOX_COLOR_DODGER_BLUE">
Dodger Blue
</message>
+ <message desc="An options page section header for options about ChromeVox rich text behavior. This section lets users set preferences on how rich text attributes should be indicated." name="IDS_CHROMEVOX_OPTIONS_RICH_TEXT_HEADER">
+ Rich Text Attributes
+ </message>
+ <message desc="The text label for ChromeVox automatic rich text indication checkbox." name="IDS_CHROMEVOX_OPTIONS_RICH_TEXT_CHECKBOX_LABEL">
+ Customize rich text indication
+ </message>
+ <message desc="Labels the misspell list box." name="IDS_CHROMEVOX_OPTIONS_MISSPELL_DESCRIPTION">
+ Indicate misspell:
+ </message>
+ <message desc="Labels the bold list box." name="IDS_CHROMEVOX_OPTIONS_BOLD_DESCRIPTION">
+ Indicate bold:
+ </message>
+ <message desc="Labels the italic list box." name="IDS_CHROMEVOX_OPTIONS_ITALIC_DESCRIPTION">
+ Indicate italic:
+ </message>
+ <message desc="Labels the underline list box." name="IDS_CHROMEVOX_OPTIONS_UNDERLINE_DESCRIPTION">
+ Indicate underline:
+ </message>
+ <message desc="A menulist option in ChromeVox rich text settings to do nothing to indicate rich text" name="IDS_CHROMEVOX_RICH_TEXT_DO_NOTHING">
+ Do nothing
+ </message>
+ <message desc="A menulist option in ChromeVox rich text settings to announce rich text" name="IDS_CHROMEVOX_RICH_TEXT_ANNOUNCE">
+ Announce
+ </message>
+
+ <message desc="An option to announce download notifications." name="IDS_CHROMEVOX_OPTIONS_ANNOUNCE_DOWNLOAD">
+ Announce download notifications
+ </message>
+ <message desc="Spoken when a download is started" name="IDS_CHROMEVOX_DOWNLOAD_STARTED">
+ Download started <ph name="file_name">$1<ex>test.pdf</ex></ph>
+ </message>
+ <message desc="Spoken when a download is completed" name="IDS_CHROMEVOX_DOWNLOAD_COMPLETED">
+ Download completed <ph name="file_name">$1<ex>test.pdf</ex></ph>
+ </message>
+ <message desc="Spoken when a download is stopped" name="IDS_CHROMEVOX_DOWNLOAD_STOPPED">
+ Download stopped <ph name="file_name">$1<ex>test.pdf</ex></ph>
+ </message>
+ <message desc="Spoken when a download is paused" name="IDS_CHROMEVOX_DOWNLOAD_PAUSED">
+ Download paused <ph name="file_name">$1<ex>test.pdf</ex></ph>
+ </message>
+ <message desc="Spoken when a download is resumed" name="IDS_CHROMEVOX_DOWNLOAD_RESUMED">
+ Download resumed <ph name="file_name">$1<ex>test.pdf</ex></ph>
+ </message>
+ <message desc="Spoken to give progress on a current download, specifying percent complete and time remaining." name="IDS_CHROMEVOX_DOWNLOAD_PROGRESS">
+ Download <ph name="progress">$1<ex>50</ex></ph>% complete <ph name="file_name">$2<ex>test.pdf</ex></ph>. About <ph name="time">$3<ex>30</ex></ph> <ph name="units">$4<ex>minutes</ex></ph> remaining.
+ </message>
+ <message desc="A string to specify time units in seconds." name="IDS_CHROMEVOX_SECONDS">
+ {COUNT, plural, =1 {second}other {seconds}}
+ </message>
+ <message desc="A string to specify time units in minutes." name="IDS_CHROMEVOX_MINUTES">
+ {COUNT, plural, =1 {minute}other {minutes}}
+ </message>
+ <message desc="A string to specify time units in hours." name="IDS_CHROMEVOX_HOURS">
+ {COUNT, plural, =1 {hour}other {hours}}
+ </message>
</messages>
</release>
</grit>
diff --git a/chromium/chrome/browser/resources/chromeos/echo/manifest.json b/chromium/chrome/browser/resources/chromeos/echo/manifest.json
index 8297d275f6e..9643ccc02af 100644
--- a/chromium/chrome/browser/resources/chromeos/echo/manifest.json
+++ b/chromium/chrome/browser/resources/chromeos/echo/manifest.json
@@ -41,6 +41,19 @@
"ids": ["*"],
"matches": [
"*://www.google.com/*chromebook/*",
+ "*://www.google.com.au/*chromebook/*",
+ "*://www.google.ca/*chromebook/*",
+ "*://www.google.co.jp/*chromebook/*",
+ "*://www.google.co.uk/*chromebook/*",
+ "*://www.google.de/*chromebook/*",
+ "*://www.google.dk/*chromebook/*",
+ "*://www.google.fi/*chromebook/*",
+ "*://www.google.fr/*chromebook/*",
+ "*://www.google.ie/*chromebook/*",
+ "*://www.google.nl/*chromebook/*",
+ "*://www.google.no/*chromebook/*",
+ "*://www.google.co.nz/*chromebook/*",
+ "*://www.google.se/*chromebook/*",
"*://chromebook-dot-googwebreview.appspot.com/*chromebook/*"
]
}
diff --git a/chromium/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json b/chromium/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json
index 61de0db092d..e59dd858d6c 100644
--- a/chromium/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json
+++ b/chromium/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json
@@ -1939,5 +1939,6 @@
"input_view": "inputview.html#id=m17n:ru_phone_yazhert&language=ru&passwordLayout=us-ltr&name=keyboard_russian_phonetic_yazhert"
}
],
- "manifest_version": 2
+ "manifest_version": 2,
+ "content_security_policy": "script-src 'self' 'wasm-eval'; object-src 'self'"
}
diff --git a/chromium/chrome/browser/resources/chromeos/kiosk_next_home/BUILD.gn b/chromium/chrome/browser/resources/chromeos/kiosk_next_home/BUILD.gn
index 6d2aa6f73b3..9d5a109d980 100644
--- a/chromium/chrome/browser/resources/chromeos/kiosk_next_home/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/kiosk_next_home/BUILD.gn
@@ -15,8 +15,15 @@ js_library("kiosk_next_api") {
"api.js",
"api_impl.js",
]
- externs_list = [
- "$externs_path/arc_apps_private.js",
- "$externs_path/chrome_extensions.js",
+ externs_list = [ "$externs_path/arc_apps_private.js" ]
+ deps = [
+ "//chrome/browser/chromeos/kiosk_next_home/mojom:mojom_js_library_for_compile",
+ ]
+}
+
+js_binary("mojom_bin") {
+ sources = []
+ deps = [
+ "//chrome/browser/chromeos/kiosk_next_home/mojom:mojom_js_library_for_compile",
]
}
diff --git a/chromium/chrome/browser/resources/chromeos/kiosk_next_home/kiosk_next_resources.grdp b/chromium/chrome/browser/resources/chromeos/kiosk_next_home/kiosk_next_resources.grdp
index 2af207ab3ad..f78d19cb5a9 100644
--- a/chromium/chrome/browser/resources/chromeos/kiosk_next_home/kiosk_next_resources.grdp
+++ b/chromium/chrome/browser/resources/chromeos/kiosk_next_home/kiosk_next_resources.grdp
@@ -6,4 +6,5 @@
<include name="IDR_KIOSK_NEXT_MAIN_HTML" file="chromeos/kiosk_next_home/main.html" type="chrome_html" />
<include name="IDR_KIOSK_NEXT_API_JS" file="chromeos/kiosk_next_home/api.js" type="BINDATA" />
<include name="IDR_KIOSK_NEXT_API_IMPL_JS" file="chromeos/kiosk_next_home/api_impl.js" type="BINDATA" />
+ <include name="IDR_KIOSK_NEXT_HOME_MOJOM_JS" file="${root_gen_dir}/chrome/browser/resources/chromeos/kiosk_next_home/mojom_bin.js" type="BINDATA" use_base_dir="false" />
</grit-part>
diff --git a/chromium/chrome/browser/resources/chromeos/kiosk_next_home/manifest.json b/chromium/chrome/browser/resources/chromeos/kiosk_next_home/manifest.json
index c9c1d25dde1..bb307f4a972 100644
--- a/chromium/chrome/browser/resources/chromeos/kiosk_next_home/manifest.json
+++ b/chromium/chrome/browser/resources/chromeos/kiosk_next_home/manifest.json
@@ -9,14 +9,14 @@
"192": "static/icon192.png"
},
"permissions": [
- "arcAppsPrivate",
"https://*.googleapis.com",
- "identity"
+ "chrome://app-icon/",
+ "mojoPrivate"
],
"app": {
"background": {
"scripts": ["bg.js"]
},
- "content_security_policy": "script-src 'self'; object-src 'self'; img-src 'self' data: https://lh3.googleusercontent.com"
+ "content_security_policy": "script-src 'self'; object-src 'self'; img-src 'self' data: https://lh3.googleusercontent.com chrome://app-icon"
}
}
diff --git a/chromium/chrome/browser/resources/chromeos/login/BUILD.gn b/chromium/chrome/browser/resources/chromeos/login/BUILD.gn
index f48966f03fc..afe04ddaae5 100644
--- a/chromium/chrome/browser/resources/chromeos/login/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/login/BUILD.gn
@@ -2,14 +2,100 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//chrome/test/base/js2gtest.gni")
import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
+ ":active_directory_password_change",
+ ":app_downloading",
+ ":arc_terms_of_service",
+ ":demo_preferences",
+ ":demo_setup",
+ ":encryption_migration",
+ ":enrollment_license_card",
+ ":fingerprint_setup",
+ ":gaia_buttons",
+ ":gaia_card",
+ ":gaia_header",
+ ":gaia_input",
+ ":gaia_input_form",
+ ":gaia_password_changed",
+ ":hd-iron-icon",
+ ":html-echo",
+ ":marketing_opt_in",
":multidevice_setup_first_run",
+ ":navigation_bar",
+ ":network_select_login",
+ ":notification_card",
":offline_ad_login",
+ ":offline_gaia",
+ ":oobe_a11y_option",
+ ":oobe_buttons",
":oobe_change_picture",
+ ":oobe_dialog",
+ ":oobe_enrollment",
+ ":oobe_eula",
+ ":oobe_i18n_dropdown",
+ ":oobe_network",
+ ":oobe_reset",
+ ":oobe_reset_confirmation_overlay",
":oobe_select",
+ ":oobe_supervision_transition",
+ ":oobe_update",
+ ":oobe_welcome",
+ ":recommend_apps",
+ ":saml_confirm_password",
+ ":saml_interstitial",
+ ":sync_consent",
+ ":throbber_notice",
+ ":update_required_card",
+ ]
+}
+
+js2gtest("login_unitjs_tests") {
+ # These could be unit tests, except they need a browser context in order
+ # to construct a DOMParser object - so they are webui tests.
+ test_type = "webui"
+ sources = [
+ "saml_password_attributes_test.unitjs",
+ "saml_timestamps_test.unitjs",
+ ]
+ gen_include_files = [
+ "saml_password_attributes.js",
+ "saml_timestamps.js",
+ "//ui/webui/resources/js/cr.js",
+ ]
+ defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
+}
+
+source_set("browser_tests") {
+ testonly = true
+ deps = [
+ ":login_unitjs_tests",
+ ]
+}
+
+###############################
+# Closure compiler libraries below
+
+js_library("oobe_types") {
+}
+
+# This is special file to be used as a substutute of Oobe object for closure
+# compilation until we make real one closure compile.
+# TODO (https://crbug.com/950198)
+js_library("fake_oobe") {
+ deps = [
+ ":oobe_types",
+ "//ui/login:display_manager_types",
+ ]
+}
+
+js_library("login_screen_behavior") {
+ deps = [
+ ":fake_oobe",
+ "//ui/login:display_manager_types",
]
}
@@ -19,6 +105,15 @@ js_library("oobe_dialog_host_behavior") {
js_library("oobe_select") {
}
+js_library("oobe_welcome") {
+ deps = [
+ ":fake_oobe",
+ ":login_screen_behavior",
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
js_library("offline_ad_login") {
deps = [
":oobe_dialog_host_behavior",
@@ -46,6 +141,199 @@ js_library("multidevice_setup_first_run") {
"//ui/webui/resources/cr_components/chromeos/multidevice_setup:mojo_api",
"//ui/webui/resources/cr_components/chromeos/multidevice_setup:multidevice_setup",
"//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("active_directory_password_change") {
+}
+
+js_library("app_downloading") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("arc_terms_of_service") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ ]
+}
+
+js_library("demo_preferences") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("demo_setup") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("encryption_migration") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("enrollment_license_card") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("fingerprint_setup") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/cr_elements/chromeos/fingerprint:cr_fingerprint_progress_arc",
+ "//ui/webui/resources/js:i18n_behavior",
]
}
+js_library("gaia_buttons") {
+}
+
+js_library("gaia_card") {
+}
+
+js_library("gaia_header") {
+}
+
+js_library("gaia_input_form") {
+}
+
+js_library("gaia_input") {
+}
+
+js_library("gaia_password_changed") {
+}
+
+js_library("hd-iron-icon") {
+}
+
+js_library("html-echo") {
+}
+
+js_library("marketing_opt_in") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("navigation_bar") {
+}
+
+js_library("network_select_login") {
+ deps = [
+ "//ui/webui/resources/cr_elements/chromeos/network:cr_network_select",
+ "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
+ ]
+}
+
+js_library("notification_card") {
+}
+
+js_library("offline_gaia") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("oobe_a11y_option") {
+}
+
+js_library("oobe_buttons") {
+}
+
+js_library("oobe_dialog") {
+}
+
+js_library("oobe_enrollment") {
+ deps = [
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("oobe_eula") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("oobe_i18n_dropdown") {
+ deps = [
+ ":oobe_types",
+ ]
+}
+
+js_library("oobe_network") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("oobe_reset_confirmation_overlay") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ ]
+}
+
+js_library("oobe_reset") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ ]
+}
+
+js_library("oobe_supervision_transition") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("oobe_update") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("recommend_apps") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("saml_confirm_password") {
+}
+
+js_library("saml_interstitial") {
+ deps = [
+ ":html-echo",
+ ]
+}
+
+js_library("sync_consent") {
+ deps = [
+ ":oobe_dialog_host_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("throbber_notice") {
+}
+
+js_library("update_required_card") {
+}
diff --git a/chromium/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn b/chromium/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn
new file mode 100644
index 00000000000..7e924f7353c
--- /dev/null
+++ b/chromium/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn
@@ -0,0 +1,30 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":set_time_browser_proxy",
+ ":set_time_dialog",
+ ]
+}
+
+js_library("set_time_dialog") {
+ deps = [
+ ":set_time_browser_proxy",
+ "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog",
+ "//ui/webui/resources/js:assert",
+ "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:load_time_data",
+ "//ui/webui/resources/js:web_ui_listener_behavior",
+ ]
+}
+
+js_library("set_time_browser_proxy") {
+ deps = [
+ "//ui/webui/resources/js:cr",
+ ]
+ externs_list = [ "$externs_path/chrome_send.js" ]
+}
diff --git a/chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn b/chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn
index c1b6be6af50..094fc4f8034 100644
--- a/chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn
@@ -32,12 +32,14 @@ run_jsbundler("switch_access_copied_files") {
"../select_to_speak/closure_shim.js",
"//third_party/chromevox/third_party/closure-library/closure/goog/base.js",
"auto_scan_manager.js",
+ "back_button_manager.js",
"background.js",
"commands.js",
"icons/back.svg",
"icons/decrement.svg",
"icons/dictation.svg",
"icons/increment.svg",
+ "icons/keyboard.svg",
"icons/options.svg",
"icons/scrollDownOrForward.svg",
"icons/scrollLeft.svg",
@@ -45,7 +47,7 @@ run_jsbundler("switch_access_copied_files") {
"icons/scrollUpOrBackward.svg",
"icons/select.svg",
"icons/showContextMenu.svg",
- "keyboard_handler.js",
+ "key_event_handler.js",
"menu_manager.js",
"menu_panel.css",
"menu_panel.html",
@@ -55,7 +57,7 @@ run_jsbundler("switch_access_copied_files") {
"options.css",
"options.html",
"options.js",
- "prefs.js",
+ "preferences.js",
"switch_access.js",
"switch_access_constants.js",
"switch_access_predicate.js",
@@ -155,14 +157,15 @@ manifest("switch_access_guest_manifest") {
js_type_check("closure_compile") {
deps = [
":auto_scan_manager",
+ ":back_button_manager",
":background",
":commands",
- ":keyboard_handler",
+ ":key_event_handler",
":menu_manager",
":menu_panel_interface",
":navigation_manager",
":options",
- ":prefs",
+ ":preferences",
":switch_access",
":switch_access_constants",
":switch_access_interface",
@@ -182,6 +185,7 @@ js_library("auto_scan_manager") {
js_library("navigation_manager") {
deps = [
+ ":back_button_manager",
":menu_manager",
":menu_panel_interface",
":switch_access_constants",
@@ -203,13 +207,23 @@ js_library("background") {
externs_list = [ "$externs_path/chrome_extensions.js" ]
}
+js_library("back_button_manager") {
+ deps = [
+ ":menu_panel_interface",
+ ]
+ externs_list = [
+ "$externs_path/accessibility_private.js",
+ "$externs_path/automation.js",
+ ]
+}
+
js_library("commands") {
deps = [
":switch_access_interface",
]
}
-js_library("keyboard_handler") {
+js_library("key_event_handler") {
deps = [
":switch_access_interface",
]
@@ -234,7 +248,7 @@ js_library("options") {
externs_list = [ "$externs_path/chrome_extensions.js" ]
}
-js_library("prefs") {
+js_library("preferences") {
deps = [
":switch_access_interface",
]
@@ -245,10 +259,10 @@ js_library("switch_access") {
deps = [
":auto_scan_manager",
":commands",
- ":keyboard_handler",
+ ":key_event_handler",
":menu_panel_interface",
":navigation_manager",
- ":prefs",
+ ":preferences",
]
externs_list = [
"$externs_path/automation.js",
diff --git a/chromium/chrome/browser/resources/conflicts/about_conflicts.html b/chromium/chrome/browser/resources/conflicts/about_conflicts.html
index 4ee426b421f..efeabe223b0 100644
--- a/chromium/chrome/browser/resources/conflicts/about_conflicts.html
+++ b/chromium/chrome/browser/resources/conflicts/about_conflicts.html
@@ -202,6 +202,9 @@ html[dir=rtl] .clearing {
<span dir="ltr">Code Id</span>
</td>
<td class="datacell">
+ <span dir="ltr">Process types</span>
+ </td>
+ <td class="datacell">
<span dir="ltr">Location</span>
</td>
<td jsdisplay="thirdPartyFeatureEnabled" class="datacell">
@@ -226,6 +229,11 @@ html[dir=rtl] .clearing {
<span dir="ltr" jscontent="code_id" class="nowrap">CODE_ID</span>
</td>
<td valign="top" class="datacell">
+ <span dir="ltr" jscontent="process_types" class="nowrap">
+ PROCESS_TYPES
+ </span>
+ </td>
+ <td valign="top" class="datacell">
<span class="nowrap">
<span dir="ltr" jscontent="location">LOCATION</span>
<strong>
@@ -258,12 +266,9 @@ html[dir=rtl] .clearing {
</div>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/jstemplate_compiled.js"></script>
-<script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://resources/js/promise_resolver.js"></script>
<script src="chrome://resources/js/util.js"></script>
-<script src="chrome://conflicts/strings.js"></script>
-
<script src="chrome://conflicts/conflicts.js"></script>
</body>
</html>
diff --git a/chromium/chrome/browser/resources/device_log_ui/device_log_ui.html b/chromium/chrome/browser/resources/device_log_ui/device_log_ui.html
index 4a6af562de6..7bbd71e5a1e 100644
--- a/chromium/chrome/browser/resources/device_log_ui/device_log_ui.html
+++ b/chromium/chrome/browser/resources/device_log_ui/device_log_ui.html
@@ -62,6 +62,10 @@
<span>$i18n{logTypePrinterText}</span>
</label>
<label>
+ <input id="log-type-fido" type="checkbox">
+ <span>$i18n{logTypeFidoText}</span>
+ </label>
+ <label>
<input id="log-fileinfo" type="checkbox">
<span>$i18n{logLevelFileinfoText}</span>
</label>
diff --git a/chromium/chrome/browser/resources/discards/generate_graph_tab.py b/chromium/chrome/browser/resources/discards/generate_graph_tab.py
index 528e1d87558..4205e36a979 100644
--- a/chromium/chrome/browser/resources/discards/generate_graph_tab.py
+++ b/chromium/chrome/browser/resources/discards/generate_graph_tab.py
@@ -30,7 +30,8 @@ def main():
html_doc = html_template.substitute({'javascript_file': js_file_contents});
# Construct the data: URL that contains the combined doc.
- data_url = "data:text/html;base64,%s" % base64.b64encode(html_doc);
+ data_url = "data:text/html;base64,%s" % base64.b64encode(
+ html_doc.encode()).decode()
# And finally stamp the the data URL into the output template.
output = output_template.substitute({'data_url': data_url})
diff --git a/chromium/chrome/browser/resources/discards/graph_doc.js b/chromium/chrome/browser/resources/discards/graph_doc.js
index 415dafa788d..ada3896d54a 100644
--- a/chromium/chrome/browser/resources/discards/graph_doc.js
+++ b/chromium/chrome/browser/resources/discards/graph_doc.js
@@ -2,6 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Target y position for page nodes.
+const kPageNodesTargetY = 20;
+
+// Range occupied by page nodes at the top of the graph view.
+const kPageNodesYRange = 100;
+
+// Range occupied by process nodes at the bottom of the graph view.
+const kProcessNodesYRange = 150;
+
+// Target y position for frame nodes.
+const kFrameNodesTargetY = kPageNodesYRange + 50;
+
+// Range that frame nodes cannot enter at the top/bottom of the graph view.
+const kFrameNodesTopMargin = kPageNodesYRange;
+const kFrameNodesBottomMargin = kProcessNodesYRange + 50;
/** @implements {d3.ForceNode} */
class GraphNode {
@@ -24,19 +39,35 @@ class GraphNode {
}
/**
- * @param {number} height
+ * @param {number} graph_height: Height of the graph view (svg).
* @return {number}
*/
- yPosition(height) {
- // By default, nodes are biased mildly to the center of the graph.
- return height / 2;
+ targetYPosition(graph_height) {
+ return 0;
}
- /** @return {number} */
- yStrength() {
+ /**
+ * @return {number}: The strength of the force that pulls the node towards
+ * its target y position.
+ */
+ targetYPositionStrength() {
return 0.1;
}
+ /**
+ * @param {number} graph_height: Height of the graph view.
+ * @return {!Array<number>}
+ */
+ allowedYRange(graph_height) {
+ // By default, there is no hard constraint on the y position of a node.
+ return [-Infinity, Infinity];
+ }
+
+ /** @return {number}: The strength of the repulsion force with other nodes. */
+ manyBodyStrength() {
+ return -200;
+ }
+
/** @return {!Array<number>} */
linkTargets() {
return [];
@@ -48,21 +79,32 @@ class PageNode extends GraphNode {
constructor(page) {
super(page.id);
this.page = page;
+ this.y = kPageNodesTargetY;
}
/** override */
get title() {
- return this.page.mainFrameUrl;
+ return this.page.mainFrameUrl.length > 0 ? this.page.mainFrameUrl : 'Page';
}
/** override */
- yPosition(height) {
- return 30;
+ targetYPosition(graph_height) {
+ return kPageNodesTargetY;
}
/** @override */
- yStrength() {
- return 1;
+ targetYPositionStrength() {
+ return 10;
+ }
+
+ /** override */
+ allowedYRange(graph_height) {
+ return [0, kPageNodesYRange];
+ }
+
+ /** override */
+ manyBodyStrength() {
+ return -600;
}
/** override */
@@ -80,7 +122,17 @@ class FrameNode extends GraphNode {
/** override */
get title() {
- return 'Frame';
+ return this.frame.url.length > 0 ? this.frame.url : 'Frame';
+ }
+
+ /** override */
+ targetYPosition(graph_height) {
+ return kFrameNodesTargetY;
+ }
+
+ /** override */
+ allowedYRange(graph_height) {
+ return [kFrameNodesTopMargin, graph_height - kFrameNodesBottomMargin];
}
/** override */
@@ -98,18 +150,28 @@ class ProcessNode extends GraphNode {
}
/** override */
- yPosition(height) {
- return height - 30;
+ get title() {
+ return `PID: ${this.process.pid.pid}`;
+ }
+
+ /** override */
+ targetYPosition(graph_height) {
+ return graph_height - (kProcessNodesYRange / 2);
}
/** @return {number} */
- yStrength() {
- return 1;
+ targetYPositionStrength() {
+ return 10;
}
/** override */
- get title() {
- return `PID: ${this.process.pid.pid}`;
+ allowedYRange(graph_height) {
+ return [graph_height - kProcessNodesYRange, graph_height];
+ }
+
+ /** override */
+ manyBodyStrength() {
+ return -600;
}
}
@@ -172,7 +234,13 @@ class Graph {
const linkForce = d3.forceLink().id(d => d.id);
simulation.force('link', linkForce);
- simulation.force('charge', d3.forceManyBody());
+
+ // Sets the repulsion force between nodes (positive number is attraction,
+ // negative number is repulsion).
+ simulation.force(
+ 'charge',
+ d3.forceManyBody().strength(this.getManyBodyStrength_.bind(this)));
+
this.simulation_ = simulation;
// Create the <g> elements that host nodes and links.
@@ -249,14 +317,15 @@ class Graph {
/** @private */
onTick_() {
+ const circles = this.nodeGroup_.selectAll('circle');
+ circles.attr('cx', this.getClampedXPosition_.bind(this))
+ .attr('cy', this.getClampedYPosition_.bind(this));
+
const lines = this.linkGroup_.selectAll('line');
lines.attr('x1', d => d.source.x)
.attr('y1', d => d.source.y)
.attr('x2', d => d.target.x)
.attr('y2', d => d.target.y);
-
- const circles = this.nodeGroup_.selectAll('circle');
- circles.attr('cx', d => d.x).attr('cy', d => d.y);
}
/**
@@ -403,16 +472,43 @@ class Graph {
* @param {!d3.ForceNode} d The node to position.
* @private
*/
- getYPosition_(d) {
- return d.yPosition(this.height_);
+ getTargetYPosition_(d) {
+ return d.targetYPosition(this.height_);
+ }
+
+ /**
+ * @param {!d3.ForceNode} d The node to position.
+ * @private
+ */
+ getClampedYPosition_(d) {
+ const range = d.allowedYRange(this.height_);
+ d.y = Math.max(range[0], Math.min(d.y, range[1]));
+ return d.y;
+ }
+
+ /**
+ * @param {!d3.ForceNode} d The node to position.
+ * @private
+ */
+ getClampedXPosition_(d) {
+ d.x = Math.max(10, Math.min(d.x, this.width_ - 10));
+ return d.x;
+ }
+
+ /**
+ * @param {!d3.ForceNode} d The node to position.
+ * @private
+ */
+ getTargetYPositionStrength_(d) {
+ return d.targetYPositionStrength();
}
/**
* @param {!d3.ForceNode} d The node to position.
* @private
*/
- getYStrength_(d) {
- return d.yStrength();
+ getManyBodyStrength_(d) {
+ return d.manyBodyStrength();
}
/** @private */
@@ -432,8 +528,8 @@ class Graph {
// Reset both X and Y attractive forces, as they're cached.
const xForce = d3.forceX().x(this.width_ / 2).strength(0.1);
const yForce = d3.forceY()
- .y(this.getYPosition_.bind(this))
- .strength(this.getYStrength_.bind(this));
+ .y(this.getTargetYPosition_.bind(this))
+ .strength(this.getTargetYPositionStrength_.bind(this));
this.simulation_.force('x_pos', xForce);
this.simulation_.force('y_pos', yForce);
diff --git a/chromium/chrome/browser/resources/domain_reliability_internals.css b/chromium/chrome/browser/resources/domain_reliability_internals/domain_reliability_internals.css
index 94e47c880b2..94e47c880b2 100644
--- a/chromium/chrome/browser/resources/domain_reliability_internals.css
+++ b/chromium/chrome/browser/resources/domain_reliability_internals/domain_reliability_internals.css
diff --git a/chromium/chrome/browser/resources/domain_reliability_internals.html b/chromium/chrome/browser/resources/domain_reliability_internals/domain_reliability_internals.html
index 95d6d18901b..7bb2a1b8e19 100644
--- a/chromium/chrome/browser/resources/domain_reliability_internals.html
+++ b/chromium/chrome/browser/resources/domain_reliability_internals/domain_reliability_internals.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
- <link rel="stylesheet" href="domain_reliability_internals.css" />
+ <link rel="stylesheet" href="domain_reliability_internals.css">
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/util.js"></script>
<script src="chrome://resources/js/jstemplate_compiled.js"></script>
diff --git a/chromium/chrome/browser/resources/domain_reliability_internals.js b/chromium/chrome/browser/resources/domain_reliability_internals/domain_reliability_internals.js
index 8d475fb4ce4..8d475fb4ce4 100644
--- a/chromium/chrome/browser/resources/domain_reliability_internals.js
+++ b/chromium/chrome/browser/resources/domain_reliability_internals/domain_reliability_internals.js
diff --git a/chromium/chrome/browser/resources/download_internals/BUILD.gn b/chromium/chrome/browser/resources/download_internals/BUILD.gn
index 53a4def4ffe..e1314cfd5de 100644
--- a/chromium/chrome/browser/resources/download_internals/BUILD.gn
+++ b/chromium/chrome/browser/resources/download_internals/BUILD.gn
@@ -17,7 +17,6 @@ js_library("download_internals") {
":download_internals_browser_proxy",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:util",
]
}
diff --git a/chromium/chrome/browser/resources/download_internals/download_internals.html b/chromium/chrome/browser/resources/download_internals/download_internals.html
index 1c71deee56e..62b2d8c3794 100644
--- a/chromium/chrome/browser/resources/download_internals/download_internals.html
+++ b/chromium/chrome/browser/resources/download_internals/download_internals.html
@@ -11,10 +11,8 @@
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/cr/ui/list_item.html">
<link rel="import" href="chrome://resources/html/cr/ui/list.html">
- <link rel="import" href="chrome://resources/html/load_time_data.html">
<link rel="import" href="chrome://resources/html/util.html">
- <script src="strings.js"></script>
<script src="download_internals_browser_proxy.js"></script>
<script src="download_internals.js"></script>
<script src="download_internals_visuals.js"></script>
diff --git a/chromium/chrome/browser/resources/downloads/BUILD.gn b/chromium/chrome/browser/resources/downloads/BUILD.gn
index bc2e6e07fef..312cc0a1af1 100644
--- a/chromium/chrome/browser/resources/downloads/BUILD.gn
+++ b/chromium/chrome/browser/resources/downloads/BUILD.gn
@@ -83,6 +83,7 @@ js_library("manager") {
":search_service",
":toolbar",
"//third_party/polymer/v1_0/components-chromium/iron-list:iron-list-extracted",
+ "//ui/webui/resources/cr_elements/cr_toast:cr_toast_manager",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:find_shortcut_behavior",
"//ui/webui/resources/js:load_time_data",
@@ -107,6 +108,7 @@ js_library("toolbar") {
":search_service",
"//third_party/polymer/v1_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer-extracted",
"//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu",
+ "//ui/webui/resources/cr_elements/cr_toast:cr_toast_manager",
"//ui/webui/resources/cr_elements/cr_toolbar:cr_toolbar",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:util",
diff --git a/chromium/chrome/browser/resources/downloads/images/incognito_marker.svg b/chromium/chrome/browser/resources/downloads/images/incognito_marker.svg
index e744e3a58fb..d36ca640be6 100644
--- a/chromium/chrome/browser/resources/downloads/images/incognito_marker.svg
+++ b/chromium/chrome/browser/resources/downloads/images/incognito_marker.svg
@@ -1 +1 @@
-<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><g fill="#5F6368" fill-rule="nonzero"><circle cx="5.44" cy="10.371" r="1.411"/><path d="M8 0C3.578 0 0 3.578 0 8c0 4.422 3.578 8 8 8 4.422 0 8-3.578 8-8 0-4.422-3.578-8-8-8zM6.095 3.28a.557.557 0 0 1 .705-.335l1.178.393 1.171-.393a.573.573 0 0 1 .706.335l1.287 3.433H4.815l1.28-3.433zm4.414 9.062a1.97 1.97 0 0 1-1.956-1.804c-.546-.349-.99-.13-1.164-.014a1.96 1.96 0 0 1-1.956 1.81 1.977 1.977 0 0 1-1.971-1.97c0-1.084.887-1.971 1.97-1.971.932 0 1.71.647 1.913 1.52a1.547 1.547 0 0 1 1.237.007 1.97 1.97 0 0 1 1.913-1.527c1.083 0 1.97.887 1.97 1.97a1.948 1.948 0 0 1-1.956 1.979zm2.538-4.502H2.91v-.567h10.138v.567z"/><circle cx="10.509" cy="10.371" r="1.411"/></g></svg> \ No newline at end of file
+<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><g fill="#5F6368"><circle cx="5.44" cy="10.371" r="1.411"/><path d="M8 0C3.578 0 0 3.578 0 8c0 4.422 3.578 8 8 8 4.422 0 8-3.578 8-8 0-4.422-3.578-8-8-8zM6.095 3.28a.557.557 0 0 1 .705-.335l1.178.393 1.171-.393a.573.573 0 0 1 .706.335l1.287 3.433H4.815l1.28-3.433zm4.414 9.062a1.97 1.97 0 0 1-1.956-1.804c-.546-.349-.99-.13-1.164-.014a1.96 1.96 0 0 1-1.956 1.81 1.977 1.977 0 0 1-1.971-1.97c0-1.084.887-1.971 1.97-1.971.932 0 1.71.647 1.913 1.52a1.547 1.547 0 0 1 1.237.007 1.97 1.97 0 0 1 1.913-1.527c1.083 0 1.97.887 1.97 1.97a1.948 1.948 0 0 1-1.956 1.979zm2.538-4.502H2.91v-.567h10.138v.567z"/><circle cx="10.509" cy="10.371" r="1.411"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/downloads/images/no_downloads.svg b/chromium/chrome/browser/resources/downloads/images/no_downloads.svg
index 5e0676db07f..8b9ed4fb1fd 100644
--- a/chromium/chrome/browser/resources/downloads/images/no_downloads.svg
+++ b/chromium/chrome/browser/resources/downloads/images/no_downloads.svg
@@ -1 +1 @@
-<svg width="237" height="289" xmlns="http://www.w3.org/2000/svg"><g fill="#9AA0A6" fill-rule="evenodd"><path d="M162.632 77.011c3.31-5.735 10.656-7.693 16.379-4.389l51.978 30.01c5.735 3.31 7.693 10.656 4.389 16.379l-30.01 51.978c-3.31 5.735-10.656 7.693-16.379 4.389l-51.978-30.01c-5.735-3.31-7.693-10.656-4.389-16.379l30.01-51.978zm3.723 44.885l3.08 17.998 24.669-10.06 4.186 34.748-56.58-32.667 24.645-10.02zM63.125 114.58L5.44 145.252c-4.532 2.41-6.269 8.09-3.859 12.623l30.672 57.686c2.41 4.532 8.09 6.269 12.623 3.859l57.686-30.672c4.532-2.41 6.269-8.09 3.859-12.623L75.748 118.44c-2.41-4.532-8.09-6.269-12.623-3.859zm-15.52 86.4c-2.623 1.395-5.91.39-7.304-2.233l-10.14-19.071c-6.993-13.152-1.988-29.523 11.163-36.516 13.152-6.992 29.523-1.987 36.516 11.164l10.14 19.072c1.395 2.622.39 5.909-2.233 7.303l-11.125 5.915-8.45-15.893 7.946-4.225-4.225-7.946c-4.669-8.781-15.563-12.112-24.343-7.443-8.781 4.669-12.112 15.563-7.443 24.343l4.225 7.947 7.947-4.225 8.45 15.893-11.125 5.915zM69.311.145c-4.671-.824-9.108 2.232-9.91 6.782L47.69 73.1c-.803 4.55 2.32 8.939 6.992 9.762l51.007 8.994c4.671.824 9.15-2.225 9.952-6.775l8.752-49.634-21.106-29.31L69.311.145zm24.704 34.819l4.168-23.636 19.468 27.803-23.636-4.167zM168.645 210.357l11.988 16.163-11.817 2.084-11.99-16.164-8.862 1.563 11.988 16.164-11.817 2.084-11.99-16.164-8.862 1.563 11.989 16.164-11.818 2.083-11.99-16.163-2.954.52c-5.14.907-8.147 5.378-7.3 10.427l8.856 50.225c.889 5.04 5.286 8.207 10.426 7.3l64.998-11.46c5.14-.907 8.189-5.386 7.3-10.427l-10.419-59.088-17.726 3.126z"/></g></svg> \ No newline at end of file
+<svg width="237" height="289" xmlns="http://www.w3.org/2000/svg"><path d="M162.632 77.011c3.31-5.735 10.656-7.693 16.379-4.389l51.978 30.01c5.735 3.31 7.693 10.656 4.389 16.379l-30.01 51.978c-3.31 5.735-10.656 7.693-16.379 4.389l-51.978-30.01c-5.735-3.31-7.693-10.656-4.389-16.379l30.01-51.978zm3.723 44.885l3.08 17.998 24.669-10.06 4.186 34.748-56.58-32.667 24.645-10.02zm-103.23-7.316L5.44 145.252c-4.532 2.41-6.269 8.09-3.859 12.623l30.672 57.686c2.41 4.532 8.09 6.269 12.623 3.859l57.686-30.672c4.532-2.41 6.269-8.09 3.859-12.623L75.748 118.44c-2.41-4.532-8.09-6.269-12.623-3.859zm-15.52 86.4c-2.623 1.395-5.91.39-7.304-2.233l-10.14-19.071c-6.993-13.152-1.988-29.523 11.163-36.516 13.152-6.992 29.523-1.987 36.516 11.164l10.14 19.072c1.395 2.622.39 5.909-2.233 7.303l-11.125 5.915-8.45-15.893 7.946-4.225-4.225-7.946c-4.669-8.781-15.563-12.112-24.343-7.443-8.781 4.669-12.112 15.563-7.443 24.343l4.225 7.947 7.947-4.225 8.45 15.893-11.125 5.915zM69.311.145c-4.671-.824-9.108 2.232-9.91 6.782L47.69 73.1c-.803 4.55 2.32 8.939 6.992 9.762l51.007 8.994c4.671.824 9.15-2.225 9.952-6.775l8.752-49.634-21.106-29.31L69.311.145zm24.704 34.819l4.168-23.636 19.468 27.803-23.636-4.167zm74.63 175.393l11.988 16.163-11.817 2.084-11.99-16.164-8.862 1.563 11.988 16.164-11.817 2.084-11.99-16.164-8.862 1.563 11.989 16.164-11.818 2.083-11.99-16.163-2.954.52c-5.14.907-8.147 5.378-7.3 10.427l8.856 50.225c.889 5.04 5.286 8.207 10.426 7.3l64.998-11.46c5.14-.907 8.189-5.386 7.3-10.427l-10.419-59.088-17.726 3.126z" fill="#9AA0A6" fill-rule="evenodd"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/downloads/item.html b/chromium/chrome/browser/resources/downloads/item.html
index 60350e371c0..d75108d8dbe 100644
--- a/chromium/chrome/browser/resources/downloads/item.html
+++ b/chromium/chrome/browser/resources/downloads/item.html
@@ -5,6 +5,7 @@
<link rel="import" href="chrome://downloads/i18n_setup.html">
<link rel="import" href="chrome://downloads/icon_loader.html">
<link rel="import" href="chrome://downloads/icons.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
@@ -18,7 +19,6 @@
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
@@ -243,23 +243,11 @@
color: var(--controlled-by-active-link-color);
}
- #remove-wrapper {
- align-self: flex-start;
- margin: 0;
- }
- #remove-wrapper > paper-icon-button-light {
- --cr-icon-size: 16px;
- color: var(--google-grey-refresh-700);
- height: 32px;
- margin-inline-end: 8px;
- margin-inline-start: 0;
+ cr-icon-button {
+ --cr-icon-button-icon-size: 16px;
+ --cr-icon-button-margin-end: 8px;
margin-top: 8px;
- width: 32px;
- }
-
- :host-context([dark]) #remove-wrapper > paper-icon-button-light {
- color: var(--google-grey-refresh-500);
}
#incognito {
@@ -283,9 +271,9 @@
}
</style>
- <h3 id="date">[[computeDate_(data.hideDate,
- data.sinceString,
- data.dateString)]]</h3>
+ <div id="date">[[computeDate_(data.hideDate,
+ data.sinceString,
+ data.dateString)]]</div>
<div id="content" on-dragstart="onDragStart_"
class$="[[computeClass_(isActive_, isDangerous_, showProgress_)]]"
@@ -376,18 +364,12 @@
</div>
</template>
</div>
-
- <div id="remove-wrapper" class="icon-wrapper ">
- <paper-icon-button-light class="icon-clear"
- style$="[[computeRemoveStyle_(isDangerous_, showCancel_)]]">
- <button id="remove"
- title="$i18n{controlRemoveFromList}"
- aria-label$="[[controlRemoveFromListAriaLabel_]]"
- on-click="onRemoveTap_" focus-row-control focus-type="remove">
- </button>
- </paper-icon-button-light>
- </div>
-
+ <cr-icon-button class="icon-clear"
+ style$="[[computeRemoveStyle_(isDangerous_, showCancel_)]]"
+ id="remove" title="$i18n{controlRemoveFromList}"
+ aria-label$="[[controlRemoveFromListAriaLabel_]]"
+ on-click="onRemoveTap_" focus-row-control focus-type="remove">
+ </cr-icon-button>
<div id="incognito" title="$i18n{inIncognito}" hidden="[[!data.otr]]">
</div>
</div>
diff --git a/chromium/chrome/browser/resources/downloads/manager.html b/chromium/chrome/browser/resources/downloads/manager.html
index fff6c6d0716..4407c5e1209 100644
--- a/chromium/chrome/browser/resources/downloads/manager.html
+++ b/chromium/chrome/browser/resources/downloads/manager.html
@@ -7,6 +7,7 @@
<link rel="import" href="chrome://downloads/search_service.html">
<link rel="import" href="chrome://downloads/toolbar.html">
<link rel="import" href="chrome://resources/cr_components/managed_footnote/managed_footnote.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_toast/cr_toast_manager.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
@@ -140,6 +141,8 @@
</div>
</div>
</div>
+ <cr-toast-manager on-undo-click="onUndoClick_" undo-label="$i18n{undo}"
+ undo-description="$i18n{undoDescription}"></cr-toast-manager>
</template>
<script src="chrome://downloads/manager.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/downloads/manager.js b/chromium/chrome/browser/resources/downloads/manager.js
index 192dbe3657e..8f409a57098 100644
--- a/chromium/chrome/browser/resources/downloads/manager.js
+++ b/chromium/chrome/browser/resources/downloads/manager.js
@@ -212,6 +212,7 @@ cr.define('downloads', function() {
if (e.command.id == 'clear-all-command') {
this.mojoHandler_.clearAll();
} else if (e.command.id == 'undo-command') {
+ cr.toastManager.getInstance().hide();
this.mojoHandler_.undo();
}
},
@@ -252,6 +253,7 @@ cr.define('downloads', function() {
*/
removeItem_: function(index) {
const removed = this.items_.splice(index, 1);
+ const removedFileName = removed[0].fileName;
this.updateHideDates_(index, index);
this.notifySplices('items_', [{
index: index,
@@ -260,6 +262,13 @@ cr.define('downloads', function() {
type: 'splice',
removed: removed,
}]);
+ const pieces = loadTimeData.getSubstitutedStringPieces(
+ loadTimeData.getString('toastRemovedFromList'), removedFileName);
+ pieces.forEach(p => {
+ // Make the file name collapsible.
+ p.collapsible = !!p.arg;
+ });
+ cr.toastManager.getInstance().showForStringPieces(pieces, true);
if (this.restoreFocusAfterRemove_) {
this.restoreFocusAfterRemove_ = false;
if (this.items_.length > 0) {
@@ -280,6 +289,12 @@ cr.define('downloads', function() {
this.restoreFocusAfterRemove_ = true;
},
+ /** @private */
+ onUndoClick_: function() {
+ cr.toastManager.getInstance().hide();
+ this.mojoHandler_.undo();
+ },
+
/**
* Updates whether dates should show for |this.items_[start - end]|. Note:
* this method does not trigger template bindings. Use notifySplices() or
diff --git a/chromium/chrome/browser/resources/downloads/toolbar.html b/chromium/chrome/browser/resources/downloads/toolbar.html
index 80fc546b5f2..d07eb812168 100644
--- a/chromium/chrome/browser/resources/downloads/toolbar.html
+++ b/chromium/chrome/browser/resources/downloads/toolbar.html
@@ -3,6 +3,7 @@
<link rel="import" href="chrome://downloads/search_service.html">
<link rel="import" href="chrome://downloads/browser_proxy.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
@@ -10,8 +11,6 @@
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/util.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<dom-module id="downloads-toolbar">
@@ -27,24 +26,21 @@
flex: 1;
}
- #moreActionsContainer {
- --iron-icon-height: 20px;
- --iron-icon-width: 20px;
- height: 32px;
- padding: 6px 0;
- width: 32px;
+ cr-icon-button {
+ justify-content: flex-end;
+ margin: 4px;
+ }
+
+ :host-context(html:not([dark])) cr-icon-button {
+ --cr-icon-button-color: currentColor;
}
</style>
<cr-toolbar id="toolbar" page-name="$i18n{title}"
search-prompt="$i18n{search}" clear-label="$i18n{clearSearch}"
spinner-active="{{spinnerActive}}" on-search-changed="onSearchChanged_">
- <paper-icon-button-light id="moreActionsContainer"
- class="dropdown-trigger">
- <button id="moreActions" title="$i18n{moreActions}"
- on-click="onMoreActionsTap_" aria-haspopup="menu">
- <iron-icon icon="cr:more-vert"></iron-icon>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="moreActions" iron-icon="cr:more-vert"
+ class="dropdown-trigger" title="$i18n{moreActions}"
+ on-click="onMoreActionsTap_" aria-haspopup="menu"></cr-icon-button>
</cr-toolbar>
<cr-action-menu id="moreActionsMenu"
aria-label="$i18n{actionMenuDescription}">
diff --git a/chromium/chrome/browser/resources/downloads/toolbar.js b/chromium/chrome/browser/resources/downloads/toolbar.js
index d90ed2d2231..5ab454a4284 100644
--- a/chromium/chrome/browser/resources/downloads/toolbar.js
+++ b/chromium/chrome/browser/resources/downloads/toolbar.js
@@ -61,6 +61,8 @@ cr.define('downloads', function() {
assert(this.canClearAll());
this.mojoHandler_.clearAll();
this.$.moreActionsMenu.close();
+ cr.toastManager.getInstance().show(
+ loadTimeData.getString('toastClearedAll'), true);
},
/** @private */
diff --git a/chromium/chrome/browser/resources/eoc_internals/BUILD.gn b/chromium/chrome/browser/resources/eoc_internals/BUILD.gn
index 97fbc9b46eb..cbef167ce06 100644
--- a/chromium/chrome/browser/resources/eoc_internals/BUILD.gn
+++ b/chromium/chrome/browser/resources/eoc_internals/BUILD.gn
@@ -12,11 +12,7 @@ js_type_check("closure_compile") {
js_library("eoc_internals") {
deps = [
+ "//chrome/browser/ui/webui/eoc_internals:mojo_bindings_js_library_for_compile",
"//ui/webui/resources/js:util",
]
- extra_deps = [ "//chrome/browser/ui/webui/eoc_internals:mojo_bindings_js" ]
- externs_list = [
- "$root_gen_dir/chrome/browser/ui/webui/eoc_internals/eoc_internals.mojom.externs.js",
- "$externs_path/mojo.js",
- ]
}
diff --git a/chromium/chrome/browser/resources/eoc_internals/eoc_internals.html b/chromium/chrome/browser/resources/eoc_internals/eoc_internals.html
index 18416057f07..6b5bb2f1de6 100644
--- a/chromium/chrome/browser/resources/eoc_internals/eoc_internals.html
+++ b/chromium/chrome/browser/resources/eoc_internals/eoc_internals.html
@@ -13,9 +13,9 @@ found in the LICENSE file.
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
<link rel="stylesheet" href="eoc_internals.css">
- <script src="chrome://resources/js/mojo_bindings.js"></script>
+ <script src="chrome://resources/js/mojo_bindings_lite.js"></script>
<script src="chrome://resources/js/util.js"></script>
- <script src="eoc_internals.mojom.js"></script>
+ <script src="eoc_internals.mojom-lite.js"></script>
<script src="eoc_internals.js"></script>
</head>
diff --git a/chromium/chrome/browser/resources/eoc_internals/eoc_internals.js b/chromium/chrome/browser/resources/eoc_internals/eoc_internals.js
index 33cf1846bd4..4f36dfec9f2 100644
--- a/chromium/chrome/browser/resources/eoc_internals/eoc_internals.js
+++ b/chromium/chrome/browser/resources/eoc_internals/eoc_internals.js
@@ -4,7 +4,10 @@
'use strict';
-// Reference to the backend.
+/**
+ * Reference to the backend.
+ * @type {eocInternals.mojom.PageHandlerProxy}
+ */
let pageHandler = null;
(function() {
@@ -26,8 +29,8 @@ function clearChildrenForId(domId) {
// Get the general properties.
function updatePageWithProperties() {
pageHandler.getProperties().then(response => {
- response.properties.forEach(function(value, field) {
- $(field).textContent = value;
+ Object.keys(response.properties).forEach(function(field) {
+ $(field).textContent = response.properties[field];
});
});
}
@@ -141,10 +144,7 @@ function setupEventListeners() {
document.addEventListener('DOMContentLoaded', function() {
// Setup backend mojo.
- pageHandler = new eocInternals.mojom.PageHandlerPtr;
- Mojo.bindInterface(
- eocInternals.mojom.PageHandler.name,
- mojo.makeRequest(pageHandler).handle);
+ pageHandler = eocInternals.mojom.PageHandler.getProxy();
updatePageWithProperties();
updatePageWithCachedMetricEvents();
@@ -152,4 +152,4 @@ document.addEventListener('DOMContentLoaded', function() {
setupEventListeners();
});
-})(); \ No newline at end of file
+})();
diff --git a/chromium/chrome/browser/resources/md_extensions/BUILD.gn b/chromium/chrome/browser/resources/extensions/BUILD.gn
index 10308a08fa6..8e92d58854d 100644
--- a/chromium/chrome/browser/resources/md_extensions/BUILD.gn
+++ b/chromium/chrome/browser/resources/extensions/BUILD.gn
@@ -46,7 +46,7 @@ grit("flattened_resources") {
"grit/extensions_resources_map.h",
extensions_pak_file,
]
- output_dir = "$root_gen_dir/chrome/browser/resources/md_extensions"
+ output_dir = "$root_gen_dir/chrome/browser/resources/extensions"
}
group("closure_compile") {
diff --git a/chromium/chrome/browser/resources/md_extensions/OWNERS b/chromium/chrome/browser/resources/extensions/OWNERS
index 8483f0b410a..8483f0b410a 100644
--- a/chromium/chrome/browser/resources/md_extensions/OWNERS
+++ b/chromium/chrome/browser/resources/extensions/OWNERS
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/BUILD.gn b/chromium/chrome/browser/resources/extensions/activity_log/BUILD.gn
index 836d0fc25bb..be1754ad8ff 100644
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/BUILD.gn
+++ b/chromium/chrome/browser/resources/extensions/activity_log/BUILD.gn
@@ -24,6 +24,8 @@ js_library("activity_log_history_item") {
js_library("activity_log_history") {
deps = [
":activity_log_history_item",
+ "//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu",
+ "//ui/webui/resources/cr_elements/cr_search_field:cr_search_field",
"//ui/webui/resources/js:cr",
]
externs_list = [ "$externs_path/activity_log_private.js" ]
@@ -32,6 +34,8 @@ js_library("activity_log_history") {
js_library("activity_log_stream") {
deps = [
":activity_log_stream_item",
+ "//third_party/polymer/v1_0/components-chromium/iron-list:iron-list-extracted",
+ "//ui/webui/resources/cr_elements/cr_search_field:cr_search_field",
"//ui/webui/resources/js:cr",
]
externs_list = [ "$externs_path/activity_log_private.js" ]
@@ -51,7 +55,6 @@ js_library("activity_log") {
"..:item_behavior",
"..:navigation_helper",
"//ui/webui/resources/cr_elements:cr_container_shadow_behavior",
- "//ui/webui/resources/cr_elements/cr_search_field:cr_search_field",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:i18n_behavior",
"//ui/webui/resources/js/cr/ui:focus_without_ink",
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log.html b/chromium/chrome/browser/resources/extensions/activity_log/activity_log.html
index b9bae98e9d5..301a0adae6f 100644
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log.html
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log.html
@@ -1,40 +1,33 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_container_shadow_behavior.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_search_field/cr_search_field.html">
<link rel="import" href="chrome://resources/cr_elements/paper_tabs_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-pages/iron-pages.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-tabs/paper-tabs.html">
<link rel="import" href="activity_log_history.html">
<link rel="import" href="activity_log_stream.html">
<link rel="import" href="../item_behavior.html">
<link rel="import" href="../navigation_helper.html">
<link rel="import" href="../shared_style.html">
+<link rel="import" href="../shared_vars.html">
<dom-module id="extensions-activity-log">
<template>
<style include="cr-icons shared-style paper-tabs-style">
#activity-log-heading {
@apply --cr-title-text;
- display: flex;
- flex-direction: row;
- flex-grow: 1;
}
#clear-activities-button {
margin-inline-start: 8px;
}
- cr-search-field {
- padding-inline-end: 8px;
- }
-
#icon {
height: 24px;
margin-inline-end: 12px;
@@ -43,17 +36,36 @@
}
paper-tabs {
+ border-bottom: 1px solid var(--google-grey-refresh-300);
font-size: inherit;
height: 40px;
}
+
+ .page-content {
+ display: flex;
+ flex-direction: column;
+ padding-bottom: 0;
+ }
+
+ iron-pages {
+ flex: 1;
+ position: relative;
+ }
+
+ activity-log-history,
+ activity-log-stream {
+ bottom: 0;
+ position: absolute;
+ top: 0;
+ width: 100%;
+ }
</style>
<div class="page-container" id="container">
<div class="page-content">
<div class="page-header">
- <paper-icon-button-light class="icon-arrow-back no-overlap">
- <button id="closeButton" aria-label="$i18n{back}"
- on-click="onCloseButtonTap_"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-arrow-back no-overlap" id="closeButton"
+ aria-label="$i18n{back}" on-click="onCloseButtonTap_">
+ </cr-icon-button>
<img id="icon" src="[[extensionInfo.iconUrl]]"
alt$="[[appOrExtension(
extensionInfo.type,
@@ -62,9 +74,6 @@
<div id="activity-log-heading">
[[i18n('activityLogPageHeading', extensionInfo.name)]]
</div>
- <cr-search-field label="$i18n{activityLogSearchLabel}"
- on-search-changed="onSearchChanged_">
- </cr-search-field >
</div>
<paper-tabs noink selected="{{selectedSubpage_}}">
<paper-tab id="history-tab">
@@ -79,7 +88,7 @@
<template is="dom-if"
if="[[isHistoryTabSelected_(selectedSubpage_)]]" restamp>
<activity-log-history extension-id="[[extensionInfo.id]]"
- delegate="[[delegate]]" last-search="[[lastSearch_]]">
+ delegate="[[delegate]]">
</activity-log-history>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log.js b/chromium/chrome/browser/resources/extensions/activity_log/activity_log.js
index 19e5f18cb28..27e9e421209 100644
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log.js
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log.js
@@ -37,12 +37,6 @@ cr.define('extensions', function() {
/** @type {!extensions.ActivityLogDelegate} */
delegate: Object,
- /** @private */
- lastSearch_: {
- type: String,
- value: '',
- },
-
/** @private {!ActivityLogSubpage} */
selectedSubpage_: {
type: Number,
@@ -95,22 +89,6 @@ cr.define('extensions', function() {
extensions.navigation.navigateTo(
{page: Page.DETAILS, extensionId: this.extensionInfo.id});
},
-
- /**
- * @private
- * @param {!CustomEvent<string>} e
- */
- onSearchChanged_: function(e) {
- // Remove all whitespaces from the search term, as API call names and
- // urls should not contain any whitespace. As of now, only single term
- // search queries are allowed.
- const searchTerm = e.detail.replace(/\s+/g, '');
- if (searchTerm === this.lastSearch_) {
- return;
- }
-
- this.lastSearch_ = searchTerm;
- },
});
return {
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history.html b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_history.html
index 76ea48e86e0..f7004f8354b 100644
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history.html
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_history.html
@@ -2,6 +2,9 @@
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/promise_resolver.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_search_field/cr_search_field.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="activity_log_history_item.html">
@@ -11,13 +14,28 @@
<template>
<style include="paper-button-style shared-style">
:host {
- --activity-log-call-and-count-width: 529px;
+ --activity-log-call-and-count-width: 514px;
--activity-type-width: 85px;
--activity-count-width: 100px;
+
+ display: flex;
+ flex-direction: column;
+ }
+
+ cr-search-field {
+ margin-inline-end: auto;
+ }
+
+ cr-icon-button {
+ margin: 0;
}
.activity-table-headings {
- max-width: var(--activity-log-call-and-count-width);
+ width: var(--activity-log-call-and-count-width);
+ }
+
+ #activity-list {
+ overflow-y: auto;
}
#activity-type {
@@ -35,10 +53,26 @@
}
</style>
<div class="activity-subpage-header">
+ <cr-search-field label="$i18n{activityLogSearchLabel}"
+ on-search-changed="onSearchChanged_">
+ </cr-search-field >
<paper-button class="clear-activities-button"
on-click="onClearActivitiesClick_">
$i18n{clearActivities}
</paper-button>
+ <cr-icon-button id="more-actions" iron-icon="cr:more-vert"
+ title="$i18n{activityLogMoreActionsLabel}"
+ on-click="onMoreActionsClick_"></cr-icon-button>
+ <cr-action-menu>
+ <button id="expand-all-button" class="dropdown-item"
+ on-click="onExpandAllClick_">
+ $i18n{activityLogExpandAll}
+ </button>
+ <button id="collapse-all-button" class="dropdown-item"
+ on-click="onCollapseAllClick_">
+ $i18n{activityLogCollapseAll}
+ </button>
+ </cr-action-menu>
</div>
<div id="loading-activities" class="activity-message"
hidden$="[[!shouldShowLoadingMessage_(
@@ -50,13 +84,14 @@
pageState_, activityData_)]]">
<span>$i18n{noActivities}</span>
</div>
+ <div class="activity-table-headings"
+ hidden$="[[!shouldShowActivities_(pageState_, activityData_)]]">
+ <span id="activity-type">$i18n{activityLogTypeColumn}</span>
+ <span id="activity-key">$i18n{activityLogNameColumn}</span>
+ <span id="activity-count">$i18n{activityLogCountColumn}</span>
+ </div>
<div id="activity-list"
hidden$="[[!shouldShowActivities_(pageState_, activityData_)]]">
- <div class="activity-table-headings">
- <span id="activity-type">$i18n{activityLogTypeColumn}</span>
- <span id="activity-key">$i18n{activityLogNameColumn}</span>
- <span id="activity-count">$i18n{activityLogCountColumn}</span>
- </div>
<template is="dom-repeat" items="[[activityData_]]">
<activity-log-history-item data="[[item]]">
</activity-log-history-item>
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history.js b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_history.js
index 9353c1f5516..3cbf6ec0995 100644
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history.js
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_history.js
@@ -138,7 +138,8 @@ cr.define('extensions', function() {
key,
count,
activityType,
- countsByUrl: pageUrl ? new Map([[pageUrl, count]]) : new Map()
+ countsByUrl: pageUrl ? new Map([[pageUrl, count]]) : new Map(),
+ expanded: false,
};
groupedActivities.set(key, activityGroup);
} else {
@@ -205,10 +206,11 @@ cr.define('extensions', function() {
value: ActivityLogPageState.LOADING,
},
- lastSearch: {
+ /** @private */
+ lastSearch_: {
type: String,
- observer: 'onSearchChanged_',
- }
+ value: '',
+ },
},
listeners: {
@@ -270,6 +272,36 @@ cr.define('extensions', function() {
});
},
+ /** @private */
+ onMoreActionsClick_: function() {
+ this.$$('cr-action-menu').showAt(assert(this.$$('cr-icon-button')));
+ },
+
+ /**
+ * @private
+ * @param {boolean} expanded
+ */
+ expandItems_: function(expanded) {
+ // Do not use .filter here as we need the original index of the item
+ // in |activityData_|.
+ this.activityData_.forEach((item, index) => {
+ if (item.countsByUrl.size > 0) {
+ this.set(`activityData_.${index}.expanded`, expanded);
+ }
+ });
+ this.$$('cr-action-menu').close();
+ },
+
+ /** @private */
+ onExpandAllClick_: function() {
+ this.expandItems_(true);
+ },
+
+ /** @private */
+ onCollapseAllClick_: function() {
+ this.expandItems_(false);
+ },
+
/**
* @private
* @param {!CustomEvent<!Array<string>>} e
@@ -304,11 +336,11 @@ cr.define('extensions', function() {
* @return {!Promise<void>}
*/
refreshActivities_: function() {
- if (this.lastSearch === '') {
+ if (this.lastSearch_ === '') {
return this.getActivityLog_();
}
- return this.getFilteredActivityLog_(this.lastSearch);
+ return this.getFilteredActivityLog_(this.lastSearch_);
},
/**
@@ -339,20 +371,19 @@ cr.define('extensions', function() {
/**
* @private
- * @param {string} newSearch
- * @param {string|undefined} oldSearch
+ * @param {!CustomEvent<string>} e
*/
- onSearchChanged_: function(newSearch, oldSearch) {
- // |this.delegate| may be undefined if --disable-features=WebUIPolymer2
- // is set (happens on the chromeos tryjob), which causes an error. This
- // happens only for the first time the observer for |lastSearch| is
- // invoked, when |lastSearch| changes value from |undefined| to the
- // initial value set in activity_log.js.
- // TODO(kelvinjiang): Remove this when migration to Polymer 2 is complete
- // (crbug.com/738611).
- if (oldSearch != undefined) {
- this.refreshActivities_();
+ onSearchChanged_: function(e) {
+ // Remove all whitespaces from the search term, as API call names and
+ // urls should not contain any whitespace. As of now, only single term
+ // search queries are allowed.
+ const searchTerm = e.detail.replace(/\s+/g, '');
+ if (searchTerm === this.lastSearch_) {
+ return;
}
+
+ this.lastSearch_ = searchTerm;
+ this.refreshActivities_();
},
});
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.html b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_history_item.html
index 53c999224aa..5ed47ab1996 100644
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.html
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_history_item.html
@@ -1,11 +1,11 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
+<link rel="import" href="../shared_style.html">
<link rel="import" href="../shared_vars.html">
<dom-module id="activity-log-history-item">
@@ -14,7 +14,12 @@
:host {
border-top: var(--cr-separator-line);
display: block;
- padding: 8px var(--cr-section-padding);
+ /* Unequal padding on left/right side as the cr-icon-button's width is
+ * greater than the delete icon's width. */
+ padding-bottom: 8px;
+ padding-inline-end: 8px;
+ padding-inline-start: var(--cr-section-padding);
+ padding-top: 8px;
}
#activity-item-main-row {
@@ -87,30 +92,26 @@
<span id="activity-key" title="[[data.key]]">[[data.key]]</span>
<span id="activity-count">[[data.count]]</span>
</div>
- <cr-expand-button expanded="{{isExpanded_}}"
+ <cr-expand-button expanded="{{data.expanded}}"
hidden$="[[!isExpandable_]]">
</cr-expand-button>
<div class="separator" hidden$="[[!isExpandable_]]"></div>
- <paper-icon-button-light id="activity-delete" class="icon-delete-gray">
- <button id="activity-delete-button" aria-describedby="api-call"
- aria-label="$i18n{clearEntry}" on-click="onDeleteTap_">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="activity-delete" class="icon-delete-gray"
+ aria-describedby="api-call" aria-label="$i18n{clearEntry}"
+ on-click="onDeleteTap_"></cr-icon-button>
+ </div>
+ <div id="page-url-list" hidden$="[[!data.expanded]]">
+ <template is="dom-repeat" items="[[getPageUrls_(data)]]">
+ <div class="page-url">
+ <a class="page-url-link" href="[[item.page]]" target="_blank"
+ title="[[item.page]]">[[item.page]]</a>
+ <span class="page-url-count"
+ hidden$="[[!shouldShowPageUrlCount_(data)]]">
+ [[item.count]]
+ </span>
+ </div>
+ </template>
</div>
- <iron-collapse opened="[[isExpanded_]]">
- <div id="page-url-list" hidden$="[[!isExpandable_]]">
- <template is="dom-repeat" items="[[getPageUrls_(data)]]">
- <div class="page-url">
- <a class="page-url-link" href="[[item.page]]"
- title="[[item.page]]">[[item.page]]</a>
- <span class="page-url-count"
- hidden$="[[!shouldShowPageUrlCount_(data)]]">
- [[item.count]]
- </span>
- </div>
- </template>
- </div>
- </iron-collapse>
</template>
<script src="activity_log_history_item.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.js b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_history_item.js
index 62869e4d89b..f91b27f95e4 100644
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.js
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_history_item.js
@@ -11,7 +11,8 @@ cr.define('extensions', function() {
* key: string,
* count: number,
* activityType: !chrome.activityLogPrivate.ExtensionActivityFilter,
- * countsByUrl: !Map<string, number>
+ * countsByUrl: !Map<string, number>,
+ * expanded: boolean
* }}
*/
let ActivityGroup;
@@ -42,12 +43,6 @@ cr.define('extensions', function() {
type: Boolean,
computed: 'computeIsExpandable_(data.countsByUrl)',
},
-
- /** @private */
- isExpanded_: {
- type: Boolean,
- value: false,
- },
},
/**
@@ -87,7 +82,7 @@ cr.define('extensions', function() {
/** @private */
onExpandTap_: function() {
if (this.isExpandable_) {
- this.isExpanded_ = !this.isExpanded_;
+ this.set('data.expanded', !this.data.expanded);
}
},
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream.html b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream.html
index b969b6b06d4..b4f6264f659 100644
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream.html
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream.html
@@ -1,8 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/cr.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_search_field/cr_search_field.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
<link rel="import" href="activity_log_stream_item.html">
<link rel="import" href="../shared_style.html">
@@ -10,13 +12,20 @@
<template>
<style include="shared-style paper-button-style">
:host {
- --activity-log-call-and-time-width: 590px;
+ --activity-log-call-and-time-width: 575px;
--activity-type-width: 85px;
--activity-time-width: 100px;
+
+ display: flex;
+ flex-direction: column;
+ }
+
+ cr-search-field {
+ margin-inline-end: auto;
}
.activity-table-headings {
- max-width: var(--activity-log-call-and-time-width);
+ width: var(--activity-log-call-and-time-width);
}
#activity-type {
@@ -32,8 +41,15 @@
flex: 0 var(--activity-time-width);
text-align: end;
}
+
+ iron-list {
+ flex: 1;
+ }
</style>
<div class="activity-subpage-header">
+ <cr-search-field label="$i18n{activityLogSearchLabel}"
+ on-search-changed="onSearchChanged_">
+ </cr-search-field >
<paper-button id="toggle-stream-button" on-click="onToggleButtonClick_">
<span hidden$="[[isStreamOn_]]">
$i18n{startActivityStream}
@@ -56,18 +72,22 @@
$i18n{emptyStreamStarted}
</span>
</div>
- <div id="activity-stream-list"
- hidden$="[[isStreamEmpty_(activityStream_.length)]]">
- <div class="activity-table-headings">
- <span id="activity-type">$i18n{activityLogTypeColumn}</span>
- <span id="activity-key">$i18n{activityLogNameColumn}</span>
- <span id="activity-time">$i18n{activityLogTimeColumn}</span>
- </div>
- <template is="dom-repeat" items="[[activityStream_]]">
- <activity-log-stream-item id="[[item.id]]" data="[[item]]">
- </activity-log-stream-item>
- </template>
+ <div id="empty-search-message" class="activity-message"
+ hidden$="[[!shouldShowEmptySearchMessage_(
+ activityStream_.length, filteredActivityStream_.length)]]">
+ $i18n{noSearchResults}
</div>
+ <div class="activity-table-headings"
+ hidden$="[[isFilteredStreamEmpty_(filteredActivityStream_.length)]]">
+ <span id="activity-type">$i18n{activityLogTypeColumn}</span>
+ <span id="activity-key">$i18n{activityLogNameColumn}</span>
+ <span id="activity-time">$i18n{activityLogTimeColumn}</span>
+ </div>
+ <iron-list items="[[filteredActivityStream_]]">
+ <template>
+ <activity-log-stream-item data="[[item]]"></activity-log-stream-item>
+ </template>
+ </iron-list>
</template>
<script src="activity_log_stream.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream.js b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream.js
index f2c01d4525a..9c2a1e010cd 100644
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream.js
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream.js
@@ -24,7 +24,7 @@ cr.define('extensions', function() {
const isContentScript = activityType ===
chrome.activityLogPrivate.ExtensionActivityType.CONTENT_SCRIPT;
- const args = isContentScript ? null : activity.args;
+ const args = isContentScript ? JSON.stringify([]) : activity.args;
let streamItemNames = [activity.apiCall];
@@ -35,12 +35,18 @@ cr.define('extensions', function() {
assert(Array.isArray(streamItemNames), 'Invalid data for script names.');
}
+ const other = activity.other;
+ const webRequestInfo = other && other.webRequest;
+
return streamItemNames.map(name => ({
args,
+ argUrl: activity.argUrl,
activityType,
name,
pageUrl: activity.pageUrl,
timestamp,
+ webRequestInfo,
+ expanded: false,
}));
}
@@ -60,11 +66,28 @@ cr.define('extensions', function() {
value: false,
},
- /** @private {!Array<!chrome.activityLogPrivate.ExtensionActivity>} */
+ /** @private {!Array<!extensions.StreamItem>} */
activityStream_: {
type: Array,
value: () => [],
},
+
+ /** @private {!Array<!extensions.StreamItem>} */
+ filteredActivityStream_: {
+ type: Array,
+ computed:
+ 'computeFilteredActivityStream_(activityStream_.*, lastSearch_)',
+ },
+
+ /** @private */
+ lastSearch_: {
+ type: String,
+ value: '',
+ },
+ },
+
+ listeners: {
+ 'resize-stream': 'onResizeStream_',
},
/**
@@ -86,8 +109,13 @@ cr.define('extensions', function() {
},
/** @private */
+ onResizeStream_: function(e) {
+ this.$$('iron-list').notifyResize();
+ },
+
+ /** @private */
clearStream_: function() {
- this.activityStream_ = [];
+ this.splice('activityStream_', 0, this.activityStream_.length);
},
/** @private */
@@ -131,6 +159,22 @@ cr.define('extensions', function() {
/**
* @private
+ * @return {boolean}
+ */
+ isFilteredStreamEmpty_: function() {
+ return this.filteredActivityStream_.length == 0;
+ },
+
+ /**
+ * @private
+ * @return {boolean}
+ */
+ shouldShowEmptySearchMessage_: function() {
+ return !this.isStreamEmpty_() && this.isFilteredStreamEmpty_();
+ },
+
+ /**
+ * @private
* @param {!chrome.activityLogPrivate.ExtensionActivity} activity
*/
extensionActivityListener_: function(activity) {
@@ -138,10 +182,52 @@ cr.define('extensions', function() {
return;
}
- const streamItems = processActivityForStream(activity);
- for (const item of streamItems) {
- this.push('activityStream_', item);
+ this.splice(
+ 'activityStream_', this.activityStream_.length, 0,
+ ...processActivityForStream(activity));
+
+ // Used to update the scrollbar.
+ this.$$('iron-list').notifyResize();
+ },
+
+ /**
+ * @private
+ * @param {!CustomEvent<string>} e
+ */
+ onSearchChanged_: function(e) {
+ // Remove all whitespaces from the search term, as API call names and
+ // URLs should not contain any whitespace. As of now, only single term
+ // search queries are allowed.
+ const searchTerm = e.detail.replace(/\s+/g, '').toLowerCase();
+ if (searchTerm === this.lastSearch_) {
+ return;
}
+
+ this.lastSearch_ = searchTerm;
+ },
+
+ /**
+ * @private
+ * @return {!Array<!extensions.StreamItem>}
+ */
+ computeFilteredActivityStream_: function() {
+ if (!this.lastSearch_) {
+ return this.activityStream_.slice();
+ }
+
+ // Match on these properties for each activity.
+ const propNames = [
+ 'name',
+ 'pageUrl',
+ 'activityType',
+ ];
+
+ return this.activityStream_.filter(act => {
+ return propNames.some(prop => {
+ return act[prop] &&
+ act[prop].toLowerCase().includes(this.lastSearch_);
+ });
+ });
},
});
diff --git a/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream_item.html b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream_item.html
new file mode 100644
index 00000000000..eca08d5f538
--- /dev/null
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream_item.html
@@ -0,0 +1,132 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="chrome://resources/html/cr.html">
+<link rel="import" href="../shared_style.html">
+<link rel="import" href="../shared_vars.html">
+
+<dom-module id="activity-log-stream-item">
+ <template>
+ <style include="cr-icons cr-shared-style shared-style">
+ :host {
+ border-top: var(--cr-separator-line);
+ display: block;
+ padding: 8px var(--cr-section-padding);
+ }
+
+ cr-expand-button {
+ --cr-expand-button-disabled-display: none;
+
+ /* Match separator height. */
+ height: calc(var(--cr-section-min-height) - var(--separator-gap));
+ }
+
+ cr-expand-button[disabled] {
+ opacity: 1;
+ }
+
+ #activity-call-and-time {
+ display: flex;
+ flex: 1;
+ flex-direction: row;
+ margin-inline-end: auto;
+ max-width: var(--activity-log-call-and-time-width);
+ }
+
+ #activity-type {
+ min-width: var(--activity-type-width);
+ }
+
+ #activity-name {
+ flex: 1;
+ margin-inline-start: 10px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ #activity-time {
+ min-width: var(--activity-time-width);
+ text-align: end;
+ }
+
+ #expanded-data {
+ display: flex;
+ flex-direction: column;
+ margin-inline-start: 16px;
+ max-width: var(--activity-log-call-and-time-width);
+ }
+
+ #page-url-link {
+ margin-bottom: 10px;
+ margin-inline-end: auto;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ width: 100%;
+ }
+
+ #args-list,
+ #web-request-section {
+ display: flex;
+ flex-direction: column;
+ margin-bottom: 10px;
+ }
+
+ .expanded-data-heading {
+ font-weight: 500;
+ }
+
+ .list-item {
+ display: flex;
+ margin-top: 10px;
+ }
+
+ .index {
+ min-width: 3em; /* Allow 3 digits of space */
+ }
+
+ .arg,
+ #web-request-details {
+ overflow: hidden;
+ overflow-wrap: break-word;
+ }
+
+ #web-request-details {
+ margin-top: 10px;
+ }
+ </style>
+ <cr-expand-button expanded="[[data.expanded]]"
+ disabled="[[!isExpandable_]]" on-click="onExpandClick_">
+ <div id="activity-call-and-time">
+ <span id="activity-type">[[data.activityType]]</span>
+ <span id="activity-name" title="[[data.name]]">[[data.name]]</span>
+ <span id="activity-time">[[getFormattedTime_(data.timeStamp)]]</span>
+ </div>
+ </cr-expand-button>
+ <div id="expanded-data" hidden$="[[!data.expanded]]">
+ <a id="page-url-link" href="[[data.pageUrl]]" target="_blank"
+ hidden$="[[!hasPageUrl_(data.pageUrl)]]"
+ title="[[data.pageUrl]]">[[data.pageUrl]]</a>
+ <div id="args-list" hidden$="[[!hasArgs_(argsList_)]]">
+ <span class="expanded-data-heading">
+ $i18n{activityArgumentsHeading}
+ </span>
+ <template is="dom-repeat" items="[[argsList_]]">
+ <div class="list-item">
+ <span class="index">[[item.index]]</span>
+ <span class="arg">[[item.arg]]</span>
+ </div>
+ </template>
+ </div>
+ <div id="web-request-section"
+ hidden$="[[!hasWebRequestInfo_(data.webRequestInfo)]]">
+ <span class="expanded-data-heading">$i18n{webRequestInfoHeading}</span>
+ <span id="web-request-details">[[data.webRequestInfo]]</span>
+ </div>
+ </div>
+ </template>
+ <script src="activity_log_stream_item.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream_item.js b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream_item.js
new file mode 100644
index 00000000000..9a2e477ee0d
--- /dev/null
+++ b/chromium/chrome/browser/resources/extensions/activity_log/activity_log_stream_item.js
@@ -0,0 +1,162 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('extensions', function() {
+ 'use strict';
+
+ /**
+ * @typedef {{
+ * name: string,
+ * timestamp: number,
+ * activityType: !chrome.activityLogPrivate.ExtensionActivityFilter,
+ * pageUrl: string,
+ * argUrl: string,
+ * args: string,
+ * webRequestInfo: (string|undefined),
+ * expanded: boolean
+ * }}
+ */
+ let StreamItem;
+
+ /**
+ * A struct used to describe each argument for an activity (each item in
+ * the parsed version of |data.args|). Contains the argument's value itself
+ * and its index.
+ * @typedef {{
+ * arg: string,
+ * index: number
+ * }}
+ */
+ let StreamArgItem;
+
+ /**
+ * Placeholder for arg_url that can occur in |StreamItem.args|. Sometimes we
+ * see this as '\u003Carg_url>' (opening arrow is unicode converted) but
+ * string comparison with the non-unicode value still returns true so we
+ * don't need to convert.
+ * @type {string}
+ */
+ const ARG_URL_PLACEHOLDER = '<arg_url>';
+
+ /**
+ * Regex pattern for |ARG_URL_PLACEHOLDER| for String.replace. A regex of the
+ * exact string with a global search flag is needed to replace all
+ * occurrences.
+ * @type {!RegExp}
+ */
+ const ARG_URL_PLACEHOLDER_REGEX = /"<arg_url>"/g;
+
+ const ActivityLogStreamItem = Polymer({
+ is: 'activity-log-stream-item',
+
+ properties: {
+ /**
+ * The underlying ActivityGroup that provides data for the
+ * ActivityLogItem displayed.
+ * @type {!extensions.StreamItem}
+ */
+ data: Object,
+
+ /** @private {!Array<!extensions.StreamArgItem>} */
+ argsList_: {
+ type: Array,
+ computed: 'computeArgsList_(data.args)',
+ },
+
+ /** @private */
+ isExpandable_: {
+ type: Boolean,
+ computed: 'computeIsExpandable_(data)',
+ },
+ },
+
+ /**
+ * @private
+ * @return {boolean}
+ */
+ computeIsExpandable_: function() {
+ return this.hasPageUrl_() || this.hasArgs_() || this.hasWebRequestInfo_();
+ },
+
+ /**
+ * @private
+ * @return {string}
+ */
+ getFormattedTime_: function() {
+ // Format the activity's time to HH:MM:SS.mmm format. Use ToLocaleString
+ // for HH:MM:SS and padLeft for milliseconds.
+ const activityDate = new Date(this.data.timestamp);
+ const timeString = activityDate.toLocaleTimeString(undefined, {
+ hour12: false,
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit',
+ });
+
+ const ms = activityDate.getMilliseconds().toString().padStart(3, '0');
+ return `${timeString}.${ms}`;
+ },
+
+ /**
+ * @private
+ * @return {boolean}
+ */
+ hasPageUrl_: function() {
+ return !!this.data.pageUrl;
+ },
+
+ /**
+ * @private
+ * @return {boolean}
+ */
+ hasArgs_: function() {
+ return this.argsList_.length > 0;
+ },
+
+ /**
+ * @private
+ * @return {boolean}
+ */
+ hasWebRequestInfo_: function() {
+ return !!this.data.webRequestInfo && this.data.webRequestInfo != '{}';
+ },
+
+ /**
+ * @private
+ * @return {!Array<!extensions.StreamArgItem>}
+ */
+ computeArgsList_: function() {
+ const parsedArgs = JSON.parse(this.data.args);
+ if (!Array.isArray(parsedArgs)) {
+ return [];
+ }
+
+ // Replace occurrences AFTER parsing then stringifying as the JSON
+ // serializer on the C++ side escapes certain characters such as '<' and
+ // parsing un-escapes these characters.
+ // See EscapeSpecialCodePoint in base/json/string_escape.cc.
+ return parsedArgs.map(
+ (arg, i) => ({
+ arg: JSON.stringify(arg).replace(
+ ARG_URL_PLACEHOLDER_REGEX, `"${this.data.argUrl}"`),
+ index: i + 1,
+ }));
+ },
+
+ /** @private */
+ onExpandClick_: function() {
+ if (this.isExpandable_) {
+ this.set('data.expanded', !this.data.expanded);
+ this.fire('resize-stream');
+ }
+ },
+ });
+
+ return {
+ ActivityLogStreamItem: ActivityLogStreamItem,
+ StreamItem: StreamItem,
+ StreamArgItem: StreamArgItem,
+ ARG_URL_PLACEHOLDER: ARG_URL_PLACEHOLDER,
+ };
+});
diff --git a/chromium/chrome/browser/resources/md_extensions/code_section.html b/chromium/chrome/browser/resources/extensions/code_section.html
index 0d74f4b20e7..f453c12dbf7 100644
--- a/chromium/chrome/browser/resources/md_extensions/code_section.html
+++ b/chromium/chrome/browser/resources/extensions/code_section.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/load_time_data.html">
@@ -10,34 +11,46 @@
<template>
<style include="cr-hidden-style">
:host {
+ --container-bg: white;
+ --line-bg: var(--paper-grey-300);
+ --main-color: var(--paper-grey-800);
display: block;
}
+ :host-context([dark]) {
+ --container-bg: rgba(0, 0, 0, .4);
+ --line-bg: var(--google-grey-800);
+ --main-color: var(--cr-primary-text-color);
+ }
+
#scroll-container {
- /* TODO(crbug.com/937159): all of the code themed for "light mode" and
- * needs to be updated to co-exist with "dark mode" when specs are
- * available. */
- background: white;
- border: 1px solid var(--paper-grey-500);
+ background: var(--container-bg);
height: 100%;
overflow: auto;
position: relative;
}
+ :host-context(html:not([dark])) #scroll-container {
+ border: 1px solid var(--paper-grey-500);
+ }
+
#main {
- color: var(--paper-grey-800);
+ color: var(--main-color);
display: flex;
font-family: monospace;
min-height: 100%;
}
#line-numbers {
- background: var(--paper-grey-300);
- border-right: 1px solid var(--paper-grey-500);
+ background: var(--line-bg);
display: flex;
flex-direction: column;
padding: 0 8px;
- text-align: right;
+ text-align: end;
+ }
+
+ :host-context(html:not([dark])) #line-numbers {
+ border-inline-end: 1px solid var(--paper-grey-500);
}
#source {
@@ -59,7 +72,7 @@
color: var(--paper-grey-800);
}
- .more-code {
+ :host-context(html:not([dark])) .more-code {
color: var(--paper-grey-500);
}
@@ -67,8 +80,13 @@
height: 0;
overflow: hidden;
}
+
+ :host-context([dark]) mark {
+ background-color: var(--google-yellow-refresh-300);
+ color: var(--google-grey-900);
+ }
</style>
- <div id="scroll-container" hidden="[[!highlighted_]]">
+ <div id="scroll-container" hidden="[[!highlighted_]]" dir="ltr">
<div id="main">
<!-- Line numbers are not useful to a screenreader -->
<div id="line-numbers" aria-hidden="true">
@@ -104,7 +122,7 @@
</div>
</div>
</div>
- <div id="no-code" hidden="[[highlighted_]]">[[couldNotDisplayCode]]</div>
+ <div id="no-code" hidden="[[!showNoCode_]]">[[couldNotDisplayCode]]</div>
<div id="highlight-description" aria-hidden="true">
[[highlightDescription_]]
</div>
diff --git a/chromium/chrome/browser/resources/md_extensions/code_section.js b/chromium/chrome/browser/resources/extensions/code_section.js
index 833c8237b93..3577af2687a 100644
--- a/chromium/chrome/browser/resources/md_extensions/code_section.js
+++ b/chromium/chrome/browser/resources/extensions/code_section.js
@@ -33,6 +33,8 @@ cr.define('extensions', function() {
value: null,
},
+ isActive: Boolean,
+
/** @private Highlighted code. */
highlighted_: String,
@@ -42,6 +44,12 @@ cr.define('extensions', function() {
/** @private Code after the highlighted section. */
after_: String,
+ /** @private */
+ showNoCode_: {
+ type: Boolean,
+ computed: 'computeShowNoCode_(isActive, highlighted_)',
+ },
+
/** @private Description for the highlighted section. */
highlightDescription_: String,
@@ -175,6 +183,14 @@ cr.define('extensions', function() {
return this.i18n('accessibilityErrorLine', lineStart.toString());
}
},
+
+ /**
+ * @private
+ * @return {boolean}
+ */
+ computeShowNoCode_: function() {
+ return this.isActive && !this.highlighted_;
+ },
});
return {CodeSection: CodeSection};
diff --git a/chromium/chrome/browser/resources/md_extensions/detail_view.html b/chromium/chrome/browser/resources/extensions/detail_view.html
index 45b32843891..b021c518c01 100644
--- a/chromium/chrome/browser/resources/md_extensions/detail_view.html
+++ b/chromium/chrome/browser/resources/extensions/detail_view.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_container_shadow_behavior.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
@@ -16,7 +17,6 @@
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="item_behavior.html">
@@ -167,10 +167,9 @@
<div class="page-container" id="container">
<div class="page-content">
<div class="page-header">
- <paper-icon-button-light class="icon-arrow-back no-overlap">
- <button id="closeButton" aria-label="$i18n{back}"
- on-click="onCloseButtonTap_"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-arrow-back no-overlap" id="closeButton"
+ aria-label="$i18n{back}" on-click="onCloseButtonTap_">
+ </cr-icon-button>
<img id="icon" src="[[data.iconUrl]]"
alt$="[[appOrExtension(
data.type,
diff --git a/chromium/chrome/browser/resources/md_extensions/detail_view.js b/chromium/chrome/browser/resources/extensions/detail_view.js
index 1c477906b5b..1c477906b5b 100644
--- a/chromium/chrome/browser/resources/md_extensions/detail_view.js
+++ b/chromium/chrome/browser/resources/extensions/detail_view.js
diff --git a/chromium/chrome/browser/resources/md_extensions/drag_and_drop_handler.html b/chromium/chrome/browser/resources/extensions/drag_and_drop_handler.html
index 2626f1e7a3f..2626f1e7a3f 100644
--- a/chromium/chrome/browser/resources/md_extensions/drag_and_drop_handler.html
+++ b/chromium/chrome/browser/resources/extensions/drag_and_drop_handler.html
diff --git a/chromium/chrome/browser/resources/md_extensions/drag_and_drop_handler.js b/chromium/chrome/browser/resources/extensions/drag_and_drop_handler.js
index 30bdc57f01d..30bdc57f01d 100644
--- a/chromium/chrome/browser/resources/md_extensions/drag_and_drop_handler.js
+++ b/chromium/chrome/browser/resources/extensions/drag_and_drop_handler.js
diff --git a/chromium/chrome/browser/resources/md_extensions/drop_overlay.html b/chromium/chrome/browser/resources/extensions/drop_overlay.html
index 985c3ca083e..985c3ca083e 100644
--- a/chromium/chrome/browser/resources/md_extensions/drop_overlay.html
+++ b/chromium/chrome/browser/resources/extensions/drop_overlay.html
diff --git a/chromium/chrome/browser/resources/md_extensions/drop_overlay.js b/chromium/chrome/browser/resources/extensions/drop_overlay.js
index 913d7186a84..913d7186a84 100644
--- a/chromium/chrome/browser/resources/md_extensions/drop_overlay.js
+++ b/chromium/chrome/browser/resources/extensions/drop_overlay.js
diff --git a/chromium/chrome/browser/resources/md_extensions/error_page.html b/chromium/chrome/browser/resources/extensions/error_page.html
index 15ed0416a89..5067418e7a4 100644
--- a/chromium/chrome/browser/resources/md_extensions/error_page.html
+++ b/chromium/chrome/browser/resources/extensions/error_page.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_container_shadow_behavior.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
@@ -12,7 +13,6 @@
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="code_section.html">
<link rel="import" href="item_util.html">
@@ -69,8 +69,8 @@
padding-inline-start: 0;
}
- .error-item paper-icon-button-light {
- margin-inline-end: 0;
+ .error-item cr-icon-button {
+ margin: 0;
}
.error-item.selected {
@@ -140,11 +140,9 @@
<div class="page-container" id="container">
<div class="page-content">
<div id="heading">
- <paper-icon-button-light class="icon-arrow-back no-overlap">
- <button id="closeButton" aria-label="$i18n{back}"
- on-click="onCloseButtonTap_">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-arrow-back no-overlap" id="closeButton"
+ aria-label="$i18n{back}" on-click="onCloseButtonTap_">
+ </cr-icon-button>
<span>$i18n{errorsPageHeading}</span>
<paper-button on-click="onClearAllTap_" hidden="[[!entries_.length]]">
$i18n{clearAll}
@@ -170,13 +168,11 @@
</div>
</div>
<div class="separator"></div>
- <paper-icon-button-light class="icon-delete-gray">
- <button on-click="onDeleteErrorAction_"
- aria-describedby$="[[item.id]]"
- aria-label="$i18n{clearEntry}"
- on-keydown="onDeleteErrorAction_">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-delete-gray"
+ on-click="onDeleteErrorAction_"
+ aria-describedby$="[[item.id]]"
+ aria-label="$i18n{clearEntry}"
+ on-keydown="onDeleteErrorAction_"></cr-icon-button>
</div>
<iron-collapse opened="[[isOpened_(index, selectedEntry_)]]">
<div class="devtools-controls">
@@ -207,6 +203,7 @@
</ul>
</template>
<extensions-code-section code="[[code_]]"
+ is-active="[[isOpened_(index, selectedEntry_)]]"
could-not-display-code="$i18n{noErrorsToShow}">
</extensions-code-section>
</div>
diff --git a/chromium/chrome/browser/resources/md_extensions/error_page.js b/chromium/chrome/browser/resources/extensions/error_page.js
index f1ce9f225cd..9b910d7f123 100644
--- a/chromium/chrome/browser/resources/md_extensions/error_page.js
+++ b/chromium/chrome/browser/resources/extensions/error_page.js
@@ -418,6 +418,9 @@ cr.define('extensions', function() {
return;
}
+ // Call preventDefault() to avoid the browser scrolling when the space key
+ // is pressed.
+ e.preventDefault();
this.selectedEntry_ =
this.selectedEntry_ == e.model.index ? -1 : e.model.index;
},
diff --git a/chromium/chrome/browser/resources/md_extensions/extensions.html b/chromium/chrome/browser/resources/extensions/extensions.html
index 088cee5cf80..088cee5cf80 100644
--- a/chromium/chrome/browser/resources/md_extensions/extensions.html
+++ b/chromium/chrome/browser/resources/extensions/extensions.html
diff --git a/chromium/chrome/browser/resources/md_extensions/extensions_resources.grd b/chromium/chrome/browser/resources/extensions/extensions_resources.grd
index 4892a52619d..1bb6baea7c5 100644
--- a/chromium/chrome/browser/resources/md_extensions/extensions_resources.grd
+++ b/chromium/chrome/browser/resources/extensions/extensions_resources.grd
@@ -12,229 +12,229 @@
</outputs>
<release seq="1">
<structures>
- <structure name="IDR_MD_EXTENSIONS_ITEM_BEHAVIOR_HTML"
+ <structure name="IDR_EXTENSIONS_ITEM_BEHAVIOR_HTML"
file="item_behavior.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ITEM_BEHAVIOR_JS"
+ <structure name="IDR_EXTENSIONS_ITEM_BEHAVIOR_JS"
file="item_behavior.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_EXTENSIONS_HTML"
+ <structure name="IDR_EXTENSIONS_EXTENSIONS_HTML"
file="extensions.html"
flattenhtml="true"
allowexternalscript="true"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_CODE_SECTION_HTML"
+ <structure name="IDR_EXTENSIONS_CODE_SECTION_HTML"
file="code_section.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_CODE_SECTION_JS"
+ <structure name="IDR_EXTENSIONS_CODE_SECTION_JS"
file="code_section.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HTML"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HTML"
file="activity_log/activity_log.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_JS"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_JS"
file="activity_log/activity_log.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_HTML"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_HTML"
file="activity_log/activity_log_history.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_JS"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_JS"
file="activity_log/activity_log_history.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_ITEM_HTML"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_ITEM_HTML"
file="activity_log/activity_log_history_item.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_ITEM_JS"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_ITEM_JS"
file="activity_log/activity_log_history_item.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_HTML"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_HTML"
file="activity_log/activity_log_stream.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_JS"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_JS"
file="activity_log/activity_log_stream.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_ITEM_HTML"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_ITEM_HTML"
file="activity_log/activity_log_stream_item.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_ITEM_JS"
+ <structure name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_ITEM_JS"
file="activity_log/activity_log_stream_item.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_DETAIL_VIEW_HTML"
+ <structure name="IDR_EXTENSIONS_DETAIL_VIEW_HTML"
file="detail_view.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_DETAIL_VIEW_JS"
+ <structure name="IDR_EXTENSIONS_DETAIL_VIEW_JS"
file="detail_view.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_DRAG_AND_DROP_HANDLER_HTML"
+ <structure name="IDR_EXTENSIONS_DRAG_AND_DROP_HANDLER_HTML"
file="drag_and_drop_handler.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_DRAG_AND_DROP_HANDLER_JS"
+ <structure name="IDR_EXTENSIONS_DRAG_AND_DROP_HANDLER_JS"
file="drag_and_drop_handler.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_DROP_OVERLAY_HTML"
+ <structure name="IDR_EXTENSIONS_DROP_OVERLAY_HTML"
file="drop_overlay.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_DROP_OVERLAY_JS"
+ <structure name="IDR_EXTENSIONS_DROP_OVERLAY_JS"
file="drop_overlay.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ERROR_PAGE_HTML"
+ <structure name="IDR_EXTENSIONS_ERROR_PAGE_HTML"
file="error_page.html"
flattenhtml="true"
allowexternalscript="true"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ERROR_PAGE_JS"
+ <structure name="IDR_EXTENSIONS_ERROR_PAGE_JS"
file="error_page.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_KEYBOARD_SHORTCUTS_HTML"
+ <structure name="IDR_EXTENSIONS_KEYBOARD_SHORTCUTS_HTML"
file="keyboard_shortcuts.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_KEYBOARD_SHORTCUTS_JS"
+ <structure name="IDR_EXTENSIONS_KEYBOARD_SHORTCUTS_JS"
file="keyboard_shortcuts.js"
type="chrome_html" />
<if expr="chromeos">
- <structure name="IDR_MD_EXTENSIONS_KIOSK_BROWSER_PROXY_HTML"
+ <structure name="IDR_EXTENSIONS_KIOSK_BROWSER_PROXY_HTML"
file="kiosk_browser_proxy.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_KIOSK_BROWSER_PROXY_JS"
+ <structure name="IDR_EXTENSIONS_KIOSK_BROWSER_PROXY_JS"
file="kiosk_browser_proxy.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_KIOSK_DIALOG_HTML"
+ <structure name="IDR_EXTENSIONS_KIOSK_DIALOG_HTML"
file="kiosk_dialog.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_KIOSK_DIALOG_JS"
+ <structure name="IDR_EXTENSIONS_KIOSK_DIALOG_JS"
file="kiosk_dialog.js"
type="chrome_html" />
</if>
- <structure name="IDR_MD_EXTENSIONS_MANAGER_HTML"
+ <structure name="IDR_EXTENSIONS_MANAGER_HTML"
file="manager.html"
type="chrome_html"
flattenhtml="true"
allowexternalscript="true" />
- <structure name="IDR_MD_EXTENSIONS_MANAGER_JS"
+ <structure name="IDR_EXTENSIONS_MANAGER_JS"
file="manager.js"
type="chrome_html"
flattenhtml="true" />
- <structure name="IDR_MD_EXTENSIONS_ICONS_HTML"
+ <structure name="IDR_EXTENSIONS_ICONS_HTML"
file="icons.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_INSTALL_WARNINGS_DIALOG_HTML"
+ <structure name="IDR_EXTENSIONS_INSTALL_WARNINGS_DIALOG_HTML"
file="install_warnings_dialog.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_INSTALL_WARNINGS_DIALOG_JS"
+ <structure name="IDR_EXTENSIONS_INSTALL_WARNINGS_DIALOG_JS"
file="install_warnings_dialog.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ITEM_HTML"
+ <structure name="IDR_EXTENSIONS_ITEM_HTML"
file="item.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ITEM_JS"
+ <structure name="IDR_EXTENSIONS_ITEM_JS"
file="item.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ITEM_LIST_HTML"
+ <structure name="IDR_EXTENSIONS_ITEM_LIST_HTML"
file="item_list.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ITEM_LIST_JS"
+ <structure name="IDR_EXTENSIONS_ITEM_LIST_JS"
file="item_list.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ITEM_UTIL_HTML"
+ <structure name="IDR_EXTENSIONS_ITEM_UTIL_HTML"
file="item_util.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_ITEM_UTIL_JS"
+ <structure name="IDR_EXTENSIONS_ITEM_UTIL_JS"
file="item_util.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_LOAD_ERROR_HTML"
+ <structure name="IDR_EXTENSIONS_LOAD_ERROR_HTML"
file="load_error.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_LOAD_ERROR_JS"
+ <structure name="IDR_EXTENSIONS_LOAD_ERROR_JS"
file="load_error.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_HOST_PERMISSIONS_TOGGLE_LIST_HMTL"
+ <structure name="IDR_EXTENSIONS_HOST_PERMISSIONS_TOGGLE_LIST_HMTL"
file="host_permissions_toggle_list.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_HOST_PERMISSIONS_TOGGLE_LIST_JS"
+ <structure name="IDR_EXTENSIONS_HOST_PERMISSIONS_TOGGLE_LIST_JS"
file="host_permissions_toggle_list.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_NAVIGATION_HELPER_HTML"
+ <structure name="IDR_EXTENSIONS_NAVIGATION_HELPER_HTML"
file="navigation_helper.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_NAVIGATION_HELPER_JS"
+ <structure name="IDR_EXTENSIONS_NAVIGATION_HELPER_JS"
file="navigation_helper.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_OPTIONS_DIALOG_HTML"
+ <structure name="IDR_EXTENSIONS_OPTIONS_DIALOG_HTML"
file="options_dialog.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_OPTIONS_DIALOG_JS"
+ <structure name="IDR_EXTENSIONS_OPTIONS_DIALOG_JS"
file="options_dialog.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_PACK_DIALOG_HTML"
+ <structure name="IDR_EXTENSIONS_PACK_DIALOG_HTML"
file="pack_dialog.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_PACK_DIALOG_JS"
+ <structure name="IDR_EXTENSIONS_PACK_DIALOG_JS"
file="pack_dialog.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_PACK_DIALOG_ALERT_HTML"
+ <structure name="IDR_EXTENSIONS_PACK_DIALOG_ALERT_HTML"
file="pack_dialog_alert.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_PACK_DIALOG_ALERT_JS"
+ <structure name="IDR_EXTENSIONS_PACK_DIALOG_ALERT_JS"
file="pack_dialog_alert.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_RUNTIME_HOST_PERMISSIONS_HMTL"
+ <structure name="IDR_EXTENSIONS_RUNTIME_HOST_PERMISSIONS_HMTL"
file="runtime_host_permissions.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_RUNTIME_HOST_PERMISSIONS_JS"
+ <structure name="IDR_EXTENSIONS_RUNTIME_HOST_PERMISSIONS_JS"
file="runtime_host_permissions.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_RUNTIME_HOSTS_DIALOG_HTML"
+ <structure name="IDR_EXTENSIONS_RUNTIME_HOSTS_DIALOG_HTML"
file="runtime_hosts_dialog.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_RUNTIME_HOSTS_DIALOG_JS"
+ <structure name="IDR_EXTENSIONS_RUNTIME_HOSTS_DIALOG_JS"
file="runtime_hosts_dialog.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SERVICE_HTML"
+ <structure name="IDR_EXTENSIONS_SERVICE_HTML"
file="service.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SERVICE_JS"
+ <structure name="IDR_EXTENSIONS_SERVICE_JS"
file="service.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SHARED_STYLE_HTML"
+ <structure name="IDR_EXTENSIONS_SHARED_STYLE_HTML"
file="shared_style.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SHARED_VARS_HTML"
+ <structure name="IDR_EXTENSIONS_SHARED_VARS_HTML"
file="shared_vars.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SHORTCUT_INPUT_HTML"
+ <structure name="IDR_EXTENSIONS_SHORTCUT_INPUT_HTML"
file="shortcut_input.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SHORTCUT_INPUT_JS"
+ <structure name="IDR_EXTENSIONS_SHORTCUT_INPUT_JS"
file="shortcut_input.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SHORTCUT_UTIL_HTML"
+ <structure name="IDR_EXTENSIONS_SHORTCUT_UTIL_HTML"
file="shortcut_util.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SHORTCUT_UTIL_JS"
+ <structure name="IDR_EXTENSIONS_SHORTCUT_UTIL_JS"
file="shortcut_util.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SIDEBAR_HTML"
+ <structure name="IDR_EXTENSIONS_SIDEBAR_HTML"
file="sidebar.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_SIDEBAR_JS"
+ <structure name="IDR_EXTENSIONS_SIDEBAR_JS"
file="sidebar.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_TOGGLE_ROW_HTML"
+ <structure name="IDR_EXTENSIONS_TOGGLE_ROW_HTML"
file="toggle_row.html"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_TOGGLE_ROW_JS"
+ <structure name="IDR_EXTENSIONS_TOGGLE_ROW_JS"
file="toggle_row.js"
type="chrome_html" />
- <structure name="IDR_MD_EXTENSIONS_TOOLBAR_HTML"
+ <structure name="IDR_EXTENSIONS_TOOLBAR_HTML"
file="toolbar.html"
type="chrome_html"
flattenhtml="true"
allowexternalscript="true" />
- <structure name="IDR_MD_EXTENSIONS_TOOLBAR_JS"
+ <structure name="IDR_EXTENSIONS_TOOLBAR_JS"
file="toolbar.js"
type="chrome_html"
flattenhtml="true" />
- <structure name="IDR_MD_EXTENSIONS_STRINGS_HTML"
+ <structure name="IDR_EXTENSIONS_STRINGS_HTML"
file="strings.html"
type="chrome_html" />
</structures>
diff --git a/chromium/chrome/browser/resources/extensions/extensions_resources_vulcanized.grd b/chromium/chrome/browser/resources/extensions/extensions_resources_vulcanized.grd
new file mode 100644
index 00000000000..185e7b18c05
--- /dev/null
+++ b/chromium/chrome/browser/resources/extensions/extensions_resources_vulcanized.grd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
+ <outputs>
+ <output filename="grit/extensions_resources.h" type="rc_header">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="grit/extensions_resources_map.cc"
+ type="resource_map_source" />
+ <output filename="grit/extensions_resources_map.h"
+ type="resource_map_header" />
+ <output filename="extensions_resources.pak" type="data_package" />
+ </outputs>
+ <release seq="1">
+ <includes>
+ <include name="IDR_EXTENSIONS_VULCANIZED_HTML"
+ file="${root_gen_dir}\chrome\browser\resources\extensions\vulcanized.html"
+ use_base_dir="false"
+ flattenhtml="true"
+ allowexternalscript="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_EXTENSIONS_VULCANIZED_P2_HTML"
+ file="${root_gen_dir}\chrome\browser\resources\extensions\vulcanized.p2.html"
+ use_base_dir="false"
+ flattenhtml="true"
+ allowexternalscript="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_EXTENSIONS_CRISPER_JS"
+ file="${root_gen_dir}\chrome\browser\resources\extensions\crisper.js"
+ use_base_dir="false"
+ flattenhtml="true"
+ type="BINDATA"
+ compress="gzip" />
+ </includes>
+ </release>
+</grit>
diff --git a/chromium/chrome/browser/resources/md_extensions/host_permissions_toggle_list.html b/chromium/chrome/browser/resources/extensions/host_permissions_toggle_list.html
index 0e8b6199241..0e8b6199241 100644
--- a/chromium/chrome/browser/resources/md_extensions/host_permissions_toggle_list.html
+++ b/chromium/chrome/browser/resources/extensions/host_permissions_toggle_list.html
diff --git a/chromium/chrome/browser/resources/md_extensions/host_permissions_toggle_list.js b/chromium/chrome/browser/resources/extensions/host_permissions_toggle_list.js
index 6ca93aeab16..6ca93aeab16 100644
--- a/chromium/chrome/browser/resources/md_extensions/host_permissions_toggle_list.js
+++ b/chromium/chrome/browser/resources/extensions/host_permissions_toggle_list.js
diff --git a/chromium/chrome/browser/resources/md_extensions/icons.html b/chromium/chrome/browser/resources/extensions/icons.html
index 9af6920b18f..9af6920b18f 100644
--- a/chromium/chrome/browser/resources/md_extensions/icons.html
+++ b/chromium/chrome/browser/resources/extensions/icons.html
diff --git a/chromium/chrome/browser/resources/md_extensions/install_warnings_dialog.html b/chromium/chrome/browser/resources/extensions/install_warnings_dialog.html
index 19b213005e6..19b213005e6 100644
--- a/chromium/chrome/browser/resources/md_extensions/install_warnings_dialog.html
+++ b/chromium/chrome/browser/resources/extensions/install_warnings_dialog.html
diff --git a/chromium/chrome/browser/resources/md_extensions/install_warnings_dialog.js b/chromium/chrome/browser/resources/extensions/install_warnings_dialog.js
index 5417428c937..5417428c937 100644
--- a/chromium/chrome/browser/resources/md_extensions/install_warnings_dialog.js
+++ b/chromium/chrome/browser/resources/extensions/install_warnings_dialog.js
diff --git a/chromium/chrome/browser/resources/md_extensions/item.html b/chromium/chrome/browser/resources/extensions/item.html
index 5cab3510d05..5fa187adea9 100644
--- a/chromium/chrome/browser/resources/md_extensions/item.html
+++ b/chromium/chrome/browser/resources/extensions/item.html
@@ -1,5 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
@@ -19,7 +20,6 @@
<link rel="import" href="strings.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-tooltip/paper-tooltip.html">
<link rel="import" href="navigation_helper.html">
@@ -184,7 +184,7 @@
color: var(--error-color);
}
- #dev-reload-button-container {
+ #dev-reload-button {
margin-inline-end: 12px;
}
@@ -321,12 +321,9 @@
</template>
</div>
<template is="dom-if" if="[[!computeDevReloadButtonHidden_(data.*)]]">
- <paper-icon-button-light id="dev-reload-button-container"
- class="icon-refresh no-overlap">
- <button id="dev-reload-button" aria-label="$i18n{itemReload}"
- aria-describedby="a11yAssociation" on-click="onReloadTap_">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="dev-reload-button" class="icon-refresh no-overlap"
+ aria-label="$i18n{itemReload}" aria-describedby="a11yAssociation"
+ on-click="onReloadTap_"></cr-icon-button>
</template>
<template is="dom-if" if="[[data.disableReasons.corruptInstall]]">
<paper-button id="repair-button" class="action-button"
diff --git a/chromium/chrome/browser/resources/md_extensions/item.js b/chromium/chrome/browser/resources/extensions/item.js
index 4b1a62ff39c..4b1a62ff39c 100644
--- a/chromium/chrome/browser/resources/md_extensions/item.js
+++ b/chromium/chrome/browser/resources/extensions/item.js
diff --git a/chromium/chrome/browser/resources/md_extensions/item_behavior.html b/chromium/chrome/browser/resources/extensions/item_behavior.html
index b0369e6dc6d..b0369e6dc6d 100644
--- a/chromium/chrome/browser/resources/md_extensions/item_behavior.html
+++ b/chromium/chrome/browser/resources/extensions/item_behavior.html
diff --git a/chromium/chrome/browser/resources/md_extensions/item_behavior.js b/chromium/chrome/browser/resources/extensions/item_behavior.js
index 40241f5eb2d..40241f5eb2d 100644
--- a/chromium/chrome/browser/resources/md_extensions/item_behavior.js
+++ b/chromium/chrome/browser/resources/extensions/item_behavior.js
diff --git a/chromium/chrome/browser/resources/md_extensions/item_list.html b/chromium/chrome/browser/resources/extensions/item_list.html
index 3e123447254..472399917db 100644
--- a/chromium/chrome/browser/resources/md_extensions/item_list.html
+++ b/chromium/chrome/browser/resources/extensions/item_list.html
@@ -19,7 +19,7 @@
#container {
box-sizing: border-box;
height: 100%;
- overflow: auto;
+ overflow: overlay;
}
#content-wrapper {
diff --git a/chromium/chrome/browser/resources/md_extensions/item_list.js b/chromium/chrome/browser/resources/extensions/item_list.js
index 04f8df0dfd5..04f8df0dfd5 100644
--- a/chromium/chrome/browser/resources/md_extensions/item_list.js
+++ b/chromium/chrome/browser/resources/extensions/item_list.js
diff --git a/chromium/chrome/browser/resources/md_extensions/item_util.html b/chromium/chrome/browser/resources/extensions/item_util.html
index 8836ce076d2..8836ce076d2 100644
--- a/chromium/chrome/browser/resources/md_extensions/item_util.html
+++ b/chromium/chrome/browser/resources/extensions/item_util.html
diff --git a/chromium/chrome/browser/resources/md_extensions/item_util.js b/chromium/chrome/browser/resources/extensions/item_util.js
index b619d2cdb8e..b619d2cdb8e 100644
--- a/chromium/chrome/browser/resources/md_extensions/item_util.js
+++ b/chromium/chrome/browser/resources/extensions/item_util.js
diff --git a/chromium/chrome/browser/resources/md_extensions/keyboard_shortcuts.html b/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.html
index acec55224e7..de1fd4bc740 100644
--- a/chromium/chrome/browser/resources/md_extensions/keyboard_shortcuts.html
+++ b/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.html
@@ -53,7 +53,7 @@
}
.command-entry .md-select {
- /* TODO(scottchen): line-height needs adjustment to fix large fonts. */
+ /* TODO(johntlee): line-height needs adjustment to fix large fonts. */
line-height: 22px;
margin-inline-start: var(--cr-section-padding);
}
diff --git a/chromium/chrome/browser/resources/md_extensions/keyboard_shortcuts.js b/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.js
index c740d566ea3..c740d566ea3 100644
--- a/chromium/chrome/browser/resources/md_extensions/keyboard_shortcuts.js
+++ b/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.js
diff --git a/chromium/chrome/browser/resources/md_extensions/kiosk_browser_proxy.html b/chromium/chrome/browser/resources/extensions/kiosk_browser_proxy.html
index 58f9bb8fe27..58f9bb8fe27 100644
--- a/chromium/chrome/browser/resources/md_extensions/kiosk_browser_proxy.html
+++ b/chromium/chrome/browser/resources/extensions/kiosk_browser_proxy.html
diff --git a/chromium/chrome/browser/resources/md_extensions/kiosk_browser_proxy.js b/chromium/chrome/browser/resources/extensions/kiosk_browser_proxy.js
index 91e7a70d4ca..1d0539898b8 100644
--- a/chromium/chrome/browser/resources/md_extensions/kiosk_browser_proxy.js
+++ b/chromium/chrome/browser/resources/extensions/kiosk_browser_proxy.js
@@ -36,7 +36,6 @@ let KioskApp;
let KioskAppSettings;
cr.define('extensions', function() {
-
/** @interface */
class KioskBrowserProxy {
/** @param {string} appId */
diff --git a/chromium/chrome/browser/resources/md_extensions/kiosk_dialog.html b/chromium/chrome/browser/resources/extensions/kiosk_dialog.html
index 302e64c7730..78eb1bae22e 100644
--- a/chromium/chrome/browser/resources/md_extensions/kiosk_dialog.html
+++ b/chromium/chrome/browser/resources/extensions/kiosk_dialog.html
@@ -2,8 +2,9 @@
<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
@@ -11,7 +12,6 @@
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="item_behavior.html">
<link rel="import" href="kiosk_browser_proxy.html">
@@ -64,6 +64,10 @@
.list-item:hover .item-controls {
visibility: visible;
}
+
+ cr-icon-button {
+ margin: 0;
+ }
</style>
<cr-dialog id="dialog" close-text="$i18n{close}"
ignore-enter-key>
@@ -90,9 +94,8 @@
'$i18nPolymer{kioskDisableAutoLaunch}',
'$i18nPolymer{kioskEnableAutoLaunch}')]]
</paper-button>
- <paper-icon-button-light class="icon-delete-gray">
- <button on-click="onDeleteAppTap_"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-delete-gray"
+ on-click="onDeleteAppTap_"></cr-icon-button>
</div>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/md_extensions/kiosk_dialog.js b/chromium/chrome/browser/resources/extensions/kiosk_dialog.js
index 49e5056c0c1..49e5056c0c1 100644
--- a/chromium/chrome/browser/resources/md_extensions/kiosk_dialog.js
+++ b/chromium/chrome/browser/resources/extensions/kiosk_dialog.js
diff --git a/chromium/chrome/browser/resources/md_extensions/load_error.html b/chromium/chrome/browser/resources/extensions/load_error.html
index 77a0f3d11bd..77a0f3d11bd 100644
--- a/chromium/chrome/browser/resources/md_extensions/load_error.html
+++ b/chromium/chrome/browser/resources/extensions/load_error.html
diff --git a/chromium/chrome/browser/resources/md_extensions/load_error.js b/chromium/chrome/browser/resources/extensions/load_error.js
index be8d9022554..be8d9022554 100644
--- a/chromium/chrome/browser/resources/md_extensions/load_error.js
+++ b/chromium/chrome/browser/resources/extensions/load_error.js
diff --git a/chromium/chrome/browser/resources/md_extensions/manager.html b/chromium/chrome/browser/resources/extensions/manager.html
index 0acd9673c75..0acd9673c75 100644
--- a/chromium/chrome/browser/resources/md_extensions/manager.html
+++ b/chromium/chrome/browser/resources/extensions/manager.html
diff --git a/chromium/chrome/browser/resources/md_extensions/manager.js b/chromium/chrome/browser/resources/extensions/manager.js
index eda57f21ee5..eda57f21ee5 100644
--- a/chromium/chrome/browser/resources/md_extensions/manager.js
+++ b/chromium/chrome/browser/resources/extensions/manager.js
diff --git a/chromium/chrome/browser/resources/md_extensions/navigation_helper.html b/chromium/chrome/browser/resources/extensions/navigation_helper.html
index 2521c5d5f3f..4ebc7d42b7a 100644
--- a/chromium/chrome/browser/resources/md_extensions/navigation_helper.html
+++ b/chromium/chrome/browser/resources/extensions/navigation_helper.html
@@ -1,3 +1,5 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="strings.html">
diff --git a/chromium/chrome/browser/resources/md_extensions/navigation_helper.js b/chromium/chrome/browser/resources/extensions/navigation_helper.js
index 1a39727f1dd..61915038319 100644
--- a/chromium/chrome/browser/resources/md_extensions/navigation_helper.js
+++ b/chromium/chrome/browser/resources/extensions/navigation_helper.js
@@ -22,9 +22,11 @@ const Dialog = {
OPTIONS: 'options',
};
-/** @typedef {{page: Page,
+/**
+ @typedef {{page: Page,
extensionId: (string|undefined),
- subpage: (!Dialog|undefined)}} */
+ subpage: (!Dialog|undefined)}}
+ */
let PageState;
cr.define('extensions', function() {
@@ -187,7 +189,7 @@ cr.define('extensions', function() {
let path;
switch (entry.page) {
case Page.LIST:
- path = '/';
+ path = '/';
break;
case Page.ACTIVITY_LOG:
path = '/?activity=' + entry.extensionId;
diff --git a/chromium/chrome/browser/resources/md_extensions/options_dialog.html b/chromium/chrome/browser/resources/extensions/options_dialog.html
index 3459e89b79b..59ced391619 100644
--- a/chromium/chrome/browser/resources/md_extensions/options_dialog.html
+++ b/chromium/chrome/browser/resources/extensions/options_dialog.html
@@ -27,27 +27,19 @@
}
cr-dialog {
- --scroll-border: 0;
--cr-dialog-body: {
height: 100%;
padding-bottom: 0;
padding-inline-end: 0;
padding-inline-start: 0;
padding-top: 0;
- };
-
- --cr-dialog-wrapper: {
- height: 100%;
- max-height: initial;
- overflow: hidden;
- };
-
+ }
+ --cr-dialog-body-border-bottom: none;
+ --cr-dialog-body-border-top: none;
--cr-dialog-body-container: {
- border: none;
height: 100%;
min-height: initial;
- };
-
+ }
--cr-dialog-native: {
opacity: 0;
/* When loading, it's possible for an size update to follow after the
@@ -55,7 +47,13 @@
A 100ms delay for the opacity transition will allow two updates to
occur without showing the dialog resizing to the user. */
transition: opacity 100ms ease 100ms;
- };
+ }
+ --cr-dialog-wrapper: {
+ height: 100%;
+ max-height: initial;
+ overflow: hidden;
+ }
+ --scroll-border: none;
}
</style>
diff --git a/chromium/chrome/browser/resources/md_extensions/options_dialog.js b/chromium/chrome/browser/resources/extensions/options_dialog.js
index a3fe7176551..a3fe7176551 100644
--- a/chromium/chrome/browser/resources/md_extensions/options_dialog.js
+++ b/chromium/chrome/browser/resources/extensions/options_dialog.js
diff --git a/chromium/chrome/browser/resources/md_extensions/pack_dialog.html b/chromium/chrome/browser/resources/extensions/pack_dialog.html
index d0e24585110..1a3c789ee58 100644
--- a/chromium/chrome/browser/resources/md_extensions/pack_dialog.html
+++ b/chromium/chrome/browser/resources/extensions/pack_dialog.html
@@ -23,8 +23,7 @@
margin-inline-start: 10px;
}
- /* Prevent focus-outline from being chopped by the bottom of dialog body.
- TODO(scottchen): find a more general way to solve this. */
+ /* Prevent focus-outline from being chopped by bottom of dialog body. */
cr-input {
margin-bottom: 2px;
}
diff --git a/chromium/chrome/browser/resources/md_extensions/pack_dialog.js b/chromium/chrome/browser/resources/extensions/pack_dialog.js
index 720d86942a4..720d86942a4 100644
--- a/chromium/chrome/browser/resources/md_extensions/pack_dialog.js
+++ b/chromium/chrome/browser/resources/extensions/pack_dialog.js
diff --git a/chromium/chrome/browser/resources/md_extensions/pack_dialog_alert.html b/chromium/chrome/browser/resources/extensions/pack_dialog_alert.html
index 79fa1a74167..79fa1a74167 100644
--- a/chromium/chrome/browser/resources/md_extensions/pack_dialog_alert.html
+++ b/chromium/chrome/browser/resources/extensions/pack_dialog_alert.html
diff --git a/chromium/chrome/browser/resources/md_extensions/pack_dialog_alert.js b/chromium/chrome/browser/resources/extensions/pack_dialog_alert.js
index 9b33668c7ca..9b33668c7ca 100644
--- a/chromium/chrome/browser/resources/md_extensions/pack_dialog_alert.js
+++ b/chromium/chrome/browser/resources/extensions/pack_dialog_alert.js
diff --git a/chromium/chrome/browser/resources/md_extensions/runtime_host_permissions.html b/chromium/chrome/browser/resources/extensions/runtime_host_permissions.html
index 9eaad243b17..32ebf180aa8 100644
--- a/chromium/chrome/browser/resources/md_extensions/runtime_host_permissions.html
+++ b/chromium/chrome/browser/resources/extensions/runtime_host_permissions.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_radio_group/cr_radio_group.html">
<link rel="import" href="chrome://resources/cr_elements/cr_radio_button/cr_radio_button.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
@@ -63,6 +64,10 @@
cr-radio-button.multi-row {
align-items: normal;
}
+
+ cr-icon-button {
+ margin: 0;
+ }
</style>
<div id="permissions-mode">
<div id="section-heading">
@@ -88,12 +93,9 @@
items="[[getRuntimeHosts_(permissions.hosts)]]">
<li>
<div>[[item]]</div>
- <paper-icon-button-light class="icon-more-vert">
- <button class="edit-host"
- on-click="onEditHostClick_"
- title="$i18n{hostPermissionsEdit}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert edit-host"
+ on-click="onEditHostClick_"
+ title="$i18n{hostPermissionsEdit}"></cr-icon-button>
</li>
</template>
<li>
diff --git a/chromium/chrome/browser/resources/md_extensions/runtime_host_permissions.js b/chromium/chrome/browser/resources/extensions/runtime_host_permissions.js
index 6fbc21ac3e7..6fbc21ac3e7 100644
--- a/chromium/chrome/browser/resources/md_extensions/runtime_host_permissions.js
+++ b/chromium/chrome/browser/resources/extensions/runtime_host_permissions.js
diff --git a/chromium/chrome/browser/resources/md_extensions/runtime_hosts_dialog.html b/chromium/chrome/browser/resources/extensions/runtime_hosts_dialog.html
index b639ed5754b..b639ed5754b 100644
--- a/chromium/chrome/browser/resources/md_extensions/runtime_hosts_dialog.html
+++ b/chromium/chrome/browser/resources/extensions/runtime_hosts_dialog.html
diff --git a/chromium/chrome/browser/resources/md_extensions/runtime_hosts_dialog.js b/chromium/chrome/browser/resources/extensions/runtime_hosts_dialog.js
index 61ffd43ba63..61ffd43ba63 100644
--- a/chromium/chrome/browser/resources/md_extensions/runtime_hosts_dialog.js
+++ b/chromium/chrome/browser/resources/extensions/runtime_hosts_dialog.js
diff --git a/chromium/chrome/browser/resources/md_extensions/service.html b/chromium/chrome/browser/resources/extensions/service.html
index 91b8058c5a1..91b8058c5a1 100644
--- a/chromium/chrome/browser/resources/md_extensions/service.html
+++ b/chromium/chrome/browser/resources/extensions/service.html
diff --git a/chromium/chrome/browser/resources/md_extensions/service.js b/chromium/chrome/browser/resources/extensions/service.js
index 5f2835126ed..5f2835126ed 100644
--- a/chromium/chrome/browser/resources/md_extensions/service.js
+++ b/chromium/chrome/browser/resources/extensions/service.js
diff --git a/chromium/chrome/browser/resources/md_extensions/shared_style.html b/chromium/chrome/browser/resources/extensions/shared_style.html
index 02697f0ecad..0410a18c21b 100644
--- a/chromium/chrome/browser/resources/md_extensions/shared_style.html
+++ b/chromium/chrome/browser/resources/extensions/shared_style.html
@@ -18,10 +18,9 @@
}
.activity-subpage-header {
- border-bottom: var(--cr-separator-line);
display: flex;
justify-content: flex-end;
- padding: 8px 12px;
+ padding: 12px 12px;
}
.activity-table-headings {
@@ -78,14 +77,10 @@
margin-inline-end: var(--cr-section-padding);
/* Makes the tappable area fill its parent.
- * TODO(scottchen): This is an explicit reminder to override once
- * .separator styling is extracted from settings. */
+ * TODO(crbug.com/949697): This is an explicit reminder to override
+ * once .separator styling is extracted from settings. */
margin-inline-start: 0;
}
-
- .separator + paper-icon-button-light {
- margin-inline-start: var(--cr-icon-ripple-margin);
- }
</style>
</template>
</dom-module>
diff --git a/chromium/chrome/browser/resources/md_extensions/shared_vars.html b/chromium/chrome/browser/resources/extensions/shared_vars.html
index ad311071143..ad311071143 100644
--- a/chromium/chrome/browser/resources/md_extensions/shared_vars.html
+++ b/chromium/chrome/browser/resources/extensions/shared_vars.html
diff --git a/chromium/chrome/browser/resources/md_extensions/shortcut_input.html b/chromium/chrome/browser/resources/extensions/shortcut_input.html
index 5d9ce550079..e7c6b445618 100644
--- a/chromium/chrome/browser/resources/md_extensions/shortcut_input.html
+++ b/chromium/chrome/browser/resources/extensions/shortcut_input.html
@@ -1,12 +1,12 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="shortcut_util.html">
@@ -18,13 +18,13 @@
width: 200px;
}
- #clearContainer {
- --cr-icon-ripple-size: 28px;
+ #clear {
+ --cr-icon-button-size: 28px;
position: absolute;
right: 2px;
}
- :host-context([dir='rtl']) #clearContainer {
+ :host-context([dir='rtl']) #clear {
left: -2px;
right: inherit;
}
@@ -36,11 +36,9 @@
'$i18nPolymer{shortcutTooManyModifiers}',
'$i18nPolymer{shortcutNeedCharacter}')]]"
value="[[computeText_(capturing_, shortcut, pendingShortcut_)]]">
- <paper-icon-button-light id="clearContainer" slot="suffix"
- class="icon-cancel no-overlap"
- hidden$="[[computeClearHidden_(capturing_, shortcut)]]">
- <button id="clear" on-click="onClearTap_"></button>
- </paper-icon-button-light>
+ <cr-icon-button id="clear" slot="suffix" class="icon-cancel no-overlap"
+ hidden$="[[computeClearHidden_(capturing_, shortcut)]]"
+ on-click="onClearTap_"></cr-icon-button>
</cr-input>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/md_extensions/shortcut_input.js b/chromium/chrome/browser/resources/extensions/shortcut_input.js
index 43f7d273ed1..43f7d273ed1 100644
--- a/chromium/chrome/browser/resources/md_extensions/shortcut_input.js
+++ b/chromium/chrome/browser/resources/extensions/shortcut_input.js
diff --git a/chromium/chrome/browser/resources/md_extensions/shortcut_util.html b/chromium/chrome/browser/resources/extensions/shortcut_util.html
index e44359faac7..e44359faac7 100644
--- a/chromium/chrome/browser/resources/md_extensions/shortcut_util.html
+++ b/chromium/chrome/browser/resources/extensions/shortcut_util.html
diff --git a/chromium/chrome/browser/resources/md_extensions/shortcut_util.js b/chromium/chrome/browser/resources/extensions/shortcut_util.js
index 05bb904c9bd..05bb904c9bd 100644
--- a/chromium/chrome/browser/resources/md_extensions/shortcut_util.js
+++ b/chromium/chrome/browser/resources/extensions/shortcut_util.js
diff --git a/chromium/chrome/browser/resources/md_extensions/sidebar.html b/chromium/chrome/browser/resources/extensions/sidebar.html
index 8aaf1ef5fe8..8aaf1ef5fe8 100644
--- a/chromium/chrome/browser/resources/md_extensions/sidebar.html
+++ b/chromium/chrome/browser/resources/extensions/sidebar.html
diff --git a/chromium/chrome/browser/resources/md_extensions/sidebar.js b/chromium/chrome/browser/resources/extensions/sidebar.js
index 8f5bd9b06eb..8f5bd9b06eb 100644
--- a/chromium/chrome/browser/resources/md_extensions/sidebar.js
+++ b/chromium/chrome/browser/resources/extensions/sidebar.js
diff --git a/chromium/chrome/browser/resources/md_extensions/strings.html b/chromium/chrome/browser/resources/extensions/strings.html
index cdc7c9b2a5b..cdc7c9b2a5b 100644
--- a/chromium/chrome/browser/resources/md_extensions/strings.html
+++ b/chromium/chrome/browser/resources/extensions/strings.html
diff --git a/chromium/chrome/browser/resources/md_extensions/toggle_row.html b/chromium/chrome/browser/resources/extensions/toggle_row.html
index f8cdcb4aee9..f8cdcb4aee9 100644
--- a/chromium/chrome/browser/resources/md_extensions/toggle_row.html
+++ b/chromium/chrome/browser/resources/extensions/toggle_row.html
diff --git a/chromium/chrome/browser/resources/md_extensions/toggle_row.js b/chromium/chrome/browser/resources/extensions/toggle_row.js
index c4f67baec15..c4f67baec15 100644
--- a/chromium/chrome/browser/resources/md_extensions/toggle_row.js
+++ b/chromium/chrome/browser/resources/extensions/toggle_row.js
diff --git a/chromium/chrome/browser/resources/md_extensions/toolbar.html b/chromium/chrome/browser/resources/extensions/toolbar.html
index 6f3b663fdf1..6f3b663fdf1 100644
--- a/chromium/chrome/browser/resources/md_extensions/toolbar.html
+++ b/chromium/chrome/browser/resources/extensions/toolbar.html
diff --git a/chromium/chrome/browser/resources/md_extensions/toolbar.js b/chromium/chrome/browser/resources/extensions/toolbar.js
index c231c5a95b5..c231c5a95b5 100644
--- a/chromium/chrome/browser/resources/md_extensions/toolbar.js
+++ b/chromium/chrome/browser/resources/extensions/toolbar.js
diff --git a/chromium/chrome/browser/resources/feed_internals/feed_internals.css b/chromium/chrome/browser/resources/feed_internals/feed_internals.css
index c69244c06a4..ed7ffa5b157 100644
--- a/chromium/chrome/browser/resources/feed_internals/feed_internals.css
+++ b/chromium/chrome/browser/resources/feed_internals/feed_internals.css
@@ -19,13 +19,15 @@ table > tbody > tr:nth-child(odd) {
}
table td {
+ vertical-align: top;
width: 50%;
word-wrap: break-word;
}
button {
display: block;
- min-height: 30px;
+ margin: 10px 0;
+ padding: 5px;
}
#current-content table td:first-child {
diff --git a/chromium/chrome/browser/resources/feed_internals/feed_internals.html b/chromium/chrome/browser/resources/feed_internals/feed_internals.html
index c96db8262ea..78054e838d8 100644
--- a/chromium/chrome/browser/resources/feed_internals/feed_internals.html
+++ b/chromium/chrome/browser/resources/feed_internals/feed_internals.html
@@ -17,6 +17,7 @@ found in the LICENSE file.
<script src="chrome://resources/js/mojo_bindings_lite.js"></script>
<script src="chrome://resources/js/util.js"></script>
+ <script src="url/mojom/url.mojom-lite.js"></script>
<script src="feed_internals.mojom-lite.js"></script>
<script src="feed_internals.js"></script>
@@ -30,6 +31,22 @@ found in the LICENSE file.
<td>Is Feed Enabled</td>
<td id="is-feed-enabled"></td>
</tr>
+ <tr>
+ <td>Is Feed Visible</td>
+ <td id="is-feed-visible"></td>
+ </tr>
+ <tr>
+ <td>Is Feed Allowed</td>
+ <td id="is-feed-allowed"></td>
+ </tr>
+ <tr>
+ <td>Is Prefetching Enabled</td>
+ <td id="is-prefetching-enabled"></td>
+ </tr>
+ <tr>
+ <td>Feed Fetch URL</td>
+ <td id="feed-fetch-url"></td>
+ </tr>
</table>
<h2>User Classifier</h2>
@@ -50,7 +67,11 @@ found in the LICENSE file.
<button id="clear-user-classification">
Clear User Classification
</button>
+
<h2>Feed Library Actions</h2>
+ <button id="refresh-feed">
+ Refresh Feed
+ </button>
<button id="clear-cached-data">
Clear Cache & Refresh Feed
</button>
@@ -62,6 +83,10 @@ found in the LICENSE file.
<td id="last-fetch-status"></td>
</tr>
<tr>
+ <td>Last Fetch Trigger</td>
+ <td id="last-fetch-trigger"></td>
+ </tr>
+ <tr>
<td>Last Fetch Time</td>
<td id="last-fetch-time"></td>
</tr>
@@ -98,5 +123,23 @@ found in the LICENSE file.
</template>
</div>
+ <h2>Feed Histograms</h2>
+ <button id="load-feed-histograms">
+ Load Feed Histograms
+ </button>
+ <details id="feed-histograms-details">
+ <summary>Show/Hide</summary>
+ <pre id="feed-histograms-log"></pre>
+ </details>
+
+ <h2>Feed Process Scope</h2>
+ <button id="dump-feed-process-scope">
+ Dump Feed Process Scope
+ </button>
+ <details id="feed-process-scope-details">
+ <summary>Show/Hide</summary>
+ <pre id="feed-process-scope-dump"></pre>
+ </details>
+
</body>
</html>
diff --git a/chromium/chrome/browser/resources/feed_internals/feed_internals.js b/chromium/chrome/browser/resources/feed_internals/feed_internals.js
index 4d3df2523b0..02f22a26ac4 100644
--- a/chromium/chrome/browser/resources/feed_internals/feed_internals.js
+++ b/chromium/chrome/browser/resources/feed_internals/feed_internals.js
@@ -20,6 +20,10 @@ function updatePageWithProperties() {
/** @type {!feedInternals.mojom.Properties} */
const properties = response.properties;
$('is-feed-enabled').textContent = properties.isFeedEnabled;
+ $('is-feed-visible').textContent = properties.isFeedVisible;
+ $('is-feed-allowed').textContent = properties.isFeedAllowed;
+ $('is-prefetching-enabled').textContent = properties.isPrefetchingEnabled;
+ $('feed-fetch-url').textContent = properties.feedFetchUrl.url;
});
}
@@ -44,6 +48,7 @@ function updatePageWithLastFetchProperties() {
/** @type {!feedInternals.mojom.LastFetchProperties} */
const properties = response.properties;
$('last-fetch-status').textContent = properties.lastFetchStatus;
+ $('last-fetch-trigger').textContent = properties.lastFetchTrigger;
$('last-fetch-time').textContent = toDateString(properties.lastFetchTime);
$('refresh-suppress-time').textContent =
toDateString(properties.refreshSuppressTime);
@@ -70,9 +75,9 @@ function updatePageWithCurrentContent() {
item.querySelector('.publisher').textContent = suggestion.publisherName;
// Populate template with link metadata.
- setLinkNode(item.querySelector('a.url'), suggestion.url);
- setLinkNode(item.querySelector('a.image'), suggestion.imageUrl);
- setLinkNode(item.querySelector('a.favicon'), suggestion.faviconUrl);
+ setLinkNode(item.querySelector('a.url'), suggestion.url.url);
+ setLinkNode(item.querySelector('a.image'), suggestion.imageUrl.url);
+ setLinkNode(item.querySelector('a.favicon'), suggestion.faviconUrl.url);
after.appendChild(item);
}
@@ -103,6 +108,16 @@ function toDateString(time) {
}
/**
+ * Update last fetch properties and current content following a Feed refresh.
+ */
+function updateAfterRefresh() {
+ // TODO(crbug.com/939907): Listen for Feed update events rather than waiting
+ // an arbitrary period of time.
+ setTimeout(updatePageWithLastFetchProperties, 1000);
+ setTimeout(updatePageWithCurrentContent, 1000);
+}
+
+/**
* Hook up buttons to event listeners.
*/
function setupEventListeners() {
@@ -113,14 +128,26 @@ function setupEventListeners() {
$('clear-cached-data').addEventListener('click', function() {
pageHandler.clearCachedDataAndRefreshFeed();
+ updateAfterRefresh();
+ });
+
+ $('refresh-feed').addEventListener('click', function() {
+ pageHandler.refreshFeed();
+ updateAfterRefresh();
+ });
+
+ $('dump-feed-process-scope').addEventListener('click', function() {
+ pageHandler.getFeedProcessScopeDump().then(response => {
+ $('feed-process-scope-dump').textContent = response.dump;
+ $('feed-process-scope-details').open = true;
+ });
+ });
- // TODO(chouinard): Investigate whether the Feed library's
- // AppLifecycleListener.onClearAll methods could accept a callback to notify
- // when cache clear and Feed refresh operations are complete. If not,
- // consider adding backend->frontend mojo communication to listen for
- // updates, rather than waiting an arbitrary period of time.
- setTimeout(updatePageWithLastFetchProperties, 1000);
- setTimeout(updatePageWithCurrentContent, 1000);
+ $('load-feed-histograms').addEventListener('click', function() {
+ pageHandler.getFeedHistograms().then(response => {
+ $('feed-histograms-log').textContent = response.log;
+ $('feed-histograms-details').open = true;
+ });
});
}
diff --git a/chromium/chrome/browser/resources/feedback/OWNERS b/chromium/chrome/browser/resources/feedback/OWNERS
index 806a1cef4fb..c32d77036ab 100644
--- a/chromium/chrome/browser/resources/feedback/OWNERS
+++ b/chromium/chrome/browser/resources/feedback/OWNERS
@@ -1,4 +1,5 @@
afakhry@chromium.org
rkc@chromium.org
+jkardatzke@chromium.org
# COMPONENT: Platform>Apps>Feedback
diff --git a/chromium/chrome/browser/resources/feedback/css/feedback.css b/chromium/chrome/browser/resources/feedback/css/feedback.css
index ffefbd3d0c3..86371f053b2 100644
--- a/chromium/chrome/browser/resources/feedback/css/feedback.css
+++ b/chromium/chrome/browser/resources/feedback/css/feedback.css
@@ -225,18 +225,3 @@ button.blue-button {
color: #fff;
text-shadow: 1px sharp drop shadow rgb(45, 106, 218);
}
-
-.srt-image {
- display: block;
- height: 50px;
- margin-bottom: 20px;
- margin-inline-end: auto;
- margin-inline-start: 40px;
- margin-top: 120px;
-}
-
-.srt-body {
- font-size: 14px;
- line-height: 24px;
- margin: 0 40px;
-}
diff --git a/chromium/chrome/browser/resources/feedback/html/default.html b/chromium/chrome/browser/resources/feedback/html/default.html
index 71ed3029418..e04a2cdaaa6 100644
--- a/chromium/chrome/browser/resources/feedback/html/default.html
+++ b/chromium/chrome/browser/resources/feedback/html/default.html
@@ -27,18 +27,6 @@
</button>
</span>
</div>
- <div id="srt-prompt" class="content">
- <img src="../../../../../components/resources/sadtab.svg" class="srt-image">
- <p i18n-content="srtPromptBody" class="srt-body"></p>
- <div class="buttons-pane top-buttons">
- <button id="srt-decline-button" class="white-button"
- i18n-content="srtPromptDeclineButton">
- </button>
- <button id="srt-accept-button" class="blue-button"
- i18n-content="srtPromptAcceptButton">
- </button>
- </div>
- </div>
<div id="content-pane" class="content">
<textarea id="description-text" aria-labelledby="page-title"></textarea>
<div>
diff --git a/chromium/chrome/browser/resources/feedback/js/event_handler.js b/chromium/chrome/browser/resources/feedback/js/event_handler.js
index e0fff4ce25b..653cc0ae7d2 100644
--- a/chromium/chrome/browser/resources/feedback/js/event_handler.js
+++ b/chromium/chrome/browser/resources/feedback/js/event_handler.js
@@ -166,7 +166,6 @@ class FeedbackRequest {
this.onSystemInfoReadyCallback_ = this.sendReportNow;
return;
}
-
this.sendReportNow();
}
@@ -198,6 +197,9 @@ class FeedbackRequest {
'Feedback: Report for request with ID ' + ID +
' will be sent later.');
}
+ if (FLOW == chrome.feedbackPrivate.FeedbackFlow.LOGIN) {
+ chrome.feedbackPrivate.loginFeedbackComplete();
+ }
});
}
@@ -208,6 +210,10 @@ class FeedbackRequest {
onWindowClosed() {
if (!this.reportIsBeingSent_) {
this.isRequestCanceled_ = true;
+ if (this.feedbackInfo_.flow ==
+ chrome.feedbackPrivate.FeedbackFlow.LOGIN) {
+ chrome.feedbackPrivate.loginFeedbackComplete();
+ }
}
}
}
diff --git a/chromium/chrome/browser/resources/feedback/js/feedback.js b/chromium/chrome/browser/resources/feedback/js/feedback.js
index d23462a0c50..6ed999edc27 100644
--- a/chromium/chrome/browser/resources/feedback/js/feedback.js
+++ b/chromium/chrome/browser/resources/feedback/js/feedback.js
@@ -2,12 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-/**
- * @type {string}
- * @const
- */
-const SRT_DOWNLOAD_PAGE = 'https://www.google.com/chrome/cleanup-tool/';
-
/** @type {number}
* @const
*/
@@ -46,16 +40,6 @@ const MAX_SCREENSHOT_WIDTH = 100;
*/
const SYSINFO_WINDOW_ID = 'sysinfo_window';
-/**
- * SRT Prompt Result defined in feedback_private.idl.
- * @enum {string}
- */
-const SrtPromptResult = {
- ACCEPTED: 'accepted', // User accepted prompt.
- DECLINED: 'declined', // User declined prompt.
- CLOSED: 'closed', // User closed window without responding to prompt.
-};
-
let attachedFileBlob = null;
const lastReader = null;
@@ -67,18 +51,13 @@ const lastReader = null;
let isSystemInfoReady = false;
/**
- * Indicates whether the SRT Prompt is currently being displayed.
- * @type {boolean}
- */
-let isShowingSrtPrompt = false;
-
-/**
- * Regular expression to check for all variants of bluetooth, blutooth, with or
- * without space between the words and for BT when used as an individual word,
- * or as two individual characters. Case insensitive matching.
+ * Regular expression to check for all variants of blu[e]toot[h] with or without
+ * space between the words; for BT when used as an individual word, or as two
+ * individual characters, and for BLE when used as an individual word. Case
+ * insensitive matching.
* @type {RegExp}
*/
-const btRegEx = new RegExp('[b]lu[e]?[ ]?tooth|\b[b][ ]?[t]\b', 'i');
+const btRegEx = new RegExp('blu[e]?[ ]?toot[h]?|\\bb[ ]?t\\b|\\bble\\b', 'i');
/**
* Regular expression to check for all strings indicating that a user can't
@@ -283,6 +262,9 @@ function sendReport() {
function cancel(e) {
e.preventDefault();
scheduleWindowClose();
+ if (feedbackInfo.flow == chrome.feedbackPrivate.FeedbackFlow.LOGIN) {
+ chrome.feedbackPrivate.loginFeedbackComplete();
+ }
}
// <if expr="chromeos">
@@ -366,38 +348,12 @@ function initialize() {
feedbackInfo.flow = chrome.feedbackPrivate.FeedbackFlow.REGULAR;
}
- if (feedbackInfo.flow ==
- chrome.feedbackPrivate.FeedbackFlow.SHOW_SRT_PROMPT) {
- isShowingSrtPrompt = true;
- $('content-pane').hidden = true;
-
- $('srt-decline-button').onclick = function() {
- isShowingSrtPrompt = false;
- chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.DECLINED);
- $('srt-prompt').hidden = true;
- $('content-pane').hidden = false;
- };
-
- $('srt-accept-button').onclick = function() {
- chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.ACCEPTED);
- window.open(SRT_DOWNLOAD_PAGE, '_blank');
- scheduleWindowClose();
- };
-
- $('close-button').addEventListener('click', function() {
- if (isShowingSrtPrompt) {
- chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.CLOSED);
- }
- });
- } else if (feedbackInfo.includeBluetoothLogs) {
+ if (feedbackInfo.includeBluetoothLogs) {
assert(
feedbackInfo.flow ==
chrome.feedbackPrivate.FeedbackFlow.GOOGLE_INTERNAL);
$('description-text')
.addEventListener('input', checkForBluetoothKeywords);
- $('srt-prompt').hidden = true;
- } else {
- $('srt-prompt').hidden = true;
}
if ($('assistant-checkbox-container') != null &&
@@ -418,7 +374,7 @@ function initialize() {
takeScreenshot(function(screenshotCanvas) {
// We've taken our screenshot, show the feedback page without any
// further delay.
- window.webkitRequestAnimationFrame(function() {
+ window.requestAnimationFrame(function() {
resizeAppWindow();
});
chrome.app.window.current().show();
diff --git a/chromium/chrome/browser/resources/gaia_auth_host/OWNERS b/chromium/chrome/browser/resources/gaia_auth_host/OWNERS
index 56d4e6e0940..ddff231dffe 100644
--- a/chromium/chrome/browser/resources/gaia_auth_host/OWNERS
+++ b/chromium/chrome/browser/resources/gaia_auth_host/OWNERS
@@ -1,2 +1,6 @@
+# (in PST)
achuith@chromium.org
xiyuan@chromium.org
+
+# (in CET)
+rsorokin@chromium.org
diff --git a/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js b/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
index 1075652b6cf..b7b108093b5 100644
--- a/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
+++ b/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
@@ -91,7 +91,9 @@ cr.define('cr.login', function() {
'lsbReleaseBoard', // Chrome OS Release board name
'isFirstUser', // True if this is non-enterprise device,
// and there are no users yet.
- 'obfuscatedOwnerId', // Obfuscated device owner ID, if neeed.
+ 'obfuscatedOwnerId', // Obfuscated device owner ID, if needed.
+ 'extractSamlPasswordAttributes', // If enabled attempts to extract password
+ // attributes from the SAML response.
// The email fields allow for the following possibilities:
//
@@ -217,7 +219,8 @@ cr.define('cr.login', function() {
this.webview_ = typeof webview == 'string' ? $(webview) : webview;
- this.samlHandler_ = new cr.login.SamlHandler(this.webview_);
+ this.samlHandler_ =
+ new cr.login.SamlHandler(this.webview_, false /* startsOnSamlPage */);
this.webviewEventManager_.addEventListener(
this.samlHandler_, 'insecureContentBlocked',
this.onInsecureContentBlocked_.bind(this));
@@ -303,6 +306,8 @@ cr.define('cr.login', function() {
// http. Otherwise, block insecure content as long as gaia is https.
this.samlHandler_.blockInsecureContent = authMode != AuthMode.DESKTOP &&
this.idpOrigin_.startsWith('https://');
+ this.samlHandler_.extractSamlPasswordAttributes =
+ data.extractSamlPasswordAttributes;
this.needPassword = !('needPassword' in data) || data.needPassword;
if (this.isNewGaiaFlow) {
@@ -633,6 +638,8 @@ cr.define('cr.login', function() {
if (this.email_ && this.gaiaId_ && this.sessionIndex_) {
this.maybeCompleteAuth_();
}
+ } else if (msg.method == 'showIncognito') {
+ this.dispatchEvent(new Event('showIncognito'));
} else {
console.warn('Unrecognized message from GAIA: ' + msg.method);
}
diff --git a/chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js b/chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js
new file mode 100644
index 00000000000..0f5fa464c5f
--- /dev/null
+++ b/chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js
@@ -0,0 +1,167 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// <include src="saml_handler.js">
+// Note: webview_event_manager.js is already included by saml_handler.js.
+
+/**
+ * @fileoverview Support password change on with SAML provider.
+ */
+
+cr.define('cr.samlPasswordChange', function() {
+ 'use strict';
+
+ const BLANK_PAGE_URL = 'about:blank';
+
+ /**
+ * Initializes the authenticator component.
+ */
+ class Authenticator extends cr.EventTarget {
+ /**
+ * @param {webview|string} webview The webview element or its ID to host
+ * IdP web pages.
+ */
+ constructor(webview) {
+ super();
+
+ this.initialFrameUrl_ = null;
+ this.webviewEventManager_ = WebviewEventManager.create();
+
+ this.bindToWebview_(webview);
+
+ window.addEventListener('focus', this.onFocus_.bind(this), false);
+ }
+
+ /**
+ * Reinitializes saml handler.
+ */
+ resetStates() {
+ this.samlHandler_.reset();
+ }
+
+ /**
+ * Resets the webview to the blank page.
+ */
+ resetWebview() {
+ if (this.webview_.src && this.webview_.src != BLANK_PAGE_URL) {
+ this.webview_.src = BLANK_PAGE_URL;
+ }
+ }
+
+ /**
+ * Binds this authenticator to the passed webview.
+ * @param {!Object} webview the new webview to be used by this
+ * Authenticator.
+ * @private
+ */
+ bindToWebview_(webview) {
+ assert(!this.webview_);
+ assert(!this.samlHandler_);
+
+ this.webview_ = typeof webview == 'string' ? $(webview) : webview;
+
+ this.samlHandler_ =
+ new cr.login.SamlHandler(this.webview_, true /* startsOnSamlPage */);
+ this.webviewEventManager_.addEventListener(
+ this.samlHandler_, 'authPageLoaded',
+ this.onAuthPageLoaded_.bind(this));
+
+ this.webviewEventManager_.addEventListener(
+ this.webview_, 'contentload', this.onContentLoad_.bind(this));
+ }
+
+ /**
+ * Unbinds this Authenticator from the currently bound webview.
+ * @private
+ */
+ unbindFromWebview_() {
+ assert(this.webview_);
+ assert(this.samlHandler_);
+
+ this.webviewEventManager_.removeAllListeners();
+
+ this.webview_ = undefined;
+ this.samlHandler_.unbindFromWebview();
+ this.samlHandler_ = undefined;
+ }
+
+ /**
+ * Re-binds to another webview.
+ * @param {Object} webview the new webview to be used by this Authenticator.
+ */
+ rebindWebview(webview) {
+ this.unbindFromWebview_();
+ this.bindToWebview_(webview);
+ }
+
+ /**
+ * Loads the authenticator component with the given parameters.
+ * @param {AuthMode} authMode Authorization mode.
+ * @param {Object} data Parameters for the authorization flow.
+ */
+ load(data) {
+ this.resetStates();
+ this.initialFrameUrl_ = this.constructInitialFrameUrl_(data);
+ this.samlHandler_.blockInsecureContent = true;
+ this.webview_.src = this.initialFrameUrl_;
+ }
+
+ constructInitialFrameUrl_(data) {
+ let url;
+ url = data.passwordChangeUrl;
+ if (data.userName) {
+ url = appendParam(url, 'username', data.userName);
+ }
+ return url;
+ }
+
+ /**
+ * Invoked when the sign-in page takes focus.
+ * @param {object} e The focus event being triggered.
+ * @private
+ */
+ onFocus_(e) {
+ this.webview_.focus();
+ }
+
+ /**
+ * Sends scraped password and resets the state.
+ * @private
+ */
+ completeAuth_() {
+ const passwordsOnce = this.samlHandler_.getPasswordsScrapedTimes(1);
+ const passwordsTwice = this.samlHandler_.getPasswordsScrapedTimes(2);
+
+ this.dispatchEvent(new CustomEvent('authCompleted', {
+ detail: {
+ old_passwords: passwordsOnce,
+ new_passwords: passwordsTwice,
+ }
+ }));
+ this.resetStates();
+ }
+
+ /**
+ * Invoked when |samlHandler_| fires 'authPageLoaded' event.
+ * @private
+ */
+ onAuthPageLoaded_(e) {
+ this.webview_.focus();
+ }
+
+ /**
+ * Invoked when a new document is loaded.
+ * @private
+ */
+ onContentLoad_(e) {
+ const currentUrl = this.webview_.src;
+ // TODO(rsorokin): Implement more robust check.
+ if (currentUrl.lastIndexOf('status=0') != -1) {
+ this.completeAuth_();
+ }
+ }
+ }
+
+ return {Authenticator: Authenticator};
+});
diff --git a/chromium/chrome/browser/resources/gaia_auth_host/post_message_channel.js b/chromium/chrome/browser/resources/gaia_auth_host/post_message_channel.js
index 555b5a0c4f9..8fd7118b449 100644
--- a/chromium/chrome/browser/resources/gaia_auth_host/post_message_channel.js
+++ b/chromium/chrome/browser/resources/gaia_auth_host/post_message_channel.js
@@ -16,7 +16,8 @@ const PostMessageChannel = (function() {
* Allowed origins of the hosting page.
* @type {Array<string>}
*/
- const ALLOWED_ORIGINS = ['chrome://oobe', 'chrome://chrome-signin'];
+ const ALLOWED_ORIGINS =
+ ['chrome://oobe', 'chrome://chrome-signin', 'chrome://password-change'];
/** @const */
const PORT_MESSAGE = 'post-message-port-message';
diff --git a/chromium/chrome/browser/resources/gaia_auth_host/saml_handler.js b/chromium/chrome/browser/resources/gaia_auth_host/saml_handler.js
index f7c8096b2cc..766946994ed 100644
--- a/chromium/chrome/browser/resources/gaia_auth_host/saml_handler.js
+++ b/chromium/chrome/browser/resources/gaia_auth_host/saml_handler.js
@@ -4,6 +4,7 @@
// <include src="post_message_channel.js">
// <include src="webview_event_manager.js">
+// <include src="../chromeos/login/saml_password_attributes.js">
/**
* @fileoverview Saml support for webview based auth.
@@ -71,8 +72,12 @@ cr.define('cr.login', function() {
* auth IdP pages.
*/
class SamlHandler extends cr.EventTarget {
- /** @param {webview} webview */
- constructor(webview) {
+ /**
+ * @param {webview} webview
+ * @param {boolean} startsOnSamlPage - whether initial URL is already SAML
+ * page
+ * */
+ constructor(webview, startsOnSamlPage) {
super();
/**
@@ -82,17 +87,22 @@ cr.define('cr.login', function() {
this.webview_ = webview;
/**
+ * Whether a Saml page is in the webview from the start.
+ */
+ this.startsOnSamlPage_ = startsOnSamlPage;
+
+ /**
* Whether a Saml IdP page is display in the webview.
* @type {boolean}
*/
- this.isSamlPage_ = false;
+ this.isSamlPage_ = this.startsOnSamlPage_;
/**
* Pending Saml IdP page flag that is set when a SAML_HEADER is received
* and is copied to |isSamlPage_| in loadcommit.
* @type {boolean}
*/
- this.pendingIsSamlPage_ = false;
+ this.pendingIsSamlPage_ = this.startsOnSamlPage_;
/**
* The last aborted top level url. It is recorded in loadabort event and
@@ -139,13 +149,20 @@ cr.define('cr.login', function() {
*/
this.apiPasswordBytes_ = null;
- /*
+ /**
* Whether to abort the authentication flow and show an error messagen
* when content served over an unencrypted connection is detected.
* @type {boolean}
*/
this.blockInsecureContent = false;
+ /**
+ * Whether to attempt to extract password attributes from the SAMLResponse
+ * XML. See ../chromeos/login/saml_password_attributes.js
+ * @type {boolean}
+ */
+ this.extractSamlPasswordAttributes = false;
+
this.webviewEventManager_ = WebviewEventManager.create();
this.webviewEventManager_.addEventListener(
@@ -153,8 +170,6 @@ cr.define('cr.login', function() {
this.webviewEventManager_.addEventListener(
this.webview_, 'loadabort', this.onLoadAbort_.bind(this));
this.webviewEventManager_.addEventListener(
- this.webview_, 'loadcommit', this.onLoadCommit_.bind(this));
- this.webviewEventManager_.addEventListener(
this.webview_, 'permissionrequest',
this.onPermissionRequest_.bind(this));
@@ -162,11 +177,23 @@ cr.define('cr.login', function() {
this.webview_.request.onBeforeRequest,
this.onInsecureRequest.bind(this),
{urls: ['http://*/*', 'file://*/*', 'ftp://*/*']}, ['blocking']);
+
this.webviewEventManager_.addWebRequestEventListener(
- this.webview_.request.onHeadersReceived,
- this.onHeadersReceived_.bind(this),
- {urls: ['<all_urls>'], types: ['main_frame', 'xmlhttprequest']},
- ['blocking', 'responseHeaders']);
+ this.webview_.request.onBeforeRequest,
+ this.onMainFrameWebRequest.bind(this),
+ {urls: ['http://*/*', 'https://*/*'], types: ['main_frame']},
+ ['requestBody']);
+
+ if (!this.startsOnSamlPage_) {
+ this.webviewEventManager_.addEventListener(
+ this.webview_, 'loadcommit', this.onLoadCommit_.bind(this));
+
+ this.webviewEventManager_.addWebRequestEventListener(
+ this.webview_.request.onHeadersReceived,
+ this.onHeadersReceived_.bind(this),
+ {urls: ['<all_urls>'], types: ['main_frame', 'xmlhttprequest']},
+ ['blocking', 'responseHeaders']);
+ }
this.webview_.addContentScripts([{
name: injectedScriptName,
@@ -213,6 +240,19 @@ cr.define('cr.login', function() {
}
/**
+ * Gets the list of passwords which were scpared exactly |times| times.
+ * @return {Array<string>}
+ */
+ getPasswordsScrapedTimes(times) {
+ const passwords = {};
+ for (const property in this.passwordStore_) {
+ const key = this.passwordStore_[property];
+ passwords[key] = (passwords[key] + 1) || 1;
+ }
+ return Object.keys(passwords).filter(key => passwords[key] == times);
+ }
+
+ /**
* Gets the de-duped scraped passwords.
* @return {Array<string>}
* @private
@@ -239,8 +279,8 @@ cr.define('cr.login', function() {
* Resets all auth states
*/
reset() {
- this.isSamlPage_ = false;
- this.pendingIsSamlPage_ = false;
+ this.isSamlPage_ = this.startsOnSamlPage_;
+ this.pendingIsSamlPage_ = this.startsOnSamlPage_;
this.passwordStore_ = {};
this.apiInitialized_ = false;
@@ -319,6 +359,37 @@ cr.define('cr.login', function() {
}
/**
+ * Handler for webRequest.onBeforeRequest that looks for the Base64
+ * encoded SAMLResponse in the POST-ed formdata sent from the SAML page.
+ * Non-blocking.
+ * @param {Object} details The web-request details.
+ */
+ onMainFrameWebRequest(details) {
+ if (!this.extractSamlPasswordAttributes) return;
+ if (!this.isSamlPage_ || details.method != 'POST') return;
+
+ const formData = details.requestBody.formData;
+ let samlResponse = (formData && formData.SAMLResponse);
+ if (!samlResponse) {
+ samlResponse = new URL(details.url).searchParams.get('SAMLResponse');
+ }
+ if (!samlResponse) return;
+
+ try {
+ // atob means asciiToBinary, which actually means base64Decode:
+ samlResponse = window.atob(samlResponse);
+ } catch (decodingError) {
+ console.warn('SAMLResponse is not Base64 encoded');
+ return;
+ }
+
+ const attr = samlPasswordAttributes.readPasswordAttributes(samlResponse);
+ chrome.send('updatePasswordAttributes', [
+ attr.modifiedTimestamp, attr.expirationTimestamp, attr.passwordChangeUrl
+ ]);
+ }
+
+ /**
* Invoked when headers are received for the main frame.
* @private
*/
diff --git a/chromium/chrome/browser/resources/hangout_services/manifest.json b/chromium/chrome/browser/resources/hangout_services/manifest.json
index 438074a18f3..166d0edd4ab 100644
--- a/chromium/chrome/browser/resources/hangout_services/manifest.json
+++ b/chromium/chrome/browser/resources/hangout_services/manifest.json
@@ -5,7 +5,7 @@
"name": "Google Hangouts",
// Note: Always update the version number when this file is updated. Chrome
// triggers extension preferences update on the version increase.
- "version": "1.3.13",
+ "version": "1.3.14",
"manifest_version": 2,
"externally_connectable": {
"matches": [
diff --git a/chromium/chrome/browser/resources/hangout_services/thunk.js b/chromium/chrome/browser/resources/hangout_services/thunk.js
index 56b254150b2..061dca0c55c 100644
--- a/chromium/chrome/browser/resources/hangout_services/thunk.js
+++ b/chromium/chrome/browser/resources/hangout_services/thunk.js
@@ -190,11 +190,6 @@ chrome.runtime.onMessageExternal.addListener(function(
requestInfo, origin, sessionId, maxLogSizeBytes, outputPeriodMs,
webAppId, doSendResponse);
return true;
- } else if (method == 'setAudioExperiments') {
- const experiments = message['experiments'];
- chrome.webrtcAudioPrivate.setAudioExperiments(
- requestInfo, origin, experiments, doSendResponse);
- return true;
} else if (method == 'getHardwarePlatformInfo') {
chrome.enterprise.hardwarePlatform.getHardwarePlatformInfo(
doSendResponse);
diff --git a/chromium/chrome/browser/resources/history/history_item.html b/chromium/chrome/browser/resources/history/history_item.html
index a57f41d2883..e658f1c0680 100644
--- a/chromium/chrome/browser/resources/history/history_item.html
+++ b/chromium/chrome/browser/resources/history/history_item.html
@@ -9,11 +9,12 @@
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_row_behavior.html">
+<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/icon.html">
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<!-- Lazy loaded: paper-icon-button-light. -->
+<!-- Lazy loaded: cr-icon-button. -->
<dom-module id="history-item">
<template>
@@ -102,25 +103,16 @@
margin-inline-start: 16px;
}
- #menu-button-container {
- margin-inline-end: 12px;
+ #menu-button {
+ --cr-icon-button-margin-end: 12px;
+ --cr-icon-button-margin-start: 12px;
}
- #star-container {
- margin-inline-end: 4px;
- margin-inline-start: 12px;
- width: 32px;
- }
-
- #bookmark-star-container {
- color: var(--interactive-color);
- height: 32px;
- width: 32px;
- }
-
- #bookmark-star-container iron-icon {
- height: 16px;
- width: 16px;
+ #bookmark-star {
+ --cr-icon-button-color: var(--interactive-color);
+ --cr-icon-button-icon-size: 16px;
+ --cr-icon-button-margin-start: 12px;
+ --cr-icon-button-size: 32px;
}
#time-gap-separator {
@@ -209,24 +201,16 @@
</div>
<div id="star-container">
<template is="dom-if" if="[[item.starred]]" notify-dom-change>
- <paper-icon-button-light id="bookmark-star-container">
- <button id="bookmark-star" focus-row-control focus-type="star"
- title="$i18n{removeBookmark}" on-click="onRemoveBookmarkTap_">
- <iron-icon icon="cr:star"></iron-icon>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="bookmark-star" iron-icon="cr:star"
+ focus-row-control focus-type="star"
+ title="$i18n{removeBookmark}" on-click="onRemoveBookmarkTap_">
+ </cr-icon-button>
</template>
</div>
- <paper-icon-button-light id="menu-button-container"
- class="more-vert-button">
- <button id="menu-button" focus-row-control focus-type="cr-menu-button"
- title="$i18n{actionMenuDescription}" on-click="onMenuButtonTap_"
- aria-haspopup="menu">
- <div></div>
- <div></div>
- <div></div>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="menu-button" iron-icon="cr:more-vert"
+ focus-row-control focus-type="cr-menu-button"
+ title="$i18n{actionMenuDescription}" on-click="onMenuButtonTap_"
+ aria-haspopup="menu"></cr-icon-button>
</div>
<div id="time-gap-separator" hidden="[[!hasTimeGap]]"></div>
</div>
diff --git a/chromium/chrome/browser/resources/history/history_item.js b/chromium/chrome/browser/resources/history/history_item.js
index cee4633400d..6bdf7f52bf2 100644
--- a/chromium/chrome/browser/resources/history/history_item.js
+++ b/chromium/chrome/browser/resources/history/history_item.js
@@ -104,7 +104,7 @@ cr.define('history', function() {
for (let i = 0; i < e.path.length; i++) {
const elem = e.path[i];
if (elem.id != 'checkbox' &&
- (elem.nodeName == 'A' || elem.nodeName == 'BUTTON')) {
+ (elem.nodeName == 'A' || elem.nodeName == 'CR-ICON-BUTTON')) {
return;
}
}
@@ -189,7 +189,7 @@ cr.define('history', function() {
}
if (this.$$('#bookmark-star') == this.root.activeElement) {
- this.$['menu-button'].focus();
+ cr.ui.focusWithoutInk(this.$['menu-button']);
}
const browserService = history.BrowserService.getInstance();
diff --git a/chromium/chrome/browser/resources/history/images/sign_in_promo.svg b/chromium/chrome/browser/resources/history/images/sign_in_promo.svg
index 45b987a1645..abd09c9cf63 100644
--- a/chromium/chrome/browser/resources/history/images/sign_in_promo.svg
+++ b/chromium/chrome/browser/resources/history/images/sign_in_promo.svg
@@ -1 +1 @@
-<svg width="1189" height="444" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="a" d="M0 127h169V0H0v127z"/><path id="c" d="M101 0H0v211h101z"/><path id="f" d="M0 256h403V16H0z"/><filter x="-2.6%" y="-3.1%" width="105.2%" height="108.8%" filterUnits="objectBoundingBox" id="e"><feOffset dy="3" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" in="shadowBlurOuter1"/></filter><path id="g" d="M0 215h388V0H0z"/><path id="j" d="M.01.896h115v172H.01z"/><filter x="-9.6%" y="-4.1%" width="119.1%" height="112.8%" filterUnits="objectBoundingBox" id="i"><feOffset dy="4" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.241649683 0" in="shadowBlurOuter1"/></filter><path id="k" d="M0 1h103v153H0z"/></defs><g fill="none" fill-rule="evenodd"><g transform="translate(93 296)"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><path d="M84.865 0H0c0 88.164 47.14 127 47.14 127h74.72S169 88.164 169 0H84.865z" fill="#E4EAEE" mask="url(#b)"/></g><g transform="translate(79 32)"><mask id="d" fill="#fff"><use xlink:href="#c"/></mask><path d="M99.233 210.415S121.44 96.44 8.393 0c0 0-27.026 84.53 15.915 152.732 42.94 68.204 74.925 57.683 74.925 57.683" fill="#E4EAEE" mask="url(#d)"/></g><path d="M201.538 185.694c2.632-4.527 48.842-20.348 55.46-113.145.393-5.53-47.993 30.452-74.356 118.722C156.277 279.543 176.244 305 176.244 305h9.535s-25.873-47.705 15.759-119.306M153 257.713s-16.798-26.77-53.804-32.9c-37.004-6.13-51.986 23.98-45.869 37.877C61.68 281.662 153 257.713 153 257.713" fill="#E4EAEE"/><path d="M207.277 248.763c-9.453 5.769-22.277 2.069-22.277 2.069s2.504-13.052 11.957-18.82c9.453-5.768 19.426-6.694 22.277-2.068 2.85 4.626-2.503 13.051-11.957 18.82" fill="#E4EAEE"/><path d="M139.615 252s30.431 7.813 36.385 34.745L173.126 292s-2.418-21.677-40.126-38.099l6.615-1.901z" fill="#EAEAEA"/><g><path fill="#FFF" d="M318.164 0v389.346H263V422h662v-32.654h-55.192V0z"/><path fill="#C2D4F4" d="M332 388h520V24H332z"/><path fill="#4A4A4A" opacity=".113" d="M332 388h520v-31H332z"/><path fill="#FFF" opacity=".438" d="M577 203h245V57H577z"/><g transform="translate(374 78)"><use fill="#000" filter="url(#e)" xlink:href="#f"/><use fill="#FFF" xlink:href="#f"/></g><path fill="#FFF" d="M384 95h82l-9.787-17h-62.426z"/><path fill="#FFF" opacity=".78" d="M455 95h82l-9.787-17h-62.426z"/><g transform="translate(381 112)"><mask id="h" fill="#fff"><use xlink:href="#g"/></mask><use fill="#F8F8F8" xlink:href="#g"/><ellipse fill="#FBE8B0" mask="url(#h)" cx="538" cy="289" rx="344" ry="276"/></g></g><path fill="#E4EAEE" d="M0 423h1189v21H0z"/><g transform="translate(885 112)"><rect fill="#FFF" x="59" width="164" height="310" rx="22.68"/><path fill="#C2D4F4" d="M71 15h139v270H71z"/><path fill="#4A4A4A" opacity=".113" d="M71 15h139v8H71zM71 269h139v16H71z"/><path fill="#FFF" opacity=".78" d="M91 65h104v127H91z"/><path fill="#B8CEF6" d="M95 74h94v115H95z"/><g transform="rotate(-6 574.13 21.522)"><use fill="#000" filter="url(#i)" xlink:href="#j"/><use fill="#FFF" xlink:href="#j"/></g><g transform="rotate(-6 688.693 -39.441)"><mask id="l" fill="#fff"><use xlink:href="#k"/></mask><use fill="#FBE8B0" xlink:href="#k"/><path fill="#FFF" opacity=".4" mask="url(#l)" d="M-7.106 59.039h117v116h-117z"/><circle fill="#FF9962" mask="url(#l)" cx="86.669" cy="58.868" r="7.5"/></g><path fill="#4A4A4A" opacity=".258" d="M79 32h8v8h-8z"/><rect fill="#4A4A4A" opacity=".258" x="183" y="32" width="8" height="8" rx="4"/><rect fill="#4A4A4A" opacity=".258" x="197" y="32" width="8" height="8" rx="4"/></g></g></svg> \ No newline at end of file
+<svg width="1189" height="444" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="a" d="M0 127h169V0H0v127z"/><path id="c" d="M101 0H0v211h101z"/><path id="f" d="M0 256h403V16H0z"/><filter x="-2.6%" y="-3.1%" width="105.2%" height="108.8%" filterUnits="objectBoundingBox" id="e"><feOffset dy="3" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" in="shadowBlurOuter1"/></filter><path id="g" d="M0 215h388V0H0z"/><path id="j" d="M.01.896h115v172H.01z"/><filter x="-9.6%" y="-4.1%" width="119.1%" height="112.8%" filterUnits="objectBoundingBox" id="i"><feOffset dy="4" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.241649683 0" in="shadowBlurOuter1"/></filter><path id="k" d="M0 1h103v153H0z"/></defs><g fill="none" fill-rule="evenodd"><g transform="translate(93 296)"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><path d="M84.865 0H0c0 88.164 47.14 127 47.14 127h74.72S169 88.164 169 0H84.865z" fill="#E4EAEE" mask="url(#b)"/></g><g transform="translate(79 32)"><mask id="d" fill="#fff"><use xlink:href="#c"/></mask><path d="M99.233 210.415S121.44 96.44 8.393 0c0 0-27.026 84.53 15.915 152.732 42.94 68.204 74.925 57.683 74.925 57.683" fill="#E4EAEE" mask="url(#d)"/></g><path d="M201.538 185.694c2.632-4.527 48.842-20.348 55.46-113.145.393-5.53-47.993 30.452-74.356 118.722C156.277 279.543 176.244 305 176.244 305h9.535s-25.873-47.705 15.759-119.306M153 257.713s-16.798-26.77-53.804-32.9c-37.004-6.13-51.986 23.98-45.869 37.877C61.68 281.662 153 257.713 153 257.713" fill="#E4EAEE"/><path d="M207.277 248.763c-9.453 5.769-22.277 2.069-22.277 2.069s2.504-13.052 11.957-18.82c9.453-5.768 19.426-6.694 22.277-2.068 2.85 4.626-2.503 13.051-11.957 18.82" fill="#E4EAEE"/><path d="M139.615 252s30.431 7.813 36.385 34.745L173.126 292s-2.418-21.677-40.126-38.099l6.615-1.901z" fill="#EAEAEA"/><path fill="#FFF" d="M318.164 0v389.346H263V422h662v-32.654h-55.192V0z"/><path fill="#C2D4F4" d="M332 388h520V24H332z"/><path fill="#4A4A4A" opacity=".113" d="M332 388h520v-31H332z"/><path fill="#FFF" opacity=".438" d="M577 203h245V57H577z"/><g transform="translate(374 78)"><use fill="#000" filter="url(#e)" xlink:href="#f"/><use fill="#FFF" xlink:href="#f"/></g><path fill="#FFF" d="M384 95h82l-9.787-17h-62.426z"/><path fill="#FFF" opacity=".78" d="M455 95h82l-9.787-17h-62.426z"/><g transform="translate(381 112)"><mask id="h" fill="#fff"><use xlink:href="#g"/></mask><use fill="#F8F8F8" xlink:href="#g"/><ellipse fill="#FBE8B0" mask="url(#h)" cx="538" cy="289" rx="344" ry="276"/></g><path fill="#E4EAEE" d="M0 423h1189v21H0z"/><g transform="translate(885 112)"><rect fill="#FFF" x="59" width="164" height="310" rx="22.68"/><path fill="#C2D4F4" d="M71 15h139v270H71z"/><path fill="#4A4A4A" opacity=".113" d="M71 15h139v8H71zm0 254h139v16H71z"/><path fill="#FFF" opacity=".78" d="M91 65h104v127H91z"/><path fill="#B8CEF6" d="M95 74h94v115H95z"/><g transform="rotate(-6 574.13 21.522)"><use fill="#000" filter="url(#i)" xlink:href="#j"/><use fill="#FFF" xlink:href="#j"/></g><g transform="rotate(-6 688.693 -39.441)"><mask id="l" fill="#fff"><use xlink:href="#k"/></mask><use fill="#FBE8B0" xlink:href="#k"/><path fill="#FFF" opacity=".4" mask="url(#l)" d="M-7.106 59.039h117v116h-117z"/><circle fill="#FF9962" mask="url(#l)" cx="86.669" cy="58.868" r="7.5"/></g><path fill="#4A4A4A" opacity=".258" d="M79 32h8v8h-8z"/><rect fill="#4A4A4A" opacity=".258" x="183" y="32" width="8" height="8" rx="4"/><rect fill="#4A4A4A" opacity=".258" x="197" y="32" width="8" height="8" rx="4"/></g></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/history/images/sign_in_promo_dark.svg b/chromium/chrome/browser/resources/history/images/sign_in_promo_dark.svg
index e61dda685a0..c3647e0ab28 100644
--- a/chromium/chrome/browser/resources/history/images/sign_in_promo_dark.svg
+++ b/chromium/chrome/browser/resources/history/images/sign_in_promo_dark.svg
@@ -1 +1 @@
-<svg width="1189" height="444" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="b" d="M0 256h403V16H0z"/><filter x="-2.6%" y="-3.1%" width="105.2%" height="108.8%" filterUnits="objectBoundingBox" id="a"><feOffset dy="3" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" in="shadowBlurOuter1"/></filter><path id="c" d="M0 215h388V0H0z"/><path id="f" d="M.01.896h115v172H.01z"/><filter x="-9.6%" y="-4.1%" width="119.1%" height="112.8%" filterUnits="objectBoundingBox" id="e"><feOffset dy="4" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.241649683 0" in="shadowBlurOuter1"/></filter><path id="g" d="M0 1h103v153H0z"/></defs><g fill="none" fill-rule="evenodd"><path d="M225.253 296H305c0 88.164-47.14 127-47.14 127h-74.72S136 384.164 136 296h79.296c-.971-3.253-1.911-7.489-2.537-12.866-3.523-6.303-10.667-15.088-25.063-23.378-22.701 5.36-84.565 18.389-91.369 2.934-6.117-13.897 8.865-44.007 45.87-37.877 37.005 6.13 53.803 32.9 53.803 32.9l-.009.002c5.365 3.06 11.367 7.524 16.029 13.8-.131-7.842.377-17.297 1.942-28.6-11.8-.88-36.921-9.368-67.654-58.183C103.368 116.53 130.393 32 130.393 32c71.428 60.935 88.859 128.871 92.013 170.634a453.053 453.053 0 0 1 3.236-11.363c26.363-88.27 74.75-124.252 74.356-118.722-6.618 92.797-52.828 108.618-55.46 113.145-30.962 53.25-24.587 93.283-19.285 110.306zm25.024-47.237c-9.453 5.769-22.277 2.069-22.277 2.069s2.504-13.052 11.957-18.82c9.453-5.768 19.426-6.694 22.277-2.068 2.85 4.626-2.503 13.051-11.957 18.82z" fill-opacity=".351" fill="#F8F9FA" opacity=".199"/><path d="M180 32H79v211h101z"/><path fill="#4F5154" d="M298.164 0v389.346H243V422h662v-32.654h-55.192V0z"/><path fill="#C2D4F4" d="M312 388h520V24H312z"/><path fill="#4A4A4A" opacity=".113" d="M312 388h520v-31H312z"/><path fill="#FFF" opacity=".438" d="M557 203h245V57H557z"/><g transform="translate(354 78)"><use fill="#000" filter="url(#a)" xlink:href="#b"/><use fill="#FFF" xlink:href="#b"/></g><path fill="#FFF" d="M364 95h82l-9.787-17h-62.426z"/><path fill="#FFF" opacity=".78" d="M435 95h82l-9.787-17h-62.426z"/><g transform="translate(361 112)"><mask id="d" fill="#fff"><use xlink:href="#c"/></mask><use fill="#F8F8F8" xlink:href="#c"/><ellipse fill="#FBE8B0" mask="url(#d)" cx="538" cy="289" rx="344" ry="276"/></g><g transform="translate(813 112)"><rect fill="#4F5154" x="59" width="164" height="310" rx="22.68"/><path fill="#C2D4F4" d="M71 15h139v270H71z"/><path fill="#4A4A4A" opacity=".113" d="M71 15h139v8H71zM71 269h139v16H71z"/><path fill="#FFF" opacity=".78" d="M91 65h104v127H91z"/><path fill="#B8CEF6" d="M95 74h94v115H95z"/><g transform="rotate(-6 574.13 21.522)"><use fill="#000" filter="url(#e)" xlink:href="#f"/><use fill="#FFF" xlink:href="#f"/></g><g transform="rotate(-6 688.693 -39.441)"><mask id="h" fill="#fff"><use xlink:href="#g"/></mask><use fill="#FBE8B0" xlink:href="#g"/><path fill="#FFF" opacity=".4" mask="url(#h)" d="M-7.106 59.039h117v116h-117z"/><circle fill="#FF9962" mask="url(#h)" cx="86.669" cy="58.868" r="7.5"/></g><path fill="#4A4A4A" opacity=".258" d="M79 32h8v8h-8z"/><rect fill="#4A4A4A" opacity=".258" x="183" y="32" width="8" height="8" rx="4"/><rect fill="#4A4A4A" opacity=".258" x="197" y="32" width="8" height="8" rx="4"/></g><path fill-opacity=".351" fill="#F8F9FA" opacity=".199" d="M0 423h1189v21H0z"/></g></svg> \ No newline at end of file
+<svg width="1189" height="444" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="b" d="M0 256h403V16H0z"/><filter x="-2.6%" y="-3.1%" width="105.2%" height="108.8%" filterUnits="objectBoundingBox" id="a"><feOffset dy="3" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" in="shadowBlurOuter1"/></filter><path id="c" d="M0 215h388V0H0z"/><path id="f" d="M.01.896h115v172H.01z"/><filter x="-9.6%" y="-4.1%" width="119.1%" height="112.8%" filterUnits="objectBoundingBox" id="e"><feOffset dy="4" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.241649683 0" in="shadowBlurOuter1"/></filter><path id="g" d="M0 1h103v153H0z"/></defs><g fill="none" fill-rule="evenodd"><path d="M225.253 296H305c0 88.164-47.14 127-47.14 127h-74.72S136 384.164 136 296h79.296c-.971-3.253-1.911-7.489-2.537-12.866-3.523-6.303-10.667-15.088-25.063-23.378-22.701 5.36-84.565 18.389-91.369 2.934-6.117-13.897 8.865-44.007 45.87-37.877 37.005 6.13 53.803 32.9 53.803 32.9l-.009.002c5.365 3.06 11.367 7.524 16.029 13.8-.131-7.842.377-17.297 1.942-28.6-11.8-.88-36.921-9.368-67.654-58.183C103.368 116.53 130.393 32 130.393 32c71.428 60.935 88.859 128.871 92.013 170.634a453.053 453.053 0 0 1 3.236-11.363c26.363-88.27 74.75-124.252 74.356-118.722-6.618 92.797-52.828 108.618-55.46 113.145-30.962 53.25-24.587 93.283-19.285 110.306zm25.024-47.237c-9.453 5.769-22.277 2.069-22.277 2.069s2.504-13.052 11.957-18.82c9.453-5.768 19.426-6.694 22.277-2.068 2.85 4.626-2.503 13.051-11.957 18.82z" fill-opacity=".351" fill="#F8F9FA" opacity=".199"/><path d="M180 32H79v211h101z"/><path fill="#4F5154" d="M298.164 0v389.346H243V422h662v-32.654h-55.192V0z"/><path fill="#C2D4F4" d="M312 388h520V24H312z"/><path fill="#4A4A4A" opacity=".113" d="M312 388h520v-31H312z"/><path fill="#FFF" opacity=".438" d="M557 203h245V57H557z"/><g transform="translate(354 78)"><use fill="#000" filter="url(#a)" xlink:href="#b"/><use fill="#FFF" xlink:href="#b"/></g><path fill="#FFF" d="M364 95h82l-9.787-17h-62.426z"/><path fill="#FFF" opacity=".78" d="M435 95h82l-9.787-17h-62.426z"/><g transform="translate(361 112)"><mask id="d" fill="#fff"><use xlink:href="#c"/></mask><use fill="#F8F8F8" xlink:href="#c"/><ellipse fill="#FBE8B0" mask="url(#d)" cx="538" cy="289" rx="344" ry="276"/></g><g transform="translate(813 112)"><rect fill="#4F5154" x="59" width="164" height="310" rx="22.68"/><path fill="#C2D4F4" d="M71 15h139v270H71z"/><path fill="#4A4A4A" opacity=".113" d="M71 15h139v8H71zm0 254h139v16H71z"/><path fill="#FFF" opacity=".78" d="M91 65h104v127H91z"/><path fill="#B8CEF6" d="M95 74h94v115H95z"/><g transform="rotate(-6 574.13 21.522)"><use fill="#000" filter="url(#e)" xlink:href="#f"/><use fill="#FFF" xlink:href="#f"/></g><g transform="rotate(-6 688.693 -39.441)"><mask id="h" fill="#fff"><use xlink:href="#g"/></mask><use fill="#FBE8B0" xlink:href="#g"/><path fill="#FFF" opacity=".4" mask="url(#h)" d="M-7.106 59.039h117v116h-117z"/><circle fill="#FF9962" mask="url(#h)" cx="86.669" cy="58.868" r="7.5"/></g><path fill="#4A4A4A" opacity=".258" d="M79 32h8v8h-8z"/><rect fill="#4A4A4A" opacity=".258" x="183" y="32" width="8" height="8" rx="4"/><rect fill="#4A4A4A" opacity=".258" x="197" y="32" width="8" height="8" rx="4"/></g><path fill-opacity=".351" fill="#F8F9FA" opacity=".199" d="M0 423h1189v21H0z"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/history/lazy_load.html b/chromium/chrome/browser/resources/history/lazy_load.html
index 81a6d85e683..53567c5d365 100644
--- a/chromium/chrome/browser/resources/history/lazy_load.html
+++ b/chromium/chrome/browser/resources/history/lazy_load.html
@@ -6,8 +6,8 @@
<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/cr_drawer/cr_drawer.html">
+ <link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar_selection_overlay.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
- <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
</body>
</html>
diff --git a/chromium/chrome/browser/resources/history/shared_style.html b/chromium/chrome/browser/resources/history/shared_style.html
index daccd428a92..c915d823deb 100644
--- a/chromium/chrome/browser/resources/history/shared_style.html
+++ b/chromium/chrome/browser/resources/history/shared_style.html
@@ -57,26 +57,6 @@
text-overflow: ellipsis;
white-space: nowrap;
}
-
- paper-icon-button-light {
- background: none;
- border: none;
- height: 36px;
- outline: none;
- width: 36px;
- }
-
- paper-icon-button-light.more-vert-button > button {
- padding: 8px;
- }
-
- paper-icon-button-light.more-vert-button div {
- border: 2px solid var(--cr-secondary-text-color);
- border-radius: 2px;
- margin: 1px 8px;
- pointer-events: none;
- transform: scale(0.8);
- }
</style>
</template>
</dom-module>
diff --git a/chromium/chrome/browser/resources/history/side_bar.html b/chromium/chrome/browser/resources/history/side_bar.html
index 0c3b053b0df..73fa9dec87d 100644
--- a/chromium/chrome/browser/resources/history/side_bar.html
+++ b/chromium/chrome/browser/resources/history/side_bar.html
@@ -58,7 +58,7 @@
cursor: pointer;
display: flex;
font-weight: 500;
- margin-inline-end: 4px;
+ margin: 0 4px;
min-height: 40px;
padding-inline-start: 24px;
position: relative;
diff --git a/chromium/chrome/browser/resources/history/synced_device_card.html b/chromium/chrome/browser/resources/history/synced_device_card.html
index f4d2c3663fc..d7bdbf00752 100644
--- a/chromium/chrome/browser/resources/history/synced_device_card.html
+++ b/chromium/chrome/browser/resources/history/synced_device_card.html
@@ -1,11 +1,11 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_row.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/html/icon.html">
<link rel="import" href="browser_service.html">
<link rel="import" href="constants.html">
@@ -44,7 +44,7 @@
#device-name {
overflow: hidden;
- padding-right: 3px;
+ padding-inline-end: 3px;
text-overflow: ellipsis;
}
@@ -87,21 +87,12 @@
<span id="last-update-time">[[lastUpdateTime]]</span>
</div>
<div id="right-buttons">
- <paper-icon-button-light class="more-vert-button">
- <button id="menu-button" on-click="onMenuButtonTap_"
- title="$i18n{actionMenuDescription}">
- <div></div>
- <div></div>
- <div></div>
- </button>
- </paper-icon-button-light>
- <paper-icon-button-light>
- <button id="collapse-button" title$="[[getCollapseTitle_(opened)]]">
- <iron-icon icon="[[getCollapseIcon_(opened)]]"
- id="dropdown-indicator">
- </iron-icon>
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="menu-button" iron-icon="cr:more-vert"
+ on-click="onMenuButtonTap_" title="$i18n{actionMenuDescription}">
+ </cr-icon-button>
+ <cr-icon-button id="collapse-button"
+ iron-icon="[[getCollapseIcon_(opened)]]"
+ title$="[[getCollapseTitle_(opened)]]"></cr-icon-button>
</div>
</div>
diff --git a/chromium/chrome/browser/resources/history/synced_device_card.js b/chromium/chrome/browser/resources/history/synced_device_card.js
index 9908112f974..6e1c5a6bb61 100644
--- a/chromium/chrome/browser/resources/history/synced_device_card.js
+++ b/chromium/chrome/browser/resources/history/synced_device_card.js
@@ -93,8 +93,6 @@ Polymer({
SYNCED_TABS_HISTOGRAM_NAME, histogramValue, SyncedTabsHistogram.LIMIT);
this.$.collapse.toggle();
- this.$['dropdown-indicator'].icon =
- this.$.collapse.opened ? 'cr:expand-less' : 'cr:expand-more';
this.fire('update-focus-grid');
},
diff --git a/chromium/chrome/browser/resources/identity_internals.css b/chromium/chrome/browser/resources/identity_internals/identity_internals.css
index 4d30370ae3e..4d30370ae3e 100644
--- a/chromium/chrome/browser/resources/identity_internals.css
+++ b/chromium/chrome/browser/resources/identity_internals/identity_internals.css
diff --git a/chromium/chrome/browser/resources/identity_internals.html b/chromium/chrome/browser/resources/identity_internals/identity_internals.html
index 537e7246602..537e7246602 100644
--- a/chromium/chrome/browser/resources/identity_internals.html
+++ b/chromium/chrome/browser/resources/identity_internals/identity_internals.html
diff --git a/chromium/chrome/browser/resources/identity_internals.js b/chromium/chrome/browser/resources/identity_internals/identity_internals.js
index b7d72473f68..b7d72473f68 100644
--- a/chromium/chrome/browser/resources/identity_internals.js
+++ b/chromium/chrome/browser/resources/identity_internals/identity_internals.js
diff --git a/chromium/chrome/browser/resources/inline_login/inline_login.css b/chromium/chrome/browser/resources/inline_login/inline_login.css
index f550f1c6edb..a749a40f08e 100644
--- a/chromium/chrome/browser/resources/inline_login/inline_login.css
+++ b/chromium/chrome/browser/resources/inline_login/inline_login.css
@@ -34,7 +34,8 @@ body,
}
#navigation-button {
- color: white;
+ --cr-icon-button-color: white;
+ margin: 0;
position: absolute;
top: 0;
visibility: hidden;
diff --git a/chromium/chrome/browser/resources/inline_login/inline_login.html b/chromium/chrome/browser/resources/inline_login/inline_login.html
index 74a9813861d..ab872711e2c 100644
--- a/chromium/chrome/browser/resources/inline_login/inline_login.html
+++ b/chromium/chrome/browser/resources/inline_login/inline_login.html
@@ -3,8 +3,8 @@
<head>
<title>$i18n{title}</title>
<link rel="import" href="chrome://resources/html/polymer.html">
+ <link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
- <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html">
<link rel="stylesheet" href="chrome://resources/css/spinner.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
<link rel="stylesheet" href="chrome://chrome-signin/inline_login.css">
@@ -23,7 +23,6 @@
<div class="spinner"></div>
</div>
</div>
- <paper-icon-button id="navigation-button"
- icon="cr:close"></paper-icon-button>
+ <cr-icon-button id="navigation-button" iron-icon="cr:close"></cr-icon-button>
</body>
</html>
diff --git a/chromium/chrome/browser/resources/inline_login/inline_login.js b/chromium/chrome/browser/resources/inline_login/inline_login.js
index a4be6f05f59..71a6b6b7201 100644
--- a/chromium/chrome/browser/resources/inline_login/inline_login.js
+++ b/chromium/chrome/browser/resources/inline_login/inline_login.js
@@ -56,6 +56,10 @@ cr.define('inline.login', function() {
$('contents').classList.toggle('loading', true);
}
+ function onShowIncognito() {
+ chrome.send('showIncognito');
+ }
+
/**
* Initialize the UI.
*/
@@ -67,6 +71,7 @@ cr.define('inline.login', function() {
authExtHost.addEventListener('newWindow', onNewWindow);
authExtHost.addEventListener('resize', onResize);
authExtHost.addEventListener('authCompleted', onAuthCompleted);
+ authExtHost.addEventListener('showIncognito', onShowIncognito);
chrome.send('initialize');
}
@@ -129,7 +134,7 @@ cr.define('inline.login', function() {
}
function showBackButton() {
- $('navigation-button').icon =
+ $('navigation-button').ironIcon =
isRTL() ? 'cr:arrow-forward' : 'cr:arrow-back';
$('navigation-button')
@@ -138,7 +143,7 @@ cr.define('inline.login', function() {
}
function showCloseButton() {
- $('navigation-button').icon = 'cr:close';
+ $('navigation-button').ironIcon = 'cr:close';
$('navigation-button').classList.add('enabled');
$('navigation-button')
.setAttribute(
diff --git a/chromium/chrome/browser/resources/local_ntp/BUILD.gn b/chromium/chrome/browser/resources/local_ntp/BUILD.gn
new file mode 100644
index 00000000000..f7d4bd9711c
--- /dev/null
+++ b/chromium/chrome/browser/resources/local_ntp/BUILD.gn
@@ -0,0 +1,28 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":local_ntp",
+ ]
+}
+
+js_library("local_ntp") {
+ sources = [
+ "animations.js",
+ "custom_backgrounds.js",
+ "custom_links_edit.js",
+ "doodles.js",
+ "instant_iframe_validation.js",
+ "local_ntp.js",
+ "most_visited_single.js",
+ "most_visited_title.js",
+ "most_visited_util.js",
+ "utils.js",
+ "voice.js",
+ ]
+ externs_list = [ "externs.js" ]
+}
diff --git a/chromium/chrome/browser/resources/local_ntp/animations.css b/chromium/chrome/browser/resources/local_ntp/animations.css
index cb2efa47ea1..465d029a3ad 100644
--- a/chromium/chrome/browser/resources/local_ntp/animations.css
+++ b/chromium/chrome/browser/resources/local_ntp/animations.css
@@ -49,7 +49,8 @@ button.paper {
border-radius: 4px;
font-size: 12px;
font-weight: 500;
- height: 32px;
+ line-height: 1.6;
+ min-height: 32px;
padding: 0 16px;
position: relative;
transition-duration: 200ms;
diff --git a/chromium/chrome/browser/resources/local_ntp/custom_backgrounds.css b/chromium/chrome/browser/resources/local_ntp/custom_backgrounds.css
index 799117c1147..b4f3a04906d 100644
--- a/chromium/chrome/browser/resources/local_ntp/custom_backgrounds.css
+++ b/chromium/chrome/browser/resources/local_ntp/custom_backgrounds.css
@@ -78,7 +78,6 @@ html[dir=rtl] #edit-bg {
.ep-enhanced #edit-bg-icon {
background-color: rgb(var(--GB600-rgb));
- margin-inline-start: 12px;
}
html[darkmode=true] .ep-enhanced #edit-bg-icon {
@@ -86,21 +85,28 @@ html[darkmode=true] .ep-enhanced #edit-bg-icon {
}
#edit-bg-text {
- display: none;
-}
-
-.ep-enhanced #edit-bg-text {
color: rgb(var(--GB600-rgb));
- display: inline;
+ display: none;
font-size: 14px;
padding-inline-end: 12px;
padding-inline-start: 8px;
+ user-select: none;
}
html[darkmode=true] .ep-enhanced #edit-bg-text {
color: rgb(var(--GB300-rgb));
}
+@media (min-width: 550px) {
+ .ep-enhanced #edit-bg-icon {
+ margin-inline-start: 12px;
+ }
+
+ .ep-enhanced #edit-bg-text {
+ display: inline;
+ }
+}
+
#edit-bg-dialog::backdrop {
background: transparent;
}
@@ -200,7 +206,8 @@ html[darkmode=true] .bg-option.bg-option-disabled {
outline: none;
}
-.bg-option.bg-option-disabled:hover {
+.bg-option.bg-option-disabled:hover,
+html[darkmode=true] .bg-option.bg-option-disabled:hover {
background-color: transparent;
}
@@ -580,9 +587,10 @@ html[darkmode=true] .selected-check::after {
color: #FFF;
display: inline-block;
font-size: 13px;
- height: 32px;
+ line-height: 1.6;
+ min-height: 32px;
overflow: hidden;
- padding: 8px 16px 0 16px;
+ padding: 8px 16px;
position: absolute;
text-overflow: ellipsis;
user-select: none;
@@ -637,6 +645,7 @@ html[dir=rtl] .plus-icon {
color: white;
font-weight: 500;
left: 16px;
+ max-width: 80%;
padding: 8px 8px 8px 8px;
position: fixed;
text-shadow: 0 0 16px rgba(0, 0, 0, 0.3);
@@ -649,26 +658,26 @@ html[dir=rtl] #custom-bg-attr {
right: 16px;
}
-.attr1 {
+.attr-common {
font-size: 13px;
height: 20px;
line-height: 20px;
+ overflow: hidden;
+ text-overflow: ellipsis;
vertical-align: middle;
+ white-space: nowrap;
+ width: -webkit-fill-available;
}
-.attr2 {
+.attr-common.attr-small {
font-size: 11px;
- height: 20px;
- line-height: 20px;
- vertical-align: middle;
}
#custom-bg-attr.attr-link:hover {
background: rgba(var(--GG900-rgb), .1);
}
-.attr1.attr-link,
-.attr2.attr-link {
+.attr-link {
display: inline-block;
text-decoration: underline;
}
diff --git a/chromium/chrome/browser/resources/local_ntp/custom_backgrounds.js b/chromium/chrome/browser/resources/local_ntp/custom_backgrounds.js
index 63f805942b8..06bf99cf075 100644
--- a/chromium/chrome/browser/resources/local_ntp/custom_backgrounds.js
+++ b/chromium/chrome/browser/resources/local_ntp/custom_backgrounds.js
@@ -48,7 +48,7 @@ var BACKGROUND_CUSTOMIZATION_LOG_TYPE = {
/**
* Enum for key codes.
- * @enum {int}
+ * @enum {number}
* @const
*/
customBackgrounds.KEYCODES = {
@@ -69,6 +69,8 @@ customBackgrounds.KEYCODES = {
* @const
*/
customBackgrounds.IDS = {
+ ATTR1: 'attr1',
+ ATTR2: 'attr2',
ATTRIBUTIONS: 'custom-bg-attr',
BACK: 'bg-sel-back',
BACK_CIRCLE: 'bg-sel-back-circle',
@@ -107,8 +109,8 @@ customBackgrounds.IDS = {
* @const
*/
customBackgrounds.CLASSES = {
- ATTR_1: 'attr1',
- ATTR_2: 'attr2',
+ ATTR_SMALL: 'attr-small',
+ ATTR_COMMON: 'attr-common',
ATTR_LINK: 'attr-link',
COLLECTION_DIALOG: 'is-col-sel',
COLLECTION_SELECTED: 'bg-selected', // Highlight selected tile
@@ -134,7 +136,7 @@ customBackgrounds.CLASSES = {
/**
* Enum for background sources.
- * @enum {int}
+ * @enum {number}
* @const
*/
customBackgrounds.SOURCES = {
@@ -145,7 +147,7 @@ customBackgrounds.SOURCES = {
/**
* Enum for background option menu entries, in the order they appear in the UI.
- * @enum {int}
+ * @enum {number}
* @const
*/
customBackgrounds.MENU_ENTRIES = {
@@ -177,7 +179,7 @@ customBackgrounds.ROWS_TO_PRELOAD = 3;
/* Type of collection that is being browsed, needed in order
* to return from the image dialog.
- * @type {int}
+ * @type {number}
*/
customBackgrounds.dialogCollectionsSource = customBackgrounds.SOURCES.NONE;
@@ -186,14 +188,14 @@ customBackgrounds.dialogCollectionsSource = customBackgrounds.SOURCES.NONE;
* @type {?Function}
* @private
*/
-customBackgrounds.showErrorNotification;
+customBackgrounds.showErrorNotification = null;
/*
* Called when the custom link notification should be hidden.
* @type {?Function}
* @private
*/
-customBackgrounds.hideCustomLinkNotification;
+customBackgrounds.hideCustomLinkNotification = null;
/**
* Sets the visibility of the settings menu and individual options depending on
@@ -220,17 +222,21 @@ customBackgrounds.setAttribution = function(
attributionLine1, attributionLine2, attributionActionUrl) {
var attributionBox = $(customBackgrounds.IDS.ATTRIBUTIONS);
var attr1 = document.createElement('div');
+ attr1.setAttribute('id', customBackgrounds.IDS.ATTR1);
var attr2 = document.createElement('div');
+ attr2.setAttribute('id', customBackgrounds.IDS.ATTR2);
+
if (attributionLine1 !== '') {
// Shouldn't be changed from textContent for security assurances.
attr1.textContent = attributionLine1;
- attr1.classList.add(customBackgrounds.CLASSES.ATTR_1);
+ attr1.classList.add(customBackgrounds.CLASSES.ATTR_COMMON);
$(customBackgrounds.IDS.ATTRIBUTIONS).appendChild(attr1);
}
if (attributionLine2 !== '') {
// Shouldn't be changed from textContent for security assurances.
attr2.textContent = attributionLine2;
- attr2.classList.add(customBackgrounds.CLASSES.ATTR_2);
+ attr2.classList.add(customBackgrounds.CLASSES.ATTR_SMALL);
+ attr2.classList.add(customBackgrounds.CLASSES.ATTR_COMMON);
attributionBox.appendChild(attr2);
}
if (attributionActionUrl !== '') {
@@ -308,7 +314,7 @@ customBackgrounds.createChromeBackgroundTile = function(data) {
tile.style.backgroundImage = 'url(' + data.previewImageUrl + ')';
tile.dataset.id = data.collectionId;
tile.dataset.name = data.collectionName;
- fadeInImageTile(tile, data.previewImageUrl);
+ fadeInImageTile(tile, data.previewImageUrl, null);
return tile;
};
@@ -331,8 +337,8 @@ customBackgrounds.getTilesWide = function() {
/* Get the next tile when the arrow keys are used to navigate the grid.
* Returns null if the tile doesn't exist.
- * @param {int} deltaX Change in the x direction.
- * @param {int} deltaY Change in the y direction.
+ * @param {number} deltaX Change in the x direction.
+ * @param {number} deltaY Change in the y direction.
* @param {string} current Number of the current tile.
*/
customBackgrounds.getNextTile = function(deltaX, deltaY, current) {
@@ -343,10 +349,10 @@ customBackgrounds.getNextTile = function(deltaX, deltaY, current) {
}
if (deltaX != 0) {
- let target = parseInt(current) + deltaX;
+ let target = parseInt(current, /*radix=*/ 10) + deltaX;
return $(idPrefix + target);
} else if (deltaY != 0) {
- let target = parseInt(current);
+ let target = parseInt(current, /*radix=*/ 10);
let nextTile = $(idPrefix + target);
let startingTop = nextTile.getBoundingClientRect().top;
let startingLeft = nextTile.getBoundingClientRect().left;
@@ -364,7 +370,7 @@ customBackgrounds.getNextTile = function(deltaX, deltaY, current) {
/**
* Show dialog for selecting a Chrome background.
- * @param {int} collectionsSource The enum value of the source to fetch
+ * @param {number} collectionsSource The enum value of the source to fetch
* collection data from.
*/
customBackgrounds.showCollectionSelectionDialog = function(collectionsSource) {
@@ -429,8 +435,7 @@ customBackgrounds.showCollectionSelectionDialog = function(collectionsSource) {
imgScript.onload = function() {
// Verify that the individual image data was successfully loaded.
var imageDataLoaded =
- (coll_img.length > 0 &&
- coll_img[0].collectionId == tile.dataset.id);
+ (collImg.length > 0 && collImg[0].collectionId == tile.dataset.id);
// Dependent upon the success of the load, populate the image selection
// dialog or close the current dialog.
@@ -438,7 +443,7 @@ customBackgrounds.showCollectionSelectionDialog = function(collectionsSource) {
customBackgrounds.resetSelectionDialog();
customBackgrounds.showImageSelectionDialog(tile.dataset.name);
} else {
- customBackgrounds.handleError(coll_img_errors);
+ customBackgrounds.handleError(collImgErrors);
}
};
};
@@ -462,20 +467,22 @@ customBackgrounds.showCollectionSelectionDialog = function(collectionsSource) {
if (event.keyCode === customBackgrounds.KEYCODES.LEFT) {
target = customBackgrounds.getNextTile(
document.documentElement.classList.contains('rtl') ? 1 : -1, 0,
- this.dataset.tile_num);
+ event.currentTarget.dataset.tile_num);
} else if (event.keyCode === customBackgrounds.KEYCODES.UP) {
- target = customBackgrounds.getNextTile(0, -1, this.dataset.tile_num);
+ target = customBackgrounds.getNextTile(
+ 0, -1, event.currentTarget.dataset.tile_num);
} else if (event.keyCode === customBackgrounds.KEYCODES.RIGHT) {
target = customBackgrounds.getNextTile(
document.documentElement.classList.contains('rtl') ? -1 : 1, 0,
- this.dataset.tile_num);
+ event.currentTarget.dataset.tile_num);
} else if (event.keyCode === customBackgrounds.KEYCODES.DOWN) {
- target = customBackgrounds.getNextTile(0, 1, this.dataset.tile_num);
+ target = customBackgrounds.getNextTile(
+ 0, 1, event.currentTarget.dataset.tile_num);
}
if (target) {
target.focus();
} else {
- this.focus();
+ event.currentTarget.focus();
}
}
};
@@ -490,7 +497,7 @@ customBackgrounds.showCollectionSelectionDialog = function(collectionsSource) {
/**
* Apply border and checkmark when a tile is selected
- * @param {div} tile The tile to apply styling to.
+ * @param {!Element} tile The tile to apply styling to.
*/
customBackgrounds.applySelectedState = function(tile) {
tile.classList.add(customBackgrounds.CLASSES.COLLECTION_SELECTED);
@@ -511,7 +518,7 @@ customBackgrounds.applySelectedState = function(tile) {
/**
* Remove border and checkmark when a tile is un-selected
- * @param {div} tile The tile to remove styling from.
+ * @param {!Element} tile The tile to remove styling from.
*/
customBackgrounds.removeSelectedState = function(tile) {
tile.classList.remove(customBackgrounds.CLASSES.COLLECTION_SELECTED);
@@ -521,7 +528,7 @@ customBackgrounds.removeSelectedState = function(tile) {
/**
* Show dialog for selecting an image. Image data should previous have been
- * loaded into coll_img via
+ * loaded into collImg via
* chrome-search://local-ntp/ntp-background-images.js?collection_id=<collection_id>
* @param {string} dialogTitle The title to be displayed at the top of the
* dialog.
@@ -539,7 +546,7 @@ customBackgrounds.showImageSelectionDialog = function(dialogTitle) {
let preLoadTiles = [];
let postLoadTiles = [];
- for (var i = 0; i < coll_img.length; ++i) {
+ for (var i = 0; i < collImg.length; ++i) {
let tileBackground = document.createElement('div');
tileBackground.classList.add(
customBackgrounds.CLASSES.COLLECTION_TILE_BG);
@@ -550,23 +557,23 @@ customBackgrounds.showImageSelectionDialog = function(dialogTitle) {
// TODO(crbug.com/854028): Remove this hardcoded check when wallpaper
// previews are supported.
- if (coll_img[i].collectionId === 'solidcolors') {
+ if (collImg[i].collectionId === 'solidcolors') {
tile.dataset.attributionLine1 = '';
tile.dataset.attributionLine2 = '';
tile.dataset.attributionActionUrl = '';
} else {
tile.dataset.attributionLine1 =
- (coll_img[i].attributions[0] !== undefined ?
- coll_img[i].attributions[0] :
+ (collImg[i].attributions[0] !== undefined ?
+ collImg[i].attributions[0] :
'');
tile.dataset.attributionLine2 =
- (coll_img[i].attributions[1] !== undefined ?
- coll_img[i].attributions[1] :
+ (collImg[i].attributions[1] !== undefined ?
+ collImg[i].attributions[1] :
'');
- tile.dataset.attributionActionUrl = coll_img[i].attributionActionUrl;
+ tile.dataset.attributionActionUrl = collImg[i].attributionActionUrl;
}
- tile.setAttribute('aria-label', coll_img[i].attributions[0]);
- tile.dataset.url = coll_img[i].imageUrl;
+ tile.setAttribute('aria-label', collImg[i].attributions[0]);
+ tile.dataset.url = collImg[i].imageUrl;
tile.id = 'img_tile_' + i;
tile.dataset.tile_num = i;
@@ -604,11 +611,15 @@ customBackgrounds.showImageSelectionDialog = function(dialogTitle) {
let clickCount = event.detail;
// Control + option + space will fire the onclick event with 0 clickCount.
if (clickCount <= 1) {
- tileInteraction(this);
- } else if (clickCount === 2 && customBackgrounds.selectedTile === this) {
- customBackgrounds.setBackground(this.dataset.url,
- this.dataset.attributionLine1, this.dataset.attributionLine2,
- this.dataset.attributionActionUrl);
+ tileInteraction(event.currentTarget);
+ } else if (
+ clickCount === 2 &&
+ customBackgrounds.selectedTile === event.currentTarget) {
+ customBackgrounds.setBackground(
+ event.currentTarget.dataset.url,
+ event.currentTarget.dataset.attributionLine1,
+ event.currentTarget.dataset.attributionLine2,
+ event.currentTarget.dataset.attributionActionUrl);
}
};
tile.onkeydown = function(event) {
@@ -616,7 +627,7 @@ customBackgrounds.showImageSelectionDialog = function(dialogTitle) {
if (event.keyCode === customBackgrounds.KEYCODES.ENTER) {
event.preventDefault();
event.stopPropagation();
- tileInteraction(this);
+ tileInteraction(event.currentTarget);
} else if (
event.keyCode === customBackgrounds.KEYCODES.LEFT ||
event.keyCode === customBackgrounds.KEYCODES.UP ||
@@ -630,20 +641,22 @@ customBackgrounds.showImageSelectionDialog = function(dialogTitle) {
if (event.keyCode == customBackgrounds.KEYCODES.LEFT) {
target = customBackgrounds.getNextTile(
document.documentElement.classList.contains('rtl') ? 1 : -1, 0,
- this.dataset.tile_num);
+ event.currentTarget.dataset.tile_num);
} else if (event.keyCode == customBackgrounds.KEYCODES.UP) {
- target = customBackgrounds.getNextTile(0, -1, this.dataset.tile_num);
+ target = customBackgrounds.getNextTile(
+ 0, -1, event.currentTarget.dataset.tile_num);
} else if (event.keyCode == customBackgrounds.KEYCODES.RIGHT) {
target = customBackgrounds.getNextTile(
document.documentElement.classList.contains('rtl') ? -1 : 1, 0,
- this.dataset.tile_num);
+ event.currentTarget.dataset.tile_num);
} else if (event.keyCode == customBackgrounds.KEYCODES.DOWN) {
- target = customBackgrounds.getNextTile(0, 1, this.dataset.tile_num);
+ target = customBackgrounds.getNextTile(
+ 0, 1, event.currentTarget.dataset.tile_num);
}
if (target) {
target.focus();
} else {
- this.focus();
+ event.currentTarget.focus();
}
}
};
@@ -653,11 +666,11 @@ customBackgrounds.showImageSelectionDialog = function(dialogTitle) {
}
let tileGetsLoaded = 0;
for (let tile of preLoadTiles) {
- loadTile(tile, coll_img, () => {
+ loadTile(tile, collImg, () => {
// After the preloaded tiles finish loading, the rest of the tiles start
// loading.
if (++tileGetsLoaded === preLoadTiles.length) {
- postLoadTiles.forEach((tile) => loadTile(tile, coll_img));
+ postLoadTiles.forEach((tile) => loadTile(tile, collImg, null));
}
});
}
@@ -668,8 +681,8 @@ customBackgrounds.showImageSelectionDialog = function(dialogTitle) {
/**
* Add background image src to the tile and add animation for the tile once it
* successfully loaded.
- * @param {Object} tile the tile that needs to be loaded.
- * @param {object} imageData the source imageData.
+ * @param {!Object} tile the tile that needs to be loaded.
+ * @param {!Object} imageData the source imageData.
* @param {?Function} countLoad If not null, called after the tile finishes
* loading.
*/
@@ -690,7 +703,7 @@ let loadTile = function(tile, imageData, countLoad) {
* Fade in effect for both collection and image tile. Once the image
* successfully loads, we can assume the background image with the same source
* has also loaded. Then, we set opacity for the tile to start the animation.
- * @param {Object} tile The tile to add the fade in animation to.
+ * @param {!Object} tile The tile to add the fade in animation to.
* @param {string} imageUrl the image url for the tile
* @param {?Function} countLoad If not null, called after the tile finishes
* loading.
@@ -731,8 +744,8 @@ customBackgrounds.closeCustomizationDialog = function() {
/*
* Get the next visible option. There are times when various combinations of
* options are hidden.
- * @param {int} current_index Index of the option the key press occurred on.
- * @param {int} deltaY Direction to search in, -1 for up, 1 for down.
+ * @param {number} current_index Index of the option the key press occurred on.
+ * @param {number} deltaY Direction to search in, -1 for up, 1 for down.
*/
customBackgrounds.getNextOption = function(current_index, deltaY) {
// Create array corresponding to the menu. Important that this is in the same
@@ -895,7 +908,7 @@ customBackgrounds.initCustomLinksItems = function(hideCustomLinkNotification) {
$(customBackgrounds.IDS.CUSTOM_LINKS_RESTORE_DEFAULT).onkeydown = function(
event) {
if (event.keyCode === customBackgrounds.KEYCODES.ENTER) {
- customLinksRestoreDefaultInteraction(event);
+ customLinksRestoreDefaultInteraction();
} else if (event.keyCode === customBackgrounds.KEYCODES.UP) {
// Handle arrow key navigation.
event.preventDefault();
@@ -960,21 +973,21 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
$(customBackgrounds.IDS.DONE).disabled = true;
// Interactions with the "Upload an image" option.
- var uploadImageInteraction = function(event) {
+ var uploadImageInteraction = function() {
window.chrome.embeddedSearch.newTabPage.selectLocalBackgroundImage();
ntpApiHandle.logEvent(
BACKGROUND_CUSTOMIZATION_LOG_TYPE.NTP_CUSTOMIZE_LOCAL_IMAGE_CLICKED);
};
- $(customBackgrounds.IDS.UPLOAD_IMAGE).onclick = () => {
+ $(customBackgrounds.IDS.UPLOAD_IMAGE).onclick = (event) => {
if (!$(customBackgrounds.IDS.UPLOAD_IMAGE).classList.contains(
customBackgrounds.CLASSES.OPTION_DISABLED)) {
uploadImageInteraction();
}
- } ;
+ };
$(customBackgrounds.IDS.UPLOAD_IMAGE).onkeydown = function(event) {
if (event.keyCode === customBackgrounds.KEYCODES.ENTER) {
- uploadImageInteraction(event);
+ uploadImageInteraction();
}
// Handle arrow key navigation.
@@ -993,14 +1006,14 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
};
// Interactions with the "Restore default background" option.
- var restoreDefaultInteraction = function(event) {
+ var restoreDefaultInteraction = function() {
editDialog.close();
customBackgrounds.clearAttribution();
window.chrome.embeddedSearch.newTabPage.setBackgroundURL('');
ntpApiHandle.logEvent(BACKGROUND_CUSTOMIZATION_LOG_TYPE
.NTP_CUSTOMIZE_RESTORE_BACKGROUND_CLICKED);
};
- $(customBackgrounds.IDS.RESTORE_DEFAULT).onclick = () => {
+ $(customBackgrounds.IDS.RESTORE_DEFAULT).onclick = (event) => {
if (!$(customBackgrounds.IDS.RESTORE_DEFAULT).classList.contains(
customBackgrounds.CLASSES.OPTION_DISABLED)) {
restoreDefaultInteraction();
@@ -1008,7 +1021,7 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
};
$(customBackgrounds.IDS.RESTORE_DEFAULT).onkeydown = function(event) {
if (event.keyCode === customBackgrounds.KEYCODES.ENTER) {
- restoreDefaultInteraction(event);
+ restoreDefaultInteraction();
}
// Handle arrow key navigation.
@@ -1035,13 +1048,13 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
customBackgrounds.showCollectionSelectionDialog(
customBackgrounds.SOURCES.CHROME_BACKGROUNDS);
} else {
- customBackgrounds.handleError(coll_errors);
+ customBackgrounds.handleError(collErrors);
}
};
ntpApiHandle.logEvent(BACKGROUND_CUSTOMIZATION_LOG_TYPE
.NTP_CUSTOMIZE_CHROME_BACKGROUNDS_CLICKED);
};
- $(customBackgrounds.IDS.DEFAULT_WALLPAPERS).onclick = function() {
+ $(customBackgrounds.IDS.DEFAULT_WALLPAPERS).onclick = function(event) {
$(customBackgrounds.IDS.MENU)
.classList.add(customBackgrounds.CLASSES.MOUSE_NAV);
defaultWallpapersInteraction(event);
@@ -1114,6 +1127,12 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
backInteraction(event);
}
};
+ // Pressing Spacebar on the back arrow shouldn't scroll the dialog.
+ $(customBackgrounds.IDS.BACK_CIRCLE).onkeydown = function(event) {
+ if (event.keyCode === customBackgrounds.KEYCODES.SPACE) {
+ event.stopPropagation();
+ }
+ };
// Interactions with the cancel button on the background picker dialog.
$(customBackgrounds.IDS.CANCEL).onclick = function(event) {
diff --git a/chromium/chrome/browser/resources/local_ntp/custom_links_edit.css b/chromium/chrome/browser/resources/local_ntp/custom_links_edit.css
index d4c2cadc5b6..88fabe7081e 100644
--- a/chromium/chrome/browser/resources/local_ntp/custom_links_edit.css
+++ b/chromium/chrome/browser/resources/local_ntp/custom_links_edit.css
@@ -75,8 +75,8 @@ input {
caret-color: rgb(var(--GB600-rgb));
color: rgb(var(--GG900-rgb));
font-size: 13px;
- height: 32px;
- line-height: 24px;
+ line-height: 1.6;
+ min-height: 32px;
outline: none;
padding-inline-end: 8px;
padding-inline-start: 8px;
diff --git a/chromium/chrome/browser/resources/local_ntp/custom_links_edit.js b/chromium/chrome/browser/resources/local_ntp/custom_links_edit.js
index 541b7ce3f83..afb18410f54 100644
--- a/chromium/chrome/browser/resources/local_ntp/custom_links_edit.js
+++ b/chromium/chrome/browser/resources/local_ntp/custom_links_edit.js
@@ -179,7 +179,7 @@ function closeDialog() {
// Small delay to allow the dialog to close before cleaning up.
window.setTimeout(() => {
$(IDS.FORM).reset();
- $(IDS.TITLE_FIELD).dir = null;
+ $(IDS.TITLE_FIELD).dir = '';
$(IDS.URL_FIELD_CONTAINER).classList.remove('invalid');
$(IDS.DELETE).disabled = false;
$(IDS.DONE).disabled = false;
@@ -210,7 +210,7 @@ function focusBackOnCancel(event) {
/**
* Handler for the 'updateTheme' message from the host page.
- * @param {object} info Data received in the message.
+ * @param {!Object} info Data received in the message.
*/
function updateTheme(info) {
document.documentElement.setAttribute('darkmode', info.isDarkMode);
diff --git a/chromium/chrome/browser/resources/local_ntp/doodles.js b/chromium/chrome/browser/resources/local_ntp/doodles.js
index 89ec7af9f9d..bfb601d1022 100644
--- a/chromium/chrome/browser/resources/local_ntp/doodles.js
+++ b/chromium/chrome/browser/resources/local_ntp/doodles.js
@@ -275,7 +275,7 @@ doodles.logDoodleImpression = function(logUrl, isAnimated) {
console.log(error);
return;
}
- doodles.handleDdllogResponse(json.ddllog, isAnimated);
+ doodles.handleDdllogResponse(json['ddllog'], isAnimated);
})
.catch(function(error) {
console.log('Error logging doodle impression to "' + logUrl + '":');
@@ -291,11 +291,10 @@ doodles.logDoodleImpression = function(logUrl, isAnimated) {
/**
- * TODO(896461): Add more click tracking parameters and testing.
* Logs a doodle sharing event.
* Uses the ct param provided in metadata.onClickUrl to track the doodle.
*
- * @param {string} platform Social media platform the doodle will be shared to.
+ * @param {number} platform Social media platform the doodle will be shared to.
*/
doodles.logDoodleShare = function(platform) {
if (doodles.targetDoodle.metadata.onClickUrl) {
@@ -306,7 +305,7 @@ doodles.logDoodleShare = function(platform) {
url.searchParams.append('atyp', 'i');
url.searchParams.append('ct', 'doodle');
url.searchParams.append('cad', 'sh,' + platform + ',ct:' + ct);
- url.searchParams.append('ntp', 1);
+ url.searchParams.append('ntp', '1');
if (doodles.ei && doodles.ei != '') {
url.searchParams.append('ei', doodles.ei);
}
@@ -423,17 +422,17 @@ doodles.showLogoOrDoodle = function(fromCache) {
* Starts fading out the given element, which should be either the default logo
* or the doodle.
*
- * @param {HTMLElement} element
+ * @param {?Element} element
*/
doodles.startFadeOut = function(element) {
- if (!element.classList.contains(doodles.CLASSES.SHOW_LOGO)) {
+ if (!element || !element.classList.contains(doodles.CLASSES.SHOW_LOGO)) {
return;
}
// Compute style now, to ensure that the transition from 1 -> 0 is properly
// recognized. Otherwise, if a 0 -> 1 -> 0 transition is too fast, the
// element might stay invisible instead of appearing then fading out.
- window.getComputedStyle(element).opacity;
+ const style = window.getComputedStyle(element).opacity;
element.classList.add(doodles.CLASSES.FADE);
element.classList.remove(doodles.CLASSES.SHOW_LOGO);
@@ -476,7 +475,8 @@ doodles.onDoodleFadeOutComplete = function(e) {
$(doodles.IDS.LOGO_DEFAULT).classList.add(doodles.CLASSES.FADE);
doodles.showLogoOrDoodle(/*fromCache=*/ false);
- this.removeEventListener('transitionend', doodles.onDoodleFadeOutComplete);
+ e.target.removeEventListener(
+ 'transitionend', doodles.onDoodleFadeOutComplete);
};
@@ -499,7 +499,8 @@ doodles.applyDoodleMetadata = function() {
// Ping the static interaction_log_url if there is one.
if (doodles.targetDoodle.staticInteractionLogUrl) {
- navigator.sendBeacon(doodles.targetDoodle.staticInteractionLogUrl);
+ navigator.sendBeacon(
+ doodles.targetDoodle.staticInteractionLogUrl.href);
doodles.targetDoodle.staticInteractionLogUrl = null;
}
@@ -521,7 +522,8 @@ doodles.applyDoodleMetadata = function() {
// Ping the static interaction_log_url if there is one.
if (doodles.targetDoodle.staticInteractionLogUrl) {
- navigator.sendBeacon(doodles.targetDoodle.staticInteractionLogUrl);
+ navigator.sendBeacon(
+ doodles.targetDoodle.staticInteractionLogUrl.href);
doodles.targetDoodle.staticInteractionLogUrl = null;
}
@@ -542,7 +544,7 @@ doodles.applyDoodleMetadata = function() {
// Ping the animated interaction_log_url if there is one.
if (doodles.targetDoodle.animatedInteractionLogUrl) {
navigator.sendBeacon(
- doodles.targetDoodle.animatedInteractionLogUrl);
+ doodles.targetDoodle.animatedInteractionLogUrl.href);
doodles.targetDoodle.animatedInteractionLogUrl = null;
}
diff --git a/chromium/chrome/browser/resources/local_ntp/externs.js b/chromium/chrome/browser/resources/local_ntp/externs.js
new file mode 100644
index 00000000000..4b4aa1ce61a
--- /dev/null
+++ b/chromium/chrome/browser/resources/local_ntp/externs.js
@@ -0,0 +1,382 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview Externs for objects sent from C++ to
+ * chrome-search://local-ntp/local-ntp.html.
+ * @externs
+ */
+
+/**
+ * The type of the most visited data object. The definition is based on
+ * chrome/common/search/instant_types.h:
+ * InstantMostVisitedItem
+ * @typedef {{dataGenerationTime: Date,
+ * isAddButton: boolean,
+ * tid: number,
+ * tileSource: number,
+ * tileTitleSource: number,
+ * title: ?,
+ * url: string}}
+ */
+let MostVisitedData;
+
+/**
+ * The type of the config data object. The definition is based on
+ * chrome/browser/search/local_ntp_source.cc:
+ * LocalNtpSource::SearchConfigurationProvider::UpdateConfigData()
+ * @typedef {{translatedStrings: Array<string>,
+ * isGooglePage: boolean,
+ * googleBaseUrl: string,
+ * isAccessibleBrowser: boolean,
+ * removeFakebox: boolean,
+ * alternateFakebox: boolean,
+ * fakeboxSearchIcon: boolean,
+ * hideShortcuts: boolean}}
+ */
+let configData;
+
+/**
+ * The type of the image collections object. The definition is based on
+ * chrome/browser/search/local_ntp_source.cc:
+ * ConvertCollectionInfoToDict()
+ * @typedef {{collectionId: string,
+ * collectionName: string,
+ * previewImageUrl: string}}
+ */
+let coll;
+
+/**
+ * The type of the individual image data object. The definition is based on
+ * chrome/browser/search/local_ntp_source.cc:
+ * ConvertCollectionImageToDict()
+ * @typedef {{thumbnailImageUrl: string,
+ * imageUrl: string,
+ * collectionId: string,
+ * attributions: Array<string>,
+ * attributionActionUrl: string}}
+ */
+let collImg;
+
+/**
+ * The type of the errors when fetching individual images object. The
+ * definition is based on
+ * chrome/browser/search/local_ntp_source.cc:
+ * GetErrorDict()
+ * @typedef {{net_error: boolean,
+ * service_error: boolean,
+ * net_error_no: number}}
+ */
+let collImgErrors;
+
+/**
+ * The type of the errors when fetching collection object. The definition is
+ * based on
+ * chrome/browser/search/local_ntp_source.cc:
+ * GetErrorDict()
+ * @typedef {{net_error: boolean,
+ * service_error: boolean,
+ * net_error_no: number}}
+ */
+let collErrors;
+
+/**
+ * The type of the Doodle data object. The definition is based on
+ * chrome/browser/search/local_ntp_source.cc:
+ * LocalNtpSource::DesktopLogoObserver::OnLogoAvailable()
+ * @typedef {{usable: boolean,
+ * image: string,
+ * metadata: string}}
+ */
+let ddl;
+
+/**
+ * The type of the OneGoogleBar data object. The definition is based on
+ * chrome/browser/search/local_ntp_source.cc:
+ * ConvertOGBDataToDict()
+ * @typedef {{barHtml: string,
+ * inHeadScript: string,
+ * inHeadStyle: string,
+ * afterBarScript: string,
+ * endOfBodyHtml: string,
+ * endOfBodyScript: string}}
+ */
+let og;
+
+/**
+ * The type of the middle-slot promo data object. The definition is based on
+ * chrome/browser/search/local_ntp_source.cc:
+ * ConvertPromoDataToDict()
+ * @typedef {{promoHtml: string,
+ * promoLogUrl: string}}
+ */
+let promo;
+
+/**
+ * The type of the search suggestions data object. The definition is based on
+ * chrome/browser/search/local_ntp_source.cc:
+ * ConvertSearchSuggestDataToDict()
+ * @typedef {{suggestionsHtml: string,
+ * suggestionsEndOfBodyScript: string}}
+ */
+let searchSuggestions;
+
+/**
+ * Types created by the OneGoogleBar scripts when injected into the page.
+ * Defined in google3/javascript/externs/api/one_google/gbar.js
+ */
+window.gbar;
+window.gbar.a;
+window.gbar.a.pc;
+
+/**
+ * Used for running NTP javascript unit tests. Defined in
+ * src/chrome/test/data/local_ntp/local_ntp_browsertest.html
+ */
+window.localNTPUnitTest;
+
+/**************************** Embedded Search API ****************************/
+
+/**
+ * Embedded Search API methods defined in
+ * chrome/renderer/searchbox/searchbox_extension.cc:
+ * NewTabPageBindings::GetObjectTemplateBuilder()
+ */
+
+window.chrome;
+window.chrome.embeddedSearch;
+window.chrome.embeddedSearch.newTabPage;
+
+/**
+ * @param {number} task_version
+ * @param {number} task_id
+ */
+window.chrome.embeddedSearch.newTabPage.blacklistSearchSuggestion;
+
+/**
+ * @param {number} task_version
+ * @param {number} task_id
+ * @param {string} hash
+ */
+window.chrome.embeddedSearch.newTabPage.blacklistSearchSuggestionWithHash;
+
+/**
+ * @param {string} identity
+ */
+window.chrome.embeddedSearch.newTabPage.checkIsUserSignedIntoChromeAs;
+
+/**
+ * No params.
+ */
+window.chrome.embeddedSearch.newTabPage.checkIsUserSyncingHistory;
+
+/**
+ * @param {number} tid
+ */
+window.chrome.embeddedSearch.newTabPage.deleteMostVisitedItem;
+
+/**
+ * @param {string} url
+ */
+window.chrome.embeddedSearch.newTabPage.fixupAndValidateUrl;
+
+/**
+ * @param {number} tid
+ */
+window.chrome.embeddedSearch.newTabPage.getMostVisitedItemData;
+
+/**
+ * @return {boolean} isCustomLinks
+ */
+window.chrome.embeddedSearch.newTabPage.isCustomLinks;
+
+/**
+ * @return {boolean} isInputInProgress
+ */
+window.chrome.embeddedSearch.newTabPage.isInputInProgress;
+
+/**
+ * @param {number} event
+ */
+window.chrome.embeddedSearch.newTabPage.logEvent;
+
+/**
+ * @param {number} position
+ * @param {number} tile_title_source
+ * @param {number} tile_source
+ * @param {number} tile_type
+ * @param {number} data_generation_time
+ */
+window.chrome.embeddedSearch.newTabPage.logMostVisitedImpression;
+
+/**
+ * @param {number} position
+ * @param {number} tile_title_source
+ * @param {number} tile_source
+ * @param {number} tile_type
+ * @param {number} data_generation_time
+ */
+window.chrome.embeddedSearch.newTabPage.logMostVisitedNavigation;
+
+/**
+ * No params.
+ */
+window.chrome.embeddedSearch.newTabPage.mostVisited;
+
+/**
+ * @return {boolean} mostVisitedAvailable
+ */
+window.chrome.embeddedSearch.newTabPage.mostVisitedAvailable;
+
+/**
+ * No params.
+ */
+window.chrome.embeddedSearch.newTabPage.optOutOfSearchSuggestions;
+
+/**
+ * @param {number} rid
+ * @param {number} new_pos
+ */
+window.chrome.embeddedSearch.newTabPage.reorderCustomLink;
+
+/**
+ * No params.
+ */
+window.chrome.embeddedSearch.newTabPage.resetCustomLinks;
+
+/**
+ * @param {number} task_version
+ * @param {number} task_id
+ * @param {string} hash
+ */
+window.chrome.embeddedSearch.newTabPage.searchSuggestionSelected;
+
+/**
+ * No params.
+ */
+window.chrome.embeddedSearch.newTabPage.selectLocalBackgroundImage;
+
+/**
+ * @param {string} background_url
+ */
+window.chrome.embeddedSearch.newTabPage.setBackgroundURL;
+
+/**
+ * @param {string} background_url
+ * @param {string} attribution_line_1
+ * @param {string} attribution_line_2
+ * @param {string} attribution_action_url
+ */
+window.chrome.embeddedSearch.newTabPage.setBackgroundURLWithAttributions;
+
+/**
+ * @return {Object} theme_background_info
+ */
+window.chrome.embeddedSearch.newTabPage.themeBackgroundInfo;
+
+/**
+ * No params.
+ */
+window.chrome.embeddedSearch.newTabPage.undoAllMostVisitedDeletions;
+
+/**
+ * No params.
+ */
+window.chrome.embeddedSearch.newTabPage.undoCustomLinkAction;
+
+/**
+ * @param {number} rid_value
+ */
+window.chrome.embeddedSearch.newTabPage.undoMostVisitedDeletion;
+
+/**
+ * @param {number} rid
+ * @param {string} url
+ */
+window.chrome.embeddedSearch.newTabPage.updateCustomLink;
+
+/**
+ * Embedded Search API methods defined in
+ * chrome/renderer/searchbox/searchbox_extension.cc:
+ * SearchBoxBindings::GetObjectTemplateBuilder()
+ */
+window.chrome.embeddedSearch.searchBox;
+window.chrome.embeddedSearch.searchBox.isKeyCaptureEnabled;
+window.chrome.embeddedSearch.searchBox.paste;
+window.chrome.embeddedSearch.searchBox.startCapturingKeyStrokes;
+window.chrome.embeddedSearch.searchBox.stopCapturingKeyStrokes;
+
+
+/**************************** Translated Strings *****************************/
+
+/**
+ * Translated strings defined in
+ * chrome/browser/search/local_ntp_source.cc:
+ * GetTranslatedStrings()
+ */
+
+configData.translatedStrings.addLinkTitle;
+configData.translatedStrings.addLinkTooltip;
+configData.translatedStrings.attributionIntro;
+configData.translatedStrings.audioError;
+configData.translatedStrings.backLabel;
+configData.translatedStrings.backgroundsUnavailable;
+configData.translatedStrings.clickToViewDoodle;
+configData.translatedStrings.connectionError;
+configData.translatedStrings.connectionErrorNoPeriod;
+configData.translatedStrings.copyLink;
+configData.translatedStrings.customizeBackground;
+configData.translatedStrings.customizeButtonLabel;
+configData.translatedStrings.customizeThisPage;
+configData.translatedStrings.dailyRefresh;
+configData.translatedStrings.defaultWallpapers;
+configData.translatedStrings.details;
+configData.translatedStrings.editLinkTitle;
+configData.translatedStrings.editLinkTooltip;
+configData.translatedStrings.fakeboxMicrophoneTooltip;
+configData.translatedStrings.invalidUrl;
+configData.translatedStrings.languageError;
+configData.translatedStrings.learnMore;
+configData.translatedStrings.linkAddedMsg;
+configData.translatedStrings.linkCancel;
+configData.translatedStrings.linkCantCreate;
+configData.translatedStrings.linkCantEdit;
+configData.translatedStrings.linkCantRemove;
+configData.translatedStrings.linkDone;
+configData.translatedStrings.linkEditedMsg;
+configData.translatedStrings.linkRemove;
+configData.translatedStrings.linkRemovedMsg;
+configData.translatedStrings.listening;
+configData.translatedStrings.moreInfo;
+configData.translatedStrings.mostVisitedTitle;
+configData.translatedStrings.nameField;
+configData.translatedStrings.networkError;
+configData.translatedStrings.noTranslation;
+configData.translatedStrings.noVoice;
+configData.translatedStrings.otherError;
+configData.translatedStrings.permissionError;
+configData.translatedStrings.ready;
+configData.translatedStrings.removeThumbnailTooltip;
+configData.translatedStrings.restoreDefaultBackground;
+configData.translatedStrings.restoreDefaultLinks;
+configData.translatedStrings.restoreThumbnailsShort;
+configData.translatedStrings.searchboxPlaceholder;
+configData.translatedStrings.selectChromeWallpaper;
+configData.translatedStrings.selectedLabel;
+configData.translatedStrings.selectionCancel;
+configData.translatedStrings.selectionDone;
+configData.translatedStrings.shareClose;
+configData.translatedStrings.shareDoodle;
+configData.translatedStrings.shareFacebook;
+configData.translatedStrings.shareLink;
+configData.translatedStrings.shareMail;
+configData.translatedStrings.shareTwitter;
+configData.translatedStrings.thumbnailRemovedNotification;
+configData.translatedStrings.title;
+configData.translatedStrings.tryAgain;
+configData.translatedStrings.undoThumbnailRemove;
+configData.translatedStrings.uploadImage;
+configData.translatedStrings.urlField;
+configData.translatedStrings.voiceCloseTooltip;
+configData.translatedStrings.waiting;
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/add.svg b/chromium/chrome/browser/resources/local_ntp/icons/add.svg
index 3b6431404e0..5eaf5f5f757 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/add.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/add.svg
@@ -1,6 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
- <g fill="none" fill-rule="evenodd">
- <rect width="2" height="12" x="7" y="2" fill="#616161"/>
- <rect width="2" height="12" x="7" y="2" fill="#616161" transform="rotate(-90 8 8)"/>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#616161" fill-rule="evenodd"><path d="M7 2h2v12H7z"/><path d="M2 9V7h12v2z"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/add_link.svg b/chromium/chrome/browser/resources/local_ntp/icons/add_link.svg
index 05b83a554f6..27c4df0a61b 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/add_link.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/add_link.svg
@@ -1,6 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
- <g fill="none" fill-rule="evenodd">
- <rect width="2" height="12" x="7" y="2" fill="#202124"/>
- <rect width="2" height="12" x="7" y="2" fill="#202124" transform="rotate(-90 8 8)"/>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#202124" fill-rule="evenodd"><path d="M7 2h2v12H7z"/><path d="M2 9V7h12v2z"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/add_link_white.svg b/chromium/chrome/browser/resources/local_ntp/icons/add_link_white.svg
index c491f52db79..c0a2987c763 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/add_link_white.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/add_link_white.svg
@@ -1,6 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
- <g fill="none" fill-rule="evenodd">
- <rect width="2" height="12" x="7" y="2" fill="#E8EAED"/>
- <rect width="2" height="12" x="7" y="2" fill="#E8EAED" transform="rotate(-90 8 8)"/>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#E8EAED" fill-rule="evenodd"><path d="M7 2h2v12H7z"/><path d="M2 9V7h12v2z"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/chrome.svg b/chromium/chrome/browser/resources/local_ntp/icons/chrome.svg
index ed46b770554..0114b6f485d 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/chrome.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/chrome.svg
@@ -1,8 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
- <defs>
- <path id="chrome_16dp-a" d="M8,5.3 L13.34,5.3 C12.38,3.32 10.34,2 8,2 C6.14,2 4.46,2.84 3.38,4.16 L5.36,7.58 C5.54,6.32 6.68,5.3 8,5.3 L8,5.3 Z M8,10.7 C6.98,10.7 6.14,10.16 5.66,9.32 L2.96,4.7 C2.36,5.66 2,6.8 2,8 C2,11 4.16,13.46 7.04,13.94 L9.02,10.52 C8.66,10.64 8.36,10.7 8,10.7 L8,10.7 Z M10.7,8 C10.7,7.16 10.28,6.38 9.68,5.9 L13.64,5.9 C13.88,6.56 14,7.28 14,8 C14,11.3 11.3,14 8,14 L7.64,14 L10.34,9.32 C10.58,8.96 10.7,8.48 10.7,8 Z M8,10.1 C6.84020203,10.1 5.9,9.15979797 5.9,8 C5.9,6.84020203 6.84020203,5.9 8,5.9 C9.15979797,5.9 10.1,6.84020203 10.1,8 C10.1,9.15979797 9.15979797,10.1 8,10.1 Z"/>
- </defs>
- <g fill="none" fill-rule="evenodd">
- <use fill="#5F6368" xlink:href="#chrome_16dp-a"/>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><defs><path id="a" d="M8 5.3h5.34C12.38 3.32 10.34 2 8 2c-1.86 0-3.54.84-4.62 2.16l1.98 3.42C5.54 6.32 6.68 5.3 8 5.3zm0 5.4c-1.02 0-1.86-.54-2.34-1.38L2.96 4.7C2.36 5.66 2 6.8 2 8c0 3 2.16 5.46 5.04 5.94l1.98-3.42c-.36.12-.66.18-1.02.18zM10.7 8c0-.84-.42-1.62-1.02-2.1h3.96c.24.66.36 1.38.36 2.1 0 3.3-2.7 6-6 6h-.36l2.7-4.68c.24-.36.36-.84.36-1.32zM8 10.1a2.1 2.1 0 1 1 0-4.2 2.1 2.1 0 0 1 0 4.2z"/></defs><use fill="#5F6368" xlink:href="#a" fill-rule="evenodd"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/close.svg b/chromium/chrome/browser/resources/local_ntp/icons/close.svg
index e74a9812a6d..282fa77de8f 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/close.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/close.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.a{fill:none;stroke:#4d4d4d;stroke-miterlimit:10;stroke-width:3px;}</style></defs><title>Untitled-2</title><line class="a" x1="3.5" y1="3.5" x2="21" y2="21"/><line class="a" x1="3.5" y1="21" x2="21" y2="3.5"/></svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><defs><style>.a{fill:none;stroke:#4d4d4d;stroke-miterlimit:10;stroke-width:3px}</style></defs><path class="a" d="M3.5 3.5L21 21M3.5 21L21 3.5"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/copy.svg b/chromium/chrome/browser/resources/local_ntp/icons/copy.svg
index affb359bb61..fd4c870c66d 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/copy.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/copy.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><defs><style>.a{fill:#666;}.b{fill:none;stroke:#666;stroke-miterlimit:10;stroke-width:4px;}</style></defs><title>Untitled-1</title><path class="a" d="M35.25,14a.76.76,0,0,1,.75.75v25.5a.76.76,0,0,1-.75.75H18.75a.76.76,0,0,1-.75-.75V14.75a.76.76,0,0,1,.75-.75h16.5m0-4H18.75A4.77,4.77,0,0,0,14,14.75v25.5A4.77,4.77,0,0,0,18.75,45h16.5A4.77,4.77,0,0,0,40,40.25V14.75A4.77,4.77,0,0,0,35.25,10Z"/><path class="b" d="M9,38V9.75A4.77,4.77,0,0,1,13.75,5H32.91"/></svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M35.25 14a.76.76 0 0 1 .75.75v25.5a.76.76 0 0 1-.75.75h-16.5a.76.76 0 0 1-.75-.75v-25.5a.76.76 0 0 1 .75-.75h16.5m0-4h-16.5A4.77 4.77 0 0 0 14 14.75v25.5A4.77 4.77 0 0 0 18.75 45h16.5A4.77 4.77 0 0 0 40 40.25v-25.5A4.77 4.77 0 0 0 35.25 10z" fill="#666"/><path d="M9 38V9.75A4.77 4.77 0 0 1 13.75 5h19.16" fill="none" stroke="#666" stroke-miterlimit="10" stroke-width="4"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/edit_menu.svg b/chromium/chrome/browser/resources/local_ntp/icons/edit_menu.svg
index a0feae1ae49..76656662b46 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/edit_menu.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/edit_menu.svg
@@ -1,7 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
- <g fill="none" fill-rule="evenodd">
- <circle cx="6" cy="3" r="1" fill="#000"/>
- <circle cx="6" cy="6" r="1" fill="#000"/>
- <circle cx="6" cy="9" r="1" fill="#000"/>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12"><g fill="#000" fill-rule="evenodd"><circle cx="6" cy="3" r="1"/><circle cx="6" cy="6" r="1"/><circle cx="6" cy="9" r="1"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/facebook.svg b/chromium/chrome/browser/resources/local_ntp/icons/facebook.svg
index 02a8ebc8572..dbf2fd8aa42 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/facebook.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/facebook.svg
@@ -1,12 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="48px" height="48px"
- viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
-<style type="text/css">
- .st0{fill:#3A589B;}
- .st1{fill:#FFFFFF;}
-</style>
-<path class="st0" d="M43.5,48h-39C2,48,0,46,0,43.5v-39C0,2,2,0,4.5,0h39C46,0,48,2,48,4.5v39C48,46,46,48,43.5,48z"/>
-<g>
- <path class="st1" d="M39.4,29.4l0.9-7.3h-7.2v-4.7c0-2.1,0.6-3.5,3.6-3.5h3.8V7.5c-0.7-0.1-2.9-0.3-5.6-0.3c-5.5,0-9.3,3.4-9.3,9.6
- v5.3h-6.2v7.3h6.2V48h7.5V29.4H39.4z"/>
-</g>
-</svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M43.5 48h-39C2 48 0 46 0 43.5v-39C0 2 2 0 4.5 0h39C46 0 48 2 48 4.5v39c0 2.5-2 4.5-4.5 4.5z" fill="#3a589b"/><path d="M39.4 29.4l.9-7.3h-7.2v-4.7c0-2.1.6-3.5 3.6-3.5h3.8V7.5c-.7-.1-2.9-.3-5.6-.3-5.5 0-9.3 3.4-9.3 9.6v5.3h-6.2v7.3h6.2V48h7.5V29.4h6.3z" fill="#fff"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/googlemic_clr_24px.svg b/chromium/chrome/browser/resources/local_ntp/icons/googlemic_clr_24px.svg
index 9e18d9e33fe..05068f863ff 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/googlemic_clr_24px.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/googlemic_clr_24px.svg
@@ -1,7 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
- <path fill="none" d="M0 0h24v24H0z"/>
- <path fill="#4285F4" d="M12 15c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v7c0 1.66 1.34 3 3 3z"/>
- <path fill="#34A853" d="M11 18.92h2V22h-2z"/>
- <path fill="#F4B400" d="M7 12H5c0 1.93.78 3.68 2.05 4.95l1.41-1.41C7.56 14.63 7 13.38 7 12z"/>
- <path fill="#EA4335" d="M12 17c-1.38 0-2.63-.56-3.54-1.47l-1.41 1.41C8.32 18.21 10.07 19 12.01 19c3.87 0 6.98-3.14 6.98-7h-2c0 2.76-2.23 5-4.99 5z"/>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path fill="#4285F4" d="M12 15c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v7c0 1.66 1.34 3 3 3z"/><path fill="#34A853" d="M11 18.92h2V22h-2z"/><path fill="#F4B400" d="M7 12H5c0 1.93.78 3.68 2.05 4.95l1.41-1.41C7.56 14.63 7 13.38 7 12z"/><path fill="#EA4335" d="M12 17c-1.38 0-2.63-.56-3.54-1.47l-1.41 1.41A6.99 6.99 0 0 0 12.01 19c3.87 0 6.98-3.14 6.98-7h-2c0 2.76-2.23 5-4.99 5z"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/icon_pencil.svg b/chromium/chrome/browser/resources/local_ntp/icons/icon_pencil.svg
index 4cafc07722c..b3dc49f1c3d 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/icon_pencil.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/icon_pencil.svg
@@ -1,4 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
- <path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/>
- <path d="M0 0h24v24H0z" fill="none"/>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/><path d="M0 0h24v24H0z" fill="none"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/link.svg b/chromium/chrome/browser/resources/local_ntp/icons/link.svg
index 3300cd64a88..6f1d5f40ca4 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/link.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/link.svg
@@ -1,6 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
- <g fill="none" fill-rule="evenodd">
- <polygon points="0 0 16 0 16 16 0 16"/>
- <path fill="#fff" fill-rule="nonzero" d="M1.52,8 C1.52,6.632 2.632,5.52 4,5.52 L7.2,5.52 L7.2,4 L4,4 C1.792,4 0,5.792 0,8 C0,10.208 1.792,12 4,12 L7.2,12 L7.2,10.48 L4,10.48 C2.632,10.48 1.52,9.368 1.52,8 Z M4.8,8.8 L11.2,8.8 L11.2,7.2 L4.8,7.2 L4.8,8.8 Z M12,4 L8.8,4 L8.8,5.52 L12,5.52 C13.368,5.52 14.48,6.632 14.48,8 C14.48,9.368 13.368,10.48 12,10.48 L8.8,10.48 L8.8,12 L12,12 C14.208,12 16,10.208 16,8 C16,5.792 14.208,4 12,4 Z"/>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="none" fill-rule="evenodd"><path d="M0 0h16v16H0z"/><path fill="#fff" fill-rule="nonzero" d="M1.52 8A2.482 2.482 0 0 1 4 5.52h3.2V4H4C1.792 4 0 5.792 0 8s1.792 4 4 4h3.2v-1.52H4A2.482 2.482 0 0 1 1.52 8zm3.28.8h6.4V7.2H4.8v1.6zM12 4H8.8v1.52H12A2.482 2.482 0 0 1 14.48 8 2.482 2.482 0 0 1 12 10.48H8.8V12H12c2.208 0 4-1.792 4-4s-1.792-4-4-4z"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/link_gray.svg b/chromium/chrome/browser/resources/local_ntp/icons/link_gray.svg
index 0072bcebe91..44625b19349 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/link_gray.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/link_gray.svg
@@ -1,6 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
- <g fill="none" fill-rule="evenodd">
- <polygon points="0 0 16 0 16 16 0 16"/>
- <path fill="#5F6368" fill-rule="nonzero" d="M1.52,8 C1.52,6.632 2.632,5.52 4,5.52 L7.2,5.52 L7.2,4 L4,4 C1.792,4 0,5.792 0,8 C0,10.208 1.792,12 4,12 L7.2,12 L7.2,10.48 L4,10.48 C2.632,10.48 1.52,9.368 1.52,8 Z M4.8,8.8 L11.2,8.8 L11.2,7.2 L4.8,7.2 L4.8,8.8 Z M12,4 L8.8,4 L8.8,5.52 L12,5.52 C13.368,5.52 14.48,6.632 14.48,8 C14.48,9.368 13.368,10.48 12,10.48 L8.8,10.48 L8.8,12 L12,12 C14.208,12 16,10.208 16,8 C16,5.792 14.208,4 12,4 Z"/>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="none" fill-rule="evenodd"><path d="M0 0h16v16H0z"/><path fill="#5F6368" fill-rule="nonzero" d="M1.52 8A2.482 2.482 0 0 1 4 5.52h3.2V4H4C1.792 4 0 5.792 0 8s1.792 4 4 4h3.2v-1.52H4A2.482 2.482 0 0 1 1.52 8zm3.28.8h6.4V7.2H4.8v1.6zM12 4H8.8v1.52H12A2.482 2.482 0 0 1 14.48 8 2.482 2.482 0 0 1 12 10.48H8.8V12H12c2.208 0 4-1.792 4-4s-1.792-4-4-4z"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/mail.svg b/chromium/chrome/browser/resources/local_ntp/icons/mail.svg
index d6655dac9c4..8851e4298fc 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/mail.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/mail.svg
@@ -1,11 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" viewBox="0 0 48 48">
-<style type="text/css">
- .st0{fill:#9DA6AA;}
- .st1{fill:#FFFFFF;}
- .st2{fill:none;stroke:#9DA6AA;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
-</style>
-<path class="st0" d="M43.5,48h-39C2,48,0,46,0,43.5v-39C0,2,2,0,4.5,0h39C46,0,48,2,48,4.5v39C48,46,46,48,43.5,48z"/>
-<path class="st1" d="M35.9,12.8H12.1c-2.2,0-4,1.8-4,4v14.4c0,2.2,1.8,4,4,4h23.8c2.2,0,4-1.8,4-4V16.8
- C39.9,14.6,38.1,12.8,35.9,12.8z"/>
-<polyline class="st2" points="35.4,17.2 24,26.1 12.6,17.2 "/>
-</svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M43.5 48h-39C2 48 0 46 0 43.5v-39C0 2 2 0 4.5 0h39C46 0 48 2 48 4.5v39c0 2.5-2 4.5-4.5 4.5z" fill="#9da6aa"/><path d="M35.9 12.8H12.1c-2.2 0-4 1.8-4 4v14.4c0 2.2 1.8 4 4 4h23.8c2.2 0 4-1.8 4-4V16.8c0-2.2-1.8-4-4-4z" fill="#fff"/><path fill="none" stroke="#9da6aa" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M35.4 17.2L24 26.1l-11.4-8.9"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/twitter.svg b/chromium/chrome/browser/resources/local_ntp/icons/twitter.svg
index fb3570ade66..4aeae35c2bb 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/twitter.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/twitter.svg
@@ -1,12 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" viewBox="0 0 48 48">
-<style type="text/css">
- .st0{fill:#3AAAE1;}
- .st1{fill:#FFFFFF;}
-</style>
-<path class="st0" d="M43.5,48h-39C2,48,0,46,0,43.5v-39C0,2,2,0,4.5,0h39C46,0,48,2,48,4.5v39C48,46,46,48,43.5,48z"/>
-<path class="st1" d="M39.3,15.5c-1.1,0.5-2.3,0.8-3.5,0.9c1.2-0.7,2.2-1.9,2.6-3.3c-1.1,0.7-2.5,1.2-3.8,1.5
- c-1.1-1.1-2.6-1.9-4.4-1.9c-3.3,0-6,2.7-6,6c0,0.5,0.1,0.9,0.1,1.3c-4.9-0.3-9.4-2.6-12.4-6.3c-0.5,0.9-0.8,1.9-0.8,3
- c0,2,1.1,3.9,2.7,5c-1,0-1.9-0.3-2.7-0.8v0.1c0,2.9,2,5.3,4.8,5.9c-0.5,0.1-1.1,0.2-1.6,0.2c-0.4,0-0.8-0.1-1.1-0.1
- c0.8,2.4,3,4.1,5.6,4.2c-2,1.6-4.7,2.5-7.4,2.5c-0.5,0-1,0-1.4-0.1c2.7,1.7,5.8,2.7,9.2,2.7c11,0,17-9.1,17-17c0-0.3,0-0.5,0-0.8
- C37.5,17.7,38.5,16.7,39.3,15.5L39.3,15.5z"/>
-</svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M43.5 48h-39C2 48 0 46 0 43.5v-39C0 2 2 0 4.5 0h39C46 0 48 2 48 4.5v39c0 2.5-2 4.5-4.5 4.5z" fill="#3aaae1"/><path d="M39.3 15.5c-1.1.5-2.3.8-3.5.9 1.2-.7 2.2-1.9 2.6-3.3-1.1.7-2.5 1.2-3.8 1.5-1.1-1.1-2.6-1.9-4.4-1.9-3.3 0-6 2.7-6 6 0 .5.1.9.1 1.3-4.9-.3-9.4-2.6-12.4-6.3-.5.9-.8 1.9-.8 3 0 2 1.1 3.9 2.7 5-1 0-1.9-.3-2.7-.8v.1c0 2.9 2 5.3 4.8 5.9-.5.1-1.1.2-1.6.2-.4 0-.8-.1-1.1-.1.8 2.4 3 4.1 5.6 4.2-2 1.6-4.7 2.5-7.4 2.5-.5 0-1 0-1.4-.1 2.7 1.7 5.8 2.7 9.2 2.7 11 0 17-9.1 17-17v-.8c1.3-.8 2.3-1.8 3.1-3z" fill="#fff"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/upload.svg b/chromium/chrome/browser/resources/local_ntp/icons/upload.svg
index 78c3795cbab..3900228dcb6 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/upload.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/upload.svg
@@ -1,6 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
- <g fill="none" fill-rule="evenodd">
- <polygon fill="#000" fill-rule="nonzero" points="3 12 3 14 13 14 13 12"/>
- <polygon fill="#000" points="13 6.154 10.01 6.154 10.01 2 6.014 2 6.014 6.154 3 6.154 8 11" transform="rotate(-180 8 6.5)"/>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#000" fill-rule="evenodd"><path fill-rule="nonzero" d="M3 12v2h10v-2z"/><path d="M3 6.846h2.99V11h3.996V6.846H13L8 2z"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/wallpapers.svg b/chromium/chrome/browser/resources/local_ntp/icons/wallpapers.svg
index 73e795b276a..8f3a2a3624d 100644
--- a/chromium/chrome/browser/resources/local_ntp/icons/wallpapers.svg
+++ b/chromium/chrome/browser/resources/local_ntp/icons/wallpapers.svg
@@ -1,58 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24" viewBox="0 0 24 24">
- <defs>
- <circle id="group-a" cx="11.936" cy="11.932" r="11.932"/>
- <path id="group-c" d="M23.8277966,12.9152542 L16.779661,5.86711864 C16.3322034,5.29898305 15.6379661,4.93559322 14.859661,4.93559322 C13.7966102,4.93559322 12.8908475,5.61491525 12.5559322,6.5640678 L12.1355932,6.5640678 L11.3830508,5.37220339 C11.0264407,4.80813559 10.2020339,4.80813559 9.84542373,5.37220339 L3.53355932,15.3613559 C3.34779661,15.6555932 3.30847458,16.1613559 3.69355932,16.5138983 L11.0698305,23.8332203 C11.3559322,23.8535593 11.6433898,23.8644068 11.9349153,23.8644068 C18.1952542,23.8644068 23.3288136,19.0454237 23.8277966,12.9152542 Z"/>
- <linearGradient id="group-d" x1="18.237%" x2="80.781%" y1="16.317%" y2="82.979%">
- <stop offset="0%" stop-color="#1C3AA9" stop-opacity=".2"/>
- <stop offset="100%" stop-color="#1C3AA9" stop-opacity=".02"/>
- </linearGradient>
- <path id="group-f" d="M23.8277966,12.9152542 L16.779661,5.86711864 C16.3322034,5.29898305 15.6379661,4.93559322 14.859661,4.93559322 C13.7966102,4.93559322 12.8908475,5.61491525 12.5559322,6.5640678 L12.1355932,6.5640678 L11.3830508,5.37220339 C11.0264407,4.80813559 10.2020339,4.80813559 9.84542373,5.37220339 L3.53355932,15.3613559 C3.34779661,15.6555932 3.30847458,16.1613559 3.69355932,16.5138983 L11.0698305,23.8332203 C11.3559322,23.8535593 11.6433898,23.8644068 11.9349153,23.8644068 C18.1952542,23.8644068 23.3288136,19.0454237 23.8277966,12.9152542 Z"/>
- <path id="group-h" d="M23.8277966,12.9152542 L16.779661,5.86711864 C16.3322034,5.29898305 15.6379661,4.93559322 14.859661,4.93559322 C13.7966102,4.93559322 12.8908475,5.61491525 12.5559322,6.5640678 L12.1355932,6.5640678 L11.3830508,5.37220339 C11.0264407,4.80813559 10.2020339,4.80813559 9.84542373,5.37220339 L3.53355932,15.3613559 C3.34779661,15.6555932 3.30847458,16.1613559 3.69355932,16.5138983 L11.0698305,23.8332203 C11.3559322,23.8535593 11.6433898,23.8644068 11.9349153,23.8644068 C18.1952542,23.8644068 23.3288136,19.0454237 23.8277966,12.9152542 Z"/>
- <path id="group-j" d="M23.8277966,12.9152542 L16.779661,5.86711864 C16.3322034,5.29898305 15.6379661,4.93559322 14.859661,4.93559322 C13.7966102,4.93559322 12.8908475,5.61491525 12.5559322,6.5640678 L12.1355932,6.5640678 L11.3830508,5.37220339 C11.0264407,4.80813559 10.2020339,4.80813559 9.84542373,5.37220339 L3.53355932,15.3613559 C3.34779661,15.6555932 3.30847458,16.1613559 3.69355932,16.5138983 L11.0698305,23.8332203 C11.3559322,23.8535593 11.6433898,23.8644068 11.9349153,23.8644068 C18.1952542,23.8644068 23.3288136,19.0454237 23.8277966,12.9152542 Z"/>
- <path id="group-l" d="M23.8277966,12.9152542 L16.779661,5.86711864 C16.3322034,5.29898305 15.6379661,4.93559322 14.859661,4.93559322 C13.7966102,4.93559322 12.8908475,5.61491525 12.5559322,6.5640678 L12.1355932,6.5640678 L11.3830508,5.37220339 C11.0264407,4.80813559 10.2020339,4.80813559 9.84542373,5.37220339 L3.53355932,15.3613559 C3.34779661,15.6555932 3.30847458,16.1613559 3.69355932,16.5138983 L11.0698305,23.8332203 C11.3559322,23.8535593 11.6433898,23.8644068 11.9349153,23.8644068 C18.1952542,23.8644068 23.3288136,19.0454237 23.8277966,12.9152542 Z"/>
- <path id="group-n" d="M23.8277966,12.9152542 L16.779661,5.86711864 C16.3322034,5.29898305 15.6379661,4.93559322 14.859661,4.93559322 C13.7966102,4.93559322 12.8908475,5.61491525 12.5559322,6.5640678 L12.1355932,6.5640678 L11.3830508,5.37220339 C11.0264407,4.80813559 10.2020339,4.80813559 9.84542373,5.37220339 L3.53355932,15.3613559 C3.34779661,15.6555932 3.30847458,16.1613559 3.69355932,16.5138983 L11.0698305,23.8332203 C11.3559322,23.8535593 11.6433898,23.8644068 11.9349153,23.8644068 C18.1952542,23.8644068 23.3288136,19.0454237 23.8277966,12.9152542 Z"/>
- <path id="group-p" d="M23.8277966,12.9152542 L16.779661,5.86711864 C16.3322034,5.29898305 15.6379661,4.93559322 14.859661,4.93559322 C13.7966102,4.93559322 12.8908475,5.61491525 12.5559322,6.5640678 L12.1355932,6.5640678 L11.3830508,5.37220339 C11.0264407,4.80813559 10.2020339,4.80813559 9.84542373,5.37220339 L3.53355932,15.3613559 C3.34779661,15.6555932 3.30847458,16.1613559 3.69355932,16.5138983 L11.0698305,23.8332203 C11.3559322,23.8535593 11.6433898,23.8644068 11.9349153,23.8644068 C18.1952542,23.8644068 23.3288136,19.0454237 23.8277966,12.9152542 Z"/>
- <linearGradient id="group-r" x1="14.132%" x2="85.172%" y1="14.136%" y2="85.175%">
- <stop offset="0%" stop-color="#FFF" stop-opacity=".1"/>
- <stop offset="100%" stop-color="#FFF" stop-opacity="0"/>
- </linearGradient>
- </defs>
- <g fill="none" fill-rule="evenodd">
- <mask id="group-b" fill="#fff">
- <use xlink:href="#group-a"/>
- </mask>
- <circle cx="11.936" cy="11.932" r="11.932" fill="#4285F4" fill-rule="nonzero" mask="url(#group-b)"/>
- <mask id="group-e" fill="#fff">
- <use xlink:href="#group-c"/>
- </mask>
- <path fill="url(#group-d)" fill-rule="nonzero" d="M23.8277966,12.9152542 L16.779661,5.86711864 C16.3322034,5.29898305 15.6379661,4.93559322 14.859661,4.93559322 C13.7966102,4.93559322 12.8908475,5.61491525 12.5559322,6.5640678 L12.1355932,6.5640678 L11.3830508,5.37220339 C11.0264407,4.80813559 10.2020339,4.80813559 9.84542373,5.37220339 L3.53355932,15.3613559 C3.34779661,15.6555932 3.30169492,16.1694915 3.71525424,16.5315254 L11.2881356,24.1044068 C11.3559322,23.8549153 11.6447458,23.8657627 11.9362712,23.8657627 C18.1952542,23.8644068 23.3288136,19.0454237 23.8277966,12.9152542 Z" mask="url(#group-e)"/>
- <mask id="group-g" fill="#fff">
- <use xlink:href="#group-f"/>
- </mask>
- <path fill="#EEE" fill-rule="nonzero" d="M20.3376271,15.3613559 L18.3498305,12.2155932 C17.9932203,11.6515254 17.1688136,11.6515254 16.8122034,12.2155932 L16.260339,13.0888136 L11.3844068,5.37220339 C11.0277966,4.80813559 10.2033898,4.80813559 9.84677966,5.37220339 L3.53491525,15.3613559 C3.15525424,15.9633898 3.58915254,16.7457627 4.30372881,16.7457627 L19.5688136,16.7457627 C20.2833898,16.7457627 20.7172881,15.9633898 20.3376271,15.3613559 Z" mask="url(#group-g)"/>
- <mask id="group-i" fill="#fff">
- <use xlink:href="#group-h"/>
- </mask>
- <path fill="#FFF" fill-opacity=".4" fill-rule="nonzero" d="M3.53491525,15.4969492 L9.84677966,5.50779661 C10.2033898,4.94372881 11.0277966,4.94372881 11.3844068,5.50779661 L16.260339,13.2244068 L16.8122034,12.3511864 C17.1688136,11.7871186 17.9932203,11.7871186 18.3498305,12.3511864 L20.3376271,15.4969492 C20.4216949,15.6298305 20.4637288,15.7708475 20.4745763,15.9105085 C20.4894915,15.7274576 20.4488136,15.5376271 20.3376271,15.3613559 L18.3498305,12.2155932 C17.9932203,11.6515254 17.1688136,11.6515254 16.8122034,12.2155932 L16.260339,13.0888136 L11.3844068,5.37220339 C11.0277966,4.80813559 10.2033898,4.80813559 9.84677966,5.37220339 L3.53491525,15.3613559 C3.42372881,15.5362712 3.38440678,15.7274576 3.3979661,15.9105085 C3.40881356,15.7708475 3.45084746,15.6298305 3.53491525,15.4969492 Z" mask="url(#group-i)"/>
- <mask id="group-k" fill="#fff">
- <use xlink:href="#group-j"/>
- </mask>
- <path fill="#A1C2FA" fill-rule="nonzero" d="M11.9932203,6.5640678 L12.5559322,6.5640678 C12.8908475,5.61491525 13.7952542,4.93559322 14.859661,4.93559322 C16.2088136,4.93559322 17.3030508,6.02983051 17.3030508,7.37898305 C17.3030508,8.72813559 16.2088136,9.71118644 14.859661,9.71118644 L11.9932203,9.71118644 C11.0942373,9.71118644 10.3647458,9.11728814 10.3647458,8.21694915 C10.3647458,7.31661017 11.0942373,6.5640678 11.9932203,6.5640678 Z" mask="url(#group-k)"/>
- <mask id="group-m" fill="#fff">
- <use xlink:href="#group-l"/>
- </mask>
- <path fill="#212121" fill-opacity=".1" fill-rule="nonzero" d="M19.5688136,16.6101695 L4.30372881,16.6101695 C3.7979661,16.6101695 3.43322034,16.2169492 3.3979661,15.7735593 C3.36135593,16.2684746 3.74644068,16.7457627 4.30372881,16.7457627 L19.5688136,16.7457627 C20.1261017,16.7457627 20.5111864,16.2698305 20.4745763,15.7735593 C20.439322,16.2169492 20.0745763,16.6101695 19.5688136,16.6101695 Z" mask="url(#group-m)"/>
- <mask id="group-o" fill="#fff">
- <use xlink:href="#group-n"/>
- </mask>
- <path fill="#FFF" fill-opacity=".2" fill-rule="nonzero" d="M11.9932203,6.69966102 L12.5559322,6.69966102 C12.8908475,5.75050847 13.7952542,5.07118644 14.859661,5.07118644 C16.1857627,5.07118644 17.2637288,6.12881356 17.2989831,7.44677966 C17.2989831,7.42372881 17.3030508,7.4020339 17.3030508,7.37898305 C17.3030508,6.02983051 16.2088136,4.93559322 14.859661,4.93559322 C13.7966102,4.93559322 12.8908475,5.61491525 12.5559322,6.5640678 L11.9932203,6.5640678 C11.0942373,6.5640678 10.3647458,7.31661017 10.3647458,8.21694915 C10.3647458,8.24 10.3674576,8.26169492 10.3688136,8.28474576 C10.4040678,7.41423729 11.1172881,6.69966102 11.9932203,6.69966102 Z" mask="url(#group-o)"/>
- <mask id="group-q" fill="#fff">
- <use xlink:href="#group-p"/>
- </mask>
- <path fill="#1A237E" fill-opacity=".2" fill-rule="nonzero" d="M14.859661,9.70983051 L11.9932203,9.70983051 C11.1172881,9.70983051 10.4040678,9.14440678 10.3674576,8.28338983 C10.3661017,8.30644068 10.3633898,8.32813559 10.3633898,8.35118644 C10.3633898,9.25016949 11.0928814,9.84542373 11.9918644,9.84542373 L14.8583051,9.84542373 C16.2074576,9.84542373 17.3016949,8.86372881 17.3016949,7.51322034 C17.3016949,7.49016949 17.2989831,7.46847458 17.2976271,7.44542373 C17.2637288,8.75932203 16.1871186,9.70983051 14.859661,9.70983051 Z" mask="url(#group-q)"/>
- <path fill="#1A237E" fill-rule="nonzero" d="M11.9362712,23.7288136 C5.36813559,23.7288136 0.0406779661,18.4230508 0.00406779661,11.8644068 C0.00406779661,11.8874576 0.00271186441,11.9091525 0.00271186441,11.9322034 C0.00271186441,18.5220339 5.34508475,23.8644068 11.9349153,23.8644068 C18.5247458,23.8644068 23.8671186,18.5220339 23.8671186,11.9322034 C23.8671186,11.9091525 23.8657627,11.8874576 23.8657627,11.8644068 C23.8305085,18.4230508 18.5030508,23.7288136 11.9362712,23.7288136 Z" mask="url(#group-q)" opacity=".2"/>
- <path fill="#FFF" fill-rule="nonzero" d="M11.9362712,0.13559322 C18.5030508,0.13559322 23.8305085,5.44135593 23.8671186,12 C23.8671186,11.9769492 23.8684746,11.9552542 23.8684746,11.9322034 C23.8684746,5.34237288 18.5261017,0 11.9362712,0 C5.34644068,0 0.00406779661,5.34237288 0.00406779661,11.9322034 C0.00406779661,11.9552542 0.00542372881,11.9769492 0.00542372881,12 C0.0406779661,5.44135593 5.36813559,0.13559322 11.9362712,0.13559322 Z" mask="url(#group-q)" opacity=".2"/>
- <circle cx="11.936" cy="11.932" r="11.932" fill="url(#group-r)" fill-rule="nonzero" mask="url(#group-q)"/>
- <rect width="26.034" height="26.034" x="-1.081" y="-1.085" mask="url(#group-q)"/>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24"><defs><circle id="a" cx="11.936" cy="11.932" r="11.932"/><path id="c" d="M23.828 12.915L16.78 5.867a2.443 2.443 0 0 0-4.224.697h-.42l-.753-1.192a.91.91 0 0 0-1.538 0l-6.311 9.99a.91.91 0 0 0 .16 1.152l7.376 7.32c.286.02.573.03.865.03 6.26 0 11.394-4.819 11.893-10.949z"/><linearGradient id="d" x1="18.237%" x2="80.781%" y1="16.317%" y2="82.979%"><stop offset="0%" stop-color="#1C3AA9" stop-opacity=".2"/><stop offset="100%" stop-color="#1C3AA9" stop-opacity=".02"/></linearGradient><path id="f" d="M23.828 12.915L16.78 5.867a2.443 2.443 0 0 0-4.224.697h-.42l-.753-1.192a.91.91 0 0 0-1.538 0l-6.311 9.99a.91.91 0 0 0 .16 1.152l7.376 7.32c.286.02.573.03.865.03 6.26 0 11.394-4.819 11.893-10.949z"/><path id="h" d="M23.828 12.915L16.78 5.867a2.443 2.443 0 0 0-4.224.697h-.42l-.753-1.192a.91.91 0 0 0-1.538 0l-6.311 9.99a.91.91 0 0 0 .16 1.152l7.376 7.32c.286.02.573.03.865.03 6.26 0 11.394-4.819 11.893-10.949z"/><path id="j" d="M23.828 12.915L16.78 5.867a2.443 2.443 0 0 0-4.224.697h-.42l-.753-1.192a.91.91 0 0 0-1.538 0l-6.311 9.99a.91.91 0 0 0 .16 1.152l7.376 7.32c.286.02.573.03.865.03 6.26 0 11.394-4.819 11.893-10.949z"/><path id="l" d="M23.828 12.915L16.78 5.867a2.443 2.443 0 0 0-4.224.697h-.42l-.753-1.192a.91.91 0 0 0-1.538 0l-6.311 9.99a.91.91 0 0 0 .16 1.152l7.376 7.32c.286.02.573.03.865.03 6.26 0 11.394-4.819 11.893-10.949z"/><path id="n" d="M23.828 12.915L16.78 5.867a2.443 2.443 0 0 0-4.224.697h-.42l-.753-1.192a.91.91 0 0 0-1.538 0l-6.311 9.99a.91.91 0 0 0 .16 1.152l7.376 7.32c.286.02.573.03.865.03 6.26 0 11.394-4.819 11.893-10.949z"/><path id="p" d="M23.828 12.915L16.78 5.867a2.443 2.443 0 0 0-4.224.697h-.42l-.753-1.192a.91.91 0 0 0-1.538 0l-6.311 9.99a.91.91 0 0 0 .16 1.152l7.376 7.32c.286.02.573.03.865.03 6.26 0 11.394-4.819 11.893-10.949z"/><linearGradient id="r" x1="14.132%" x2="85.172%" y1="14.136%" y2="85.175%"><stop offset="0%" stop-color="#FFF" stop-opacity=".1"/><stop offset="100%" stop-color="#FFF" stop-opacity="0"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><circle cx="11.936" cy="11.932" r="11.932" fill="#4285F4" fill-rule="nonzero" mask="url(#b)"/><mask id="e" fill="#fff"><use xlink:href="#c"/></mask><path fill="url(#d)" fill-rule="nonzero" d="M23.828 12.915L16.78 5.867a2.443 2.443 0 0 0-4.224.697h-.42l-.753-1.192a.91.91 0 0 0-1.538 0l-6.311 9.99a.906.906 0 0 0 .181 1.17l7.573 7.572c.068-.25.357-.238.648-.238 6.26-.002 11.393-4.82 11.892-10.95z" mask="url(#e)"/><mask id="g" fill="#fff"><use xlink:href="#f"/></mask><path fill="#EEE" fill-rule="nonzero" d="M20.338 15.361l-1.988-3.145a.91.91 0 0 0-1.538 0l-.552.873-4.876-7.717a.91.91 0 0 0-1.537 0l-6.312 9.99a.903.903 0 0 0 .769 1.384h15.265a.903.903 0 0 0 .769-1.385z" mask="url(#g)"/><mask id="i" fill="#fff"><use xlink:href="#h"/></mask><path fill="#FFF" fill-opacity=".4" fill-rule="nonzero" d="M3.535 15.497l6.312-9.99a.91.91 0 0 1 1.537 0l4.876 7.717.552-.873a.91.91 0 0 1 1.538 0l1.988 3.146a.896.896 0 0 1 .137.414.884.884 0 0 0-.137-.55l-1.988-3.145a.91.91 0 0 0-1.538 0l-.552.873-4.876-7.717a.91.91 0 0 0-1.537 0l-6.312 9.99a.89.89 0 0 0-.137.549c.01-.14.053-.281.137-.414z" mask="url(#i)"/><mask id="k" fill="#fff"><use xlink:href="#j"/></mask><path fill="#A1C2FA" fill-rule="nonzero" d="M11.993 6.564h.563a2.444 2.444 0 0 1 4.747.815c0 1.35-1.094 2.332-2.443 2.332h-2.867c-.899 0-1.628-.594-1.628-1.494s.73-1.653 1.628-1.653z" mask="url(#k)"/><mask id="m" fill="#fff"><use xlink:href="#l"/></mask><path fill="#212121" fill-opacity=".1" fill-rule="nonzero" d="M19.569 16.61H4.304a.906.906 0 0 1-.906-.836.907.907 0 0 0 .906.972h15.265a.906.906 0 0 0 .906-.972.906.906 0 0 1-.906.836z" mask="url(#m)"/><mask id="o" fill="#fff"><use xlink:href="#n"/></mask><path fill="#FFF" fill-opacity=".2" fill-rule="nonzero" d="M11.993 6.7h.563a2.442 2.442 0 0 1 4.743.747c0-.023.004-.045.004-.068a2.444 2.444 0 0 0-4.747-.815h-.563c-.899 0-1.628.753-1.628 1.653 0 .023.002.045.004.068.035-.87.748-1.585 1.624-1.585z" mask="url(#o)"/><mask id="q" fill="#fff"><use xlink:href="#p"/></mask><path fill="#1A237E" fill-opacity=".2" fill-rule="nonzero" d="M14.86 9.71h-2.867c-.876 0-1.589-.566-1.626-1.427 0 .023-.004.045-.004.068 0 .9.73 1.494 1.629 1.494h2.866c1.35 0 2.444-.981 2.444-2.332 0-.023-.003-.045-.004-.068-.034 1.314-1.11 2.265-2.438 2.265z" mask="url(#q)"/><path fill="#1A237E" fill-rule="nonzero" d="M11.936 23.729C5.368 23.729.041 18.423.004 11.864l-.001.068c0 6.59 5.342 11.932 11.932 11.932 6.59 0 11.932-5.342 11.932-11.932l-.001-.068c-.035 6.56-5.363 11.865-11.93 11.865z" mask="url(#q)" opacity=".2"/><path fill="#FFF" fill-rule="nonzero" d="M11.936.136C18.503.136 23.831 5.44 23.867 12l.001-.068C23.868 5.342 18.526 0 11.936 0 5.346 0 .004 5.342.004 11.932L.005 12C.041 5.441 5.368.136 11.936.136z" mask="url(#q)" opacity=".2"/><circle cx="11.936" cy="11.932" r="11.932" fill="url(#r)" fill-rule="nonzero" mask="url(#q)"/><path mask="url(#q)" d="M-1.081-1.085h26.034v26.034H-1.081z"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/local_ntp/local_ntp.css b/chromium/chrome/browser/resources/local_ntp/local_ntp.css
index a1a0a790e02..c5c680359d2 100644
--- a/chromium/chrome/browser/resources/local_ntp/local_ntp.css
+++ b/chromium/chrome/browser/resources/local_ntp/local_ntp.css
@@ -239,14 +239,14 @@ html[dir=rtl] #fakebox-search-icon {
#fakebox-text {
bottom: 4px;
- color: rgb(var(--GG600-rgb));
+ color: rgb(var(--GG700-rgb));
font-size: 14px;
left: 0;
margin-top: 1px;
overflow: hidden;
padding-inline-start: 20px;
position: absolute;
- right: 13px;
+ right: 44px;
text-align: initial;
text-overflow: ellipsis;
top: 4px;
@@ -352,8 +352,8 @@ html[dir=rtl] #fakebox-microphone {
}
}
-body.fakebox-drag-focused #fakebox-text,
-body.fakebox-focused #fakebox-text {
+body.fakebox-drag-focused #fakebox-text:not(.show-placeholder),
+body.fakebox-focused #fakebox-text:not(.show-placeholder) {
visibility: hidden;
}
@@ -378,15 +378,11 @@ body.remove-fakebox #user-content {
}
#most-visited {
- margin-top: 56px;
- text-align: -webkit-center;
- user-select: none;
-}
-
-#most-visited.md-icons {
/* Total of 40px margin between fakebox and MV tiles: 8px fakebox
* margin-bottom + 22px here margin-top + 10px MV margin-top */
margin-top: 22px;
+ text-align: -webkit-center;
+ user-select: none;
}
/* Non-Google pages have no Fakebox, so don't need top margin. */
@@ -395,197 +391,116 @@ body.remove-fakebox #user-content {
}
#mv-tiles {
- /* Two rows of tiles of 128px each, 16px of spacing between the rows, and
- * 4px/8px of margin on top and bottom respectively. If you change this, also
- * change the corresponding values in most_visited_single.css. */
- height: calc(2*var(--tile-height) + var(--tile-margin) + 4px + 8px);
- margin: 0;
- position: relative;
- text-align: -webkit-auto;
- width: var(--content-width);
-}
-
-.md-icons #mv-tiles {
/* Two rows of tiles of 112px each, 16px of spacing after each row, and 10px
* of margin on top. If you change this, also change the corresponding values
* in most_visited_single.css. */
height: calc(2*(var(--md-tile-height) + var(--md-tile-margin)) + 10px);
+ margin: 0;
+ position: relative;
+ text-align: -webkit-auto;
/* Add 2*5px to account for drop shadow on the tiles. If you change this, also
* change the corresponding values in most_visited_single.css. */
width: calc(var(--content-width) + 2*5px);
}
-#mv-notice-x {
- -webkit-mask-image: -webkit-image-set(
- url(chrome-search://local-ntp/images/close_3_mask.png) 1x,
- url(chrome-search://local-ntp/images/close_3_mask.png@2x) 2x);
- -webkit-mask-position: 3px 3px;
- -webkit-mask-repeat: no-repeat;
- -webkit-mask-size: 10px 10px;
- background-color: rgba(90, 90, 90, 0.7);
- cursor: pointer;
- display: inline-block;
- filter: var(--theme-filter, 'none');
- height: 16px;
- margin-inline-start: 20px;
- outline: none;
- vertical-align: middle;
- width: 16px;
-}
-
-html[darkmode=true] body:not(.light-chip) #mv-notice-x {
- background-color: rgb(var(--GG200-rgb));
-}
-
-#mv-notice-x:hover {
- background-color: rgba(90, 90, 90, 1.0);
-}
-
-#mv-notice-x:active {
- background-color: rgb(var(--GB500-rgb));
-}
-
-html[darkmode=true] body:not(.light-chip) #mv-notice-x:hover,
-html[darkmode=true] body:not(.light-chip) #mv-notice-x:active {
- background-color: rgb(var(--GG400-rgb));
-}
-
-.md-icons #mv-notice-x {
- display: none;
-}
-
#mv-notice-container {
- width: 100%;
-}
-
-.md-icons #mv-notice-container {
bottom: -50px;
+ left: 0;
margin-bottom: 16px;
position: fixed;
transition: bottom 400ms;
+ width: 100%;
}
/* Required to allow click events through the wrapping div of the toast
* notification container. */
-.md-icons #mv-notice-container,
+#mv-notice-container,
#error-notice-container {
pointer-events: none;
}
-.md-icons #mv-notice-container > div,
+#mv-notice-container > div,
#error-notice-container > div {
pointer-events: all;
}
-
-.md-icons #mv-notice-container.float-up {
+#mv-notice-container.float-up {
bottom: 0;
}
-.md-icons #mv-notice-container.notice-hide {
+#mv-notice-container.notice-hide {
display: none;
}
/* The notification shown when a tile is blacklisted. */
#mv-notice {
- font-size: 12px;
- font-weight: bold;
- opacity: 1;
- padding: 10px 0;
-}
-
-.md-icons #mv-notice {
background-color: white;
border: 1px solid rgb(var(--GG300-rgb));
/* Necessary for a "pill" shape. Using 50% creates an oval. */
border-radius: 16px;
- font-weight: normal;
+ font-size: 12px;
height: fit-content;
margin: 0 auto;
- padding: 0;
+ opacity: 1;
width: fit-content;
}
-html[darkmode=true] body:not(.light-chip) .md-icons #mv-notice {
+html[darkmode=true] body:not(.light-chip) #mv-notice {
background-color: rgb(var(--GG900-rgb));
border-color: rgba(0, 0, 0, 0.1);
}
#mv-notice span {
+ color: rgb(var(--GG700-rgb));
cursor: default;
display: inline-block;
- height: 16px;
- line-height: 16px;
- vertical-align: top;
-}
-
-.md-icons #mv-notice span {
- color: rgb(var(--GG700-rgb));
height: auto;
line-height: 32px;
vertical-align: unset;
}
-html[darkmode=true] body:not(.light-chip) .md-icons #mv-notice span {
+html[darkmode=true] body:not(.light-chip) #mv-notice span {
color: rgb(var(--GG200-rgb));
}
/* Links in the notification. */
#mv-notice-links span {
- color: var(--text-color-link);
- cursor: pointer;
- margin-inline-start: 6px;
- outline: none;
- padding: 0 4px;
-}
-
-.md-icons #mv-notice-links span {
/* Necessary for a "pill" shape. Using 50% creates an oval. */
border-radius: 16px;
color: rgb(var(--GB600-rgb));
+ cursor: pointer;
margin-inline-start: 0;
+ outline: none;
padding: 0 16px;
position: relative;
}
-html[darkmode=true] body:not(.light-chip) .md-icons #mv-notice-links span {
+html[darkmode=true] body:not(.light-chip) #mv-notice-links span {
color: rgb(var(--GB400-dark-rgb));
}
-#mv-notice-links span:hover,
#mv-notice-links span:focus {
text-decoration: underline;
}
-.md-icons #mv-notice-links span:hover,
-.md-icons #mv-notice-links span:active {
+#mv-notice-links span:hover,
+#mv-notice-links span:active {
background-color: rgba(var(--GB600-rgb), 0.1);
text-decoration: none;
transition: background-color 200ms;
}
-html[darkmode=true] body:not(.light-chip) .md-icons #mv-notice-links span:hover,
-html[darkmode=true] body:not(.light-chip) .md-icons #mv-notice-links span:active {
+html[darkmode=true] body:not(.light-chip) #mv-notice-links span:hover,
+html[darkmode=true] body:not(.light-chip) #mv-notice-links span:active {
background-color: rgba(var(--GB400-dark-rgb), 0.1);
}
#mv-msg {
color: var(--text-color);
-}
-
-.md-icons #mv-msg {
padding: 0 16px;
}
-.default-theme.dark #mv-msg :not(.md-icons) {
- color: #fff;
-}
-
-.default-theme.dark #mv-notice-links :not(.md-icons) span {
- color: #fff;
-}
-
-html[darkmode=true] body:not(.light-chip) .default-theme.dark #mv-msg :not(.md-icons),
-html[darkmode=true] body:not(.light-chip) .default-theme.dark #mv-notice-links :not(.md-icons) span {
+html[darkmode=true] body:not(.light-chip) .default-theme.dark #mv-msg :not(),
+html[darkmode=true] body:not(.light-chip) .default-theme.dark #mv-notice-links :not() span {
color: rgb(var(--GG200-rgb));
}
diff --git a/chromium/chrome/browser/resources/local_ntp/local_ntp.html b/chromium/chrome/browser/resources/local_ntp/local_ntp.html
index a2a859a7ce6..de6b857f035 100644
--- a/chromium/chrome/browser/resources/local_ntp/local_ntp.html
+++ b/chromium/chrome/browser/resources/local_ntp/local_ntp.html
@@ -77,22 +77,22 @@
<div id="most-visited">
<!-- The container for the tiles. The MV iframe goes in here. -->
<div id="mv-tiles"></div>
- <!-- Notification shown when a tile is blacklisted. -->
- <div id="mv-notice-container">
- <div id="mv-notice" class="notice-hide" role="alert">
- <span id="mv-msg"></span>
- <!-- Links in the notification. -->
- <span id="mv-notice-links">
- <span id="mv-undo" class="ripple" tabindex="0" role="button"></span>
- <span id="mv-restore" class="ripple" tabindex="0" role="button"></span>
- <div id="mv-notice-x" tabindex="0" role="button"></div>
- </span>
- </div>
- </div>
</div>
</div>
</div>
+ <!-- Notification shown when the tiles are modified. -->
+ <div id="mv-notice-container">
+ <div id="mv-notice" class="notice-hide" role="alert">
+ <span id="mv-msg"></span>
+ <!-- Links in the notification. -->
+ <span id="mv-notice-links">
+ <span id="mv-undo" class="ripple" tabindex="0" role="button"></span>
+ <span id="mv-restore" class="ripple" tabindex="0" role="button"></span>
+ </span>
+ </div>
+ </div>
+
<div id="attribution"><div id="attribution-text"></div></div>
<div id="error-notice-container">
@@ -193,7 +193,7 @@
</div>
</span>
</div>
- <div class="text-container">
+ <div id="text-container" aria-live="polite">
<!-- Low confidence text underneath high confidence text. -->
<span id="voice-text-i" class="voice-text"></span>
<!-- High confidence text on top of low confidence text. -->
diff --git a/chromium/chrome/browser/resources/local_ntp/local_ntp.js b/chromium/chrome/browser/resources/local_ntp/local_ntp.js
index f79eccbfee6..fb0fa9df981 100644
--- a/chromium/chrome/browser/resources/local_ntp/local_ntp.js
+++ b/chromium/chrome/browser/resources/local_ntp/local_ntp.js
@@ -53,8 +53,8 @@ function disableIframesAndVoiceSearchForTesting() {
*
* @type {{
* numTitleLines: number,
- * titleColor: string,
- * titleColorAgainstDark: string,
+ * titleColor: Array<number>,
+ * titleColorAgainstDark: Array<number>,
* }}
*/
var NTP_DESIGN = {
@@ -84,7 +84,9 @@ var CLASSES = {
FAKEBOX_FOCUS: 'fakebox-focused', // Applies focus styles to the fakebox
// Shows a search icon in the fakebox.
SHOW_FAKEBOX_ICON: 'show-fakebox-icon',
- SHOW_EDIT_DIALOG: 'show', // Displays the edit custom link dialog.
+ SHOW_EDIT_DIALOG: 'show', // Displays the edit custom link dialog.
+ // Applied when the fakebox placeholder text should not be hidden on focus.
+ SHOW_PLACEHOLDER: 'show-placeholder',
HIDE_BODY_OVERFLOW: 'hidden', // Prevents scrolling while the edit custom
// link dialog is open.
// Applies float animations to the Most Visited notification
@@ -99,8 +101,6 @@ var CLASSES = {
HIDE_PROMO: 'hide-promo',
INITED: 'inited', // Reveals the <body> once init() is done.
LEFT_ALIGN_ATTRIBUTION: 'left-align-attribution',
- MATERIAL_DESIGN_ICONS:
- 'md-icons', // Applies Material Design styles to Most Visited.
// Vertically centers the most visited section for a non-Google provided page.
NON_GOOGLE_PAGE: 'non-google-page',
NON_WHITE_BG: 'non-white-bg',
@@ -119,6 +119,7 @@ var CLASSES = {
var IDS = {
ATTRIBUTION: 'attribution',
ATTRIBUTION_TEXT: 'attribution-text',
+ CUSTOM_BG: 'custom-bg',
CUSTOM_LINKS_EDIT_IFRAME: 'custom-links-edit',
CUSTOM_LINKS_EDIT_IFRAME_DIALOG: 'custom-links-edit-dialog',
ERROR_NOTIFICATION: 'error-notice',
@@ -135,7 +136,6 @@ var IDS = {
MOST_VISITED: 'most-visited',
NOTIFICATION: 'mv-notice',
NOTIFICATION_CONTAINER: 'mv-notice-container',
- NOTIFICATION_CLOSE_BUTTON: 'mv-notice-x',
NOTIFICATION_MESSAGE: 'mv-msg',
NTP_CONTENTS: 'ntp-contents',
PROMO: 'promo',
@@ -192,6 +192,11 @@ var LOG_TYPE = {
NTP_CUSTOMIZE_SHORTCUT_CANCEL: 54,
// 'Done' was clicked in the 'Edit shortcut' dialog.
NTP_CUSTOMIZE_SHORTCUT_DONE: 55,
+
+ // A middle slot promo was shown.
+ NTP_MIDDLE_SLOT_PROMO_SHOWN: 60,
+ // A promo link was clicked.
+ NTP_MIDDLE_SLOT_PROMO_LINK_CLICKED: 61,
};
@@ -267,7 +272,15 @@ var lastBlacklistedTile = null;
* set if a notification is visible.
* @type {?Object}
*/
-let delayedHideNotification;
+let delayedHideNotification = null;
+
+
+/**
+ * The currently visible notification element. Null if no notification is
+ * present.
+ * @type {?Object}
+ */
+let currNotification = null;
/**
@@ -316,6 +329,15 @@ function createExecutableTimeout(timeout, delay) {
/**
+ * Called by tests to override the executable timeout with a test timeout.
+ * @param {!Function} timeout The timeout function. Requires a boolean param.
+ */
+function overrideExecutableTimeoutForTesting(timeout) {
+ createExecutableTimeout = timeout;
+}
+
+
+/**
* Returns theme background info, first checking for history.state.notheme. If
* the page has notheme set, returns a fallback light-colored theme (or dark-
* colored theme if dark mode is enabled). This is used when the doodle is
@@ -327,7 +349,6 @@ function getThemeBackgroundInfo() {
alternateLogo: false,
backgroundColorRgba:
(isDarkModeEnabled ? [50, 54, 57, 255] : [255, 255, 255, 255]),
- colorRgba: [255, 255, 255, 255],
headerColorRgba: [150, 150, 150, 255],
linkColorRgba: [6, 55, 116, 255],
sectionBorderColorRgba: [150, 150, 150, 255],
@@ -349,7 +370,6 @@ function getThemeBackgroundInfo() {
* when considering darkness. Therefore, dark mode should only be checked if
* this is the default NTP. Dark mode is considered a dark theme if enabled.
*
- * @param {ThemeBackgroundInfo|undefined} info Theme background information.
* @return {boolean} Whether the theme is dark.
* @private
*/
@@ -374,7 +394,7 @@ function getIsThemeDark() {
* is the case when dark mode is enabled and a background image (from a custom
* background or user theme) is not set.
*
- * @param {ThemeBackgroundInfo|undefined} info Theme background information.
+ * @param {!Object} info Theme background information.
* @return {boolean} Whether the chips should be dark.
* @private
*/
@@ -434,7 +454,7 @@ function renderTheme() {
customBackgrounds.CUSTOM_BACKGROUND_OVERLAY, 'url(' + info.imageUrl + ')'
].join(',').trim();
- if (imageWithOverlay != document.body.style.backgroundImage) {
+ if (imageWithOverlay != $(IDS.CUSTOM_BG).style.backgroundImage) {
customBackgrounds.closeCustomizationDialog();
customBackgrounds.clearAttribution();
}
@@ -442,19 +462,19 @@ function renderTheme() {
// |image| and |imageWithOverlay| use the same url as their source. Waiting
// to display the custom background until |image| is fully loaded ensures
// that |imageWithOverlay| is also loaded.
- $('custom-bg').style.backgroundImage = imageWithOverlay;
+ $(IDS.CUSTOM_BG).style.backgroundImage = imageWithOverlay;
var image = new Image();
image.onload = function() {
- $('custom-bg').style.opacity = '1';
+ $(IDS.CUSTOM_BG).style.opacity = '1';
};
image.src = info.imageUrl;
customBackgrounds.setAttribution(
info.attribution1, info.attribution2, info.attributionActionUrl);
} else {
- $('custom-bg').style.opacity = '0';
+ $(IDS.CUSTOM_BG).style.opacity = '0';
window.setTimeout(function() {
- $('custom-bg').style.backgroundImage = '';
+ $(IDS.CUSTOM_BG).style.backgroundImage = '';
}, 1000);
customBackgrounds.clearAttribution();
}
@@ -578,9 +598,9 @@ function onThemeChange() {
* @private
*/
function setCustomThemeStyle(themeInfo) {
- var textColor = null;
- var textColorLight = null;
- var mvxFilter = null;
+ var textColor = '';
+ var textColorLight = '';
+ var mvxFilter = '';
if (!themeInfo.usingDefaultTheme) {
textColor = convertToRGBAColor(themeInfo.textColorRgba);
textColorLight = convertToRGBAColor(themeInfo.textColorLightRgba);
@@ -594,8 +614,6 @@ function setCustomThemeStyle(themeInfo) {
document.body.style.setProperty('--text-color-light', textColorLight);
// Themes reuse the "light" text color for links too.
document.body.style.setProperty('--text-color-link', textColorLight);
- $(IDS.NOTIFICATION_CLOSE_BUTTON)
- .style.setProperty('--theme-filter', mvxFilter);
}
@@ -695,7 +713,8 @@ function onAddCustomLinkDone(success) {
if (success) {
showNotification(configData.translatedStrings.linkAddedMsg);
} else {
- showErrorNotification(configData.translatedStrings.linkCantCreate);
+ showErrorNotification(
+ configData.translatedStrings.linkCantCreate, null, null);
}
ntpApiHandle.logEvent(LOG_TYPE.NTP_CUSTOMIZE_SHORTCUT_DONE);
}
@@ -711,7 +730,8 @@ function onUpdateCustomLinkDone(success) {
if (success) {
showNotification(configData.translatedStrings.linkEditedMsg);
} else {
- showErrorNotification(configData.translatedStrings.linkCantEdit);
+ showErrorNotification(
+ configData.translatedStrings.linkCantEdit, null, null);
}
}
@@ -726,7 +746,8 @@ function onDeleteCustomLinkDone(success) {
if (success) {
showNotification(configData.translatedStrings.linkRemovedMsg);
} else {
- showErrorNotification(configData.translatedStrings.linkCantRemove);
+ showErrorNotification(
+ configData.translatedStrings.linkCantRemove, null, null);
}
}
@@ -738,17 +759,7 @@ function onDeleteCustomLinkDone(success) {
*/
function showNotification(msg) {
$(IDS.NOTIFICATION_MESSAGE).textContent = msg;
-
- if (configData.isGooglePage) {
- floatUpNotification($(IDS.NOTIFICATION), $(IDS.NOTIFICATION_CONTAINER));
- } else {
- var notification = $(IDS.NOTIFICATION);
- notification.classList.remove(CLASSES.HIDE_NOTIFICATION);
- notification.classList.remove(CLASSES.DELAYED_HIDE_NOTIFICATION);
- notification.scrollTop;
- notification.classList.add(CLASSES.DELAYED_HIDE_NOTIFICATION);
- }
-
+ floatUpNotification($(IDS.NOTIFICATION), $(IDS.NOTIFICATION_CONTAINER));
$(IDS.UNDO_LINK).focus();
}
@@ -757,15 +768,8 @@ function showNotification(msg) {
* Hides the Most Visited pop-up notification.
*/
function hideNotification() {
- if (configData.isGooglePage) {
- floatDownNotification(
- $(IDS.NOTIFICATION), $(IDS.NOTIFICATION_CONTAINER),
- /*showPromo=*/ true);
- } else {
- var notification = $(IDS.NOTIFICATION);
- notification.classList.add(CLASSES.HIDE_NOTIFICATION);
- notification.classList.remove(CLASSES.DELAYED_HIDE_NOTIFICATION);
- }
+ floatDownNotification(
+ $(IDS.NOTIFICATION), $(IDS.NOTIFICATION_CONTAINER), /*showPromo=*/ true);
}
@@ -797,13 +801,24 @@ function showErrorNotification(msg, linkName, linkOnClick) {
* Animates the specified notification to float up. Automatically hides any
* pre-existing notification and sets a delayed timer to hide the new
* notification.
- * @param {!Element} notification The notification element.
- * @param {!Element} notificationContainer The notification container element.
+ * @param {?Element} notification The notification element.
+ * @param {?Element} notificationContainer The notification container element.
*/
function floatUpNotification(notification, notificationContainer) {
+ if (!notification || !notificationContainer) {
+ return;
+ }
+
// Hide any pre-existing notification.
if (delayedHideNotification) {
- delayedHideNotification.trigger();
+ // Hide the current notification if it's a different type (i.e. error vs
+ // success). Otherwise, simply clear the notification timeout and reset it
+ // later.
+ if (currNotification === notificationContainer) {
+ delayedHideNotification.clear();
+ } else {
+ delayedHideNotification.trigger();
+ }
delayedHideNotification = null;
}
@@ -834,17 +849,22 @@ function floatUpNotification(notification, notificationContainer) {
// case, we do not want to re-show the promo yet.
floatDownNotification(notification, notificationContainer, !executedEarly);
}, NOTIFICATION_TIMEOUT);
+ currNotification = notificationContainer;
}
/**
* Animates the pop-up notification to float down, and clears the timeout to
* hide the notification.
- * @param {!Element} notification The notification element.
- * @param {!Element} notificationContainer The notification container element.
+ * @param {?Element} notification The notification element.
+ * @param {?Element} notificationContainer The notification container element.
* @param {boolean} showPromo Do show the promo if present.
*/
function floatDownNotification(notification, notificationContainer, showPromo) {
+ if (!notification || !notificationContainer) {
+ return;
+ }
+
if (!notificationContainer.classList.contains(CLASSES.FLOAT_UP)) {
return;
}
@@ -853,6 +873,7 @@ function floatDownNotification(notification, notificationContainer, showPromo) {
if (delayedHideNotification) {
delayedHideNotification.clear();
delayedHideNotification = null;
+ currNotification = null;
}
if (showPromo) {
@@ -875,7 +896,7 @@ function floatDownNotification(notification, notificationContainer, showPromo) {
$(IDS.UNDO_LINK).blur();
$(IDS.RESTORE_ALL_LINK).blur();
if (notification.classList.contains(CLASSES.HAS_LINK)) {
- notification.classlist.remove(CLASSES.HAS_LINK);
+ notification.classList.remove(CLASSES.HAS_LINK);
$(IDS.ERROR_NOTIFICATION_LINK).blur();
}
// Hide the notification
@@ -969,8 +990,9 @@ function isFakeboxFocused() {
* @return {boolean} True if the click occurred in an enabled fakebox.
*/
function isFakeboxClick(event) {
- return $(IDS.FAKEBOX).contains(event.target) &&
- !$(IDS.FAKEBOX_MICROPHONE).contains(event.target);
+ return $(IDS.FAKEBOX).contains(/** @type HTMLElement */ (event.target)) &&
+ !$(IDS.FAKEBOX_MICROPHONE)
+ .contains(/** @type HTMLElement */ (event.target));
}
@@ -1080,23 +1102,13 @@ function showSearchSuggestions() {
ssScript.async = false;
document.body.appendChild(ssScript);
ssScript.onload = function() {
- injectSearchSuggestions(search_suggestions);
+ injectSearchSuggestions(searchSuggestions);
};
}
}
/**
- * Enables Material Design styles for the Most Visited section. Implicitly
- * enables Material Design for the rest of NTP.
- */
-function enableMDIcons() {
- $(IDS.MOST_VISITED).classList.add(CLASSES.MATERIAL_DESIGN_ICONS);
- $(IDS.TILES).classList.add(CLASSES.MATERIAL_DESIGN_ICONS);
- animations.addRippleAnimations();
-}
-
-/**
* Prepares the New Tab Page by adding listeners, the most visited pages
* section, and Google-specific elements for a Google-provided page.
*/
@@ -1109,7 +1121,7 @@ function init() {
// Hide notifications after fade out, so we can't focus on links via keyboard.
$(IDS.NOTIFICATION).addEventListener('transitionend', (event) => {
- if (event.properyName === 'opacity') {
+ if (event.propertyName === 'opacity') {
hideNotification();
}
});
@@ -1135,8 +1147,6 @@ function init() {
$(IDS.ATTRIBUTION_TEXT).textContent =
configData.translatedStrings.attributionIntro;
- $(IDS.NOTIFICATION_CLOSE_BUTTON).addEventListener('click', hideNotification);
-
var embeddedSearchApiHandle = window.chrome.embeddedSearch;
ntpApiHandle = embeddedSearchApiHandle.newTabPage;
@@ -1149,7 +1159,7 @@ function init() {
if (configData.isGooglePage) {
showSearchSuggestions();
- enableMDIcons();
+ animations.addRippleAnimations();
ntpApiHandle.onaddcustomlinkdone = onAddCustomLinkDone;
ntpApiHandle.onupdatecustomlinkdone = onUpdateCustomLinkDone;
@@ -1169,6 +1179,9 @@ function init() {
if (configData.fakeboxSearchIconColor) {
$(IDS.FAKEBOX_ICON).classList.add(CLASSES.FAKEBOX_ICON_COLOR);
}
+ if (configData.showFakeboxPlaceholderOnFocus) {
+ $(IDS.FAKEBOX_TEXT).classList.add(CLASSES.SHOW_PLACEHOLDER);
+ }
if (configData.removeFakebox) {
document.body.classList.add(CLASSES.REMOVE_FAKEBOX);
@@ -1394,6 +1407,15 @@ function injectPromo(promo) {
if (promo.promoLogUrl) {
navigator.sendBeacon(promo.promoLogUrl);
}
+
+ ntpApiHandle.logEvent(LOG_TYPE.NTP_MIDDLE_SLOT_PROMO_SHOWN);
+
+ let links = promoContainer.getElementsByTagName('a');
+ if (links[0]) {
+ links[0].onclick = function() {
+ ntpApiHandle.logEvent(LOG_TYPE.NTP_MIDDLE_SLOT_PROMO_LINK_CLICKED);
+ };
+ }
}
@@ -1460,9 +1482,10 @@ function injectOneGoogleBar(ogb) {
return {
init: init, // Exposed for testing.
listen: listen,
- disableIframesAndVoiceSearchForTesting: disableIframesAndVoiceSearchForTesting
+ disableIframesAndVoiceSearchForTesting:
+ disableIframesAndVoiceSearchForTesting,
+ overrideExecutableTimeoutForTesting: overrideExecutableTimeoutForTesting
};
-
}
if (!window.localNTPUnitTest) {
diff --git a/chromium/chrome/browser/resources/local_ntp/most_visited_single.css b/chromium/chrome/browser/resources/local_ntp/most_visited_single.css
index bc412c5a472..7f925b78ed0 100644
--- a/chromium/chrome/browser/resources/local_ntp/most_visited_single.css
+++ b/chromium/chrome/browser/resources/local_ntp/most_visited_single.css
@@ -224,7 +224,7 @@ html[darkmode=true] .md-add-icon {
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
- width: 96px;
+ width: 88px;
}
.md-title span {
@@ -253,7 +253,7 @@ body.using-theme .md-title-container {
background-color: white;
/* Necessary for a "pill" shape. Using 50% creates an oval. */
border-radius: 500px;
- padding: 0 4px;
+ padding: 0 8px;
}
html[darkmode=true] body.using-theme .md-title-container {
diff --git a/chromium/chrome/browser/resources/local_ntp/most_visited_single.js b/chromium/chrome/browser/resources/local_ntp/most_visited_single.js
index 8dfe125e856..0672392166c 100644
--- a/chromium/chrome/browser/resources/local_ntp/most_visited_single.js
+++ b/chromium/chrome/browser/resources/local_ntp/most_visited_single.js
@@ -9,7 +9,7 @@
/**
* Enum for key codes.
- * @enum {int}
+ * @enum {number}
* @const
*/
const KEYCODES = {
@@ -156,7 +156,7 @@ const MD_NUM_TILES_ALWAYS_VISIBLE = 6;
* or 'chrome-search://local-ntp' for the local NTP.
* @const {string}
*/
-var DOMAIN_ORIGIN = '{{ORIGIN}}';
+const DOMAIN_ORIGIN = '{{ORIGIN}}';
/**
@@ -313,8 +313,9 @@ var handleCommand = function(data) {
if (cmd == 'tile') {
addTile(data);
} else if (cmd == 'show') {
- // TODO(treib): If this happens before we have finished loading the previous
- // tiles, we probably get into a bad state.
+ // TODO(crbug.com/946225): If this happens before we have finished loading
+ // the previous tiles, we probably get into a bad state. If/when the iframe
+ // is removed this might no longer be a concern.
showTiles(data);
} else if (cmd == 'updateTheme') {
updateTheme(data);
@@ -328,7 +329,7 @@ var handleCommand = function(data) {
/**
* Handler for the 'show' message from the host page.
- * @param {object} info Data received in the message.
+ * @param {!Object} info Data received in the message.
*/
var showTiles = function(info) {
logEvent(LOG_TYPE.NTP_ALL_TILES_RECEIVED);
@@ -339,7 +340,7 @@ var showTiles = function(info) {
/**
* Handler for the 'updateTheme' message from the host page.
- * @param {object} info Data received in the message.
+ * @param {!Object} info Data received in the message.
*/
var updateTheme = function(info) {
document.body.style.setProperty('--tile-title-color', info.tileTitleColor);
@@ -360,7 +361,7 @@ var updateTheme = function(info) {
* Handler for 'focusMenu' message from the host page. Focuses the edited tile's
* menu or the add shortcut tile after closing the custom link edit dialog
* without saving.
- * @param {object} info Data received in the message.
+ * @param {!Object} info Data received in the message.
*/
var focusTileMenu = function(info) {
let tile = document.querySelector(`a.md-tile[data-tid="${info.tid}"]`);
@@ -401,6 +402,9 @@ var swapInNewTiles = function() {
'title': queryArgs['addLink'],
'url': '',
'isAddButton': true,
+ 'dataGenerationTime': new Date(),
+ 'tileSource': -1,
+ 'tileTitleSource': -1
};
tiles.appendChild(renderMaterialDesignTile(data));
}
@@ -440,7 +444,7 @@ var swapInNewTiles = function() {
// getComputedStyle causes the initial style (opacity 0) to be applied, so
// that when we then set it to 1, that triggers the CSS transition.
if (fadeIn) {
- window.getComputedStyle(cur).opacity;
+ const style = window.getComputedStyle(cur).opacity;
}
cur.style.opacity = 1.0;
@@ -474,7 +478,7 @@ function updateTileVisibility() {
* Handler for the 'show' message from the host page, called when it wants to
* add a suggestion tile.
* It's also used to fill up our tiles to |maxNumTiles| if necessary.
- * @param {object} args Data for the tile to be rendered.
+ * @param {?MostVisitedData} args Data for the tile to be rendered.
*/
var addTile = function(args) {
if (isFinite(args.rid)) {
@@ -594,23 +598,28 @@ function setupReorder(tile) {
// Cancel the timeout if the user drags the mouse off the tile and
// releases or if the mouse if released.
- let dragend = document.addEventListener('dragend', () => {
+ let dragend = () => {
window.clearTimeout(timeout);
- }, {once: true});
- let mouseup = document.addEventListener('mouseup', () => {
+ };
+ document.addEventListener('dragend', dragend, {once: true});
+
+ let mouseup = () => {
if (event.button == 0 /* LEFT CLICK */) {
window.clearTimeout(timeout);
}
- }, {once: true});
+ };
+ document.addEventListener('mouseup', mouseup, {once: true});
- // Wait for |REORDER_TIMEOUT_DELAY| before starting the reorder flow.
- timeout = window.setTimeout(() => {
+ let timeoutFunc = (dragend_in, mouseup_in) => {
if (!reordering) {
startReorder(tile);
}
- document.removeEventListener('dragend', dragend);
- document.removeEventListener('mouseup', mouseup);
- }, REORDER_TIMEOUT_DELAY);
+ document.removeEventListener('dragend', dragend_in);
+ document.removeEventListener('mouseup', mouseup_in);
+ };
+ // Wait for |REORDER_TIMEOUT_DELAY| before starting the reorder flow.
+ timeout = window.setTimeout(
+ timeoutFunc.bind(dragend, mouseup), REORDER_TIMEOUT_DELAY);
}
});
@@ -638,10 +647,11 @@ function setupReorder(tile) {
/**
* Renders a MostVisited tile to the DOM.
- * @param {object} data Object containing rid, url, title, favicon, thumbnail,
- * and optionally isAddButton. isAddButton is true if you want to construct
- * an add custom link button. data is null if you want to construct an
- * empty tile. isAddButton can only be set if custom links is enabled.
+ * @param {?MostVisitedData} data Object containing rid, url, title, favicon,
+ * thumbnail, and optionally isAddButton. isAddButton is true if you want to
+ * construct an add custom link button. data is null if you want to
+ * construct an empty tile. isAddButton can only be set if custom links is
+ * enabled.
*/
var renderTile = function(data) {
return renderMaterialDesignTile(data);
@@ -650,9 +660,10 @@ var renderTile = function(data) {
/**
* Renders a MostVisited tile with Material Design styles.
- * @param {object} data Object containing rid, url, title, favicon, and
- * optionally isAddButton. isAddButton is if you want to construct an add
- * custom link button. data is null if you want to construct an empty tile.
+ * @param {?MostVisitedData} data Object containing rid, url, title, favicon,
+ * and optionally isAddButton. isAddButton is if you want to construct an
+ * add custom link button. data is null if you want to construct an empty
+ * tile.
* @return {Element}
*/
function renderMaterialDesignTile(data) {
@@ -683,7 +694,7 @@ function renderMaterialDesignTile(data) {
mdTile.addEventListener('click', function(ev) {
if (data.isAddButton) {
- editCustomLink();
+ editCustomLink(null);
logEvent(LOG_TYPE.NTP_CUSTOMIZE_ADD_SHORTCUT_CLICKED);
} else {
logMostVisitedNavigation(
@@ -819,7 +830,7 @@ function renderMaterialDesignTile(data) {
// Don't allow the event to bubble out to the containing tile, as that would
// trigger navigation to the tile URL.
mdMenu.addEventListener('keydown', function(ev) {
- event.stopPropagation();
+ ev.stopPropagation();
});
utils.disableOutlineOnMouseClick(mdMenu);
diff --git a/chromium/chrome/browser/resources/local_ntp/most_visited_util.js b/chromium/chrome/browser/resources/local_ntp/most_visited_util.js
index 00057a8141b..d568a79f657 100644
--- a/chromium/chrome/browser/resources/local_ntp/most_visited_util.js
+++ b/chromium/chrome/browser/resources/local_ntp/most_visited_util.js
@@ -15,11 +15,11 @@
* The origin of this request.
* @const {string}
*/
-var DOMAIN_ORIGIN = '{{ORIGIN}}';
+const MV_DOMAIN_ORIGIN = '{{ORIGIN}}';
/**
* Parses query parameters from Location.
- * @param {string} location The URL to generate the CSS url for.
+ * @param {!Location} location The URL to generate the CSS url for.
* @return {Object} Dictionary containing name value pairs for URL.
*/
function parseQueryParams(location) {
@@ -49,7 +49,7 @@ function parseQueryParams(location) {
* @param {string} title The title for the link.
* @param {string|undefined} text The text for the link or none.
* @param {string|undefined} direction The text direction.
- * @return {HTMLAnchorElement} A new link element.
+ * @return {!Element} A new link element.
*/
function createMostVisitedLink(params, href, title, text, direction) {
var styles = getMostVisitedStyles(params, !!text);
@@ -87,17 +87,18 @@ function createMostVisitedLink(params, href, title, text, direction) {
link.appendChild(spanWrap);
}
link.addEventListener('focus', function() {
- window.parent.postMessage('linkFocused', DOMAIN_ORIGIN);
+ window.parent.postMessage('linkFocused', MV_DOMAIN_ORIGIN);
});
link.addEventListener('blur', function() {
- window.parent.postMessage('linkBlurred', DOMAIN_ORIGIN);
+ window.parent.postMessage('linkBlurred', MV_DOMAIN_ORIGIN);
});
link.addEventListener('keydown', function(event) {
if (event.keyCode == 46 /* DELETE */ ||
event.keyCode == 8 /* BACKSPACE */) {
event.preventDefault();
- window.parent.postMessage('tileBlacklisted,' + params.pos, DOMAIN_ORIGIN);
+ window.parent.postMessage(
+ 'tileBlacklisted,' + params['pos'], MV_DOMAIN_ORIGIN);
} else if (
event.keyCode == 13 /* ENTER */ || event.keyCode == 32 /* SPACE */) {
// Event target is the <a> tag. Send a click event on it, which will
@@ -197,7 +198,7 @@ var isSchemeAllowed = function(url) {
/**
- * @param {string} location A location containing URL parameters.
+ * @param {!Location} location A location containing URL parameters.
* @param {function(Object, Object)} fill A function called with styles and
* data to fill.
*/
diff --git a/chromium/chrome/browser/resources/local_ntp/utils.js b/chromium/chrome/browser/resources/local_ntp/utils.js
index 90f489bcfa2..dd9dc02a932 100644
--- a/chromium/chrome/browser/resources/local_ntp/utils.js
+++ b/chromium/chrome/browser/resources/local_ntp/utils.js
@@ -17,7 +17,7 @@ const CLASSES = {
/**
* Alias for document.getElementById.
* @param {string} id The ID of the element to find.
- * @return {HTMLElement} The found element or null if not found.
+ * @return {Element} The found element or null if not found.
*/
function $(id) {
// eslint-disable-next-line no-restricted-properties
diff --git a/chromium/chrome/browser/resources/local_ntp/voice.css b/chromium/chrome/browser/resources/local_ntp/voice.css
index 76c00da9530..57c350ab3c6 100644
--- a/chromium/chrome/browser/resources/local_ntp/voice.css
+++ b/chromium/chrome/browser/resources/local_ntp/voice.css
@@ -284,13 +284,13 @@ html[darkmode=true] .button:active {
* - voice-text-5l - 5 line style class */
/* Styles applied to the positioning text-container element. */
-.text-container {
+#text-container {
pointer-events: none;
}
/* Full Page UI style for the text-container. */
-.overlay .text-container,
-.overlay-hidden .text-container {
+.overlay #text-container,
+.overlay-hidden #text-container {
position: absolute;
}
diff --git a/chromium/chrome/browser/resources/local_ntp/voice.js b/chromium/chrome/browser/resources/local_ntp/voice.js
index 106dfe7d074..060972ca04d 100644
--- a/chromium/chrome/browser/resources/local_ntp/voice.js
+++ b/chromium/chrome/browser/resources/local_ntp/voice.js
@@ -7,17 +7,6 @@
/**
- * Alias for document.getElementById.
- * @param {string} id The ID of the element to find.
- * @return {HTMLElement} The found element or null if not found.
- */
-function $(id) {
- // eslint-disable-next-line no-restricted-properties
- return document.getElementById(id);
-}
-
-
-/**
* Get the preferred language for UI localization. Represents Chrome's UI
* language, which might not coincide with the user's "preferred" language
* in the Settings. For more details, see:
@@ -307,7 +296,7 @@ speech.usingKeyboardNavigation_ = false;
/**
* Log an event from Voice Search.
- * @param {!number} eventType Event from |LOG_TYPE|.
+ * @param {number} eventType Event from |LOG_TYPE|.
*/
speech.logEvent = function(eventType) {
window.chrome.embeddedSearch.newTabPage.logEvent(eventType);
@@ -317,14 +306,18 @@ speech.logEvent = function(eventType) {
/**
* Initialize the speech module as part of the local NTP. Adds event handlers
* and shows the fakebox microphone icon.
- * @param {!string} googleBaseUrl Base URL for sending queries to Search.
+ * @param {string} googleBaseUrl Base URL for sending queries to Search.
* @param {!Object} translatedStrings Dictionary of localized string messages.
- * @param {!HTMLElement} fakeboxMicrophoneElem Fakebox microphone icon element.
+ * @param {?Element} fakeboxMicrophoneElem Fakebox microphone icon element.
* @param {!Object} searchboxApiHandle SearchBox API handle.
*/
speech.init = function(
googleBaseUrl, translatedStrings, fakeboxMicrophoneElem,
searchboxApiHandle) {
+ if (!fakeboxMicrophoneElem) {
+ throw new Error('Speech button element not found.');
+ }
+
if (speech.currentState_ != speech.State_.UNINITIALIZED) {
throw new Error(
'Trying to re-initialize speech when not in UNINITIALIZED state.');
@@ -370,6 +363,7 @@ speech.init = function(
waiting: translatedStrings.waiting,
};
view.init(speech.onClick_);
+ view.setTitles(translatedStrings);
speech.initWebkitSpeech_();
speech.reset_();
};
@@ -666,7 +660,7 @@ speech.isUserAgentMac_ = function() {
/**
* Determines, if the given KeyboardEvent |code| is a space or enter key.
- * @param {!string} A KeyboardEvent's |code| property.
+ * @param {string} code A KeyboardEvent's |code| property.
* @return True, iff the code represents a space or enter key.
* @private
*/
@@ -684,7 +678,7 @@ speech.isSpaceOrEnter_ = function(code) {
/**
* Determines if the given event's target id is for a button or navigation link.
- * @param {!string} An event's target id.
+ * @param {string} id An event's target id.
* @return True, iff the id is for a button or link.
* @private
*/
@@ -706,7 +700,7 @@ speech.isButtonOrLink_ = function(id) {
* - <ESC> aborts voice input when the recognition interface is active.
* - <ENTER> or <SPACE> interprets as a click if the target is a button or
* navigation link, otherwise it submits the speech query if there is one
- * @param {KeyboardEvent} event The keydown event.
+ * @param {!Event} event The keydown event.
*/
speech.onKeyDown = function(event) {
if (speech.isUiDefinitelyHidden_()) {
@@ -796,7 +790,7 @@ speech.onOmniboxFocused = function() {
/**
* Change the location of this tab to the new URL. Used for query submission.
- * @param {!URL} The URL to navigate to.
+ * @param {!URL} url The URL to navigate to.
* @private
*/
speech.navigateToUrl_ = function(url) {
@@ -819,11 +813,11 @@ speech.submitFinalResult_ = function() {
// before stopping speech.
searchParams.append('q', speech.finalResult_);
// Add a parameter to indicate that this request is a voice search.
- searchParams.append('gs_ivs', 1);
+ searchParams.append('gs_ivs', '1');
// Build the query URL.
const queryUrl = new URL('/search', speech.googleBaseUrl_);
- queryUrl.search = searchParams;
+ queryUrl.search = searchParams.toString();
speech.logEvent(LOG_TYPE.ACTION_QUERY_SUBMITTED);
speech.stop();
@@ -1110,8 +1104,8 @@ text.init = function() {
/**
* Updates the text elements with new recognition results.
- * @param {!string} interimText Low confidence speech recognition result text.
- * @param {!string} opt_finalText High confidence speech recognition result
+ * @param {string} interimText Low confidence speech recognition result text.
+ * @param {string} opt_finalText High confidence speech recognition result
* text, defaults to an empty string.
*/
text.updateTextArea = function(interimText, opt_finalText = '') {
@@ -1450,7 +1444,7 @@ let view = {};
/**
* ID for the close button in the speech output container.
- * @const @private
+ * @const
*/
view.CLOSE_BUTTON_ID = 'voice-close-button';
@@ -1641,6 +1635,17 @@ view.init = function(onClick) {
/**
+ * Sets accessibility titles/labels for the page elements.
+ * @param {!Object} translatedStrings Dictionary of localized title strings.
+ */
+view.setTitles = function(translatedStrings) {
+ let closeButton = $(view.CLOSE_BUTTON_ID);
+ closeButton.title = translatedStrings.voiceCloseTooltip;
+ closeButton.setAttribute('aria-label', translatedStrings.voiceCloseTooltip);
+};
+
+
+/**
* Displays an error message and stops animations.
* @param {RecognitionError} error The error type.
*/
@@ -1690,7 +1695,7 @@ view.stopMicrophoneAnimations_ = function() {
/**
* Makes sure that a click anywhere closes the UI when it is active.
- * @param {!MouseEvent} event The click event.
+ * @param {!Event} event The click event.
* @private
*/
view.onWindowClick_ = function(event) {
diff --git a/chromium/chrome/browser/resources/management/management.html b/chromium/chrome/browser/resources/management/management.html
index 8bcb853828e..62a62bf9147 100644
--- a/chromium/chrome/browser/resources/management/management.html
+++ b/chromium/chrome/browser/resources/management/management.html
@@ -3,11 +3,12 @@
$i18n{dark}>
<head>
<meta charset="utf-8">
- <meta name="viewport" content="width=device-width, user-scalable=no">
+ <meta name="viewport" content="width=device-width, user-scalable=yes">
<title>$i18n{title}</title>
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
+ <link rel="import" href="chrome://resources/html/cr.html">
<style>
html {
background: var(--md-background-color);
diff --git a/chromium/chrome/browser/resources/management/management_browser_proxy.js b/chromium/chrome/browser/resources/management/management_browser_proxy.js
index d02cb65f2ef..cdbda1f96f8 100644
--- a/chromium/chrome/browser/resources/management/management_browser_proxy.js
+++ b/chromium/chrome/browser/resources/management/management_browser_proxy.js
@@ -5,8 +5,8 @@
cr.exportPath('management');
/**
* @typedef {{
- * name: string,
- * permissions: !Array<string>
+ * name: string,
+ * permissions: !Array<string>
* }}
*/
management.Extension;
@@ -22,12 +22,34 @@ management.ReportingType = {
/**
* @typedef {{
- * messageId: string,
- * reportingType: !management.ReportingType,
+ * messageId: string,
+ * reportingType: !management.ReportingType,
* }}
*/
management.BrowserReportingResponse;
+/**
+ * @typedef {{
+ * overview: string,
+ * setup: string,
+ * data: string,
+ * }}
+ */
+management.ManagedInfo;
+
+/**
+ * @typedef {{
+ * accountManagedInfo: ?management.ManagedInfo,
+ * browserManagementNotice: string,
+ * deviceManagedInfo: ?management.ManagedInfo,
+ * extensionReportingTitle: string,
+ * pageSubtitle: string,
+ * managed: boolean,
+ * overview: string,
+ * }}
+ */
+management.ManagedDataResponse;
+
// <if expr="chromeos">
/**
* @enum {string} Look at ToJSDeviceReportingType usage in
@@ -38,14 +60,15 @@ management.DeviceReportingType = {
DEVICE_ACTIVITY: 'device activity',
STATISTIC: 'device statistics',
DEVICE: 'device',
- LOGS: 'logs'
+ LOGS: 'logs',
+ PRINT: 'print'
};
/**
* @typedef {{
- * messageId: string,
- * reportingType: !management.DeviceReportingType,
+ * messageId: string,
+ * reportingType: !management.DeviceReportingType,
* }}
*/
management.DeviceReportingResponse;
@@ -71,6 +94,9 @@ cr.define('management', function() {
getDeviceReportingInfo() {}
// </if>
+ /** @return {!Promise<!management.ManagedDataResponse>} */
+ getContextualManagedData() {}
+
/**
* @return {!Promise<!Array<!management.BrowserReportingResponse>>} The list
* of browser reporting info messages.
@@ -98,6 +124,11 @@ cr.define('management', function() {
// </if>
/** @override */
+ getContextualManagedData() {
+ return cr.sendWithPromise('getContextualManagedData');
+ }
+
+ /** @override */
initBrowserReportingInfo() {
return cr.sendWithPromise('initBrowserReportingInfo');
}
diff --git a/chromium/chrome/browser/resources/management/management_ui.html b/chromium/chrome/browser/resources/management/management_ui.html
index 8e20e489b43..a46ab2232a0 100644
--- a/chromium/chrome/browser/resources/management/management_ui.html
+++ b/chromium/chrome/browser/resources/management/management_ui.html
@@ -1,7 +1,9 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar.html">
+<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
@@ -12,9 +14,10 @@
<dom-module id="management-ui">
<template>
- <style>
+ <style include="cr-icons cr-hidden-style">
:host {
@apply --cr-page-host;
+ color: var(--cr-secondary-text-color);
display: flex;
flex-direction: column;
height: 100%;
@@ -30,211 +33,267 @@
}
main {
- overflow: auto;
- padding-bottom: 2em;
+ height: 100%;
+ overflow: overlay;
}
- .header {
- font-weight: 500;
+ .sections-container {
+ @apply --cr-centered-card-container;
+ height: 100%;
}
- h2 {
- @apply --cr-card-external-title;
+ .card {
+ @apply --cr-card-elevation;
+ background-color: var(--cr-card-background-color);
+ margin: 0 3px;
+ min-height: 100%;
}
- .subtitle {
- margin: 1em 0;
+ .page-subtitle {
+ align-items: center;
+ flex-direction: row;
+ justify-content: start;
+ min-height: 40px;
+ padding-bottom: 24px;
+ padding-top: 6px;
}
- section {
- @apply --cr-section;
+ .page-subtitle cr-icon-button {
+ margin-inline-end: 10px;
+ margin-inline-start: -10px;
}
- .sections-container {
- @apply --cr-centered-card-container;
- margin-top: var(--cr-section-vertical-margin);
+ .overview-section div + div {
+ margin-top: 16px;
}
- .card {
- @apply --cr-card-elevation;
- background-color: var(--cr-card-background-color);
- border-radius: var(--cr-card-border-radius);
- margin: 0 3px;
+ .overview-messages {
+ margin-top: 0;
}
- .browser-report iron-icon {
- margin-inline-end: 20px;
+ .overview-messages li {
+ margin-top: 8px;
}
- .browser-report {
- align-items: start;
- display: flex;
- margin: 12px 0;
+ th {
+ font-weight: 500;
+ }
+
+ h2 {
+ @apply --cr-title-text;
+ font-size: 13px;
+ }
+
+ .page-subtitle h2 {
+ font-size: 14px;
}
- .single-column {
+ .subtitle {
+ margin-top: 16px;
+ }
+
+ section {
+ @apply --cr-section;
align-items: flex-start;
+ border-top: none;
flex-direction: column;
justify-content: center;
+ padding-bottom: 12px;
+ padding-top: 12px;
}
- .three-line {
- min-height: var(--cr-section-three-line-min-height);
+ section:not(.page-subtitle) h2 {
+ margin: 0;
}
-<if expr="chromeos">
- .device-reporting div {
- align-items: center;
- display: flex;
+ .report iron-icon {
+ height: 20px;
+ margin-inline-end: 16px;
+ width: 20px;
}
- .device-reporting div + div {
- margin-top: 2em;
+ .report {
+ align-items: start;
+ display: flex;
+ margin-top: 16px;
}
- .device-reporting iron-icon {
- margin-inline-end: 10px;
- width: 24px;
+ .content-indented {
+ margin-inline-start: 24px;
}
- .device-reporting {
- margin-bottom: 2em;
+ table {
+ border-spacing: 0 16px;
+ width: 100%;
}
-</if>
- .extension-name {
- align-items: center;
- display: flex;
- flex: 2;
+ th,
+ td {
+ text-align: start;
}
- .extension-name > div {
+ td > div {
align-items: center;
display: flex;
}
- .extension-name img {
- margin-inline-end: 20px;
+ .extension-name {
+ width: 40%;
}
- .extension-permissions {
- flex: 3;
+ .extension-name span {
+ max-width: 200px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
- .extensions-list .list-item {
- display: flex;
+ .extension-permissions {
+ width: 60%;
}
- .browser-report li,
- .extensions-list li {
- padding: 2px;
+ .extension-name img {
+ height: 20px;
+ margin-inline-end: 12px;
+ width: 20px;
}
- .browser-report ul,
- .extensions-list ul {
+ .extension-permissions ul,
+ .report ul {
list-style: none;
- padding: 0;
- }
-
- .browser-report ul {
margin: 0;
- }
-
- .list-item div {
- padding: 0 5px 0;
+ padding: 0;
}
</style>
- <cr-toolbar page-name="$i18n{title}" show-search="[[showSearchInToolbar_]]">
+ <cr-toolbar page-name="$i18n{toolbarTitle}" role="banner"
+ on-search-changed="onSearchChanged_" clear-label="$i18n{clearSearch}"
+ search-prompt="$i18n{searchPrompt}">
</cr-toolbar>
<main id="mainContent">
<div class="sections-container">
+ <div class="card">
+ <section hidden="[[!managed_]]" class="page-subtitle">
+ <cr-icon-button class="icon-arrow-back" id="closeButton"
+ on-click="onTapBack_" aria-label="$i18n{backButton}">
+ </cr-icon-button>
+ <h2>
+ [[subtitle_]]
+ </h2>
+ </section>
+ <section class="overview-section">
<if expr="not chromeos">
- <section class="card three-line single-column">
- <p inner-h-t-m-l="[[i18nAdvanced('browserManagementNotice')]]"></p>
- </section>
+ <div inner-h-t-m-l="[[managementNoticeHtml_]]"></div>
</if>
<if expr="chromeos">
- <template is="dom-if"
- if="[[showDeviceReportingInfo_(deviceReportingInfo_)]]">
- <h2>$i18n{deviceReporting}</h2>
- <section class="card three-line single-column">
- <div class="subtitle">
- $i18n{deviceConfiguration}
- </div>
- <template is="dom-repeat" items="[[deviceReportingInfo_]]">
- <div class="device-reporting">
- <span>
- <iron-icon icon="[[getIconForDeviceReportingType_(
- item.reportingType)]]"></iron-icon>
- [[i18n(item.messageId)]]
- </span>
- </div>
- </template>
- </section>
- </template>
+ <div>[[managementOverview_]]</div>
+ <div>[[deviceManagedInfo_.overview]]</div>
+ <ul class="overview-messages"
+ hidden="[[!deviceManagedInfo_]]">
+ <li>
+ [[deviceManagedInfo_.setup]]
+ <a href="$i18nRaw{managementDeviceLearnMoreUrl}"
+ target="_blank">$i18n{learnMore}</a>
+ </li>
+ <li>[[deviceManagedInfo_.data]]</li>
+ </ul>
+ <div>[[accountManagedInfo_.overview]]</div>
+ <ul class="overview-messages" hidden="[[!accountManagedInfo_]]">
+ <li>[[accountManagedInfo_.setup]]
+ <a href="$i18nRaw{managementAccountLearnMoreUrl}"
+ target="_blank">$i18n{learnMore}</a>
+ </li>
+ <li>[[accountManagedInfo_.data]]</li>
+ </ul>
</if>
- <template is="dom-if"
- if="[[showBrowserReportingInfo_(browserReportingInfo_)]]">
- <h2>$i18n{browserReporting}</h2>
- <section class="card three-line single-column">
- <div class="subtitle">
- $i18n{browserReportingExplanation}
- </div>
- <template is="dom-repeat" items="[[browserReportingInfo_]]">
- <div class="browser-report">
- <iron-icon icon="[[item.icon]]"></iron-icon>
- <ul>
- <template is="dom-repeat" items="[[item.messageIds]]"
- as="messageId">
- <li inner-h-t-m-l="[[i18nAdvanced(messageId)]]"></li>
- </template>
- </ul>
- </div>
- </template>
</section>
- </template>
- <template is="dom-if"
- if="[[showExtensionReportingInfo_(extensions_)]]">
- <h2>$i18n{extensionReporting}</h2>
- <section class="card three-line single-column">
- <div class="subtitle">
- $i18n{extensionsInstalled}
- </div>
- <div class="extensions-list">
- <div class="list-item header">
- <div class="extension-name">$i18n{extensionName}</div>
- <div class="extension-permissions">
- $i18n{extensionPermissions}
- </div>
+<if expr="chromeos">
+ <div hidden="[[!localTrustRoots_]]">
+ <section>
+ <h2>$i18n{localTrustRoots}</h2>
+ <div class="subtitle" id="trust-roots-configuration">
+ [[localTrustRoots_]]</div>
+ </section>
+ </div>
+ <template is="dom-if"
+ if="[[showDeviceReportingInfo_(deviceReportingInfo_)]]">
+ <section>
+ <h2>$i18n{deviceReporting}</h2>
+ <div class="subtitle">
+ $i18n{deviceConfiguration}
</div>
- <template is="dom-repeat" items="[[extensions_]]">
- <div class="list-item">
- <div class="extension-name">
- <img src="[[item.icon]]"
- aria-describedby="a11yAssociation">
- <span>[[item.name]]</span>
+ <div class="content-indented">
+ <template is="dom-repeat" items="[[deviceReportingInfo_]]">
+ <div class="report">
+ <iron-icon icon="[[getIconForDeviceReportingType_(
+ item.reportingType)]]"></iron-icon>
+ [[i18n(item.messageId)]]
</div>
- <div class="extension-permissions">
+ </template>
+ </div>
+ </section>
+ </template>
+</if>
+<if expr="not chromeos">
+ <template is="dom-if"
+ if="[[showBrowserReportingInfo_(browserReportingInfo_)]]">
+ <section>
+ <h2>$i18n{browserReporting}</h2>
+ <div class="subtitle">
+ $i18n{browserReportingExplanation}
+ </div>
+ <div>
+ <template is="dom-repeat" items="[[browserReportingInfo_]]">
+ <div class="report">
+ <iron-icon icon="[[item.icon]]"></iron-icon>
<ul>
- <template is="dom-repeat" items="[[item.permissions]]"
- as="permission">
- <li>[[permission]]</li>
+ <template is="dom-repeat" items="[[item.messageIds]]"
+ as="messageId">
+ <li inner-h-t-m-l="[[i18nAdvanced(messageId)]]"></li>
</template>
</ul>
</div>
- </template>
- </div>
- </section>
- </template>
-<if expr="chromeos">
- <template is="dom-if" if="[[localTrustRoots_]]">
- <h2>$i18n{localTrustRoots}</h2>
- <section class="card three-line single-column">
- <div id="trust-roots-configuration">[[localTrustRoots_]]</div>
- </section>
- </template>
+ </template>
+ </div>
+ </section>
+ </template>
</if>
+ <template is="dom-if"
+ if="[[showExtensionReportingInfo_(extensions_)]]">
+ <section class="extension-reporting">
+ <h2>$i18n{extensionReporting}</h2>
+ <div class="subtitle">
+ [[extensionReportingSubtitle_]]
+ </div>
+ <table class="content-indented">
+ <tr>
+ <th class="extension-name">$i18n{extensionName}</td>
+ <th class="extension-permissions">
+ $i18n{extensionPermissions}
+ </td>
+ </tr>
+ <template is="dom-repeat" items="[[extensions_]]">
+ <tr>
+ <td class="extension-name">
+ <div title="[[item.name]]" role="presentation">
+ <img src="[[item.icon]]" alt="" aria-hidden="true">
+ <span>[[item.name]]</span>
+ </div>
+ </td>
+ <td class="extension-permissions">
+ <ul>
+ <template is="dom-repeat" items="[[item.permissions]]"
+ as="permission">
+ <li>[[permission]]</li>
+ </template>
+ </ul>
+ </td>
+ </tr>
+ </template>
+ </table>
+ </section>
+ </template>
+ </div>
</div>
</main>
</template>
diff --git a/chromium/chrome/browser/resources/management/management_ui.js b/chromium/chrome/browser/resources/management/management_ui.js
index a6692831d80..13f177d9076 100644
--- a/chromium/chrome/browser/resources/management/management_ui.js
+++ b/chromium/chrome/browser/resources/management/management_ui.js
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+cr.exportPath('management');
/**
* @typedef {{
- * messageIds: !Array<string>,
- * icon: string,
+ * messageIds: !Array<string>,
+ * icon: string,
* }}
*/
management.BrowserReportingData;
@@ -44,16 +44,30 @@ Polymer({
* @private
*/
localTrustRoots_: String,
+
+ /** @private */
+ managementOverview_: String,
+
+ /** @private {?management.ManagedInfo} */
+ deviceManagedInfo_: Object,
// </if>
- /**
- * Indicates if the search field in visible in the toolbar.
- * @private
- */
- showSearchInToolbar_: {
- type: Boolean,
- value: false,
- },
+ /** @private {?management.ManagedInfo} */
+ accountManagedInfo_: Object,
+
+ /** @private */
+ subtitle_: String,
+
+ // <if expr="not chromeos">
+ /** @private */
+ managementNoticeHtml_: String,
+ // </if>
+
+ /** @private */
+ managed_: Boolean,
+
+ /** @private */
+ extensionReportingSubtitle_: String,
},
/** @private {?management.ManagementBrowserProxy} */
@@ -63,14 +77,16 @@ Polymer({
attached() {
document.documentElement.classList.remove('loading');
this.browserProxy_ = management.ManagementBrowserProxyImpl.getInstance();
+ this.updateManagedFields_();
this.initBrowserReportingInfo_();
this.addWebUIListener(
'browser-reporting-info-updated',
reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo));
- this.addWebUIListener(
- 'update-load-time-data', data => loadTimeData.overrideValues(data));
+ this.addWebUIListener('managed_state_changed', () => {
+ this.updateManagedFields_();
+ });
this.getExtensions_();
// <if expr="chromeos">
@@ -124,9 +140,9 @@ Polymer({
/** @private */
getLocalTrustRootsInfo_() {
this.browserProxy_.getLocalTrustRootsInfo().then(trustRootsConfigured => {
- this.localTrustRoots_ = loadTimeData.getString(
- trustRootsConfigured ? 'managementTrustRootsConfigured' :
- 'managementTrustRootsNotConfigured');
+ this.localTrustRoots_ = trustRootsConfigured ?
+ loadTimeData.getString('managementTrustRootsConfigured') :
+ '';
});
},
@@ -162,6 +178,8 @@ Polymer({
return 'cr:computer';
case management.DeviceReportingType.LOGS:
return 'management:report';
+ case management.DeviceReportingType.PRINT:
+ return 'cr:print';
default:
return 'cr:computer';
}
@@ -206,4 +224,39 @@ Polymer({
return 'cr:security';
}
},
+
+ /**
+ * Handles the 'search-changed' event fired from the toolbar.
+ * Redirects to the settings page initialized the the current
+ * search query.
+ * @param {!CustomEvent<string>} e
+ * @private
+ */
+ onSearchChanged_: function(e) {
+ const query = e.detail;
+ window.location.href =
+ `chrome://settings?search=${encodeURIComponent(query)}`;
+ },
+
+ /** @private */
+ onTapBack_() {
+ window.location.href = `chrome://settings/help`;
+ },
+
+ /** @private */
+ updateManagedFields_() {
+ this.browserProxy_.getContextualManagedData().then(data => {
+ this.managed_ = data.managed;
+ this.extensionReportingSubtitle_ = data.extensionReportingTitle;
+ this.subtitle_ = data.pageSubtitle;
+ this.accountManagedInfo_ = data.accountManagedInfo;
+ // <if expr="chromeos">
+ this.managementOverview_ = data.overview;
+ this.deviceManagedInfo_ = data.deviceManagedInfo;
+ // </if>
+ // <if expr="not chromeos">
+ this.managementNoticeHtml_ = data.browserManagementNotice;
+ // </if>
+ });
+ },
});
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream_item.html b/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream_item.html
deleted file mode 100644
index 7fc0df69190..00000000000
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream_item.html
+++ /dev/null
@@ -1,102 +0,0 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
-<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="chrome://resources/html/cr.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
-<link rel="import" href="../shared_vars.html">
-
-<dom-module id="activity-log-stream-item">
- <template>
- <style include="cr-icons cr-shared-style">
- :host {
- border-top: var(--cr-separator-line);
- display: block;
- padding: 8px var(--cr-section-padding);
- }
-
- #activity-item-main-row {
- align-items: center;
- display: flex;
- flex-direction: row;
- /* Match separator height. */
- min-height: calc(var(--cr-section-min-height) - var(--separator-gap));
- }
-
- #activity-item-main-row cr-expand-button {
- margin-inline-end: 6px;
- }
-
- #activity-call-and-time {
- display: flex;
- flex: 1;
- flex-direction: row;
- margin-inline-end: auto;
- max-width: var(--activity-log-call-and-time-width);
- }
-
- #activity-type {
- flex: 0 var(--activity-type-width);
- }
-
- #activity-name {
- flex: 1;
- margin-inline-start: 10px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- #activity-time {
- flex: 0 var(--activity-time-width);
- text-align: end;
- }
-
- #expanded-data {
- display: flex;
- flex-direction: column;
- }
-
- .page-url-link {
- margin-bottom: 10px;
- margin-inline-end: 20px;
- margin-inline-start: 16px;
- max-width: var(--activity-log-call-and-time-width);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .data-args {
- margin-bottom: 10px;
- margin-inline-end: 20px;
- margin-inline-start: 16px;
- max-width: var(--activity-log-call-and-time-width);
- overflow-wrap: break-word;
- }
- </style>
- <div actionable$="[[isExpandable_]]"
- id="activity-item-main-row"
- on-click="onExpandClick_">
- <div id="activity-call-and-time">
- <span id="activity-type">[[data.activityType]]</span>
- <span id="activity-name" title="[[data.name]]">[[data.name]]</span>
- <span id="activity-time">[[getFormattedTime_(data.timeStamp)]]</span>
- </div>
- <cr-expand-button expanded="{{isExpanded_}}"
- hidden$="[[!isExpandable_]]">
- </cr-expand-button>
- </div>
- <iron-collapse opened="[[isExpanded_]]">
- <div id="expanded-data" hidden$="[[!isExpandable_]]">
- <a class="page-url-link" href="[[data.pageUrl]]"
- hidden$="[[!hasPageUrl_(data.pageUrl)]]"
- title="[[data.pageUrl]]">[[data.pageUrl]]</a>
- <span class="data-args"
- hidden$="[[!hasArgs_(data.args)]]">[[data.args]]</span>
- </div>
- </iron-collapse>
- </template>
- <script src="activity_log_stream_item.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream_item.js b/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream_item.js
deleted file mode 100644
index 70a50eca28c..00000000000
--- a/chromium/chrome/browser/resources/md_extensions/activity_log/activity_log_stream_item.js
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('extensions', function() {
- 'use strict';
-
- /**
- * @typedef {{
- * name: string,
- * timestamp: number,
- * activityType: !chrome.activityLogPrivate.ExtensionActivityFilter,
- * pageUrl: string,
- * args: ?String
- * }}
- */
- let StreamItem;
-
- const ActivityLogStreamItem = Polymer({
- is: 'activity-log-stream-item',
-
- properties: {
- /**
- * The underlying ActivityGroup that provides data for the
- * ActivityLogItem displayed.
- * @type {!extensions.StreamItem}
- */
- data: Object,
-
- /** @private */
- isExpandable_: {
- type: Boolean,
- computed: 'computeIsExpandable_(data)',
- },
-
- /** @private */
- isExpanded_: {
- type: Boolean,
- value: false,
- },
- },
-
- /**
- * @private
- * @return {boolean}
- */
- computeIsExpandable_: function() {
- return this.hasPageUrl_() || this.hasArgs_();
- },
-
- /**
- * @private
- * @return {string}
- */
- getFormattedTime_: function() {
- // Format the activity's time to HH:MM:SS.mmm format. Use ToLocaleString
- // for HH:MM:SS and padLeft for milliseconds.
- const activityDate = new Date(this.data.timestamp);
- const timeString = activityDate.toLocaleTimeString(undefined, {
- hour12: false,
- hour: '2-digit',
- minute: '2-digit',
- second: '2-digit',
- });
-
- const ms = activityDate.getMilliseconds().toString().padStart(3, '0');
- return `${timeString}.${ms}`;
- },
-
- /**
- * @private
- * @return {boolean}
- */
- hasArgs_: function() {
- return !!this.data.args && this.data.args != 'null';
- },
-
- /**
- * @private
- * @return {boolean}
- */
- hasPageUrl_: function() {
- return !!this.data.pageUrl;
- },
-
- /** @private */
- onExpandClick_: function() {
- if (this.isExpandable_) {
- this.isExpanded_ = !this.isExpanded_;
- }
- },
- });
-
- return {
- ActivityLogStreamItem: ActivityLogStreamItem,
- StreamItem: StreamItem,
- };
-});
diff --git a/chromium/chrome/browser/resources/md_extensions/extensions_resources_vulcanized.grd b/chromium/chrome/browser/resources/md_extensions/extensions_resources_vulcanized.grd
deleted file mode 100644
index 1fafbcdc93a..00000000000
--- a/chromium/chrome/browser/resources/md_extensions/extensions_resources_vulcanized.grd
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
- <outputs>
- <output filename="grit/extensions_resources.h" type="rc_header">
- <emit emit_type='prepend'></emit>
- </output>
- <output filename="grit/extensions_resources_map.cc"
- type="resource_map_source" />
- <output filename="grit/extensions_resources_map.h"
- type="resource_map_header" />
- <output filename="extensions_resources.pak" type="data_package" />
- </outputs>
- <release seq="1">
- <includes>
- <include name="IDR_MD_EXTENSIONS_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\md_extensions\vulcanized.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MD_EXTENSIONS_VULCANIZED_P2_HTML" file="${root_gen_dir}\chrome\browser\resources\md_extensions\vulcanized.p2.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MD_EXTENSIONS_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\md_extensions\crisper.js" use_base_dir="false" flattenhtml="true" type="BINDATA" compress="gzip" />
- </includes>
- </release>
-</grit>
diff --git a/chromium/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.html b/chromium/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.html
index 50075c18bae..393f05c7ed6 100644
--- a/chromium/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.html
+++ b/chromium/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-selector/iron-selector.html">
@@ -160,10 +161,10 @@
<template is="dom-if" if="[[searchEnabled_]]">
<div id="sink-search">
<div class="sink-content">
- <paper-icon-button id="sink-search-icon"
- icon="media-router:search" on-tap="searchButtonClick_"
+ <cr-icon-button id="sink-search-icon"
+ iron-icon="media-router:search" on-tap="searchButtonClick_"
title="[[i18n('searchButtonTitle')]]">
- </paper-icon-button>
+ </cr-icon-button>
<cr-input id="sink-search-input" value="{{searchInputText_}}"
placeholder="[[i18n('searchInputLabel')]]">
</cr-input>
diff --git a/chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.css b/chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.css
index 695e07f249c..124b120cd1d 100644
--- a/chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.css
+++ b/chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.css
@@ -44,6 +44,10 @@
white-space: nowrap;
}
+cr-icon-button {
+ --cr-icon-button-color: currentColor;
+}
+
#header-text {
font-size: 1.175em;
line-height: 36px;
@@ -57,10 +61,6 @@
background-color: var(--paper-red-700);
}
-paper-icon-button {
- display: inline-block;
-}
-
#main-container {
display: flex;
padding-top: 10px;
diff --git a/chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.html b/chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.html
index 3a58bc24608..5b9189bf3a8 100644
--- a/chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.html
+++ b/chromium/chrome/browser/resources/media_router/elements/media_router_header/media_router_header.html
@@ -1,8 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../icons/media_router_icons.html">
<dom-module id="media-router-header">
<link rel="import" type="css" href="../../media_router_common.css">
@@ -12,26 +12,26 @@
<div id="main-container">
<template is="dom-if" if="[[computeBackButtonShown_(view)]]">
<div id="back-button-container">
- <paper-icon-button id="back-button" icon="[[arrowDropIcon_]]"
+ <cr-icon-button id="back-button" iron-icon="[[arrowDropIcon_]]"
on-tap="onBackButtonClick_" title="[[i18n('backButtonTitle')]]">
- </paper-icon-button>
+ </cr-icon-button>
</div>
</template>
<div id="header-and-arrow-container" on-tap="onHeaderOrArrowClick_">
<span id="header-text" title="[[tooltip]]">
[[headingText]]</span>
<div id="arrow-drop-container">
- <paper-icon-button icon="[[computeArrowDropIcon_(view)]]"
+ <cr-icon-button iron-icon="[[computeArrowDropIcon_(view)]]"
id="arrow-drop-icon" disabled$="[[arrowDropIconDisabled]]"
hidden$="[[computeArrowDropIconHidden_(view)]]"
title="[[computeArrowDropTitle_(view)]]">
- </paper-icon-button>
+ </cr-icon-button>
</div>
</div>
<div id="close-button-container">
- <paper-icon-button icon="cr:close" id="close-button"
+ <cr-icon-button iron-icon="cr:close" id="close-button"
on-tap="onCloseButtonClick_" title="[[i18n('closeButtonTitle')]]">
- </paper-icon-button>
+ </cr-icon-button>
</div>
</div>
<template is="dom-if" if="[[showEmail]]">
diff --git a/chromium/chrome/browser/resources/media_router/elements/route_controls/route_controls.html b/chromium/chrome/browser/resources/media_router/elements/route_controls/route_controls.html
index b46e424d60a..c60d15d518f 100644
--- a/chromium/chrome/browser/resources/media_router/elements/route_controls/route_controls.html
+++ b/chromium/chrome/browser/resources/media_router/elements/route_controls/route_controls.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_slider/cr_slider.html">
<link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
@@ -53,20 +54,20 @@
</div>
<div id="play-pause-volume-hangouts-controls">
<span id="button-holder" dir="ltr">
- <paper-icon-button
+ <cr-icon-button
id="route-play-pause-button"
hidden="[[!routeStatus.canPlayPause]]"
disabled="[[!routeStatus.canPlayPause]]"
- icon="[[getPlayPauseIcon_(routeStatus)]]"
+ iron-icon="[[getPlayPauseIcon_(routeStatus)]]"
title="[[getPlayPauseTitle_(routeStatus)]]"
- on-click="onPlayPause_"></paper-icon-button>
- <paper-icon-button
+ on-click="onPlayPause_"></cr-icon-button>
+ <cr-icon-button
id="route-volume-button"
hidden="[[!routeStatus.canMute]]"
disabled="[[!routeStatus.canMute]]"
- icon="[[getMuteUnmuteIcon_(routeStatus)]]"
+ iron-icon="[[getMuteUnmuteIcon_(routeStatus)]]"
title="[[getMuteUnmuteTitle_(routeStatus)]]"
- on-click="onMuteUnmute_"></paper-icon-button>
+ on-click="onMuteUnmute_"></cr-icon-button>
</span>
<span id="volume-holder" hidden="[[!routeStatus.canSetVolume]]">
<cr-slider
@@ -82,8 +83,7 @@
<cr-checkbox
checked="[[hangoutsLocalPresent_]]"
id="hangouts-local-present-checkbox"
- on-change="onHangoutsLocalPresentChange_"
- tabindex="0">
+ on-change="onHangoutsLocalPresentChange_">
<span id='hangouts-local-present-checkbox-title'>
[[i18n('hangoutsLocalPresentTitle')]]
</span>
diff --git a/chromium/chrome/browser/resources/media_router/media_router_common.css b/chromium/chrome/browser/resources/media_router/media_router_common.css
index 030af36ca6c..7dba9da3369 100644
--- a/chromium/chrome/browser/resources/media_router/media_router_common.css
+++ b/chromium/chrome/browser/resources/media_router/media_router_common.css
@@ -29,3 +29,8 @@
text-overflow: ellipsis;
white-space: nowrap;
}
+
+cr-icon-button {
+ --cr-icon-button-color: black;
+ margin: 0;
+}
diff --git a/chromium/chrome/browser/resources/memory_internals.html b/chromium/chrome/browser/resources/memory_internals/memory_internals.html
index 020e7c1c699..2c3a17b56f0 100644
--- a/chromium/chrome/browser/resources/memory_internals.html
+++ b/chromium/chrome/browser/resources/memory_internals/memory_internals.html
@@ -8,7 +8,7 @@
th {
border-bottom: 1px solid black;
padding: 5px;
- text-align: left;
+ text-align: start;
}
td {
padding: 5px;
diff --git a/chromium/chrome/browser/resources/memory_internals.js b/chromium/chrome/browser/resources/memory_internals/memory_internals.js
index d0e585531c7..d0e585531c7 100644
--- a/chromium/chrome/browser/resources/memory_internals.js
+++ b/chromium/chrome/browser/resources/memory_internals/memory_internals.js
diff --git a/chromium/chrome/browser/resources/net_internals/index.html b/chromium/chrome/browser/resources/net_internals/index.html
index 417ec37539c..56f50557873 100644
--- a/chromium/chrome/browser/resources/net_internals/index.html
+++ b/chromium/chrome/browser/resources/net_internals/index.html
@@ -15,9 +15,7 @@ found in the LICENSE file.
<link rel="stylesheet" href="chromeos_view.css">
<script src="chrome://resources/js/util.js"></script>
<script src="chrome://resources/js/cr.js"></script>
- <script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://net-internals/index.js"></script>
- <script src="chrome://net-internals/strings.js"></script>
</head>
<body id=events-view-drop-target>
<div id="tab-list">
diff --git a/chromium/chrome/browser/resources/ntp4/BUILD.gn b/chromium/chrome/browser/resources/ntp4/BUILD.gn
index 7bd99669526..a32be737dff 100644
--- a/chromium/chrome/browser/resources/ntp4/BUILD.gn
+++ b/chromium/chrome/browser/resources/ntp4/BUILD.gn
@@ -23,10 +23,8 @@ js_library("apps_page") {
"//ui/webui/resources/js/cr/ui/bubble.js",
"//ui/webui/resources/js/cr/ui/card_slider.js",
"//ui/webui/resources/js/cr/ui/command.js",
- "//ui/webui/resources/js/cr/ui/context_menu_button.js",
"//ui/webui/resources/js/cr/ui/context_menu_handler.js",
"//ui/webui/resources/js/cr/ui/drag_wrapper.js",
- "//ui/webui/resources/js/cr/ui/expandable_bubble.js",
"//ui/webui/resources/js/cr/ui/focus_manager.js",
"//ui/webui/resources/js/cr/ui/menu.js",
"//ui/webui/resources/js/cr/ui/menu_button.js",
diff --git a/chromium/chrome/browser/resources/ntp4/apps_page.js b/chromium/chrome/browser/resources/ntp4/apps_page.js
index 72f6795494c..32bb497a416 100644
--- a/chromium/chrome/browser/resources/ntp4/apps_page.js
+++ b/chromium/chrome/browser/resources/ntp4/apps_page.js
@@ -53,9 +53,7 @@ cr.define('ntp', function() {
menu.appendChild(cr.ui.MenuItem.createSeparator());
this.launchRegularTab_ = this.appendMenuItem_('applaunchtyperegular');
this.launchPinnedTab_ = this.appendMenuItem_('applaunchtypepinned');
- if (loadTimeData.getBoolean('canHostedAppsOpenInWindows')) {
- this.launchNewWindow_ = this.appendMenuItem_('applaunchtypewindow');
- }
+ this.launchNewWindow_ = this.appendMenuItem_('applaunchtypewindow');
this.launchFullscreen_ = this.appendMenuItem_('applaunchtypefullscreen');
const self = this;
@@ -90,6 +88,12 @@ cr.define('ntp', function() {
this.createShortcut_.addEventListener(
'activate', this.onCreateShortcut_.bind(this));
+ this.installLocallySeparator_ =
+ menu.appendChild(cr.ui.MenuItem.createSeparator());
+ this.installLocally_ = this.appendMenuItem_('appinstalllocally');
+ this.installLocally_.addEventListener(
+ 'activate', this.onInstallLocally_.bind(this));
+
document.body.appendChild(menu);
},
@@ -146,16 +150,11 @@ cr.define('ntp', function() {
this.forAllLaunchTypes_(function(launchTypeButton, id) {
launchTypeButton.disabled = false;
launchTypeButton.checked = app.appData.launch_type == id;
- // There are three cases when a launch type is hidden:
+ // There are two cases when a launch type is hidden:
// 1. if the launch type can't be changed.
- // 2. canHostedAppsOpenInWindows is false and type is launchTypeWindow
- // 3. enableNewBookmarkApps is true and type is anything except
- // launchTypeWindow
+ // 2. type is anything except launchTypeWindow
launchTypeButton.hidden = !app.appData.mayChangeLaunchType ||
- (!loadTimeData.getBoolean('canHostedAppsOpenInWindows') &&
- launchTypeButton == launchTypeWindow) ||
- (loadTimeData.getBoolean('enableNewBookmarkApps') &&
- launchTypeButton != launchTypeWindow);
+ launchTypeButton != launchTypeWindow;
if (!launchTypeButton.hidden) {
hasLaunchType = true;
}
@@ -175,6 +174,9 @@ cr.define('ntp', function() {
this.createShortcutSeparator_.hidden = this.createShortcut_.hidden =
!app.appData.mayCreateShortcuts;
+
+ this.installLocallySeparator_.hidden = this.installLocally_.hidden =
+ app.appData.isLocallyInstalled;
},
/** @private */
@@ -192,11 +194,9 @@ cr.define('ntp', function() {
let targetLaunchType = pressed;
// When bookmark apps are enabled, hosted apps can only toggle between
// open as window and open as tab.
- if (loadTimeData.getBoolean('enableNewBookmarkApps')) {
- targetLaunchType = this.launchNewWindow_.checked ?
- this.launchRegularTab_ :
- this.launchNewWindow_;
- }
+ targetLaunchType = this.launchNewWindow_.checked ?
+ this.launchRegularTab_ :
+ this.launchNewWindow_;
this.forAllLaunchTypes_(function(launchTypeButton, id) {
if (launchTypeButton == targetLaunchType) {
chrome.send('setLaunchType', [app.appId, id]);
@@ -230,6 +230,11 @@ cr.define('ntp', function() {
},
/** @private */
+ onInstallLocally_: function() {
+ chrome.send('installAppLocally', [this.app_.appData.id]);
+ },
+
+ /** @private */
onShowAppInfo_: function() {
chrome.send('showAppInfo', [this.app_.appData.id]);
}
diff --git a/chromium/chrome/browser/resources/ntp4/guest_tab.html b/chromium/chrome/browser/resources/ntp4/guest_tab.html
index a89226c66f4..1807bfc1891 100644
--- a/chromium/chrome/browser/resources/ntp4/guest_tab.html
+++ b/chromium/chrome/browser/resources/ntp4/guest_tab.html
@@ -1,5 +1,5 @@
<!doctype html>
-<html dir="$i18n{textdirection}" lang="$i18n{language}">
+<html dir="$i18n{textdirection}" lang="$i18n{language}" $i18n{dark}>
<head>
<meta charset="utf-8">
<title>$i18n{title}</title>
diff --git a/chromium/chrome/browser/resources/ntp4/incognito_and_guest_tab.css b/chromium/chrome/browser/resources/ntp4/incognito_and_guest_tab.css
index ef6f2791324..d6d9d7774fc 100644
--- a/chromium/chrome/browser/resources/ntp4/incognito_and_guest_tab.css
+++ b/chromium/chrome/browser/resources/ntp4/incognito_and_guest_tab.css
@@ -9,6 +9,11 @@ body {
font-size: 85%;
}
+[dark] {
+ background: rgb(50, 54, 57);
+ color: rgb(232, 234, 237); /* --google-grey-200 */
+}
+
h1 {
font-size: 200%;
font-weight: 400;
@@ -29,8 +34,6 @@ a:hover {
text-decoration: underline;
}
-/* 'Learn More' button styled like a Material Design text button.
- * TODO(edwardjung): Switch styled links to actual text buttons. */
.learn-more-button {
color: rgb(66, 133, 244);
display: inline-block;
@@ -39,7 +42,10 @@ a:hover {
margin-top: 1.98em;
padding: 10.5px 12px;
text-decoration: none;
- text-transform: uppercase;
+}
+
+[dark] :-webkit-any(a, .learn-more-button) {
+ color: rgb(138, 180, 248); /* --google-blue-refresh-300 */
}
.content {
diff --git a/chromium/chrome/browser/resources/ntp4/incognito_tab.css b/chromium/chrome/browser/resources/ntp4/incognito_tab.css
index 5a06e024eea..e4bdbe6257c 100644
--- a/chromium/chrome/browser/resources/ntp4/incognito_tab.css
+++ b/chromium/chrome/browser/resources/ntp4/incognito_tab.css
@@ -14,14 +14,13 @@ body {
/* This is identical to the default background color. It's necessary to set it
for the case when a theme with a background image is installed. */
background-color: rgb(50, 54, 57);
- color: rgb(189, 193, 198);
+ color: rgb(232, 234, 237); /* --google-grey-200 */
font-size: calc(100% - 2px);
line-height: calc(100% + 6px);
min-width: 240px;
}
h1 {
- color: rgb(218, 220, 224);
font-size: calc(100% + 8px);
font-weight: 400;
line-height: calc(100% + 8px);
diff --git a/chromium/chrome/browser/resources/ntp4/incognito_tab.js b/chromium/chrome/browser/resources/ntp4/incognito_tab.js
index 8aaf797bfa4..b2d5eb74e24 100644
--- a/chromium/chrome/browser/resources/ntp4/incognito_tab.js
+++ b/chromium/chrome/browser/resources/ntp4/incognito_tab.js
@@ -33,7 +33,10 @@ function recomputeLayoutWidth() {
content.style.maxWidth = maxWidth + 'px';
}
-window.addEventListener('load', recomputeLayoutWidth);
+window.addEventListener('load', function() {
+ recomputeLayoutWidth();
+ chrome.send('observeThemeChanges');
+});
// Handle the bookmark bar, theme, and font size change requests
// from the C++ side.
diff --git a/chromium/chrome/browser/resources/ntp4/nav_dot.css b/chromium/chrome/browser/resources/ntp4/nav_dot.css
index cca4b54fc2b..7abbfb77e1d 100644
--- a/chromium/chrome/browser/resources/ntp4/nav_dot.css
+++ b/chromium/chrome/browser/resources/ntp4/nav_dot.css
@@ -55,14 +55,15 @@ html.starting-up #dot-list {
}
.dot input {
- -webkit-appearance: caret;
+ -webkit-appearance: none;
background-color: transparent;
+ border: none;
cursor: inherit;
font: inherit;
height: auto;
margin-inline-start: 2px;
margin-top: 2px;
- padding: 1px 0;
+ padding: 2px 1px;
transition: color 200ms;
width: 90%;
}
diff --git a/chromium/chrome/browser/resources/ntp4/new_tab.html b/chromium/chrome/browser/resources/ntp4/new_tab.html
index d6f57b23e2a..af9604705c3 100644
--- a/chromium/chrome/browser/resources/ntp4/new_tab.html
+++ b/chromium/chrome/browser/resources/ntp4/new_tab.html
@@ -18,7 +18,6 @@
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
<link rel="stylesheet" href="../../../../ui/webui/resources/css/bubble.css">
-<link rel="stylesheet" href="../../../../ui/webui/resources/css/expandable_bubble.css">
<link rel="stylesheet" href="../../../../ui/webui/resources/css/menu.css">
<link rel="stylesheet" href="../../../../ui/webui/resources/css/menu_button.css">
<link rel="stylesheet" href="../../../../ui/webui/resources/css/trash.css">
@@ -43,13 +42,11 @@ document.write('<link id="themecss" rel="stylesheet" ' +
<script src="../../../../ui/webui/resources/js/cr/ui/card_slider.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/context_menu_handler.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/drag_wrapper.js"></script>
-<script src="../../../../ui/webui/resources/js/cr/ui/expandable_bubble.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/focus_manager.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/menu_item.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/menu.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/position_util.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/menu_button.js"></script>
-<script src="../../../../ui/webui/resources/js/cr/ui/context_menu_button.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/touch_handler.js"></script>
<script src="tile_page.js"></script>
diff --git a/chromium/chrome/browser/resources/ntp4/new_tab.js b/chromium/chrome/browser/resources/ntp4/new_tab.js
index 0c3d114aef6..88a315998ba 100644
--- a/chromium/chrome/browser/resources/ntp4/new_tab.js
+++ b/chromium/chrome/browser/resources/ntp4/new_tab.js
@@ -139,10 +139,11 @@ cr.define('ntp', function() {
newTabView.cardSlider.currentCardValue.navigationDot.classList.add(
'selected');
- cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true);
document.documentElement.classList.remove('starting-up');
startTime = Date.now();
+
+ chrome.send('observeThemeChanges');
});
}
diff --git a/chromium/chrome/browser/resources/ntp4/new_tab_theme.css b/chromium/chrome/browser/resources/ntp4/new_tab_theme.css
index 56bb6889f34..48aea9313ee 100644
--- a/chromium/chrome/browser/resources/ntp4/new_tab_theme.css
+++ b/chromium/chrome/browser/resources/ntp4/new_tab_theme.css
@@ -10,17 +10,6 @@ html {
background-repeat: $i18n{backgroundTiling};
}
-#attribution {
- left: $i18n{leftAlignAttribution};
- right: $i18n{rightAlignAttribution};
- text-align: $i18n{textAlignAttribution};
- display: $i18n{displayAttribution};
-}
-
-#attribution-img {
- content: url(chrome://theme/IDR_THEME_NTP_ATTRIBUTION?$i18n{themeId});
-}
-
html[bookmarkbarattached='true'] {
background-position: $i18n{backgroundBarAttached};
}
@@ -31,13 +20,21 @@ body {
overflow: auto;
}
-#attribution,
-[is='action-link'] {
+[is='action-link'],
+[is='action-link']:active {
+ color: rgb($i18n{colorLink});
+}
+
+#attribution {
color: $i18n{colorTextLight};
+ display: $i18n{displayAttribution};
+ left: $i18n{leftAlignAttribution};
+ right: $i18n{rightAlignAttribution};
+ text-align: $i18n{textAlignAttribution};
}
-[is='action-link']:active {
- color: $i18n{colorTextRgba};
+#attribution-img {
+ content: url(chrome://theme/IDR_THEME_NTP_ATTRIBUTION?$i18n{themeId});
}
.page-switcher {
diff --git a/chromium/chrome/browser/resources/omnibox/omnibox_output.js b/chromium/chrome/browser/resources/omnibox/omnibox_output.js
index bd4c0f4bbb3..2d8cee79114 100644
--- a/chromium/chrome/browser/resources/omnibox/omnibox_output.js
+++ b/chromium/chrome/browser/resources/omnibox/omnibox_output.js
@@ -14,6 +14,9 @@ cr.define('omnibox_output', function() {
*/
let ResultsDetails;
+ /** @typedef {Array<{key: string, value: string}>} */
+ let KeyValuePair;
+
/** @param {!Element} element*/
function clearChildren(element) {
while (element.firstChild) {
@@ -820,11 +823,11 @@ cr.define('omnibox_output', function() {
}
}
- class OutputKeyValueTuplesProperty extends OutputJsonProperty {
+ class OutputAdditionalInfoProperty extends OutputJsonProperty {
/** @private @override */
render_() {
clearChildren(this.pre_);
- this.value.forEach(({key, value}) => {
+ this.tuples_.forEach(({key, value}) => {
this.pre_.appendChild(
OutputJsonProperty.renderJsonWord(key + ': ', ['key']));
this.pre_.appendChild(
@@ -834,9 +837,17 @@ cr.define('omnibox_output', function() {
/** @override @return {string} */
get text() {
- return this.value.reduce(
+ return this.tuples_.reduce(
(prev, {key, value}) => `${prev}${key}: ${value}\n`, '');
}
+
+ /** @private @return {!KeyValuePair} */
+ get tuples_() {
+ return [
+ .../** @type {!KeyValuePair} */ (this.value),
+ {key: 'document_type', value: this.values_[1]}
+ ];
+ }
}
class OutputUrlProperty extends FlexWrappingOutputProperty {
@@ -1067,7 +1078,7 @@ cr.define('omnibox_output', function() {
new Column(
['Additional Info'], '', 'additionalInfo', false,
'Additional Info\nProvider-specific information about the result.',
- ['additionalInfo'], OutputKeyValueTuplesProperty)
+ ['additionalInfo', 'documentType'], OutputAdditionalInfoProperty)
];
/** @type {!Column} */
@@ -1097,7 +1108,7 @@ cr.define('omnibox_output', function() {
customElements.define(
'output-json-property', OutputJsonProperty, {extends: 'td'});
customElements.define(
- 'output-key-value-tuple-property', OutputKeyValueTuplesProperty,
+ 'output-additional-info-property', OutputAdditionalInfoProperty,
{extends: 'td'});
customElements.define(
'output-url-property', OutputUrlProperty, {extends: 'td'});
diff --git a/chromium/chrome/browser/resources/page_not_available_for_guest/app.html b/chromium/chrome/browser/resources/page_not_available_for_guest/app.html
index 3313ee43dc0..9e8736a40bb 100644
--- a/chromium/chrome/browser/resources/page_not_available_for_guest/app.html
+++ b/chromium/chrome/browser/resources/page_not_available_for_guest/app.html
@@ -1,12 +1,17 @@
<!doctype html>
-<html dir="$i18n{textdirection}" lang="$i18n{language}">
+<html dir="$i18n{textdirection}" lang="$i18n{language}" $i18n{dark}>
<head>
<meta charset="utf-8">
<title>$i18n{pageTitle}</title>
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
+ <link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<style>
+ html {
+ background: var(--md-background-color);
+ }
+
h1 {
- color: #6e6e6e;
+ color: var(--md-loading-message-color);
font-weight: 500;
margin-top: 80px;
text-align: center;
@@ -15,5 +20,6 @@
</head>
<body>
<h1>$i18n{pageHeading}</h1>
+ <link rel="import" href="chrome://resources/html/dark_mode.html">
</body>
</html>
diff --git a/chromium/chrome/browser/resources/pdf/elements/shared-vars.html b/chromium/chrome/browser/resources/pdf/elements/shared-vars.html
index 2ba130405e4..164abe7c0e7 100644
--- a/chromium/chrome/browser/resources/pdf/elements/shared-vars.html
+++ b/chromium/chrome/browser/resources/pdf/elements/shared-vars.html
@@ -7,12 +7,6 @@
html {
--iron-icon-height: 20px;
--iron-icon-width: 20px;
- --paper-icon-button: {
- height: 32px;
- padding: 6px;
- width: 32px;
- };
- --paper-icon-button-ink-color: rgb(189, 189, 189);
--viewer-icon-ink-color: rgb(189, 189, 189);
}
</style>
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html
index 174b498e017..d3c11673161 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html
@@ -1,5 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-ripple/paper-ripple.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
@@ -36,14 +37,11 @@
}
#expand {
- --iron-icon-height: 16px;
- --iron-icon-width: 16px;
- --paper-icon-button-ink-color: var(--paper-grey-900);
- height: 28px;
- min-width: 28px;
- padding: 6px;
+ --cr-icon-button-color: var(--primary-text-color);
+ --cr-icon-button-icon-size: 16px;
+ --cr-icon-button-size: 28px;
+ margin: 0;
transition: transform 150ms;
- width: 28px;
}
:host-context([dir=rtl]) #expand {
@@ -56,9 +54,8 @@
</style>
<div id="item" on-click="onClick">
<paper-ripple></paper-ripple>
- <paper-icon-button id="expand" icon="cr:chevron-right"
- on-click="toggleChildren">
- </paper-icon-button>
+ <cr-icon-button id="expand" iron-icon="cr:chevron-right"
+ on-click="toggleChildren"></cr-icon-button>
<span id="title" tabindex="0">{{bookmark.title}}</span>
</div>
<!-- dom-if will stamp the complex bookmark tree lazily as individual nodes
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js
index baad5778238..160191b6ecb 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js
@@ -91,7 +91,7 @@ Polymer({
},
onSpace_: function(e) {
- // paper-icon-button stops propagation of space events, so there's no need
+ // cr-icon-button stops propagation of space events, so there's no need
// to check the event source here.
this.onClick();
// Prevent default space scroll behavior.
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html
index 921ce0f27a3..2f87e5efc14 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html
@@ -1,7 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="../icons.html">
@@ -51,23 +51,16 @@
user-select: none;
}
- paper-icon-button {
- height: 36px;
+ cr-icon-button {
+ --cr-icon-button-color: rgb(241, 241, 241);
margin: 6px;
- padding: 8px;
- width: 36px;
}
- paper-icon-button:hover {
+ cr-icon-button:hover {
background: rgba(255, 255, 255, 0.08);
border-radius: 50%;
}
- paper-icon-button:focus {
- --paper-icon-button-ink-color:white;
- --paper-ripple-opacity: 0.24;
- }
-
paper-progress {
--paper-progress-active-color: var(--google-blue-300);
--paper-progress-container-color: transparent;
@@ -195,32 +188,24 @@
<div id="buttons" class="invisible">
<template is="dom-if" if="[[pdfAnnotationsEnabled]]">
- <paper-icon-button id="annotate" icon="pdf:create"
- disabled="[[!annotationAvailable]]"
- on-click="toggleAnnotation"
+ <cr-icon-button id="annotate" iron-icon="pdf:create"
+ disabled="[[!annotationAvailable]]" on-click="toggleAnnotation"
aria-label$="{{strings.tooltipAnnotate}}"
- title$="{{strings.tooltipAnnotate}}">
- </paper-icon-button>
+ title$="{{strings.tooltipAnnotate}}"></cr-icon-button>
</template>
- <paper-icon-button id="rotate-right" icon="pdf:rotate-right"
- disabled="[[annotationMode]]"
- on-click="rotateRight"
+ <cr-icon-button id="rotate-right" iron-icon="pdf:rotate-right"
+ disabled="[[annotationMode]]" on-click="rotateRight"
aria-label$="{{strings.tooltipRotateCW}}"
- title$="{{strings.tooltipRotateCW}}">
- </paper-icon-button>
+ title$="{{strings.tooltipRotateCW}}"></cr-icon-button>
- <paper-icon-button id="download" icon="cr:file-download"
- on-click="download"
- aria-label$="{{strings.tooltipDownload}}"
- title$="{{strings.tooltipDownload}}">
- </paper-icon-button>
+ <cr-icon-button id="download" iron-icon="cr:file-download"
+ on-click="download" aria-label$="{{strings.tooltipDownload}}"
+ title$="{{strings.tooltipDownload}}"></cr-icon-button>
- <paper-icon-button id="print" icon="cr:print"
- on-click="print"
+ <cr-icon-button id="print" iron-icon="cr:print" on-click="print"
aria-label$="{{strings.tooltipPrint}}"
- title$="{{strings.tooltipPrint}}">
- </paper-icon-button>
+ title$="{{strings.tooltipPrint}}"></cr-icon-button>
<viewer-toolbar-dropdown id="bookmarks"
selected
@@ -229,8 +214,8 @@
open-icon="pdf:bookmark"
closed-icon="pdf:bookmark-border"
header="{{strings.bookmarks}}">
- <viewer-bookmarks-content bookmarks="{{bookmarks}}">
- </viewer-bookmarks-content>
+ <viewer-bookmarks-content bookmarks="{{bookmarks}}">
+ </viewer-bookmarks-content>
</viewer-toolbar-dropdown>
</div>
</div>
@@ -280,31 +265,23 @@
</viewer-pen-options>
</viewer-toolbar-dropdown>
- <paper-icon-button id="eraser"
+ <cr-icon-button id="eraser"
selected$="[[equal_('eraser', annotationTool.tool)]]"
- on-click="annotationToolClicked_"
- icon="pdf:eraser"
+ on-click="annotationToolClicked_" iron-icon="pdf:eraser"
aria-label$="{{strings.annotationEraser}}"
- title$="{{strings.annotationEraser}}">
- </paper-icon-button>
+ title$="{{strings.annotationEraser}}"></cr-icon-button>
<div id="annotation-separator"></div>
- <paper-icon-button id="undo"
- disabled="[[!canUndoAnnotation]]"
- icon="pdf:undo"
- on-click="undo"
+ <cr-icon-button id="undo" disabled="[[!canUndoAnnotation]]"
+ iron-icon="pdf:undo" on-click="undo"
aria-label$="{{strings.annotationUndo}}"
- title$="{{strings.annotationUndo}}">
- </paper-icon-button>
+ title$="{{strings.annotationUndo}}"></cr-icon-button>
- <paper-icon-button id="redo"
- disabled="[[!canRedoAnnotation]]"
- icon="pdf:redo"
- on-click="redo"
+ <cr-icon-button id="redo" disabled="[[!canRedoAnnotation]]"
+ iron-icon="pdf:redo" on-click="redo"
aria-label$="{{strings.annotationRedo}}"
- title$="{{strings.annotationRedo}}">
- </paper-icon-button>
+ title$="{{strings.annotationRedo}}"></cr-icon-button>
</div>
</template>
<script src="viewer-pdf-toolbar.js"></script>
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/viewer-pen-options.html b/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/viewer-pen-options.html
index 3151736c3e3..dbf18b0bfda 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/viewer-pen-options.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/viewer-pen-options.html
@@ -1,5 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html">
+
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<dom-module id="viewer-pen-options">
<template>
@@ -14,21 +15,20 @@
#colors {
overflow: hidden;
}
- input,
- #expand {
- height: 32px;
- width: 32px;
- }
#expand {
+ --cr-icon-button-icon-size: 16px;
+ --cr-icon-button-size: 32px;
grid-column: 8;
grid-row: 1 / 4;
+ margin: 0;
}
input {
-webkit-appearance: none;
border-radius: 16px;
+ height: 32px;
margin: 0;
padding: 0;
-
+ width: 32px;
}
#sizes input {
background: black;
@@ -70,12 +70,9 @@
aria-label$="[[lookup_(strings, item.name)]]"
on-pointerdown="blurOnPointerDown">
</template>
- <paper-icon-button id="expand" icon="cr:expand-more"
- tabindex="3"
- on-click="toggleExpanded_"
- aria-label$="[[strings.annotationExpand]]"
- title$="[[strings.annotationExpand]]">
- </paper-icon-button>
+ <cr-icon-button id="expand" iron-icon="cr:expand-more" tabindex="3"
+ on-click="toggleExpanded_" aria-label$="[[strings.annotationExpand]]"
+ title$="[[strings.annotationExpand]]"></cr-icon-button>
</div>
<div id="separator"></div>
<div id="sizes" on-change="sizeChanged_">
@@ -88,7 +85,6 @@
on-pointerdown="blurOnPointerDown">
</template>
</div>
- </paper-icon-button>
</template>
<script src="viewer-pen-options.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.html b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.html
index c3e029f3458..c9572082003 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.html
@@ -1,9 +1,18 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-fab/paper-fab.html">
<dom-module id="viewer-zoom-button">
<template>
<style>
+ :host {
+ --translate-x-distance: 132px;
+ }
+
+ :host([new-print-preview]) {
+ --translate-x-distance: 96px;
+ }
+
#wrapper {
transition: transform 250ms;
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
@@ -12,12 +21,12 @@
:host([closed]) #wrapper {
/* 132px roughly flips the location of the button across the right edge
* of the page. */
- transform: translateX(132px);
+ transform: translateX(var(--translate-x-distance));
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}
- :host-context([dir=rtl]):host([closed]) #wrapper {
- transform: translateX(-132px);
+ :host([show-on-left][closed]) #wrapper {
+ transform: translateX(calc(-1 * var(--translate-x-distance)));
}
paper-fab {
@@ -31,9 +40,32 @@
overflow: visible;
}
+ :host([new-print-preview]) paper-fab {
+ --paper-fab-mini: {
+ height: 24px;
+ padding: 4px;
+ width: 24px;
+ };
+ background-color: var(--google-grey-100);
+ color: var(--google-grey-refresh-700);
+ }
+
+ :host-context([dark]):host([new-print-preview]) paper-fab {
+ background-color: var(--google-grey-900);
+ color: var(--google-grey-200);
+ }
+
paper-fab.keyboard-focus {
background-color: var(--viewer-icon-ink-color);
}
+
+ :host([new-print-preview]) paper-fab.keyboard-focus {
+ background-color: var(--google-grey-200);
+ }
+
+ :host-context([dark]):host([new-print-preview]) paper-fab.keyboard-focus {
+ background-color: var(--google-grey-800);
+ }
</style>
<div id="wrapper">
<paper-fab id="button" mini icon="[[visibleIcon_]]" on-click="fireClick"
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js
index f592dcea8ae..e1d750a36be 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js
@@ -26,6 +26,10 @@ Polymer({
delay: {type: Number, observer: 'delayChanged_'},
+ newPrintPreview: {type: Boolean, reflectToAttribute: true},
+
+ showOnLeft: {type: Boolean, reflectToAttribute: true},
+
/**
* Index of the icon currently being displayed.
*/
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.html b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.html
index aba9da429c1..c1175075722 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.html
@@ -1,4 +1,5 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="../icons.html">
<link rel="import" href="viewer-zoom-button.html">
@@ -7,6 +8,7 @@
<template>
<style>
:host {
+ --button-position-offset: 48px;
bottom: 0;
padding: 48px 0;
position: fixed;
@@ -15,18 +17,22 @@
z-index: 3;
}
- :host-context([dir=rtl]) {
+ :host([new-print-preview]) {
+ --button-position-offset: 24px;
+ }
+
+ :host([show-on-left_]) {
left: 0;
right: auto;
}
#zoom-buttons {
position: relative;
- right: 48px;
+ right: var(--button-position-offset);
}
- :host-context([dir=rtl]) #zoom-buttons {
- left: 48px;
+ :host([show-on-left_]) #zoom-buttons {
+ left: var(--button-position-offset);
right: auto;
}
@@ -46,11 +52,17 @@
</style>
<div id="zoom-buttons">
<viewer-zoom-button id="fit-button" on-fabclick="fitToggle" delay="100"
+ new-print-preview="[[newPrintPreview]]"
+ show-on-left="[[showOnLeft_]]"
icons="pdf:fullscreen-exit cr:fullscreen">
</viewer-zoom-button>
<viewer-zoom-button id="zoom-in-button" icons="pdf:add"
+ new-print-preview="[[newPrintPreview]]"
+ show-on-left="[[showOnLeft_]]"
on-fabclick="zoomIn" delay="50"></viewer-zoom-button>
<viewer-zoom-button id="zoom-out-button" icons="pdf:remove"
+ new-print-preview="[[newPrintPreview]]"
+ show-on-left="[[showOnLeft_]]"
on-fabclick="zoomOut" delay="0"></viewer-zoom-button>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js
index 795750a6468..fddb5bb00eb 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js
@@ -11,15 +11,48 @@ Polymer({
is: 'viewer-zoom-toolbar',
properties: {
+ newPrintPreview: {
+ type: Boolean,
+ reflectToAttribute: true,
+ },
+
+ /** @private */
+ showOnLeft_: {
+ type: Boolean,
+ computed: 'computeShowOnLeft_(newPrintPreview)',
+ reflectToAttribute: true,
+ },
+
strings: {type: Object, observer: 'updateTooltips_'},
visible_: {type: Boolean, value: true}
},
+ listeners: {
+ 'focus': 'onFocus_',
+ },
+
isVisible: function() {
return this.visible_;
},
+ /** @private */
+ onFocus_: function() {
+ // This can only happen when the plugin is shown within Print Preview.
+ if (!this.visible_) {
+ this.show();
+ }
+ },
+
+ /**
+ * @return {boolean} Whether to show the zoom toolbar on the left side of the
+ * viewport.
+ * @private
+ */
+ computeShowOnLeft_: function() {
+ return isRTL() !== this.newPrintPreview;
+ },
+
/**
* @private
* Change button tooltips to match any changes to localized strings.
diff --git a/chromium/chrome/browser/resources/pdf/index.html b/chromium/chrome/browser/resources/pdf/index.html
index 71b5d84126d..c1c362756b3 100644
--- a/chromium/chrome/browser/resources/pdf/index.html
+++ b/chromium/chrome/browser/resources/pdf/index.html
@@ -2,6 +2,8 @@
<html>
<head>
<meta charset="utf-8">
+ <script src="chrome://resources/polymer/v1_0/html-imports/html-imports.min.js">
+ </script>
<link rel="import" href="elements/viewer-error-screen/viewer-error-screen.html">
<link rel="import" href="elements/viewer-page-indicator/viewer-page-indicator.html">
<link rel="import" href="elements/viewer-page-selector/viewer-page-selector.html">
diff --git a/chromium/chrome/browser/resources/pdf/ink/BUILD.gn b/chromium/chrome/browser/resources/pdf/ink/BUILD.gn
index b98fd60781e..38908ee25a1 100644
--- a/chromium/chrome/browser/resources/pdf/ink/BUILD.gn
+++ b/chromium/chrome/browser/resources/pdf/ink/BUILD.gn
@@ -4,18 +4,15 @@
import("//third_party/closure_compiler/compile_js.gni")
-group("closure_compile") {
+js_type_check("closure_compile") {
deps = [
":ink_api",
]
}
js_library("ink_api") {
- externs_list = [ "//third_party/ink/build/ink_lib_externs.js" ]
-}
-
-js_type_check("ink") {
- deps = [
- ":ink_api",
+ externs_list = [
+ "//third_party/ink/build/ink_lib_externs.js",
+ "$externs_path/pending.js",
]
}
diff --git a/chromium/chrome/browser/resources/pdf/main.js b/chromium/chrome/browser/resources/pdf/main.js
index ae29c590088..9d3f533b4f5 100644
--- a/chromium/chrome/browser/resources/pdf/main.js
+++ b/chromium/chrome/browser/resources/pdf/main.js
@@ -73,14 +73,16 @@ function main() {
// Set up an event listener to catch scripting messages which are sent prior
// to the PDFViewer being created.
window.addEventListener('message', handleScriptingMessage, false);
- let chain = createBrowserApi();
+ HTMLImports.whenReady(() => {
+ let chain = createBrowserApi();
- // Content settings may not be present in test environments.
- if (chrome.contentSettings) {
- chain = chain.then(configureJavaScriptContentSetting);
- }
+ // Content settings may not be present in test environments.
+ if (chrome.contentSettings) {
+ chain = chain.then(configureJavaScriptContentSetting);
+ }
- chain.then(initViewer);
+ chain = chain.then(initViewer);
+ });
}
main();
diff --git a/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js b/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js
index 92f7a15841a..0ab77f41f3f 100644
--- a/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js
+++ b/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js
@@ -199,6 +199,13 @@ PDFScriptingAPI.prototype = {
},
/**
+ * Hide the toolbars after a delay.
+ */
+ hideToolbars: function() {
+ this.sendMessage_({type: 'hideToolbars'});
+ },
+
+ /**
* Load a page into the document while in print preview mode.
*
* @param {string} url the url of the pdf page to load.
@@ -208,6 +215,11 @@ PDFScriptingAPI.prototype = {
this.sendMessage_({type: 'loadPreviewPage', url: url, index: index});
},
+ /** @param {boolean} darkMode Whether the page is in dark mode. */
+ darkModeChanged: function(darkMode) {
+ this.sendMessage_({type: 'darkModeChanged', darkMode: darkMode});
+ },
+
/**
* Select all the text in the document. May only be called after document
* load.
@@ -274,8 +286,6 @@ function PDFCreateOutOfProcessPlugin(src, baseUrl) {
const iframe = assertInstanceof(
window.document.createElement('iframe'), HTMLIFrameElement);
iframe.setAttribute('src', baseUrl + '/index.html?' + src);
- // Prevent the frame from being tab-focusable.
- iframe.setAttribute('tabindex', '-1');
iframe.onload = function() {
client.setPlugin(iframe.contentWindow);
@@ -290,5 +300,7 @@ function PDFCreateOutOfProcessPlugin(src, baseUrl) {
iframe.loadPreviewPage = client.loadPreviewPage.bind(client);
iframe.sendKeyEvent = client.sendKeyEvent.bind(client);
iframe.scrollPosition = client.scrollPosition.bind(client);
+ iframe.hideToolbars = client.hideToolbars.bind(client);
+ iframe.darkModeChanged = client.darkModeChanged.bind(client);
return iframe;
}
diff --git a/chromium/chrome/browser/resources/pdf/pdf_viewer.js b/chromium/chrome/browser/resources/pdf/pdf_viewer.js
index 284afedf2d9..942761c08a2 100644
--- a/chromium/chrome/browser/resources/pdf/pdf_viewer.js
+++ b/chromium/chrome/browser/resources/pdf/pdf_viewer.js
@@ -101,14 +101,20 @@ PDFViewer.MATERIAL_TOOLBAR_HEIGHT = 56;
PDFViewer.TOOLBAR_WINDOW_MIN_HEIGHT = 250;
/**
- * The light-gray background color used for print preview.
+ * The background color used for print preview (--google-grey-refresh-300).
*/
-PDFViewer.LIGHT_BACKGROUND_COLOR = '0xFFCCCCCC';
+PDFViewer.PRINT_PREVIEW_BACKGROUND_COLOR = '0xFFDADCE0';
/**
- * The dark-gray background color used for the regular viewer.
+ * The background color used for print preview when dark mode is enabled
+ * (--google-grey-refresh-700).
*/
-PDFViewer.DARK_BACKGROUND_COLOR = '0xFF525659';
+PDFViewer.PRINT_PREVIEW_DARK_BACKGROUND_COLOR = '0xFF5F6368';
+
+/**
+ * The background color used for the regular viewer.
+ */
+PDFViewer.BACKGROUND_COLOR = '0xFF525659';
/**
* Creates a new PDFViewer. There should only be one of these objects per
@@ -214,8 +220,7 @@ function PDFViewer(browserApi) {
}
this.plugin_.setAttribute('headers', headers);
- const backgroundColor = PDFViewer.DARK_BACKGROUND_COLOR;
- this.plugin_.setAttribute('background-color', backgroundColor);
+ this.plugin_.setAttribute('background-color', PDFViewer.BACKGROUND_COLOR);
this.plugin_.setAttribute('top-toolbar-height', topToolbarHeight);
this.plugin_.setAttribute('javascript', this.javascript_);
@@ -737,6 +742,16 @@ PDFViewer.prototype = {
}
},
+ /** @private */
+ sendBackgroundColorForPrintPreview_: function() {
+ this.pluginController_.postMessage({
+ type: 'backgroundColorChanged',
+ backgroundColor: document.documentElement.hasAttribute('dark') ?
+ PDFViewer.PRINT_PREVIEW_DARK_BACKGROUND_COLOR :
+ PDFViewer.PRINT_PREVIEW_BACKGROUND_COLOR,
+ });
+ },
+
/**
* Load a dictionary of translated strings into the UI. Used as a callback for
* chrome.resourcesPrivate.
@@ -749,6 +764,15 @@ PDFViewer.prototype = {
document.documentElement.lang = strings.language;
loadTimeData.data = strings;
+ const isNewPrintPreview = this.isPrintPreview_ &&
+ loadTimeData.getBoolean('newPrintPreviewLayoutEnabled');
+ if (isNewPrintPreview) {
+ this.sendBackgroundColorForPrintPreview_();
+ this.toolbarManager_.reverseSideToolbar();
+ }
+ this.reverseZoomToolbar_ = isNewPrintPreview;
+ this.zoomToolbar_.newPrintPreview = isNewPrintPreview;
+
$('toolbar').strings = strings;
$('toolbar').pdfAnnotationsEnabled =
loadTimeData.getBoolean('pdfAnnotationsEnabled');
@@ -849,9 +873,11 @@ PDFViewer.prototype = {
// gives a compromise: if there is no scrollbar visible then the toolbar
// will be half a scrollbar width further left than the spec but if there
// is a scrollbar visible it will be half a scrollbar width further right
- // than the spec. In RTL layout, the zoom toolbar is on the left side, but
- // the scrollbar is still on the right, so this is not necessary.
- if (!isRTL()) {
+ // than the spec. In RTL layout normally, and in LTR layout in Print Preview
+ // when the NewPrintPreview flag is enabled, the zoom toolbar is on the left
+ // left side, but the scrollbar is still on the right, so this is not
+ // necessary.
+ if (isRTL() === this.reverseZoomToolbar_) {
this.zoomToolbar_.style.right =
-verticalScrollbarWidth + (scrollbarWidth / 2) + 'px';
}
@@ -984,6 +1010,15 @@ PDFViewer.prototype = {
case 'sendKeyEvent':
this.handleKeyEvent_(DeserializeKeyEvent(message.data.keyEvent));
return true;
+ case 'hideToolbars':
+ this.toolbarManager_.resetKeyboardNavigationAndHideToolbars();
+ return true;
+ case 'darkModeChanged':
+ document.documentElement.toggleAttribute('dark', message.data.darkMode);
+ if (this.isPrintPreview_) {
+ this.sendBackgroundColorForPrintPreview_();
+ }
+ return true;
case 'scrollPosition':
const position = this.viewport_.position;
position.y += message.data.y;
@@ -1234,6 +1269,9 @@ PDFViewer.prototype = {
* conditions.
*/
updateAnnotationAvailable_() {
+ if (!this.toolbar_) {
+ return;
+ }
let annotationAvailable = true;
if (this.viewport_.getClockwiseRotations() != 0) {
annotationAvailable = false;
diff --git a/chromium/chrome/browser/resources/pdf/toolbar_manager.js b/chromium/chrome/browser/resources/pdf/toolbar_manager.js
index bdd3427e2d8..4b47da225bc 100644
--- a/chromium/chrome/browser/resources/pdf/toolbar_manager.js
+++ b/chromium/chrome/browser/resources/pdf/toolbar_manager.js
@@ -33,12 +33,13 @@ function isMouseNearTopToolbar(e) {
/**
* @param {MouseEvent} e Event to test.
* @param {Window} window Window to test against.
+ * @param {boolean} reverse Whether the side toolbar is reversed.
* @return {boolean} True if the mouse is close to the bottom-right of the
* screen.
*/
-function isMouseNearSideToolbar(e, window) {
+function isMouseNearSideToolbar(e, window, reverse) {
let atSide = e.x > window.innerWidth - SIDE_TOOLBAR_REVEAL_DISTANCE_RIGHT;
- if (isRTL()) {
+ if (isRTL() !== reverse) {
atSide = e.x < SIDE_TOOLBAR_REVEAL_DISTANCE_RIGHT;
}
const atBottom =
@@ -71,6 +72,8 @@ function ToolbarManager(window, toolbar, zoomToolbar) {
this.lastMovementTimestamp = null;
+ this.reverseSideToolbar_ = false;
+
this.window_.addEventListener('resize', this.resizeDropdowns_.bind(this));
this.resizeDropdowns_();
}
@@ -79,7 +82,8 @@ ToolbarManager.prototype = {
handleMouseMove: function(e) {
this.isMouseNearTopToolbar_ = this.toolbar_ && isMouseNearTopToolbar(e);
- this.isMouseNearSideToolbar_ = isMouseNearSideToolbar(e, this.window_);
+ this.isMouseNearSideToolbar_ =
+ isMouseNearSideToolbar(e, this.window_, this.reverseSideToolbar_);
this.keyboardNavigationActive = false;
const touchInteractionActive =
@@ -236,6 +240,14 @@ ToolbarManager.prototype = {
},
/**
+ * Clears the keyboard navigation state and hides the toolbars after a delay.
+ */
+ resetKeyboardNavigationAndHideToolbars: function() {
+ this.keyboardNavigationActive = false;
+ this.hideToolbarsAfterTimeout();
+ },
+
+ /**
* Hide the top toolbar and keep it hidden until both:
* - The mouse is moved away from the right side of the screen
* - 1 second has passed.
@@ -254,6 +266,11 @@ ToolbarManager.prototype = {
}, FORCE_HIDE_TIMEOUT);
},
+ /** Reverse the position of the side toolbar. */
+ reverseSideToolbar: function() {
+ this.reverseSideToolbar_ = true;
+ },
+
/**
* Updates the size of toolbar dropdowns based on the positions of the rest of
* the UI.
diff --git a/chromium/chrome/browser/resources/plugin_metadata/plugins_linux.json b/chromium/chrome/browser/resources/plugin_metadata/plugins_linux.json
index 78d32ee2532..722e064f5dd 100644
--- a/chromium/chrome/browser/resources/plugin_metadata/plugins_linux.json
+++ b/chromium/chrome/browser/resources/plugin_metadata/plugins_linux.json
@@ -1,5 +1,5 @@
{
- "x-version": 39,
+ "x-version": 40,
"adobe-flash-player": {
"mime_types": [
"application/futuresplash",
@@ -10,9 +10,9 @@
],
"versions": [
{
- "version": "32.0.0.171",
+ "version": "32.0.0.192",
"status": "up_to_date",
- "reference": "https://helpx.adobe.com/security/products/flash-player/apsb19-19.html"
+ "reference": "https://helpx.adobe.com/security/products/flash-player/apsb19-26.html"
}
],
"lang": "en-US",
diff --git a/chromium/chrome/browser/resources/plugin_metadata/plugins_mac.json b/chromium/chrome/browser/resources/plugin_metadata/plugins_mac.json
index ed22d3310e3..7d0f49a30cb 100644
--- a/chromium/chrome/browser/resources/plugin_metadata/plugins_mac.json
+++ b/chromium/chrome/browser/resources/plugin_metadata/plugins_mac.json
@@ -1,5 +1,5 @@
{
- "x-version": 45,
+ "x-version": 46,
"adobe-flash-player": {
"mime_types": [
"application/futuresplash",
@@ -7,9 +7,9 @@
],
"versions": [
{
- "version": "32.0.0.171",
+ "version": "32.0.0.192",
"status": "requires_authorization",
- "reference": "https://helpx.adobe.com/security/products/flash-player/apsb19-19.html"
+ "reference": "https://helpx.adobe.com/security/products/flash-player/apsb19-26.html"
}
],
"lang": "en-US",
diff --git a/chromium/chrome/browser/resources/plugin_metadata/plugins_win.json b/chromium/chrome/browser/resources/plugin_metadata/plugins_win.json
index 0d449d11239..9abad05475d 100644
--- a/chromium/chrome/browser/resources/plugin_metadata/plugins_win.json
+++ b/chromium/chrome/browser/resources/plugin_metadata/plugins_win.json
@@ -1,5 +1,5 @@
{
- "x-version": 54,
+ "x-version": 55,
"adobe-flash-player": {
"mime_types": [
"application/futuresplash",
@@ -7,9 +7,9 @@
],
"versions": [
{
- "version": "32.0.0.171",
+ "version": "32.0.0.192",
"status": "requires_authorization",
- "reference": "https://helpx.adobe.com/security/products/flash-player/apsb19-19.html"
+ "reference": "https://helpx.adobe.com/security/products/flash-player/apsb19-26.html"
}
],
"lang": "en-US",
diff --git a/chromium/chrome/browser/resources/print_preview/BUILD.gn b/chromium/chrome/browser/resources/print_preview/BUILD.gn
index 94826af7ae2..618c7a9a055 100644
--- a/chromium/chrome/browser/resources/print_preview/BUILD.gn
+++ b/chromium/chrome/browser/resources/print_preview/BUILD.gn
@@ -74,6 +74,11 @@ js_type_check("print_preview_resources") {
}
js_library("print_preview_utils") {
+ deps = [
+ "//ui/webui/resources/js:dark_mode",
+ "//ui/webui/resources/js:util",
+ ]
+ externs_list = [ "$externs_path/pending.js" ]
}
js_library("metrics") {
diff --git a/chromium/chrome/browser/resources/print_preview/data/destination.js b/chromium/chrome/browser/resources/print_preview/data/destination.js
index d509eb9ba15..d037df020f5 100644
--- a/chromium/chrome/browser/resources/print_preview/data/destination.js
+++ b/chromium/chrome/browser/resources/print_preview/data/destination.js
@@ -178,14 +178,27 @@ print_preview.ColorMode = {
COLOR: 2
};
+// <if expr="chromeos">
/**
- * Enumeration of duplex modes used by Chromium.
+ * Enumeration of color mode restrictions used by Chromium.
+ * This has to coincide with |printing::ColorModeRestriction| as defined in
+ * printing/backend/printing_restrictions.h
+ * @enum {number}
+ */
+print_preview.ColorModeRestriction = {
+ UNSET: 0x0,
+ MONOCHROME: 0x1,
+ COLOR: 0x2,
+};
+
+/**
+ * Enumeration of duplex mode restrictions used by Chromium.
* This has to coincide with |printing::DuplexModeRestriction| as defined in
* printing/backend/printing_restrictions.h
* @enum {number}
*/
print_preview.DuplexModeRestriction = {
- NONE: 0x0,
+ UNSET: 0x0,
SIMPLEX: 0x1,
LONG_EDGE: 0x2,
SHORT_EDGE: 0x4,
@@ -193,15 +206,30 @@ print_preview.DuplexModeRestriction = {
};
/**
+ * Enumeration of PIN printing mode restrictions used by Chromium.
+ * This has to coincide with |printing::PinModeRestriction| as defined in
+ * printing/backend/printing_restrictions.h
+ * @enum {number}
+ */
+print_preview.PinModeRestriction = {
+ UNSET: 0,
+ PIN: 1,
+ NO_PIN: 2
+};
+
+/**
* Policies affecting a destination.
* @typedef {{
- * allowedColorModes: ?print_preview.ColorMode,
+ * allowedColorModes: ?print_preview.ColorModeRestriction,
* allowedDuplexModes: ?print_preview.DuplexModeRestriction,
- * defaultColorMode: ?print_preview.ColorMode,
+ * allowedPinMode: ?print_preview.PinModeRestriction,
+ * defaultColorMode: ?print_preview.ColorModeRestriction,
* defaultDuplexMode: ?print_preview.DuplexModeRestriction,
+ * defaultPinMode: ?print_preview.PinModeRestriction,
* }}
*/
print_preview.Policies;
+// </if>
/**
* @typedef {{id: string,
@@ -571,6 +599,7 @@ cr.define('print_preview', function() {
}
}
+ // <if expr="chromeos">
/**
* @return {?print_preview.Policies} Print policies affecting the
* destination.
@@ -586,6 +615,7 @@ cr.define('print_preview', function() {
set policies(policies) {
this.policies_ = policies;
}
+ // </if>
/**
* @return {!print_preview.DestinationConnectionStatus} Connection status
@@ -769,8 +799,9 @@ cr.define('print_preview', function() {
null;
}
+ // <if expr="chromeos">
/**
- * @return {?print_preview.ColorMode} Color mode set by policy.
+ * @return {?print_preview.ColorModeRestriction} Color mode set by policy.
*/
get colorPolicy() {
return this.policies && this.policies.allowedColorModes ?
@@ -789,6 +820,16 @@ cr.define('print_preview', function() {
}
/**
+ * @return {?print_preview.PinModeRestriction} Pin mode allowed by policy.
+ */
+ get pinPolicy() {
+ return this.policies && this.policies.allowedPinModes ?
+ this.policies.allowedPinModes :
+ null;
+ }
+ // </if>
+
+ /**
* @return {boolean} Whether the printer supports both black and white and
* color printing.
*/
@@ -808,9 +849,10 @@ cr.define('print_preview', function() {
return hasColor && hasMonochrome;
}
+ // <if expr="chromeos">
/**
- * @return {?print_preview.ColorMode} Value of default color setting given
- * by policy.
+ * @return {?print_preview.ColorModeRestriction} Value of default color
+ * setting given by policy.
*/
get defaultColorPolicy() {
return this.policies && this.policies.defaultColorMode;
@@ -825,6 +867,15 @@ cr.define('print_preview', function() {
}
/**
+ * @return {?print_preview.PinModeRestriction} Value of default pin setting
+ * given by policy.
+ */
+ get defaultPinPolicy() {
+ return this.policies && this.policies.defaultPinMode;
+ }
+ // </if>
+
+ /**
* @param {boolean} isColor Whether to use a color printing mode.
* @return {Object} Selected color option.
*/
diff --git a/chromium/chrome/browser/resources/print_preview/data/destination_store.js b/chromium/chrome/browser/resources/print_preview/data/destination_store.js
index 139a271c047..0e4cc677bb1 100644
--- a/chromium/chrome/browser/resources/print_preview/data/destination_store.js
+++ b/chromium/chrome/browser/resources/print_preview/data/destination_store.js
@@ -14,6 +14,18 @@ print_preview.DestinationStorePrinterSearchStatus = {
DONE: 'done'
};
+/**
+ * Enumeration of possible destination errors.
+ * @enum {number}
+ */
+print_preview.DestinationErrorType = {
+ INVALID: 0,
+ UNSUPPORTED: 1,
+ // <if expr="chromeos">
+ NO_DESTINATIONS: 2,
+ // </if>
+};
+
cr.define('print_preview', function() {
'use strict';
/**
@@ -442,6 +454,11 @@ cr.define('print_preview', function() {
this.selectFinalFallbackDestination_();
}
+ /** Removes all events being tracked from the tracker. */
+ resetTracker() {
+ this.tracker_.removeAll();
+ }
+
/**
* Attempts to fetch capabilities of the destination identified by
* |serializedDestination|.
@@ -500,6 +517,9 @@ cr.define('print_preview', function() {
if (serializedDestination.capabilities) {
this.selectedDestination_.capabilities =
serializedDestination.capabilities;
+ this.dispatchEvent(new CustomEvent(
+ DestinationStore.EventType
+ .SELECTED_DESTINATION_CAPABILITIES_READY));
}
}
break;
@@ -1039,15 +1059,19 @@ cr.define('print_preview', function() {
/**
* Sends SELECTED_DESTINATION_CAPABILITIES_READY event if the destination
- * is supported, or SELECTED_DESTINATION_UNSUPPORTED otherwise.
+ * is supported, or ERROR otherwise of with error type UNSUPPORTED.
* @private
*/
sendSelectedDestinationUpdateEvent_() {
- this.dispatchEvent(new CustomEvent(
- this.selectedDestination_.shouldShowInvalidCertificateError ?
- DestinationStore.EventType.SELECTED_DESTINATION_UNSUPPORTED :
- DestinationStore.EventType
- .SELECTED_DESTINATION_CAPABILITIES_READY));
+ if (this.selectedDestination_.shouldShowInvalidCertificateError) {
+ this.dispatchEvent(new CustomEvent(
+ DestinationStore.EventType.ERROR,
+ {detail: print_preview.DestinationErrorType.UNSUPPORTED}));
+ } else {
+ this.dispatchEvent(
+ new CustomEvent(DestinationStore.EventType
+ .SELECTED_DESTINATION_CAPABILITIES_READY));
+ }
}
/**
@@ -1240,7 +1264,8 @@ cr.define('print_preview', function() {
if (this.selectedDestination_ &&
this.selectedDestination_.id == destinationId) {
this.dispatchEvent(new CustomEvent(
- DestinationStore.EventType.SELECTED_DESTINATION_INVALID));
+ DestinationStore.EventType.ERROR,
+ {detail: print_preview.DestinationErrorType.INVALID}));
}
if (this.autoSelectMatchingDestination_ &&
this.autoSelectMatchingDestination_.matchIdAndOrigin(
@@ -1279,7 +1304,7 @@ cr.define('print_preview', function() {
/**
* Checks if the search is done and no printers are found. If so, fires a
- * DestinationStore.EventType.NO_DESTINATIONS_FOUND event.
+ * DestinationStore.EventType.ERROR event with error type NO_DESTINATIONS.
* @private
*/
sendNoPrinterEventIfNeeded_() {
@@ -1293,10 +1318,12 @@ cr.define('print_preview', function() {
!this.selectFirstDestination_) {
return;
}
-
+ // <if expr="chromeos">
this.selectFirstDestination_ = false;
- this.dispatchEvent(
- new CustomEvent(DestinationStore.EventType.NO_DESTINATIONS_FOUND));
+ this.dispatchEvent(new CustomEvent(
+ DestinationStore.EventType.ERROR,
+ {detail: print_preview.DestinationErrorType.NO_DESTINATIONS}));
+ // </if>
}
/**
@@ -1395,14 +1422,9 @@ cr.define('print_preview', function() {
DESTINATIONS_INSERTED:
'print_preview.DestinationStore.DESTINATIONS_INSERTED',
DESTINATIONS_RESET: 'print_preview.DestinationStore.DESTINATIONS_RESET',
- NO_DESTINATIONS_FOUND:
- 'print_preview.DestinationStore.NO_DESTINATIONS_FOUND',
+ ERROR: 'print_preview.DestinationStore.ERROR',
SELECTED_DESTINATION_CAPABILITIES_READY: 'print_preview.DestinationStore' +
'.SELECTED_DESTINATION_CAPABILITIES_READY',
- SELECTED_DESTINATION_INVALID:
- 'print_preview.DestinationStore.SELECTED_DESTINATION_INVALID',
- SELECTED_DESTINATION_UNSUPPORTED:
- 'print_preview.DestinationStore.SELECTED_DESTINATION_UNSUPPORTED',
};
/**
diff --git a/chromium/chrome/browser/resources/print_preview/data/invitation_store.js b/chromium/chrome/browser/resources/print_preview/data/invitation_store.js
index eeb06eab0f2..724a309540f 100644
--- a/chromium/chrome/browser/resources/print_preview/data/invitation_store.js
+++ b/chromium/chrome/browser/resources/print_preview/data/invitation_store.js
@@ -94,6 +94,11 @@ cr.define('print_preview', function() {
this.onCloudPrintProcessInviteDone_.bind(this));
}
+ /** Removes all events being tracked from the tracker. */
+ resetTracker() {
+ this.tracker_.removeAll();
+ }
+
/**
* Initiates loading of cloud printer sharing invitations for the user
* account given by |user|.
diff --git a/chromium/chrome/browser/resources/print_preview/data/user_info.js b/chromium/chrome/browser/resources/print_preview/data/user_info.js
index 14d9d8cfbd7..1be3c448c3a 100644
--- a/chromium/chrome/browser/resources/print_preview/data/user_info.js
+++ b/chromium/chrome/browser/resources/print_preview/data/user_info.js
@@ -34,12 +34,6 @@ Polymer({
value: '',
},
- /** @type {?cloudprint.CloudPrintInterface} */
- cloudPrintInterface: {
- type: Object,
- observer: 'onCloudPrintInterfaceSet_',
- },
-
/** @type {?print_preview.DestinationStore} */
destinationStore: Object,
@@ -59,14 +53,15 @@ Polymer({
/** @private {!EventTracker} */
tracker_: new EventTracker(),
- /** @private */
- onCloudPrintInterfaceSet_: function() {
- if (!this.cloudPrintInterface) {
- return;
- }
+ /** @override */
+ detached: function() {
+ this.tracker_.removeAll();
+ },
+ /** @param {!cloudprint.CloudPrintInterface} cloudPrintInterface */
+ setCloudPrintInterface: function(cloudPrintInterface) {
this.tracker_.add(
- assert(this.cloudPrintInterface).getEventTarget(),
+ cloudPrintInterface.getEventTarget(),
cloudprint.CloudPrintInterfaceEventType.UPDATE_USERS,
this.updateUsers_.bind(this));
},
diff --git a/chromium/chrome/browser/resources/print_preview/icons.html b/chromium/chrome/browser/resources/print_preview/icons.html
index c5b3efa5694..8cffcf206ad 100644
--- a/chromium/chrome/browser/resources/print_preview/icons.html
+++ b/chromium/chrome/browser/resources/print_preview/icons.html
@@ -5,16 +5,24 @@
<iron-iconset-svg name="print-preview" size="24">
<svg>
<defs>
- <!-- Custom svg (namratakannan). -->
+ <!-- Custom svgs (namratakannan). -->
<g id="printer-shared" viewBox="0 0 106 96">
<defs>
<path d="M44 59H32v26h12v11H21.2V74.462H0V42.154C0 33.215 7.102 26 15.9 26h74.2c8.798 0 15.9 7.215 15.9 16.154V59H91.393A15.943 15.943 0 0 0 93 52c0-8.84-7.16-16-16-16s-16 7.16-16 16c0 2.51.578 4.886 1.607 7H44zM84 0H21v22h63V0z" id="a"></path>
</defs>
- <g fill-rule="nonzero" fill="none">
- <use fill="#80868B" xlink:href="#a"></use>
+ <g fill-rule="nonzero">
+ <use xlink:href="#a"></use>
<path d="M77 68c-9.679 0-29 6.253-29 18.667V96h58v-9.333C106 74.253 86.679 68 77 68zM77 64c6.63 0 12-5.37 12-12s-5.37-12-12-12-12 5.37-12 12 5.37 12 12 12z" fill="#4A93F9"></path>
</g>
</g>
+ <g id="short-edge" viewBox="0 0 26 20" fill-rule="evenodd">
+ <path d="M2 14v2h2v-2H2zm12 4v2h2v-2h-2zm4 0v2h2v-2h-2zm3.556-18H4.444C3.1 0 2 1.35 2 3v6h2V2h18v7h2V3c0-1.65-1.1-3-2.444-3zM24 18h-2v2c1.1 0 2-.9 2-2zM0 10v2h26v-2H0zm6 8v2h2v-2H6zm16-4v2h2v-2h-2zm-12 4v2h2v-2h-2zm-8 0c0 1.1.9 2 2 2v-2H2z" fill-rule="nonzero">
+ <path d="M29-6v32H-3V-6z">
+ </g>
+ <g id="long-edge" viewBox="0 0 23 22" fill-rule="evenodd">
+ <path d="M17 20h2v-2h-2v2zm4-12h2V6h-2v2zM0 4v14c0 1.1 1.35 2 3 2h6v-2H2V4h7V2H3c-1.65 0-3 .9-3 2zm21-2v2h2c0-1.1-.9-2-2-2zM10 22h2V0h-2v22zm11-6h2v-2h-2v2zM17 4h2V2h-2v2zm-4 16h2v-2h-2v2zm0-16h2V2h-2v2zm8 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z" fill-rule="nonzero">
+ <path d="M-5-5h32v32H-5z">
+ </g>
<!-- Icon from http://icons/ -->
<g id="save-to-drive">
diff --git a/chromium/chrome/browser/resources/print_preview/native_layer.js b/chromium/chrome/browser/resources/print_preview/native_layer.js
index 2f0501d782a..185de000013 100644
--- a/chromium/chrome/browser/resources/print_preview/native_layer.js
+++ b/chromium/chrome/browser/resources/print_preview/native_layer.js
@@ -213,9 +213,17 @@ cr.define('print_preview', function() {
return cr.sendWithPromise('getPreview', printTicket);
}
- /** Opens the chrome://settings printing page. */
+ /**
+ * Opens the chrome://settings printing page. For Chrome OS, open the
+ * printing settings in the Settings App.
+ */
openSettingsPrintPage() {
+ // <if expr="chromeos">
+ chrome.send('openPrinterSettings');
+ // </if>
+ // <if expr="not chromeos">
window.open('chrome://settings/printing');
+ // </if>
}
/**
diff --git a/chromium/chrome/browser/resources/print_preview/new/BUILD.gn b/chromium/chrome/browser/resources/print_preview/new/BUILD.gn
index 249d328ec91..4d87996c5c1 100644
--- a/chromium/chrome/browser/resources/print_preview/new/BUILD.gn
+++ b/chromium/chrome/browser/resources/print_preview/new/BUILD.gn
@@ -10,6 +10,7 @@ js_type_check("closure_compile") {
":advanced_settings_dialog",
":advanced_settings_item",
":app",
+ ":button_strip",
":color_settings",
":copies_settings",
":destination_dialog",
@@ -17,7 +18,9 @@ js_type_check("closure_compile") {
":destination_list_item",
":destination_settings",
":dpi_settings",
+ ":duplex_settings",
":header",
+ ":header_new",
":highlight_utils",
":input_behavior",
":layout_settings",
@@ -41,54 +44,86 @@ js_type_check("closure_compile") {
":settings_select",
":state",
]
+
+ if (is_chromeos) {
+ deps += [ ":pin_settings" ]
+ }
}
js_library("app") {
deps = [
+ ":model",
+ ":state",
+ "..:cloud_print_interface",
+ "..:cloud_print_interface_manager",
+ "..:native_layer",
+ "../data:destination",
+ "../data:document_info",
+ "../data:measurement_system",
+ "//ui/webui/resources/js:event_tracker",
+ "//ui/webui/resources/js:util",
+ "//ui/webui/resources/js:web_ui_listener_behavior",
+ "//ui/webui/resources/js/cr/ui:focus_outline_manager",
+ ]
+}
+
+js_library("print_preview_sidebar") {
+ deps = [
":advanced_options_settings",
+ ":button_strip",
":color_settings",
":copies_settings",
":destination_settings",
":dpi_settings",
+ ":duplex_settings",
":header",
+ ":header_new",
":layout_settings",
":link_container",
":margins_settings",
":media_size_settings",
- ":model",
":more_settings",
":other_options_settings",
":pages_per_sheet_settings",
":pages_settings",
- ":preview_area",
":scaling_settings",
":state",
"..:cloud_print_interface",
- "..:cloud_print_interface_manager",
"..:metrics",
- "..:native_layer",
"../data:destination",
- "../data:destination_store",
- "../data:document_info",
- "../data:invitation_store",
- "../data:measurement_system",
- "../data:user_info",
"//ui/webui/resources/cr_elements:cr_container_shadow_behavior",
- "//ui/webui/resources/js:event_tracker",
- "//ui/webui/resources/js:util",
+ "//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:web_ui_listener_behavior",
- "//ui/webui/resources/js/cr/ui:focus_outline_manager",
]
}
+js_library("button_strip") {
+ deps = [
+ ":state",
+ "../data:destination",
+ "//ui/webui/resources/js:cr",
+ ]
+
+ if (is_chromeos) {
+ deps += [ ":pin_settings" ]
+ }
+}
+
js_library("header") {
deps = [
- ":model",
":settings_behavior",
":state",
"../data:destination",
"//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:load_time_data",
+ ]
+}
+
+js_library("header_new") {
+ deps = [
+ ":settings_behavior",
+ ":state",
+ "../data:destination",
+ "//ui/webui/resources/js:cr",
]
}
@@ -96,26 +131,41 @@ js_library("destination_settings") {
deps = [
":destination_dialog",
":destination_select",
+ ":settings_behavior",
":state",
+ "..:cloud_print_interface",
"../data:destination",
"../data:destination_store",
"../data:invitation_store",
"../data:user_info",
"//ui/webui/resources/cr_elements/cr_lazy_render:cr_lazy_render",
"//ui/webui/resources/js:i18n_behavior",
+ "//ui/webui/resources/js:web_ui_listener_behavior",
]
}
js_library("destination_select") {
deps = [
":select_behavior",
+ "..:print_preview_utils",
"../data:destination",
"../data:user_info",
+ "//third_party/polymer/v1_0/components-chromium/iron-meta:iron-meta-extracted",
"//ui/webui/resources/js:i18n_behavior",
]
externs_list = [ "$externs_path/pending.js" ]
}
+if (is_chromeos) {
+ js_library("pin_settings") {
+ deps = [
+ ":input_behavior",
+ ":settings_behavior",
+ ":state",
+ ]
+ }
+}
+
js_library("pages_settings") {
deps = [
":input_behavior",
@@ -190,6 +240,15 @@ js_library("other_options_settings") {
]
}
+js_library("duplex_settings") {
+ deps = [
+ ":select_behavior",
+ ":settings_behavior",
+ "..:print_preview_utils",
+ ]
+ externs_list = [ "$externs_path/pending.js" ]
+}
+
js_library("advanced_options_settings") {
deps = [
":advanced_settings_dialog",
@@ -223,6 +282,7 @@ js_library("settings_select") {
js_library("settings_behavior") {
deps = [
+ ":model",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
]
@@ -261,6 +321,7 @@ js_library("preview_area") {
"../data:printable_area",
"../data:size",
"//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:dark_mode",
"//ui/webui/resources/js:i18n_behavior",
"//ui/webui/resources/js:util",
"//ui/webui/resources/js:web_ui_listener_behavior",
@@ -377,11 +438,11 @@ js_library("highlight_utils") {
js_library("model") {
deps = [
- ":settings_behavior",
"../data:destination",
"../data:document_info",
"../data:margins",
"//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:promise_resolver",
]
}
diff --git a/chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.html b/chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.html
index b0cc55f191b..e988382bb62 100644
--- a/chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.html
+++ b/chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.html
@@ -5,7 +5,6 @@
<link rel="import" href="../data/destination.html">
<link rel="import" href="advanced_settings_dialog.html">
<link rel="import" href="print_preview_shared_css.html">
-<link rel="import" href="settings_behavior.html">
<link rel="import" href="settings_section.html">
<dom-module id="print-preview-advanced-options-settings">
@@ -32,7 +31,7 @@
</print-preview-settings-section>
<template is="dom-if" if="[[showAdvancedDialog_]]" restamp>
<print-preview-advanced-dialog
- settings="{{settings}}" destination="[[destination]]"
+ settings="[[settings]]" destination="[[destination]]"
on-close="onDialogClose_">
</print-preview-advanced-dialog>
</template>
diff --git a/chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.js b/chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.js
index c0a204cb9a3..176050673c1 100644
--- a/chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/new/advanced_options_settings.js
@@ -5,14 +5,15 @@
Polymer({
is: 'print-preview-advanced-options-settings',
- behaviors: [SettingsBehavior],
-
properties: {
disabled: Boolean,
/** @type {!print_preview.Destination} */
destination: Object,
+ /** @type {!print_preview_new.Settings} */
+ settings: Object,
+
/** @private {boolean} */
showAdvancedDialog_: {
type: Boolean,
diff --git a/chromium/chrome/browser/resources/print_preview/new/advanced_settings_item.html b/chromium/chrome/browser/resources/print_preview/new/advanced_settings_item.html
index 577277a6003..1f6fe09f8be 100644
--- a/chromium/chrome/browser/resources/print_preview/new/advanced_settings_item.html
+++ b/chromium/chrome/browser/resources/print_preview/new/advanced_settings_item.html
@@ -30,7 +30,7 @@
.label,
.value {
align-self: center;
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
overflow: hidden;
text-overflow: ellipsis;
}
diff --git a/chromium/chrome/browser/resources/print_preview/new/app.html b/chromium/chrome/browser/resources/print_preview/new/app.html
index 9a705ce4f0b..9ea85452afc 100644
--- a/chromium/chrome/browser/resources/print_preview/new/app.html
+++ b/chromium/chrome/browser/resources/print_preview/new/app.html
@@ -1,6 +1,5 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_container_shadow_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
@@ -8,40 +7,20 @@
<link rel="import" href="chrome://resources/html/cr/ui/focus_outline_manager.html">
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="../cloud_print_interface.html">
<link rel="import" href="../cloud_print_interface_manager.html">
-<link rel="import" href="../metrics.html">
<link rel="import" href="../native_layer.html">
<link rel="import" href="../data/destination.html">
-<link rel="import" href="../data/destination_store.html">
-<link rel="import" href="../data/invitation_store.html">
<link rel="import" href="../data/document_info.html">
<link rel="import" href="../data/measurement_system.html">
-<link rel="import" href="../data/user_info.html">
<link rel="import" href="print_preview_shared_css.html">
<link rel="import" href="strings.html">
<link rel="import" href="settings_behavior.html">
<link rel="import" href="state.html">
<link rel="import" href="model.html">
-<link rel="import" href="header.html">
+<link rel="import" href="print_preview_sidebar.html">
<link rel="import" href="preview_area.html">
-<link rel="import" href="destination_settings.html">
-<link rel="import" href="pages_settings.html">
-<link rel="import" href="copies_settings.html">
-<link rel="import" href="layout_settings.html">
-<link rel="import" href="color_settings.html">
-<link rel="import" href="media_size_settings.html">
-<link rel="import" href="margins_settings.html">
-<link rel="import" href="dpi_settings.html">
-<link rel="import" href="pages_per_sheet_settings.html">
-<link rel="import" href="scaling_settings.html">
-<link rel="import" href="other_options_settings.html">
-<link rel="import" href="advanced_options_settings.html">
-<link rel="import" href="more_settings.html">
-<if expr="not chromeos">
- <link rel="import" href="link_container.html">
-</if>
+
<dom-module id="print-preview-app">
<template>
<style include="print-preview-shared cr-shared-style">
@@ -51,153 +30,67 @@
user-select: none;
}
- #sidebar {
- background-color: white;
- border-inline-end: var(--print-preview-settings-border);
- display: flex;
- flex: none;
- flex-direction: column;
- width: 311px;
+ :host-context([dark]) {
+ background: var(--google-grey-900);
}
- #container {
- color: var(--google-grey-900);
- flex: 1;
- overflow: overlay;
- padding-bottom: 16px;
+ :host([new-print-preview-layout_]) {
+ flex-direction: row-reverse;
}
- .settings-section {
- display: block;
- margin-bottom: 16px;
- margin-top: 16px;
+ print-preview-sidebar {
+ flex: none;
+ width: 326px;
}
#preview-area-container {
align-items: center;
- background-color: var(--google-grey-200);
+ background-color: var(--preview-area-background-color);
flex: 1;
}
+
+ :host([new-print-preview-layout_]) #preview-area-container {
+ background-color: var(--preview-area-background-color-new);
+ }
</style>
- <print-preview-state id="state" state="{{state}}"></print-preview-state>
+ <print-preview-state id="state" state="{{state}}" error="{{error_}}">
+ </print-preview-state>
<print-preview-model id="model" settings="{{settings}}"
- controls-managed="{{controlsManaged_}}" destination="{{destination_}}"
+ controls-managed="{{controlsManaged_}}" destination="[[destination_]]"
document-settings="[[documentSettings_]]"
margins="[[margins_]]" page-size="[[pageSize_]]"
- recent-destinations="{{recentDestinations_}}"
- on-save-sticky-settings="onSaveStickySettings_">
+ on-preview-setting-changed="onPreviewSettingChanged_"
+ on-sticky-setting-changed="onStickySettingChanged_"
+ on-setting-valid-changed="onSettingValidChanged_">
</print-preview-model>
- <print-preview-user-info id="userInfo" active-user="{{activeUser_}}"
- users="{{users_}}" cloud-print-interface="[[cloudPrintInterface_]]"
- destination-store="[[destinationStore_]]"
- invitation-store="[[invitationStore_]]">
- </print-preview-user-info>
<print-preview-document-info id="documentInfo"
document-settings="{{documentSettings_}}" margins="{{margins_}}"
page-size="{{pageSize_}}">
</print-preview-document-info>
- <div id="sidebar" on-setting-valid-changed="onSettingValidChanged_">
- <print-preview-header destination="[[destination_]]" state="[[state]]"
- error-message="[[errorMessage_]]" settings="[[settings]]"
- managed="[[controlsManaged_]]" on-print-requested="onPrintRequested_"
- on-cancel-requested="onCancelRequested_">
- </print-preview-header>
- <div id="container">
- <print-preview-destination-settings id="destinationSettings"
- cloud-print-state="[[cloudPrintState_]]"
- destination="[[destination_]]"
- destination-store="[[destinationStore_]]"
- invitation-store="[[invitationStore_]]"
- app-kiosk-mode="[[isInAppKioskMode_]]"
- cloud-print-state="[[cloudPrintState_]]"
- disabled="[[controlsDisabled_]]" state="[[state]]"
- recent-destinations="[[recentDestinations_]]"
- active-user="[[activeUser_]]" users="[[users_]]"
- available class="settings-section"
- on-account-change="onAccountChange_">
- </print-preview-destination-settings>
- <print-preview-pages-settings settings="{{settings}}"
- page-count="[[documentSettings_.pageCount]]"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.pages.available]]" class="settings-section">
- </print-preview-pages-settings>
- <print-preview-copies-settings settings="{{settings}}"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.copies.available]]" class="settings-section">
- </print-preview-copies-settings>
- <print-preview-layout-settings settings="{{settings}}"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.layout.available]]" class="settings-section">
- </print-preview-layout-settings>
- <print-preview-color-settings settings="{{settings}}"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.color.available]]" class="settings-section">
- </print-preview-color-settings>
- <print-preview-more-settings
- settings-expanded-by-user="{{settingsExpandedByUser_}}"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!shouldShowMoreSettings_]]">
- </print-preview-more-settings>
- <iron-collapse id="moreSettings"
- opened="[[shouldExpandSettings_(
- settingsExpandedByUser_, shouldShowMoreSettings_)]]">
- <print-preview-media-size-settings settings="{{settings}}"
- capability="[[destination_.capabilities.printer.media_size]]"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.mediaSize.available]]"
- class="settings-section">
- </print-preview-media-size-settings>
- <print-preview-pages-per-sheet-settings settings="{{settings}}"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.pagesPerSheet.available]]"
- class="settings-section">
- </print-preview-pages-per-sheet-settings>
- <print-preview-margins-settings settings="{{settings}}"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.margins.available]]"
- class="settings-section">
- </print-preview-margins-settings>
- <print-preview-dpi-settings settings="{{settings}}"
- capability="[[destination_.capabilities.printer.dpi]]"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.dpi.available]]" class="settings-section">
- </print-preview-dpi-settings>
- <print-preview-scaling-settings settings="{{settings}}"
- fit-to-page-scaling="[[documentSettings_.fitToPageScaling]]"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.scaling.available]]"
- class="settings-section">
- </print-preview-scaling-settings>
- <print-preview-other-options-settings settings="{{settings}}"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.otherOptions.available]]"
- class="settings-section">
- </print-preview-other-options-settings>
- <print-preview-advanced-options-settings
- settings="{{settings}}" destination="[[destination_]]"
- disabled="[[controlsDisabled_]]"
- hidden$="[[!settings.vendorItems.available]]"
- class="settings-section">
- </print-preview-advanced-options-settings>
- </iron-collapse>
-<if expr="not chromeos">
- <print-preview-link-container destination="[[destination_]]"
- app-kiosk-mode="[[isInAppKioskMode_]]"
- disabled="[[controlsDisabled_]]"
+ <print-preview-sidebar id="sidebar"
+ cloud-print-interface="[[cloudPrintInterface_]]"
+ cloud-print-error-message="[[cloudPrintErrorMessage_]]"
+ destination-state="{{destinationState_}}"
+ controls-managed="[[controlsManaged_]]" destination="{{destination_}}"
+ error="{{error_}}" new-print-preview-layout="[[newPrintPreviewLayout_]]"
+ page-count="[[documentSettings_.pageCount]]"
+ settings="[[settings]]" state="[[state]]" on-focus="onSidebarFocus_"
<if expr="is_macosx">
- on-open-pdf-in-preview="onOpenPdfInPreview_"
+ on-open-pdf-in-preview="onOpenPdfInPreview_"
</if>
- on-print-with-system-dialog="onPrintWithSystemDialog_">
- </print-preview-link-container>
+<if expr="not chromeos">
+ on-print-with-system-dialog="onPrintWithSystemDialog_"
</if>
- </div>
- </div>
+ on-print-requested="onPrintRequested_"
+ on-cancel-requested="onCancelRequested_">
+ </print-preview-sidebar>
<div id="preview-area-container">
- <print-preview-preview-area id="previewArea" settings="{{settings}}"
- destination="[[destination_]]"
+ <print-preview-preview-area id="previewArea" settings="[[settings]]"
+ destination="[[destination_]]" error="{{error_}}"
document-modifiable="[[documentSettings_.isModifiable]]"
margins="[[margins_]]" page-size="[[pageSize_]]" state="[[state]]"
measurement-system="[[measurementSystem_]]"
+ new-print-preview-layout="[[newPrintPreviewLayout_]]"
preview-state="{{previewState_}}" on-preview-start="onPreviewStart_">
</print-preview-preview-area>
</div>
diff --git a/chromium/chrome/browser/resources/print_preview/new/app.js b/chromium/chrome/browser/resources/print_preview/new/app.js
index cc3f07e9ea1..079483f9c88 100644
--- a/chromium/chrome/browser/resources/print_preview/new/app.js
+++ b/chromium/chrome/browser/resources/print_preview/new/app.js
@@ -2,35 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-(function() {
-'use strict';
-
-/**
- * Number of settings sections to show when "More settings" is collapsed.
- * @type {number}
- */
-const MAX_SECTIONS_TO_SHOW = 6;
-
Polymer({
is: 'print-preview-app',
behaviors: [
SettingsBehavior,
- CrContainerShadowBehavior,
WebUIListenerBehavior,
],
properties: {
- /**
- * Object containing current settings of Print Preview, for use by Polymer
- * controls.
- * @type {!Object}
- */
- settings: {
- type: Object,
- notify: true,
- },
-
/** @type {!print_preview_new.State} */
state: {
type: Number,
@@ -38,114 +18,58 @@ Polymer({
},
/** @private {string} */
- activeUser_: {
- type: String,
- observer: 'onActiveUserChanged_',
- },
-
- /** @private {!print_preview.CloudPrintState} */
- cloudPrintState_: {
- type: Number,
- value: print_preview.CloudPrintState.DISABLED,
- },
+ cloudPrintErrorMessage_: String,
- /** @private {boolean} */
- controlsDisabled_: {
- type: Boolean,
- notify: true,
- computed: 'computeControlsDisabled_(state)',
- },
+ /** @private {!cloudprint.CloudPrintInterface} */
+ cloudPrintInterface_: Object,
/** @private {boolean} */
controlsManaged_: Boolean,
/** @private {print_preview.Destination} */
- destination_: {
- type: Object,
- notify: true,
- value: null,
- },
+ destination_: Object,
- /** @private {?print_preview.DestinationStore} */
- destinationStore_: {
- type: Object,
- notify: true,
- value: null,
+ /** @private {!print_preview.DestinationState} */
+ destinationState_: {
+ type: Number,
+ observer: 'onDestinationStateChange_',
},
/** @private {print_preview.DocumentSettings} */
documentSettings_: Object,
+ /** @private {!print_preview_new.Error} */
+ error_: Number,
+
/** @private {print_preview.Margins} */
margins_: Object,
- /** @private {!print_preview.Size} */
- pageSize_: Object,
-
- /** @private {!print_preview.PrintableArea} */
- printableArea_: Object,
-
- /** @private {string} */
- errorMessage_: {
- type: String,
- notify: true,
- value: '',
- },
-
- /** @private {?print_preview.InvitationStore} */
- invitationStore_: {
- type: Object,
- notify: true,
- value: null,
- },
-
/** @private {boolean} */
- isInAppKioskMode_: {
+ newPrintPreviewLayout_: {
type: Boolean,
- notify: true,
- value: false,
+ value: function() {
+ return loadTimeData.getBoolean('newPrintPreviewLayoutEnabled');
+ },
+ reflectToAttribute: true,
},
- /** @private {?print_preview.MeasurementSystem} */
- measurementSystem_: {
- type: Object,
- notify: true,
- value: null,
- },
+ /** @private {!print_preview.Size} */
+ pageSize_: Object,
/** @private {!print_preview_new.PreviewAreaState} */
previewState_: {
type: String,
- observer: 'onPreviewAreaStateChanged_',
+ observer: 'onPreviewStateChange_',
},
- /** @private {!Array<print_preview.RecentDestination>} */
- recentDestinations_: {
- type: Array,
- notify: true,
- },
-
- /** @private {boolean} */
- settingsExpandedByUser_: {
- type: Boolean,
- notify: true,
- value: false,
- },
+ /** @private {!print_preview.PrintableArea} */
+ printableArea_: Object,
- /** @private {boolean} */
- shouldShowMoreSettings_: {
- type: Boolean,
- notify: true,
- computed: 'computeShouldShowMoreSettings_(settings.pages.available, ' +
- 'settings.copies.available, settings.layout.available, ' +
- 'settings.color.available, settings.mediaSize.available, ' +
- 'settings.dpi.available, settings.margins.available, ' +
- 'settings.pagesPerSheet.available, settings.scaling.available, ' +
- 'settings.otherOptions.available, settings.vendorItems.available)',
+ /** @private {?print_preview.MeasurementSystem} */
+ measurementSystem_: {
+ type: Object,
+ value: null,
},
-
- /** @private {!Array<string>} */
- users_: Array,
},
listeners: {
@@ -156,9 +80,6 @@ Polymer({
/** @private {?print_preview.NativeLayer} */
nativeLayer_: null,
- /** @private {?cloudprint.CloudPrintInterface} */
- cloudPrintInterface_: null,
-
/** @private {!EventTracker} */
tracker_: new EventTracker(),
@@ -166,6 +87,12 @@ Polymer({
cancelled_: false,
/** @private {boolean} */
+ printRequested_: false,
+
+ /** @private {boolean} */
+ startPreviewWhenReady_: false,
+
+ /** @private {boolean} */
showSystemDialogBeforePrint_: false,
/** @private {boolean} */
@@ -174,6 +101,9 @@ Polymer({
/** @private {boolean} */
isInKioskAutoPrintMode_: false,
+ /** @private {?Promise} */
+ whenReady_: null,
+
/** @private {!Array<!CrDialogElement>} */
openDialogs_: [],
@@ -184,41 +114,16 @@ Polymer({
/** @override */
attached: function() {
+ document.documentElement.classList.remove('loading');
this.nativeLayer_ = print_preview.NativeLayer.getInstance();
this.addWebUIListener(
'use-cloud-print', this.onCloudPrintEnable_.bind(this));
this.addWebUIListener('print-failed', this.onPrintFailed_.bind(this));
this.addWebUIListener(
'print-preset-options', this.onPrintPresetOptions_.bind(this));
- this.destinationStore_ =
- new print_preview.DestinationStore(this.addWebUIListener.bind(this));
- this.invitationStore_ = new print_preview.InvitationStore();
this.tracker_.add(window, 'keydown', this.onKeyDown_.bind(this));
this.$.previewArea.setPluginKeyEventCallback(this.onKeyDown_.bind(this));
- this.tracker_.add(
- this.destinationStore_,
- print_preview.DestinationStore.EventType.DESTINATION_SELECT,
- this.onDestinationSelect_.bind(this));
- // <if expr="chromeos">
- this.tracker_.add(
- this.destinationStore_,
- print_preview.DestinationStore.EventType.NO_DESTINATIONS_FOUND,
- this.onNoDestinationsFound_.bind(this));
- // </if>
- this.tracker_.add(
- this.destinationStore_,
- print_preview.DestinationStore.EventType
- .SELECTED_DESTINATION_CAPABILITIES_READY,
- this.onDestinationUpdated_.bind(this));
- this.tracker_.add(
- this.destinationStore_,
- print_preview.DestinationStore.EventType
- .SELECTED_DESTINATION_UNSUPPORTED,
- this.onInvalidPrinter_.bind(this));
- this.tracker_.add(
- this.destinationStore_,
- print_preview.DestinationStore.EventType.SELECTED_DESTINATION_INVALID,
- this.onInvalidPrinter_.bind(this));
+ this.whenReady_ = print_preview.Model.whenReady();
this.nativeLayer_.getInitialSettings().then(
this.onInitialSettingsSet_.bind(this));
},
@@ -226,14 +131,12 @@ Polymer({
/** @override */
detached: function() {
this.tracker_.removeAll();
+ this.whenReady_ = null;
},
- /**
- * @return {boolean} Whether the controls should be disabled.
- * @private
- */
- computeControlsDisabled_: function() {
- return this.state != print_preview_new.State.READY;
+ /** @private */
+ onSidebarFocus_: function() {
+ this.$.previewArea.hideToolbars();
},
/**
@@ -278,9 +181,7 @@ Polymer({
if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) ||
(!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) {
// Don't use system dialog if the link isn't available.
- const linkContainer = this.$$('print-preview-link-container');
- if (!linkContainer || !linkContainer.systemDialogLinkAvailable()) {
- e.preventDefault();
+ if (!this.$.sidebar.systemDialogLinkAvailable()) {
return;
}
@@ -342,30 +243,35 @@ Polymer({
* @private
*/
onInitialSettingsSet_: function(settings) {
- this.$.documentInfo.init(
- settings.previewModifiable, settings.documentTitle,
- settings.documentHasSelection);
- this.$.model.setStickySettings(settings.serializedAppStateStr);
- this.$.model.setPolicySettings(
- settings.headerFooter, settings.isHeaderFooterManaged);
- this.measurementSystem_ = new print_preview.MeasurementSystem(
- settings.thousandsDelimeter, settings.decimalDelimeter,
- settings.unitType);
- this.setSetting('selectionOnly', settings.shouldPrintSelectionOnly);
- this.destinationStore_.init(
- settings.isInAppKioskMode, settings.printerName,
- settings.serializedDefaultDestinationSelectionRulesStr,
- this.recentDestinations_);
- this.isInAppKioskMode_ = settings.isInAppKioskMode;
- this.isInKioskAutoPrintMode_ = settings.isInKioskAutoPrintMode;
-
- // This is only visible in the task manager.
- let title = document.head.querySelector('title');
- if (!title) {
- title = document.createElement('title');
- document.head.appendChild(title);
+ if (!this.whenReady_) {
+ // This element and its corresponding model were detached while waiting
+ // for the callback. This can happen in tests; return early.
+ return;
}
- title.textContent = settings.documentTitle;
+ this.whenReady_.then(() => {
+ this.$.documentInfo.init(
+ settings.previewModifiable, settings.documentTitle,
+ settings.documentHasSelection);
+ this.$.model.setStickySettings(settings.serializedAppStateStr);
+ this.$.model.setPolicySettings(
+ settings.headerFooter, settings.isHeaderFooterManaged);
+ this.measurementSystem_ = new print_preview.MeasurementSystem(
+ settings.thousandsDelimeter, settings.decimalDelimeter,
+ settings.unitType);
+ this.setSetting('selectionOnly', settings.shouldPrintSelectionOnly);
+ this.$.sidebar.init(
+ settings.isInAppKioskMode, settings.printerName,
+ settings.serializedDefaultDestinationSelectionRulesStr);
+ this.isInKioskAutoPrintMode_ = settings.isInKioskAutoPrintMode;
+
+ // This is only visible in the task manager.
+ let title = document.head.querySelector('title');
+ if (!title) {
+ title = document.createElement('title');
+ document.head.appendChild(title);
+ }
+ title.textContent = settings.documentTitle;
+ });
},
/**
@@ -378,81 +284,92 @@ Polymer({
* @private
*/
onCloudPrintEnable_: function(cloudPrintUrl, appKioskMode) {
- assert(!this.cloudPrintInterface_);
- this.cloudPrintInterface_ = cloudprint.getCloudPrintInterface(
- cloudPrintUrl, assert(this.nativeLayer_), appKioskMode);
- this.tracker_.add(
- assert(this.cloudPrintInterface_).getEventTarget(),
- cloudprint.CloudPrintInterfaceEventType.SUBMIT_DONE,
- this.close_.bind(this));
-
- [cloudprint.CloudPrintInterfaceEventType.SEARCH_FAILED,
- cloudprint.CloudPrintInterfaceEventType.PRINTER_FAILED,
- ].forEach(eventType => {
- this.tracker_.add(
- assert(this.cloudPrintInterface_).getEventTarget(), eventType,
- this.checkCloudPrintStatus_.bind(this));
- });
- this.tracker_.add(
- assert(this.cloudPrintInterface_).getEventTarget(),
- cloudprint.CloudPrintInterfaceEventType.SUBMIT_FAILED,
- this.onCloudPrintError_.bind(this));
-
- this.destinationStore_.setCloudPrintInterface(this.cloudPrintInterface_);
- this.invitationStore_.setCloudPrintInterface(this.cloudPrintInterface_);
- assert(this.cloudPrintState_ === print_preview.CloudPrintState.DISABLED);
- this.cloudPrintState_ = print_preview.CloudPrintState.ENABLED;
- },
-
- /** @private */
- onDestinationSelect_: function() {
- // If the plugin does not exist do not attempt to load the preview.
- if (this.state == print_preview_new.State.FATAL_ERROR) {
+ if (!this.whenReady_) {
+ // This element and its corresponding model were detached while waiting
+ // for the callback. This can happen in tests; return early.
return;
}
-
- this.$.state.transitTo(print_preview_new.State.NOT_READY);
- this.destination_ = this.destinationStore_.selectedDestination;
+ this.whenReady_.then(() => {
+ assert(!this.cloudPrintInterface_);
+ this.cloudPrintInterface_ = cloudprint.getCloudPrintInterface(
+ cloudPrintUrl, assert(this.nativeLayer_), appKioskMode);
+ this.tracker_.add(
+ assert(this.cloudPrintInterface_).getEventTarget(),
+ cloudprint.CloudPrintInterfaceEventType.SUBMIT_DONE,
+ this.close_.bind(this));
+ this.tracker_.add(
+ assert(this.cloudPrintInterface_).getEventTarget(),
+ cloudprint.CloudPrintInterfaceEventType.SUBMIT_FAILED,
+ this.onCloudPrintError_.bind(this, appKioskMode));
+ });
},
/** @private */
- onDestinationUpdated_: function() {
- // Notify observers, since destination_ ==
- // destinationStore_.selectedDestination and this event indicates
- // destinationStore_.selectedDestination.capabilities has been updated.
- this.notifyPath('destination_.capabilities');
-
- if (!this.$.model.initialized()) {
- this.$.model.applyStickySettings();
- }
+ onDestinationStateChange_: function() {
+ switch (this.destinationState_) {
+ case print_preview.DestinationState.SELECTED:
+ case print_preview.DestinationState.SET:
+ if (this.state !== print_preview_new.State.NOT_READY) {
+ this.$.state.transitTo(print_preview_new.State.NOT_READY);
+ }
+ break;
+ case print_preview.DestinationState.UPDATED:
+ if (!this.$.model.initialized()) {
+ this.$.model.applyStickySettings();
+ }
- // <if expr="chromeos">
- if (this.destination_) {
- this.$.model.applyDestinationSpecificPolicies();
- }
- // </if>
+ // <if expr="chromeos">
+ this.$.model.applyDestinationSpecificPolicies();
+ // </if>
- if (this.state == print_preview_new.State.NOT_READY ||
- this.state == print_preview_new.State.INVALID_PRINTER) {
- this.$.state.transitTo(print_preview_new.State.READY);
- if (this.isInKioskAutoPrintMode_) {
- this.onPrintRequested_();
- }
+ this.startPreviewWhenReady_ = true;
+ this.$.state.transitTo(print_preview_new.State.READY);
+ break;
+ case print_preview.DestinationState.ERROR:
+ let newState = print_preview_new.State.ERROR;
+ // <if expr="chromeos">
+ if (this.error_ === print_preview_new.Error.NO_DESTINATIONS) {
+ newState = print_preview_new.State.FATAL_ERROR;
+ }
+ // </if>
+ this.$.state.transitTo(newState);
+ break;
+ default:
+ break;
}
},
/**
- * @param {!CustomEvent<string>} e Event containing the sticky settings
- * string.
+ * @param {!CustomEvent<string>} e Event containing the new sticky settings.
* @private
*/
- onSaveStickySettings_: function(e) {
+ onStickySettingChanged_: function(e) {
this.nativeLayer_.saveAppState(e.detail);
},
/** @private */
+ onPreviewSettingChanged_: function() {
+ if (this.state === print_preview_new.State.READY) {
+ this.$.previewArea.startPreview(false);
+ this.startPreviewWhenReady_ = false;
+ } else {
+ this.startPreviewWhenReady_ = true;
+ }
+ },
+
+ /** @private */
onStateChanged_: function() {
- if (this.state == print_preview_new.State.CLOSING) {
+ if (this.state == print_preview_new.State.READY) {
+ if (this.startPreviewWhenReady_) {
+ this.$.previewArea.startPreview(false);
+ this.startPreviewWhenReady_ = false;
+ }
+ if (this.isInKioskAutoPrintMode_ || this.printRequested_) {
+ this.onPrintRequested_();
+ // Reset in case printing fails.
+ this.printRequested_ = false;
+ }
+ } else if (this.state == print_preview_new.State.CLOSING) {
this.remove();
this.nativeLayer_.dialogClose(this.cancelled_);
} else if (this.state == print_preview_new.State.HIDDEN) {
@@ -463,15 +380,7 @@ Polymer({
this.nativeLayer_.hidePreview();
}
} else if (this.state == print_preview_new.State.PRINTING) {
- if (this.shouldShowMoreSettings_) {
- print_preview.MetricsContext.printSettingsUi().record(
- this.settingsExpandedByUser_ ?
- print_preview.Metrics.PrintSettingsUiBucket
- .PRINT_WITH_SETTINGS_EXPANDED :
- print_preview.Metrics.PrintSettingsUiBucket
- .PRINT_WITH_SETTINGS_COLLAPSED);
- }
- const destination = assert(this.destinationStore_.selectedDestination);
+ const destination = assert(this.destination_);
const whenPrintDone =
this.nativeLayer_.print(this.$.model.createPrintTicket(
destination, this.openPdfInPreview_,
@@ -494,6 +403,10 @@ Polymer({
/** @private */
onPrintRequested_: function() {
+ if (this.state === print_preview_new.State.NOT_READY) {
+ this.printRequested_ = true;
+ return;
+ }
this.$.state.transitTo(
this.$.previewArea.previewLoaded() ? print_preview_new.State.PRINTING :
print_preview_new.State.HIDDEN);
@@ -510,9 +423,12 @@ Polymer({
* @private
*/
onSettingValidChanged_: function(e) {
- this.$.state.transitTo(
- e.detail ? print_preview_new.State.READY :
- print_preview_new.State.INVALID_TICKET);
+ if (e.detail) {
+ this.$.state.transitTo(print_preview_new.State.READY);
+ } else {
+ this.error_ = print_preview_new.Error.INVALID_TICKET;
+ this.$.state.transitTo(print_preview_new.State.ERROR);
+ }
},
/** @private */
@@ -529,7 +445,7 @@ Polymer({
onPrintToCloud_: function(data) {
assert(
this.cloudPrintInterface_ != null, 'Google Cloud Print is not enabled');
- const destination = assert(this.destinationStore_.selectedDestination);
+ const destination = assert(this.destination_);
this.cloudPrintInterface_.submit(
destination, this.$.model.createCloudJobTicket(destination),
this.documentSettings_.title, data);
@@ -566,78 +482,48 @@ Polymer({
*/
onPrintFailed_: function(httpError) {
console.error('Printing failed with error code ' + httpError);
- this.errorMessage_ = loadTimeData.getString('couldNotPrint');
+ this.error_ = print_preview_new.Error.PRINT_FAILED;
this.$.state.transitTo(print_preview_new.State.FATAL_ERROR);
},
/** @private */
- onInvalidPrinter_: function() {
- this.previewState_ =
- print_preview_new.PreviewAreaState.UNSUPPORTED_CLOUD_PRINTER;
- },
-
- /** @private */
- onInvalidPrinterCapabilities_: function() {
- this.previewState_ = print_preview_new.PreviewAreaState.INVALID_SETTINGS;
- },
-
- /** @private */
- onPreviewAreaStateChanged_: function() {
+ onPreviewStateChange_: function() {
switch (this.previewState_) {
- case print_preview_new.PreviewAreaState.PREVIEW_FAILED:
- case print_preview_new.PreviewAreaState.NO_PLUGIN:
- this.$.state.transitTo(print_preview_new.State.FATAL_ERROR);
- break;
- case print_preview_new.PreviewAreaState.INVALID_SETTINGS:
- case print_preview_new.PreviewAreaState.UNSUPPORTED_CLOUD_PRINTER:
- if (this.state != print_preview_new.State.INVALID_PRINTER) {
- this.$.state.transitTo(print_preview_new.State.INVALID_PRINTER);
- }
- break;
case print_preview_new.PreviewAreaState.DISPLAY_PREVIEW:
case print_preview_new.PreviewAreaState.OPEN_IN_PREVIEW_LOADED:
- if (this.state == print_preview_new.State.HIDDEN) {
+ if (this.state === print_preview_new.State.HIDDEN) {
this.$.state.transitTo(print_preview_new.State.PRINTING);
}
break;
+ case print_preview_new.PreviewAreaState.ERROR:
+ if (this.state !== print_preview_new.State.ERROR &&
+ this.state !== print_preview_new.State.FATAL_ERROR) {
+ this.$.state.transitTo(
+ this.error_ === print_preview_new.Error.INVALID_PRINTER ?
+ print_preview_new.State.ERROR :
+ print_preview_new.State.FATAL_ERROR);
+ }
+ break;
default:
break;
}
},
/**
- * Updates the cloud print status to NOT_SIGNED_IN if there is an
- * authentication error.
- * @param {!CustomEvent<!cloudprint.CloudPrintInterfaceErrorEventDetail>}
- * event Contains the error status
- * @private
- */
- checkCloudPrintStatus_: function(event) {
- if (event.detail.status != 403 || this.isInAppKioskMode_) {
- return;
- }
-
- // Should not have sent a message to Cloud Print if cloud print is
- // disabled.
- assert(this.cloudPrintState_ !== print_preview.CloudPrintState.DISABLED);
- this.cloudPrintState_ = print_preview.CloudPrintState.NOT_SIGNED_IN;
- console.warn('Google Cloud Print Error: HTTP status 403');
- },
-
- /**
* Called when there was an error communicating with Google Cloud print.
* Displays an error message in the print header.
+ * @param {boolean} appKioskMode
* @param {!CustomEvent<!cloudprint.CloudPrintInterfaceErrorEventDetail>}
* event Contains the error message.
* @private
*/
- onCloudPrintError_: function(event) {
- this.checkCloudPrintStatus_(event);
+ onCloudPrintError_: function(appKioskMode, event) {
if (event.detail.status == 0 ||
- (event.detail.status == 403 && !this.isInAppKioskMode_)) {
- return; // No internet connectivity or handled by checkCloudPrintStatus_.
+ (event.detail.status == 403 && !appKioskMode)) {
+ return; // No internet connectivity or not signed in.
}
- this.errorMessage_ = event.detail.message;
+ this.cloudPrintErrorMessage_ = event.detail.message;
+ this.error_ = print_preview_new.Error.CLOUD_PRINT_ERROR;
this.$.state.transitTo(print_preview_new.State.FATAL_ERROR);
if (event.detail.status == 200) {
console.error(
@@ -670,38 +556,17 @@ Polymer({
if (duplex !== print_preview_new.DuplexMode.UNKNOWN_DUPLEX_MODE &&
this.getSetting('duplex').available) {
this.setSetting(
- 'duplex', duplex === print_preview_new.DuplexMode.LONG_EDGE);
+ 'duplex',
+ duplex === print_preview_new.DuplexMode.LONG_EDGE ||
+ duplex === print_preview_new.DuplexMode.SHORT_EDGE);
}
- },
-
- /**
- * @return {boolean} Whether to show the "More settings" link.
- * @private
- */
- computeShouldShowMoreSettings_: function() {
- // Destination settings is always available. See if the total number of
- // available sections exceeds the maximum number to show.
- return [
- 'pages', 'copies', 'layout', 'color', 'mediaSize', 'margins', 'color',
- 'pagesPerSheet', 'scaling', 'otherOptions', 'vendorItems'
- ].reduce((count, setting) => {
- return this.getSetting(setting).available ? count + 1 : count;
- }, 1) > MAX_SECTIONS_TO_SHOW;
- },
-
- /**
- * @return {boolean} Whether the "more settings" collapse should be expanded.
- * @private
- */
- shouldExpandSettings_: function() {
- if (this.settingsExpandedByUser_ === undefined ||
- this.shouldShowMoreSettings_ === undefined) {
- return false;
+ if (duplex !== print_preview_new.DuplexMode.UNKNOWN_DUPLEX_MODE &&
+ duplex !== print_preview_new.DuplexMode.SIMPLEX &&
+ this.getSetting('duplexShortEdge').available) {
+ this.setSetting(
+ 'duplexShortEdge',
+ duplex === print_preview_new.DuplexMode.SHORT_EDGE);
}
-
- // Expand the settings if the user has requested them expanded or if more
- // settings is not displayed (i.e. less than 6 total settings available).
- return this.settingsExpandedByUser_ || !this.shouldShowMoreSettings_;
},
/**
@@ -712,37 +577,8 @@ Polymer({
this.$.documentInfo.inFlightRequestId = e.detail;
},
- // <if expr="chromeos">
- /** @private */
- onNoDestinationsFound_: function() {
- this.$.state.transitTo(print_preview_new.State.INVALID_PRINTER);
- this.$.previewArea.setNoDestinationsFound();
- this.$.destinationSettings.noDestinationsFound = true;
- },
- // </if>
-
/** @private */
close_: function() {
this.$.state.transitTo(print_preview_new.State.CLOSING);
},
-
- /**
- * @param {!CustomEvent<string>} e Event containing the new active user
- * account.
- * @private
- */
- onAccountChange_: function(e) {
- this.$.userInfo.updateActiveUser(e.detail);
- },
-
- /** @private */
- onActiveUserChanged_: function() {
- if (!this.activeUser_) {
- return;
- }
-
- assert(this.cloudPrintState_ !== print_preview.CloudPrintState.DISABLED);
- this.cloudPrintState_ = print_preview.CloudPrintState.SIGNED_IN;
- },
});
-})();
diff --git a/chromium/chrome/browser/resources/print_preview/new/button_strip.html b/chromium/chrome/browser/resources/print_preview/new/button_strip.html
new file mode 100644
index 00000000000..60fdc03c94f
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/button_strip.html
@@ -0,0 +1,53 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="chrome://resources/html/assert.html">
+<link rel="import" href="chrome://resources/html/cr.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="../data/destination.html">
+<link rel="import" href="print_preview_shared_css.html">
+<link rel="import" href="state.html">
+<link rel="import" href="strings.html">
+
+<dom-module id="print-preview-button-strip">
+ <template>
+ <style include="print-preview-shared paper-button-style">
+ :host {
+ display: flex;
+ flex-direction: row;
+ justify-content: flex-end;
+ padding-bottom: 16px;
+ padding-inline-end: 16px;
+ padding-top: 16px;
+ }
+
+ :host-context(html:not([dark])) {
+ background-color: white;
+ }
+
+ :host paper-button:not(:last-child) {
+ margin-inline-end: 8px;
+ }
+
+ :host paper-button:last-child {
+ margin-inline-end: 0;
+ }
+ </style>
+<if expr="not is_win">
+ <paper-button class="cancel-button" on-click="onCancelClick_">
+ $i18n{cancel}
+ </paper-button>
+</if>
+ <paper-button class="action-button" on-click="onPrintClick_"
+ disabled$="[[!printButtonEnabled_]]">
+ [[printButtonLabel_]]
+ </paper-button>
+<if expr="is_win">
+ <paper-button class="cancel-button" on-click="onCancelClick_">
+ $i18n{cancel}
+ </paper-button>
+</if>
+ </template>
+ <script src="button_strip.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/print_preview/new/button_strip.js b/chromium/chrome/browser/resources/print_preview/new/button_strip.js
new file mode 100644
index 00000000000..66ced123e7b
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/button_strip.js
@@ -0,0 +1,86 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer({
+ is: 'print-preview-button-strip',
+
+ properties: {
+ /** @type {!print_preview.Destination} */
+ destination: Object,
+
+ /** @type {!print_preview_new.State} */
+ state: {
+ type: Number,
+ observer: 'updatePrintButtonEnabled_',
+ },
+
+ /** @private */
+ printButtonEnabled_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /** @private */
+ printButtonLabel_: {
+ type: String,
+ value: function() {
+ return loadTimeData.getString('printButton');
+ },
+ },
+ },
+
+ observers: ['updatePrintButtonLabel_(destination.id)'],
+
+ /** @private {!print_preview_new.State} */
+ lastState_: print_preview_new.State.NOT_READY,
+
+ /** @private */
+ onPrintClick_: function() {
+ this.fire('print-requested');
+ },
+
+ /** @private */
+ onCancelClick_: function() {
+ this.fire('cancel-requested');
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ isPdfOrDrive_: function() {
+ return this.destination &&
+ (this.destination.id ==
+ print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ||
+ this.destination.id ==
+ print_preview.Destination.GooglePromotedId.DOCS);
+ },
+
+ /** @private */
+ updatePrintButtonLabel_: function() {
+ this.printButtonLabel_ = loadTimeData.getString(
+ this.isPdfOrDrive_() ? 'saveButton' : 'printButton');
+ },
+
+ /** @private */
+ updatePrintButtonEnabled_: function() {
+ switch (this.state) {
+ case (print_preview_new.State.PRINTING):
+ this.printButtonEnabled_ = false;
+ break;
+ case (print_preview_new.State.READY):
+ this.printButtonEnabled_ = true;
+ if (this.lastState_ != this.state &&
+ (document.activeElement == null ||
+ document.activeElement == document.body)) {
+ this.$$('paper-button.action-button').focus();
+ }
+ break;
+ default:
+ this.printButtonEnabled_ = false;
+ break;
+ }
+ this.lastState_ = this.state;
+ },
+});
diff --git a/chromium/chrome/browser/resources/print_preview/new/destination_dialog.html b/chromium/chrome/browser/resources/print_preview/new/destination_dialog.html
index f34b57c1372..9675f7148a7 100644
--- a/chromium/chrome/browser/resources/print_preview/new/destination_dialog.html
+++ b/chromium/chrome/browser/resources/print_preview/new/destination_dialog.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
@@ -16,7 +17,6 @@
<link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../metrics.html">
<link rel="import" href="../native_layer.html">
@@ -91,9 +91,13 @@
padding: 0;
}
+ :host-context([dark]) #dialog #promos {
+ background: rgb(50, 54, 57);
+ }
+
#dialog .promo {
align-items: center;
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
display: flex;
padding: 16px 20px;
}
@@ -108,8 +112,8 @@
}
#cloudPrintClose {
- --cr-icon-ripple-size: 20px;
- --cr-icon-size: 16px;
+ --cr-icon-button-size: 20px;
+ --cr-icon-button-icon-size: 16px;
margin-inline-start: 16px;
min-height: 14px;
min-width: 14px;
@@ -127,12 +131,15 @@
}
#invitationPromo paper-button {
- background-color: white;
margin: 0 4px;
}
+ :host-context(html:not([dark])) #invitationPromo paper-button {
+ background-color: white;
+ }
+
#invitationPromo invitation-details {
- color: var(--google-grey-refresh-700);
+ color: var(--cr-secondary-text-color);
font-size: calc(10 / 13 * 1em);
font-weight: 500;
}
@@ -180,15 +187,15 @@
$i18n{cancel}
</paper-button>
</div>
- <div id="promos" slot="footer">
+ <div id="promos" slot="footer" hidden="[[!shouldShowFooter_(
+ cloudPrintPromoDismissed_, cloudPrintState, invitation_)]]">
<div class="promo" id="cloudprintPromo"
hidden$="[[!shouldShowCloudPrintPromo_(
cloudPrintPromoDismissed_, cloudPrintState)]]">
<iron-icon icon="print-preview:cloud-queue" alt=""></iron-icon>
<div class="promo-text"></div>
- <paper-icon-button-light id="cloudPrintClose" class="icon-clear">
- <button on-click="onCloudPrintPromoDismissed_"></button>
- </paper-icon-button-light>
+ <cr-icon-button id="cloudPrintClose" class="icon-clear"
+ on-click="onCloudPrintPromoDismissed_"></cr-icon-button>
</div>
<div class="promo" id="invitationPromo" hidden="[[!invitation_]]">
<div inner-h-t-m-l="[[getInvitationText_(invitation_)]]"></div>
diff --git a/chromium/chrome/browser/resources/print_preview/new/destination_dialog.js b/chromium/chrome/browser/resources/print_preview/new/destination_dialog.js
index 2aae2bd227b..7bfeb682c1b 100644
--- a/chromium/chrome/browser/resources/print_preview/new/destination_dialog.js
+++ b/chromium/chrome/browser/resources/print_preview/new/destination_dialog.js
@@ -99,6 +99,11 @@ Polymer({
assert(this.$$('.sign-in')), 'click', this.onSignInClick_.bind(this));
},
+ /** @override */
+ detached: function() {
+ this.tracker_.removeAll();
+ },
+
/**
* @param {!KeyboardEvent} e Event containing the key
* @private
@@ -177,7 +182,7 @@ Polymer({
.DESTINATION_CLOSED_UNCHANGED :
print_preview.Metrics.DestinationSearchBucket
.DESTINATION_CLOSED_CHANGED);
- if (cancelled && this.currentDestinationAccount &&
+ if (this.currentDestinationAccount &&
this.currentDestinationAccount !== this.activeUser) {
this.fire('account-change', this.currentDestinationAccount);
}
@@ -408,6 +413,14 @@ Polymer({
!this.cloudPrintPromoDismissed_;
},
+ /**
+ * @return {boolean} Whether to show the footer.
+ * @private
+ */
+ shouldShowFooter_: function() {
+ return this.shouldShowCloudPrintPromo_() || !!this.invitation_;
+ },
+
/** @private */
onOpenSettingsPrintPage_: function() {
this.metrics_.record(
diff --git a/chromium/chrome/browser/resources/print_preview/new/destination_list.html b/chromium/chrome/browser/resources/print_preview/new/destination_list.html
index 5f66d8c17a8..e565d595f38 100644
--- a/chromium/chrome/browser/resources/print_preview/new/destination_list.html
+++ b/chromium/chrome/browser/resources/print_preview/new/destination_list.html
@@ -53,6 +53,10 @@
background-color: rgb(228, 236, 247);
}
+ :host-context([dark]) .list-item:-webkit-any(:hover, :focus) {
+ background-color: var(--cr-menu-background-focus-color);
+ }
+
.list-item:focus {
outline: none;
}
diff --git a/chromium/chrome/browser/resources/print_preview/new/destination_list_item.html b/chromium/chrome/browser/resources/print_preview/new/destination_list_item.html
index f67e5b40baf..c271fb90acd 100644
--- a/chromium/chrome/browser/resources/print_preview/new/destination_list_item.html
+++ b/chromium/chrome/browser/resources/print_preview/new/destination_list_item.html
@@ -31,7 +31,7 @@
:host > * {
align-items: center;
- color: var(--google-grey-700);
+ color: var(--cr-secondary-text-color);
font-size: calc(10/12 * 1em);
margin-inline-start: 1em;
overflow: hidden;
@@ -49,8 +49,12 @@
transition: opacity 150ms;
}
+ :host-context([dark]) iron-icon {
+ fill: var(--google-grey-refresh-500);
+ }
+
.name {
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
font-size: 1em;
margin-inline-start: 0;
}
diff --git a/chromium/chrome/browser/resources/print_preview/new/destination_select.html b/chromium/chrome/browser/resources/print_preview/new/destination_select.html
index 84fc622dbda..a7dd8886912 100644
--- a/chromium/chrome/browser/resources/print_preview/new/destination_select.html
+++ b/chromium/chrome/browser/resources/print_preview/new/destination_select.html
@@ -8,6 +8,7 @@
<link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-meta/iron-meta.html">
<link rel="import" href="../icons.html">
+<link rel="import" href="../print_preview_utils.html">
<link rel="import" href="../data/destination.html">
<link rel="import" href="../data/user_info.html">
<link rel="import" href="print_preview_shared_css.html">
@@ -37,8 +38,7 @@
</style>
<select class="md-select" aria-label$="[[i18n(destinationLabel)]]"
style="background-image:
- [[getIconImage_(destination.icon, noDestinationsFound)]],
- url(chrome://resources/images/arrow_down.svg);"
+ [[getBackgroundImages_(destination.icon, destinationState, dark)]];"
disabled$="[[disabled]]"
value="{{selectedValue::change}}">
<template is="dom-repeat" items="[[recentDestinationList]]">
@@ -51,10 +51,12 @@
hidden$="[[!showGoogleDrive_]]">
$i18n{printToGoogleDrive}
</option>
- <option value="noDestinations" hidden$="[[!noDestinationsFound]]"
- selected$="[[noDestinationsFound]]">
+<if expr="chromeos">
+ <option value="noDestinations"
+ hidden$="[[!noDestinations]]" selected$="[[noDestinations]]">
$i18n{noDestinationsMessage}
</option>
+</if>
<option value="seeMore" aria-label$="[[i18n(seeMoreDestinationsLabel)]]">
$i18n{seeMore}
</option>
diff --git a/chromium/chrome/browser/resources/print_preview/new/destination_select.js b/chromium/chrome/browser/resources/print_preview/new/destination_select.js
index 5e02797edb5..bed46b606ca 100644
--- a/chromium/chrome/browser/resources/print_preview/new/destination_select.js
+++ b/chromium/chrome/browser/resources/print_preview/new/destination_select.js
@@ -15,12 +15,14 @@ Polymer({
/** @type {!print_preview.CloudPrintState} */
cloudPrintState: Number,
+ dark: Boolean,
+
/** @type {!print_preview.Destination} */
destination: Object,
disabled: Boolean,
- noDestinationsFound: Boolean,
+ noDestinations: Boolean,
/** @type {!Array<!print_preview.Destination>} */
recentDestinationList: Array,
@@ -73,24 +75,25 @@ Polymer({
/**
* @param {string} icon The icon set and icon to obtain.
- * @return {string} An inline svg corresponding to |icon|.
+ * @return {string} An inline svg corresponding to |icon| and the image for
+ * the dropdown arrow.
* @private
*/
- getIconImage_: function(icon) {
+ getBackgroundImages_: function(icon) {
if (!icon) {
return '';
}
- const iconSetAndIcon =
- this.noDestinationsFound ? ['cr', 'error'] : icon.split(':');
- const iconset = /** @type {Polymer.IronIconsetSvg} */ (
+ let iconSetAndIcon = null;
+ // <if expr="chromeos">
+ if (this.noDestinations) {
+ iconSetAndIcon = ['cr', 'error'];
+ }
+ // </if>
+ iconSetAndIcon = iconSetAndIcon || icon.split(':');
+ const iconset = /** @type {!Polymer.IronIconsetSvg} */ (
this.meta_.byKey(iconSetAndIcon[0]));
- const serializer = new XMLSerializer();
- const iconElement = iconset.createIcon(iconSetAndIcon[1], isRTL());
- iconElement.style.fill = '#80868B';
- const serializedIcon = serializer.serializeToString(iconElement);
- return 'url("data:image/svg+xml;charset=utf-8,' +
- encodeURIComponent(serializedIcon) + '")';
+ return getSelectDropdownBackground(iconset, iconSetAndIcon[1], this);
},
/** @private */
diff --git a/chromium/chrome/browser/resources/print_preview/new/destination_settings.html b/chromium/chrome/browser/resources/print_preview/new/destination_settings.html
index 9e1553ad818..4aae1f0be0d 100644
--- a/chromium/chrome/browser/resources/print_preview/new/destination_settings.html
+++ b/chromium/chrome/browser/resources/print_preview/new/destination_settings.html
@@ -3,8 +3,11 @@
<link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/event_tracker.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
+<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
+<link rel="import" href="../cloud_print_interface.html">
<link rel="import" href="../data/destination.html">
<link rel="import" href="../data/destination_store.html">
<link rel="import" href="../data/invitation_store.html">
@@ -13,6 +16,7 @@
<link rel="import" href="destination_select.html">
<link rel="import" href="print_preview_shared_css.html">
<link rel="import" href="throbber_css.html">
+<link rel="import" href="settings_behavior.html">
<link rel="import" href="settings_section.html">
<link rel="import" href="state.html">
<link rel="import" href="strings.html">
@@ -20,6 +24,12 @@
<dom-module id="print-preview-destination-settings">
<template>
<style include="print-preview-shared throbber cr-hidden-style">
+<if expr="chromeos">
+ :host([has-pin-setting_]) {
+ margin-bottom: 0 !important;
+ }
+</if>
+
.throbber-container {
align-items: center;
display: flex;
@@ -27,7 +37,7 @@
}
.destination-status {
- color: var(--google-grey-700);
+ color: var(--cr-secondary-text-color);
font-size: calc(12/13 * 1em);
overflow: hidden;
padding-top: 4px;
@@ -45,6 +55,10 @@
min-height: 0;
}
</style>
+ <print-preview-user-info id="userInfo" active-user="{{activeUser_}}"
+ users="{{users_}}" destination-store="[[destinationStore_]]"
+ invitation-store="[[invitationStore_]]">
+ </print-preview-user-info>
<print-preview-settings-section>
<span slot="title">$i18n{destinationLabel}</span>
<div slot="controls">
@@ -53,13 +67,13 @@
</div>
<print-preview-destination-select id="destinationSelect"
hidden$="[[!shouldHideSpinner_]]"
- active-user="[[activeUser]]"
+ active-user="[[activeUser_]]"
app-kiosk-mode="[[appKioskMode]]"
- cloud-print-state="[[cloudPrintState]]"
+ cloud-print-state="[[cloudPrintState_]]" dark="[[dark]]"
destination="[[destination]]"
- disabled="[[shouldDisableDropdown_(destinationStore, disabled,
- shouldHideSpinner_, state)]]"
- no-destinations-found="[[noDestinationsFound]]"
+ disabled="[[shouldDisableDropdown_(
+ destinationState, state, disabled)]]"
+ no-destinations="[[noDestinations_]]"
recent-destination-list="[[recentDestinationList_]]"
on-selected-option-change="onSelectedDestinationOptionChange_">
</print-preview-destination-select>
@@ -75,13 +89,13 @@
<cr-lazy-render id="destinationDialog">
<template>
<print-preview-destination-dialog
- cloud-print-state="[[cloudPrintState]]"
- destination-store="[[destinationStore]]"
- invitation-store="[[invitationStore]]"
+ cloud-print-state="[[cloudPrintState_]]"
+ destination-store="[[destinationStore_]]"
+ invitation-store="[[invitationStore_]]"
recent-destination-list="[[recentDestinationList_]]"
- active-user="[[activeUser]]" users="[[users]]"
+ active-user="[[activeUser_]]" users="[[users_]]"
current-destination-account="[[destination.account]]"
- on-close="onDialogClose_">
+ on-account-change="onAccountChange_" on-close="onDialogClose_">
</print-preview-destination-dialog>
</template>
</cr-lazy-render>
diff --git a/chromium/chrome/browser/resources/print_preview/new/destination_settings.js b/chromium/chrome/browser/resources/print_preview/new/destination_settings.js
index 195bb8e03c0..29cf07d0491 100644
--- a/chromium/chrome/browser/resources/print_preview/new/destination_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/new/destination_settings.js
@@ -2,52 +2,106 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+cr.exportPath('print_preview');
+
+/** @enum {number} */
+print_preview.DestinationState = {
+ INIT: 0,
+ SELECTED: 1,
+ SET: 2,
+ UPDATED: 3,
+ ERROR: 4,
+};
+
+(function() {
+'use strict';
+
+/** @type {number} Number of recent destinations to save. */
+const NUM_PERSISTED_DESTINATIONS = 3;
+
Polymer({
is: 'print-preview-destination-settings',
- behaviors: [I18nBehavior],
+ behaviors: [
+ I18nBehavior,
+ SettingsBehavior,
+ WebUIListenerBehavior,
+ ],
properties: {
- activeUser: String,
-
appKioskMode: Boolean,
- /** @type {!print_preview.CloudPrintState} */
- cloudPrintState: {
- type: Number,
- observer: 'onCloudPrintStateChanged_',
+ /** @type {cloudprint.CloudPrintInterface} */
+ cloudPrintInterface: {
+ type: Object,
+ observer: 'onCloudPrintInterfaceSet_',
},
- /** @type {!print_preview.Destination} */
+ dark: Boolean,
+
+ /** @type {?print_preview.Destination} */
destination: {
type: Object,
- observer: 'onDestinationSet_',
+ notify: true,
+ value: null,
},
- /** @type {?print_preview.DestinationStore} */
- destinationStore: {
- type: Object,
- observer: 'onDestinationStoreSet_',
+ /** @private {!print_preview.DestinationState} */
+ destinationState: {
+ type: Number,
+ notify: true,
+ value: print_preview.DestinationState.INIT,
+ observer: 'updateDestinationSelect_',
},
disabled: Boolean,
- /** @type {?print_preview.InvitationStore} */
- invitationStore: Object,
-
- noDestinationsFound: {
- type: Boolean,
- value: false,
+ /** @type {!print_preview_new.Error} */
+ error: {
+ type: Number,
+ notify: true,
},
- /** @type {!Array<!print_preview.RecentDestination>} */
- recentDestinations: Array,
-
/** @type {!print_preview_new.State} */
state: Number,
- /** @type {!Array<string>} */
- users: Array,
+ /** @private {string} */
+ activeUser_: {
+ type: String,
+ observer: 'onActiveUserChanged_',
+ },
+
+ /** @private {!print_preview.CloudPrintState} */
+ cloudPrintState_: {
+ type: Number,
+ value: print_preview.CloudPrintState.DISABLED,
+ },
+
+ /** @private {?print_preview.DestinationStore} */
+ destinationStore_: {
+ type: Object,
+ value: null,
+ },
+
+ // <if expr="chromeos">
+ hasPinSetting_: {
+ type: Boolean,
+ computed: 'computeHasPinSetting_(settings.pin.available)',
+ reflectToAttribute: true,
+ },
+ // </if>
+
+ /** @private {?print_preview.InvitationStore} */
+ invitationStore_: {
+ type: Object,
+ value: null,
+ },
+
+ /** @private {boolean} */
+ noDestinations_: {
+ type: Boolean,
+ value: false,
+ },
/** @private {!Array<!print_preview.Destination>} */
recentDestinationList_: Array,
@@ -55,8 +109,7 @@ Polymer({
/** @private */
shouldHideSpinner_: {
type: Boolean,
- computed: 'computeShouldHideSpinner_(' +
- 'destination, noDestinationsFound, cloudPrintState)',
+ computed: 'computeShouldHideSpinner_(destinationState, destination)',
},
/** @private {string} */
@@ -64,127 +117,280 @@ Polymer({
type: String,
computed: 'computeStatusText_(destination)',
},
- },
- observers: [
- 'updateRecentDestinationList_(' +
- 'recentDestinations.*, activeUser, destinationStore)',
- 'updateDestinationSelect_(' +
- 'destination, noDestinationsFound, cloudPrintState)',
- ],
+ /** @private {!Array<string>} */
+ users_: Array,
+ },
/** @private {!EventTracker} */
tracker_: new EventTracker(),
- /** @private */
- onDestinationStoreSet_: function() {
- if (!this.destinationStore) {
- return;
- }
-
+ /** @override */
+ attached: function() {
+ this.destinationStore_ =
+ new print_preview.DestinationStore(this.addWebUIListener.bind(this));
+ this.invitationStore_ = new print_preview.InvitationStore();
+ this.tracker_.add(
+ this.destinationStore_,
+ print_preview.DestinationStore.EventType.DESTINATION_SELECT,
+ this.onDestinationSelect_.bind(this));
+ this.tracker_.add(
+ this.destinationStore_,
+ print_preview.DestinationStore.EventType
+ .SELECTED_DESTINATION_CAPABILITIES_READY,
+ this.onDestinationCapabilitiesReady_.bind(this));
+ this.tracker_.add(
+ this.destinationStore_, print_preview.DestinationStore.EventType.ERROR,
+ this.onDestinationError_.bind(this));
// Need to update the recent list when the destination store inserts
// destinations, in case any recent destinations have been added to the
// store. At startup, recent destinations can be in the sticky settings,
// but they should not be displayed in the dropdown until they have been
// fetched by the DestinationStore, to ensure that they still exist.
this.tracker_.add(
- assert(this.destinationStore),
+ assert(this.destinationStore_),
print_preview.DestinationStore.EventType.DESTINATIONS_INSERTED,
- this.updateRecentDestinationList_.bind(this));
+ this.updateDropdownDestinations_.bind(this));
},
- /**
- * @param {!print_preview.RecentDestination} destination
- * @return {boolean} Whether the destination is Save as PDF or Save to Drive.
- */
- destinationIsDriveOrPdf_: function(destination) {
- return destination.id ===
- print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ||
- destination.id === print_preview.Destination.GooglePromotedId.DOCS;
+ /** @override */
+ detached: function() {
+ this.invitationStore_.resetTracker();
+ this.destinationStore_.resetTracker();
+ this.tracker_.removeAll();
},
/** @private */
- updateRecentDestinationList_: function() {
- if (!this.recentDestinations || !this.destinationStore) {
- return;
- }
-
- const recentDestinations = [];
- let update = false;
- const existingKeys = this.recentDestinationList_ ?
- this.recentDestinationList_.map(listItem => listItem.key) :
- [];
- this.recentDestinations.forEach(recentDestination => {
- const key = print_preview.createRecentDestinationKey(recentDestination);
- const destination = this.destinationStore.getDestinationByKey(key);
- if (destination && !this.destinationIsDriveOrPdf_(recentDestination) &&
- (!destination.account || destination.account == this.activeUser)) {
- recentDestinations.push(destination);
- update = update || !existingKeys.includes(key);
- }
+ onCloudPrintInterfaceSet_: function() {
+ const cloudPrintInterface = assert(this.cloudPrintInterface);
+ [cloudprint.CloudPrintInterfaceEventType.SEARCH_FAILED,
+ cloudprint.CloudPrintInterfaceEventType.PRINTER_FAILED,
+ ].forEach(eventType => {
+ this.tracker_.add(
+ cloudPrintInterface.getEventTarget(), eventType,
+ this.checkCloudPrintStatus_.bind(this));
});
-
- // Only update the list if new destinations have been added to it.
- // Re-ordering the dropdown items every time the selected item changes is
- // a bad experience for keyboard users.
- if (update) {
- this.recentDestinationList_ = recentDestinations;
- }
+ this.$.userInfo.setCloudPrintInterface(cloudPrintInterface);
+ this.destinationStore_.setCloudPrintInterface(cloudPrintInterface);
+ this.invitationStore_.setCloudPrintInterface(cloudPrintInterface);
+ assert(this.cloudPrintState_ === print_preview.CloudPrintState.DISABLED);
+ this.cloudPrintState_ = print_preview.CloudPrintState.ENABLED;
},
/**
- * @return {boolean} Whether the destinations dropdown should be disabled.
- * @private
+ * @param {string} defaultPrinter The system default printer ID.
+ * @param {string} serializedDefaultDestinationRulesStr String with rules for
+ * selecting a default destination.
*/
- shouldDisableDropdown_: function() {
- return !this.destinationStore || this.noDestinationsFound ||
- !this.shouldHideSpinner_ ||
- (this.disabled && this.state != print_preview_new.State.NOT_READY &&
- this.state != print_preview_new.State.INVALID_PRINTER);
+ initDestinationStore: function(
+ defaultPrinter, serializedDefaultDestinationRulesStr) {
+ this.destinationStore_.init(
+ this.appKioskMode, defaultPrinter, serializedDefaultDestinationRulesStr,
+ /** @type {!Array<print_preview.RecentDestination>} */
+ (this.getSettingValue('recentDestinations')));
},
/** @private */
- onCloudPrintStateChanged_: function() {
- if (this.cloudPrintState !== print_preview.CloudPrintState.SIGNED_IN) {
+ onActiveUserChanged_: function() {
+ if (!this.activeUser_) {
return;
}
+ assert(this.cloudPrintState_ !== print_preview.CloudPrintState.DISABLED);
+ this.cloudPrintState_ = print_preview.CloudPrintState.SIGNED_IN;
+
// Load docs, in case the user was not signed in previously and signed in
// from the destinations dialog.
- this.destinationStore.startLoadCookieDestination(
+ this.destinationStore_.startLoadCookieDestination(
print_preview.Destination.GooglePromotedId.DOCS);
// Load any recent cloud destinations for the dropdown.
- this.recentDestinations.forEach(destination => {
+ const recentDestinations = this.getSettingValue('recentDestinations');
+ recentDestinations.forEach(destination => {
if (destination.origin === print_preview.DestinationOrigin.COOKIES &&
- (destination.account === this.activeUser ||
+ (destination.account === this.activeUser_ ||
destination.account === '')) {
- this.destinationStore.startLoadCookieDestination(destination.id);
+ this.destinationStore_.startLoadCookieDestination(destination.id);
}
});
+
+ if (this.destinationState === print_preview.DestinationState.SELECTED &&
+ this.destination.origin === print_preview.DestinationOrigin.COOKIES) {
+ // Adjust states if the destination is now ready to be printed to.
+ this.destinationState = this.destination.capabilities ?
+ print_preview.DestinationState.UPDATED :
+ print_preview.DestinationState.SET;
+ }
+ this.updateDropdownDestinations_();
},
/** @private */
- onDestinationSet_: function() {
- if (this.cloudPrintState === print_preview.CloudPrintState.ENABLED) {
+ onDestinationSelect_: function() {
+ if (this.state === print_preview_new.State.FATAL_ERROR) {
+ // Don't let anything reset if there is a fatal error.
+ return;
+ }
+ const destination = this.destinationStore_.selectedDestination;
+ if (this.cloudPrintState_ === print_preview.CloudPrintState.SIGNED_IN ||
+ destination.origin !== print_preview.DestinationOrigin.COOKIES) {
+ this.destinationState = print_preview.DestinationState.SET;
+ } else {
+ this.destinationState = print_preview.DestinationState.SELECTED;
+ }
+ // Notify observers that the destination is set only after updating the
+ // destinationState.
+ this.destination = destination;
+ this.updateRecentDestinations_();
+ if (this.cloudPrintState_ === print_preview.CloudPrintState.ENABLED) {
// Only try to load the docs destination for now. If this request
// succeeds, it will trigger a transition to SIGNED_IN, and we can
// load the remaining destinations. Otherwise, it will transition to
// NOT_SIGNED_IN, so we will not do this more than once.
- this.destinationStore.startLoadCookieDestination(
+ this.destinationStore_.startLoadCookieDestination(
print_preview.Destination.GooglePromotedId.DOCS);
}
},
/** @private */
- computeShouldHideSpinner_: function() {
- if (this.noDestinationsFound) {
- return true;
+ onDestinationCapabilitiesReady_: function() {
+ this.notifyPath('destination.capabilities');
+ if (this.destinationState === print_preview.DestinationState.SET) {
+ this.destinationState = print_preview.DestinationState.UPDATED;
}
+ this.updateRecentDestinations_();
+ },
+
+ /**
+ * @param {!CustomEvent<!print_preview.DestinationErrorType>} e
+ * @private
+ */
+ onDestinationError_: function(e) {
+ let errorType = print_preview_new.Error.NONE;
+ switch (e.detail) {
+ case print_preview.DestinationErrorType.INVALID:
+ errorType = print_preview_new.Error.INVALID_PRINTER;
+ break;
+ case print_preview.DestinationErrorType.UNSUPPORTED:
+ errorType = print_preview_new.Error.UNSUPPORTED_PRINTER;
+ break;
+ // <if expr="chromeos">
+ case print_preview.DestinationErrorType.NO_DESTINATIONS:
+ errorType = print_preview_new.Error.NO_DESTINATIONS;
+ this.noDestinations_ = true;
+ break;
+ // </if>
+ default:
+ break;
+ }
+ this.error = errorType;
+ this.destinationState = print_preview.DestinationState.ERROR;
+ },
+
+ /**
+ * Updates the cloud print status to NOT_SIGNED_IN if there is an
+ * authentication error.
+ * @param {!CustomEvent<!cloudprint.CloudPrintInterfaceErrorEventDetail>}
+ * event Contains the error status
+ * @private
+ */
+ checkCloudPrintStatus_: function(event) {
+ if (event.detail.status != 403 || this.appKioskMode) {
+ return;
+ }
+
+ // Should not have sent a message to Cloud Print if cloud print is
+ // disabled.
+ assert(this.cloudPrintState_ !== print_preview.CloudPrintState.DISABLED);
+ this.cloudPrintState_ = print_preview.CloudPrintState.NOT_SIGNED_IN;
+ console.warn('Google Cloud Print Error: HTTP status 403');
+ },
+
+ /**
+ * @param {!print_preview.RecentDestination} destination
+ * @return {boolean} Whether the destination is Save as PDF or Save to Drive.
+ */
+ destinationIsDriveOrPdf_: function(destination) {
+ return destination.id ===
+ print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ||
+ destination.id === print_preview.Destination.GooglePromotedId.DOCS;
+ },
+
+ /** @private */
+ updateRecentDestinations_: function() {
+ if (!this.destination) {
+ return;
+ }
+
+ // Determine if this destination is already in the recent destinations,
+ // and where in the array it is located.
+ const newDestination =
+ print_preview.makeRecentDestination(assert(this.destination));
+ const recentDestinations = this.getSettingValue('recentDestinations');
+ let indexFound = recentDestinations.findIndex(function(recent) {
+ return (
+ newDestination.id == recent.id &&
+ newDestination.origin == recent.origin);
+ });
+
+ // No change
+ if (indexFound == 0 &&
+ recentDestinations[0].capabilities == newDestination.capabilities) {
+ return;
+ }
+ const isNew = indexFound == -1;
+
+ // Shift the array so that the nth most recent destination is located at
+ // index n.
+ if (isNew && recentDestinations.length == NUM_PERSISTED_DESTINATIONS) {
+ indexFound = NUM_PERSISTED_DESTINATIONS - 1;
+ }
+ if (indexFound != -1) {
+ this.setSettingSplice('recentDestinations', indexFound, 1, null);
+ }
+
+ // Add the most recent destination
+ this.setSettingSplice('recentDestinations', 0, 0, newDestination);
+ if (!this.destinationIsDriveOrPdf_(newDestination) && isNew) {
+ this.updateDropdownDestinations_();
+ }
+ },
+
+ /** @private */
+ updateDropdownDestinations_: function() {
+ const recentDestinations = this.getSettingValue('recentDestinations');
+
+ const dropdownDestinations = [];
+ recentDestinations.forEach(recentDestination => {
+ const key = print_preview.createRecentDestinationKey(recentDestination);
+ const destination = this.destinationStore_.getDestinationByKey(key);
+ if (destination && !this.destinationIsDriveOrPdf_(recentDestination) &&
+ (!destination.account || destination.account == this.activeUser_)) {
+ dropdownDestinations.push(destination);
+ }
+ });
+
+ this.recentDestinationList_ = dropdownDestinations;
+ },
+
+ /**
+ * @return {boolean} Whether the destinations dropdown should be disabled.
+ * @private
+ */
+ shouldDisableDropdown_: function() {
+ return this.state === print_preview_new.State.FATAL_ERROR ||
+ (this.destinationState === print_preview.DestinationState.UPDATED &&
+ this.disabled && this.state !== print_preview_new.State.NOT_READY);
+ },
- return !!this.destination &&
- (this.destination.origin !== print_preview.DestinationOrigin.COOKIES ||
- this.cloudPrintState === print_preview.CloudPrintState.SIGNED_IN);
+ /** @private */
+ computeShouldHideSpinner_: function() {
+ return this.destinationState === print_preview.DestinationState.ERROR ||
+ this.destinationState === print_preview.DestinationState.UPDATED ||
+ (this.destinationState === print_preview.DestinationState.SET &&
+ !!this.destination &&
+ (!!this.destination.capabilities ||
+ this.destination.id ===
+ print_preview.Destination.GooglePromotedId.SAVE_AS_PDF));
},
/**
@@ -202,6 +408,16 @@ Polymer({
this.destination.connectionStatusText;
},
+ // <if expr="chromeos">
+ /**
+ * @return {boolean}
+ * @private
+ */
+ computeHasPinSetting_: function() {
+ return this.getSetting('pin').available;
+ },
+ // </if>
+
/**
* @param {!CustomEvent<string>} e Event containing the new selected value.
* @private
@@ -209,16 +425,25 @@ Polymer({
onSelectedDestinationOptionChange_: function(e) {
const value = e.detail;
if (value === 'seeMore') {
- this.destinationStore.startLoadAllDestinations();
- if (this.activeUser) {
- this.invitationStore.startLoadingInvitations(this.activeUser);
+ this.destinationStore_.startLoadAllDestinations();
+ if (this.activeUser_) {
+ this.invitationStore_.startLoadingInvitations(this.activeUser_);
}
this.$.destinationDialog.get().show();
} else {
- this.destinationStore.selectDestinationByKey(value);
+ this.destinationStore_.selectDestinationByKey(value);
}
},
+ /**
+ * @param {!CustomEvent<string>} e Event containing the new active user
+ * account.
+ * @private
+ */
+ onAccountChange_: function(e) {
+ this.$.userInfo.updateActiveUser(e.detail);
+ },
+
/** @private */
onDialogClose_: function() {
// Reset the select value if the user dismissed the dialog without
@@ -229,10 +454,15 @@ Polymer({
/** @private */
updateDestinationSelect_: function() {
- if (!this.destination ||
- (this.destination.origin === print_preview.DestinationOrigin.COOKIES &&
- this.cloudPrintState !== print_preview.CloudPrintState.SIGNED_IN) ||
- this.noDestinationsFound) {
+ // <if expr="chromeos">
+ if (this.destinationState === print_preview.DestinationState.ERROR &&
+ !this.destination) {
+ return;
+ }
+ // </if>
+
+ if (this.destinationState === print_preview.DestinationState.INIT ||
+ this.destinationState === print_preview.DestinationState.SELECTED) {
return;
}
@@ -249,3 +479,4 @@ Polymer({
}
},
});
+})();
diff --git a/chromium/chrome/browser/resources/print_preview/new/dpi_settings.js b/chromium/chrome/browser/resources/print_preview/new/dpi_settings.js
index b30efe43d79..bad76a8f39d 100644
--- a/chromium/chrome/browser/resources/print_preview/new/dpi_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/new/dpi_settings.js
@@ -40,7 +40,7 @@ Polymer({
},
observers: [
- 'onDpiSettingChange_(settings.dpi.value, capabilityWithLabels_.option)',
+ 'onDpiSettingChange_(settings.dpi.*, capabilityWithLabels_.option)',
],
/**
@@ -72,18 +72,15 @@ Polymer({
return result;
},
- /**
- * @param {!print_preview_new.SelectOption} value The new value of the dpi
- * setting.
- * @private
- */
- onDpiSettingChange_: function(value) {
+ /** @private */
+ onDpiSettingChange_: function() {
if (this.capabilityWithLabels_ === null ||
this.capabilityWithLabels_ === undefined) {
return;
}
- const dpiValue = /** @type {print_preview_new.DpiOption} */ (value);
+ const dpiValue = /** @type {print_preview_new.DpiOption} */ (
+ this.getSettingValue('dpi'));
for (const option of assert(this.capabilityWithLabels_.option)) {
const dpiOption =
/** @type {print_preview_new.LabelledDpiOption} */ (option);
diff --git a/chromium/chrome/browser/resources/print_preview/new/duplex_settings.html b/chromium/chrome/browser/resources/print_preview/new/duplex_settings.html
new file mode 100644
index 00000000000..834247c015d
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/duplex_settings.html
@@ -0,0 +1,71 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html">
+<link rel="import" href="chrome://resources/html/md_select_css.html">
+<link rel="import" href="chrome://resources/html/util.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-meta/iron-meta.html">
+<link rel="import" href="../icons.html">
+<link rel="import" href="../print_preview_utils.html">
+<link rel="import" href="print_preview_shared_css.html">
+<link rel="import" href="select_behavior.html">
+<link rel="import" href="settings_behavior.html">
+<link rel="import" href="settings_section.html">
+
+<dom-module id="print-preview-duplex-settings">
+ <template>
+ <style include="print-preview-shared cr-hidden-style md-select">
+ :host {
+ --duplex-icon-side-padding: 8px;
+ --duplex-icon-size: 16px;
+ }
+
+ .md-select {
+ background-position: var(--duplex-icon-side-padding) center,
+ calc(100% - var(--md-select-side-padding)) center;
+ background-size: var(--duplex-icon-size), var(--md-arrow-width);
+ padding-inline-start: 32px;
+ }
+
+ :host-context([dir=rtl]) .md-select {
+ background-position-x: calc(100% - var(--duplex-icon-side-padding)),
+ var(--md-select-side-padding);
+ }
+ </style>
+ <print-preview-settings-section hidden$="[[!settings.duplex.available]]">
+ <div slot="title">
+ <label id="label">$i18n{optionTwoSided}</label>
+ </div>
+ <div slot="controls" class="checkbox">
+ <cr-checkbox id="duplex" aria-labelledby="label"
+ disabled$="[[getDisabled_(settings.duplex.setByPolicy, disabled)]]"
+ on-change="onCheckboxChange_">
+ $i18n{printOnBothSidesLabel}
+ </cr-checkbox>
+ </div>
+ </print-preview-settings-section>
+ <iron-collapse opened="[[getOpenCollapse_(
+ settings.duplex.*, settings.duplexShortEdge.available)]]">
+ <print-preview-settings-section>
+ <div slot="title"></div>
+ <div slot="controls">
+ <select class="md-select" aria-labelledby="duplex"
+ style="background-image: [[getBackgroundImages_(
+ settings.duplexShortEdge.value, dark)]];"
+ disabled$="[[getDisabled_(
+ settings.duplexShortEdge.setByPolicy, disabled)]]"
+ value="{{selectedValue::change}}">
+ <option value="[[duplexValueEnum_.LONG_EDGE]]">
+ $i18n{optionLongEdge}
+ </option>
+ <option value="[[duplexValueEnum_.SHORT_EDGE]]">
+ $i18n{optionShortEdge}
+ </option>
+ </select>
+ </div>
+ </print-preview-settings-section>
+ </iron-collapse>
+ </template>
+ <script src="duplex_settings.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/print_preview/new/duplex_settings.js b/chromium/chrome/browser/resources/print_preview/new/duplex_settings.js
new file mode 100644
index 00000000000..0b414c5807e
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/duplex_settings.js
@@ -0,0 +1,88 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer({
+ is: 'print-preview-duplex-settings',
+
+ behaviors: [SettingsBehavior, print_preview_new.SelectBehavior],
+
+ properties: {
+ dark: Boolean,
+
+ disabled: Boolean,
+
+ /**
+ * Mirroring the enum so that it can be used from HTML bindings.
+ * @private
+ */
+ duplexValueEnum_: {
+ type: Object,
+ value: print_preview_new.DuplexMode,
+ },
+ },
+
+ observers: [
+ 'onDuplexSettingChange_(settings.duplex.*)',
+ 'onDuplexTypeChange_(settings.duplexShortEdge.*)',
+ ],
+
+ /** @private {!IronMetaElement} */
+ meta_: /** @type {!IronMetaElement} */ (
+ Polymer.Base.create('iron-meta', {type: 'iconset'})),
+
+ /** @private */
+ onDuplexSettingChange_: function() {
+ this.$.duplex.checked = this.getSettingValue('duplex');
+ },
+
+ /** @private */
+ onDuplexTypeChange_: function() {
+ this.selectedValue = this.getSettingValue('duplexShortEdge') ?
+ this.duplexValueEnum_.SHORT_EDGE.toString() :
+ this.duplexValueEnum_.LONG_EDGE.toString();
+ },
+
+ /** @private */
+ onCheckboxChange_: function() {
+ this.setSetting('duplex', this.$.duplex.checked);
+ },
+
+ onProcessSelectChange: function(value) {
+ this.setSetting(
+ 'duplexShortEdge',
+ value === this.duplexValueEnum_.SHORT_EDGE.toString());
+ },
+
+ /**
+ * @return {boolean} Whether to expand the collapse for the dropdown.
+ * @private
+ */
+ getOpenCollapse_: function() {
+ return this.getSetting('duplexShortEdge').available &&
+ /** @type {boolean} */ (this.getSettingValue('duplex'));
+ },
+
+ /**
+ * @param {boolean} managed Whether the setting is managed by policy.
+ * @param {boolean} disabled value of this.disabled
+ * @return {boolean} Whether the controls should be disabled.
+ * @private
+ */
+ getDisabled_: function(managed, disabled) {
+ return managed || disabled;
+ },
+
+ /**
+ * @return {string} An inline svg corresponding to |icon| and the image for
+ * the dropdown arrow.
+ * @private
+ */
+ getBackgroundImages_: function() {
+ const icon =
+ this.getSettingValue('duplexShortEdge') ? 'short-edge' : 'long-edge';
+ const iconset = /** @type {!Polymer.IronIconsetSvg} */ (
+ this.meta_.byKey('print-preview'));
+ return getSelectDropdownBackground(iconset, icon, this);
+ },
+});
diff --git a/chromium/chrome/browser/resources/print_preview/new/header.html b/chromium/chrome/browser/resources/print_preview/new/header.html
index a522c689c1b..fd39d3430a8 100644
--- a/chromium/chrome/browser/resources/print_preview/new/header.html
+++ b/chromium/chrome/browser/resources/print_preview/new/header.html
@@ -2,7 +2,6 @@
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
@@ -17,7 +16,6 @@
<template>
<style include="print-preview-shared paper-button-style">
:host {
- background-color: white;
border-bottom: var(--print-preview-settings-border);
display: block;
padding-bottom: 8px;
@@ -26,13 +24,17 @@
padding-top: 20px;
}
+ :host-context(html:not([dark])) {
+ background-color: white;
+ }
+
.title-container {
display: flex;
padding-bottom: 12px;
}
.title {
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
font-size: calc(16/13 * 1em);
font-weight: 400;
line-height: 1.54em;
@@ -40,6 +42,7 @@
}
.summary {
+ color: var(--cr-primary-text-color);
display: block;
height: 1em;
min-height: 20px;
@@ -66,7 +69,7 @@
iron-icon {
align-self: center;
- fill: var(--google-grey-refresh-700);
+ fill: var(--cr-secondary-text-color);
height: 16px;
margin-inline-start: 8px;
width: 16px;
diff --git a/chromium/chrome/browser/resources/print_preview/new/header.js b/chromium/chrome/browser/resources/print_preview/new/header.js
index 5cd7cb239a2..ab6681e4efc 100644
--- a/chromium/chrome/browser/resources/print_preview/new/header.js
+++ b/chromium/chrome/browser/resources/print_preview/new/header.js
@@ -18,9 +18,14 @@ Polymer({
behaviors: [SettingsBehavior],
properties: {
+ cloudPrintErrorMessage: String,
+
/** @type {!print_preview.Destination} */
destination: Object,
+ /** @type {!print_preview_new.Error} */
+ error: Number,
+
/** @type {!print_preview_new.State} */
state: Number,
@@ -43,18 +48,14 @@ Polymer({
/** @private {?string} */
summary_: {
type: String,
- notify: true,
value: null,
},
/** @private {?string} */
summaryLabel_: {
type: String,
- notify: true,
value: null,
},
-
- errorMessage: String,
},
observers: [
@@ -150,9 +151,9 @@ Polymer({
}
break;
case (print_preview_new.State.FATAL_ERROR):
+ this.summary_ = this.getErrorMessage_();
+ this.summaryLabel_ = this.getErrorMessage_();
this.printButtonEnabled_ = false;
- this.summary_ = this.errorMessage;
- this.summaryLabel_ = this.errorMessage;
break;
default:
this.summary_ = null;
@@ -164,6 +165,21 @@ Polymer({
},
/**
+ * @return {string} The error message to display.
+ * @private
+ */
+ getErrorMessage_: function() {
+ switch (this.error) {
+ case print_preview_new.Error.PRINT_FAILED:
+ return loadTimeData.getString('couldNotPrint');
+ case print_preview_new.Error.CLOUD_PRINT_ERROR:
+ return this.cloudPrintErrorMessage;
+ default:
+ return '';
+ }
+ },
+
+ /**
* @param {!print_preview_new.Header.LabelInfo} labelInfo
* @return {string}
* @private
diff --git a/chromium/chrome/browser/resources/print_preview/new/header_new.html b/chromium/chrome/browser/resources/print_preview/new/header_new.html
new file mode 100644
index 00000000000..ced55300ff5
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/header_new.html
@@ -0,0 +1,65 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="chrome://resources/html/cr.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
+<link rel="import" href="../data/destination.html">
+<link rel="import" href="../icons.html">
+<link rel="import" href="settings_behavior.html">
+<link rel="import" href="print_preview_shared_css.html">
+<link rel="import" href="state.html">
+<link rel="import" href="strings.html">
+
+<dom-module id="print-preview-header-new">
+ <template>
+ <style include="print-preview-shared">
+ :host {
+ align-items: center;
+ display: flex;
+ justify-content: space-between;
+ padding: 20px 16px 12px;
+ }
+
+ :host-context(html:not([dark])) {
+ background-color: white;
+ }
+
+ #headerContainer {
+ align-items: center;
+ display: flex;
+ }
+
+ .summary,
+ .title {
+ color: var(--cr-primary-text-color);
+ line-height: calc(20/13 * 1em);
+ margin: 0;
+ }
+
+ .title {
+ font-size: calc(16/13 * 1em);
+ font-weight: 400;
+ }
+
+ .summary {
+ font-weight: 500;
+ }
+
+ iron-icon {
+ align-self: center;
+ fill: var(--cr-secondary-text-color);
+ height: 16px;
+ margin-inline-start: 8px;
+ width: 16px;
+ }
+ </style>
+ <div id="headerContainer">
+ <h1 class="title">$i18n{title}</h1>
+ <iron-icon hidden$="[[!managed]]" icon="print-preview:business"
+ alt="" title="$i18n{managedSettings}">
+ </iron-icon>
+ </div>
+ <span class="summary" aria-label$="[[summaryLabel_]]">[[summary_]]</span>
+ </template>
+ <script src="header_new.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/print_preview/new/header_new.js b/chromium/chrome/browser/resources/print_preview/new/header_new.js
new file mode 100644
index 00000000000..9b9926b4a99
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/header_new.js
@@ -0,0 +1,159 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.exportPath('print_preview.HeaderNew');
+
+/**
+ * @typedef {{numPages: number,
+ * numSheets: number,
+ * pagesLabel: string,
+ * summaryLabel: string}}
+ */
+print_preview.HeaderNew.LabelInfo;
+
+Polymer({
+ is: 'print-preview-header-new',
+
+ behaviors: [SettingsBehavior],
+
+ properties: {
+ cloudPrintErrorMessage: String,
+
+ /** @type {!print_preview.Destination} */
+ destination: Object,
+
+ /** @type {!print_preview_new.Error} */
+ error: Number,
+
+ /** @type {!print_preview_new.State} */
+ state: Number,
+
+ managed: Boolean,
+
+ /** @private {?string} */
+ summary_: {
+ type: String,
+ value: null,
+ },
+
+ /** @private {?string} */
+ summaryLabel_: {
+ type: String,
+ value: null,
+ },
+ },
+
+ observers: [
+ 'update_(settings.copies.value, settings.duplex.value, ' +
+ 'settings.pages.value, state, destination.id)',
+ ],
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ isPdfOrDrive_: function() {
+ return this.destination &&
+ (this.destination.id ==
+ print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ||
+ this.destination.id ==
+ print_preview.Destination.GooglePromotedId.DOCS);
+ },
+
+ /**
+ * @return {!print_preview.HeaderNew.LabelInfo}
+ * @private
+ */
+ computeLabelInfo_: function() {
+ const saveToPdfOrDrive = this.isPdfOrDrive_();
+ let numPages = this.getSettingValue('pages').length;
+ let numSheets = numPages;
+ if (!saveToPdfOrDrive && this.getSettingValue('duplex')) {
+ numSheets = Math.ceil(numPages / 2);
+ }
+
+ const copies = parseInt(this.getSettingValue('copies'), 10);
+ numSheets *= copies;
+ numPages *= copies;
+
+ const pagesLabel = loadTimeData.getString('printPreviewPageLabelPlural');
+ let summaryLabel;
+ if (numSheets > 1) {
+ summaryLabel = saveToPdfOrDrive ?
+ pagesLabel :
+ loadTimeData.getString('printPreviewSheetsLabelPlural');
+ } else {
+ summaryLabel = loadTimeData.getString(
+ saveToPdfOrDrive ? 'printPreviewPageLabelSingular' :
+ 'printPreviewSheetsLabelSingular');
+ }
+ return {
+ numPages: numPages,
+ numSheets: numSheets,
+ pagesLabel: pagesLabel,
+ summaryLabel: summaryLabel
+ };
+ },
+
+ /** @private */
+ update_: function() {
+ switch (this.state) {
+ case (print_preview_new.State.PRINTING):
+ this.summary_ = loadTimeData.getString(
+ this.isPdfOrDrive_() ? 'saving' : 'printing');
+ this.summaryLabel_ = this.summary_;
+ break;
+ case (print_preview_new.State.READY):
+ const labelInfo = this.computeLabelInfo_();
+ this.summary_ = this.getSummary_(labelInfo);
+ this.summaryLabel_ = this.getSummaryLabel_(labelInfo);
+ break;
+ case (print_preview_new.State.FATAL_ERROR):
+ this.summary_ = this.getErrorMessage_();
+ this.summaryLabel_ = this.getErrorMessage_();
+ break;
+ default:
+ this.summary_ = null;
+ this.summaryLabel_ = null;
+ break;
+ }
+ },
+
+ /**
+ * @return {string} The error message to display.
+ * @private
+ */
+ getErrorMessage_: function() {
+ switch (this.error) {
+ case print_preview_new.Error.PRINT_FAILED:
+ return loadTimeData.getString('couldNotPrint');
+ case print_preview_new.Error.CLOUD_PRINT_ERROR:
+ return this.cloudPrintErrorMessage;
+ default:
+ return '';
+ }
+ },
+
+ /**
+ * @param {!print_preview.HeaderNew.LabelInfo} labelInfo
+ * @return {string}
+ * @private
+ */
+ getSummary_: function(labelInfo) {
+ return loadTimeData.getStringF(
+ 'printPreviewNewSummaryFormatShort',
+ labelInfo.numSheets.toLocaleString(), labelInfo.summaryLabel);
+ },
+
+ /**
+ * @param {!print_preview.HeaderNew.LabelInfo} labelInfo
+ * @return {string}
+ * @private
+ */
+ getSummaryLabel_: function(labelInfo) {
+ return loadTimeData.getStringF(
+ 'printPreviewNewSummaryFormatShort',
+ labelInfo.numSheets.toLocaleString(), labelInfo.summaryLabel);
+ },
+});
diff --git a/chromium/chrome/browser/resources/print_preview/new/link_container.html b/chromium/chrome/browser/resources/print_preview/new/link_container.html
index 98f90728d6f..9796298ca2a 100644
--- a/chromium/chrome/browser/resources/print_preview/new/link_container.html
+++ b/chromium/chrome/browser/resources/print_preview/new/link_container.html
@@ -1,5 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="../data/destination.html">
@@ -9,13 +10,21 @@
<dom-module id="print-preview-link-container">
<template>
<style include="print-preview-shared throbber cr-hidden-style">
- :host paper-icon-button-light {
- --cr-paper-icon-button-margin: {
- margin-inline-end: -2px;
- margin-inline-start: 0;
- };
- --cr-icon-size: 16px;
- --cr-icon-ripple-size: 28px;
+ :host {
+ display: block;
+ }
+
+ <if expr="not is_macosx">
+ :host(:not([should-show-system-dialog-link_])) {
+ display: none;
+ }
+ </if>
+
+ :host cr-icon-button {
+ --cr-icon-button-icon-size: 16px;
+ --cr-icon-button-margin-end: -2px;
+ --cr-icon-button-margin-start: 0;
+ --cr-icon-button-size: 28px;
}
.link:not([actionable]) {
@@ -36,7 +45,6 @@
}
#systemDialogLink {
- border-top: var(--print-preview-settings-border);
padding-top: 0.5em;
}
@@ -45,8 +53,7 @@
}
.link:not([actionable]) .label {
- color: var(--paper-grey-600);
- opacity: .65;
+ @apply --print-preview-disabled-label;
}
</style>
<div class="link" id="systemDialogLink"
@@ -54,12 +61,10 @@
hidden$="[[!shouldShowSystemDialogLink_]]"
on-click="onSystemDialogClick_">
<div class="label">$i18n{systemDialogOption}</div>
- <paper-icon-button-light actionable class="icon-external"
- hidden$="[[openingSystemDialog_]]">
- <button disabled="[[systemDialogLinkDisabled_]]"
- aria-label="$i18n{systemDialogOption}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button actionable class="icon-external"
+ hidden$="[[openingSystemDialog_]]"
+ disabled="[[systemDialogLinkDisabled_]]"
+ aria-label="$i18n{systemDialogOption}"></cr-icon-button>
<div id="systemDialogThrobber" hidden$="[[!openingSystemDialog_]]"
class="throbber"></div>
</div>
@@ -67,12 +72,9 @@
<div class="link" id="openPdfInPreviewLink" actionable$="[[!disabled]]"
on-click="onOpenInPreviewClick_">
<div class="label">$i18n{openPdfInPreviewOption}</div>
- <paper-icon-button-light actionable class="icon-external"
- hidden$="[[openingInPreview_]]">
- <button disabled="[[disabled]]"
- aria-label="$i18n{openPdfInPreviewOption}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button actionable class="icon-external"
+ hidden$="[[openingInPreview_]]" disabled="[[disabled]]"
+ aria-label="$i18n{openPdfInPreviewOption}"></cr-icon-button>
<div id="openPdfInPreviewThrobber" hidden$="[[!openingInPreview_]]"
class="throbber"></div>
</div>
diff --git a/chromium/chrome/browser/resources/print_preview/new/link_container.js b/chromium/chrome/browser/resources/print_preview/new/link_container.js
index df9c7145ff8..eb34c230d5a 100644
--- a/chromium/chrome/browser/resources/print_preview/new/link_container.js
+++ b/chromium/chrome/browser/resources/print_preview/new/link_container.js
@@ -17,6 +17,7 @@ Polymer({
shouldShowSystemDialogLink_: {
type: Boolean,
computed: 'computeShouldShowSystemDialogLink_(appKioskMode, destination)',
+ reflectToAttribute: true,
},
/** @private {boolean} */
diff --git a/chromium/chrome/browser/resources/print_preview/new/margin_control.html b/chromium/chrome/browser/resources/print_preview/new/margin_control.html
index bdb2d8bca2e..2eb9cfc5f7b 100644
--- a/chromium/chrome/browser/resources/print_preview/new/margin_control.html
+++ b/chromium/chrome/browser/resources/print_preview/new/margin_control.html
@@ -42,6 +42,10 @@
border: 1px dashed var(--google-blue-500);
}
+ :host-context([dark]) #line {
+ border-color: var(--google-blue-refresh-300);
+ }
+
:host([side=top]) #line,
:host([side=bottom]) #line {
width: 100%;
@@ -53,14 +57,11 @@
}
#textbox {
- --cr-input-background-color: var(--google-grey-900);
- --cr-input-color: white;
--cr-input-error-display: none;
--cr-input-row-container: {
min-height: 25px;
}
box-sizing: border-box;
- color: white;
font-size: 0.8rem;
padding: 1px;
position: absolute;
@@ -68,6 +69,17 @@
width: 60px;
}
+ :host-context(html:not([dark])) #textbox {
+ --cr-input-background-color: var(--cr-primary-text-color);
+ --cr-input-color: white;
+ color: white;
+ }
+
+ :host-context([dark]) #textbox {
+ --cr-input-background-color: #1b1c1e; /* GG900 + 30% black */
+ --cr-input-color: var(--cr-primary-text-color);
+ }
+
:host([side=top]) #textbox {
left: 50%;
top: 8px;
diff --git a/chromium/chrome/browser/resources/print_preview/new/margin_control_container.js b/chromium/chrome/browser/resources/print_preview/new/margin_control_container.js
index 7cb7a10b1e6..4b2a1b14371 100644
--- a/chromium/chrome/browser/resources/print_preview/new/margin_control_container.js
+++ b/chromium/chrome/browser/resources/print_preview/new/margin_control_container.js
@@ -162,6 +162,11 @@ Polymer({
/** @private */
onMarginSettingsChange_: function() {
const margins = this.getSettingValue('customMargins');
+ if (margins.marginTop === undefined) {
+ // This may be called when print preview model initially sets the
+ // settings. It sets custom margins empty by default.
+ return;
+ }
this.shadowRoot.querySelectorAll('print-preview-margin-control')
.forEach(control => {
const key = print_preview_new.MARGIN_KEY_MAP.get(control.side);
diff --git a/chromium/chrome/browser/resources/print_preview/new/media_size_settings.js b/chromium/chrome/browser/resources/print_preview/new/media_size_settings.js
index d4ec0ffa246..d762f9961da 100644
--- a/chromium/chrome/browser/resources/print_preview/new/media_size_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/new/media_size_settings.js
@@ -14,19 +14,14 @@ Polymer({
},
observers:
- ['onMediaSizeSettingChange_(settings.mediaSize.value, ' +
- 'capability.option)'],
+ ['onMediaSizeSettingChange_(settings.mediaSize.*, capability.option)'],
- /**
- * @param {*} value The new value of the media size setting.
- * @private
- */
- onMediaSizeSettingChange_: function(value) {
+ /** @private */
+ onMediaSizeSettingChange_: function() {
if (!this.capability) {
return;
}
-
- const valueToSet = JSON.stringify(value);
+ const valueToSet = JSON.stringify(this.getSettingValue('mediaSize'));
for (const option of
/** @type {!Array<!print_preview_new.SelectOption>} */ (
this.capability.option)) {
diff --git a/chromium/chrome/browser/resources/print_preview/new/model.html b/chromium/chrome/browser/resources/print_preview/new/model.html
index 3e3ea6386f2..88c748aa369 100644
--- a/chromium/chrome/browser/resources/print_preview/new/model.html
+++ b/chromium/chrome/browser/resources/print_preview/new/model.html
@@ -1,7 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/cr.html">
-<link rel="import" href="settings_behavior.html">
+<link rel="import" href="chrome://resources/html/promise_resolver.html">
<link rel="import" href="../data/destination.html">
<link rel="import" href="../data/document_info.html">
<link rel="import" href="../data/margins.html">
diff --git a/chromium/chrome/browser/resources/print_preview/new/model.js b/chromium/chrome/browser/resources/print_preview/new/model.js
index c8d90bcc388..54accee0956 100644
--- a/chromium/chrome/browser/resources/print_preview/new/model.js
+++ b/chromium/chrome/browser/resources/print_preview/new/model.js
@@ -3,6 +3,7 @@
// found in the LICENSE file.
cr.exportPath('print_preview_new');
+
/**
* @typedef {{
* version: string,
@@ -25,7 +26,9 @@ cr.exportPath('print_preview_new');
* isFitToPageEnabled: (boolean | undefined),
* isCssBackgroundEnabled: (boolean | undefined),
* scaling: (string | undefined),
- * vendor_options: (Object | undefined)
+ * vendor_options: (Object | undefined),
+ * isPinEnabled: (boolean | undefined),
+ * pinValue: (string | undefined)
* }}
*/
print_preview_new.SerializedSettings;
@@ -52,7 +55,8 @@ print_preview_new.PolicySettings;
print_preview_new.DuplexMode = {
SIMPLEX: 0,
LONG_EDGE: 1,
- UNKNOWN_DUPLEX_MODE: -1
+ SHORT_EDGE: 2,
+ UNKNOWN_DUPLEX_MODE: -1,
};
/**
@@ -65,24 +69,42 @@ print_preview_new.DuplexType = {
SHORT_EDGE: 'SHORT_EDGE'
};
+cr.define('print_preview.Model', () => {
+ return {
+ /** @private {?PrintPreviewModelElement} */
+ instance_: null,
+
+ /** @private {!PromiseResolver} */
+ whenReady_: new PromiseResolver(),
+
+ /** @return {!PrintPreviewModelElement} */
+ getInstance: () => assert(print_preview.Model.instance_),
+
+ /** @return {!Promise} */
+ whenReady:
+ () => {
+ return print_preview.Model.whenReady_.promise;
+ },
+ };
+});
+
(function() {
'use strict';
-/** @type {number} Number of recent destinations to save. */
-const NUM_DESTINATIONS = 3;
-
/**
* Sticky setting names. Alphabetical except for fitToPage, which must be set
* after scaling in updateFromStickySettings().
* @type {!Array<string>}
*/
const STICKY_SETTING_NAMES = [
+ 'recentDestinations',
'collate',
'color',
'cssBackground',
'customMargins',
'dpi',
'duplex',
+ 'duplexShortEdge',
'headerFooter',
'layout',
'margins',
@@ -92,6 +114,9 @@ const STICKY_SETTING_NAMES = [
'fitToPage',
'vendorItems',
];
+// <if expr="chromeos">
+STICKY_SETTING_NAMES.push('pin', 'pinValue');
+// </if>
/**
* Minimum height of page in microns to allow headers and footers. Should
@@ -104,8 +129,6 @@ const MINIMUM_HEIGHT_MICRONS = 25400;
Polymer({
is: 'print-preview-model',
- behaviors: [SettingsBehavior],
-
properties: {
/**
* Object containing current settings of Print Preview, for use by Polymer
@@ -118,186 +141,6 @@ Polymer({
settings: {
type: Object,
notify: true,
- value: function() {
- return {
- pages: {
- value: [1],
- unavailableValue: [],
- valid: true,
- available: true,
- setByPolicy: false,
- key: '',
- },
- copies: {
- value: '1',
- unavailableValue: '1',
- valid: true,
- available: true,
- setByPolicy: false,
- key: '',
- },
- collate: {
- value: true,
- unavailableValue: false,
- valid: true,
- available: true,
- setByPolicy: false,
- key: 'isCollateEnabled',
- },
- layout: {
- value: false, /* portrait */
- unavailableValue: false,
- valid: true,
- available: true,
- setByPolicy: false,
- key: 'isLandscapeEnabled',
- },
- color: {
- value: true, /* color */
- unavailableValue: false,
- valid: true,
- available: false,
- setByPolicy: false,
- key: 'isColorEnabled',
- },
- mediaSize: {
- value: {},
- unavailableValue: {
- width_microns: 215900,
- height_microns: 279400,
- },
- valid: true,
- available: false,
- setByPolicy: false,
- key: 'mediaSize',
- },
- margins: {
- value: print_preview.ticket_items.MarginsTypeValue.DEFAULT,
- unavailableValue:
- print_preview.ticket_items.MarginsTypeValue.DEFAULT,
- valid: true,
- available: true,
- setByPolicy: false,
- key: 'marginsType',
- },
- customMargins: {
- value: {},
- unavailableValue: {},
- valid: true,
- available: true,
- setByPolicy: false,
- key: 'customMargins',
- },
- dpi: {
- value: {},
- unavailableValue: {},
- valid: true,
- available: false,
- setByPolicy: false,
- key: 'dpi',
- },
- fitToPage: {
- value: false,
- unavailableValue: false,
- valid: true,
- available: true,
- setByPolicy: false,
- key: 'isFitToPageEnabled',
- },
- scaling: {
- value: '100',
- unavailableValue: '100',
- valid: true,
- available: true,
- setByPolicy: false,
- key: 'scaling',
- },
- customScaling: {
- value: false,
- unavailableValue: false,
- valid: true,
- available: true,
- setByPolicy: false,
- key: 'customScaling',
- },
- duplex: {
- value: true,
- unavailableValue: false,
- valid: true,
- available: false,
- setByPolicy: false,
- key: 'isDuplexEnabled',
- },
- cssBackground: {
- value: false,
- unavailableValue: false,
- valid: true,
- available: true,
- setByPolicy: false,
- key: 'isCssBackgroundEnabled',
- },
- selectionOnly: {
- value: false,
- unavailableValue: false,
- valid: true,
- available: true,
- setByPolicy: false,
- key: '',
- },
- headerFooter: {
- value: true,
- unavailableValue: false,
- valid: true,
- available: true,
- setByPolicy: false,
- key: 'isHeaderFooterEnabled',
- },
- rasterize: {
- value: false,
- unavailableValue: false,
- valid: true,
- available: true,
- setByPolicy: false,
- key: '',
- },
- vendorItems: {
- value: {},
- unavailableValue: {},
- valid: true,
- available: false,
- setByPolicy: false,
- key: 'vendorOptions',
- },
- pagesPerSheet: {
- value: 1,
- unavailableValue: 1,
- valid: true,
- available: true,
- setByPolicy: false,
- key: '',
- },
- // This does not represent a real setting value, and is used only to
- // expose the availability of the other options settings section.
- otherOptions: {
- value: null,
- unavailableValue: null,
- valid: true,
- available: true,
- setByPolicy: false,
- key: '',
- },
- // This does not represent a real settings value, but is used to
- // propagate the correctly formatted ranges for print tickets.
- ranges: {
- value: [],
- unavailableValue: [],
- valid: true,
- available: true,
- setByPolicy: false,
- key: '',
- },
- };
- },
},
controlsManaged: {
@@ -307,10 +150,7 @@ Polymer({
},
/** @type {print_preview.Destination} */
- destination: {
- type: Object,
- notify: true,
- },
+ destination: Object,
/** @type {!print_preview.DocumentSettings} */
documentSettings: Object,
@@ -320,15 +160,6 @@ Polymer({
/** @type {!print_preview.Size} */
pageSize: Object,
-
- /** @type {!Array<!print_preview.RecentDestination>} */
- recentDestinations: {
- type: Array,
- notify: true,
- value: function() {
- return [];
- },
- },
},
observers: [
@@ -339,15 +170,6 @@ Polymer({
'updateHeaderFooterAvailable_(' +
'margins, settings.margins.value, ' +
'settings.customMargins.value, settings.mediaSize.value)',
- 'updateRecentDestinations_(destination, destination.capabilities)',
- 'stickySettingsChanged_(' +
- 'settings.collate.value, settings.layout.value, settings.color.value,' +
- 'settings.mediaSize.value, settings.margins.value, ' +
- 'settings.customMargins.value, settings.dpi.value, ' +
- 'settings.fitToPage.value, settings.customScaling.value, ' +
- 'settings.scaling.value, settings.duplex.value, ' +
- 'settings.headerFooter.value, settings.cssBackground.value, ' +
- 'settings.vendorItems.value)',
],
/** @private {boolean} */
@@ -362,13 +184,372 @@ Polymer({
/** @private {?print_preview.Cdd} */
lastDestinationCapabilities_: null,
+ /** @private */
+ initializeSettings_: function() {
+ this.settings = {
+ pages: {
+ value: [1],
+ unavailableValue: [],
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: '',
+ updatesPreview: false,
+ },
+ copies: {
+ value: '1',
+ unavailableValue: '1',
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: '',
+ updatesPreview: false,
+ },
+ collate: {
+ value: true,
+ unavailableValue: false,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'isCollateEnabled',
+ updatesPreview: false,
+ },
+ layout: {
+ value: false, /* portrait */
+ unavailableValue: false,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'isLandscapeEnabled',
+ updatesPreview: true,
+ },
+ color: {
+ value: true, /* color */
+ unavailableValue: false,
+ valid: true,
+ available: false,
+ setByPolicy: false,
+ key: 'isColorEnabled',
+ updatesPreview: true,
+ },
+ mediaSize: {
+ value: {},
+ unavailableValue: {
+ width_microns: 215900,
+ height_microns: 279400,
+ },
+ valid: true,
+ available: false,
+ setByPolicy: false,
+ key: 'mediaSize',
+ updatesPreview: true,
+ },
+ margins: {
+ value: print_preview.ticket_items.MarginsTypeValue.DEFAULT,
+ unavailableValue: print_preview.ticket_items.MarginsTypeValue.DEFAULT,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'marginsType',
+ updatesPreview: true,
+ },
+ customMargins: {
+ value: {},
+ unavailableValue: {},
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'customMargins',
+ updatesPreview: true,
+ },
+ dpi: {
+ value: {},
+ unavailableValue: {},
+ valid: true,
+ available: false,
+ setByPolicy: false,
+ key: 'dpi',
+ updatesPreview: false,
+ },
+ fitToPage: {
+ value: false,
+ unavailableValue: false,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'isFitToPageEnabled',
+ updatesPreview: true,
+ },
+ scaling: {
+ value: '100',
+ unavailableValue: '100',
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'scaling',
+ updatesPreview: true,
+ },
+ customScaling: {
+ value: false,
+ unavailableValue: false,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'customScaling',
+ updatesPreview: true,
+ },
+ duplex: {
+ value: true,
+ unavailableValue: false,
+ valid: true,
+ available: false,
+ setByPolicy: false,
+ key: 'isDuplexEnabled',
+ updatesPreview: false,
+ },
+ duplexShortEdge: {
+ value: false,
+ unavailableValue: false,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'isDuplexShortEdge',
+ updatesPreview: false,
+ },
+ cssBackground: {
+ value: false,
+ unavailableValue: false,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'isCssBackgroundEnabled',
+ updatesPreview: true,
+ },
+ selectionOnly: {
+ value: false,
+ unavailableValue: false,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: '',
+ updatesPreview: true,
+ },
+ headerFooter: {
+ value: true,
+ unavailableValue: false,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'isHeaderFooterEnabled',
+ updatesPreview: true,
+ },
+ rasterize: {
+ value: false,
+ unavailableValue: false,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: '',
+ updatesPreview: true,
+ },
+ vendorItems: {
+ value: {},
+ unavailableValue: {},
+ valid: true,
+ available: false,
+ setByPolicy: false,
+ key: 'vendorOptions',
+ updatesPreview: false,
+ },
+ pagesPerSheet: {
+ value: 1,
+ unavailableValue: 1,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: '',
+ updatesPreview: true,
+ },
+ // This does not represent a real setting value, and is used only to
+ // expose the availability of the other options settings section.
+ otherOptions: {
+ value: null,
+ unavailableValue: null,
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: '',
+ updatesPreview: false,
+ },
+ // This does not represent a real settings value, but is used to
+ // propagate the correctly formatted ranges for print tickets.
+ ranges: {
+ value: [],
+ unavailableValue: [],
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: '',
+ updatesPreview: true,
+ },
+ recentDestinations: {
+ value: [],
+ unavailableValue: [],
+ valid: true,
+ available: true,
+ setByPolicy: false,
+ key: 'recentDestinations',
+ updatesPreview: false,
+ },
+ // <if expr="chromeos">
+ pin: {
+ value: false,
+ unavailableValue: false,
+ valid: true,
+ available: false,
+ setByPolicy: false,
+ key: 'isPinEnabled',
+ updatesPreview: false,
+ },
+ pinValue: {
+ value: '',
+ unavailableValue: '',
+ valid: true,
+ available: false,
+ setByPolicy: false,
+ key: 'pinValue',
+ updatesPreview: false,
+ },
+ // </if>
+ };
+ },
+
+ /** @override */
+ attached: function() {
+ assert(!print_preview.Model.instance_);
+ print_preview.Model.instance_ = this;
+ // Initialize settings after setting the instance. Setting settings earlier
+ // will cause observers to fire before setting the instance above in Polymer
+ // 1. These observers often access this object via getSettingValue(), which
+ // calls print_preview.Model.getInstance(). Some simplification may be
+ // possible after Polymer 1 is removed, see https://crbug.com/944281.
+ this.initializeSettings_();
+ print_preview.Model.whenReady_.resolve();
+ },
+
+ /** @override */
+ detached: function() {
+ print_preview.Model.instance_ = null;
+ print_preview.Model.whenReady_ = new PromiseResolver();
+ },
+
+ /**
+ * @param {string} settingName Name of the setting to get.
+ * @return {print_preview_new.Setting} The setting object.
+ */
+ getSetting: function(settingName) {
+ const setting = /** @type {print_preview_new.Setting} */ (
+ this.get(settingName, this.settings));
+ assert(setting, 'Setting is missing: ' + settingName);
+ return setting;
+ },
+
+ /**
+ * @param {string} settingName Name of the setting to get the value for.
+ * @return {*} The value of the setting, accounting for availability.
+ */
+ getSettingValue: function(settingName) {
+ const setting = this.getSetting(settingName);
+ return setting.available ? setting.value : setting.unavailableValue;
+ },
+
+ /**
+ * Updates settings.settingPath to |value|. Fires a preview-setting-changed
+ * event if the modification results in a change to the value returned by
+ * getSettingValue().
+ * @param {string} settingPath Setting path to set
+ * @param {*} value value to set.
+ * @private
+ */
+ setSettingPath_: function(settingPath, value) {
+ const settingName = settingPath.split('.')[0];
+ const setting = this.getSetting(settingName);
+ const oldValue = this.getSettingValue(settingName);
+ this.set(`settings.${settingPath}`, value);
+ const newValue = this.getSettingValue(settingName);
+ if (newValue !== oldValue && setting.updatesPreview) {
+ this.fire('preview-setting-changed');
+ }
+ },
+
+ /**
+ * Sets settings.settingName.value to |value|, unless updating the setting is
+ * disallowed by enterprise policy. Fires preview-setting-changed and
+ * sticky-setting-changed events if the update impacts the preview or requires
+ * an update to sticky settings.
+ * @param {string} settingName Name of the setting to set
+ * @param {*} value The value to set the setting to.
+ */
+ setSetting: function(settingName, value) {
+ const setting = this.getSetting(settingName);
+ if (setting.setByPolicy) {
+ return;
+ }
+ const fireStickyEvent = setting.value !== value && setting.key;
+ this.setSettingPath_(`${settingName}.value`, value);
+ if (fireStickyEvent && this.initialized_) {
+ this.fire('sticky-setting-changed', this.getStickySettings_());
+ }
+ },
+
+ /**
+ * @param {string} settingName Name of the setting to set
+ * @param {number} start
+ * @param {number} end
+ * @param {*} newValue The value to add (if any).
+ */
+ setSettingSplice: function(settingName, start, end, newValue) {
+ const setting = this.getSetting(settingName);
+ if (setting.setByPolicy) {
+ return;
+ }
+ if (newValue) {
+ this.splice(`settings.${settingName}.value`, start, end, newValue);
+ } else {
+ this.splice(`settings.${settingName}.value`, start, end);
+ }
+ if (setting.key && this.initialized_) {
+ this.fire('sticky-setting-changed', this.getStickySettings_());
+ }
+ },
+
+ /**
+ * Sets the validity of |settingName| to |valid|. If the validity is changed,
+ * fires a setting-valid-changed event.
+ * @param {string} settingName Name of the setting to set
+ * @param {boolean} valid Whether the setting value is currently valid.
+ */
+ setSettingValid: function(settingName, valid) {
+ const setting = this.getSetting(settingName);
+ // Should not set the setting to invalid if it is not available, as there
+ // is no way for the user to change the value in this case.
+ if (!valid) {
+ assert(setting.available, 'Setting is not available: ' + settingName);
+ }
+ const shouldFireEvent = valid != setting.valid;
+ this.set(`settings.${settingName}.valid`, valid);
+ if (shouldFireEvent) {
+ this.fire('setting-valid-changed', valid);
+ }
+ },
+
/**
* Updates the availability of the settings sections and values of dpi and
* media size settings based on the destination capabilities.
* @private
*/
updateSettingsFromDestination_: function() {
- if (!this.destination) {
+ if (!this.destination || !this.settings) {
return;
}
@@ -395,25 +576,40 @@ Polymer({
* @private
*/
updateSettingsAvailabilityFromDestination_: function(caps) {
- this.set('settings.copies.available', !!caps && !!caps.copies);
- this.set('settings.collate.available', !!caps && !!caps.collate);
- this.set('settings.color.available', this.destination.hasColorCapability);
+ this.setSettingPath_('copies.available', !!caps && !!caps.copies);
+ this.setSettingPath_('collate.available', !!caps && !!caps.collate);
+ this.setSettingPath_(
+ 'color.available', this.destination.hasColorCapability);
- this.set(
- 'settings.dpi.available',
+ this.setSettingPath_(
+ 'dpi.available',
!!caps && !!caps.dpi && !!caps.dpi.option &&
caps.dpi.option.length > 1);
- this.set(
- 'settings.duplex.available',
- !!caps && !!caps.duplex && !!caps.duplex.option &&
- caps.duplex.option.some(
- o => o.type == print_preview_new.DuplexType.LONG_EDGE) &&
+ const capsHasDuplex = !!caps && !!caps.duplex && !!caps.duplex.option;
+ const capsHasLongEdge = capsHasDuplex &&
+ caps.duplex.option.some(
+ o => o.type == print_preview_new.DuplexType.LONG_EDGE);
+ const capsHasShortEdge = capsHasDuplex &&
+ caps.duplex.option.some(
+ o => o.type == print_preview_new.DuplexType.SHORT_EDGE);
+ this.setSettingPath_(
+ 'duplexShortEdge.available', capsHasLongEdge && capsHasShortEdge);
+ this.setSettingPath_(
+ 'duplex.available',
+ (capsHasLongEdge || capsHasShortEdge) &&
caps.duplex.option.some(
o => o.type == print_preview_new.DuplexType.NO_DUPLEX));
- this.set(
- 'settings.vendorItems.available', !!caps && !!caps.vendor_capability);
+ this.setSettingPath_(
+ 'vendorItems.available', !!caps && !!caps.vendor_capability);
+
+ // <if expr="chromeos">
+ const pinSupported = !!caps && !!caps.pin && !!caps.pin.supported &&
+ loadTimeData.getBoolean('isEnterpriseManaged');
+ this.set('settings.pin.available', pinSupported);
+ this.set('settings.pinValue.available', pinSupported);
+ // </if>
if (this.documentSettings) {
this.updateSettingsAvailabilityFromDestinationAndDocumentSettings_();
@@ -427,43 +623,47 @@ Polymer({
const knownSizeToSaveAsPdf = isSaveAsPDF &&
(!this.documentSettings.isModifiable ||
this.documentSettings.hasCssMediaStyles);
- this.set('settings.fitToPage.unavailableValue', !isSaveAsPDF);
- this.set(
- 'settings.fitToPage.available',
+ this.setSettingPath_('fitToPage.unavailableValue', !isSaveAsPDF);
+ this.setSettingPath_(
+ 'fitToPage.available',
!knownSizeToSaveAsPdf && !this.documentSettings.isModifiable);
- this.set('settings.scaling.available', !knownSizeToSaveAsPdf);
+ this.setSettingPath_('scaling.available', !knownSizeToSaveAsPdf);
const caps = this.destination && this.destination.capabilities ?
this.destination.capabilities.printer :
null;
- this.set(
- 'settings.mediaSize.available',
+ this.setSettingPath_(
+ 'mediaSize.available',
!!caps && !!caps.media_size && !knownSizeToSaveAsPdf);
- this.set('settings.layout.available', this.isLayoutAvailable_(caps));
- this.set(
- 'settings.otherOptions.available',
- this.settings.duplex.available ||
- this.settings.cssBackground.available ||
- this.settings.selectionOnly.available ||
- this.settings.headerFooter.available ||
- this.settings.rasterize.available);
+ this.setSettingPath_('layout.available', this.isLayoutAvailable_(caps));
},
/** @private */
updateSettingsAvailabilityFromDocumentSettings_: function() {
- this.set('settings.margins.available', this.documentSettings.isModifiable);
- this.set(
- 'settings.customMargins.available', this.documentSettings.isModifiable);
- this.set(
- 'settings.cssBackground.available', this.documentSettings.isModifiable);
- this.set(
- 'settings.selectionOnly.available',
+ if (!this.settings) {
+ return;
+ }
+
+ this.setSettingPath_(
+ 'margins.available', this.documentSettings.isModifiable);
+ this.setSettingPath_(
+ 'customMargins.available', this.documentSettings.isModifiable);
+ this.setSettingPath_(
+ 'cssBackground.available', this.documentSettings.isModifiable);
+ this.setSettingPath_(
+ 'selectionOnly.available',
this.documentSettings.isModifiable &&
this.documentSettings.hasSelection);
- this.set(
- 'settings.headerFooter.available', this.isHeaderFooterAvailable_());
- this.set(
- 'settings.rasterize.available',
+ this.setSettingPath_(
+ 'headerFooter.available', this.isHeaderFooterAvailable_());
+ this.setSettingPath_(
+ 'rasterize.available',
!this.documentSettings.isModifiable && !cr.isWindows && !cr.isMac);
+ this.setSettingPath_(
+ 'otherOptions.available',
+ this.settings.cssBackground.available ||
+ this.settings.selectionOnly.available ||
+ this.settings.headerFooter.available ||
+ this.settings.rasterize.available);
if (this.destination) {
this.updateSettingsAvailabilityFromDestinationAndDocumentSettings_();
@@ -476,8 +676,8 @@ Polymer({
return;
}
- this.set(
- 'settings.headerFooter.available', this.isHeaderFooterAvailable_());
+ this.setSettingPath_(
+ 'headerFooter.available', this.isHeaderFooterAvailable_());
},
/**
@@ -582,7 +782,7 @@ Polymer({
this.setSetting('dpi', matchingOption || defaultOption);
} else if (
caps && caps.dpi && caps.dpi.option && caps.dpi.option.length > 0) {
- this.set('settings.dpi.unavailableValue', caps.dpi.option[0]);
+ this.setSettingPath_('dpi.unavailableValue', caps.dpi.option[0]);
}
if (!this.initialized_ && this.settings.color.available) {
@@ -598,17 +798,17 @@ Polymer({
(this.destination.id ===
print_preview.Destination.GooglePromotedId.DOCS ||
this.destination.type === print_preview.DestinationType.MOBILE)) {
- this.set('settings.color.unavailableValue', true);
+ this.setSettingPath_('color.unavailableValue', true);
} else if (
!this.settings.color.available && caps && caps.color &&
caps.color.option && caps.color.option.length > 0) {
- this.set(
- 'settings.color.unavailableValue',
+ this.setSettingPath_(
+ 'color.unavailableValue',
!['STANDARD_MONOCHROME', 'CUSTOM_MONOCHROME'].includes(
caps.color.option[0].type));
} else if (!this.settings.color.available) {
// if no color capability is reported, assume black and white.
- this.set('settings.color.unavailableValue', false);
+ this.setSettingPath_('color.unavailableValue', false);
}
if (!this.initialized_ && this.settings.duplex.available) {
@@ -616,19 +816,40 @@ Polymer({
this.setSetting(
'duplex',
defaultOption ?
- defaultOption.type == print_preview_new.DuplexType.LONG_EDGE :
+ (defaultOption.type == print_preview_new.DuplexType.LONG_EDGE ||
+ defaultOption.type == print_preview_new.DuplexType.SHORT_EDGE) :
false);
+ this.setSetting(
+ 'duplexShortEdge',
+ defaultOption ?
+ defaultOption.type == print_preview_new.DuplexType.SHORT_EDGE :
+ false);
+
+ if (!this.settings.duplexShortEdge.available) {
+ // Duplex is available, so must have only one two sided printing option.
+ // Set duplexShortEdge's unavailable value based on the printer.
+ this.setSettingPath_(
+ 'duplexShortEdge.unavailableValue',
+ caps.duplex.option.some(
+ o => o.type == print_preview_new.DuplexType.SHORT_EDGE));
+ }
} else if (
!this.settings.duplex.available && caps && caps.duplex &&
- caps.duplex.option &&
- !caps.duplex.option.some(
- o => o.type != print_preview_new.DuplexType.LONG_EDGE)) {
+ caps.duplex.option) {
+ // In this case, there must only be one option.
+ const hasLongEdge = caps.duplex.option.some(
+ o => o.type == print_preview_new.DuplexType.LONG_EDGE);
+ const hasShortEdge = caps.duplex.option.some(
+ o => o.type == print_preview_new.DuplexType.SHORT_EDGE);
// If the only option available is long edge, the value should always be
// true.
- this.set('settings.duplex.unavailableValue', true);
+ this.setSettingPath_(
+ 'duplex.unavailableValue', hasLongEdge || hasShortEdge);
+ this.setSettingPath_('duplexShortEdge.unavailableValue', hasShortEdge);
} else if (!this.settings.duplex.available) {
// If no duplex capability is reported, assume false.
- this.set('settings.duplex.unavailableValue', false);
+ this.setSettingPath_('duplex.unavailableValue', false);
+ this.setSettingPath_('duplexShortEdge.unavailableValue', false);
}
if (this.settings.vendorItems.available) {
@@ -657,53 +878,13 @@ Polymer({
}
},
- /** @private */
- updateRecentDestinations_: function() {
- if (!this.initialized_ || !this.destination) {
- return;
- }
-
- // Determine if this destination is already in the recent destinations,
- // and where in the array it is located.
- const newDestination =
- print_preview.makeRecentDestination(assert(this.destination));
- let indexFound = this.recentDestinations.findIndex(function(recent) {
- return (
- newDestination.id == recent.id &&
- newDestination.origin == recent.origin);
- });
-
- // No change
- if (indexFound == 0 &&
- this.recentDestinations[0].capabilities ==
- newDestination.capabilities) {
- return;
- }
-
- // Shift the array so that the nth most recent destination is located at
- // index n.
- if (indexFound == -1 &&
- this.recentDestinations.length == NUM_DESTINATIONS) {
- indexFound = NUM_DESTINATIONS - 1;
- }
- if (indexFound != -1) {
- this.recentDestinations.splice(indexFound, 1);
- }
-
- // Add the most recent destination
- this.splice('recentDestinations', 0, 0, newDestination);
-
- // Persist sticky settings.
- this.stickySettingsChanged_();
- },
-
/**
* Caches the sticky settings and sets up the recent destinations. Sticky
* settings will be applied when destinaton capabilities have been retrieved.
* @param {?string} savedSettingsStr The sticky settings from native layer
*/
setStickySettings: function(savedSettingsStr) {
- assert(!this.stickySettings_ && this.recentDestinations.length == 0);
+ assert(!this.stickySettings_);
if (!savedSettingsStr) {
return;
@@ -725,7 +906,9 @@ Polymer({
if (!Array.isArray(recentDestinations)) {
recentDestinations = [recentDestinations];
}
- this.recentDestinations = recentDestinations;
+ // Initialize recent destinations early so that the destination store can
+ // start trying to fetch them.
+ this.setSetting('recentDestinations', recentDestinations);
this.stickySettings_ = savedSettings;
},
@@ -776,8 +959,7 @@ Polymer({
this.initialized_ = true;
this.updateManaged_();
this.stickySettings_ = null;
- this.updateRecentDestinations_();
- this.stickySettingsChanged_();
+ this.fire('sticky-settings-changed', this.getStickySettings_());
},
// <if expr="chromeos">
@@ -793,19 +975,46 @@ Polymer({
// |this.setSetting| does nothing if policy is present.
// We want to set the value nevertheless so we call |this.set| directly.
this.set(
- 'settings.color.value', colorValue == print_preview.ColorMode.COLOR);
+ 'settings.color.value',
+ colorValue == print_preview.ColorModeRestriction.COLOR);
}
this.set('settings.color.setByPolicy', !!colorPolicy);
const duplexPolicy = this.destination.duplexPolicy;
const duplexValue =
duplexPolicy ? duplexPolicy : this.destination.defaultDuplexPolicy;
+ let setDuplexTypeByPolicy = false;
if (duplexValue) {
this.set(
'settings.duplex.value',
duplexValue != print_preview.DuplexModeRestriction.SIMPLEX);
+ if (duplexValue === print_preview.DuplexModeRestriction.SHORT_EDGE) {
+ this.set('settings.duplexShortEdge.value', true);
+ setDuplexTypeByPolicy = true;
+ } else if (
+ duplexValue === print_preview.DuplexModeRestriction.LONG_EDGE) {
+ this.set('settings.duplexShortEdge.value', false);
+ setDuplexTypeByPolicy = true;
+ }
}
this.set('settings.duplex.setByPolicy', !!duplexPolicy);
+ this.set(
+ 'settings.duplexShortEdge.setByPolicy',
+ !!duplexPolicy && setDuplexTypeByPolicy);
+
+ const pinPolicy = this.destination.pinPolicy;
+ if (pinPolicy == print_preview.PinModeRestriction.NO_PIN) {
+ this.set('settings.pin.available', false);
+ this.set('settings.pinValue.available', false);
+ }
+ const pinValue = pinPolicy ? pinPolicy : this.destination.defaultPinPolicy;
+ if (pinValue) {
+ this.set(
+ 'settings.pin.value',
+ pinValue == print_preview.PinModeRestriction.PIN);
+ }
+ this.set('settings.pin.setByPolicy', !!pinPolicy);
+
this.updateManaged_();
},
// </if>
@@ -814,7 +1023,8 @@ Polymer({
updateManaged_: function() {
let managedSettings = ['headerFooter'];
// <if expr="chromeos">
- managedSettings = managedSettings.concat(['color', 'duplex']);
+ managedSettings =
+ managedSettings.concat(['color', 'duplex', 'duplexShortEdge', 'pin']);
// </if>
this.controlsManaged = managedSettings.some(settingName => {
const setting = this.getSetting(settingName);
@@ -827,22 +1037,49 @@ Polymer({
return this.initialized_;
},
- /** @private */
- stickySettingsChanged_: function() {
- if (!this.initialized_) {
- return;
- }
-
+ /**
+ * @return {string} The current serialized settings.
+ * @private
+ */
+ getStickySettings_: function() {
const serialization = {
version: 2,
- recentDestinations: this.recentDestinations,
};
STICKY_SETTING_NAMES.forEach(settingName => {
const setting = this.get(settingName, this.settings);
serialization[assert(setting.key)] = setting.value;
});
- this.fire('save-sticky-settings', JSON.stringify(serialization));
+
+ return JSON.stringify(serialization);
+ },
+
+ /**
+ * @return {!print_preview_new.DuplexMode} The duplex mode selected.
+ * @private
+ */
+ getDuplexMode_: function() {
+ if (!this.getSettingValue('duplex')) {
+ return print_preview_new.DuplexMode.SIMPLEX;
+ }
+
+ return this.getSettingValue('duplexShortEdge') ?
+ print_preview_new.DuplexMode.SHORT_EDGE :
+ print_preview_new.DuplexMode.LONG_EDGE;
+ },
+
+ /**
+ * @return {!print_preview_new.DuplexType} The duplex type selected.
+ * @private
+ */
+ getCddDuplexType_: function() {
+ if (!this.getSettingValue('duplex')) {
+ return print_preview_new.DuplexType.NO_DUPLEX;
+ }
+
+ return this.getSettingValue('duplexShortEdge') ?
+ print_preview_new.DuplexType.SHORT_EDGE :
+ print_preview_new.DuplexType.LONG_EDGE;
},
/**
@@ -859,7 +1096,6 @@ Polymer({
vertical_dpi: (number | undefined),
vendor_id: (number | undefined)}} */ (
this.getSettingValue('dpi'));
-
const ticket = {
mediaSize: this.getSettingValue('mediaSize'),
pageCount: this.getSettingValue('pages').length,
@@ -868,9 +1104,7 @@ Polymer({
/** @type {boolean} */ (this.getSettingValue('color'))),
headerFooterEnabled: false, // only used in print preview
marginsType: this.getSettingValue('margins'),
- duplex: this.getSettingValue('duplex') ?
- print_preview_new.DuplexMode.LONG_EDGE :
- print_preview_new.DuplexMode.SIMPLEX,
+ duplex: this.getDuplexMode_(),
copies: parseInt(this.getSettingValue('copies'), 10),
collate: this.getSettingValue('collate'),
shouldPrintBackgrounds: this.getSettingValue('cssBackground'),
@@ -919,6 +1153,12 @@ Polymer({
ticket.OpenPDFInPreview = true;
}
+ // <if expr="chromeos">
+ if (this.getSettingValue('pin')) {
+ ticket.pinValue = this.getSettingValue('pinValue');
+ }
+ // </if>
+
return JSON.stringify(ticket);
},
@@ -971,9 +1211,7 @@ Polymer({
}
if (this.settings.duplex.available) {
cjt.print.duplex = {
- type: this.settings.duplex.value ?
- print_preview_new.DuplexType.LONG_EDGE :
- print_preview_new.DuplexType.NO_DUPLEX,
+ type: this.getCddDuplexType_(),
};
}
if (this.settings.mediaSize.available) {
diff --git a/chromium/chrome/browser/resources/print_preview/new/more_settings.html b/chromium/chrome/browser/resources/print_preview/new/more_settings.html
index 1f40c662fd9..0ee7f116318 100644
--- a/chromium/chrome/browser/resources/print_preview/new/more_settings.html
+++ b/chromium/chrome/browser/resources/print_preview/new/more_settings.html
@@ -29,7 +29,7 @@
:host cr-expand-button {
margin-inline-end: 4px;
- --cr-icon-button-icon-padding: 4px;
+ --cr-expand-button-size: 28px;
}
:host([hidden]) {
@@ -37,14 +37,13 @@
}
#label {
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
flex: 1;
text-align: start;
}
:host([disabled]) #label {
- color: var(--paper-grey-600);
- opacity: .65;
+ @apply --print-preview-disabled-label;
}
</style>
<div on-click="toggleExpandButton_" actionable>
diff --git a/chromium/chrome/browser/resources/print_preview/new/other_options_settings.js b/chromium/chrome/browser/resources/print_preview/new/other_options_settings.js
index a4a879168d2..b7f447d8e35 100644
--- a/chromium/chrome/browser/resources/print_preview/new/other_options_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/new/other_options_settings.js
@@ -22,7 +22,6 @@ Polymer({
value: function() {
return [
{name: 'headerFooter', label: 'optionHeaderFooter'},
- {name: 'duplex', label: 'optionTwoSided'},
{name: 'cssBackground', label: 'optionBackgroundColorsAndImages'},
{name: 'rasterize', label: 'optionRasterize'},
{name: 'selectionOnly', label: 'optionSelectionOnly'},
@@ -42,7 +41,6 @@ Polymer({
observers: [
'onHeaderFooterSettingChange_(settings.headerFooter.*)',
- 'onDuplexSettingChange_(settings.duplex.*)',
'onCssBackgroundSettingChange_(settings.cssBackground.*)',
'onRasterizeSettingChange_(settings.rasterize.*)',
'onSelectionOnlySettingChange_(settings.selectionOnly.*)',
@@ -111,23 +109,18 @@ Polymer({
},
/** @private */
- onDuplexSettingChange_: function() {
- this.updateOptionFromSetting_(1);
- },
-
- /** @private */
onCssBackgroundSettingChange_: function() {
- this.updateOptionFromSetting_(2);
+ this.updateOptionFromSetting_(1);
},
/** @private */
onRasterizeSettingChange_: function() {
- this.updateOptionFromSetting_(3);
+ this.updateOptionFromSetting_(2);
},
/** @private */
onSelectionOnlySettingChange_: function() {
- this.updateOptionFromSetting_(4);
+ this.updateOptionFromSetting_(3);
},
/**
diff --git a/chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.html b/chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.html
index 649d89f3d3e..de31288d84e 100644
--- a/chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.html
+++ b/chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/md_select_css.html">
+<link rel="import" href="../data/margins.html">
<link rel="import" href="print_preview_shared_css.html">
<link rel="import" href="select_behavior.html">
<link rel="import" href="settings_behavior.html">
diff --git a/chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.js b/chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.js
index 0e9701e8c99..e94352a608c 100644
--- a/chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/new/pages_per_sheet_settings.js
@@ -19,6 +19,8 @@ Polymer({
*/
onPagesPerSheetSettingChange_: function(newValue) {
this.selectedValue = /** @type {number} */ (newValue).toString();
+ this.setSetting(
+ 'margins', print_preview.ticket_items.MarginsTypeValue.DEFAULT);
},
/** @param {string} value The new select value. */
diff --git a/chromium/chrome/browser/resources/print_preview/new/pages_settings.js b/chromium/chrome/browser/resources/print_preview/new/pages_settings.js
index c2d4bfddeb2..84c313236a0 100644
--- a/chromium/chrome/browser/resources/print_preview/new/pages_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/new/pages_settings.js
@@ -374,14 +374,6 @@ Polymer({
},
/**
- * @param {!Event} e Click event
- * @private
- */
- onCustomInputClick_: function(e) {
- e.stopPropagation();
- },
-
- /**
* @return {string} Gets message to show as hint.
* @private
*/
diff --git a/chromium/chrome/browser/resources/print_preview/new/pin_settings.html b/chromium/chrome/browser/resources/print_preview/new/pin_settings.html
new file mode 100644
index 00000000000..3159f436def
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/pin_settings.html
@@ -0,0 +1,65 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
+<link rel="import" href="input_behavior.html">
+<link rel="import" href="print_preview_shared_css.html">
+<link rel="import" href="settings_behavior.html">
+<link rel="import" href="settings_section.html">
+<link rel="import" href="state.html">
+
+<dom-module id="print-preview-pin-settings">
+ <template>
+ <style include="print-preview-shared">
+ :host {
+ margin-top: 0 !important;
+ }
+
+ :host([input-valid_]) #pinValue {
+ --cr-input-error-display: none;
+ }
+
+ /* Margin = standard margin (16px) - error field margin (8px) */
+ :host([!input-valid_]) #customInputWrapper {
+ margin-bottom: 8px;
+ }
+
+ #pinValue {
+ --cr-form-field-label-height: 100%;
+ --cr-input-row-container: {
+ min-height: 38px;
+ }
+ cursor: default;
+ }
+
+ :host #title {
+ align-self: baseline;
+ }
+ </style>
+ <print-preview-settings-section>
+ <div slot="title"></div>
+ <div slot="controls" class="checkbox">
+ <cr-checkbox id="pin" on-change="onPinChange_"
+ disabled="[[checkboxDisabled_]]" aria-labelledby="pin-label">
+ <span id="pin-label">$i18n{optionPin}</span>
+ </cr-checkbox>
+ </div>
+ </print-preview-settings-section>
+ <iron-collapse opened="[[pinEnabled_]]"
+ on-transitionend="onCollapseChanged_">
+ <print-preview-settings-section id="customInputWrapper">
+ <div slot="title"></div>
+ <div slot="controls">
+ <cr-input id="pinValue" type="text" pattern="[0-9]{4}" minlength="4"
+ maxlength="4" data-timeout-delay="250" aria-labelledby="pin"
+ placeholder="$i18n{pinPlaceholder}" spellcheck="false"
+ disabled$="[[inputDisabled_(pinEnabled_, inputValid_, disabled)]]"
+ error-message="$i18n{pinErrorMessage}" required auto-validate>
+ </cr-input>
+ </div>
+ </print-preview-settings-section>
+ </iron-collapse>
+ </template>
+ <script src="pin_settings.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/print_preview/new/pin_settings.js b/chromium/chrome/browser/resources/print_preview/new/pin_settings.js
new file mode 100644
index 00000000000..10451467987
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/pin_settings.js
@@ -0,0 +1,164 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer({
+ is: 'print-preview-pin-settings',
+
+ behaviors: [SettingsBehavior, print_preview_new.InputBehavior],
+
+ properties: {
+ /** @type {!print_preview_new.State} */
+ state: Number,
+
+ disabled: Boolean,
+
+ /** @private {boolean} */
+ checkboxDisabled_: {
+ type: Boolean,
+ computed: 'computeCheckboxDisabled_(inputValid_, disabled, ' +
+ 'settings.pin.setByPolicy)',
+ },
+
+ /** @private {boolean} */
+ pinEnabled_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /** @private {string} */
+ inputString_: {
+ type: String,
+ value: '',
+ observer: 'onInputChanged_',
+ },
+
+ /** @private */
+ inputValid_: {
+ type: Boolean,
+ value: true,
+ reflectToAttribute: true,
+ },
+ },
+
+ observers: [
+ 'onSettingsChanged_(settings.pin.value, settings.pinValue.value)',
+ 'changePinValueSetting_(state)',
+ ],
+
+ listeners: {
+ 'input-change': 'onInputChange_',
+ },
+
+ /** @return {!CrInputElement} The cr-input field element for InputBehavior. */
+ getInput: function() {
+ return this.$.pinValue;
+ },
+
+ /**
+ * @param {!CustomEvent<string>} e Contains the new input value.
+ * @private
+ */
+ onInputChange_: function(e) {
+ this.inputString_ = e.detail;
+ },
+
+ /** @private */
+ onCollapseChanged_: function() {
+ if (this.pinEnabled_) {
+ /** @type {!CrInputElement} */ (this.$.pinValue).inputElement.focus();
+ }
+ },
+
+ /**
+ * @param {boolean} inputValid Whether pin value is valid.
+ * @param {boolean} disabled Whether pin setting is disabled.
+ * @param {boolean} managed Whether pin setting is managed.
+ * @return {boolean} Whether pin checkbox should be disabled.
+ * @private
+ */
+ computeCheckboxDisabled_: function(inputValid, disabled, managed) {
+ return managed || (inputValid && disabled);
+ },
+
+ /**
+ * @return {boolean} Whether to disable the pin value input.
+ * @private
+ */
+ inputDisabled_: function() {
+ return !this.pinEnabled_ || (this.inputValid_ && this.disabled);
+ },
+
+ /**
+ * Updates the checkbox state when the setting has been initialized.
+ * @private
+ */
+ onSettingsChanged_: function() {
+ const pinEnabled = /** @type {boolean} */ (this.getSetting('pin').value);
+ this.$.pin.checked = pinEnabled;
+ this.pinEnabled_ = pinEnabled;
+ const pinValue = this.getSetting('pinValue');
+ this.inputString_ = /** @type {string} */ (pinValue.value);
+ this.resetString();
+ },
+
+ /** @private */
+ onPinChange_: function() {
+ this.setSetting('pin', this.$.pin.checked);
+ // We need to set validity of pinValue to true to return to READY state
+ // after unchecking the pin and to check the validity again after checking
+ // the pin.
+ if (!this.$.pin.checked) {
+ this.setSettingValid('pinValue', true);
+ } else {
+ this.changePinValueSetting_();
+ }
+ },
+
+ /**
+ * @private
+ */
+ onInputChanged_: function() {
+ this.changePinValueSetting_();
+ },
+
+ /**
+ * Updates pin value setting based on the current value of the pin value
+ * input.
+ * @private
+ */
+ changePinValueSetting_: function() {
+ if (this.settings === undefined) {
+ return;
+ }
+ // If the state is not READY and current pinValue is valid (so it's not the
+ // cause of the error) we need to wait until the state will be READY again.
+ // It's done because we don't permit multiple simultaneous validation errors
+ // in Print Preview and we also don't want to set the value when sticky
+ // settings may not yet have been set.
+ if (this.state != print_preview_new.State.READY &&
+ this.settings.pinValue.valid) {
+ return;
+ }
+ this.inputValid_ = this.computeValid_();
+ this.setSettingValid('pinValue', this.inputValid_);
+
+ // We allow to save the empty string as sticky setting value to give users
+ // the opportunity to unset their PIN in sticky settings.
+ if (this.inputValid_ || this.inputString_ == '') {
+ this.setSetting('pinValue', this.inputString_);
+ }
+ },
+
+ /**
+ * @return {boolean} Whether input value represented by inputString_ is
+ * valid, so that it can be used to update the setting.
+ * @private
+ */
+ computeValid_: function() {
+ // Make sure value updates first, in case inputString_ was updated by JS.
+ this.$.pinValue.value = this.inputString_;
+ this.$.pinValue.validate();
+ return !this.$.pinValue.invalid;
+ },
+});
diff --git a/chromium/chrome/browser/resources/print_preview/new/plugin_proxy.js b/chromium/chrome/browser/resources/print_preview/new/plugin_proxy.js
index 77dfb95fe80..d813eed25d9 100644
--- a/chromium/chrome/browser/resources/print_preview/new/plugin_proxy.js
+++ b/chromium/chrome/browser/resources/print_preview/new/plugin_proxy.js
@@ -138,6 +138,10 @@ cr.define('print_preview_new', function() {
this.plugin_.sendKeyEvent(e);
}
+ hideToolbars() {
+ this.plugin_.hideToolbars();
+ }
+
/**
* @param {boolean} eventsEnabled Whether pointer events should be captured
* by the plugin.
@@ -155,6 +159,11 @@ cr.define('print_preview_new', function() {
this.plugin_.loadPreviewPage(
this.getPreviewUrl_(previewUid, pageIndex), index);
}
+
+ /** @param {boolean} darkMode Whether the page is in dark mode. */
+ darkModeChanged(darkMode) {
+ this.plugin_.darkModeChanged(darkMode);
+ }
}
/** @type {?print_preview_new.PluginProxy} */
diff --git a/chromium/chrome/browser/resources/print_preview/new/preview_area.html b/chromium/chrome/browser/resources/print_preview/new/preview_area.html
index abda42d9f9c..86002d06f95 100644
--- a/chromium/chrome/browser/resources/print_preview/new/preview_area.html
+++ b/chromium/chrome/browser/resources/print_preview/new/preview_area.html
@@ -4,6 +4,7 @@
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
+<link rel="import" href="chrome://resources/html/dark_mode.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
@@ -74,7 +75,7 @@
}
.preview-area-overlay-layer {
- background: var(--google-grey-200);
+ background: var(--preview-area-background-color);
display: flex;
flex-direction: column;
height: 100%;
@@ -91,6 +92,10 @@
z-index: 1;
}
+ :host([new-print-preview-layout]) .preview-area-overlay-layer {
+ background: var(--preview-area-background-color-new);
+ }
+
.preview-area-overlay-layer.invisible {
opacity: 0;
pointer-events: none;
@@ -99,12 +104,16 @@
}
.preview-area-message {
- color: var(--google-grey-900);
+ color: var(--google-grey-900); /* Same in light and dark. */
line-height: 20px;
margin: 0 10px;
position: relative;
text-align: center;
}
+
+ :host([new-print-preview-layout]) .preview-area-message {
+ color: var(--cr-primary-text-color);
+ }
</style>
<div class$="preview-area-overlay-layer [[getInvisible_(previewState)]]"
aria-hidden$="[[getAriaHidden_(previewState)]]">
@@ -118,7 +127,7 @@
</span>
<a href="$i18n{gcpCertificateErrorLearnMoreURL}"
target="_blank" class="learn-more-link"
- hidden$="[[!shouldShowLearnMoreLink_(previewState)]]">
+ hidden$="[[!shouldShowLearnMoreLink_(error)]]">
$i18n{learnMore}
</a>
</div>
@@ -130,7 +139,7 @@
data="chrome://print/dummy.pdf"></object>
</div>
<print-preview-margin-control-container id="marginControlContainer"
- page-size="[[pageSize]]" settings="{{settings}}"
+ page-size="[[pageSize]]" settings="[[settings]]"
document-margins="[[margins]]"
measurement-system="[[measurementSystem]]" state="[[state]]"
preview-loaded="[[previewLoaded_]]"
diff --git a/chromium/chrome/browser/resources/print_preview/new/preview_area.js b/chromium/chrome/browser/resources/print_preview/new/preview_area.js
index a975619aa00..b21b069332e 100644
--- a/chromium/chrome/browser/resources/print_preview/new/preview_area.js
+++ b/chromium/chrome/browser/resources/print_preview/new/preview_area.js
@@ -19,12 +19,7 @@ print_preview_new.PreviewAreaState = {
DISPLAY_PREVIEW: 'display-preview',
OPEN_IN_PREVIEW_LOADING: 'open-in-preview-loading',
OPEN_IN_PREVIEW_LOADED: 'open-in-preview-loaded',
- INVALID_SETTINGS: 'invalid-settings',
- PREVIEW_FAILED: 'preview-failed',
- UNSUPPORTED_CLOUD_PRINTER: 'unsupported-cloud-printer',
- // <if expr="chromeos">
- NO_DESTINATIONS_FOUND: 'no-destinations-found',
- // </if>
+ ERROR: 'error',
};
Polymer({
@@ -38,19 +33,37 @@ Polymer({
documentModifiable: Boolean,
+ /** @type {!print_preview_new.Error} */
+ error: {
+ type: Number,
+ notify: true,
+ },
+
/** @type {print_preview.Margins} */
margins: Object,
/** @type {?print_preview.MeasurementSystem} */
measurementSystem: Object,
+ newPrintPreviewLayout: {
+ type: Boolean,
+ reflectToAttribute: true,
+ },
+
/** @type {!print_preview.Size} */
pageSize: Object,
+ /** @type {!print_preview_new.PreviewAreaState} */
+ previewState: {
+ type: String,
+ notify: true,
+ value: print_preview_new.PreviewAreaState.LOADING,
+ },
+
/** @type {!print_preview_new.State} */
state: {
type: Number,
- observer: 'onStateChanged_',
+ observer: 'onStateChange_',
},
/** @private {boolean} Whether the plugin is loaded */
@@ -65,13 +78,6 @@ Polymer({
value: false,
},
- /** @type {!print_preview_new.PreviewAreaState} */
- previewState: {
- type: String,
- notify: true,
- value: print_preview_new.PreviewAreaState.LOADING,
- },
-
/** @private {boolean} */
previewLoaded_: {
type: Boolean,
@@ -86,38 +92,18 @@ Polymer({
},
observers: [
- 'onSettingsChanged_(settings.color.value, settings.cssBackground.value, ' +
- 'settings.fitToPage.value, settings.headerFooter.value, ' +
- 'settings.layout.value, settings.ranges.value, ' +
- 'settings.selectionOnly.value, settings.scaling.value, ' +
- 'settings.rasterize.value, destination)',
- 'onMarginsChanged_(settings.margins.value)',
- 'onCustomScalingChanged_(settings.customScaling.value)',
- 'onCustomMarginsChanged_(settings.customMargins.value)',
- 'onMediaSizeChanged_(settings.mediaSize.value)',
- 'onPagesPerSheetChanged_(settings.pagesPerSheet.value)',
'pluginOrDocumentStatusChanged_(pluginLoaded_, documentReady_)',
],
/** @private {?print_preview.NativeLayer} */
nativeLayer_: null,
- /**
- * @private {?print_preview.MarginsSetting}
- */
- lastCustomMargins_: null,
-
- /**
- * @private {?print_preview_new.MediaSizeValue}
- */
- lastMediaSize_: null,
+ /** @private {?Object} */
+ lastTicket_: null,
/** @private {number} */
inFlightRequestId_: -1,
- /** @private {boolean} */
- requestPreviewWhenReady_: false,
-
/** @private {?print_preview_new.PluginProxy} */
pluginProxy_: null,
@@ -129,15 +115,19 @@ Polymer({
this.nativeLayer_ = print_preview.NativeLayer.getInstance();
this.addWebUIListener(
'page-preview-ready', this.onPagePreviewReady_.bind(this));
+ if (this.newPrintPreviewLayout) {
+ this.addWebUIListener(
+ 'dark-mode-changed', this.onDarkModeChanged_.bind(this));
+ }
this.pluginProxy_ = print_preview_new.PluginProxy.getInstance();
if (!this.pluginProxy_.checkPluginCompatibility(assert(
this.$$('.preview-area-compatibility-object-out-of-process')))) {
- this.previewState = print_preview_new.PreviewAreaState.NO_PLUGIN;
+ this.error = print_preview_new.Error.NO_PLUGIN;
+ this.previewState = print_preview_new.PreviewAreaState.ERROR;
}
},
-
/**
* @return {boolean} Whether the preview is loaded.
* @private
@@ -190,17 +180,9 @@ Polymer({
},
/** @private */
- onSettingsChanged_: function() {
- if (this.state == print_preview_new.State.READY) {
- this.startPreview_();
- return;
- }
- this.requestPreviewWhenReady_ = true;
- },
-
- /** @private */
pluginOrDocumentStatusChanged_: function() {
- if (!this.pluginLoaded_ || !this.documentReady_) {
+ if (!this.pluginLoaded_ || !this.documentReady_ ||
+ this.previewState === print_preview_new.PreviewAreaState.ERROR) {
return;
}
@@ -257,8 +239,7 @@ Polymer({
* @private
*/
shouldShowLearnMoreLink_: function() {
- return this.previewState ==
- print_preview_new.PreviewAreaState.UNSUPPORTED_CLOUD_PRINTER;
+ return this.error === print_preview_new.Error.UNSUPPORTED_PRINTER;
},
/**
@@ -267,8 +248,6 @@ Polymer({
*/
currentMessage_: function() {
switch (this.previewState) {
- case print_preview_new.PreviewAreaState.NO_PLUGIN:
- return this.i18n('noPlugin');
case print_preview_new.PreviewAreaState.LOADING:
return this.i18n('loading');
case print_preview_new.PreviewAreaState.DISPLAY_PREVIEW:
@@ -278,29 +257,24 @@ Polymer({
case print_preview_new.PreviewAreaState.OPEN_IN_PREVIEW_LOADED:
return this.i18n('openingPDFInPreview');
// </if>
- case print_preview_new.PreviewAreaState.INVALID_SETTINGS:
- return this.i18nAdvanced('invalidPrinterSettings', {
- substitutions: [],
- tags: ['BR'],
- });
- case print_preview_new.PreviewAreaState.PREVIEW_FAILED:
- return this.i18n('previewFailed');
- case print_preview_new.PreviewAreaState.UNSUPPORTED_CLOUD_PRINTER:
- return this.i18nAdvanced('unsupportedCloudPrinter', {
- substitutions: [],
- tags: ['BR'],
- });
- // <if expr="chromeos">
- case print_preview_new.PreviewAreaState.NO_DESTINATIONS_FOUND:
- return this.i18n('noDestinationsMessage');
- // </if>
+ case print_preview_new.PreviewAreaState.ERROR:
+ // The preview area is responsible for displaying all errors except
+ // print failed and cloud print error.
+ return this.getErrorMessage_();
default:
return '';
}
},
- /** @private */
- startPreview_: function() {
+ /**
+ * @param {boolean} forceUpdate Whether to force the preview area to update
+ * regardless of whether the print ticket has changed.
+ */
+ startPreview: function(forceUpdate) {
+ if (!this.hasTicketChanged_() && !forceUpdate &&
+ this.previewState !== print_preview_new.PreviewAreaState.ERROR) {
+ return;
+ }
this.previewState = print_preview_new.PreviewAreaState.LOADING;
this.documentReady_ = false;
this.getPreview_().then(
@@ -312,31 +286,15 @@ Polymer({
},
type => {
if (/** @type{string} */ (type) == 'SETTINGS_INVALID') {
- this.previewState =
- print_preview_new.PreviewAreaState.INVALID_SETTINGS;
+ this.error = print_preview_new.Error.INVALID_PRINTER;
+ this.previewState = print_preview_new.PreviewAreaState.ERROR;
} else if (/** @type{string} */ (type) != 'CANCELLED') {
- this.previewState =
- print_preview_new.PreviewAreaState.PREVIEW_FAILED;
+ this.error = print_preview_new.Error.PREVIEW_FAILED;
+ this.previewState = print_preview_new.PreviewAreaState.ERROR;
}
});
},
- /** @private */
- onStateChanged_: function() {
- if (this.state == print_preview_new.State.READY &&
- this.requestPreviewWhenReady_) {
- this.startPreview_();
- this.requestPreviewWhenReady_ = false;
- }
- },
-
- // <if expr="chromeos">
- setNoDestinationsFound: function() {
- this.previewState =
- print_preview_new.PreviewAreaState.NO_DESTINATIONS_FOUND;
- },
- // </if>
-
// <if expr="is_macosx">
/** Set the preview state to display the "opening in preview" message. */
setOpeningPdfInPreview: function() {
@@ -366,6 +324,9 @@ Polymer({
}
this.pluginLoaded_ = false;
+ if (inDarkMode() && this.newPrintPreviewLayout) {
+ this.pluginProxy_.darkModeChanged(true);
+ }
this.pluginProxy_.resetPrintPreviewMode(
previewUid, index, !this.getSettingValue('color'),
/** @type {!Array<number>} */ (this.getSettingValue('pages')),
@@ -383,7 +344,8 @@ Polymer({
if (success) {
this.pluginLoaded_ = true;
} else {
- this.previewState = print_preview_new.PreviewAreaState.PREVIEW_FAILED;
+ this.error = print_preview_new.Error.PREVIEW_FAILED;
+ this.previewState = print_preview_new.PreviewAreaState.ERROR;
}
},
@@ -438,6 +400,21 @@ Polymer({
},
/**
+ * @param {boolean} darkMode Whether the page is now in dark mode.
+ * @private
+ */
+ onDarkModeChanged_: function(darkMode) {
+ if (this.pluginProxy_.pluginReady()) {
+ this.pluginProxy_.darkModeChanged(darkMode);
+ }
+
+ if (this.previewState ===
+ print_preview_new.PreviewAreaState.DISPLAY_PREVIEW) {
+ this.startPreview(true);
+ }
+ },
+
+ /**
* Processes a keyboard event that could possibly be used to change state of
* the preview plugin.
* @param {!KeyboardEvent} e Keyboard event to process.
@@ -481,6 +458,17 @@ Polymer({
},
/**
+ * Sends a message to the plugin to hide the toolbars after a delay.
+ */
+ hideToolbars: function() {
+ if (!this.pluginProxy_.pluginReady()) {
+ return;
+ }
+
+ this.pluginProxy_.hideToolbars();
+ },
+
+ /**
* Set a callback that gets called when a key event is received that
* originates in the plugin.
* @param {function(KeyboardEvent)} callback The callback to be called with
@@ -528,87 +516,168 @@ Polymer({
this.pluginProxy_.scrollPosition(position.x, position.y);
},
- /** @private */
- onMarginsChanged_: function() {
- if (this.getSettingValue('margins') !=
- print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
- this.onSettingsChanged_();
- } else {
+ /**
+ * @return {boolean} Whether margin settings are valid for the print ticket.
+ * @private
+ */
+ marginsValid_: function() {
+ const type = this.getSettingValue('margins');
+ if (!Object.values(print_preview.ticket_items.MarginsTypeValue)
+ .includes(type)) {
+ // Unrecognized margins type.
+ return false;
+ }
+
+ if (type !== print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
+ return true;
+ }
+
+ const customMargins = this.getSettingValue('customMargins');
+ return customMargins.marginTop !== undefined &&
+ customMargins.marginLeft !== undefined &&
+ customMargins.marginBottom !== undefined &&
+ customMargins.marginRight !== undefined;
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ hasTicketChanged_: function() {
+ if (!this.marginsValid_()) {
+ // Log so that we can try to debug how this occurs. See
+ // https://crbug.com/942211
+ console.warn('Requested preview with invalid margins');
+ return false;
+ }
+
+ if (!this.lastTicket_) {
+ return true;
+ }
+
+ const lastTicket = this.lastTicket_;
+
+ // Margins
+ const newMarginsType = this.getSettingValue('margins');
+ if (newMarginsType !== lastTicket.marginsType &&
+ newMarginsType !== print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
+ return true;
+ }
+
+ if (newMarginsType === print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
const customMargins =
/** @type {!print_preview.MarginsSetting} */ (
this.getSettingValue('customMargins'));
- for (const side of Object.values(
- print_preview.ticket_items.CustomMarginsOrientation)) {
- const key = print_preview_new.MARGIN_KEY_MAP.get(side);
- // If custom margins are undefined, return and wait for them to be set.
- if (customMargins[key] === undefined || !this.margins) {
- return;
- }
-
- // Start a preview request if the margins actually changed.
- if (this.margins.get(side) != customMargins[key]) {
- this.onSettingsChanged_();
- break;
- }
+ // Change in custom margins values.
+ if (!!lastTicket.marginsCustom &&
+ (lastTicket.marginsCustom.marginTop != customMargins.marginTop ||
+ lastTicket.marginsCustom.marginLeft != customMargins.marginLeft ||
+ lastTicket.marginsCustom.marginRight != customMargins.marginRight ||
+ lastTicket.marginsCustom.marginBottom !=
+ customMargins.marginBottom)) {
+ return true;
+ }
+
+ // Changed to custom margins from a different margins type.
+ if (!this.margins) {
+ // Log so that we can try to debug how this occurs. See
+ // https://crbug.com/942211
+ console.warn('Requested preview with undefined document margins');
+ return false;
+ }
+
+ const customMarginsChanged =
+ Object.values(print_preview.ticket_items.CustomMarginsOrientation)
+ .some(side => {
+ return this.margins.get(side) !==
+ customMargins[print_preview_new.MARGIN_KEY_MAP.get(side)];
+ });
+ if (customMarginsChanged) {
+ return true;
}
- this.lastCustomMargins_ = customMargins;
}
- },
- /** @private */
- onCustomScalingChanged_: function() {
- // If the scaling value is 100, changing between default and custom scaling
- // has no effect on the preview ticket. Only regenerate for scaling != 100.
- if (this.getSettingValue('scaling') !== '100') {
- this.onSettingsChanged_();
+ // Simple settings: ranges, layout, header/footer, pages per sheet, fit to
+ // page, css background, selection only, rasterize, scaling, dpi
+ if (!areRangesEqual(
+ /** @type {!Array<{from: number, to: number}>} */ (
+ this.getSettingValue('ranges')),
+ lastTicket.pageRange) ||
+ this.getSettingValue('layout') !== lastTicket.landscape ||
+ this.getColorForTicket_() !== lastTicket.color ||
+ this.getSettingValue('headerFooter') !==
+ lastTicket.headerFooterEnabled ||
+ this.getSettingValue('fitToPage') !== lastTicket.fitToPageEnabled ||
+ this.getSettingValue('cssBackground') !==
+ lastTicket.shouldPrintBackgrounds ||
+ this.getSettingValue('selectionOnly') !==
+ lastTicket.shouldPrintSelectionOnly ||
+ this.getSettingValue('rasterize') !== lastTicket.rasterizePDF ||
+ this.getScaleFactorForTicket_() !== lastTicket.scaleFactor) {
+ return true;
}
- },
- /** @private */
- onCustomMarginsChanged_: function() {
- const newValue =
- /** @type {!print_preview.MarginsSetting} */ (
- this.getSettingValue('customMargins'));
- if (this.lastCustomMargins_ &&
- this.lastCustomMargins_.marginTop !== undefined &&
- this.getSettingValue('margins') ==
- print_preview.ticket_items.MarginsTypeValue.CUSTOM &&
- (this.lastCustomMargins_.marginTop != newValue.marginTop ||
- this.lastCustomMargins_.marginLeft != newValue.marginLeft ||
- this.lastCustomMargins_.marginRight != newValue.marginRight ||
- this.lastCustomMargins_.marginBottom != newValue.marginBottom)) {
- this.onSettingsChanged_();
+ // Pages per sheet. If margins are non-default, wait for the return to
+ // default margins to trigger a request.
+ if (this.getSettingValue('pagesPerSheet') !== lastTicket.pagesPerSheet &&
+ this.getSettingValue('margins') ===
+ print_preview.ticket_items.MarginsTypeValue.DEFAULT) {
+ return true;
}
- this.lastCustomMargins_ = newValue;
- },
- /** @private */
- onMediaSizeChanged_: function() {
+ // Media size
const newValue =
/** @type {!print_preview_new.MediaSizeValue} */ (
this.getSettingValue('mediaSize'));
- if (this.lastMediaSize_ &&
- (newValue.height_microns != this.lastMediaSize_.height_microns ||
- newValue.width_microns != this.lastMediaSize_.width_microns)) {
- this.onSettingsChanged_();
+ if (newValue.height_microns != lastTicket.mediaSize.height_microns ||
+ newValue.width_microns != lastTicket.mediaSize.width_microns ||
+ (this.destination.id !== lastTicket.deviceName &&
+ this.getSettingValue('margins') ===
+ print_preview.ticket_items.MarginsTypeValue.MINIMUM)) {
+ return true;
+ }
+
+ // Destination
+ if (this.destination.isPrivet !== lastTicket.printWithPrivet ||
+ this.destination.isExtension !== lastTicket.printWithExtension ||
+ !this.destination.isLocal !== lastTicket.printWithCloudPrint ||
+ (lastTicket.printToPDF &&
+ this.destination.id !==
+ print_preview.Destination.GooglePromotedId.SAVE_AS_PDF)) {
+ return true;
}
- this.lastMediaSize_ = newValue;
+
+ return false;
},
- /** @private */
- onPagesPerSheetChanged_: function() {
- const pagesPerSheet =
- /** @type {number} */ (this.getSettingValue('pagesPerSheet'));
+ /** @return {number} Native color model of the destination. */
+ getColorForTicket_: function() {
+ return this.destination.getNativeColorModel(
+ /** @type {boolean} */ (this.getSettingValue('color')));
+ },
- if (pagesPerSheet == 1 ||
- this.getSettingValue('margins') ==
- print_preview.ticket_items.MarginsTypeValue.DEFAULT) {
- this.onSettingsChanged_();
- } else {
- this.setSetting(
- 'margins', print_preview.ticket_items.MarginsTypeValue.DEFAULT);
- }
+ /** @return {number} Scale factor. */
+ getScaleFactorForTicket_: function() {
+ return this.getSettingValue('customScaling') ?
+ parseInt(this.getSettingValue('scaling'), 10) :
+ 100;
+ },
+
+ /**
+ * @param {string} dpiField The field in dpi to retrieve.
+ * @return {number} Field value.
+ */
+ getDpiForTicket_: function(dpiField) {
+ const dpi =
+ /**
+ @type {{horizontal_dpi: (number | undefined),
+ vertical_dpi: (number | undefined),
+ vendor_id: (number | undefined)}}
+ */
+ (this.getSettingValue('dpi'));
+ const value = (dpi && dpiField in dpi) ? dpi[dpiField] : 0;
+ return value;
},
/**
@@ -618,16 +687,11 @@ Polymer({
*/
getPreview_: function() {
this.inFlightRequestId_++;
- const dpi = /** @type {{horizontal_dpi: (number | undefined),
- vertical_dpi: (number | undefined),
- vendor_id: (number | undefined)}} */ (
- this.getSettingValue('dpi'));
const ticket = {
pageRange: this.getSettingValue('ranges'),
mediaSize: this.getSettingValue('mediaSize'),
landscape: this.getSettingValue('layout'),
- color: this.destination.getNativeColorModel(
- /** @type {boolean} */ (this.getSettingValue('color'))),
+ color: this.getColorForTicket_(),
headerFooterEnabled: this.getSettingValue('headerFooter'),
marginsType: this.getSettingValue('margins'),
pagesPerSheet: this.getSettingValue('pagesPerSheet'),
@@ -635,9 +699,7 @@ Polymer({
requestID: this.inFlightRequestId_,
previewModifiable: this.documentModifiable,
fitToPageEnabled: this.getSettingValue('fitToPage'),
- scaleFactor: this.getSettingValue('customScaling') ?
- parseInt(this.getSettingValue('scaling'), 10) :
- 100,
+ scaleFactor: this.getScaleFactorForTicket_(),
shouldPrintBackgrounds: this.getSettingValue('cssBackground'),
shouldPrintSelectionOnly: this.getSettingValue('selectionOnly'),
// NOTE: Even though the remaining fields don't directly relate to the
@@ -646,8 +708,8 @@ Polymer({
collate: true,
copies: 1,
deviceName: this.destination.id,
- dpiHorizontal: (dpi && 'horizontal_dpi' in dpi) ? dpi.horizontal_dpi : 0,
- dpiVertical: (dpi && 'vertical_dpi' in dpi) ? dpi.vertical_dpi : 0,
+ dpiHorizontal: this.getDpiForTicket_('horizontal_dpi'),
+ dpiVertical: this.getDpiForTicket_('vertical_dpi'),
duplex: this.getSettingValue('duplex') ?
print_preview_new.DuplexMode.LONG_EDGE :
print_preview_new.DuplexMode.SIMPLEX,
@@ -668,8 +730,44 @@ Polymer({
print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
ticket.marginsCustom = this.getSettingValue('customMargins');
}
+ this.lastTicket_ = ticket;
this.fire('preview-start', this.inFlightRequestId_);
return this.nativeLayer_.getPreview(JSON.stringify(ticket));
},
+
+ /** @private */
+ onStateChange_: function() {
+ if ((this.state === print_preview_new.State.ERROR ||
+ this.state === print_preview_new.State.FATAL_ERROR) &&
+ this.getErrorMessage_() !== '') {
+ this.previewState = print_preview_new.PreviewAreaState.ERROR;
+ }
+ },
+
+ /** @return {string} The error message to display in the preview area. */
+ getErrorMessage_: function() {
+ switch (this.error) {
+ case print_preview_new.Error.INVALID_PRINTER:
+ return this.i18nAdvanced('invalidPrinterSettings', {
+ substitutions: [],
+ tags: ['BR'],
+ });
+ case print_preview_new.Error.UNSUPPORTED_PRINTER:
+ return this.i18nAdvanced('unsupportedCloudPrinter', {
+ substitutions: [],
+ tags: ['BR'],
+ });
+ // <if expr="chromeos">
+ case print_preview_new.Error.NO_DESTINATIONS:
+ return this.i18n('noDestinationsMessage');
+ // </if>
+ case print_preview_new.Error.NO_PLUGIN:
+ return this.i18n('noPlugin');
+ case print_preview_new.Error.PREVIEW_FAILED:
+ return this.i18n('previewFailed');
+ default:
+ return '';
+ }
+ },
});
diff --git a/chromium/chrome/browser/resources/print_preview/new/print_preview_search_box.html b/chromium/chrome/browser/resources/print_preview/new/print_preview_search_box.html
index 6a11d9b91a2..43ff9f6eddf 100644
--- a/chromium/chrome/browser/resources/print_preview/new/print_preview_search_box.html
+++ b/chromium/chrome/browser/resources/print_preview/new/print_preview_search_box.html
@@ -8,19 +8,18 @@
<dom-module id="print-preview-search-box">
<template>
- <style include="print-preview-shared">
+ <style include="print-preview-shared cr-input-style">
:host {
display: flex;
font-size: calc(13/15 * 1em);
--cr-input-row-container: {
- background-color: var(--google-grey-refresh-100);
min-height: 32px;
- };
+ }
--cr-input-error-display: none;
}
#icon {
- background-color: var(--google-grey-refresh-100);
+ background-color: var(--cr-input-background-color);
height: 30px;
margin-inline-end: 0;
margin-inline-start: 0;
diff --git a/chromium/chrome/browser/resources/print_preview/new/print_preview_shared_css.html b/chromium/chrome/browser/resources/print_preview/new/print_preview_shared_css.html
index 7b8ca983b79..249c00cf617 100644
--- a/chromium/chrome/browser/resources/print_preview/new/print_preview_shared_css.html
+++ b/chromium/chrome/browser/resources/print_preview/new/print_preview_shared_css.html
@@ -12,11 +12,26 @@
min-height: 38px;
};
--md-select-width: calc(100% - 17px);
- --print-preview-settings-border: 1px solid rgb(232, 234, 237);
+ --print-preview-settings-border: 1px solid var(--google-grey-200);
--print-preview-dialog-margin: 34px;
+ --print-preview-disabled-label: {
+ color: var(--paper-grey-600);
+ opacity: .65;
+ }
--cr-form-field-label-height: initial;
--cr-form-field-label-line-height: .75rem;
--destination-item-height: 32px;
+ --preview-area-background-color: var(--google-grey-200);
+ --preview-area-background-color-new: var(--google-grey-refresh-300);
+ }
+
+ :host-context([dark]) {
+ --preview-area-background-color: var(--google-grey-400);
+ --preview-area-background-color-new: var(--google-grey-refresh-700);
+ --print-preview-disabled-label: {
+ opacity: var(--cr-disabled-opacity);
+ }
+ --print-preview-settings-border: var(--cr-separator-line);
}
/* Default state ********************************************************/
@@ -50,10 +65,14 @@
a[href],
a[is='action-link'] {
- color: var(--google-blue-600);
+ color: var(--google-blue-600); /* Same in light and dark mode. */
text-decoration: none;
}
+ :host-context([dark]) :-webkit-any(a[href], a[is='action-link']) {
+ color: var(--cr-link-color);
+ }
+
print-preview-settings-section [slot=controls] > * {
margin-inline-start: 15px;
}
@@ -80,7 +99,7 @@
#dialog div[slot='button-container'] {
align-items: center;
- box-shadow: 0 -1px 1px 0 rgba(60, 64, 67, 0.3);
+ box-shadow: 0 -1px 1px 0 rgba(var(--cr-card-shadow-color-rgb), 0.3);
min-height: 64px;
padding-bottom: 0;
padding-top: 0;
diff --git a/chromium/chrome/browser/resources/print_preview/new/print_preview_sidebar.html b/chromium/chrome/browser/resources/print_preview/new/print_preview_sidebar.html
new file mode 100644
index 00000000000..3746a4a6118
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/print_preview_sidebar.html
@@ -0,0 +1,207 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/cr_container_shadow_behavior.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="chrome://resources/html/dark_mode.html">
+<link rel="import" href="chrome://resources/html/load_time_data.html">
+<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
+<link rel="import" href="../metrics.html">
+<link rel="import" href="../data/destination.html">
+<link rel="import" href="advanced_options_settings.html">
+<link rel="import" href="button_strip.html">
+<link rel="import" href="color_settings.html">
+<link rel="import" href="copies_settings.html">
+<link rel="import" href="destination_settings.html">
+<link rel="import" href="dpi_settings.html">
+<link rel="import" href="duplex_settings.html">
+<link rel="import" href="header.html">
+<link rel="import" href="header_new.html">
+<link rel="import" href="layout_settings.html">
+<link rel="import" href="media_size_settings.html">
+<link rel="import" href="margins_settings.html">
+<link rel="import" href="more_settings.html">
+<link rel="import" href="other_options_settings.html">
+<link rel="import" href="pages_per_sheet_settings.html">
+<link rel="import" href="pages_settings.html">
+<if expr="chromeos">
+ <link rel="import" href="pin_settings.html">
+</if>
+<link rel="import" href="print_preview_shared_css.html">
+<link rel="import" href="scaling_settings.html">
+<link rel="import" href="settings_behavior.html">
+<link rel="import" href="state.html">
+<link rel="import" href="strings.html">
+
+<if expr="not chromeos">
+ <link rel="import" href="link_container.html">
+</if>
+<dom-module id="print-preview-sidebar">
+ <template>
+ <style include="print-preview-shared cr-shared-style">
+ :host {
+ background-color: white;
+ border-inline-end: var(--print-preview-settings-border);
+ display: flex;
+ flex-direction: column;
+ }
+
+ :host-context([dark]) {
+ background-color: rgba(255, 255, 255, .04);
+ }
+
+ #container {
+ color: var(--cr-primary-text-color);
+ flex: 1;
+ overflow: overlay;
+ }
+
+ :host(:not([new-print-preview-layout])) #container {
+ padding-bottom: 16px;
+ }
+
+ :host([new-print-preview-layout]) #destinationSettings {
+ margin-top: 12px;
+ }
+
+ /* Print Preview uses lighter box-shadows compared to the default
+ * styling. */
+ :host([new-print-preview-layout]) #cr-container-shadow-top,
+ :host([new-print-preview-layout]) #cr-container-shadow-bottom {
+ box-shadow: inset 0 5px 3px -3px rgba(0, 0, 0, .2);
+ }
+
+ .settings-section {
+ display: block;
+ margin-bottom: 16px;
+ margin-top: 16px;
+ }
+
+<if expr="not chromeos">
+ :host(:not([new-print-preview-layout])) print-preview-link-container {
+ border-top: var(--print-preview-settings-border);
+ }
+</if>
+ </style>
+ <template is="dom-if" if="[[newPrintPreviewLayout]]">
+ <print-preview-header-new id="header" destination="[[destination]]"
+ cloud-print-error-message="[[cloudPrintErrorMessage]]"
+ error="[[error]]" state="[[state]]"
+ settings="[[settings]]" managed="[[controlsManaged]]">
+ </print-preview-header-new>
+ </template>
+ <template is="dom-if" if="[[!newPrintPreviewLayout]]">
+ <print-preview-header id="header" destination="[[destination]]"
+ cloud-print-error-message="[[cloudPrintErrorMessage]]"
+ error="[[error]]" state="[[state]]"
+ settings="[[settings]]" managed="[[controlsManaged]]">
+ </print-preview-header>
+ </template>
+ <div id="container" show-bottom-shadow$="[[newPrintPreviewLayout]]">
+ <print-preview-destination-settings id="destinationSettings"
+ cloud-print-interface="[[cloudPrintInterface]]" dark="[[dark_]]"
+ destination="{{destination}}" destination-state="{{destinationState}}"
+ error="{{error}}" settings="[[settings]]"
+ state="[[state]]" app-kiosk-mode="[[isInAppKioskMode_]]"
+ disabled="[[controlsDisabled_]]"
+ available class="settings-section">
+ </print-preview-destination-settings>
+<if expr="chromeos">
+ <print-preview-pin-settings state="[[state]]" settings="[[settings]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.pin.available]]" class="settings-section">
+ </print-preview-pin-settings>
+</if>
+ <print-preview-pages-settings settings="[[settings]]"
+ page-count="[[pageCount]]" disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.pages.available]]" class="settings-section">
+ </print-preview-pages-settings>
+ <print-preview-copies-settings settings="[[settings]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.copies.available]]" class="settings-section">
+ </print-preview-copies-settings>
+ <print-preview-layout-settings settings="[[settings]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.layout.available]]" class="settings-section">
+ </print-preview-layout-settings>
+ <print-preview-color-settings settings="[[settings]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.color.available]]" class="settings-section">
+ </print-preview-color-settings>
+ <print-preview-more-settings
+ settings-expanded-by-user="{{settingsExpandedByUser_}}"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!shouldShowMoreSettings_]]">
+ </print-preview-more-settings>
+ <iron-collapse id="moreSettings"
+ opened="[[shouldExpandSettings_(
+ settingsExpandedByUser_, shouldShowMoreSettings_)]]">
+ <print-preview-media-size-settings settings="[[settings]]"
+ capability="[[destination.capabilities.printer.media_size]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.mediaSize.available]]"
+ class="settings-section">
+ </print-preview-media-size-settings>
+ <print-preview-pages-per-sheet-settings settings="[[settings]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.pagesPerSheet.available]]"
+ class="settings-section">
+ </print-preview-pages-per-sheet-settings>
+ <print-preview-margins-settings settings="[[settings]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.margins.available]]"
+ class="settings-section">
+ </print-preview-margins-settings>
+ <print-preview-dpi-settings settings="[[settings]]"
+ capability="[[destination.capabilities.printer.dpi]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.dpi.available]]" class="settings-section">
+ </print-preview-dpi-settings>
+ <print-preview-scaling-settings settings="[[settings]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.scaling.available]]"
+ class="settings-section">
+ </print-preview-scaling-settings>
+ <print-preview-duplex-settings settings="[[settings]]"
+ disabled="[[controlsDisabled_]]" dark="[[dark_]]"
+ hidden$="[[!settings.duplex.available]]"
+ class="settings-section">
+ </print-preview-duplex-settings>
+ <print-preview-other-options-settings settings="[[settings]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.otherOptions.available]]"
+ class="settings-section">
+ </print-preview-other-options-settings>
+ <print-preview-advanced-options-settings
+ settings="[[settings]]" destination="[[destination]]"
+ disabled="[[controlsDisabled_]]"
+ hidden$="[[!settings.vendorItems.available]]"
+ class="settings-section">
+ </print-preview-advanced-options-settings>
+<if expr="not chromeos">
+ <template is="dom-if" if="[[newPrintPreviewLayout]]">
+ <print-preview-link-container destination="[[destination]]"
+ app-kiosk-mode="[[isInAppKioskMode_]]"
+ disabled="[[controlsDisabled_]]">
+ </print-preview-link-container>
+ </template>
+</if>
+ </iron-collapse>
+<if expr="not chromeos">
+ <template is="dom-if" if="[[!newPrintPreviewLayout]]">
+ <print-preview-link-container destination="[[destination]]"
+ app-kiosk-mode="[[isInAppKioskMode_]]"
+ disabled="[[controlsDisabled_]]">
+ </print-preview-link-container>
+ </template>
+</if>
+ </div>
+ <template is="dom-if" if="[[newPrintPreviewLayout]]">
+ <print-preview-button-strip destination="[[destination]]"
+ state="[[state]]">
+ </print-preview-button-strip>
+ </template>
+ </template>
+ <script src="print_preview_sidebar.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/print_preview/new/print_preview_sidebar.js b/chromium/chrome/browser/resources/print_preview/new/print_preview_sidebar.js
new file mode 100644
index 00000000000..1121d3c1244
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/new/print_preview_sidebar.js
@@ -0,0 +1,180 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+'use strict';
+
+/**
+ * Number of settings sections to show when "More settings" is collapsed.
+ * @type {number}
+ */
+const MAX_SECTIONS_TO_SHOW = 6;
+
+Polymer({
+ is: 'print-preview-sidebar',
+
+ behaviors: [
+ SettingsBehavior,
+ CrContainerShadowBehavior,
+ WebUIListenerBehavior,
+ ],
+
+ properties: {
+ cloudPrintErrorMessage: String,
+
+ /** @type {cloudprint.CloudPrintInterface} */
+ cloudPrintInterface: Object,
+
+ controlsManaged: Boolean,
+
+ /** @type {print_preview.Destination} */
+ destination: {
+ type: Object,
+ notify: true,
+ },
+
+ /** @private {!print_preview.DestinationState} */
+ destinationState: {
+ type: Number,
+ notify: true,
+ },
+
+ /** @type {!print_preview_new.Error} */
+ error: {
+ type: Number,
+ notify: true,
+ },
+
+ newPrintPreviewLayout: {
+ type: Boolean,
+ reflectToAttribute: true,
+ },
+
+ pageCount: Number,
+
+ /** @type {!print_preview_new.State} */
+ state: {
+ type: Number,
+ observer: 'onStateChanged_',
+ },
+
+ /** @private {boolean} */
+ controlsDisabled_: {
+ type: Boolean,
+ computed: 'computeControlsDisabled_(state)',
+ },
+
+ /** @private {boolean} */
+ dark_: {
+ type: Boolean,
+ value: function() {
+ return inDarkMode();
+ },
+ },
+
+ /** @private {boolean} */
+ isInAppKioskMode_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /** @private {boolean} */
+ settingsExpandedByUser_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /** @private {boolean} */
+ shouldShowMoreSettings_: {
+ type: Boolean,
+ computed: 'computeShouldShowMoreSettings_(settings.pages.available, ' +
+ 'settings.copies.available, settings.layout.available, ' +
+ 'settings.color.available, settings.mediaSize.available, ' +
+ 'settings.dpi.available, settings.margins.available, ' +
+ 'settings.pagesPerSheet.available, settings.scaling.available, ' +
+ 'settings.duplex.available, settings.otherOptions.available, ' +
+ 'settings.vendorItems.available)',
+ },
+ },
+
+ /** @override */
+ attached: function() {
+ this.addWebUIListener('dark-mode-changed', darkMode => {
+ this.dark_ = darkMode;
+ });
+ },
+
+ /**
+ * @param {boolean} appKioskMode
+ * @param {string} defaultPrinter The system default printer ID.
+ * @param {string} serializedDestinationSelectionRulesStr String with rules
+ * for selecting the default destination.
+ */
+ init: function(
+ appKioskMode, printerName, serializedDestinationSelectionRulesStr) {
+ this.isInAppKioskMode_ = appKioskMode;
+ this.$.destinationSettings.initDestinationStore(
+ printerName, serializedDestinationSelectionRulesStr);
+ },
+
+ /**
+ * @return {boolean} Whether the controls should be disabled.
+ * @private
+ */
+ computeControlsDisabled_: function() {
+ return this.state != print_preview_new.State.READY;
+ },
+
+ /**
+ * @return {boolean} Whether to show the "More settings" link.
+ * @private
+ */
+ computeShouldShowMoreSettings_: function() {
+ // Destination settings is always available. See if the total number of
+ // available sections exceeds the maximum number to show.
+ return [
+ 'pages', 'copies', 'layout', 'color', 'mediaSize', 'margins', 'color',
+ 'pagesPerSheet', 'scaling', 'dpi', 'duplex', 'otherOptions', 'vendorItems'
+ ].reduce((count, setting) => {
+ return this.getSetting(setting).available ? count + 1 : count;
+ }, 1) > MAX_SECTIONS_TO_SHOW;
+ },
+
+ /**
+ * @return {boolean} Whether the "more settings" collapse should be expanded.
+ * @private
+ */
+ shouldExpandSettings_: function() {
+ if (this.settingsExpandedByUser_ === undefined ||
+ this.shouldShowMoreSettings_ === undefined) {
+ return false;
+ }
+
+ // Expand the settings if the user has requested them expanded or if more
+ // settings is not displayed (i.e. less than 6 total settings available).
+ return this.settingsExpandedByUser_ || !this.shouldShowMoreSettings_;
+ },
+
+ onStateChanged_: function() {
+ if (this.state !== print_preview_new.State.PRINTING) {
+ return;
+ }
+
+ if (this.shouldShowMoreSettings_) {
+ print_preview.MetricsContext.printSettingsUi().record(
+ this.settingsExpandedByUser_ ?
+ print_preview.Metrics.PrintSettingsUiBucket
+ .PRINT_WITH_SETTINGS_EXPANDED :
+ print_preview.Metrics.PrintSettingsUiBucket
+ .PRINT_WITH_SETTINGS_COLLAPSED);
+ }
+ },
+
+ /** @return {boolean} Whether the system dialog link is available. */
+ systemDialogLinkAvailable: function() {
+ const linkContainer = this.$$('print-preview-link-container');
+ return !!linkContainer && linkContainer.systemDialogLinkAvailable();
+ },
+});
+})();
diff --git a/chromium/chrome/browser/resources/print_preview/new/provisional_destination_resolver.html b/chromium/chrome/browser/resources/print_preview/new/provisional_destination_resolver.html
index 94c26601cc0..2f09f5b313a 100644
--- a/chromium/chrome/browser/resources/print_preview/new/provisional_destination_resolver.html
+++ b/chromium/chrome/browser/resources/print_preview/new/provisional_destination_resolver.html
@@ -49,7 +49,7 @@
}
.extension-name {
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
display: flex;
flex: 1;
flex-direction: column;
diff --git a/chromium/chrome/browser/resources/print_preview/new/scaling_settings.html b/chromium/chrome/browser/resources/print_preview/new/scaling_settings.html
index 1daadae8808..58b147ee4bb 100644
--- a/chromium/chrome/browser/resources/print_preview/new/scaling_settings.html
+++ b/chromium/chrome/browser/resources/print_preview/new/scaling_settings.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/md_select_css.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="number_settings_section.html">
<link rel="import" href="print_preview_shared_css.html">
<link rel="import" href="select_behavior.html">
diff --git a/chromium/chrome/browser/resources/print_preview/new/scaling_settings.js b/chromium/chrome/browser/resources/print_preview/new/scaling_settings.js
index 9c1b5d3a641..a8526587b18 100644
--- a/chromium/chrome/browser/resources/print_preview/new/scaling_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/new/scaling_settings.js
@@ -39,7 +39,8 @@ Polymer({
/** @private {boolean} */
customSelected_: {
type: Boolean,
- computed: 'computeCustomSelected_(selectedValue)',
+ computed: 'computeCustomSelected_(settings.customScaling.*, ' +
+ 'settings.fitToPage.*)',
},
/** @private {boolean} */
@@ -64,6 +65,22 @@ Polymer({
/** @private {string} */
lastValidScaling_: '',
+ /**
+ * Whether the custom scaling setting has been set to true, but the custom
+ * input has not yet been expanded. Used to determine whether changes in the
+ * dropdown are due to user input or sticky settings.
+ * @private {boolean}
+ */
+ customScalingSettingSet_: false,
+
+ /**
+ * Whether the user has selected custom scaling in the dropdown, but the
+ * custom input has not yet been expanded. Used to determine whether to
+ * auto-focus the custom input.
+ * @private {boolean}
+ */
+ userSelectedCustomScaling_: false,
+
/** @override */
ready: function() {
this.ScalingValue = ScalingValue;
@@ -80,6 +97,11 @@ Polymer({
this.setSetting('fitToPage', false);
}
const isCustom = value === ScalingValue.CUSTOM.toString();
+ if (isCustom && !this.customScalingSettingSet_) {
+ this.userSelectedCustomScaling_ = true;
+ } else {
+ this.customScalingSettingSet_ = false;
+ }
this.setSetting('customScaling', isCustom);
if (isCustom) {
this.setSetting('scaling', this.currentValue_);
@@ -117,6 +139,8 @@ Polymer({
/** @type {boolean} */ (this.getSetting('customScaling').value);
if (!isCustom) {
this.updateScalingToValid_();
+ } else {
+ this.customScalingSettingSet_ = true;
}
this.selectedValue = isCustom ? ScalingValue.CUSTOM.toString() :
ScalingValue.DEFAULT.toString();
@@ -163,13 +187,17 @@ Polymer({
* @private
*/
computeCustomSelected_: function() {
- return this.selectedValue === ScalingValue.CUSTOM.toString();
+ return /** @type {boolean} */ (this.getSettingValue('customScaling')) &&
+ (!this.getSetting('fitToPage').available ||
+ !(/** @type {boolean} */ (this.getSettingValue('fitToPage'))));
},
/** @private */
onCollapseChanged_: function() {
- if (this.customSelected_) {
+ if (this.customSelected_ && this.userSelectedCustomScaling_) {
this.$$('print-preview-number-settings-section').getInput().focus();
}
+ this.customScalingSettingSet_ = false;
+ this.userSelectedCustomScaling_ = false;
},
});
diff --git a/chromium/chrome/browser/resources/print_preview/new/select_behavior.html b/chromium/chrome/browser/resources/print_preview/new/select_behavior.html
index f6ef6283e8e..2059526fab6 100644
--- a/chromium/chrome/browser/resources/print_preview/new/select_behavior.html
+++ b/chromium/chrome/browser/resources/print_preview/new/select_behavior.html
@@ -1,3 +1,5 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
<link rel="import" href="chrome://resources/html/cr.html">
<script src="select_behavior.js"></script>
diff --git a/chromium/chrome/browser/resources/print_preview/new/settings_behavior.html b/chromium/chrome/browser/resources/print_preview/new/settings_behavior.html
index 72cf371c35d..05564e632f9 100644
--- a/chromium/chrome/browser/resources/print_preview/new/settings_behavior.html
+++ b/chromium/chrome/browser/resources/print_preview/new/settings_behavior.html
@@ -1,3 +1,5 @@
<link rel="import" href="chrome://resources/html/assert.html">
+<link rel="import" href="model.html">
+
<script src="settings_behavior.js"></script>
diff --git a/chromium/chrome/browser/resources/print_preview/new/settings_behavior.js b/chromium/chrome/browser/resources/print_preview/new/settings_behavior.js
index 5935aa4ae05..64543135c10 100644
--- a/chromium/chrome/browser/resources/print_preview/new/settings_behavior.js
+++ b/chromium/chrome/browser/resources/print_preview/new/settings_behavior.js
@@ -3,6 +3,7 @@
// found in the LICENSE file.
cr.exportPath('print_preview_new');
+
/**
* |key| is the field in the serialized settings state that corresponds to the
* setting, or an empty string if the setting should not be saved in the
@@ -14,6 +15,7 @@ cr.exportPath('print_preview_new');
* available: boolean,
* setByPolicy: boolean,
* key: string,
+ * updatesPreview: boolean,
* }}
*/
print_preview_new.Setting;
@@ -31,6 +33,7 @@ print_preview_new.Setting;
* fitToPage: !print_preview_new.Setting,
* scaling: !print_preview_new.Setting,
* duplex: !print_preview_new.Setting,
+ * duplexShortEdge: !print_preview_new.Setting,
* cssBackground: !print_preview_new.Setting,
* selectionOnly: !print_preview_new.Setting,
* headerFooter: !print_preview_new.Setting,
@@ -39,6 +42,8 @@ print_preview_new.Setting;
* otherOptions: !print_preview_new.Setting,
* ranges: !print_preview_new.Setting,
* pagesPerSheet: !print_preview_new.Setting,
+ * pin: (print_preview_new.Setting|undefined),
+ * pinValue: (print_preview_new.Setting|undefined),
* }}
*/
print_preview_new.Settings;
@@ -47,10 +52,7 @@ print_preview_new.Settings;
const SettingsBehavior = {
properties: {
/** @type {print_preview_new.Settings} */
- settings: {
- type: Object,
- notify: true,
- },
+ settings: Object,
},
/**
@@ -58,10 +60,7 @@ const SettingsBehavior = {
* @return {print_preview_new.Setting} The setting object.
*/
getSetting: function(settingName) {
- const setting = /** @type {print_preview_new.Setting} */ (
- this.get(settingName, this.settings));
- assert(setting, 'Setting is missing: ' + settingName);
- return setting;
+ return print_preview.Model.getInstance().getSetting(settingName);
},
/**
@@ -69,37 +68,39 @@ const SettingsBehavior = {
* @return {*} The value of the setting, accounting for availability.
*/
getSettingValue: function(settingName) {
- const setting = this.getSetting(settingName);
- return setting.available ? setting.value : setting.unavailableValue;
+ return print_preview.Model.getInstance().getSettingValue(settingName);
},
/**
+ * Sets settings.settingName.value to |value|, unless updating the setting is
+ * disallowed by enterprise policy. Fires preview-setting-changed and
+ * sticky-setting-changed events if the update impacts the preview or requires
+ * an update to sticky settings.
* @param {string} settingName Name of the setting to set
* @param {*} value The value to set the setting to.
*/
setSetting: function(settingName, value) {
- const setting = this.getSetting(settingName);
- if (setting.setByPolicy) {
- return;
- }
- this.set(`settings.${settingName}.value`, value);
+ print_preview.Model.getInstance().setSetting(settingName, value);
},
/**
* @param {string} settingName Name of the setting to set
+ * @param {number} start
+ * @param {number} end
+ * @param {*} newValue The value to add (if any).
+ */
+ setSettingSplice: function(settingName, start, end, newValue) {
+ print_preview.Model.getInstance().setSettingSplice(
+ settingName, start, end, newValue);
+ },
+
+ /**
+ * Sets the validity of |settingName| to |valid|. If the validity is changed,
+ * fires a setting-valid-changed event.
+ * @param {string} settingName Name of the setting to set
* @param {boolean} valid Whether the setting value is currently valid.
*/
setSettingValid: function(settingName, valid) {
- const setting = this.getSetting(settingName);
- // Should not set the setting to invalid if it is not available, as there
- // is no way for the user to change the value in this case.
- if (!valid) {
- assert(setting.available, 'Setting is not available: ' + settingName);
- }
- const shouldFireEvent = valid != setting.valid;
- this.set(`settings.${settingName}.valid`, valid);
- if (shouldFireEvent) {
- this.fire('setting-valid-changed', valid);
- }
- }
+ print_preview.Model.getInstance().setSettingValid(settingName, valid);
+ },
};
diff --git a/chromium/chrome/browser/resources/print_preview/new/settings_section.html b/chromium/chrome/browser/resources/print_preview/new/settings_section.html
index 4bd296f5a3d..86b230dd146 100644
--- a/chromium/chrome/browser/resources/print_preview/new/settings_section.html
+++ b/chromium/chrome/browser/resources/print_preview/new/settings_section.html
@@ -25,11 +25,11 @@
}
::slotted([slot=title]) {
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
flex: none;
font-size: 1em;
line-height: calc(20/13 * 1em);
- width: 75px;
+ width: 100px;
}
</style>
<slot name="title"></slot>
diff --git a/chromium/chrome/browser/resources/print_preview/new/state.js b/chromium/chrome/browser/resources/print_preview/new/state.js
index 8526b5c7d49..f2c66d0bb8f 100644
--- a/chromium/chrome/browser/resources/print_preview/new/state.js
+++ b/chromium/chrome/browser/resources/print_preview/new/state.js
@@ -11,22 +11,41 @@ print_preview_new.State = {
HIDDEN: 2,
PRINTING: 3,
SYSTEM_DIALOG: 4,
- INVALID_TICKET: 5,
- INVALID_PRINTER: 6,
- FATAL_ERROR: 7,
- CLOSING: 8,
+ ERROR: 5,
+ FATAL_ERROR: 6,
+ CLOSING: 7,
+};
+
+/** @enum {number} */
+print_preview_new.Error = {
+ NONE: 0,
+ INVALID_TICKET: 1,
+ INVALID_PRINTER: 2,
+ UNSUPPORTED_PRINTER: 3,
+ NO_DESTINATIONS: 4,
+ NO_PLUGIN: 5,
+ PREVIEW_FAILED: 6,
+ PRINT_FAILED: 7,
+ CLOUD_PRINT_ERROR: 8,
};
Polymer({
is: 'print-preview-state',
properties: {
- /** @type {print_preview_new.State} */
+ /** @type {!print_preview_new.State} */
state: {
type: Number,
notify: true,
value: print_preview_new.State.NOT_READY,
},
+
+ /** @type {!print_preview_new.Error} */
+ error: {
+ type: Number,
+ notify: true,
+ value: print_preview_new.Error.NONE,
+ },
},
/** @param {print_preview_new.State} newState The state to transition to. */
@@ -36,11 +55,11 @@ Polymer({
assert(
this.state == print_preview_new.State.NOT_READY ||
this.state == print_preview_new.State.READY ||
- this.state == print_preview_new.State.INVALID_PRINTER);
+ this.state == print_preview_new.State.ERROR);
break;
case (print_preview_new.State.READY):
assert(
- this.state == print_preview_new.State.INVALID_TICKET ||
+ this.state == print_preview_new.State.ERROR ||
this.state == print_preview_new.State.NOT_READY ||
this.state == print_preview_new.State.PRINTING);
break;
@@ -58,12 +77,9 @@ Polymer({
this.state != print_preview_new.State.PRINTING &&
this.state != print_preview_new.State.CLOSING);
break;
- case (print_preview_new.State.INVALID_TICKET):
- assert(this.state == print_preview_new.State.READY);
- break;
- case (print_preview_new.State.INVALID_PRINTER):
+ case (print_preview_new.State.ERROR):
assert(
- this.state == print_preview_new.State.INVALID_PRINTER ||
+ this.state == print_preview_new.State.ERROR ||
this.state == print_preview_new.State.NOT_READY ||
this.state == print_preview_new.State.READY);
break;
@@ -72,5 +88,9 @@ Polymer({
break;
}
this.state = newState;
+ if (newState !== print_preview_new.State.ERROR &&
+ newState !== print_preview_new.State.FATAL_ERROR) {
+ this.error = print_preview_new.Error.NONE;
+ }
},
});
diff --git a/chromium/chrome/browser/resources/print_preview/print_preview_new.html b/chromium/chrome/browser/resources/print_preview/print_preview_new.html
index 2917106cf7d..8e957bb270d 100644
--- a/chromium/chrome/browser/resources/print_preview/print_preview_new.html
+++ b/chromium/chrome/browser/resources/print_preview/print_preview_new.html
@@ -1,13 +1,27 @@
<!doctype html>
-<html dir="$i18n{textdirection}" lang="$i18n{language}">
+<html dir="$i18n{textdirection}" lang="$i18n{language}" class="loading"
+ $i18n{dark} $i18n{newprintpreviewlayout}>
<head>
<meta charset="utf-8">
<style>
html {
+ background: rgb(232, 234, 237); /* --google-grey-200 */
/* Remove 300ms delay for 'click' event, when using touch interface. */
touch-action: manipulation;
}
+ html[dark] {
+ background: rgb(189, 193, 198); /* --google-grey-400 */
+ }
+
+ html[new-print-preview-layout] {
+ background: rgb(218, 220, 224); /* --google-grey-refresh-300 */
+ }
+
+ html[new-print-preview-layout][dark] {
+ background: rgb(95, 99, 104); /* --google-grey-refresh-700 */
+ }
+
html,
body {
height: 100%;
@@ -15,6 +29,38 @@
overflow: hidden;
width: 100%;
}
+
+ .loading body {
+ display: flex;
+ }
+
+ [new-print-preview-layout].loading body {
+ flex-direction: row-reverse;
+ }
+
+ .loading body::before {
+ background: white;
+ border-bottom-width: 0;
+ border-color: rgb(232, 234, 237);
+ border-inline-end-width: 1px;
+ border-inline-start-width: 0;
+ border-style: solid;
+ border-top-width: 0;
+ content: '';
+ display: block;
+ height: 100%;
+ width: 326px;
+ }
+
+ [new-print-preview-layout].loading body::before {
+ border-inline-end-width: 0;
+ border-inline-start-width: 1px;
+ }
+
+ [dark].loading body::before {
+ background: rgb(40, 41, 44);
+ border-color: rgba(255, 255, 255, .04);
+ }
</style>
</head>
<body>
@@ -22,5 +68,6 @@
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="import" href="new/app.html">
+ <link rel="import" href="chrome://resources/html/dark_mode.html">
</body>
</html>
diff --git a/chromium/chrome/browser/resources/print_preview/print_preview_resources.grd b/chromium/chrome/browser/resources/print_preview/print_preview_resources.grd
index 1f94fee136f..2eabd7b5242 100644
--- a/chromium/chrome/browser/resources/print_preview/print_preview_resources.grd
+++ b/chromium/chrome/browser/resources/print_preview/print_preview_resources.grd
@@ -23,12 +23,21 @@
file="new/app.js"
type="chrome_html"
preprocess="true" />
+ <structure name="IDR_PRINT_PREVIEW_NEW_PRINT_PREVIEW_SIDEBAR_HTML"
+ file="new/print_preview_sidebar.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_PRINT_PREVIEW_NEW_PRINT_PREVIEW_SIDEBAR_JS"
+ file="new/print_preview_sidebar.js"
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_PRINT_PREVIEW_NEW_MODEL_HTML"
file="new/model.html"
type="chrome_html" />
<structure name="IDR_PRINT_PREVIEW_NEW_MODEL_JS"
file="new/model.js"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_PRINT_PREVIEW_CLOUD_PRINT_INTERFACE_HTML"
file="cloud_print_interface.html"
type="chrome_html" />
@@ -185,6 +194,19 @@
<structure name="IDR_PRINT_PREVIEW_NEW_HEADER_JS"
file="new/header.js"
type="chrome_html" />
+ <structure name="IDR_PRINT_PREVIEW_NEW_HEADER_NEW_HTML"
+ file="new/header_new.html"
+ type="chrome_html" />
+ <structure name="IDR_PRINT_PREVIEW_NEW_HEADER_NEW_JS"
+ file="new/header_new.js"
+ type="chrome_html" />
+ <structure name="IDR_PRINT_PREVIEW_NEW_BUTTON_STRIP_HTML"
+ file="new/button_strip.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_PRINT_PREVIEW_NEW_BUTTON_STRIP_JS"
+ file="new/button_strip.js"
+ type="chrome_html" />
<structure name="IDR_PRINT_PREVIEW_NEW_SETTINGS_BEHAVIOR_HTML"
file="new/settings_behavior.html"
type="chrome_html" />
@@ -223,16 +245,27 @@
type="chrome_html" />
<structure name="IDR_PRINT_PREVIEW_NEW_DESTINATION_SELECT_HTML"
file="new/destination_select.html"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_PRINT_PREVIEW_NEW_DESTINATION_SELECT_JS"
file="new/destination_select.js"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
<structure name="IDR_PRINT_PREVIEW_NEW_DESTINATION_SETTINGS_HTML"
file="new/destination_settings.html"
type="chrome_html" />
<structure name="IDR_PRINT_PREVIEW_NEW_DESTINATION_SETTINGS_JS"
file="new/destination_settings.js"
- type="chrome_html" />
+ type="chrome_html"
+ preprocess="true" />
+ <if expr="chromeos">
+ <structure name="IDR_PRINT_PREVIEW_NEW_PIN_SETTINGS_HTML"
+ file="new/pin_settings.html"
+ type="chrome_html" />
+ <structure name="IDR_PRINT_PREVIEW_NEW_PIN_SETTINGS_JS"
+ file="new/pin_settings.js"
+ type="chrome_html" />
+ </if>
<structure name="IDR_PRINT_PREVIEW_NEW_PAGES_SETTINGS_HTML"
file="new/pages_settings.html"
type="chrome_html" />
@@ -275,6 +308,12 @@
<structure name="IDR_PRINT_PREVIEW_NEW_DPI_SETTINGS_JS"
file="new/dpi_settings.js"
type="chrome_html" />
+ <structure name="IDR_PRINT_PREVIEW_NEW_DUPLEX_SETTINGS_HTML"
+ file="new/duplex_settings.html"
+ type="chrome_html" />
+ <structure name="IDR_PRINT_PREVIEW_NEW_DUPLEX_SETTINGS_JS"
+ file="new/duplex_settings.js"
+ type="chrome_html" />
<structure name="IDR_PRINT_PREVIEW_NEW_SCALING_SETTINGS_HTML"
file="new/scaling_settings.html"
type="chrome_html" />
diff --git a/chromium/chrome/browser/resources/print_preview/print_preview_utils.html b/chromium/chrome/browser/resources/print_preview/print_preview_utils.html
index 1e8d2bd8a12..bca9791024a 100644
--- a/chromium/chrome/browser/resources/print_preview/print_preview_utils.html
+++ b/chromium/chrome/browser/resources/print_preview/print_preview_utils.html
@@ -1 +1,5 @@
+<link rel="import" href="chrome://resources/html/dark_mode.html">
+<link rel="import" href="chrome://resources/html/util.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html">
+
<script src="print_preview_utils.js"></script>
diff --git a/chromium/chrome/browser/resources/print_preview/print_preview_utils.js b/chromium/chrome/browser/resources/print_preview/print_preview_utils.js
index a17e8f62bdc..9d84d07311e 100644
--- a/chromium/chrome/browser/resources/print_preview/print_preview_utils.js
+++ b/chromium/chrome/browser/resources/print_preview/print_preview_utils.js
@@ -56,3 +56,26 @@ function getStringForCurrentLocale(localizedStrings) {
function observerDepsDefined(args) {
return args.every(arg => arg !== undefined);
}
+
+/**
+ * Returns background images (icon and dropdown arrow) for use in a md-select.
+ * @param {!Polymer.IronIconsetSvg} iconset The iconset the icon is in.
+ * @param {string} iconName The icon name
+ * @param {!HTMLElement} el The element that contains the select.
+ * @return {string} String containing inlined SVG of the icon and
+ * url(path_to_arrow) separated by a comma.
+ */
+function getSelectDropdownBackground(iconset, iconName, el) {
+ const serializer = new XMLSerializer();
+ const iconElement = iconset.createIcon(iconName, isRTL());
+ const fillColor = getComputedStyle(el).getPropertyValue(
+ inDarkMode() ? '--google-grey-refresh-500' : '--google-grey-600');
+ iconElement.style.fill = fillColor;
+ const serializedIcon = serializer.serializeToString(iconElement);
+ const uri = encodeURIComponent(serializedIcon);
+ const arrowDownPath = inDarkMode() ?
+ 'chrome://resources/images/dark/arrow_down.svg' :
+ 'chrome://resources/images/arrow_down.svg';
+ return `url("data:image/svg+xml;charset=utf-8,${uri}"),` +
+ `url("${arrowDownPath}")`;
+}
diff --git a/chromium/chrome/browser/resources/quota_internals/main.html b/chromium/chrome/browser/resources/quota_internals/main.html
index 6683271511b..a1a1b11a5dc 100644
--- a/chromium/chrome/browser/resources/quota_internals/main.html
+++ b/chromium/chrome/browser/resources/quota_internals/main.html
@@ -13,7 +13,6 @@ found in the LICENSE file.
<script src="chrome://resources/js/util.js"></script>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/cr/event_target.js"></script>
-<script src="chrome://resources/js/load_time_data.js"></script>
<link rel="stylesheet" href="chrome://resources/css/tabs.css">
<link rel="stylesheet" href="chrome://resources/css/tree.css">
@@ -24,7 +23,6 @@ found in the LICENSE file.
<script src="chrome://quota-internals/message_dispatcher.js"></script>
<script src="chrome://quota-internals/event_handler.js"></script>
-<script src="chrome://quota-internals/strings.js"></script>
<body>
diff --git a/chromium/chrome/browser/resources/reset_password/BUILD.gn b/chromium/chrome/browser/resources/reset_password/BUILD.gn
index 1d0f2ebdd55..2a2f75f6e12 100644
--- a/chromium/chrome/browser/resources/reset_password/BUILD.gn
+++ b/chromium/chrome/browser/resources/reset_password/BUILD.gn
@@ -12,12 +12,8 @@ js_type_check("closure_compile") {
js_library("reset_password") {
deps = [
+ "//chrome/browser/ui/webui/reset_password:mojo_bindings_js_externs",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:util",
]
- extra_deps = [ "//chrome/browser/ui/webui/reset_password:mojo_bindings_js" ]
- externs_list = [
- "$root_gen_dir/chrome/browser/ui/webui/reset_password/reset_password.mojom.externs.js",
- "$externs_path/mojo.js",
- ]
}
diff --git a/chromium/chrome/browser/resources/reset_password/reset_password.html b/chromium/chrome/browser/resources/reset_password/reset_password.html
index b68848f6c0c..60838025330 100644
--- a/chromium/chrome/browser/resources/reset_password/reset_password.html
+++ b/chromium/chrome/browser/resources/reset_password/reset_password.html
@@ -9,9 +9,9 @@
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
- <script src="chrome://resources/js/mojo_bindings.js"></script>
+ <script src="chrome://resources/js/mojo_bindings_lite.js"></script>
<script src="chrome://resources/js/util.js"></script>
- <script src="reset_password.mojom.js"></script>
+ <script src="reset_password.mojom-lite.js"></script>
<script src="reset_password.js"></script>
<style>
html {
diff --git a/chromium/chrome/browser/resources/reset_password/reset_password.js b/chromium/chrome/browser/resources/reset_password/reset_password.js
index df5c5f7e775..15611b4d0e8 100644
--- a/chromium/chrome/browser/resources/reset_password/reset_password.js
+++ b/chromium/chrome/browser/resources/reset_password/reset_password.js
@@ -8,13 +8,11 @@
*/
(function() {
-/** @type {mojom.ResetPasswordHandler} */
+/** @type {mojom.ResetPasswordHandlerProxy} */
let uiHandler;
function initialize() {
- uiHandler = new mojom.ResetPasswordHandlerPtr;
- Mojo.bindInterface(
- mojom.ResetPasswordHandler.name, mojo.makeRequest(uiHandler).handle);
+ uiHandler = mojom.ResetPasswordHandler.getProxy();
/** @type {?HTMLElement} */
const resetPasswordButton = $('reset-password-button');
diff --git a/chromium/chrome/browser/resources/safe_browsing/download_file_types.asciipb b/chromium/chrome/browser/resources/safe_browsing/download_file_types.asciipb
index 1bc901628ab..1f05f90e81a 100644
--- a/chromium/chrome/browser/resources/safe_browsing/download_file_types.asciipb
+++ b/chromium/chrome/browser/resources/safe_browsing/download_file_types.asciipb
@@ -8,7 +8,7 @@
##
## Top level settings
##
-version_id: 33
+version_id: 34
sampled_ping_probability: 0.01
max_archived_binaries_to_report: 10
default_file_type {
@@ -2807,6 +2807,16 @@ file_types {
inspection_type: DMG
}
file_types {
+ extension: "dylib"
+ uma_value: 357
+ ping_setting: FULL_PING
+ platform_settings {
+ platform: PLATFORM_MAC
+ danger_level: ALLOW_ON_USER_GESTURE
+ auto_open_hint: DISALLOW_AUTO_OPEN
+ }
+}
+file_types {
extension: "img"
uma_value: 247
ping_setting: FULL_PING
@@ -2829,25 +2839,25 @@ file_types {
inspection_type: DMG
}
file_types {
- extension: "mobileconfig"
- uma_value: 356
+ extension: "ndif"
+ uma_value: 258
ping_setting: FULL_PING
platform_settings {
platform: PLATFORM_MAC
danger_level: ALLOW_ON_USER_GESTURE
auto_open_hint: DISALLOW_AUTO_OPEN
}
+ inspection_type: DMG
}
file_types {
- extension: "ndif"
- uma_value: 258
+ extension: "service"
+ uma_value: 358
ping_setting: FULL_PING
platform_settings {
platform: PLATFORM_MAC
danger_level: ALLOW_ON_USER_GESTURE
auto_open_hint: DISALLOW_AUTO_OPEN
}
- inspection_type: DMG
}
file_types {
extension: "smi"
@@ -2910,7 +2920,40 @@ file_types {
# Automator action
extension: "action"
uma_value: 158
- ping_setting: SAMPLED_PING
+ ping_setting: FULL_PING
+ platform_settings {
+ platform: PLATFORM_MAC
+ danger_level: ALLOW_ON_USER_GESTURE
+ auto_open_hint: DISALLOW_AUTO_OPEN
+ }
+}
+file_types {
+ # Automator action
+ extension: "definition"
+ uma_value: 359
+ ping_setting: FULL_PING
+ platform_settings {
+ platform: PLATFORM_MAC
+ danger_level: ALLOW_ON_USER_GESTURE
+ auto_open_hint: DISALLOW_AUTO_OPEN
+ }
+}
+file_types {
+ # Automator action
+ extension: "wflow"
+ uma_value: 360
+ ping_setting: FULL_PING
+ platform_settings {
+ platform: PLATFORM_MAC
+ danger_level: ALLOW_ON_USER_GESTURE
+ auto_open_hint: DISALLOW_AUTO_OPEN
+ }
+}
+file_types {
+ # Automator action
+ extension: "caction"
+ uma_value: 361
+ ping_setting: FULL_PING
platform_settings {
platform: PLATFORM_MAC
danger_level: ALLOW_ON_USER_GESTURE
@@ -3040,7 +3083,7 @@ file_types {
# Automator workflow
extension: "workflow"
uma_value: 170
- ping_setting: SAMPLED_PING
+ ping_setting: FULL_PING
platform_settings {
platform: PLATFORM_MAC
danger_level: ALLOW_ON_USER_GESTURE
@@ -3059,6 +3102,46 @@ file_types {
}
inspection_type: ZIP
}
+file_types {
+ extension: "mobileconfig"
+ uma_value: 356
+ ping_setting: FULL_PING
+ platform_settings {
+ platform: PLATFORM_MAC
+ danger_level: ALLOW_ON_USER_GESTURE
+ auto_open_hint: DISALLOW_AUTO_OPEN
+ }
+}
+file_types {
+ extension: "configprofile"
+ uma_value: 362
+ ping_setting: FULL_PING
+ platform_settings {
+ platform: PLATFORM_MAC
+ danger_level: ALLOW_ON_USER_GESTURE
+ auto_open_hint: DISALLOW_AUTO_OPEN
+ }
+}
+file_types {
+ extension: "internetconnect"
+ uma_value: 363
+ ping_setting: FULL_PING
+ platform_settings {
+ platform: PLATFORM_MAC
+ danger_level: ALLOW_ON_USER_GESTURE
+ auto_open_hint: DISALLOW_AUTO_OPEN
+ }
+}
+file_types {
+ extension: "networkconnect"
+ uma_value: 364
+ ping_setting: FULL_PING
+ platform_settings {
+ platform: PLATFORM_MAC
+ danger_level: ALLOW_ON_USER_GESTURE
+ auto_open_hint: DISALLOW_AUTO_OPEN
+ }
+}
##
diff --git a/chromium/chrome/browser/resources/settings/BUILD.gn b/chromium/chrome/browser/resources/settings/BUILD.gn
index b1c488cfce3..8acfedc59ca 100644
--- a/chromium/chrome/browser/resources/settings/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/BUILD.gn
@@ -106,12 +106,14 @@ group("closure_compile") {
deps += [
"android_apps_page:closure_compile",
"bluetooth_page:closure_compile",
+ "chromeos:closure_compile",
"crostini_page:closure_compile",
"date_time_page:closure_compile",
"device_page:closure_compile",
"internet_page:closure_compile",
"kiosk_next_shell_page:closure_compile",
"multidevice_page:closure_compile",
+ "plugin_vm_page:closure_compile",
]
}
}
diff --git a/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.html b/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.html
index 8b2bf090169..82b612860f3 100644
--- a/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.html
+++ b/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.html
@@ -2,7 +2,6 @@
<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../settings_shared_css.html">
@@ -17,18 +16,18 @@
<dom-module id="settings-a11y-page">
<template>
<style include="settings-shared"></style>
- <settings-toggle-button
- id="a11yImageLabels"
- hidden$="[[!showAccessibilityLabelsSetting_]]"
- pref="{{prefs.settings.a11y.enable_accessibility_image_labels}}"
- on-change="onToggleAccessibilityImageLabels_"
- label="$i18n{accessibleImageLabelsTitle}"
- sub-label="$i18n{accessibleImageLabelsSubtitle}">
- </settings-toggle-button>
<if expr="chromeos">
<settings-animated-pages id="pages" current-route="{{currentRoute}}"
section="a11y" focus-config="[[focusConfig_]]">
<div route-path="default">
+ <settings-toggle-button
+ id="a11yImageLabels"
+ hidden$="[[!showAccessibilityLabelsSetting_]]"
+ pref="{{prefs.settings.a11y.enable_accessibility_image_labels}}"
+ on-change="onToggleAccessibilityImageLabels_"
+ label="$i18n{accessibleImageLabelsTitle}"
+ sub-label="$i18n{accessibleImageLabelsSubtitle}">
+ </settings-toggle-button>
<settings-toggle-button id="optionsInMenuToggle"
label="$i18n{optionsInMenuLabel}"
pref="{{prefs.settings.a11y.enable_menu}}">
@@ -60,6 +59,14 @@
</if>
<if expr="not chromeos">
+ <settings-toggle-button
+ id="a11yImageLabels"
+ hidden$="[[!showAccessibilityLabelsSetting_]]"
+ pref="{{prefs.settings.a11y.enable_accessibility_image_labels}}"
+ on-change="onToggleAccessibilityImageLabels_"
+ label="$i18n{accessibleImageLabelsTitle}"
+ sub-label="$i18n{accessibleImageLabelsSubtitle}">
+ </settings-toggle-button>
<cr-link-row class="hr" label="$i18n{moreFeaturesLink}"
on-click="onMoreFeaturesLinkClick_" sub-label="$i18n{a11yWebStore}"
external></cr-link-row>
diff --git a/chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html b/chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html
index 4139346283a..395f045399c 100644
--- a/chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html
+++ b/chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html
@@ -1,26 +1,26 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../controls/settings_slider.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
-<link rel="import" href="../settings_vars_css.html">
<link rel="import" href="tts_subpage.html">
<dom-module id="settings-manage-a11y-page">
<template>
<style include="settings-shared">
h2 {
- padding-inline-start: var(--settings-box-row-padding);
+ padding-inline-start: var(--cr-section-padding);
}
.sub-item {
- margin-inline-start: var(--settings-indent-width);
+ margin-inline-start: var(--cr-section-indent-width);
}
h2 ~ .settings-box,
@@ -29,8 +29,8 @@
iron-collapse .settings-box,
iron-collapse settings-toggle-button,
iron-collapse cr-link-row {
- margin-inline-end: var(--settings-box-row-padding);
- margin-inline-start: var(--settings-box-row-indent);
+ margin-inline-end: var(--cr-section-padding);
+ margin-inline-start: var(--cr-section-indent-padding);
padding-inline-end: 0;
padding-inline-start: 0;
}
@@ -50,13 +50,8 @@
label="$i18n{chromeVoxLabel}">
</settings-toggle-button>
<iron-collapse opened="[[prefs.settings.accessibility.value]]">
- <div class="settings-box"
- on-click="onChromeVoxSettingsTap_" actionable>
- <div class="start" aria-hidden="true">$i18n{chromeVoxOptionsLabel}</div>
- <paper-icon-button-light class="icon-external">
- <button aria-label="$i18n{chromeVoxOptionsLabel}"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row class="settings-box" on-click="onChromeVoxSettingsTap_"
+ label="$i18n{chromeVoxOptionsLabel}" external></cr-link-row>
</iron-collapse>
<settings-toggle-button
pref="{{prefs.settings.a11y.select_to_speak}}"
@@ -68,15 +63,8 @@
'$i18nPolymer{selectToSpeakDescriptionWithoutKeyboard}')]]">
</settings-toggle-button>
<iron-collapse opened="[[prefs.settings.a11y.select_to_speak.value]]">
- <div class="settings-box"
- on-click="onSelectToSpeakSettingsTap_" actionable>
- <div class="start" aria-hidden="true">
- $i18n{selectToSpeakOptionsLabel}
- </div>
- <paper-icon-button-light class="icon-external">
- <button aria-label="$i18n{selectToSpeakOptionsLabel}"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row class="settings-box" on-click="onSelectToSpeakSettingsTap_"
+ label="$i18n{selectToSpeakOptionsLabel}" external></cr-link-row>
</iron-collapse>
<cr-link-row class="hr" label="$i18n{manageTtsSettings}"
@@ -172,18 +160,14 @@
disabled="[[!prefs.settings.a11y.autoclick.value]]">
</settings-dropdown-menu>
</div>
+ <div class="sub-item">
+ <settings-toggle-button class="continuation sub-item"
+ hidden$="[[!prefs.settings.a11y.autoclick.value]]"
+ pref="{{prefs.settings.a11y.autoclick_stabilize_position}}"
+ label="$i18n{autoclickStabilizeCursorPosition}">
+ </settings-toggle-button>
+ </div>
<template is="dom-if" if="[[showExperimentalAutoclick_]]">
- <div class="settings-box continuation"
- hidden$="[[!prefs.settings.a11y.autoclick.value]]">
- <div class="start sub-item" id="autoclickEventTypeLabel">
- $i18n{autoclickEventTypeLabel}
- </div>
- <settings-dropdown-menu aria-labeledby="autoclickEventTypeLabel"
- pref="{{prefs.settings.a11y.autoclick_event_type}}"
- menu-options="[[autoClickEventTypeOptions_]]"
- disabled="[[!prefs.settings.a11y.autoclick.value]]">
- </settings-dropdown-menu>
- </div>
<div class="sub-item">
<settings-toggle-button class="continuation sub-item"
hidden$="[[!prefs.settings.a11y.autoclick.value]]"
@@ -247,10 +231,9 @@
$i18n{a11yWebStore}
</div>
</div>
- <paper-icon-button-light class="icon-external">
- <button actionable aria-label="$i18n{additionalFeaturesTitle}"
- aria-describedby="moreFeaturesSecondary"></button>
- </paper-icon-button-light>
+ <cr-icon-button actionable class="icon-external"
+ aria-label="$i18n{additionalFeaturesTitle}"
+ aria-describedby="moreFeaturesSecondary"></cr-icon-button>
</a>
</template>
</template>
diff --git a/chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.js b/chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.js
index 2e55dbb64de..e3b2fb0743b 100644
--- a/chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.js
+++ b/chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.js
@@ -69,44 +69,6 @@ Polymer({
},
},
- autoClickEventTypeOptions_: {
- readOnly: true,
- type: Array,
- value: function() {
- // These values correspond to the i18n values in settings_strings.grdp
- // and the enums in accessibility_controller.mojom, AutoclickEventType.
- // If these values get changed then those strings need to be changed as
- // well.
- return [
- {
- // mojom::AutoclickEventType::kLeftClick
- value: 0,
- name: loadTimeData.getString('autoclickEventTypeLeftClick')
- },
- {
- // mojom::AutoclickEventType::kRightClick
- value: 1,
- name: loadTimeData.getString('autoclickEventTypeRightClick')
- },
- {
- // mojom::AutoclickEventType::kDragAndDrop
- value: 2,
- name: loadTimeData.getString('autoclickEventTypeDragAndDrop')
- },
- {
- // mojom::AutoclickEventType::kDoubleClick
- value: 3,
- name: loadTimeData.getString('autoclickEventTypeDoubleClick')
- },
- {
- // mojom::AutoclickEventType::kNoAction
- value: 4,
- name: loadTimeData.getString('autoclickEventTypeNoAction')
- },
- ];
- },
- },
-
autoClickMovementThresholdOptions_: {
readOnly: true,
type: Array,
diff --git a/chromium/chrome/browser/resources/settings/a11y_page/tts_subpage.html b/chromium/chrome/browser/resources/settings/a11y_page/tts_subpage.html
index 8d105fb8df4..5866fcc1539 100644
--- a/chromium/chrome/browser/resources/settings/a11y_page/tts_subpage.html
+++ b/chromium/chrome/browser/resources/settings/a11y_page/tts_subpage.html
@@ -1,7 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"
<link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
@@ -10,18 +11,17 @@
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../languages_page/languages_browser_proxy.html">
<link rel="import" href="../settings_shared_css.html">
-<link rel="import" href="../settings_vars_css.html">
<dom-module id="settings-tts-subpage">
<template>
<style include="settings-shared md-select">
h2 {
- padding-inline-start: var(--settings-box-row-padding);
+ padding-inline-start: var(--cr-section-padding);
}
.settings-box {
- margin-inline-end: var(--settings-box-row-padding);
- margin-inline-start: var(--settings-box-row-indent);
+ margin-inline-end: var(--cr-section-padding);
+ margin-inline-start: var(--cr-section-indent-padding);
padding-inline-end: 0;
padding-inline-start: 0;
}
@@ -88,7 +88,8 @@
</div>
<div class="settings-box continuation">
<cr-input id="previewInput" label="$i18n{textToSpeechPreviewInputLabel}"
- value="{{previewText_}}">
+ value="{{previewText_}}"
+ disabled="[[isPreviewing_]]">
<paper-button on-click="onPreviewTtsClick_"
disabled$="[[!enablePreviewButton_(allVoices, isPreviewing_,
previewText_)]]"
diff --git a/chromium/chrome/browser/resources/settings/about_page/about_page.html b/chromium/chrome/browser/resources/settings/about_page/about_page.html
index d0c98a66507..bb8758591da 100644
--- a/chromium/chrome/browser/resources/settings/about_page/about_page.html
+++ b/chromium/chrome/browser/resources/settings/about_page/about_page.html
@@ -11,6 +11,7 @@
<link rel="import" href="../settings_page/settings_section.html">
<link rel="import" href="../settings_page_css.html">
<link rel="import" href="../settings_shared_css.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/assert.html">
@@ -26,10 +27,6 @@
<link rel="import" href="../reset_page/powerwash_dialog.html">
</if>
-<if expr="_google_chrome and is_macosx">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
-</if>
-
<dom-module id="settings-about-page">
<template>
<style include="settings-shared settings-page-styles">
@@ -57,9 +54,10 @@
margin-inline-end: var(--about-page-image-space);
}
- iron-icon {
+ .icon-container {
margin-inline-end: var(--about-page-image-space);
min-width: 32px; /* The width of the product-logo img. */
+ text-align: center;
}
iron-icon[icon='settings:check-circle'] {
@@ -105,19 +103,21 @@
src URL -->
<!-- Set the icon from the iconset (when it's obsolete/EOL and
when update is done) or set the src (when it's updating). -->
- <iron-icon
- hidden="[[!shouldShowIcons_(showUpdateStatus_)]]"
+ <div class="icon-container"
+ hidden="[[!shouldShowIcons_(showUpdateStatus_)]]">
+ <iron-icon
<if expr="not chromeos">
- icon$="[[getUpdateStatusIcon_(
- obsoleteSystemInfo_, currentUpdateStatusEvent_)]]"
- src="[[getThrobberSrcIfUpdating_(obsoleteSystemInfo_, currentUpdateStatusEvent_)]]">
+ icon$="[[getUpdateStatusIcon_(
+ obsoleteSystemInfo_, currentUpdateStatusEvent_)]]"
+ src="[[getThrobberSrcIfUpdating_(obsoleteSystemInfo_, currentUpdateStatusEvent_)]]">
</if>
<if expr="chromeos">
- icon$="[[getUpdateStatusIcon_(
- hasEndOfLife_, currentUpdateStatusEvent_)]]"
- src="[[getThrobberSrcIfUpdating_(hasEndOfLife_, currentUpdateStatusEvent_)]]">
+ icon$="[[getUpdateStatusIcon_(
+ hasEndOfLife_, currentUpdateStatusEvent_)]]"
+ src="[[getThrobberSrcIfUpdating_(hasEndOfLife_, currentUpdateStatusEvent_)]]">
</if>
- </iron-icon>
+ </iron-icon>
+ </div>
<div class="start padded">
<div id="updateStatusMessage" hidden="[[!showUpdateStatus_]]">
<div
@@ -189,9 +189,8 @@
</a>
</div>
</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-labelledby="aboutTPMFirmwareUpdate"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-labelledby="aboutTPMFirmwareUpdate"></cr-icon-button>
</div>
</if>
<if expr="_google_chrome and is_macosx">
@@ -208,12 +207,10 @@
$i18n{learnMore}
</a>
</div>
- <paper-icon-button-light class="subpage-arrow"
- hidden="[[!promoteUpdaterStatus_.actionable]]">
- <button disabled="[[promoteUpdaterStatus_.disabled]]"
- aria-label$="[[promoteUpdaterStatus_.text]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ hidden$="[[!promoteUpdaterStatus_.actionable]]"
+ disabled="[[promoteUpdaterStatus_.disabled]]"
+ aria-label$="[[promoteUpdaterStatus_.text]]"></cr-icon-button>
</div>
</template>
</if>
@@ -228,6 +225,9 @@
on-click="onDetailedBuildInfoTap_"
label="$i18n{aboutDetailedBuildInfo}"></cr-link-row>
</if>
+ <cr-link-row class="hr" on-click="onManagementPageTap_"
+ start-icon="cr:domain" label="$i18n{managementPage}"
+ hidden$="[[!isManaged_]]"></cr-link-row>
</div>
<if expr="chromeos">
<template is="dom-if" route-path="/help/details">
diff --git a/chromium/chrome/browser/resources/settings/about_page/about_page.js b/chromium/chrome/browser/resources/settings/about_page/about_page.js
index df989aa3f59..7f9047f7226 100644
--- a/chromium/chrome/browser/resources/settings/about_page/about_page.js
+++ b/chromium/chrome/browser/resources/settings/about_page/about_page.js
@@ -29,6 +29,18 @@ Polymer({
},
},
+ /**
+ * Whether the browser/ChromeOS is managed by their organization
+ * through enterprise policies.
+ * @private
+ */
+ isManaged_: {
+ type: Boolean,
+ value: function() {
+ return loadTimeData.getBoolean('isManaged');
+ },
+ },
+
// <if expr="chromeos">
/** @private */
hasCheckedForUpdates_: {
@@ -495,6 +507,11 @@ Polymer({
return this.currentUpdateStatusEvent_.status == status;
},
+ /** @private */
+ onManagementPageTap_: function() {
+ window.location.href = 'chrome://management';
+ },
+
// <if expr="chromeos">
/**
* @return {boolean}
diff --git a/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.html b/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.html
index a7d73caf6ae..bccb0f2a902 100644
--- a/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.html
+++ b/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.html
@@ -1,10 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../prefs/prefs_behavior.html">
<link rel="import" href="../settings_page/settings_animated_pages.html">
@@ -34,11 +34,9 @@
icon-aria-label="$i18n{androidAppsPageTitle}">
</cr-policy-pref-indicator>
<template is="dom-if" if="[[androidAppsInfo.playStoreEnabled]]">
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{androidAppsPageTitle}"
- aria-describedby="secondaryText">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{androidAppsPageTitle}"
+ aria-describedby="secondaryText"></cr-icon-button>
</template>
<template is="dom-if" if="[[!androidAppsInfo.playStoreEnabled]]">
<div class="separator"></div>
@@ -53,9 +51,8 @@
</div>
</template>
<template is="dom-if" if="[[!havePlayStoreApp]]" restamp>
- <cr-link-row id="manageApps" icon-class="icon-external"
- label="$i18n{androidAppsManageApps}"
- on-click="onManageAndroidAppsTap_">
+ <cr-link-row id="manageApps" label="$i18n{androidAppsManageApps}"
+ on-click="onManageAndroidAppsTap_" external>
</cr-link-row>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.js b/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.js
index f84e0277430..a79ba938237 100644
--- a/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.js
+++ b/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.js
@@ -31,7 +31,7 @@ Polymer({
if (settings.routes.ANDROID_APPS_DETAILS) {
map.set(
settings.routes.ANDROID_APPS_DETAILS.path,
- '#android-apps .subpage-arrow button');
+ '#android-apps .subpage-arrow');
}
return map;
},
diff --git a/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.html b/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.html
index 7f5fe396abb..f27ac898cdd 100644
--- a/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.html
+++ b/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.html
@@ -6,7 +6,6 @@
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="android_apps_browser_proxy.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../prefs/prefs_behavior.html">
@@ -24,12 +23,8 @@
</template>
<template is="dom-if" if="[[allowRemove_(prefs.arc.enabled.*)]]">
- <div id="remove" class="settings-box" actionable on-click="onRemoveTap_">
- <div class="start">$i18n{androidAppsRemove}</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{androidAppsRemove}"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="remove" class="hr" on-click="onRemoveTap_"
+ label="$i18n{androidAppsRemove}"></cr-link-row>
</template>
<!-- Confirm disable android apps dialog -->
diff --git a/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.js b/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.js
index ddd09f370cd..046682bc850 100644
--- a/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.js
+++ b/chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.js
@@ -94,7 +94,7 @@ Polymer({
/** @private */
onConfirmDisableDialogClose_: function() {
- cr.ui.focusWithoutInk(assert(this.$$('#remove button')));
+ cr.ui.focusWithoutInk(assert(this.$$('#remove')));
},
/**
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html b/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html
index 28fa3ad2d28..e531e1a0d22 100644
--- a/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html
+++ b/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html
@@ -1,8 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="fonts_browser_proxy.html">
<link rel="import" href="../controls/settings_slider.html">
<link rel="import" href="../controls/settings_dropdown_menu.html">
@@ -57,7 +57,7 @@
menu-options="[[fontOptions_]]">
</settings-dropdown-menu>
</div>
- <div class="list-item underbar"
+ <div class="list-item"
style="
font-size:[[prefs.webkit.webprefs.default_font_size.value]]px;
font-family:
@@ -78,7 +78,7 @@
menu-options="[[fontOptions_]]">
</settings-dropdown-menu>
</div>
- <div class="list-item underbar"
+ <div class="list-item"
style="
font-size:[[prefs.webkit.webprefs.default_font_size.value]]px;
font-family:
@@ -99,7 +99,7 @@
menu-options="[[fontOptions_]]">
</settings-dropdown-menu>
</div>
- <div class="list-item underbar"
+ <div class="list-item"
style="
font-size:[[prefs.webkit.webprefs.default_font_size.value]]px;
font-family:
@@ -131,19 +131,9 @@
</div>
</div>
<template is="dom-if" if="[[!isGuest_]]">
- <div class="settings-box two-line" id="advancedButton"
- on-click="openAdvancedExtension_" actionable>
- <div class="start">
- $i18n{advancedFontSettings}
- <div class="secondary" id="advancedButtonSublabel">
- [[advancedExtensionSublabel_]]
- </div>
- </div>
- <paper-icon-button-light class="icon-external">
- <button aria-label="$i18n{advancedFontSettings}"
- aria-describedby="advancedButtonSublabel"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="advancedButton" class="hr"
+ on-click="openAdvancedExtension_" label="$i18n{advancedFontSettings}"
+ sub-label="[[advancedExtensionSublabel_]]" external></cr-link-row>
</template>
</template>
<script src="appearance_fonts_page.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/autofill_page.html b/chromium/chrome/browser/resources/settings/autofill_page/autofill_page.html
index 15d63625f72..51208f35ebe 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/autofill_page.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/autofill_page.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="autofill_section.html">
<link rel="import" href="passwords_section.html">
@@ -20,7 +21,7 @@
--cr-icon-button-margin-start: 20px;
}
cr-link-row:not([hidden]) + cr-link-row {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
}
</style>
<settings-animated-pages id="pages" section="autofill"
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.html b/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.html
index fa0257a2d7f..8853eaa4133 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.html
@@ -1,9 +1,9 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../controls/extension_controlled_indicator.html">
@@ -68,16 +68,13 @@
</span>
</div>
<template is="dom-if" if="[[item.metadata.isLocal]]">
- <paper-icon-button-light class="icon-more-vert">
- <button id="addressMenu"
- on-click="onAddressMenuTap_" title="$i18n{moreActions}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" id="addressMenu"
+ on-click="onAddressMenuTap_" title="$i18n{moreActions}">
+ </cr-icon-button>
</template>
<template is="dom-if" if="[[!item.metadata.isLocal]]">
- <paper-icon-button-light actionable class="icon-external">
- <button on-click="onRemoteEditAddressTap_"></button>
- </paper-icon-button-light>
+ <cr-icon-button actionable class="icon-external"
+ on-click="onRemoteEditAddressTap_"></cr-icon-button>
</template>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js b/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js
index b4d4d46b6c5..423ae7f1320 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js
+++ b/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js
@@ -161,8 +161,6 @@ Polymer({
onAddressMenuTap_: function(e) {
const menuEvent = /** @type {!{model: !{item: !Object}}} */ (e);
- /* TODO(scottchen): drop the [dataHost][dataHost] once this bug is fixed:
- https://github.com/Polymer/polymer/issues/2574 */
// TODO(dpapad): The [dataHost][dataHost] workaround is only necessary for
// Polymer 1. Remove once migration to Polymer 2 has completed.
const item = Polymer.DomIf ? menuEvent.model.item :
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.html b/chromium/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.html
index bb92c4bda40..304471f26a2 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.html
@@ -22,8 +22,7 @@
margin-inline-start: 8px;
}
- /* Prevent focus-outline from being chopped by the bottom of dialog body.
- TODO(scottchen): find a more general way to solve this. */
+ /* Prevent focus-outline from being chopped by bottom of dialog body. */
.md-select {
margin-bottom: 2px;
}
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/credit_card_list_entry.html b/chromium/chrome/browser/resources/settings/autofill_page/credit_card_list_entry.html
index 43be7d69a3a..4f62b13e1f0 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/credit_card_list_entry.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/credit_card_list_entry.html
@@ -1,7 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="passwords_shared_css.html">
@@ -42,18 +42,14 @@
[[creditCard.expirationMonth]]/[[creditCard.expirationYear]]
</div>
<template is="dom-if" if="[[showDots_(creditCard.metadata)]]">
- <paper-icon-button-light class="icon-more-vert">
- <button id="creditCardMenu" title="$i18n{moreActions}"
- on-click="onDotsMenuClick_">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" id="creditCardMenu"
+ title="$i18n{moreActions}" on-click="onDotsMenuClick_">
+ </cr-icon-button>
</template>
<template is="dom-if" if="[[!showDots_(creditCard.metadata)]]">
- <paper-icon-button-light actionable class="icon-external">
- <button id="remoteCreditCardLink"
- on-click="onRemoteEditClick_">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button actionable class="icon-external"
+ id="remoteCreditCardLink" on-click="onRemoteEditClick_">
+ </cr-icon-button>
</template>
</div>
</div>
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html b/chromium/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html
index 2cb94c2386e..5508a8ef07f 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html
@@ -1,11 +1,11 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../settings_vars_css.html">
@@ -48,8 +48,8 @@
}
}
- paper-icon-button-light {
- background-size: 24px; /* Other buttons are sized by --cr-icon-size. */
+ cr-icon-button {
+ --cr-icon-button-icon-size: 24px;
margin-inline-start: 2px;
}
</style>
@@ -66,16 +66,14 @@
label="$i18n{editPasswordPasswordLabel}"
type="[[getPasswordInputType_(item.password)]]"
value="[[getPassword_(item.password)]]">
- <paper-icon-button-light id="showPasswordButtonContainer"
+ <cr-icon-button id="showPasswordButton"
class$="[[getIconClass_(item.password)]]" slot="suffix"
- hidden$="[[item.entry.federationText]]">
- <button id="showPasswordButton"
- on-click="onShowPasswordButtonTap_"
- title="[[showPasswordTitle_(item.password,
- '$i18nPolymer{hidePassword}',
- '$i18nPolymer{showPassword}')]]">
- </button>
- </paper-icon-button-light>
+ hidden$="[[item.entry.federationText]]"
+ on-click="onShowPasswordButtonTap_"
+ title="[[showPasswordTitle_(item.password,
+ '$i18nPolymer{hidePassword}',
+ '$i18nPolymer{showPassword}')]]">
+ </cr-icon-button>
</cr-input>
</div>
<div slot="button-container">
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html b/chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html
index 9eb7a20aeaf..847f192031d 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html
@@ -1,8 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_row_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../site_favicon.html">
<link rel="import" href="passwords_shared_css.html">
@@ -72,30 +72,23 @@
on-click="onReadonlyInputTap_" class="password-field" readonly
disabled$="[[!item.password]]"
value="[[getPassword_(item.password)]]">
- <paper-icon-button-light id="showPasswordButtonContainer"
- class$="[[getIconClass_(item.password)]]">
- <button id="showPasswordButton"
- on-click="onShowPasswordButtonTap_"
- title="[[showPasswordTitle_(item.password,
- '$i18nPolymer{hidePassword}',
- '$i18nPolymer{showPassword}')]]"
- focus-row-control focus-type="showPassword">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="showPasswordButton"
+ class$="[[getIconClass_(item.password)]]"
+ on-click="onShowPasswordButtonTap_"
+ title="[[showPasswordTitle_(item.password,
+ '$i18nPolymer{hidePassword}',
+ '$i18nPolymer{showPassword}')]]"
+ focus-row-control focus-type="showPassword"></cr-icon-button>
</template>
<span class="password-field text-elide" id="federated"
hidden$="[[!item.entry.federationText]]">
[[item.entry.federationText]]
</span>
</div>
- <paper-icon-button-light class="icon-more-vert">
- <button id="passwordMenu"
- on-click="onPasswordMenuTap_"
- title="$i18n{moreActions}" focus-row-control
- focus-type="passwordMenu"
- aria-label$="[[getMoreActionsLabel_(item)]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" id="passwordMenu"
+ on-click="onPasswordMenuTap_" title="$i18n{moreActions}"
+ focus-row-control focus-type="passwordMenu"
+ aria-label$="[[getMoreActionsLabel_(item)]]"></cr-icon-button>
</div>
</template>
<script src="password_list_item.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html
index a364e600b6d..74cd237e755 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toast/cr_toast.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/assert.html">
@@ -11,7 +12,6 @@
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-announcer/iron-a11y-announcer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../controls/extension_controlled_indicator.html">
<link rel="import" href="../global_scroll_target_behavior.html">
@@ -83,14 +83,10 @@
<template is="dom-if"
if="[[showImportOrExportPasswords_(
showExportPasswords_, showImportPasswords_)]]">
- <paper-icon-button-light id="exportImportMenuButtonContainer"
- class="icon-more-vert">
- <button id="exportImportMenuButton"
- on-click="onImportExportMenuTap_"
- title="$i18n{moreActions}" focus-type="exportImportMenuButton"
- aria-describedby="savedPasswordsHeading">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" id="exportImportMenuButton"
+ on-click="onImportExportMenuTap_" title="$i18n{moreActions}"
+ focus-type="exportImportMenuButton"
+ aria-describedby="savedPasswordsHeading"></cr-icon-button>
</template>
</div>
<div class="list-frame">
@@ -165,13 +161,9 @@
[[item.urls.shown]]
</a>
</div>
- <paper-icon-button-light class="icon-clear">
- <button id="removeExceptionButton"
- on-click="onRemoveExceptionButtonTap_"
- tabindex$="[[tabIndex]]"
- title="$i18n{deletePasswordException}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-clear" id="removeExceptionButton"
+ on-click="onRemoveExceptionButtonTap_" tabindex$="[[tabIndex]]"
+ title="$i18n{deletePasswordException}"></cr-icon-button>
</div>
</template>
<div id="noExceptionsLabel" class="list-item"
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/passwords_shared_css.html b/chromium/chrome/browser/resources/settings/autofill_page/passwords_shared_css.html
index 05f5b0c4b7a..d89345d33ae 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_shared_css.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_shared_css.html
@@ -1,3 +1,5 @@
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+
<!-- Common styles for Passwords and Forms -->
<dom-module id="passwords-shared">
<template>
@@ -8,7 +10,7 @@
}
.list-with-header > div:first-of-type {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
}
.website-column {
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html
index 2cb349b7cac..8fcf01900f6 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html
@@ -1,11 +1,11 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../controls/settings_toggle_button.html">
@@ -25,7 +25,7 @@
}
#migrateCreditCards {
- border-bottom: var(--settings-separator-line);
+ border-bottom: var(--cr-separator-line);
border-top: none;
}
@@ -68,19 +68,12 @@
$i18n{add}
</paper-button>
</div>
- <div class="settings-box two-line" id="migrateCreditCards"
- hidden$="[[!checkIfMigratable_(syncStatus, creditCards,
+ <cr-link-row id="migrateCreditCards"
+ hidden$="[[!checkIfMigratable_(creditCards,
prefs.autofill.credit_card_enabled.value)]]"
- on-click="onMigrateCreditCardsClick_" actionable>
- <div class="start">
- $i18n{migrateCreditCardsLabel}
- <div class="secondary">[[migratableCreditCardsInfo_]]</div>
- </div>
- <paper-icon-button-light id="migrateCreditCardsButton"
- class="subpage-arrow">
- <button aria-label="[[migrateCreditCardsLabel_]]"></button>
- </paper-icon-button-light>
- </div>
+ on-click="onMigrateCreditCardsClick_"
+ label="$i18n{migrateCreditCardsLabel}"
+ sub-label="[[migratableCreditCardsInfo_]]"></cr-link-row>
<settings-credit-card-list id="creditCardList" class="list-frame"
credit-cards="[[creditCards]]">
</settings-credit-card-list>
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js
index 0eca2bcf4a3..03d51d23ebf 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js
+++ b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js
@@ -120,7 +120,10 @@ Polymer({
* An array of all saved credit cards.
* @type {!Array<!PaymentsManager.CreditCardEntry>}
*/
- creditCards: Array,
+ creditCards: {
+ type: Array,
+ value: () => [],
+ },
/**
* The model for any credit card related action menus or dialogs.
@@ -135,12 +138,6 @@ Polymer({
migratableCreditCardsInfo_: String,
/**
- * The current sync status, supplied by SyncBrowserProxy.
- * @type {?settings.SyncStatus}
- */
- syncStatus: Object,
-
- /**
* Whether migration local card on settings page is enabled.
* @private
*/
@@ -151,66 +148,6 @@ Polymer({
},
readOnly: true,
},
-
- /**
- * Whether user has a Google Payments account.
- * @private
- */
- hasGooglePaymentsAccount_: {
- type: Boolean,
- value: function() {
- return loadTimeData.getBoolean('hasGooglePaymentsAccount');
- },
- readOnly: true,
- },
-
- /**
- * Whether Autofill Upstream is enabled.
- * @private
- */
- upstreamEnabled_: {
- type: Boolean,
- value: function() {
- return loadTimeData.getBoolean('upstreamEnabled');
- },
- readOnly: true,
- },
-
- /**
- * Whether the user has a secondary sync passphrase.
- * @private
- */
- isUsingSecondaryPassphrase_: {
- type: Boolean,
- value: function() {
- return loadTimeData.getBoolean('isUsingSecondaryPassphrase');
- },
- readOnly: true,
- },
-
- /**
- * Whether the upload-to-google state is active.
- * @private
- */
- uploadToGoogleActive_: {
- type: Boolean,
- value: function() {
- return loadTimeData.getBoolean('uploadToGoogleActive');
- },
- readOnly: true,
- },
-
- /**
- * Whether the domain of the user's email is allowed.
- * @private
- */
- userEmailDomainAllowed_: {
- type: Boolean,
- value: function() {
- return loadTimeData.getBoolean('userEmailDomainAllowed');
- },
- readOnly: true,
- },
},
listeners: {
@@ -238,9 +175,6 @@ Polymer({
*/
setCreditCardsListener_: null,
- /** @private {?settings.SyncBrowserProxy} */
- syncBrowserProxy_: null,
-
/** @override */
attached: function() {
// Create listener function.
@@ -262,12 +196,6 @@ Polymer({
this.paymentsManager_.addCreditCardListChangedListener(
setCreditCardsListener);
- this.syncBrowserProxy_ = settings.SyncBrowserProxyImpl.getInstance();
- this.syncBrowserProxy_.getSyncStatus().then(
- this.handleSyncStatus_.bind(this));
- this.addWebUIListener(
- 'sync-status-changed', this.handleSyncStatus_.bind(this));
-
// Record that the user opened the payments settings.
chrome.metricsPrivate.recordUserAction('AutofillCreditCardsViewed');
},
@@ -383,73 +311,22 @@ Polymer({
},
/**
- * Handler for when the sync state is pushed from the browser.
- * @param {?settings.SyncStatus} syncStatus
- * @private
- */
- handleSyncStatus_: function(syncStatus) {
- this.syncStatus = syncStatus;
- },
-
- /**
- * @param {!settings.SyncStatus} syncStatus
* @param {!Array<!PaymentsManager.CreditCardEntry>} creditCards
* @param {boolean} creditCardEnabled
- * @return {boolean} Whether to show the migration button. True iff at
- * least
- * one valid local card, enable migration, signed-in & synced and credit
- * card pref enabled.
+ * @return {boolean} Whether to show the migration button.
* @private
*/
- checkIfMigratable_: function(syncStatus, creditCards, creditCardEnabled) {
- if (syncStatus == undefined) {
- return false;
- }
-
- // If user not enable migration experimental flag, return false.
+ checkIfMigratable_: function(creditCards, creditCardEnabled) {
+ // If migration prerequisites are not met, return false.
if (!this.migrationEnabled_) {
return false;
}
- // If user does not have Google Payments Account, return false.
- if (!this.hasGooglePaymentsAccount_) {
- return false;
- }
-
- // If the Autofill Upstream feature is not enabled, return false.
- if (!this.upstreamEnabled_) {
- return false;
- }
-
- // Don't offer upload if user has a secondary passphrase. Users who have
- // enabled a passphrase have chosen to not make their sync information
- // accessible to Google. Since upload makes credit card data available
- // to other Google systems, disable it for passphrase users.
- if (this.isUsingSecondaryPassphrase_) {
- return false;
- }
-
- // If upload-to-Google state is not active, card cannot be saved to
- // Google Payments. Return false.
- if (!this.uploadToGoogleActive_) {
- return false;
- }
-
- // The domain of the user's email address is not allowed, return false.
- if (!this.userEmailDomainAllowed_) {
- return false;
- }
-
// If credit card enabled pref is false, return false.
if (!creditCardEnabled) {
return false;
}
- // If user not signed-in and synced, return false.
- if (!syncStatus.signedIn || !syncStatus.syncSystemEnabled) {
- return false;
- }
-
const numberOfMigratableCreditCard =
creditCards.filter(card => card.metadata.isMigratable).length;
// Check whether exist at least one local valid card for migration.
diff --git a/chromium/chrome/browser/resources/settings/basic_page/basic_page.html b/chromium/chrome/browser/resources/settings/basic_page/basic_page.html
index fc4a25dbbd0..c9e4d46a5ac 100644
--- a/chromium/chrome/browser/resources/settings/basic_page/basic_page.html
+++ b/chromium/chrome/browser/resources/settings/basic_page/basic_page.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="../appearance_page/appearance_page.html">
<link rel="import" href="../autofill_page/autofill_page.html">
@@ -13,14 +14,13 @@
<link rel="import" href="../settings_page/main_page_behavior.html">
<link rel="import" href="../settings_page/settings_section.html">
<link rel="import" href="../settings_page_css.html">
-<link rel="import" href="../settings_vars_css.html">
<if expr="chromeos">
<link rel="import" href="../android_apps_page/android_apps_browser_proxy.html">
<link rel="import" href="../android_apps_page/android_apps_page.html">
<link rel="import" href="../bluetooth_page/bluetooth_page.html">
-<link rel="import" href="../kiosk_next_shell_page/kiosk_next_shell_page.html">
<link rel="import" href="../crostini_page/crostini_page.html">
+<link rel="import" href="../plugin_vm_page/plugin_vm_page.html">
<link rel="import" href="../kiosk_next_shell_page/kiosk_next_shell_page.html">
<link rel="import" href="../device_page/device_page.html">
<link rel="import" href="../internet_page/internet_page.html">
@@ -43,7 +43,7 @@
}
#advancedToggle {
- @apply --settings-actionable;
+ @apply --cr-actionable;
align-items: center;
display: flex;
margin-bottom: 3px;
@@ -214,6 +214,13 @@
</settings-crostini-page>
</settings-section>
</template>
+ <template is="dom-if" if="[[showPluginVm]]" restamp>
+ <settings-section page-title="$i18n{pluginVmPageTitle}"
+ section="pluginVm">
+ <settings-plugin-vm-page prefs="{{prefs}}">
+ </settings-plugin-vm-page>
+ </settings-section>
+ </template>
</if>
<if expr="not chromeos">
<template is="dom-if" if="[[showPage_(pageVisibility.defaultBrowser)]]"
diff --git a/chromium/chrome/browser/resources/settings/basic_page/basic_page.js b/chromium/chrome/browser/resources/settings/basic_page/basic_page.js
index 7f7f9420187..3082d22da2f 100644
--- a/chromium/chrome/browser/resources/settings/basic_page/basic_page.js
+++ b/chromium/chrome/browser/resources/settings/basic_page/basic_page.js
@@ -42,7 +42,7 @@ Polymer({
/**
* Dictionary defining page visibility.
- * @type {!GuestModePageVisibility}
+ * @type {!PageVisibility}
*/
pageVisibility: {
type: Object,
diff --git a/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.html b/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.html
index c0fe09cee68..b779c7067df 100644
--- a/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.html
+++ b/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.html
@@ -1,10 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../settings_shared_css.html">
@@ -33,11 +33,9 @@
</div>
<span hidden$="[[!device.connecting]]">$i18n{bluetoothConnecting}</span>
<div hidden$="[[!device.paired]]">
- <paper-icon-button-light class="icon-more-vert">
- <button on-click="onMenuButtonTap_" tabindex$="[[tabindex]]"
- title="$i18n{moreActions}" on-keydown="ignoreEnterKey_">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" on-click="onMenuButtonTap_"
+ tabindex$="[[tabindex]]" title="$i18n{moreActions}"
+ on-keydown="ignoreEnterKey_"></cr-icon-button>
<cr-action-menu id="dotsMenu">
<button class="dropdown-item"
on-click="onConnectActionTap_">
diff --git a/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html b/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html
index ff5b87f1ad7..3929df27e54 100644
--- a/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html
+++ b/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html
@@ -1,10 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../prefs/prefs.html">
@@ -38,12 +38,10 @@
hidden="[[prefs.cros.device.allow_bluetooth.value]]">
</cr-policy-pref-indicator>
<template is="dom-if" if="[[bluetoothToggleState_]]">
- <paper-icon-button-light class="subpage-arrow">
- <button on-click="onSubpageArrowTap_"
- aria-label="$i18n{bluetoothPageTitle}"
- aria-describedby="bluetoothSecondary">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ on-click="onSubpageArrowTap_"
+ aria-label="$i18n{bluetoothPageTitle}"
+ aria-describedby="bluetoothSecondary"></cr-icon-button>
</template>
<div class="separator"></div>
<cr-toggle id="enableBluetooth"
diff --git a/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js b/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
index 043a7588a88..b84118487a0 100644
--- a/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
+++ b/chromium/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
@@ -74,7 +74,7 @@ Polymer({
if (settings.routes.BLUETOOTH_DEVICES) {
map.set(
settings.routes.BLUETOOTH_DEVICES.path,
- '#bluetoothDevices .subpage-arrow button');
+ '#bluetoothDevices .subpage-arrow');
}
return map;
},
diff --git a/chromium/chrome/browser/resources/settings/change_password_page/change_password_page.html b/chromium/chrome/browser/resources/settings/change_password_page/change_password_page.html
index 8bb78adddca..50554b25513 100644
--- a/chromium/chrome/browser/resources/settings/change_password_page/change_password_page.html
+++ b/chromium/chrome/browser/resources/settings/change_password_page/change_password_page.html
@@ -11,7 +11,7 @@
<template>
<style include="settings-shared">
.icon-container {
- padding-inline-end: var(--settings-box-row-padding);
+ padding-inline-end: var(--cr-section-padding);
}
.change-password-icon {
@@ -25,7 +25,7 @@
.top-aligned-settings-box {
align-items: start;
min-height: 0;
- padding: 12px var(--settings-box-row-padding);
+ padding: 12px var(--cr-section-padding);
}
</style>
<div class="settings-box first top-aligned-settings-box">
diff --git a/chromium/chrome/browser/resources/settings/chrome_cleanup_page/items_to_remove_list.html b/chromium/chrome/browser/resources/settings/chrome_cleanup_page/items_to_remove_list.html
index 6fda33aca1b..2ff69ed6d66 100644
--- a/chromium/chrome/browser/resources/settings/chrome_cleanup_page/items_to_remove_list.html
+++ b/chromium/chrome/browser/resources/settings/chrome_cleanup_page/items_to_remove_list.html
@@ -12,7 +12,7 @@
:host {
display: block;
margin: 0;
- padding: 0 var(--settings-box-row-padding);
+ padding: 0 var(--cr-section-padding);
word-break: break-all;
}
diff --git a/chromium/chrome/browser/resources/settings/chromeos/BUILD.gn b/chromium/chrome/browser/resources/settings/chromeos/BUILD.gn
new file mode 100644
index 00000000000..0eef6d0863a
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/chromeos/BUILD.gn
@@ -0,0 +1,74 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//chrome/common/features.gni")
+import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/grit/grit_rule.gni")
+import("//ui/webui/webui_features.gni")
+import("../../optimize_webui.gni")
+
+if (optimize_webui) {
+ settings_pak_file = "os_settings_resources.pak"
+ unpak_folder = "os_settings_resources.unpak"
+
+ optimize_webui("build") {
+ host = "os-settings"
+ html_in_files = [
+ "chromeos/os_settings.html",
+ "chromeos/lazy_load.html",
+ ]
+ html_out_files = [
+ "vulcanized.html",
+ "lazy_load.vulcanized.html",
+ ]
+ html_out_files_polymer2 = [
+ "vulcanized.p2.html",
+ "lazy_load.vulcanized.p2.html",
+ ]
+ insert_in_head = "<base href=\"chrome://os-settings\">"
+ input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir)
+ js_out_files = [
+ "crisper.js",
+ "lazy_load.crisper.js",
+ ]
+
+ deps = [
+ ":unpak",
+ ]
+ }
+
+ unpak("unpak") {
+ pak_file = settings_pak_file
+ out_folder = unpak_folder
+
+ deps = [
+ ":flattened_resources",
+ ]
+ }
+
+ grit("flattened_resources") {
+ source = "../os_settings_resources.grd"
+
+ # The .grd contains references to generated files.
+ source_is_generated = true
+
+ defines = chrome_grit_defines
+ outputs = [
+ "grit/os_settings_resources.h",
+ "grit/os_settings_resources_map.cc",
+ "grit/os_settings_resources_map.h",
+ settings_pak_file,
+ ]
+ output_dir = "$root_gen_dir/chrome/browser/resources/settings/chromeos"
+ }
+}
+
+group("closure_compile") {
+ deps = [
+ "os_settings_main:closure_compile",
+ "os_settings_menu:closure_compile",
+ "os_settings_page:closure_compile",
+ "os_settings_ui:closure_compile",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/settings/chromeos/os_settings_main/BUILD.gn b/chromium/chrome/browser/resources/settings/chromeos/os_settings_main/BUILD.gn
new file mode 100644
index 00000000000..1850d5a851c
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/chromeos/os_settings_main/BUILD.gn
@@ -0,0 +1,25 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":os_settings_main",
+ ]
+}
+
+js_library("os_settings_main") {
+ deps = [
+ "../..:page_visibility",
+ "../..:route",
+ "../..:search_settings",
+ "../../about_page:about_page",
+ "../../settings_page:main_page_behavior",
+ "../os_settings_page:os_settings_page",
+ "//third_party/polymer/v1_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer-extracted",
+ "//ui/webui/resources/js:assert",
+ "//ui/webui/resources/js:load_time_data",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/settings/chromeos/os_settings_menu/BUILD.gn b/chromium/chrome/browser/resources/settings/chromeos/os_settings_menu/BUILD.gn
new file mode 100644
index 00000000000..3f1eae6ed31
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/chromeos/os_settings_menu/BUILD.gn
@@ -0,0 +1,19 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":os_settings_menu",
+ ]
+}
+
+js_library("os_settings_menu") {
+ deps = [
+ "../..:page_visibility",
+ "../..:route",
+ "//third_party/polymer/v1_0/components-chromium/paper-ripple:paper-ripple-extracted",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/settings/chromeos/os_settings_page/BUILD.gn b/chromium/chrome/browser/resources/settings/chromeos/os_settings_page/BUILD.gn
new file mode 100644
index 00000000000..e2f8ef47446
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/chromeos/os_settings_page/BUILD.gn
@@ -0,0 +1,26 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":os_settings_page",
+ ]
+}
+
+js_library("os_settings_page") {
+ deps = [
+ "../..:page_visibility",
+ "../..:route",
+ "../..:search_settings",
+ "../../android_apps_page:android_apps_browser_proxy",
+ "../../change_password_page:change_password_browser_proxy",
+ "../../chrome_cleanup_page:chrome_cleanup_proxy",
+ "../../settings_page:main_page_behavior",
+ "//ui/webui/resources/js:load_time_data",
+ "//ui/webui/resources/js:web_ui_listener_behavior",
+ ]
+ externs_list = [ "$externs_path/pending.js" ]
+}
diff --git a/chromium/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn b/chromium/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn
new file mode 100644
index 00000000000..68bf8d373b3
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn
@@ -0,0 +1,27 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":os_settings_ui",
+ ]
+}
+
+js_library("os_settings_ui") {
+ deps = [
+ "../..:global_scroll_target_behavior",
+ "../..:page_visibility",
+ "../../prefs:prefs",
+ "../os_settings_main:os_settings_main",
+ "//ui/webui/resources/cr_elements:cr_container_shadow_behavior",
+ "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
+ "//ui/webui/resources/cr_elements/cr_drawer:cr_drawer",
+ "//ui/webui/resources/cr_elements/cr_toolbar:cr_toolbar",
+ "//ui/webui/resources/cr_elements/cr_toolbar:cr_toolbar_search_field",
+ "//ui/webui/resources/cr_elements/policy:cr_policy_indicator_behavior",
+ "//ui/webui/resources/js:find_shortcut_behavior",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html b/chromium/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html
index 89be0f3f981..57c1eebbe2b 100644
--- a/chromium/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html
+++ b/chromium/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html
@@ -16,7 +16,6 @@
<link rel="import" href="../icons.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
-<link rel="import" href="../settings_vars_css.html">
<dom-module id="settings-clear-browsing-data-dialog">
<template>
@@ -35,9 +34,9 @@
padding-bottom: 8px;
};
--cr-dialog-body-container: {
- border-top: 1px solid var(--border-top-color);
height: var(--body-container-height);
};
+ --cr-dialog-body-border-top: 1px solid var(--border-top-color);
}
:host-context([dark]) #clearBrowsingDataDialog {
@@ -106,7 +105,7 @@
}
.divider {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
margin: 0 16px;
}
diff --git a/chromium/chrome/browser/resources/settings/controls/controlled_radio_button.html b/chromium/chrome/browser/resources/settings/controls/controlled_radio_button.html
index e3b26b4205b..de6672af7a9 100644
--- a/chromium/chrome/browser/resources/settings/controls/controlled_radio_button.html
+++ b/chromium/chrome/browser/resources/settings/controls/controlled_radio_button.html
@@ -29,14 +29,25 @@
}
</style>
- <div class="disc-wrapper">
+ <div
+ aria-checked$="[[getAriaChecked_(checked)]]"
+ aria-describedby="slotted-content"
+ aria-disabled$="[[getAriaDisabled_(disabled)]]"
+ aria-labelledby="label"
+ class="disc-wrapper"
+ id="button"
+ role="radio"
+ tabindex="0"
+ on-keydown="onInputKeydown_">
<div class="disc-border"></div>
<div class="disc"></div>
</div>
<div id="labelWrapper">
<span id="label" hidden$="[[!label]]">[[label]]</span>
- <slot></slot>
+ <span id="slotted-content">
+ <slot></slot>
+ </span>
</div>
<template is="dom-if" if="[[showIndicator_(disabled, name, pref.*)]]">
diff --git a/chromium/chrome/browser/resources/settings/controls/settings_checkbox.html b/chromium/chrome/browser/resources/settings/controls/settings_checkbox.html
index d8856d5402e..c5433716c5c 100644
--- a/chromium/chrome/browser/resources/settings/controls/settings_checkbox.html
+++ b/chromium/chrome/browser/resources/settings/controls/settings_checkbox.html
@@ -33,9 +33,10 @@
<div id="outerRow" noSubLabel$="[[!hasSubLabel_(subLabel, subLabelHtml)]]">
<cr-checkbox id="checkbox" checked="{{checked}}"
on-change="notifyChangedByUserInteraction"
- disabled="[[controlDisabled(disabled, pref.*)]]">
- <div class="label">[[label]] <slot></slot></div>
- <div class="secondary label">
+ disabled="[[controlDisabled(disabled, pref.*)]]"
+ aria-label="[[label]]">
+ <div id="label" class="label">[[label]] <slot></slot></div>
+ <div id="subLabel" class="secondary label">
<div inner-h-t-m-l="[[subLabelHtml]]"></div>
[[subLabel]]
</div>
diff --git a/chromium/chrome/browser/resources/settings/controls/settings_checkbox.js b/chromium/chrome/browser/resources/settings/controls/settings_checkbox.js
index c4482b15c39..3bc4f6c49a4 100644
--- a/chromium/chrome/browser/resources/settings/controls/settings_checkbox.js
+++ b/chromium/chrome/browser/resources/settings/controls/settings_checkbox.js
@@ -19,18 +19,24 @@ Polymer({
subLabelHtml: {
type: String,
value: '',
+ observer: 'onSubLabelHtmlChanged_',
},
},
observers: [
- 'subLabelHtmlChanged_(subLabelHtml)',
+ 'onSubLabelChanged_(subLabel, subLabelHtml)',
],
+ /** @private */
+ onSubLabelChanged_: function() {
+ this.$.checkbox.ariaDescription = this.$.subLabel.textContent;
+ },
+
/**
* Don't let clicks on a link inside the secondary label reach the checkbox.
* @private
*/
- subLabelHtmlChanged_: function() {
+ onSubLabelHtmlChanged_: function() {
const links = this.root.querySelectorAll('.secondary.label a');
links.forEach((link) => {
link.addEventListener('click', this.stopPropagation);
diff --git a/chromium/chrome/browser/resources/settings/controls/settings_slider.html b/chromium/chrome/browser/resources/settings/controls/settings_slider.html
index 8b874fc43ad..0dbf241df6a 100644
--- a/chromium/chrome/browser/resources/settings/controls/settings_slider.html
+++ b/chromium/chrome/browser/resources/settings/controls/settings_slider.html
@@ -18,12 +18,12 @@
margin-inline-start: var(--settings-controlled-by-spacing);
}
- :host-context(html:not([dark])) #labels[disabled] {
+ #labels[disabled] {
color: var(--paper-grey-400);
}
:host-context([dark]) #labels[disabled] {
- opacity: var(--settings-disabled-opacity);
+ color: var(--google-grey-refresh-500);
}
div.outer {
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/BUILD.gn b/chromium/chrome/browser/resources/settings/crostini_page/BUILD.gn
index 1ab1fbae7c7..db0a920aee3 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/crostini_page/BUILD.gn
@@ -7,6 +7,7 @@ import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
":crostini_browser_proxy",
+ ":crostini_export_import",
":crostini_page",
":crostini_shared_paths",
":crostini_shared_usb_devices",
@@ -17,7 +18,12 @@ js_type_check("closure_compile") {
js_library("crostini_browser_proxy") {
deps = [
"//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:web_ui_listener_behavior",
+ ]
+}
+
+js_library("crostini_export_import") {
+ deps = [
+ ":crostini_browser_proxy",
]
}
@@ -43,7 +49,7 @@ js_library("crostini_shared_usb_devices") {
deps = [
":crostini_browser_proxy",
"..:route",
- "../prefs:prefs_behavior",
+ "//ui/webui/resources/js:web_ui_listener_behavior",
]
}
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_browser_proxy.js b/chromium/chrome/browser/resources/settings/crostini_page/crostini_browser_proxy.js
index fd3df485f5c..225da323ed6 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/crostini_browser_proxy.js
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_browser_proxy.js
@@ -9,6 +9,13 @@
let CrostiniSharedPath;
/**
+ * @typedef {{label: string,
+ * guid: string,
+ * shared: boolean}}
+ */
+let CrostiniSharedUsbDevice;
+
+/**
* @fileoverview A helper object used by the "Linux Apps" (Crostini) section
* to install and uninstall Crostini.
*/
@@ -27,8 +34,22 @@ cr.define('settings', function() {
*/
getCrostiniSharedPathsDisplayText(paths) {}
- /** @param {string} path Path to stop sharing. */
- removeCrostiniSharedPath(path) {}
+ /**
+ * @return {!Promise<!Array<CrostiniSharedUsbDevice>>}
+ */
+ getCrostiniSharedUsbDevices() {}
+
+ /**
+ * @param {string} guid Unique device identifier.
+ * @param {boolean} shared Whether device is currently shared with Crostini.
+ */
+ setCrostiniUsbDeviceShared(guid, shared) {}
+
+ /**
+ * @param {string} vmName VM to stop sharing path with.
+ * @param {string} path Path to stop sharing.
+ */
+ removeCrostiniSharedPath(vmName, path) {}
/* Request chrome send a crostini-installer-status-changed event with the
current installer status */
@@ -59,8 +80,18 @@ cr.define('settings', function() {
}
/** @override */
- removeCrostiniSharedPath(path) {
- chrome.send('removeCrostiniSharedPath', [path]);
+ getCrostiniSharedUsbDevices() {
+ return cr.sendWithPromise('getCrostiniSharedUsbDevices');
+ }
+
+ /** @override */
+ setCrostiniUsbDeviceShared(guid, shared) {
+ return chrome.send('setCrostiniUsbDeviceShared', [guid, shared]);
+ }
+
+ /** @override */
+ removeCrostiniSharedPath(vmName, path) {
+ chrome.send('removeCrostiniSharedPath', [vmName, path]);
}
/** @override */
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_export_import.html b/chromium/chrome/browser/resources/settings/crostini_page/crostini_export_import.html
new file mode 100644
index 00000000000..cc248509024
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_export_import.html
@@ -0,0 +1,28 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/html/i18n_behavior.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="crostini_browser_proxy.html">
+<link rel="import" href="../i18n_setup.html">
+<link rel="import" href="../settings_shared_css.html">
+
+<dom-module id="settings-crostini-export-import">
+ <template>
+ <style include="settings-shared"></style>
+ <div class="list-frame vertical-list">
+ <div id="export" class="list-item">
+ <div class="start secondary">$i18n{crostiniExportLabel}</div>
+ <paper-button on-click="onExportClick_">
+ $i18n{crostiniExport}
+ </paper-button>
+ </div>
+ <div id="import" class="list-item">
+ <div class="start secondary">$i18n{crostiniImportLabel}</div>
+ <paper-button on-click="onImportClick_">
+ $i18n{crostiniImport}
+ </paper-button>
+ </div>
+ </div>
+ </template>
+ <script src="crostini_export_import.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_export_import.js b/chromium/chrome/browser/resources/settings/crostini_page/crostini_export_import.js
new file mode 100644
index 00000000000..d1a513bb6e8
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_export_import.js
@@ -0,0 +1,23 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview
+ * 'crostini-export-import' is the settings backup and restore subpage for
+ * Crostini.
+ */
+
+Polymer({
+ is: 'settings-crostini-export-import',
+
+ /** @private */
+ onExportClick_: function() {
+ settings.CrostiniBrowserProxyImpl.getInstance().exportCrostiniContainer();
+ },
+
+ /** @private */
+ onImportClick_: function() {
+ settings.CrostiniBrowserProxyImpl.getInstance().importCrostiniContainer();
+ },
+});
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_page.html b/chromium/chrome/browser/resources/settings/crostini_page/crostini_page.html
index 895b096ccf2..0b910eae1c5 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/crostini_page.html
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_page.html
@@ -1,5 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
@@ -9,9 +10,10 @@
<link rel="import" href="../settings_page/settings_subpage.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="crostini_browser_proxy.html">
-<link rel="import" href="crostini_subpage.html">
+<link rel="import" href="crostini_export_import.html">
<link rel="import" href="crostini_shared_paths.html">
<link rel="import" href="crostini_shared_usb_devices.html">
+<link rel="import" href="crostini_subpage.html">
<dom-module id="settings-crostini-page">
<template>
@@ -34,11 +36,9 @@
</cr-policy-indicator>
</template>
<template is="dom-if" if="[[prefs.crostini.enabled.value]]">
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{crostiniPageTitle}"
- aria-describedby="secondaryText">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{crostiniPageTitle}"
+ aria-describedby="secondaryText"></cr-icon-button>
</template>
<template is="dom-if" if="[[!prefs.crostini.enabled.value]]">
<div class="separator"></div>
@@ -62,6 +62,15 @@
</settings-subpage>
</template>
+ <template is="dom-if" route-path="/crostini/exportImport">
+ <settings-subpage
+ associated-control="[[$$('#crostini')]]"
+ page-title="$i18n{crostiniExportImportTitle}">
+ <settings-crostini-export-import prefs="{{prefs}}">
+ </settings-crostini-export-import>
+ </settings-subpage>
+ </template>
+
<template is="dom-if" route-path="/crostini/sharedPaths">
<settings-subpage
associated-control="[[$$('#crostini')]]"
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_page.js b/chromium/chrome/browser/resources/settings/crostini_page/crostini_page.js
index 1370e0400aa..1f2b08a13e9 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/crostini_page.js
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_page.js
@@ -29,17 +29,22 @@ Polymer({
if (settings.routes.CROSTINI_DETAILS) {
map.set(
settings.routes.CROSTINI_DETAILS.path,
- '#crostini .subpage-arrow button');
+ '#crostini .subpage-arrow');
+ }
+ if (settings.routes.CROSTINI_EXPORT_IMPORT) {
+ map.set(
+ settings.routes.CROSTINI_EXPORT_IMPORT.path,
+ '#crostini .subpage-arrow');
}
if (settings.routes.CROSTINI_SHARED_PATHS) {
map.set(
settings.routes.CROSTINI_SHARED_PATHS.path,
- '#crostini .subpage-arrow button');
+ '#crostini .subpage-arrow');
}
if (settings.routes.CROSTINI_SHARED_USB_DEVICES) {
map.set(
settings.routes.CROSTINI_SHARED_USB_DEVICES.path,
- '#crostini .subpage-arrow button');
+ '#crostini .subpage-arrow');
}
return map;
},
@@ -58,6 +63,12 @@ Polymer({
/** @private */
onSubpageTap_: function(event) {
+ // We do not open the subpage if the click was on a link.
+ if (event.target && event.target.tagName == 'A') {
+ event.stopPropagation();
+ return;
+ }
+
if (this.getPref('crostini.enabled.value')) {
settings.navigateTo(settings.routes.CROSTINI_DETAILS);
}
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.html b/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.html
index 2acab1f970c..62fd01cdd54 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.html
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.html
@@ -1,7 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="crostini_browser_proxy.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../prefs/prefs_behavior.html">
@@ -27,11 +27,8 @@
<template is="dom-repeat" items="[[sharedPaths_]]">
<div class="list-item">
<div class="start">[[item.pathDisplayText]]</div>
- <paper-icon-button-light class="icon-clear">
- <button on-click="onRemoveSharedPathTap_"
- title="$i18n{crostiniSharedPathsRemoveSharing}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-clear" on-click="onRemoveSharedPathTap_"
+ title="$i18n{crostiniSharedPathsRemoveSharing}"></cr-icon-button>
</div>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.js b/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.js
index cc04e9ec7b1..0072edd8a4a 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.js
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_paths.js
@@ -7,6 +7,15 @@
* 'crostini-shared-paths' is the settings shared paths subpage for Crostini.
*/
+(function() {
+
+/**
+ * The default crostini VM is named 'termina'.
+ * https://cs.chromium.org/chromium/src/chrome/browser/chromeos/crostini/crostini_util.h?q=kCrostiniDefaultVmName&dr=CSs
+ * @type {string}
+ */
+const DEFAULT_CROSTINI_VM = 'termina';
+
Polymer({
is: 'settings-crostini-shared-paths',
@@ -26,22 +35,27 @@ Polymer({
sharedPaths_: Array,
},
- observers:
- ['onCrostiniSharedPathsChanged_(prefs.crostini.shared_paths.value)'],
+ observers: [
+ 'onCrostiniSharedPathsChanged_(prefs.guest_os.paths_shared_to_vms.value)'
+ ],
/**
- * @param {!Array<string>} paths
+ * @param {!Object<!Array<string>>} paths
* @private
*/
onCrostiniSharedPathsChanged_: function(paths) {
+ const vmPaths = [];
+ for (const path in paths) {
+ const vms = paths[path];
+ if (vms.includes(DEFAULT_CROSTINI_VM)) {
+ vmPaths.push(path);
+ }
+ }
settings.CrostiniBrowserProxyImpl.getInstance()
- .getCrostiniSharedPathsDisplayText(paths)
+ .getCrostiniSharedPathsDisplayText(vmPaths)
.then(text => {
- const sharedPaths = [];
- for (let i = 0; i < paths.length; i++) {
- sharedPaths.push({path: paths[i], pathDisplayText: text[i]});
- }
- this.sharedPaths_ = sharedPaths;
+ this.sharedPaths_ = vmPaths.map(
+ (path, i) => ({path: path, pathDisplayText: text[i]}));
});
},
@@ -51,6 +65,7 @@ Polymer({
*/
onRemoveSharedPathTap_: function(event) {
settings.CrostiniBrowserProxyImpl.getInstance().removeCrostiniSharedPath(
- event.model.item.path);
+ DEFAULT_CROSTINI_VM, event.model.item.path);
},
});
+})();
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.html b/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.html
index 48dcb3a03dd..eb0922a2eb2 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.html
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.html
@@ -1,6 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="../prefs/prefs_behavior.html">
+<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="../settings_shared_css.html">
@@ -16,20 +16,28 @@
}
</style>
<div class="settings-box first">
- <div>$i18n{crostiniSharedUsbDevicesDescription}</div>
+ <div class="settings-box-text">
+ $i18n{crostiniSharedUsbDevicesDescription}
+ <div class="secondary" id="secondaryText">
+ $i18n{crostiniSharedUsbDevicesExtraDescription}
+ </div>
+ </div>
</div>
- <div class="settings-box continuation">
- <h2 class="start">$i18n{crostiniSharedUsbDevicesListHeading}</h2>
+ <div class="settings-box secondary continuation"
+ hidden="[[sharedUsbDevices_.length]]" >
+ $i18n{crostiniSharedUsbDevicesListEmptyMessage}
</div>
- <div class="list-frame vertical-list">
- <template is="dom-repeat"
- items="{{prefs.crostini.shared_usb_devices.value}}" as="device">
+ <div class="list-frame vertical-list"
+ hidden="[[!sharedUsbDevices_.length]]">
+ <template is="dom-repeat" items="[[sharedUsbDevices_]]">
<div class="toggle-container settings-box">
- <div class="label">[[device.name]]</div>
- <cr-toggle class="toggle" checked="{{device.shared}}"></cr-toggle>
+ <div class="label">[[item.label]]</div>
+ <cr-toggle class="toggle" checked="[[item.shared]]"
+ on-change="onDeviceSharedChange_"
+ aria-label$="[[item.label]]"></cr-toggle>
</div>
- </template>
- </div>
+ </div>
+ </template>
</template>
<script src="crostini_shared_usb_devices.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.js b/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.js
index 02951ec94be..8d4db11bbb0 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.js
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_shared_usb_devices.js
@@ -11,13 +11,41 @@
Polymer({
is: 'settings-crostini-shared-usb-devices',
- behaviors: [PrefsBehavior],
+ behaviors: [WebUIListenerBehavior],
properties: {
- /** Preferences state. */
- prefs: {
- type: Object,
- notify: true,
- },
+ /**
+ * The USB Devices available for connection to a VM.
+ * @private {Array<!CrostiniSharedUsbDevice>}
+ */
+ sharedUsbDevices_: Array,
+ },
+
+ /** @override */
+ attached: function() {
+ this.addWebUIListener(
+ 'crostini-shared-usb-devices-changed',
+ this.onCrostiniSharedUsbDevicesChanged_.bind(this));
+ settings.CrostiniBrowserProxyImpl.getInstance()
+ .getCrostiniSharedUsbDevices()
+ .then(this.onCrostiniSharedUsbDevicesChanged_.bind(this));
+ },
+
+ /**
+ * @param {!Array<CrostiniSharedUsbDevice>} devices
+ * @private
+ */
+ onCrostiniSharedUsbDevicesChanged_: function(devices) {
+ this.sharedUsbDevices_ = devices;
+ },
+
+ /**
+ * @param {!CustomEvent<!CrostiniSharedUsbDevice>} event
+ * @private
+ */
+ onDeviceSharedChange_: function(event) {
+ const deviceInfo = event.model.item;
+ settings.CrostiniBrowserProxyImpl.getInstance().setCrostiniUsbDeviceShared(
+ deviceInfo.guid, event.target.checked);
},
});
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.html b/chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.html
index e2b9cf0f63b..fe61ff56b60 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.html
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.html
@@ -1,8 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="crostini_browser_proxy.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../prefs/prefs_behavior.html">
@@ -13,45 +13,33 @@
<template>
<style include="settings-shared"></style>
<div id="crostini-shared-paths" class="settings-box first"
- actionable on-click="onSharedPathsTap_">
+ on-click="onSharedPathsClick_" actionable>
<div class="start">$i18n{crostiniSharedPaths}</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{crostiniSharedPaths}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{crostiniSharedPaths}"></cr-icon-button>
</div>
<template is="dom-if" if="[[enableCrostiniUsbDeviceSupport_]]">
<div id="crostini-shared-usb-devices" class="settings-box"
- actionable on-click="onSharedUsbDevicesTap_">
+ on-click="onSharedUsbDevicesClick_" actionable>
<div class="start">$i18n{crostiniSharedUsbDevicesLabel}</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{crostiniSharedUsbDevicesLabel}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{crostiniSharedUsbDevicesLabel}"></cr-icon-button>
</div>
</template>
<template is="dom-if" if="[[showCrostiniExportImport_]]">
- <div class="settings-box">$i18n{crostiniExportImportTitle}</div>
- <div class="list-frame vertical-list">
- <div id="export" class="list-item">
- <div class="start secondary">$i18n{crostiniExportLabel}</div>
- <paper-button on-click="onExportClick_">
- $i18n{crostiniExport}
- </paper-button>
- </div>
- <div id="import" class="list-item">
- <div class="start secondary">$i18n{crostiniImportLabel}</div>
- <paper-button on-click="onImportClick_">
- $i18n{crostiniImport}
- </paper-button>
- </div>
+ <div id="crostini-export-import" class="settings-box"
+ on-click="onExportImportClick_" actionable>
+ <div class="start">$i18n{crostiniExportImportTitle}</div>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{crostiniExportImportTitle}"></cr-icon-button>
</div>
</template>
<template is="dom-if" if="[[!hideCrostiniUninstall_]]">
- <div id="remove" class="settings-box"
- actionable on-click="onRemoveTap_">
+ <div id="remove" class="settings-box">
<div class="start">$i18n{crostiniRemove}</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{crostiniRemove}"></button>
- </paper-icon-button-light>
+ <paper-button on-click="onRemoveClick_">
+ $i18n{crostiniRemoveButton}
+ </paper-button>
</div>
</template>
</template>
diff --git a/chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.js b/chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.js
index 702a29017ff..736b8a86e4b 100644
--- a/chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.js
+++ b/chromium/chrome/browser/resources/settings/crostini_page/crostini_subpage.js
@@ -69,32 +69,26 @@ Polymer({
}
},
+ /** @private */
+ onExportImportClick_: function() {
+ settings.navigateTo(settings.routes.CROSTINI_EXPORT_IMPORT);
+ },
+
/**
* Shows a confirmation dialog when removing crostini.
- * @param {!Event} event
* @private
*/
- onRemoveTap_: function(event) {
+ onRemoveClick_: function() {
settings.CrostiniBrowserProxyImpl.getInstance().requestRemoveCrostini();
},
/** @private */
- onSharedPathsTap_: function(event) {
+ onSharedPathsClick_: function() {
settings.navigateTo(settings.routes.CROSTINI_SHARED_PATHS);
},
/** @private */
- onExportClick_: function(event) {
- settings.CrostiniBrowserProxyImpl.getInstance().exportCrostiniContainer();
- },
-
- /** @private */
- onImportClick_: function(event) {
- settings.CrostiniBrowserProxyImpl.getInstance().importCrostiniContainer();
- },
-
- /** @private */
- onSharedUsbDevicesTap_: function(event) {
+ onSharedUsbDevicesClick_: function() {
settings.navigateTo(settings.routes.CROSTINI_SHARED_USB_DEVICES);
},
});
diff --git a/chromium/chrome/browser/resources/settings/date_time_page/date_time_page.html b/chromium/chrome/browser/resources/settings/date_time_page/date_time_page.html
index c98fd1631a4..735549d7721 100644
--- a/chromium/chrome/browser/resources/settings/date_time_page/date_time_page.html
+++ b/chromium/chrome/browser/resources/settings/date_time_page/date_time_page.html
@@ -1,9 +1,9 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../prefs/prefs_behavior.html">
@@ -44,28 +44,14 @@
<template is="dom-if"
if="[[prefs.cros.flags.fine_grained_time_zone_detection_enabled.value]]"
restamp>
- <div id="timeZoneSettingsTrigger" class="settings-box first"
- on-click="onTimeZoneSettings_" actionable>
- <div id="timeZoneButton" class="two-line">
- $i18n{timeZoneButton}
- <div class="secondary">
- <div hidden="[[prefs.generated.resolve_timezone_by_geolocation_on_off.value]]">
- [[activeTimeZoneDisplayName]]
- </div>
- <div hidden="[[!prefs.generated.resolve_timezone_by_geolocation_on_off.value]]">
- [[getTimeZoneAutoDetectMethodDisplayName_(
- prefs.generated.resolve_timezone_by_geolocation_method_short.value)]]
- </div>
- </div>
- </div>
+ <cr-link-row id="timeZoneSettingsTrigger" class="hr"
+ on-click="onTimeZoneSettings_" label="$i18n{timeZoneButton}"
+ sub-label="[[timeZoneSettingSubLabel_]]">
<div class="flex"></div>
<cr-policy-pref-indicator
pref="[[prefs.generated.resolve_timezone_by_geolocation_on_off]]">
</cr-policy-pref-indicator>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{timeZoneButton}"></button>
- </paper-icon-button-light>
- </div>
+ </cr-link-row>
</template>
<div class="settings-box continuation embedded"
hidden="[[prefs.cros.flags.fine_grained_time_zone_detection_enabled.value]]">
@@ -77,13 +63,9 @@
pref="{{prefs.settings.clock.use_24hour_clock}}"
label="$i18n{use24HourClock}">
</settings-toggle-button>
- <div class="settings-box" id="setDateTime" actionable
- on-click="onSetDateTimeTap_" hidden$="[[!canSetDateTime_]]">
- <div class="start">$i18n{setDateTime}</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{setDateTime}"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row class="hr" id="setDateTime"
+ on-click="onSetDateTimeTap_" hidden$="[[!canSetDateTime_]]"
+ label="$i18n{setDateTime}"></cr-link-row>
</div>
<template is="dom-if" route-path="/dateTime/timeZone">
<settings-subpage data-route="DATETIME_TIMEZONE_SUBPAGE"
diff --git a/chromium/chrome/browser/resources/settings/date_time_page/date_time_page.js b/chromium/chrome/browser/resources/settings/date_time_page/date_time_page.js
index dc4cae9991e..ec588874de5 100644
--- a/chromium/chrome/browser/resources/settings/date_time_page/date_time_page.js
+++ b/chromium/chrome/browser/resources/settings/date_time_page/date_time_page.js
@@ -41,11 +41,20 @@ Polymer({
if (settings.routes.DATETIME_TIMEZONE_SUBPAGE) {
map.set(
settings.routes.DATETIME_TIMEZONE_SUBPAGE.path,
- '#timeZoneSettingsTrigger .subpage-arrow button');
+ '#timeZoneSettingsTrigger');
}
return map;
},
},
+
+ /** @private */
+ timeZoneSettingSubLabel_: {
+ type: String,
+ computed: `computeTimeZoneSettingSubLabel_(
+ activeTimeZoneDisplayName,
+ prefs.generated.resolve_timezone_by_geolocation_on_off.value,
+ prefs.generated.resolve_timezone_by_geolocation_method_short.value)`
+ }
},
/** @override */
@@ -70,24 +79,24 @@ Polymer({
},
/**
- * Returns display name of the given time zone detection method.
- * @param {settings.TimeZoneAutoDetectMethod} method
- * prefs.generated.resolve_timezone_by_geolocation_method_short.value
* @return {string}
* @private
*/
- getTimeZoneAutoDetectMethodDisplayName_: function(method) {
- const id = ([
+ computeTimeZoneSettingSubLabel_: function() {
+ if (!this.getPref('generated.resolve_timezone_by_geolocation_on_off')
+ .value) {
+ return this.activeTimeZoneDisplayName;
+ }
+ const method = /** @type {number} */ (
+ this.getPref('generated.resolve_timezone_by_geolocation_method_short')
+ .value);
+ const id = [
'setTimeZoneAutomaticallyDisabled',
'setTimeZoneAutomaticallyIpOnlyDefault',
'setTimeZoneAutomaticallyWithWiFiAccessPointsData',
- 'setTimeZoneAutomaticallyWithAllLocationInfo'
- ])[method];
- if (id) {
- return this.i18n(id);
- }
-
- return '';
+ 'setTimeZoneAutomaticallyWithAllLocationInfo',
+ ][method];
+ return id ? this.i18n(id) : '';
},
onTimeZoneSettings_: function() {
diff --git a/chromium/chrome/browser/resources/settings/default_browser_page/default_browser_browser_proxy.js b/chromium/chrome/browser/resources/settings/default_browser_page/default_browser_browser_proxy.js
index 93f847ef249..34fe0350b02 100644
--- a/chromium/chrome/browser/resources/settings/default_browser_page/default_browser_browser_proxy.js
+++ b/chromium/chrome/browser/resources/settings/default_browser_page/default_browser_browser_proxy.js
@@ -23,6 +23,7 @@ cr.define('settings', function() {
/**
* Get the initial DefaultBrowserInfo and begin sending updates to
* 'settings.updateDefaultBrowserState'.
+ * @return {!Promise<!DefaultBrowserInfo>}
*/
requestDefaultBrowserState() {}
@@ -39,7 +40,7 @@ cr.define('settings', function() {
class DefaultBrowserBrowserProxyImpl {
/** @override */
requestDefaultBrowserState() {
- chrome.send('requestDefaultBrowserState');
+ return cr.sendWithPromise('requestDefaultBrowserState');
}
/** @override */
diff --git a/chromium/chrome/browser/resources/settings/default_browser_page/default_browser_page.js b/chromium/chrome/browser/resources/settings/default_browser_page/default_browser_page.js
index 39c3f6a5e82..4e3d8eb9492 100644
--- a/chromium/chrome/browser/resources/settings/default_browser_page/default_browser_page.js
+++ b/chromium/chrome/browser/resources/settings/default_browser_page/default_browser_page.js
@@ -40,7 +40,8 @@ Polymer({
'browser-default-state-changed',
this.updateDefaultBrowserState_.bind(this));
- this.browserProxy_.requestDefaultBrowserState();
+ this.browserProxy_.requestDefaultBrowserState().then(
+ this.updateDefaultBrowserState_.bind(this));
},
/**
diff --git a/chromium/chrome/browser/resources/settings/device_page/device_page.html b/chromium/chrome/browser/resources/settings/device_page/device_page.html
index 44f0cf7c8f7..889d5d37941 100644
--- a/chromium/chrome/browser/resources/settings/device_page/device_page.html
+++ b/chromium/chrome/browser/resources/settings/device_page/device_page.html
@@ -3,7 +3,6 @@
<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="device_page_browser_proxy.html">
<link rel="import" href="display.html">
<link rel="import" href="keyboard.html">
diff --git a/chromium/chrome/browser/resources/settings/device_page/display.html b/chromium/chrome/browser/resources/settings/device_page/display.html
index bbc54c417db..fb78b2d1d64 100644
--- a/chromium/chrome/browser/resources/settings/device_page/display.html
+++ b/chromium/chrome/browser/resources/settings/device_page/display.html
@@ -11,7 +11,6 @@
<link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-tabs/paper-tabs.html">
<link rel="import" href="display_layout.html">
<link rel="import" href="display_overscan_dialog.html">
@@ -210,9 +209,9 @@
aria-labelledby="displayOrientation"
on-change="onOrientationChange_">
<option value="0">$i18n{displayOrientationStandard}</option>
- <option value="90">90</option>
- <option value="180">180</option>
- <option value="270">270</option>
+ <option value="90">90&deg;</option>
+ <option value="180">180&deg;</option>
+ <option value="270">270&deg;</option>
</select>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/settings/device_page/display.js b/chromium/chrome/browser/resources/settings/device_page/display.js
index bf4f491dd0a..84613d217c6 100644
--- a/chromium/chrome/browser/resources/settings/device_page/display.js
+++ b/chromium/chrome/browser/resources/settings/device_page/display.js
@@ -896,7 +896,7 @@ Polymer({
/** @private */
onCloseOverscanDialog_: function() {
- cr.ui.focusWithoutInk(assert(this.$$('#overscan button')));
+ cr.ui.focusWithoutInk(assert(this.$$('#overscan')));
},
/** @private */
diff --git a/chromium/chrome/browser/resources/settings/device_page/keyboard.html b/chromium/chrome/browser/resources/settings/device_page/keyboard.html
index 89c25c96ec7..c88a6f7bb5f 100644
--- a/chromium/chrome/browser/resources/settings/device_page/keyboard.html
+++ b/chromium/chrome/browser/resources/settings/device_page/keyboard.html
@@ -1,8 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../controls/settings_dropdown_menu.html">
<link rel="import" href="../controls/settings_slider.html">
<link rel="import" href="../controls/settings_toggle_button.html">
@@ -129,19 +129,11 @@
</settings-slider>
</div>
</iron-collapse>
- <div id="keyboardShortcutViewer" class="settings-box"
- on-click="onShowKeyboardShortcutViewerTap_" actionable>
- <div class="start">$i18n{showKeyboardShortcutViewer}</div>
- <paper-icon-button-light class="icon-external">
- <button aria-label="$i18n{showKeyboardShortcutViewer}"></button>
- </paper-icon-button-light>
- </div>
- <div class="settings-box" on-click="onShowLanguageInputTap_" actionable>
- <div class="start">$i18n{keyboardShowLanguageAndInput}</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{keyboardShowLanguageAndInput}"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="keyboardShortcutViewer" class="hr"
+ on-click="onShowKeyboardShortcutViewerTap_"
+ label="$i18n{showKeyboardShortcutViewer}" external></cr-link-row>
+ <cr-link-row class="hr" on-click="onShowLanguageInputTap_"
+ label="$i18n{keyboardShowLanguageAndInput}"></cr-link-row>
</template>
<script src="keyboard.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/device_page/pointers.html b/chromium/chrome/browser/resources/settings/device_page/pointers.html
index 32085554ce4..95301b12bf5 100644
--- a/chromium/chrome/browser/resources/settings/device_page/pointers.html
+++ b/chromium/chrome/browser/resources/settings/device_page/pointers.html
@@ -1,6 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_radio_button/cr_radio_button.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="../controls/settings_radio_group.html">
<link rel="import" href="../controls/settings_slider.html">
<link rel="import" href="../controls/settings_toggle_button.html">
@@ -11,12 +12,12 @@
<template>
<style include="settings-shared">
h2 {
- padding-inline-start: var(--settings-box-row-padding);
+ padding-inline-start: var(--cr-section-padding);
}
.subsection {
- padding-inline-end: var(--settings-box-row-padding);
- padding-inline-start: var(--settings-box-row-indent);
+ padding-inline-end: var(--cr-section-padding);
+ padding-inline-start: var(--cr-section-indent-padding);
}
.subsection > settings-toggle-button,
diff --git a/chromium/chrome/browser/resources/settings/device_page/storage.html b/chromium/chrome/browser/resources/settings/device_page/storage.html
index 7b7c8d91bc8..f9b050db7ed 100644
--- a/chromium/chrome/browser/resources/settings/device_page/storage.html
+++ b/chromium/chrome/browser/resources/settings/device_page/storage.html
@@ -1,12 +1,13 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="drive_cache_dialog.html">
<link rel="import" href="../prefs/prefs.html">
<link rel="import" href="../route.html">
@@ -196,18 +197,9 @@
</div>
</div>
</div>
- <div class="settings-box two-line" on-click="onDownloadsTap_" actionable>
- <div class="start">
- $i18n{storageItemDownloads}
- <div id="downloadsSize" class="secondary">
- $i18n{storageSizeComputing}
- </div>
- </div>
- <paper-icon-button-light class="icon-external">
- <button aria-label="$i18n{storageItemDownloads}"
- aria-describedby="downloadsSize"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="downloadsSize" class="hr" on-click="onDownloadsTap_"
+ label="$i18n{storageItemDownloads}"
+ sub-label="$i18n{storageSizeComputing}" external></cr-link-row>
<template is="dom-if" if="[[driveEnabled_]]">
<div class="settings-box two-line" on-click="onDriveCacheTap_"
actionable$="[[hasDriveCache_]]" >
@@ -217,66 +209,28 @@
$i18n{storageSizeComputing}
</div>
</div>
- <paper-icon-button-light class="icon-delete-gray">
- <button id="deleteButton" aria-label="$i18n{storageItemDriveCache}"
- aria-describedby="driveSizeCache">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-delete-gray" id="deleteButton"
+ aria-label="$i18n{storageItemDriveCache}"
+ aria-describedby="driveSizeCache"></cr-icon-button>
</div>
</template>
- <div class="settings-box two-line" on-click="onBrowsingDataTap_" actionable>
- <div class="start">
- $i18n{storageItemBrowsingData}
- <div id="browsingDataSize" class="secondary">
- $i18n{storageSizeComputing}
- </div>
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{storageItemBrowsingData}"
- aria-describedby="browsingDataSize"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="browsingDataSize" class="hr" on-click="onBrowsingDataTap_"
+ label="$i18n{storageItemBrowsingData}"
+ sub-label="$i18n{storageSizeComputing}"></cr-link-row>
<template is="dom-if" if="[[androidEnabled_]]">
- <div class="settings-box two-line" on-click="onAndroidTap_" actionable>
- <div class="start">
- $i18n{storageItemAndroid}
- <div id="androidSize" class="secondary">
- $i18n{storageSizeComputing}
- </div>
- </div>
- <paper-icon-button-light class="icon-external">
- <button aria-label="$i18n{storageItemAndroid}"
- aria-describedby="androidSize"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="androidSize" class="hr" on-click="onAndroidTap_"
+ label="$i18n{storageItemAndroid}"
+ sub-label="$i18n{storageSizeComputing}" external></cr-link-row>
</template>
<template is="dom-if" if="[[showCrostiniStorage_]]">
- <div class="settings-box two-line" on-click="onCrostiniTap_" actionable>
- <div class="start">
- $i18n{storageItemCrostini}
- <div id="crostiniSize" class="secondary">
- $i18n{storageSizeComputing}
- </div>
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{storageItemCrostini}"
- aria-describedby="crostiniSize"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="crostiniSize" class="hr" on-click="onCrostiniTap_"
+ label="$i18n{storageItemCrostini}"
+ sub-label="$i18n{storageSizeComputing}"></cr-link-row>
</template>
<template is="dom-if" if="[[!isGuest_]]">
- <div class="settings-box two-line" on-click="onOtherUsersTap_" actionable>
- <div class="start">
- $i18n{storageItemOtherUsers}
- <div id="otherUsersSize" class="secondary">
- $i18n{storageSizeComputing}
- </div>
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{storageItemOtherUsers}"
- aria-describedby="otherUsersSize"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="otherUsersSize" class="hr" on-click="onOtherUsersTap_"
+ label="$i18n{storageItemOtherUsers}"
+ sub-label="$i18n{storageSizeComputing}"></cr-link-row>
</template>
<settings-drive-cache-dialog id="storageDriveCache"
diff --git a/chromium/chrome/browser/resources/settings/device_page/storage.js b/chromium/chrome/browser/resources/settings/device_page/storage.js
index 033a96e338b..91a695811fc 100644
--- a/chromium/chrome/browser/resources/settings/device_page/storage.js
+++ b/chromium/chrome/browser/resources/settings/device_page/storage.js
@@ -203,7 +203,7 @@ Polymer({
* @private
*/
handleDownloadsSizeChanged_: function(size) {
- this.$.downloadsSize.textContent = size;
+ this.$.downloadsSize.subLabel = size;
},
/**
@@ -225,7 +225,7 @@ Polymer({
* @private
*/
handleBrowsingDataSizeChanged_: function(size) {
- this.$.browsingDataSize.textContent = size;
+ this.$.browsingDataSize.subLabel = size;
},
/**
@@ -235,7 +235,7 @@ Polymer({
*/
handleAndroidSizeChanged_: function(size) {
if (this.androidEnabled_) {
- this.$$('#androidSize').textContent = size;
+ this.$$('#androidSize').subLabel = size;
}
},
@@ -246,7 +246,7 @@ Polymer({
*/
handleCrostiniSizeChanged_: function(size) {
if (this.showCrostiniStorage_) {
- this.$$('#crostiniSize').textContent = size;
+ this.$$('#crostiniSize').subLabel = size;
}
},
@@ -256,7 +256,7 @@ Polymer({
*/
handleOtherUsersSizeChanged_: function(size) {
if (!this.isGuest_) {
- this.$$('#otherUsersSize').textContent = size;
+ this.$$('#otherUsersSize').subLabel = size;
}
},
diff --git a/chromium/chrome/browser/resources/settings/device_page/stylus.html b/chromium/chrome/browser/resources/settings/device_page/stylus.html
index b3ff61bf392..7dad79f1c65 100644
--- a/chromium/chrome/browser/resources/settings/device_page/stylus.html
+++ b/chromium/chrome/browser/resources/settings/device_page/stylus.html
@@ -1,8 +1,9 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/action_link.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../settings_shared_css.html">
@@ -18,7 +19,7 @@
}
paper-spinner-lite {
- margin-left: 12px;
+ margin-inline-start: 12px;
@apply --cr-icon-height-width;
}
@@ -27,7 +28,7 @@
}
#note-taking-app-lock-screen-settings {
- padding: 0 var(--settings-box-row-padding);
+ padding: 0 var(--cr-section-padding);
}
</style>
@@ -73,21 +74,10 @@
</select>
</div>
- <!-- TODO(scottchen): Make a proper a[href].settings-box with
- icon-external (see: https://crbug.com/684005)-->
- <div class="settings-box two-line" on-click="onFindAppsTap_" actionable
- hidden$="[[!prefs.arc.enabled.value]]">
- <div class="start">
- $i18n{stylusFindMoreAppsPrimary}
- <div class="secondary" id="stylusFindMoreAppsSecondary">
- $i18n{stylusFindMoreAppsSecondary}
- </div>
- </div>
- <paper-icon-button-light class="icon-external">
- <button aria-label="$i18n{stylusFindMoreAppsPrimary}"
- aria-describedby="stylusFindMoreAppsSecondary"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row class="hr" on-click="onFindAppsTap_"
+ hidden$="[[!prefs.arc.enabled.value]]"
+ label="$i18n{stylusFindMoreAppsPrimary}"
+ sub-label="$i18n{stylusFindMoreAppsSecondary}" external></cr-link-row>
<template is="dom-if" if="[[supportsLockScreen_(selectedApp_)]]">
<div id="note-taking-app-lock-screen-settings">
diff --git a/chromium/chrome/browser/resources/settings/downloads_page/downloads_page.html b/chromium/chrome/browser/resources/settings/downloads_page/downloads_page.html
index 3626607833d..47f34404cce 100644
--- a/chromium/chrome/browser/resources/settings/downloads_page/downloads_page.html
+++ b/chromium/chrome/browser/resources/settings/downloads_page/downloads_page.html
@@ -1,5 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="../controls/controlled_button.html">
@@ -52,13 +53,8 @@
label="$i18n{disconnectGoogleDriveAccount}"
hidden="[[!pageVisibility.googleDrive]]">
</settings-toggle-button>
- <div id="smbShares" class="settings-box"
- on-click="onTapSmbShares_" actionable>
- <div class="start"> $i18n{smbSharesTitle} </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{smbSharesTitle}"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="smbShares" class="hr" on-click="onTapSmbShares_"
+ label="$i18n{smbSharesTitle}"></cr-link-row>
</if>
<template is="dom-if" if="[[autoOpenDownloads_]]" restamp>
<div class="settings-box">
diff --git a/chromium/chrome/browser/resources/settings/downloads_page/downloads_page.js b/chromium/chrome/browser/resources/settings/downloads_page/downloads_page.js
index 7ed19e857e2..4ad4f50c39b 100644
--- a/chromium/chrome/browser/resources/settings/downloads_page/downloads_page.js
+++ b/chromium/chrome/browser/resources/settings/downloads_page/downloads_page.js
@@ -55,9 +55,7 @@ Polymer({
const map = new Map();
// <if expr="chromeos">
if (settings.routes.SMB_SHARES) {
- map.set(
- settings.routes.SMB_SHARES.path,
- '#smbShares .subpage-arrow button');
+ map.set(settings.routes.SMB_SHARES.path, '#smbShares');
}
// </if>
return map;
diff --git a/chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html b/chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html
index ddcad97c1bf..61c613ff43a 100644
--- a/chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html
+++ b/chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html
@@ -1,10 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/md_select_css.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="google_assistant_browser_proxy.html">
<link rel="import" href="../controls/controlled_button.html">
<link rel="import" href="../controls/settings_toggle_button.html">
@@ -39,7 +39,7 @@
width: 24px;
}
</style>
- <settings-toggle-button id="googleAssistantEnable"
+ <settings-toggle-button id="google-assistant-enable"
class="first primary-toggle"
pref="{{prefs.settings.voice_interaction.enabled}}"
label="[[getAssistantOnOffLabel_(
@@ -47,20 +47,20 @@
</settings-toggle-button>
<template is="dom-if"
if="[[prefs.settings.voice_interaction.enabled.value]]">
- <settings-toggle-button id="googleAssistantContextEnable"
+ <settings-toggle-button id="google-assistant-context-enable"
pref="{{prefs.settings.voice_interaction.context.enabled}}"
label="$i18n{googleAssistantEnableContext}"
sub-label="$i18n{googleAssistantEnableContextDescription}">
</settings-toggle-button>
<template is="dom-if" if="[[assistantFeatureEnabled_]]">
- <settings-toggle-button id="googleAssistantHotwordEnable"
+ <settings-toggle-button id="google-assistant-hotword-enable"
pref="{{prefs.settings.voice_interaction.hotword.enabled}}"
label="$i18n{googleAssistantEnableHotword}"
sub-label="$i18n{googleAssistantEnableHotwordDescription}"
on-settings-boolean-control-change="onEnableHotwordChange_"
hidden="[[!hotwordDspAvailable_]]">
</settings-toggle-button>
- <div class="settings-box three-line"
+ <div class="settings-box three-line" id="dsp-hotword-container"
hidden="[[hotwordDspAvailable_]]">
<div class="start text-area">
<div class="label">
@@ -80,7 +80,7 @@
pref="{{prefs.settings.voice_interaction.hotword.enabled}}">
</cr-policy-pref-indicator>
</template>
- <select id="dspHotwordState" class="md-select"
+ <select id="dsp-hotword-state" class="md-select"
aria-labelledby="googleAssistantEnableHotword"
on-change="onDspHotwordStateChange_"
disabled="[[hotwordEnforced_]]">
@@ -102,33 +102,27 @@
$i18n{googleAssistantVoiceSettingsDescription}
</div>
</div>
- <controlled-button id="button" class="secondary-button"
+ <controlled-button id="retrain-voice-model" class="secondary-button"
on-click="onRetrainVoiceModelTapped_"
label="$i18n{googleAssistantVoiceSettingsRetrainButton}"
pref="{{prefs.settings.voice_interaction.hotword.enabled}}">
</controlled-button>
</div>
</template>
- <settings-toggle-button id="googleAssistantNotificationEnable"
+ <settings-toggle-button id="google-assistant-notification-enable"
pref="{{prefs.settings.voice_interaction.notification.enabled}}"
label="$i18n{googleAssistantEnableNotification}"
sub-label="$i18n{googleAssistantEnableNotificationDescription}">
</settings-toggle-button>
- <settings-toggle-button id="googleAssistantLaunchWithMicOpen"
+ <settings-toggle-button id="google-assistant-launch-with-mic-open"
pref="{{prefs.settings.voice_interaction.launch_with_mic_open}}"
label="$i18n{googleAssistantLaunchWithMicOpen}"
sub-label="$i18n{googleAssistantLaunchWithMicOpenDescription}">
</settings-toggle-button>
</template>
- <div id="googleAssistantSettings" class="settings-box"
- on-click="onGoogleAssistantSettingsTapped_" actionable>
- <div class="start">
- $i18n{googleAssistantSettings}
- </div>
- <paper-icon-button-light class="icon-external">
- <button aria-label="$i18n{googleAssistantSettings}"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="google-assistant-settings" class="hr"
+ on-click="onGoogleAssistantSettingsTapped_"
+ label="$i18n{googleAssistantSettings}" external></cr-link-row>
</template>
</template>
<script src="google_assistant_page.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js b/chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js
index 5c1aea217de..ca0bb30deb2 100644
--- a/chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js
+++ b/chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js
@@ -151,7 +151,7 @@ Polymer({
/** @private */
onDspHotwordStateChange_: function() {
- switch (Number(this.$$('#dspHotwordState').value)) {
+ switch (Number(this.$$('#dsp-hotword-state').value)) {
case DspHotwordState.DEFAULT_ON:
this.setPrefValue('settings.voice_interaction.hotword.enabled', true);
this.setPrefValue(
@@ -217,8 +217,8 @@ Polymer({
this.dspHotwordState_ = DspHotwordState.DEFAULT_ON;
}
- if (this.$$('#dspHotwordState')) {
- this.$$('#dspHotwordState').value = this.dspHotwordState_;
+ if (this.$$('#dsp-hotword-state')) {
+ this.$$('#dsp-hotword-state').value = this.dspHotwordState_;
}
},
});
diff --git a/chromium/chrome/browser/resources/settings/icons.html b/chromium/chrome/browser/resources/settings/icons.html
index 80ab17e9e1b..da180186d15 100644
--- a/chromium/chrome/browser/resources/settings/icons.html
+++ b/chromium/chrome/browser/resources/settings/icons.html
@@ -120,6 +120,7 @@ List icons here rather than importing large sets of (e.g. Polymer) icons.
<g id="restore"><path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"></path></g>
<g id="rotate-right"><path d="M15.55 5.55L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42l1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z"></path></g>
<g id="sensors"><path d="M10 8.5c-0.8 0-1.5 0.7-1.5 1.5s0.7 1.5 1.5 1.5s1.5-0.7 1.5-1.5S10.8 8.5 10 8.5z M7.6 5.8 C6.2 6.7 5.2 8.2 5.2 10c0 1.8 1 3.4 2.4 4.2l0.8-1.4c-1-0.6-1.6-1.6-1.6-2.8c0-1.2 0.6-2.2 1.6-2.8L7.6 5.8z M14.8 10 c0-1.8-1-3.4-2.4-4.2l-0.8 1.4c0.9 0.6 1.6 1.6 1.6 2.8c0 1.2-0.6 2.2-1.6 2.8l0.8 1.4C13.8 13.4 14.8 11.8 14.8 10z M6 3 c-2.4 1.4-4 4-4 7c0 3 1.6 5.6 4 7l0.8-1.4c-1.9-1.1-3.2-3.2-3.2-5.6c0-2.4 1.3-4.5 3.2-5.6L6 3z M13.2 4.4 c1.9 1.1 3.2 3.2 3.2 5.6c0 2.4-1.3 4.5-3.2 5.6L14 17c2.4-1.4 4-4 4-7c0-3-1.6-5.6-4-7L13.2 4.4z"></path></g>
+ <g id="serial-port"><path stroke="#000" fill="none" stroke-width=".529" d="M1.963 7.039h20.074c.632 0 1.176.836 1 1.443l-2.14 7.339c-.177.606-.51 1.14-1.141 1.14H4.244c-.631 0-.962-.534-1.14-1.14l-2.14-7.3c-.178-.605.367-1.482 1-1.482z"></path><circle r="1.154" cx="4.279" cy="9.882"></circle><circle r="1.154" cx="5.772" cy="14.134"></circle><circle r="1.154" cx="19.892" cy="9.882"></circle><circle r="1.154" cx="15.989" cy="9.882"></circle><circle r="1.154" cx="12.086" cy="9.882"></circle><circle r="1.154" cx="8.183" cy="9.882"></circle><circle r="1.154" cx="9.849" cy="14.134"></circle><circle r="1.154" cx="13.925" cy="14.134"></circle><circle r="1.154" cx="18.002" cy="14.134"></circle></g>
<if expr="chromeos">
<g id="alert-device-out-of-range" fill="none" fill-rule="evenodd"><path d="M-1-1h20v20H-1z"></path><path fill="#C53929" fill-rule="nonzero" d="M8.167 11.5h1.666v1.667H8.167V11.5zm0-6.667h1.666v5H8.167v-5zM8.992.667C4.392.667.667 4.4.667 9s3.725 8.333 8.325 8.333c4.608 0 8.341-3.733 8.341-8.333S13.6.667 8.992.667zm.008 15A6.665 6.665 0 0 1 2.333 9 6.665 6.665 0 0 1 9 2.333 6.665 6.665 0 0 1 15.667 9 6.665 6.665 0 0 1 9 15.667z"></path></g>
<g id="signal-cellular-0-bar"><path fill-opacity=".3" d="M2 22h20V2z"></path></g>
diff --git a/chromium/chrome/browser/resources/settings/images/settings_icon_add_circle.svg b/chromium/chrome/browser/resources/settings/images/settings_icon_add_circle.svg
index 245a9369655..b4422925f95 100644
--- a/chromium/chrome/browser/resources/settings/images/settings_icon_add_circle.svg
+++ b/chromium/chrome/browser/resources/settings/images/settings_icon_add_circle.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="#4285f4" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"></path></svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="#4285f4" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/images/settings_icon_add_wifi.svg b/chromium/chrome/browser/resources/settings/images/settings_icon_add_wifi.svg
index 08358d86470..7174d59523f 100644
--- a/chromium/chrome/browser/resources/settings/images/settings_icon_add_wifi.svg
+++ b/chromium/chrome/browser/resources/settings/images/settings_icon_add_wifi.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="#4285f4" d="M10.92 16.85l-.91 1.14L10 18l-.01-.01L0 5.46C.387 5.164 4.227 2 10 2c5.765 0 9.613 3.165 10 3.46l-2.198 2.756C17.292 8.076 16.755 8 16.2 8c-3.314 0-6 2.686-6 6 0 1.03.26 2.002.72 2.85z" fill-opacity=".3"></path><path fill="#4285f4" d="M17 13v-3h-2v3h-3v2h3v3h2v-3h3v-2h-3z"></path></svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="#4285f4" d="M10.92 16.85l-.91 1.14L10 18l-.01-.01L0 5.46C.387 5.164 4.227 2 10 2c5.765 0 9.613 3.165 10 3.46l-2.198 2.756a6 6 0 0 0-6.882 8.634z" fill-opacity=".3"/><path fill="#4285f4" d="M17 13v-3h-2v3h-3v2h3v3h2v-3h3v-2h-3z"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/images/sync_banner.svg b/chromium/chrome/browser/resources/settings/images/sync_banner.svg
index d85b7c02684..12f4c756f9b 100644
--- a/chromium/chrome/browser/resources/settings/images/sync_banner.svg
+++ b/chromium/chrome/browser/resources/settings/images/sync_banner.svg
@@ -1 +1 @@
-<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="1360" height="240"><defs><clipPath id="a"><path fill="none" d="M0-.36h1360v239.72H0z"/></clipPath></defs><path fill="#f8f9fa" d="M0-.36h1360v240H0z"/><g clip-path="url(#a)"><path d="M458.53 122.23h-1.31V51.9a16.06 16.06 0 0 1 16-16h46.8v1.31h-46.8a14.75 14.75 0 0 0-14.69 14.69z" fill="#bdc0c5"/><path d="M377.09 158a30.17 30.17 0 0 1 30.1 28.82H326a19.6 19.6 0 0 1 26.15-17.2l.87.31.58-.72A30 30 0 0 1 377.09 158m0-1.31a31.38 31.38 0 0 0-24.46 11.7 20.91 20.91 0 0 0-27.94 19.75h83.85a31.44 31.44 0 0 0-31.44-31.44z" fill="#e8e9eb"/><path d="M496.39 207.3h-23.13a14.75 14.75 0 0 1-14.73-14.73v-70.34h-1.31v70.33a16.06 16.06 0 0 0 16 16h23.13zM539.71 36.64V38a14.74 14.74 0 0 1 9.82 13.87v71.43h1.31V51.9a16.06 16.06 0 0 0-11.13-15.26z" fill="#bdc0c5"/><path d="M531.89 199.89h-56.43A10.44 10.44 0 0 1 465 189.46v-135A10.44 10.44 0 0 1 475.46 44h56.43a10.44 10.44 0 0 1 10.43 10.43v135a10.44 10.44 0 0 1-10.43 10.46zM475.46 45.3a9.13 9.13 0 0 0-9.12 9.12v135a9.13 9.13 0 0 0 9.12 9.12h56.43a9.13 9.13 0 0 0 9.12-9.12v-135a9.13 9.13 0 0 0-9.12-9.12z" fill="#e8e9eb"/><path d="M549.53 178.93v13.64a14.75 14.75 0 0 1-14.73 14.73h-23.13v1.31h23.13a16.06 16.06 0 0 0 16-16v-13.68z" fill="#e54440"/><path d="M629 90.92a39.3 39.3 0 1 1-39.3 39.3 39.35 39.35 0 0 1 39.3-39.3m0-2.62a41.92 41.92 0 1 0 42 41.93 41.92 41.92 0 0 0-42-41.93z" fill="#e8e9eb"/><circle cx="650.37" cy="145.95" r="5.24" fill="#4b87f1"/><circle cx="563.16" cy="130.23" r="41.92" fill="#34a751"/><path d="M587.12 130.23a41.73 41.73 0 0 0 9 25.92 41.88 41.88 0 0 0 0-51.83 41.73 41.73 0 0 0-9 25.91z" opacity=".12"/><path d="M457.17 75.43V65c21.47 0 38.35-6 50.18-17.91C525.93 28.37 526 1.06 526 .79l10.5-.08c0 1.29 0 31.8-21.63 53.64-13.87 13.99-33.29 21.08-57.7 21.08z" fill="#f7bb2a"/><path d="M387.74 137h-10.49a80.9 80.9 0 0 1 10-36c9.21-16.42 28.8-36 69.92-36v10.43c-28.93 0-49.37 10.34-60.77 30.72a70.69 70.69 0 0 0-8.66 30.85z" fill="#e8e9eb"/><path d="M562.83 146.74v-5.08h.66v3.5l4.93-4.93-4.93-4.93v3.5h-.66v-5.08l6.51 6.51zm.66-20l-6.49-6.52 6.51-6.51v5.08h-.66v-3.5l-4.93 4.93 4.93 4.93v-3.5h.66z" fill="#fff"/><path d="M572.14 135.51l-.56-.33a9.77 9.77 0 0 0-8.42-14.72v-.66a10.42 10.42 0 0 1 9 15.71zM563.16 140.64a10.42 10.42 0 0 1-9-15.71l.56.33a9.77 9.77 0 0 0 8.44 14.74z" fill="#fff"/><path d="M112 114.83H76.35v-.54a17.82 17.82 0 0 1 35.64 0zm-34.55-1.08h33.45a16.74 16.74 0 0 0-33.46 0z" fill="#bdc0c5"/><path d="M433.65 136.79h-34.56a17.28 17.28 0 1 1 34.56 0z" fill="#e8e9eb"/><path d="M339.22 200H157.78V75.65a5.3 5.3 0 0 1 5.28-5.28h170.88a5.3 5.3 0 0 1 5.28 5.28z" fill="#f4f4f4"/><path d="M330.58 71.45a7.57 7.57 0 0 1 7.56 7.55v119.89H158.86V79a7.57 7.57 0 0 1 7.56-7.56h164.16m0-1.08H166.42a8.67 8.67 0 0 0-8.64 8.64v121h181.44V79a8.67 8.67 0 0 0-8.64-8.64zM131.86 207.53h233.28v1.08H131.86z" fill="#bdc0c5"/><path d="M169.2 115.84a25.87 25.87 0 0 0-20.2 9.64 17.24 17.24 0 0 0-23 16.28h69.12a25.92 25.92 0 0 0-25.92-25.92z" fill="#fff"/><path d="M195.66 142.3h-70.2v-.54a17.78 17.78 0 0 1 23.39-16.91 26.46 26.46 0 0 1 46.81 16.91zm-69.11-1.08h68a25.38 25.38 0 0 0-45.12-15.4l-.24.3-.36-.13a16.7 16.7 0 0 0-22.31 15.23z" fill="#bdc0c5"/><path d="M76.24 163.72l7.41-7.41c15.18 15.18 31.38 22.86 48.15 22.82 26.34-.06 45.71-19.31 45.9-19.5l7.47 7.35c-.9.92-22.47 22.5-53.22 22.63-19.71.08-38.45-8.61-55.71-25.89z" fill="#4285f4"/><path d="M-16.4 158.16l-7.41-7.41a80.9 80.9 0 0 1 32.5-18.36c18.15-5.14 45.89-5.16 75 23.92l-7.41 7.41c-20.5-20.46-42.28-27.61-64.74-21.25a70.69 70.69 0 0 0-27.94 15.69z" fill="#e8e9eb"/><path d="M1273.24 78.47a22.41 22.41 0 1 1 8.31-1.61 22.29 22.29 0 0 1-8.31 1.61zm0-43.53a21.16 21.16 0 0 0-19.64 29 21.14 21.14 0 1 0 19.64-29zM1238 259h-160a13.57 13.57 0 0 1-13.55-13.55v-20h1.2v20a12.37 12.37 0 0 0 12.35 12.31h160a12.37 12.37 0 0 0 12.35-12.35v-87.1A12.37 12.37 0 0 0 1238 146h-24v-1.2h24a13.57 13.57 0 0 1 13.55 13.55v87.05A13.57 13.57 0 0 1 1238 259z" fill="#bdc0c5"/><path fill="#bdc0c5" d="M1214.01 145.96H1122l6-1.2h86.01v1.2z"/><path d="M1065.6 199.36h-1.2v-41a13.57 13.57 0 0 1 13.6-13.6h59V146h-59a12.37 12.37 0 0 0-12.35 12.35z" fill="#bdc0c5"/><path d="M1080 185.56a28.74 28.74 0 0 0-22.41 10.71 19.16 19.16 0 0 0-25.59 18.09h76.8a28.8 28.8 0 0 0-28.8-28.8z" fill="#fff"/><path d="M1109.45 215h-78v-.6a19.76 19.76 0 0 1 26-18.79 29.4 29.4 0 0 1 52 18.79zm-76.79-1.2h75.59a28.2 28.2 0 0 0-50.13-17.11l-.27.33-.4-.14a18.55 18.55 0 0 0-24.78 16.92z" fill="#bdc0c5"/><path fill="#f8f9fa" d="M997.34 58.76l71.32-60.81"/><path fill="#e8e9eb" d="M996.638 57.935l71.36-60.755 1.297 1.523-71.36 60.754zM1282.86 111.16h-11.65a89.89 89.89 0 0 0 11.11 40c10.22 18.29 32 40.1 77.68 40.1v-11.68c-32.14 0-54.86-11.49-67.52-34.14a78.55 78.55 0 0 1-9.62-34.28z"/></g></svg> \ No newline at end of file
+<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="1360" height="240"><defs><clipPath id="a"><path fill="none" d="M0-.36h1360v239.72H0z"/></clipPath></defs><path fill="#f8f9fa" d="M0-.36h1360v240H0z"/><g clip-path="url(#a)"><path d="M458.53 122.23h-1.31V51.9a16.06 16.06 0 0 1 16-16h46.8v1.31h-46.8a14.75 14.75 0 0 0-14.69 14.69z" fill="#bdc0c5"/><path d="M377.09 158a30.17 30.17 0 0 1 30.1 28.82H326a19.6 19.6 0 0 1 26.15-17.2l.87.31.58-.72A30 30 0 0 1 377.09 158m0-1.31a31.38 31.38 0 0 0-24.46 11.7 20.91 20.91 0 0 0-27.94 19.75h83.85a31.44 31.44 0 0 0-31.44-31.44z" fill="#e8e9eb"/><path d="M496.39 207.3h-23.13a14.75 14.75 0 0 1-14.73-14.73v-70.34h-1.31v70.33a16.06 16.06 0 0 0 16 16h23.13zm43.32-170.66V38a14.74 14.74 0 0 1 9.82 13.87v71.43h1.31V51.9a16.06 16.06 0 0 0-11.13-15.26z" fill="#bdc0c5"/><path d="M531.89 199.89h-56.43A10.44 10.44 0 0 1 465 189.46v-135A10.44 10.44 0 0 1 475.46 44h56.43a10.44 10.44 0 0 1 10.43 10.43v135a10.44 10.44 0 0 1-10.43 10.46zM475.46 45.3a9.13 9.13 0 0 0-9.12 9.12v135a9.13 9.13 0 0 0 9.12 9.12h56.43a9.13 9.13 0 0 0 9.12-9.12v-135a9.13 9.13 0 0 0-9.12-9.12z" fill="#e8e9eb"/><path d="M549.53 178.93v13.64a14.75 14.75 0 0 1-14.73 14.73h-23.13v1.31h23.13a16.06 16.06 0 0 0 16-16v-13.68z" fill="#e54440"/><path d="M629 90.92a39.3 39.3 0 1 1-39.3 39.3 39.35 39.35 0 0 1 39.3-39.3m0-2.62a41.92 41.92 0 1 0 42 41.93 41.92 41.92 0 0 0-42-41.93z" fill="#e8e9eb"/><circle cx="650.37" cy="145.95" r="5.24" fill="#4b87f1"/><circle cx="563.16" cy="130.23" r="41.92" fill="#34a751"/><path d="M587.12 130.23a41.73 41.73 0 0 0 9 25.92 41.88 41.88 0 0 0 0-51.83 41.73 41.73 0 0 0-9 25.91z" opacity=".12"/><path d="M457.17 75.43V65c21.47 0 38.35-6 50.18-17.91C525.93 28.37 526 1.06 526 .79l10.5-.08c0 1.29 0 31.8-21.63 53.64-13.87 13.99-33.29 21.08-57.7 21.08z" fill="#f7bb2a"/><path d="M387.74 137h-10.49a80.9 80.9 0 0 1 10-36c9.21-16.42 28.8-36 69.92-36v10.43c-28.93 0-49.37 10.34-60.77 30.72a70.69 70.69 0 0 0-8.66 30.85z" fill="#e8e9eb"/><path d="M562.83 146.74v-5.08h.66v3.5l4.93-4.93-4.93-4.93v3.5h-.66v-5.08l6.51 6.51zm.66-20l-6.49-6.52 6.51-6.51v5.08h-.66v-3.5l-4.93 4.93 4.93 4.93v-3.5h.66z" fill="#fff"/><path d="M572.14 135.51l-.56-.33a9.77 9.77 0 0 0-8.42-14.72v-.66a10.42 10.42 0 0 1 9 15.71zm-8.98 5.13a10.42 10.42 0 0 1-9-15.71l.56.33a9.77 9.77 0 0 0 8.44 14.74z" fill="#fff"/><path d="M112 114.83H76.35v-.54a17.82 17.82 0 0 1 35.64 0zm-34.55-1.08h33.45a16.74 16.74 0 0 0-33.46 0z" fill="#bdc0c5"/><path d="M433.65 136.79h-34.56a17.28 17.28 0 1 1 34.56 0z" fill="#e8e9eb"/><path d="M339.22 200H157.78V75.65a5.3 5.3 0 0 1 5.28-5.28h170.88a5.3 5.3 0 0 1 5.28 5.28z" fill="#f4f4f4"/><path d="M330.58 71.45a7.57 7.57 0 0 1 7.56 7.55v119.89H158.86V79a7.57 7.57 0 0 1 7.56-7.56h164.16m0-1.08H166.42a8.67 8.67 0 0 0-8.64 8.64v121h181.44V79a8.67 8.67 0 0 0-8.64-8.64zM131.86 207.53h233.28v1.08H131.86z" fill="#bdc0c5"/><path d="M169.2 115.84a25.87 25.87 0 0 0-20.2 9.64 17.24 17.24 0 0 0-23 16.28h69.12a25.92 25.92 0 0 0-25.92-25.92z" fill="#fff"/><path d="M195.66 142.3h-70.2v-.54a17.78 17.78 0 0 1 23.39-16.91 26.46 26.46 0 0 1 46.81 16.91zm-69.11-1.08h68a25.38 25.38 0 0 0-45.12-15.4l-.24.3-.36-.13a16.7 16.7 0 0 0-22.31 15.23z" fill="#bdc0c5"/><path d="M76.24 163.72l7.41-7.41c15.18 15.18 31.38 22.86 48.15 22.82 26.34-.06 45.71-19.31 45.9-19.5l7.47 7.35c-.9.92-22.47 22.5-53.22 22.63-19.71.08-38.45-8.61-55.71-25.89z" fill="#4285f4"/><path d="M-16.4 158.16l-7.41-7.41a80.9 80.9 0 0 1 32.5-18.36c18.15-5.14 45.89-5.16 75 23.92l-7.41 7.41c-20.5-20.46-42.28-27.61-64.74-21.25a70.69 70.69 0 0 0-27.94 15.69z" fill="#e8e9eb"/><path d="M1273.24 78.47a22.41 22.41 0 1 1 8.31-1.61 22.29 22.29 0 0 1-8.31 1.61zm0-43.53a21.16 21.16 0 0 0-19.64 29 21.14 21.14 0 1 0 19.64-29zM1238 259h-160a13.57 13.57 0 0 1-13.55-13.55v-20h1.2v20a12.37 12.37 0 0 0 12.35 12.31h160a12.37 12.37 0 0 0 12.35-12.35v-87.1A12.37 12.37 0 0 0 1238 146h-24v-1.2h24a13.57 13.57 0 0 1 13.55 13.55v87.05A13.57 13.57 0 0 1 1238 259z" fill="#bdc0c5"/><path fill="#bdc0c5" d="M1214.01 145.96H1122l6-1.2h86.01v1.2z"/><path d="M1065.6 199.36h-1.2v-41a13.57 13.57 0 0 1 13.6-13.6h59V146h-59a12.37 12.37 0 0 0-12.35 12.35z" fill="#bdc0c5"/><path d="M1080 185.56a28.74 28.74 0 0 0-22.41 10.71 19.16 19.16 0 0 0-25.59 18.09h76.8a28.8 28.8 0 0 0-28.8-28.8z" fill="#fff"/><path d="M1109.45 215h-78v-.6a19.76 19.76 0 0 1 26-18.79 29.4 29.4 0 0 1 52 18.79zm-76.79-1.2h75.59a28.2 28.2 0 0 0-50.13-17.11l-.27.33-.4-.14a18.55 18.55 0 0 0-24.78 16.92z" fill="#bdc0c5"/><path fill="#f8f9fa" d="M997.34 58.76l71.32-60.81"/><path fill="#e8e9eb" d="M996.638 57.935l71.36-60.755 1.297 1.523-71.36 60.754zm286.222 53.225h-11.65a89.89 89.89 0 0 0 11.11 40c10.22 18.29 32 40.1 77.68 40.1v-11.68c-32.14 0-54.86-11.49-67.52-34.14a78.55 78.55 0 0 1-9.62-34.28z"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/images/sync_banner_dark.svg b/chromium/chrome/browser/resources/settings/images/sync_banner_dark.svg
index 0de1230a121..42cc59bc033 100644
--- a/chromium/chrome/browser/resources/settings/images/sync_banner_dark.svg
+++ b/chromium/chrome/browser/resources/settings/images/sync_banner_dark.svg
@@ -1 +1 @@
-<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="1360" height="240"><path fill="#28282b" d="M-14.74-2.96h1389.47v245.2H-14.74z"/><path d="M458.53 122.23h-1.31V51.9a16.06 16.06 0 0 1 16-16h46.8v1.31h-46.8a14.75 14.75 0 0 0-14.69 14.69zM377.09 158a30.17 30.17 0 0 1 30.1 28.82H326a19.6 19.6 0 0 1 26.15-17.2l.87.31.58-.72A30 30 0 0 1 377.09 158m0-1.31a31.38 31.38 0 0 0-24.46 11.7 20.91 20.91 0 0 0-27.94 19.75h83.85a31.44 31.44 0 0 0-31.44-31.44zM496.39 207.3h-23.13a14.75 14.75 0 0 1-14.73-14.73v-70.34h-1.31v70.33a16.06 16.06 0 0 0 16 16h23.13zM539.71 36.64V38a14.74 14.74 0 0 1 9.82 13.87v71.43h1.31V51.9a16.06 16.06 0 0 0-11.13-15.26z" fill="#5f6368"/><path d="M531.89 199.89h-56.43A10.44 10.44 0 0 1 465 189.46v-135A10.44 10.44 0 0 1 475.46 44h56.43a10.44 10.44 0 0 1 10.43 10.43v135a10.44 10.44 0 0 1-10.43 10.46zM475.46 45.3a9.13 9.13 0 0 0-9.12 9.12v135a9.13 9.13 0 0 0 9.12 9.12h56.43a9.13 9.13 0 0 0 9.12-9.12v-135a9.13 9.13 0 0 0-9.12-9.12z" fill="#4e5154"/><path d="M549.53 178.93v13.64a14.75 14.75 0 0 1-14.73 14.73h-23.13v1.31h23.13a16.06 16.06 0 0 0 16-16v-13.68z" fill="#f18a81"/><path d="M629 90.92a39.3 39.3 0 1 1-39.3 39.3 39.35 39.35 0 0 1 39.3-39.3m0-2.62a41.92 41.92 0 1 0 42 41.93 41.92 41.92 0 0 0-42-41.93z" fill="#5f6368"/><circle cx="650.37" cy="145.95" r="5.24" fill="#8ab4f8"/><circle cx="563.16" cy="130.23" r="41.92" fill="#81c995"/><path d="M587.12 130.23a41.73 41.73 0 0 0 9 25.92 41.88 41.88 0 0 0 0-51.83 41.73 41.73 0 0 0-9 25.91z" opacity=".12"/><path d="M457.17 75.43V65c21.47 0 38.35-6 50.18-17.91C525.93 28.37 526 1.06 526 .79l10.5-.08c0 1.29 0 31.8-21.63 53.64-13.87 13.99-33.29 21.08-57.7 21.08z" fill="#f7bb2a"/><path d="M387.74 137h-10.49a80.9 80.9 0 0 1 10-36c9.21-16.42 28.8-36 69.92-36v10.43c-28.93 0-49.37 10.34-60.77 30.72a70.69 70.69 0 0 0-8.66 30.85z" fill="#414447"/><path d="M562.83 146.74v-5.08h.66v3.5l4.93-4.93-4.93-4.93v3.5h-.66v-5.08l6.51 6.51zm.66-20l-6.49-6.52 6.51-6.51v5.08h-.66v-3.5l-4.93 4.93 4.93 4.93v-3.5h.66z" fill="#292a2d"/><path d="M572.14 135.51l-.56-.33a9.77 9.77 0 0 0-8.42-14.72v-.66a10.42 10.42 0 0 1 9 15.71zM563.16 140.64a10.42 10.42 0 0 1-9-15.71l.56.33a9.77 9.77 0 0 0 8.44 14.74z" fill="#292a2d"/><path d="M112 114.83H76.35v-.54a17.82 17.82 0 0 1 35.64 0zm-34.55-1.08h33.45a16.74 16.74 0 0 0-33.46 0z" fill="#5f6368"/><path d="M433.65 136.79h-34.56a17.28 17.28 0 1 1 34.56 0z" fill="#414447"/><path d="M339.22 200H157.78V75.65a5.3 5.3 0 0 1 5.28-5.28h170.88a5.3 5.3 0 0 1 5.28 5.28z" fill="#262628"/><path d="M330.58 71.45a7.57 7.57 0 0 1 7.56 7.55v119.89H158.86V79a7.57 7.57 0 0 1 7.56-7.56h164.16m0-1.08H166.42a8.67 8.67 0 0 0-8.64 8.64v121h181.44V79a8.67 8.67 0 0 0-8.64-8.64zM131.86 207.53h233.28v1.08H131.86z" fill="#5f6368"/><path d="M169.2 115.84a25.87 25.87 0 0 0-20.2 9.64 17.24 17.24 0 0 0-23 16.28h69.12a25.92 25.92 0 0 0-25.92-25.92z" fill="#292a2d"/><path d="M195.66 142.3h-70.2v-.54a17.78 17.78 0 0 1 23.39-16.91 26.46 26.46 0 0 1 46.81 16.91zm-69.11-1.08h68a25.38 25.38 0 0 0-45.12-15.4l-.24.3-.36-.13a16.7 16.7 0 0 0-22.31 15.23z" fill="#5f6368"/><path d="M76.24 163.72l7.41-7.41c15.18 15.18 31.38 22.86 48.15 22.82 26.34-.06 45.71-19.31 45.9-19.5l7.47 7.35c-.9.92-22.47 22.5-53.22 22.63-19.71.08-38.45-8.61-55.71-25.89z" fill="#8ab4f8"/><path d="M-16.4 158.16l-7.41-7.41a80.9 80.9 0 0 1 32.5-18.36c18.15-5.14 45.89-5.16 75 23.92l-7.41 7.41c-20.5-20.46-42.28-27.61-64.74-21.25a70.69 70.69 0 0 0-27.94 15.69z" fill="#414447"/><path d="M1273.24 78.47a22.41 22.41 0 1 1 8.31-1.61 22.29 22.29 0 0 1-8.31 1.61zm0-43.53a21.16 21.16 0 0 0-19.64 29 21.14 21.14 0 1 0 19.64-29zM1238 259h-160a13.57 13.57 0 0 1-13.55-13.55v-20h1.2v20a12.37 12.37 0 0 0 12.35 12.31h160a12.37 12.37 0 0 0 12.35-12.35v-87.1A12.37 12.37 0 0 0 1238 146h-24v-1.2h24a13.57 13.57 0 0 1 13.55 13.55v87.05A13.57 13.57 0 0 1 1238 259z" fill="#5f6368"/><path fill="#5f6368" d="M1214.01 145.96H1122l6-1.2h86.01v1.2z"/><path d="M1065.6 199.36h-1.2v-41a13.57 13.57 0 0 1 13.6-13.6h59V146h-59a12.37 12.37 0 0 0-12.35 12.35z" fill="#5f6368"/><path d="M1080 185.56a28.74 28.74 0 0 0-22.41 10.71 19.16 19.16 0 0 0-25.59 18.09h76.8a28.8 28.8 0 0 0-28.8-28.8z" fill="#262628"/><path d="M1109.45 215h-78v-.6a19.76 19.76 0 0 1 26-18.79 29.4 29.4 0 0 1 52 18.79zm-76.79-1.2h75.59a28.2 28.2 0 0 0-50.13-17.11l-.27.33-.4-.14a18.55 18.55 0 0 0-24.78 16.92z" fill="#5f6368"/><path fill="#f8f9fa" d="M997.34 58.76l71.32-60.81"/><path fill="#5f6368" d="M996.638 57.935l71.36-60.755 1.297 1.523-71.36 60.754z"/><path d="M1282.86 111.16h-11.65a89.89 89.89 0 0 0 11.11 40c10.22 18.29 32 40.1 77.68 40.1v-11.68c-32.14 0-54.86-11.49-67.52-34.14a78.55 78.55 0 0 1-9.62-34.28z" fill="#414447"/><path fill="none" d="M0-.36h1360v239.72H0z"/></svg> \ No newline at end of file
+<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="1360" height="240"><path fill="#28282b" d="M-14.74-2.96h1389.47v245.2H-14.74z"/><path d="M458.53 122.23h-1.31V51.9a16.06 16.06 0 0 1 16-16h46.8v1.31h-46.8a14.75 14.75 0 0 0-14.69 14.69zM377.09 158a30.17 30.17 0 0 1 30.1 28.82H326a19.6 19.6 0 0 1 26.15-17.2l.87.31.58-.72A30 30 0 0 1 377.09 158m0-1.31a31.38 31.38 0 0 0-24.46 11.7 20.91 20.91 0 0 0-27.94 19.75h83.85a31.44 31.44 0 0 0-31.44-31.44zm119.3 50.61h-23.13a14.75 14.75 0 0 1-14.73-14.73v-70.34h-1.31v70.33a16.06 16.06 0 0 0 16 16h23.13zm43.32-170.66V38a14.74 14.74 0 0 1 9.82 13.87v71.43h1.31V51.9a16.06 16.06 0 0 0-11.13-15.26z" fill="#5f6368"/><path d="M531.89 199.89h-56.43A10.44 10.44 0 0 1 465 189.46v-135A10.44 10.44 0 0 1 475.46 44h56.43a10.44 10.44 0 0 1 10.43 10.43v135a10.44 10.44 0 0 1-10.43 10.46zM475.46 45.3a9.13 9.13 0 0 0-9.12 9.12v135a9.13 9.13 0 0 0 9.12 9.12h56.43a9.13 9.13 0 0 0 9.12-9.12v-135a9.13 9.13 0 0 0-9.12-9.12z" fill="#4e5154"/><path d="M549.53 178.93v13.64a14.75 14.75 0 0 1-14.73 14.73h-23.13v1.31h23.13a16.06 16.06 0 0 0 16-16v-13.68z" fill="#f18a81"/><path d="M629 90.92a39.3 39.3 0 1 1-39.3 39.3 39.35 39.35 0 0 1 39.3-39.3m0-2.62a41.92 41.92 0 1 0 42 41.93 41.92 41.92 0 0 0-42-41.93z" fill="#5f6368"/><circle cx="650.37" cy="145.95" r="5.24" fill="#8ab4f8"/><circle cx="563.16" cy="130.23" r="41.92" fill="#81c995"/><path d="M587.12 130.23a41.73 41.73 0 0 0 9 25.92 41.88 41.88 0 0 0 0-51.83 41.73 41.73 0 0 0-9 25.91z" opacity=".12"/><path d="M457.17 75.43V65c21.47 0 38.35-6 50.18-17.91C525.93 28.37 526 1.06 526 .79l10.5-.08c0 1.29 0 31.8-21.63 53.64-13.87 13.99-33.29 21.08-57.7 21.08z" fill="#f7bb2a"/><path d="M387.74 137h-10.49a80.9 80.9 0 0 1 10-36c9.21-16.42 28.8-36 69.92-36v10.43c-28.93 0-49.37 10.34-60.77 30.72a70.69 70.69 0 0 0-8.66 30.85z" fill="#414447"/><path d="M562.83 146.74v-5.08h.66v3.5l4.93-4.93-4.93-4.93v3.5h-.66v-5.08l6.51 6.51zm.66-20l-6.49-6.52 6.51-6.51v5.08h-.66v-3.5l-4.93 4.93 4.93 4.93v-3.5h.66z" fill="#292a2d"/><path d="M572.14 135.51l-.56-.33a9.77 9.77 0 0 0-8.42-14.72v-.66a10.42 10.42 0 0 1 9 15.71zm-8.98 5.13a10.42 10.42 0 0 1-9-15.71l.56.33a9.77 9.77 0 0 0 8.44 14.74z" fill="#292a2d"/><path d="M112 114.83H76.35v-.54a17.82 17.82 0 0 1 35.64 0zm-34.55-1.08h33.45a16.74 16.74 0 0 0-33.46 0z" fill="#5f6368"/><path d="M433.65 136.79h-34.56a17.28 17.28 0 1 1 34.56 0z" fill="#414447"/><path d="M339.22 200H157.78V75.65a5.3 5.3 0 0 1 5.28-5.28h170.88a5.3 5.3 0 0 1 5.28 5.28z" fill="#262628"/><path d="M330.58 71.45a7.57 7.57 0 0 1 7.56 7.55v119.89H158.86V79a7.57 7.57 0 0 1 7.56-7.56h164.16m0-1.08H166.42a8.67 8.67 0 0 0-8.64 8.64v121h181.44V79a8.67 8.67 0 0 0-8.64-8.64zM131.86 207.53h233.28v1.08H131.86z" fill="#5f6368"/><path d="M169.2 115.84a25.87 25.87 0 0 0-20.2 9.64 17.24 17.24 0 0 0-23 16.28h69.12a25.92 25.92 0 0 0-25.92-25.92z" fill="#292a2d"/><path d="M195.66 142.3h-70.2v-.54a17.78 17.78 0 0 1 23.39-16.91 26.46 26.46 0 0 1 46.81 16.91zm-69.11-1.08h68a25.38 25.38 0 0 0-45.12-15.4l-.24.3-.36-.13a16.7 16.7 0 0 0-22.31 15.23z" fill="#5f6368"/><path d="M76.24 163.72l7.41-7.41c15.18 15.18 31.38 22.86 48.15 22.82 26.34-.06 45.71-19.31 45.9-19.5l7.47 7.35c-.9.92-22.47 22.5-53.22 22.63-19.71.08-38.45-8.61-55.71-25.89z" fill="#8ab4f8"/><path d="M-16.4 158.16l-7.41-7.41a80.9 80.9 0 0 1 32.5-18.36c18.15-5.14 45.89-5.16 75 23.92l-7.41 7.41c-20.5-20.46-42.28-27.61-64.74-21.25a70.69 70.69 0 0 0-27.94 15.69z" fill="#414447"/><path d="M1273.24 78.47a22.41 22.41 0 1 1 8.31-1.61 22.29 22.29 0 0 1-8.31 1.61zm0-43.53a21.16 21.16 0 0 0-19.64 29 21.14 21.14 0 1 0 19.64-29zM1238 259h-160a13.57 13.57 0 0 1-13.55-13.55v-20h1.2v20a12.37 12.37 0 0 0 12.35 12.31h160a12.37 12.37 0 0 0 12.35-12.35v-87.1A12.37 12.37 0 0 0 1238 146h-24v-1.2h24a13.57 13.57 0 0 1 13.55 13.55v87.05A13.57 13.57 0 0 1 1238 259z" fill="#5f6368"/><path fill="#5f6368" d="M1214.01 145.96H1122l6-1.2h86.01v1.2z"/><path d="M1065.6 199.36h-1.2v-41a13.57 13.57 0 0 1 13.6-13.6h59V146h-59a12.37 12.37 0 0 0-12.35 12.35z" fill="#5f6368"/><path d="M1080 185.56a28.74 28.74 0 0 0-22.41 10.71 19.16 19.16 0 0 0-25.59 18.09h76.8a28.8 28.8 0 0 0-28.8-28.8z" fill="#262628"/><path d="M1109.45 215h-78v-.6a19.76 19.76 0 0 1 26-18.79 29.4 29.4 0 0 1 52 18.79zm-76.79-1.2h75.59a28.2 28.2 0 0 0-50.13-17.11l-.27.33-.4-.14a18.55 18.55 0 0 0-24.78 16.92z" fill="#5f6368"/><path fill="#f8f9fa" d="M997.34 58.76l71.32-60.81"/><path fill="#5f6368" d="M996.638 57.935l71.36-60.755 1.297 1.523-71.36 60.754z"/><path d="M1282.86 111.16h-11.65a89.89 89.89 0 0 0 11.11 40c10.22 18.29 32 40.1 77.68 40.1v-11.68c-32.14 0-54.86-11.49-67.52-34.14a78.55 78.55 0 0 1-9.62-34.28z" fill="#414447"/><path fill="none" d="M0-.36h1360v239.72H0z"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/internet_page/OWNERS b/chromium/chrome/browser/resources/settings/internet_page/OWNERS
new file mode 100644
index 00000000000..137a1129bd3
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/internet_page/OWNERS
@@ -0,0 +1 @@
+file://chromeos/network/OWNERS
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html b/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html
index 907239d7520..e178d57addd 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html
@@ -24,6 +24,7 @@
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../prefs/prefs.html">
<link rel="import" href="../route.html">
+<link rel="import" href="internet_page_browser_proxy.html">
<link rel="import" href="internet_shared_css.html">
<link rel="import" href="network_proxy_section.html">
<link rel="import" href="tether_connection_dialog.html">
@@ -106,6 +107,8 @@
prefs.vpn_config_allowed)]]">
$i18n{networkButtonConfigure}
</paper-button>
+ <!-- Use policy properties from vpn_config_allowed to indicate when that
+ pref disables buttons in this row. -->
<controlled-button id="connect" action-button on-click="onConnectTap_"
hidden$="[[!showConnect_(networkProperties_, globalPolicy,
managedNetworkAvailable)]]"
@@ -113,14 +116,14 @@
networkPropertiesReceived_, outOfRange_, globalPolicy,
managedNetworkAvailable)]]"
label="$i18n{networkButtonConnect}"
- pref="[[getVpnConfigPrefFromValue_(networkProperties_,
+ pref="[[getFakeVpnConfigPrefForEnforcement_(networkProperties_,
prefs.vpn_config_allowed)]]">
</controlled-button>
<controlled-button id="disconnect" action-button
on-click="onDisconnectTap_"
hidden$="[[!showDisconnect_(networkProperties_)]]"
label="$i18n{networkButtonDisconnect}"
- pref="[[getVpnConfigPrefFromValue_(networkProperties_,
+ pref="[[getFakeVpnConfigPrefForEnforcement_(networkProperties_,
prefs.vpn_config_allowed)]]">
</controlled-button>
</div>
@@ -155,14 +158,16 @@
<template is="dom-if"
if="[[showPreferNetwork_(networkProperties_, globalPolicy,
managedNetworkAvailable)]]">
- <div class="settings-box">
+ <div class="settings-box" on-click="onPreferNetworkRowClicked_"
+ actionable$="[[!isNetworkPolicyEnforced(
+ networkProperties_.Priority)]]">
<div id="preferNetworkToggleLabel" class="start settings-box-text">
$i18n{networkPrefer}
</div>
<cr-policy-network-indicator
property="[[networkProperties_.Priority]]">
</cr-policy-network-indicator>
- <cr-toggle checked="{{preferNetwork_}}"
+ <cr-toggle id="preferNetworkToggle" checked="{{preferNetwork_}}"
disabled="[[isNetworkPolicyEnforced(
networkProperties_.Priority)]]"
aria-labelledby="preferNetworkToggleLabel">
@@ -173,45 +178,18 @@
<template is="dom-if"
if="[[showAutoConnect_(networkProperties_, globalPolicy,
managedNetworkAvailable)]]">
- <div class="settings-box">
- <div id="autoConnectToggleLabel" class="start settings-box-text">
- $i18n{networkAutoConnect}
- </div>
- <template is="dom-if" if="[[isAutoConnectEnforcedByPolicy(
- networkProperties_, globalPolicy)]]">
- <cr-policy-indicator indicator-type="devicePolicy">
- </cr-policy-indicator>
- </template>
- <cr-toggle checked="{{autoConnect_}}"
- disabled="[[isAutoConnectEnforcedByPolicy(networkProperties_,
- globalPolicy)]]"
- aria-labelledby="autoConnectToggleLabel">
- </cr-toggle>
- </div>
+ <settings-toggle-button
+ pref="{{autoConnect_}}"
+ label="[[getAutoConnectToggleLabel_(networkProperties_)]]">
+ </settings-toggle-button>
</template>
<!-- Always-on VPN. -->
<template is="dom-if"
if="[[showAlwaysOnVpn_(networkProperties_)]]">
- <div class="settings-box">
- <div id="AlwaysOnVpnToggleLabel" class="start settings-box-text">
- $i18n{networkAlwaysOnVpn}
- </div>
- <cr-toggle checked="{{alwaysOnVpn_}}"
- disabled="[[!enableAlwaysOnVpn_(networkProperties_,
- prefs.vpn_config_allowed)]]"
- aria-labelledby="AlwaysOnVpnToggleLabel"
- on-change="onAlwaysOnVpnChange_">
- </cr-toggle>
- <template is="dom-if"
- if="[[!enableAlwaysOnVpn_(networkProperties_,
- prefs.vpn_config_allowed)]]">
- <cr-policy-pref-indicator
- pref="[[getVpnConfigPrefFromValue_(networkProperties_,
- prefs.vpn_config_allowed)]]" on-click="onIndicatorTap_"
- icon-aria-label="$i18n{networkAlwaysOnVpn}">
- </cr-policy-pref-indicator>
- </template>
- </div>
+ <settings-toggle-button id="alwaysOnVpnToggle"
+ pref="{{alwaysOnVpn_}}"
+ label="$i18n{networkAlwaysOnVpn}">
+ </settings-toggle-button>
</template>
<!-- Data roaming (Cellular only). -->
<template is="dom-if" if="[[isCellular_(networkProperties_)]]">
@@ -224,8 +202,7 @@
<template is="dom-if" if="[[showCellularSim_(networkProperties_)]]"
restamp>
<div class="settings-box single-column stretch">
- <network-siminfo
- editable on-siminfo-change="onNetworkPropertyChange_"
+ <network-siminfo on-siminfo-change="onNetworkPropertyChange_"
network-properties="[[networkProperties_]]"
networking-private="[[networkingPrivate]]">
</network-siminfo>
@@ -309,7 +286,7 @@
<!-- APN -->
<template is="dom-if" if="[[isCellular_(networkProperties_)]]">
- <network-apnlist editable on-apn-change="onNetworkPropertyChange_"
+ <network-apnlist on-apn-change="onNetworkPropertyChange_"
network-properties="[[networkProperties_]]">
</network-apnlist>
</template>
@@ -317,11 +294,10 @@
<!-- IP Config, Nameservers -->
<template is="dom-if"
if="[[isRememberedOrConnected_(networkProperties_)]]">
- <network-ip-config editable on-ip-change="onIPConfigChange_"
+ <network-ip-config on-ip-change="onIPConfigChange_"
network-properties="[[networkProperties_]]">
</network-ip-config>
- <network-nameservers editable
- on-nameservers-change="onIPConfigChange_"
+ <network-nameservers on-nameservers-change="onIPConfigChange_"
network-properties="[[networkProperties_]]">
</network-nameservers>
</template>
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js b/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js
index 5d6af27b967..40d882c4de9 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js
@@ -90,6 +90,7 @@ Polymer({
globalPolicy: {
type: Object,
value: null,
+ observer: 'updateAutoConnectPref_'
},
/**
@@ -108,22 +109,28 @@ Polymer({
networkingPrivate: Object,
/**
- * The network AutoConnect state.
- * @private
+ * The network AutoConnect state as a fake preference object.
+ * @private {!chrome.settingsPrivate.PrefObject|undefined}
*/
autoConnect_: {
- type: Boolean,
- value: false,
+ type: Object,
observer: 'autoConnectChanged_',
},
/**
- * State of the Always-on VPN toggle.
- * @private
+ * The always-on VPN state as a fake preference object.
+ * @private {!chrome.settingsPrivate.PrefObject|undefined}
*/
alwaysOnVpn_: {
- type: Boolean,
- value: false,
+ type: Object,
+ observer: 'alwaysOnVpnChanged_',
+ value: function() {
+ return {
+ key: 'fakeAlwaysOnPref',
+ type: chrome.settingsPrivate.PrefType.BOOLEAN,
+ value: false,
+ };
+ }
},
/**
@@ -168,7 +175,9 @@ Polymer({
},
observers: [
- 'onAlwaysOnPrefChanged_(prefs.arc.vpn.always_on.*)',
+ 'updateAlwaysOnVpnPrefValue_(prefs.arc.vpn.always_on.*)',
+ 'updateAlwaysOnVpnPrefEnforcement_(prefs.vpn_config_allowed.*)',
+ 'autoConnectChanged_(autoConnect_.*)', 'alwaysOnVpnChanged_(alwaysOnVpn_.*)'
],
listeners: {
@@ -217,7 +226,7 @@ Polymer({
const guid = queryParams.get('guid') || '';
if (!guid) {
console.error('No guid specified for page:' + route);
- this.close_();
+ this.close();
}
this.shouldShowConfigureWhenNetworkLoaded_ =
@@ -242,18 +251,31 @@ Polymer({
this.networkProperties_ = {
GUID: this.guid,
Type: type,
- ConnectionState: CrOnc.ConnectionState.NOT_CONNECTED,
Name: {Active: name},
};
this.didSetFocus_ = false;
this.getNetworkDetails_();
},
- /** @private */
- close_: function() {
+ close: function() {
+ // If the page is already closed, return early to avoid navigating backward
+ // erroneously.
+ if (!this.guid) {
+ return;
+ }
+
this.guid = '';
+
// Delay navigating to allow other subpages to load first.
- requestAnimationFrame(() => settings.navigateToPreviousRoute());
+ requestAnimationFrame(() => {
+ // Clear network properties before navigating away to ensure that a future
+ // navigation back to the details page does not show a flicker of
+ // incorrect text. See https://crbug.com/905986.
+ this.networkProperties_ = undefined;
+ this.networkPropertiesReceived_ = false;
+
+ settings.navigateToPreviousRoute();
+ });
},
/** @private */
@@ -264,8 +286,11 @@ Polymer({
// Update autoConnect if it has changed. Default value is false.
const autoConnect = CrOnc.getAutoConnect(this.networkProperties_);
- if (autoConnect != this.autoConnect_) {
- this.autoConnect_ = autoConnect;
+ if (this.autoConnect_ === undefined) {
+ this.updateAutoConnectPref_();
+ }
+ if (autoConnect != this.autoConnect_.value) {
+ this.autoConnect_.value = autoConnect;
}
// Update preferNetwork if it has changed. Default value is false.
@@ -311,11 +336,28 @@ Polymer({
return;
}
const onc = this.getEmptyNetworkProperties_();
- CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_);
+ CrOnc.setTypeProperty(onc, 'AutoConnect', !!this.autoConnect_.value);
this.setNetworkProperties_(onc);
},
/** @private */
+ updateAutoConnectPref_: function() {
+ const newPrefValue = {
+ key: 'fakeAutoConnectPref',
+ value: !!this.autoConnect_ && !!this.autoConnect_.value,
+ type: chrome.settingsPrivate.PrefType.BOOLEAN,
+ };
+ if (this.isAutoConnectEnforcedByPolicy(
+ this.networkProperties_, this.globalPolicy)) {
+ newPrefValue.controlledBy =
+ chrome.settingsPrivate.ControlledBy.DEVICE_POLICY;
+ newPrefValue.enforcement = chrome.settingsPrivate.Enforcement.ENFORCED;
+ }
+
+ this.autoConnect_ = newPrefValue;
+ },
+
+ /** @private */
preferNetworkChanged_: function() {
if (!this.networkProperties_ || !this.guid) {
return;
@@ -375,7 +417,7 @@ Polymer({
'Unexpected networkingPrivate.getManagedProperties error: ' +
message + ' For: ' + this.guid);
}
- this.close_();
+ this.close();
return;
}
@@ -386,14 +428,14 @@ Polymer({
if (!properties) {
console.error('No properties for: ' + this.guid);
- this.close_();
+ this.close();
return;
}
// Detail page should not be shown when Arc VPN is not connected.
if (this.isArcVpn_(properties) && !this.isConnectedState_(properties)) {
this.guid = '';
- this.close_();
+ this.close();
}
this.networkProperties_ = properties;
@@ -411,7 +453,7 @@ Polymer({
// If |state| is null, the network is no longer visible, close this.
console.error('Network no longer exists: ' + this.guid);
this.networkProperties_ = undefined;
- this.close_();
+ this.close();
return;
}
this.networkProperties_ = {
@@ -478,6 +520,17 @@ Polymer({
/**
* @param {!CrOnc.NetworkProperties} networkProperties
+ * @return {string} The text to display for auto-connect toggle label.
+ * @private
+ */
+ getAutoConnectToggleLabel_: function(networkProperties) {
+ return this.isCellular_(networkProperties) ?
+ this.i18n('networkAutoConnectCellular') :
+ this.i18n('networkAutoConnect');
+ },
+
+ /**
+ * @param {!CrOnc.NetworkProperties} networkProperties
* @return {boolean} True if the network is connected.
* @private
*/
@@ -575,8 +628,7 @@ Polymer({
showDisconnect_: function(networkProperties) {
return !!networkProperties &&
networkProperties.Type != CrOnc.Type.ETHERNET &&
- networkProperties.ConnectionState !=
- CrOnc.ConnectionState.NOT_CONNECTED;
+ CrOnc.isConnectingOrConnected(networkProperties);
},
/**
@@ -644,8 +696,7 @@ Polymer({
}
}
if ((type == CrOnc.Type.WI_FI || type == CrOnc.Type.WI_MAX) &&
- networkProperties.ConnectionState !=
- CrOnc.ConnectionState.NOT_CONNECTED) {
+ CrOnc.isConnectingOrConnected(networkProperties)) {
return false;
}
if (this.isArcVpn_(networkProperties) &&
@@ -775,7 +826,7 @@ Polymer({
},
/**
- * @param {!CrOnc.NetworkProperties} networkProperties
+ * @param {!CrOnc.NetworkProperties=} networkProperties
* @return {boolean} Whether or not we are looking at VPN configuration.
* @private
*/
@@ -783,25 +834,44 @@ Polymer({
return !!networkProperties && networkProperties.Type == CrOnc.Type.VPN;
},
+ /** @private */
+ updateAlwaysOnVpnPrefValue_: function() {
+ this.alwaysOnVpn_.value = this.prefs.arc && this.prefs.arc.vpn &&
+ this.prefs.arc.vpn.always_on &&
+ this.prefs.arc.vpn.always_on.lockdown &&
+ this.prefs.arc.vpn.always_on.lockdown.value;
+ },
+
/**
- * @param {!CrOnc.NetworkProperties} networkProperties
- * @param {!chrome.settingsPrivate.PrefObject} prefButtonAllowed
- * @return {Object} Fake pref that is enforced
- * whenever the original pref is true
* @private
+ * @return {!chrome.settingsPrivate.PrefObject}
*/
- getVpnConfigPrefFromValue_: function(networkProperties, prefButtonAllowed) {
- if (!this.isVpn_(networkProperties) || !prefButtonAllowed) {
- return null;
- }
- const fakePref = Object.assign({}, prefButtonAllowed);
- if (prefButtonAllowed.value) {
- delete fakePref.enforcement;
- delete fakePref.controlledBy;
- } else {
- fakePref.enforcement = chrome.settingsPrivate.Enforcement.ENFORCED;
+ getFakeVpnConfigPrefForEnforcement_: function() {
+ const fakeAlwaysOnVpnEnforcementPref = {
+ key: 'fakeAlwaysOnPref',
+ type: chrome.settingsPrivate.PrefType.BOOLEAN,
+ value: false,
+ };
+ // Only mark VPN networks as enforced. This fake pref also controls the
+ // policy indicator on the connect/disconnect buttons, so it shouldn't be
+ // shown on non-VPN networks.
+ if (this.isVpn_(this.networkProperties_) &&
+ this.prefs.vpn_config_allowed &&
+ !this.prefs.vpn_config_allowed.value) {
+ fakeAlwaysOnVpnEnforcementPref.enforcement =
+ chrome.settingsPrivate.Enforcement.ENFORCED;
+ fakeAlwaysOnVpnEnforcementPref.controlledBy =
+ this.prefs.vpn_config_allowed.controlledBy;
}
- return fakePref;
+
+ return fakeAlwaysOnVpnEnforcementPref;
+ },
+
+ /** @private */
+ updateAlwaysOnVpnPrefEnforcement_: function() {
+ const prefForEnforcement = this.getFakeVpnConfigPrefForEnforcement_();
+ this.alwaysOnVpn_.enforcement = prefForEnforcement.enforcement;
+ this.alwaysOnVpn_.controlledBy = prefForEnforcement.controlledBy;
},
/**
@@ -839,7 +909,7 @@ Polymer({
onForgetTap_: function() {
this.networkingPrivate.forgetNetwork(this.guid);
// A forgotten network no longer has a valid GUID, close the subpage.
- this.close_();
+ this.close();
},
/** @private */
@@ -1053,8 +1123,8 @@ Polymer({
},
/**
- * @param {!CrOnc.NetworkProperties} networkProperties
- * @param {!chrome.networkingPrivate.GlobalPolicy} globalPolicy
+ * @param {!CrOnc.NetworkProperties=} networkProperties
+ * @param {!chrome.networkingPrivate.GlobalPolicy=} globalPolicy
* @return {boolean}
* @private
*/
@@ -1065,7 +1135,8 @@ Polymer({
if (this.isPolicySource(networkProperties.Source)) {
return !this.isEditable(CrOnc.getManagedAutoConnect(networkProperties));
}
- return globalPolicy && !!globalPolicy.AllowOnlyPolicyNetworksToAutoconnect;
+ return !!globalPolicy &&
+ !!globalPolicy.AllowOnlyPolicyNetworksToAutoconnect;
},
/**
@@ -1082,31 +1153,13 @@ Polymer({
this.prefs.arc.vpn.always_on.vpn_package.value;
},
- /**
- * @param {!CrOnc.NetworkProperties} networkProperties
- * @param {!chrome.settingsPrivate.PrefObject} vpnConfigAllowed
- * @return {boolean} Whether the toggle for the Always-on VPN feature is
- * enabled.
- * @private
- */
- enableAlwaysOnVpn_: function(networkProperties, vpnConfigAllowed) {
- return this.isArcVpn_(networkProperties) && vpnConfigAllowed &&
- !!vpnConfigAllowed.value;
- },
-
- /** @private */
- onAlwaysOnPrefChanged_: function() {
- if (this.prefs.arc && this.prefs.arc.vpn && this.prefs.arc.vpn.always_on &&
- this.prefs.arc.vpn.always_on.lockdown) {
- this.alwaysOnVpn_ = this.prefs.arc.vpn.always_on.lockdown.value;
- }
- },
-
/** @private */
- onAlwaysOnVpnChange_: function() {
- if (this.prefs.arc && this.prefs.arc.vpn && this.prefs.arc.vpn.always_on &&
- this.prefs.arc.vpn.always_on.lockdown) {
- this.set('prefs.arc.vpn.always_on.lockdown.value', this.alwaysOnVpn_);
+ alwaysOnVpnChanged_: function() {
+ if (this.prefs && this.prefs.arc && this.prefs.arc.vpn &&
+ this.prefs.arc.vpn.always_on && this.prefs.arc.vpn.always_on.lockdown) {
+ this.set(
+ 'prefs.arc.vpn.always_on.lockdown.value',
+ !!this.alwaysOnVpn_ && this.alwaysOnVpn_.value);
}
},
@@ -1135,6 +1188,23 @@ Polymer({
},
/**
+ * @param {Event} event
+ * @private
+ */
+ onPreferNetworkRowClicked_: function(event) {
+ // Stop propagation because the toggle and policy indicator handle clicks
+ // themselves.
+ event.stopPropagation();
+ const preferNetworkToggle =
+ this.shadowRoot.querySelector('#preferNetworkToggle');
+ if (!preferNetworkToggle || preferNetworkToggle.disabled) {
+ return;
+ }
+
+ this.preferNetwork_ = !this.preferNetwork_;
+ },
+
+ /**
* @param {!Array<string>} fields
* @return {boolean}
* @private
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.html b/chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.html
index ed2d8873866..7ebcf59cb91 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.html
@@ -1,9 +1,9 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_network_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../settings_shared_css.html">
<dom-module id="settings-internet-known-networks-page">
@@ -21,11 +21,14 @@
<div class="settings-box settings-box-text">
<div class="secondary">$i18n{knownNetworksPreferred}</div>
</div>
- <div class="list-frame vertical-list">
- <div class="list-item settings-box-text"
- hidden$="[[havePreferred_(networkStateList_)]]">
+ <div class="list-frame vertical-list"
+ hidden$="[[havePreferred_(networkStateList_)]]">
+ <div class="list-item settings-box-text">
$i18n{internetNoNetworks}
</div>
+ </div>
+ <div class="list-frame vertical-list"
+ hidden$="[[!havePreferred_(networkStateList_)]]">
<template is="dom-repeat" items="[[networkStateList_]]"
filter="networkIsPreferred_">
<div class="list-item">
@@ -37,18 +40,14 @@
indicator-type="[[getIndicatorTypeForSource(item.Source)]]">
</cr-policy-indicator>
</template>
- <paper-icon-button-light class="subpage-arrow">
- <button actionable on-click="fireShowDetails_"
- tabindex$="[[tabindex]]" aria-label$="[[item.Name]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow" on-click="fireShowDetails_"
+ tabindex$="[[tabindex]]" aria-label$="[[item.Name]]">
+ </cr-icon-button>
</div>
<div class="separator"></div>
- <paper-icon-button-light class="icon-more-vert">
- <button preferred tabindex$="[[tabindex]]"
- on-click="onMenuButtonTap_" title="$i18n{moreActions}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" tabindex$="[[tabindex]]"
+ on-click="onMenuButtonTap_" title="$i18n{moreActions}">
+ </cr-icon-button>
</div>
</template>
</div>
@@ -69,18 +68,14 @@
indicator-type="[[getIndicatorTypeForSource(item.Source)]]">
</cr-policy-indicator>
</template>
- <paper-icon-button-light class="subpage-arrow">
- <button actionable on-click="fireShowDetails_"
- tabindex$="[[tabindex]]" aria-label$="[[item.Name]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow" on-click="fireShowDetails_"
+ tabindex$="[[tabindex]]" aria-label$="[[item.Name]]">
+ </cr-icon-button>
</div>
<div class="separator"></div>
- <paper-icon-button-light class="icon-more-vert">
- <button tabindex$="[[tabindex]]" on-click="onMenuButtonTap_"
- title="$i18n{moreActions}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" tabindex$="[[tabindex]]"
+ on-click="onMenuButtonTap_" title="$i18n{moreActions}">
+ </cr-icon-button>
</div>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.js b/chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.js
index e5afbd03c8e..f5196b08250 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.js
@@ -125,10 +125,10 @@ Polymer({
* @private
*/
onMenuButtonTap_: function(event) {
- const button = /** @type {!HTMLElement} */ (event.target);
- this.selectedGuid_ =
- /** @type {!{model: !{item: !CrOnc.NetworkStateProperties}}} */ (event)
- .model.item.GUID;
+ const button = event.target;
+ const networkState =
+ /** @type {!CrOnc.NetworkStateProperties} */ (event.model.item);
+ this.selectedGuid_ = networkState.GUID;
// We need to make a round trip to Chrome in order to retrieve the managed
// properties for the network. The delay is not noticeable (~5ms) and is
// preferable to initiating a query for every known network at load time.
@@ -139,16 +139,17 @@ Polymer({
'Unexpected error: ' + chrome.runtime.lastError.message);
return;
}
- const preferred = button.hasAttribute('preferred');
if (this.isNetworkPolicyEnforced(properties.Priority)) {
this.showAddPreferred_ = false;
this.showRemovePreferred_ = false;
} else {
+ const preferred = this.networkIsPreferred_(networkState);
this.showAddPreferred_ = !preferred;
this.showRemovePreferred_ = preferred;
}
this.enableForget_ = !this.isPolicySource(properties.Source);
- /** @type {!CrActionMenuElement} */ (this.$.dotsMenu).showAt(button);
+ /** @type {!CrActionMenuElement} */ (this.$.dotsMenu)
+ .showAt(/** @type {!Element} */ (button));
});
event.stopPropagation();
},
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_page.html b/chromium/chrome/browser/resources/settings/internet_page/internet_page.html
index 64e7b15d576..14ba902ebc1 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_page.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_page.html
@@ -3,11 +3,11 @@
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_listener_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html">
<link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../prefs/prefs.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_page/settings_animated_pages.html">
@@ -16,6 +16,7 @@
<link rel="import" href="internet_config.html">
<link rel="import" href="internet_detail_page.html">
<link rel="import" href="internet_known_networks_page.html">
+<link rel="import" href="internet_page_browser_proxy.html">
<link rel="import" href="internet_subpage.html">
<link rel="import" href="network_summary.html">
@@ -53,31 +54,26 @@
<div class="start settings-box-text">
$i18n{internetAddWiFi}
</div>
- <paper-icon-button-light
- class$="[[getAddNetworkClass_('WiFi')]]">
- <button aria-label="$i18n{internetAddWiFi}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class$="[[getAddNetworkClass_('WiFi')]]"
+ aria-label="$i18n{internetAddWiFi}"></cr-icon-button>
</div>
</template>
<div actionable class="list-item" on-click="onAddVPNTap_">
<div class="start settings-box-text">
$i18n{internetAddVPN}
</div>
- <paper-icon-button-light
- class$="[[getAddNetworkClass_('VPN')]]">
- <button aria-label="$i18n{internetAddVPN}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class$="[[getAddNetworkClass_('VPN')]]"
+ aria-label="$i18n{internetAddVPN}"></cr-icon-button>
</div>
<template is="dom-repeat" items="[[thirdPartyVpnProviders_]]">
<div actionable class="list-item"
- on-click="onAddThirdPartyVpnTap_" provider="[[item]]">
+ on-click="onAddThirdPartyVpnTap_">
<div class="start settings-box-text">
[[getAddThirdPartyVpnLabel_(item)]]
</div>
- <paper-icon-button-light class="icon-external">
- <button aria-label$="[[getAddThirdPartyVpnLabel_(item)]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-external"
+ aria-label$="[[getAddThirdPartyVpnLabel_(item)]]">
+ </cr-icon-button>
</div>
</template>
<template is="dom-if" if="[[arcVpnProviders_.length]]">
@@ -86,9 +82,8 @@
<div class="setting-box-text">
$i18n{internetAddArcVPN}
</div>
- <paper-icon-button-light class="icon-external">
- <button aria-label$="$i18n{internetAddArcVPN}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-external"
+ aria-label$="$i18n{internetAddArcVPN}"></cr-icon-button>
</div>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_page.js b/chromium/chrome/browser/resources/settings/internet_page/internet_page.js
index 827a46e169d..bbe365e43c7 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_page.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_page.js
@@ -269,9 +269,15 @@ Polymer({
element = subPage.$$('#networkList');
}
} else if (this.detailType_) {
- element = this.$$('network-summary')
- .$$(`#${this.detailType_}`)
- .$$('.subpage-arrow button');
+ const rowForDetailType =
+ this.$$('network-summary').$$(`#${this.detailType_}`);
+
+ // Note: It is possible that the row is no longer present in the DOM
+ // (e.g., when a Cellular dongle is unplugged or when Instant Tethering
+ // becomes unavailable due to the Bluetooth controller disconnecting).
+ if (rowForDetailType) {
+ element = rowForDetailType.$$('.subpage-arrow');
+ }
}
if (element) {
this.focusConfig_.set(oldRoute.path, element);
@@ -320,6 +326,7 @@ Polymer({
* @private
*/
showConfig_: function(configAndConnect, type, guid, name) {
+ assert(type != CrOnc.Type.CELLULAR && type != CrOnc.Type.TETHER);
const configDialog =
/** @type {!InternetConfigElement} */ (this.$.configDialog);
configDialog.type =
@@ -401,6 +408,17 @@ Polymer({
if (this.managedNetworkAvailable != managedNetworkAvailable) {
this.managedNetworkAvailable = managedNetworkAvailable;
}
+
+ if (this.detailType_ && !this.deviceStates[this.detailType_]) {
+ // If the device type associated with the current network has been
+ // removed (e.g., due to unplugging a Cellular dongle), the details page,
+ // if visible, displays controls which are no longer functional. If this
+ // case occurs, close the details page.
+ const detailPage = this.$$('settings-internet-detail-page');
+ if (detailPage) {
+ detailPage.close();
+ }
+ }
},
/**
@@ -594,11 +612,12 @@ Polymer({
onNetworkConnect_: function(event) {
const properties = event.detail.networkProperties;
const name = CrOnc.getNetworkName(properties);
+ const networkType = properties.Type;
if (!event.detail.bypassConnectionDialog &&
CrOnc.shouldShowTetherDialogBeforeConnection(properties)) {
const params = new URLSearchParams;
params.append('guid', properties.GUID);
- params.append('type', properties.Type);
+ params.append('type', networkType);
params.append('name', name);
params.append('showConfigure', true.toString());
@@ -606,9 +625,10 @@ Polymer({
return;
}
- if (properties.Connectable === false || properties.ErrorState) {
+ if (!CrOnc.isMobileNetwork(properties) &&
+ (properties.Connectable === false || properties.ErrorState)) {
this.showConfig_(
- true /* configAndConnect */, properties.Type, properties.GUID, name);
+ true /* configAndConnect */, networkType, properties.GUID, name);
return;
}
@@ -623,11 +643,10 @@ Polymer({
'networkingPrivate.startConnect error: ' + message +
' For: ' + properties.GUID);
- // There is no configuration flow for Instant Tethering networks.
- if (properties.Type != CrOnc.Type.TETHER) {
+ // There is no configuration flow for Mobile Networks.
+ if (!CrOnc.isMobileNetwork(properties)) {
this.showConfig_(
- true /* configAndConnect */, properties.Type, properties.GUID,
- name);
+ true /* configAndConnect */, networkType, properties.GUID, name);
}
}
});
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_shared_css.html b/chromium/chrome/browser/resources/settings/internet_page/internet_shared_css.html
index a3b39fb5c99..fb67a79809c 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_shared_css.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_shared_css.html
@@ -1,12 +1,12 @@
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="../settings_shared_css.html">
-<link rel="import" href="internet_page_browser_proxy.html">
<!-- Common styles for Internet settings. -->
<dom-module id="internet-shared">
<template>
<style include="settings-shared">
cr-network-icon {
- padding-inline-end: var(--settings-box-row-padding);
+ padding-inline-end: var(--cr-section-padding);
}
iron-icon.policy {
@@ -14,7 +14,7 @@
}
.indented {
- margin-inline-start: var(--settings-box-row-padding);
+ margin-inline-start: var(--cr-section-padding);
}
.stretch {
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.html b/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.html
index 7fd0d184409..f042c254d20 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.html
@@ -1,12 +1,13 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_list.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
+<link rel="import" href="internet_page_browser_proxy.html">
<link rel="import" href="../settings_shared_css.html">
<dom-module id="settings-internet-subpage">
@@ -21,9 +22,9 @@
separator lines can fill the entire width of the page. */
#networkListDiv > * {
/* cr-network-list is padded to the right to allow space for a ripple */
- padding-inline-end: calc(var(--settings-box-row-padding) -
+ padding-inline-end: calc(var(--cr-section-padding) -
var(--cr-icon-ripple-padding));
- padding-inline-start: var(--settings-box-row-padding);
+ padding-inline-start: var(--cr-section-padding);
}
#addButton {
@@ -84,12 +85,10 @@
'$i18nPolymer{deviceOn}', '$i18nPolymer{deviceOff}')]]
</div>
<!-- The add button in this row is only shown for WiFi networks. -->
- <paper-icon-button-light class="icon-add-wifi" id="addButton"
- hidden$="[[!showAddButton_(deviceState, globalPolicy)]]">
- <button aria-label="$i18n{internetAddWiFi}"
- on-click="onAddButtonTap_" tabindex$="[[tabindex]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-add-wifi" id="addButton"
+ hidden$="[[!showAddButton_(deviceState, globalPolicy)]]"
+ aria-label="$i18n{internetAddWiFi}" on-click="onAddButtonTap_"
+ tabindex$="[[tabindex]]"></cr-icon-button>
<cr-toggle id="deviceEnabledButton"
aria-label$="[[getToggleA11yString_(deviceState)]]"
checked="[[deviceIsEnabled_(deviceState)]]"
@@ -102,9 +101,8 @@
<template is="dom-if" if="[[knownNetworksIsVisible_(deviceState)]]">
<div actionable class="settings-box" on-click="onKnownNetworksTap_">
<div class="start">$i18n{knownNetworksButton}</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{knownNetworksButton}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{knownNetworksButton}"></cr-icon-button>
</div>
</template>
@@ -114,11 +112,9 @@
<template is="dom-if" if="[[isEqual_('VPN', deviceState.Type)]]">
<div class="vpn-header layout horizontal center">
<div class="flex settings-box-text">$i18n{networkVpnBuiltin}</div>
- <paper-icon-button-light class="icon-add-circle">
- <button aria-label="$i18n{internetAddVPN}"
- on-click="onAddButtonTap_" tabindex$="[[tabindex]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-add-circle"
+ aria-label="$i18n{internetAddVPN}" on-click="onAddButtonTap_"
+ tabindex$="[[tabindex]]"></cr-icon-button>
</div>
</template>
@@ -165,12 +161,10 @@
<div id="[[item.ProviderName]]"
class="vpn-header layout horizontal center">
<div class="flex settings-box-text">[[item.ProviderName]]</div>
- <paper-icon-button-light>
- <button class="icon-add-circle"
- aria-label$="[[getAddThirdPartyVpnA11yString_(item)]]"
- on-click="onAddThirdPartyVpnTap_" tabindex$="[[tabindex]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-add-circle"
+ aria-label$="[[getAddThirdPartyVpnA11yString_(item)]]"
+ on-click="onAddThirdPartyVpnTap_" tabindex$="[[tabindex]]">
+ </cr-icon-button>
</div>
<cr-network-list show-buttons
hidden$="[[!haveThirdPartyVpnNetwork_(thirdPartyVpns_, item)]]"
@@ -187,12 +181,10 @@
<div id="[[item.ProviderName]]"
class="vpn-header layout horizontal center">
<div class="flex settings-box-text">[[item.ProviderName]]</div>
- <paper-icon-button-light>
- <button class="icon-add-circle"
- aria-label$="[[getAddArcVpnAllyString_(item)]]"
- on-click="onAddArcVpnTap_" tabindex$="[[tabindex]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-add-circle"
+ aria-label$="[[getAddArcVpnAllyString_(item)]]"
+ on-click="onAddArcVpnTap_" tabindex$="[[tabindex]]">
+ </cr-icon-button>
</div>
<cr-network-list show-buttons
hidden$="[[!haveArcVpnNetwork_(arcVpns_, item)]]"
@@ -210,7 +202,7 @@
<template is="dom-if"
if="[[tetherToggleIsVisible_(deviceState, tetherDeviceState)]]">
<div class="settings-box two-line" actionable
- on-click="onTetherEnabledTap_">
+ on-click="onTetherEnabledChange_">
<div class="start settings-box-text">
$i18n{internetToggleTetherLabel}
<div id="tetherSecondary" class="secondary">
@@ -222,7 +214,8 @@
aria-describedby="tetherSecondary"
checked="[[deviceIsEnabled_(tetherDeviceState)]]"
disabled="[[!tetherToggleIsEnabled_(deviceState,
- tetherDeviceState)]]">
+ tetherDeviceState)]]"
+ on-change="onTetherEnabledChange_">
</cr-toggle>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.js b/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.js
index 82ddb712e80..a7e399ef0d0 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.js
@@ -609,7 +609,7 @@ Polymer({
* @param {!Event} event
* @private
*/
- onTetherEnabledTap_: function(event) {
+ onTetherEnabledChange_: function(event) {
this.fire('device-enabled-toggled', {
enabled: !this.deviceIsEnabled_(this.tetherDeviceState),
type: CrOnc.Type.TETHER,
diff --git a/chromium/chrome/browser/resources/settings/internet_page/network_summary_item.html b/chromium/chrome/browser/resources/settings/internet_page/network_summary_item.html
index 1dbb066c6d1..e5326a65acb 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/network_summary_item.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/network_summary_item.html
@@ -2,24 +2,23 @@
<link rel="import" href="chrome://resources/cr_components/chromeos/network/network_siminfo.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_icon.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../settings_page/settings_subpage.html">
-<link rel="import" href="../settings_shared_css.html">
<dom-module id="network-summary-item">
<template>
<style include="internet-shared iron-flex">
network-siminfo {
- padding-inline-start: var(--settings-box-row-padding);
+ padding-inline-start: var(--cr-section-padding);
}
#outerBox {
- padding: 0 var(--settings-box-row-padding);
+ padding: 0 var(--cr-section-padding);
@apply(--network-summary-item-outer-box);
}
@@ -75,11 +74,9 @@
<template is="dom-if" if="[[showDetailsIsVisible_(activeNetworkState,
deviceState, networkStateList)]]">
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label$="[[getDetailsA11yString_(activeNetworkState,
- deviceState, networkStateList)]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label$="[[getDetailsA11yString_(activeNetworkState,
+ deviceState, networkStateList)]]"></cr-icon-button>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/BUILD.gn b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/BUILD.gn
index b382f6548ba..bde7e39d052 100644
--- a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/BUILD.gn
@@ -14,7 +14,7 @@ js_type_check("closure_compile") {
js_library("kiosk_next_shell_page") {
deps = [
"../prefs:prefs_behavior",
- "//ui/webui/resources/js:i18n_behavior",
+ "//ui/webui/resources/js:load_time_data",
]
}
@@ -22,6 +22,6 @@ js_library("kiosk_next_shell_confirmation_dialog") {
deps = [
"..:lifetime_browser_proxy",
"../prefs:prefs_behavior",
- "//ui/webui/resources/js:i18n_behavior",
+ "//ui/webui/resources/js:load_time_data",
]
}
diff --git a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.html b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.html
index 9038ff85123..1d1d0624e38 100644
--- a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.html
+++ b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.html
@@ -1,15 +1,14 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="../lifetime_browser_proxy.html">
<link rel="import" href="../prefs/prefs_behavior.html">
<link rel="import" href="../settings_shared_css.html">
<dom-module id="settings-kiosk-next-shell-confirmation-dialog">
<template>
- <style include="settings-shared">
- </style>
+ <style include="settings-shared"></style>
<cr-dialog id="dialog" close-text="$i18n{close}" ignore-enter-key>
<div slot="title">
[[getTitleText_(prefs.ash.kiosk_next_shell.enabled.value)]]
@@ -19,13 +18,13 @@
</div>
<div slot="button-container">
<paper-button class="cancel-button"
- on-click="onCancelTap_"
+ on-click="onCancelClick_"
id="cancel">
$i18n{cancel}
</paper-button>
<paper-button class="action-button"
id="confirm"
- on-click="onConfirmTap_">
+ on-click="onConfirmClick_">
[[getConfirmationText_(prefs.ash.kiosk_next_shell.enabled.value)]]
</paper-button>
</div>
diff --git a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.js b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.js
index 8d60ea4a31d..5c82394ae4d 100644
--- a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.js
+++ b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.js
@@ -12,7 +12,7 @@
Polymer({
is: 'settings-kiosk-next-shell-confirmation-dialog',
- behaviors: [I18nBehavior, PrefsBehavior],
+ behaviors: [PrefsBehavior],
properties: {
/** Preferences state. */
@@ -31,8 +31,8 @@ Polymer({
* @param {!Event} event
* @private
*/
- onCancelTap_: function(event) {
- this.$.dialog.close();
+ onCancelClick_: function(event) {
+ this.$.dialog.cancel();
event.stopPropagation();
},
@@ -40,39 +40,44 @@ Polymer({
* @param {!Event} event
* @private
*/
- onConfirmTap_: function(event) {
+ onConfirmClick_: function(event) {
const prefPath = 'ash.kiosk_next_shell.enabled';
this.setPrefValue(prefPath, !this.getPref(prefPath).value);
settings.LifetimeBrowserProxyImpl.getInstance().signOutAndRestart();
+ this.$.dialog.close();
event.stopPropagation();
},
/**
- * @private
+ * @param {boolean} kioskNextShellEnabled
* @return {string}
+ * @private
*/
getTitleText_: function(kioskNextShellEnabled) {
- return kioskNextShellEnabled ?
- this.i18n('kioskNextShellEnabledDialogTitle') :
- this.i18n('kioskNextShellDisabledDialogTitle');
+ return loadTimeData.getString(
+ kioskNextShellEnabled ? 'kioskNextShellEnabledDialogTitle' :
+ 'kioskNextShellDisabledDialogTitle');
},
/**
- * @private
+ * @param {boolean} kioskNextShellEnabled
* @return {string}
+ * @private
*/
getBodyText_: function(kioskNextShellEnabled) {
- return kioskNextShellEnabled ?
- this.i18n('kioskNextShellEnabledDialogBody') :
- this.i18n('kioskNextShellDisabledDialogBody');
+ return loadTimeData.getString(
+ kioskNextShellEnabled ? 'kioskNextShellEnabledDialogBody' :
+ 'kioskNextShellDisabledDialogBody');
},
/**
- * @private
+ * @param {boolean} kioskNextShellEnabled
* @return {string}
+ * @private
*/
getConfirmationText_: function(kioskNextShellEnabled) {
- return kioskNextShellEnabled ? this.i18n('kioskNextShellTurnOff') :
- this.i18n('kioskNextShellTurnOn');
+ return loadTimeData.getString(
+ kioskNextShellEnabled ? 'kioskNextShellTurnOff' :
+ 'kioskNextShellTurnOn');
},
});
diff --git a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.html b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.html
index 1ee63eb394b..db08f3a4b26 100644
--- a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.html
+++ b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.html
@@ -1,6 +1,5 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../prefs/prefs_behavior.html">
@@ -12,6 +11,7 @@
<style include="settings-shared"></style>
<template is="dom-if" if="[[showConfirmationDialog_]]" restamp>
<settings-kiosk-next-shell-confirmation-dialog
+ id="dialog"
on-close="onConfirmationDialogClose_"
prefs="{{prefs}}">
</settings-kiosk-next-shell-confirmation-dialog>
@@ -24,8 +24,8 @@
</div>
</div>
<div class="separator"></div>
- <paper-button id="enable"
- on-click="onToggleButtonPressed_"
+ <paper-button
+ on-click="onToggleButtonClick_"
aria-label="$i18n{kioskNextShellPageTitle}"
aria-describedby="secondaryText">
[[getButtonLabel_(prefs.ash.kiosk_next_shell.enabled.value)]]
diff --git a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.js b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.js
index 4b685acd6d4..4485674dcef 100644
--- a/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.js
+++ b/chromium/chrome/browser/resources/settings/kiosk_next_shell_page/kiosk_next_shell_page.js
@@ -10,7 +10,7 @@
Polymer({
is: 'settings-kiosk-next-shell-page',
- behaviors: [I18nBehavior, PrefsBehavior],
+ behaviors: [PrefsBehavior],
properties: {
/** Preferences state. */
@@ -19,6 +19,7 @@ Polymer({
notify: true,
},
+ /** @private */
showConfirmationDialog_: Boolean,
},
@@ -26,7 +27,7 @@ Polymer({
* @private
* @param {!Event} event
*/
- onToggleButtonPressed_: function(event) {
+ onToggleButtonClick_: function(event) {
this.showConfirmationDialog_ = true;
event.stopPropagation();
},
@@ -46,9 +47,9 @@ Polymer({
* @return {string}
*/
getSubtextLabel_: function(kioskNextShellEnabled) {
- return kioskNextShellEnabled
- ? this.i18n('kioskNextShellPageSubtextDisable')
- : this.i18n('kioskNextShellPageSubtextEnable');
+ return loadTimeData.getString(
+ kioskNextShellEnabled ? 'kioskNextShellPageSubtextDisable' :
+ 'kioskNextShellPageSubtextEnable');
},
/**
@@ -57,8 +58,8 @@ Polymer({
* @return {string}
*/
getButtonLabel_: function(kioskNextShellEnabled) {
- return kioskNextShellEnabled
- ? this.i18n('kioskNextShellTurnOff')
- : this.i18n('kioskNextShellTurnOn');
+ return loadTimeData.getString(
+ kioskNextShellEnabled ? 'kioskNextShellTurnOff' :
+ 'kioskNextShellTurnOn');
}
});
diff --git a/chromium/chrome/browser/resources/settings/languages_page/add_languages_dialog.html b/chromium/chrome/browser/resources/settings/languages_page/add_languages_dialog.html
index 0c6556980b8..b8fb95c4c48 100644
--- a/chromium/chrome/browser/resources/settings/languages_page/add_languages_dialog.html
+++ b/chromium/chrome/browser/resources/settings/languages_page/add_languages_dialog.html
@@ -55,7 +55,7 @@
languages.supported, languages.enabled.*, filterValue_)]]">
<template>
<cr-checkbox class="list-item no-outline"
- checked="[[willAdd_(item.code)]]" tabindex$="[[tabIndex]]"
+ checked="[[willAdd_(item.code)]]" tab-index="[[tabIndex]]"
title$="[[item.nativeDisplayName]]"
on-change="onLanguageCheckboxChange_">
[[getDisplayText_(item)]]
diff --git a/chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html b/chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html
index f6ceea3f5ac..9d01835b882 100644
--- a/chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html
+++ b/chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html
@@ -1,11 +1,11 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-keys/iron-a11y-keys.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../global_scroll_target_behavior.html">
<link rel="import" href="../prefs/prefs.html">
<link rel="import" href="../prefs/prefs_behavior.html">
@@ -56,10 +56,8 @@
<template>
<div class="list-item">
<div class="word text-elide">[[item]]</div>
- <paper-icon-button-light class="icon-clear">
- <button on-click="onRemoveWordTap_" tabindex$="[[tabIndex]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-clear" on-click="onRemoveWordTap_"
+ tabindex$="[[tabIndex]]"></cr-icon-button>
</div>
</template>
</iron-list>
diff --git a/chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.js b/chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.js
index 3badb9bf431..64176619be4 100644
--- a/chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.js
+++ b/chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.js
@@ -134,6 +134,12 @@ Polymer({
Polymer.dom.flush();
this.$$('#list').notifyResize();
}
+
+ // Update input enable to reflect new additions/removals.
+ // TODO(hsuregan): Remove hack when notifyPath() or notifySplices()
+ // is successful at creating DOM changes when applied to words_ (when
+ // attached to input newWord), OR when array changes are registered.
+ this.$.addWord.disabled = !this.$.newWord.validate();
},
/**
diff --git a/chromium/chrome/browser/resources/settings/languages_page/languages.js b/chromium/chrome/browser/resources/settings/languages_page/languages.js
index 5408936fd7e..6e46eeda8bd 100644
--- a/chromium/chrome/browser/resources/settings/languages_page/languages.js
+++ b/chromium/chrome/browser/resources/settings/languages_page/languages.js
@@ -145,7 +145,8 @@ Polymer({
'prefs.' + preferredLanguagesPrefName + '.value, languages)',
'spellCheckDictionariesPrefChanged_(' +
'prefs.spellcheck.dictionaries.value.*, ' +
- 'prefs.spellcheck.forced_dictionaries.value.*, languages)',
+ 'prefs.spellcheck.forced_dictionaries.value.*, ' +
+ 'prefs.spellcheck.blacklisted_dictionaries.value.*, languages)',
'translateLanguagesPrefChanged_(' +
'prefs.translate_blocked_languages.value.*, languages)',
'updateRemovableLanguages_(' +
@@ -327,7 +328,20 @@ Polymer({
this.languageSettingsPrivate_.getSpellcheckDictionaryStatuses(
this.boundOnSpellcheckDictionariesChanged_);
}
+
+ // Recreate the set of spellcheck forced languages in case a forced
+ // spellcheck language was removed from the languages list.
+ this.set(
+ 'languages.forcedSpellCheckLanguages',
+ this.getForcedSpellCheckLanguages_(this.languages.enabled));
// </if>
+
+ // Update translate target language.
+ new Promise(resolve => {
+ this.languageSettingsPrivate_.getTranslateTargetLanguage(resolve);
+ }).then(result => {
+ this.set('languages.translateTarget', result);
+ });
},
/**
@@ -344,14 +358,20 @@ Polymer({
const spellCheckForcedSet =
this.makeSetFromArray_(/** @type {!Array<string>} */ (
this.getPref('spellcheck.forced_dictionaries').value));
+ const spellCheckBlacklistedSet =
+ this.makeSetFromArray_(/** @type {!Array<string>} */ (
+ this.getPref('spellcheck.blacklisted_dictionaries').value));
+
for (let i = 0; i < this.languages.enabled.length; i++) {
const languageState = this.languages.enabled[i];
+ const isUser = spellCheckSet.has(languageState.language.code);
+ const isForced = spellCheckForcedSet.has(languageState.language.code);
+ const isBlacklisted =
+ spellCheckBlacklistedSet.has(languageState.language.code);
this.set(
`languages.enabled.${i}.spellCheckEnabled`,
- spellCheckSet.has(languageState.language.code));
- this.set(
- `languages.enabled.${i}.isManaged`,
- spellCheckForcedSet.has(languageState.language.code));
+ (isUser && !isBlacklisted) || isForced);
+ this.set(`languages.enabled.${i}.isManaged`, isForced || isBlacklisted);
}
this.set(
@@ -361,7 +381,7 @@ Polymer({
/**
* Returns an array of language codes for the spellcheck languages that are
- * managed by policy, but that are not "enabled" languages.
+ * force-enabled by policy, but that are not "enabled" languages.
* @param {!Array<!LanguageState>} enabledLanguages An array of enabled
* languages.
* @return {!Array<!string>}
@@ -380,6 +400,7 @@ Polymer({
forcedLanguages.push({
language: this.supportedLanguageMap_.get(code),
isManaged: true,
+ spellCheckEnabled: true,
downloadDictionaryFailureCount: 0,
});
}
@@ -527,11 +548,15 @@ Polymer({
const enabledLanguageCodes = pref.value.split(',');
const spellCheckPref = this.getPref('spellcheck.dictionaries');
const spellCheckForcedPref = this.getPref('spellcheck.forced_dictionaries');
+ const spellCheckBlacklistedPref =
+ this.getPref('spellcheck.blacklisted_dictionaries');
const spellCheckSet = this.makeSetFromArray_(
/** @type {!Array<string>} */ (
spellCheckPref.value.concat(spellCheckForcedPref.value)));
const spellCheckForcedSet = this.makeSetFromArray_(
/** @type {!Array<string>} */ (spellCheckForcedPref.value));
+ const spellCheckBlacklistedSet = this.makeSetFromArray_(
+ /** @type {!Array<string>} */ (spellCheckBlacklistedPref.value));
const translateBlockedPref = this.getPref('translate_blocked_languages');
const translateBlockedSet = this.makeSetFromArray_(
@@ -547,11 +572,14 @@ Polymer({
}
const languageState = /** @type {LanguageState} */ ({});
languageState.language = language;
- languageState.spellCheckEnabled = spellCheckSet.has(code);
+ languageState.spellCheckEnabled =
+ spellCheckSet.has(code) && !spellCheckBlacklistedSet.has(code) ||
+ spellCheckForcedSet.has(code);
languageState.translateEnabled = this.isTranslateEnabled_(
code, !!language.supportsTranslate, translateBlockedSet,
translateTarget, prospectiveUILanguage);
- languageState.isManaged = spellCheckForcedSet.has(code);
+ languageState.isManaged =
+ spellCheckForcedSet.has(code) || spellCheckBlacklistedSet.has(code);
languageState.downloadDictionaryFailureCount = 0;
enabledLanguageStates.push(languageState);
}
diff --git a/chromium/chrome/browser/resources/settings/languages_page/languages_page.html b/chromium/chrome/browser/resources/settings/languages_page/languages_page.html
index 1bbe35b2a9a..9a4b8dcf00e 100644
--- a/chromium/chrome/browser/resources/settings/languages_page/languages_page.html
+++ b/chromium/chrome/browser/resources/settings/languages_page/languages_page.html
@@ -1,6 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/action_link.html">
<link rel="import" href="chrome://resources/html/action_link_css.html">
@@ -9,7 +11,6 @@
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
<link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html">
@@ -18,9 +19,12 @@
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="add_languages_dialog.html">
<link rel="import" href="languages.html">
+<link rel="import" href="../controls/controlled_radio_button.html">
+<link rel="import" href="../controls/settings_radio_group.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../lifetime_browser_proxy.html">
+<link rel="import" href="../prefs/prefs_behavior.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_page/settings_animated_pages.html">
<link rel="import" href="../settings_page/settings_subpage.html">
@@ -65,7 +69,7 @@
border: none;
/* TODO(michaelpg): Update to whatever variable is used for the darker,
* full-width separators: crbug.com/649547. */
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
margin: 6px 0 0 0;
}
@@ -91,7 +95,7 @@
#uiLanguageItem cr-policy-indicator {
float: right;
- margin-left: 20px;
+ margin-inline-start: 20px;
}
.name-with-error-list {
@@ -121,6 +125,51 @@
iron-icon.policy {
margin-inline-start: 10px;
}
+
+ cr-policy-pref-indicator {
+ margin-inline-end: var(--settings-controlled-by-spacing);
+ }
+
+ .spell-check-radio-group {
+ padding-bottom: var(--cr-section-vertical-padding);
+ }
+
+ .spell-check-radio-button {
+ --cr-radio-button-label-spacing: calc(
+ var(--cr-section-indent-width) - var(--cr-radio-button-size));
+ }
+
+ .spell-check-radio-button.enhanced {
+ align-items: start;
+ --cr-radio-button-disc: {
+ /* Align with just the first line of text */
+ margin-top: calc((1.5em - var(--cr-radio-button-size)) / 2);
+ }
+ }
+
+ .enhanced-spellcheck-description {
+ padding-inline-end: 150px;
+ }
+
+ .spell-check-languages .list-item:last-of-type {
+ border-bottom: var(--cr-separator-line);
+ }
+
+ div.list-item.non-target .target-info {
+ display: none;
+ }
+
+ /* Any .target.target-info following another .target element needs to
+ be hidden. We only want to show the _first_ .target-info of the list.
+ This is a way to do a :first-of-class selector. */
+ div.list-item.target ~ div.list-item.target .target-info {
+ display: none;
+ }
+
+ .restart-button {
+ margin-inline-start: var(--settings-controlled-by-spacing);
+ }
+
</style>
<settings-languages languages="{{languages}}" prefs="{{prefs}}"
language-helper="{{languageHelper}}">
@@ -152,13 +201,14 @@
<div class="list-frame vertical-list">
<template is="dom-repeat" items="[[languages.enabled]]">
<div class$="list-item [[getLanguageItemClass_(
- item.language.code, language.prospectiveUILanguage)]]">
+ item.language.code, language.prospectiveUILanguage)]]
+ [[isTranslationTarget_(item.language.code,
+ languages.translateTarget)]]">
<div class="start">
<div title="[[item.language.nativeDisplayName]]">
[[item.language.displayName]]
</div>
- <div class="secondary"
- hidden="[[!isTranslationTarget_(item.language.code)]]">
+ <div class="target-info secondary">
$i18n{translateTargetLabel}
</div>
<if expr="chromeos or is_win">
@@ -173,16 +223,14 @@
<if expr="chromeos or is_win">
<template is="dom-if" if="[[isRestartRequired_(
item.language.code, languages.prospectiveUILanguage)]]">
- <paper-button on-click="onRestartTap_">
+ <paper-button class="restart-button" on-click="onRestartTap_">
$i18n{restart}
</paper-button>
</template>
</if>
- <paper-icon-button-light class="icon-more-vert">
- <button title="$i18n{moreActions}"
- id="more-[[item.language.code]]" on-click="onDotsTap_">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert"
+ title="$i18n{moreActions}" id="more-[[item.language.code]]"
+ on-click="onDotsTap_"></cr-icon-button>
</div>
</template>
<div class="list-item">
@@ -226,22 +274,14 @@
$i18n{inputMethodEnabled}
</div>
</div>
- <paper-icon-button-light class="icon-external"
- hidden="[[!item.hasOptionsPage]]">
- <button on-click="onInputMethodOptionsTap_"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-external"
+ hidden="[[!item.hasOptionsPage]]"
+ on-click="onInputMethodOptionsTap_"></cr-icon-button>
</div>
</template>
- <div class="list-item" on-click="onManageInputMethodsTap_"
- actionable>
- <div class="start" id="manageInputMethods">
- $i18n{manageInputMethods}
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{manageInputMethods}"
- aria-describedby="customSpelling"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row class="hr list-item" id="manageInputMethods"
+ on-click="onManageInputMethodsTap_"
+ label="$i18n{manageInputMethods}"></cr-link-row>
</div>
<settings-toggle-button
pref="{{prefs.settings.language.ime_menu_activated}}"
@@ -249,83 +289,102 @@
</settings-toggle-button>
</iron-collapse>
</if>
-<if expr="not is_macosx">
- <div id="spellCheckSubpageTrigger"
- class$="settings-box [[getSpellCheckListTwoLine_(
- spellCheckSecondaryText_)]]"
- actionable$="[[!spellCheckDisabled_]]"
- on-click="toggleExpandButton_">
- <div class="start">
- <div>$i18n{spellCheckListTitle}</div>
- <div class="secondary">[[spellCheckSecondaryText_]]</div>
- </div>
- <!-- |enable_spellchecking| may be set by policy, but if it's enabled,
- we shouldn't display the policy indicator. -->
- <template is="dom-if" if="[[spellCheckDisabled_]]" restamp>
- <cr-policy-pref-indicator
- pref="[[prefs.browser.enable_spellchecking]]">
- </cr-policy-pref-indicator>
- </template>
- <template is="dom-if" if="[[!spellCheckDisabled_]]" restamp>
- <cr-expand-button expanded="{{spellCheckOpened_}}"
- alt="$i18n{spellCheckExpandA11yLabel}">
- </cr-expand-button>
- </template>
- </div>
- <iron-collapse id="spellCheckCollapse" opened="[[spellCheckOpened_]]">
- <div class="list-frame vertical-list">
- <template is="dom-repeat" items="[[spellCheckLanguages_]]">
- <div class="list-item">
- <div class="start name-with-error-list"
- on-click="onSpellCheckNameClick_" actionable
- disabled$="[[isSpellCheckNameClickDisabled_(item,
- item.*)]]">
- [[item.language.displayName]]
- <div hidden="[[!errorsGreaterThan_(
- item.downloadDictionaryFailureCount, 0)]]">
- <iron-icon icon="cr:error"></iron-icon>
- $i18n{languagesDictionaryDownloadError}
- </div>
- <div hidden="[[!errorsGreaterThan_(
- item.downloadDictionaryFailureCount, 1)]]">
- $i18n{languagesDictionaryDownloadErrorHelp}
- </div>
+
+ <settings-toggle-button
+ id="enableSpellcheckingToggle"
+ label="$i18n{spellCheckTitle}"
+ pref="{{prefs.browser.enable_spellchecking}}"
+ disabled="[[!spellCheckLanguages_.length]]">
+ </settings-toggle-button>
+<if expr="_google_chrome or not is_macosx">
+ <iron-collapse id="spellCheckCollapse"
+ opened="[[prefs.browser.enable_spellchecking.value]]">
+<if expr="_google_chrome">
+ <div class="settings-box continuation spell-check-radio-group">
+ <settings-radio-group
+ pref="{{prefs.spellcheck.use_spelling_service}}">
+ <controlled-radio-button
+ class="spell-check-radio-button"
+ id="spellingServiceDisable"
+ label="$i18n{spellCheckBasicLabel}"
+ name="false"
+ pref="[[prefs.spellcheck.use_spelling_service]]">
+ </controlled-radio-button>
+ <controlled-radio-button
+ class="spell-check-radio-button enhanced"
+ id="spellingServiceEnable"
+ label="$i18n{spellCheckEnhancedLabel}"
+ name="true"
+ pref="[[prefs.spellcheck.use_spelling_service]]">
+ <div class="secondary enhanced-spellcheck-description">
+ $i18n{spellCheckEnhancedDescription}
</div>
- <paper-button on-click="onRetryDictionaryDownloadClick_"
- hidden="[[!errorsGreaterThan_(
+ </controlled-radio-button>
+ </settings-radio-group>
+ </div>
+</if> <!-- _google_chrome -->
+<if expr="not is_macosx">
+ <div id="spellCheckLanguagesList"
+ hidden="[[hideSpellCheckLanguages_]]">
+ <div class="settings-box continuation">
+ $i18n{spellCheckLanguagesListTitle}
+ </div>
+ <div class="list-frame vertical-list spell-check-languages">
+ <template is="dom-repeat" items="[[spellCheckLanguages_]]">
+ <div class="list-item">
+ <div class="start name-with-error-list"
+ on-click="onSpellCheckNameClick_" actionable
+ disabled$="[[isSpellCheckNameClickDisabled_(item,
+ item.*)]]">
+ [[item.language.displayName]]
+ <div hidden="[[!errorsGreaterThan_(
item.downloadDictionaryFailureCount, 0)]]">
- $i18n{retry}
- </paper-button>
- <template is="dom-if" if="[[!item.isManaged]]">
- <cr-toggle on-change="onSpellCheckChange_"
- disabled="[[!item.language.supportsSpellcheck]]"
- checked="[[item.spellCheckEnabled]]"
- aria-label$="[[item.language.displayName]]"
- hidden="[[errorsGreaterThan_(
- item.downloadDictionaryFailureCount, 0)]]">
- </cr-toggle>
- </template>
- <template is="dom-if" if="[[item.isManaged]]">
- <cr-policy-pref-indicator
- pref="[[prefs.spellcheck.forced_dictionaries]]"
- hidden="[[errorsGreaterThan_(
+ <iron-icon icon="cr:error"></iron-icon>
+ $i18n{languagesDictionaryDownloadError}
+ </div>
+ <div hidden="[[!errorsGreaterThan_(
+ item.downloadDictionaryFailureCount, 1)]]">
+ $i18n{languagesDictionaryDownloadErrorHelp}
+ </div>
+ </div>
+ <paper-button on-click="onRetryDictionaryDownloadClick_"
+ hidden="[[!errorsGreaterThan_(
item.downloadDictionaryFailureCount, 0)]]">
- </cr-policy-pref-indicator>
- </template>
- </div>
- </template>
- <div class="list-item" on-click="onEditDictionaryTap_" actionable>
- <div class="start" id="customSpelling">
- $i18n{manageSpellCheck}
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{manageSpellCheck}"
- aria-describedby="customSpelling"></button>
- </paper-icon-button-light>
+ $i18n{retry}
+ </paper-button>
+ <template is="dom-if" if="[[!item.isManaged]]">
+ <cr-toggle on-change="onSpellCheckLanguageChange_"
+ disabled="[[!item.language.supportsSpellcheck]]"
+ checked="[[item.spellCheckEnabled]]"
+ aria-label$="[[item.language.displayName]]"
+ hidden="[[errorsGreaterThan_(
+ item.downloadDictionaryFailureCount, 0)]]">
+ </cr-toggle>
+ </template>
+ <template is="dom-if" if="[[item.isManaged]]">
+ <cr-policy-pref-indicator
+ pref="[[getIndicatorPrefForManagedSpellcheckLanguage_(
+ item.spellCheckEnabled)]]"
+ hidden="[[errorsGreaterThan_(
+ item.downloadDictionaryFailureCount, 0)]]">
+ </cr-policy-pref-indicator>
+ <cr-toggle disabled="true"
+ checked="[[item.spellCheckEnabled]]"
+ aria-label$="[[item.language.displayName]]"
+ hidden="[[errorsGreaterThan_(
+ item.downloadDictionaryFailureCount, 0)]]">
+ </cr-toggle>
+ </template>
+ </div>
+ </template>
</div>
</div>
+ <cr-link-row on-click="onEditDictionaryTap_"
+ id="spellCheckSubpageTrigger" label="$i18n{manageSpellCheck}">
+ </cr-link-row>
+</if> <!-- not is_macosx -->
</iron-collapse>
-</if>
+</if> <!-- _google_chrome or not is_macosx -->
<cr-lazy-render id="menu">
<template>
<cr-action-menu
@@ -354,7 +413,7 @@
detailLanguage_, languages.translateTarget)]]">
$i18n{offerToTranslateInThisLanguage}
</cr-checkbox>
- <hr>
+ <hr hidden="[[!shouldShowDialogSeparator_(languages.enabled.*)]]">
<button class="dropdown-item" role="menuitem"
on-click="onMoveToTopTap_"
hidden="[[isNthLanguage_(
@@ -395,10 +454,12 @@
</template>
</if>
<if expr="not is_macosx">
- <template is="dom-if" route-path="/editDictionary">
+ <template is="dom-if" route-path="/editDictionary"
+ no-search="[[!prefs.browser.enable_spellchecking.value]]">
<settings-subpage
associated-control="[[$$('#spellCheckSubpageTrigger')]]"
- page-title="$i18n{editDictionaryPageTitle}">
+ page-title="$i18n{editDictionaryPageTitle}"
+ no-search$="[[!prefs.browser.enable_spellchecking.value]]">
<settings-edit-dictionary-page></settings-edit-dictionary-page>
</settings-subpage>
</template>
diff --git a/chromium/chrome/browser/resources/settings/languages_page/languages_page.js b/chromium/chrome/browser/resources/settings/languages_page/languages_page.js
index 3cabe189b12..649d7aee0cb 100644
--- a/chromium/chrome/browser/resources/settings/languages_page/languages_page.js
+++ b/chromium/chrome/browser/resources/settings/languages_page/languages_page.js
@@ -26,6 +26,10 @@ const LANGUAGE_SETTING_IS_SHOWN_UMA_NAME = 'Translate.LanguageSettingsIsShown';
Polymer({
is: 'settings-languages-page',
+ behaviors: [
+ PrefsBehavior,
+ ],
+
properties: {
/**
* Preferences state.
@@ -50,15 +54,6 @@ Polymer({
// <if expr="not is_macosx">
/** @private */
- spellCheckSecondaryText_: {
- type: String,
- value: '',
- computed: 'getSpellCheckSecondaryText_(languages.enabled.*, ' +
- 'languages.forcedSpellCheckLanguages.*, ' +
- 'prefs.browser.enable_spellchecking.*)',
- },
-
- /** @private */
spellCheckLanguages_: {
type: Array,
value: function() {
@@ -66,11 +61,8 @@ Polymer({
},
},
- /** @private */
- spellCheckDisabled_: {
- type: Boolean,
- value: false,
- },
+ /** @private {string|undefined} */
+ languageSyncedWithBrowserEnableSpellchecking_: String,
// </if>
/**
@@ -80,6 +72,12 @@ Polymer({
*/
detailLanguage_: Object,
+ /** @private */
+ hideSpellCheckLanguages_: {
+ type: Boolean,
+ value: false,
+ },
+
/**
* Whether the language settings list is opened.
* @private
@@ -101,14 +99,12 @@ Polymer({
if (settings.routes.EDIT_DICTIONARY) {
map.set(
settings.routes.EDIT_DICTIONARY.path,
- '#spellCheckCollapse .subpage-arrow button');
+ '#spellCheckSubpageTrigger');
}
// </if>
// <if expr="chromeos">
if (settings.routes.INPUT_METHODS) {
- map.set(
- settings.routes.INPUT_METHODS.path,
- '#inputMethodsCollapse .subpage-arrow button');
+ map.set(settings.routes.INPUT_METHODS.path, '#manageInputMethods');
}
// </if>
return map;
@@ -168,6 +164,17 @@ Polymer({
},
/**
+ * Used to determine whether to show the separator between checkbox settings
+ * and move buttons in the dialog menu.
+ * @return {boolean} True if there is currently more than one selected
+ * language.
+ * @private
+ */
+ shouldShowDialogSeparator_: function() {
+ return this.languages != undefined && this.languages.enabled.length > 1;
+ },
+
+ /**
* Used to determine which "Move" buttons to show for ordering enabled
* languages.
* @param {number} n
@@ -219,11 +226,17 @@ Polymer({
/**
* @param {string} languageCode The language code identifying a language.
- * @return {boolean} True iff this language is the one used when translating
- * pages.
- */
- isTranslationTarget_: function(languageCode) {
- return languageCode == this.languages.translateTarget;
+ * @param {string} translateTarget The target language.
+ * @return {string} 'target' if |languageCode| matches the target language,
+ 'non-target' otherwise.
+ */
+ isTranslationTarget_: function(languageCode, translateTarget) {
+ if (this.languageHelper.convertLanguageCodeForTranslate(languageCode) ==
+ translateTarget) {
+ return 'target';
+ } else {
+ return 'non-target';
+ }
},
// <if expr="chromeos">
@@ -266,7 +279,7 @@ Polymer({
// Taps on the button are handled in onInputMethodOptionsTap_.
// TODO(dschuyler): The row has two operations that are not clearly
// delineated. crbug.com/740691
- if (e.target.tagName == 'BUTTON') {
+ if (e.target.tagName == 'CR-ICON-BUTTON') {
return;
}
@@ -487,71 +500,37 @@ Polymer({
// <if expr="not is_macosx">
/**
- * Returns the secondary text for the spell check subsection based on the
- * enabled spell check languages, listing at most 2 languages.
- * @return {string}
- * @private
+ * Returns the value to use as the |pref| attribute for the policy indicator
+ * of spellcheck languages, based on whether or not the language is enabled.
+ * @param {boolean} isEnabled Whether the language is enabled or not.
*/
- getSpellCheckSecondaryText_: function() {
- if (this.languages == undefined || this.prefs == undefined) {
- return '';
- }
-
- if (this.getSpellCheckDisabledByPolicy_()) {
- return loadTimeData.getString('spellCheckDisabled');
- }
- const enabledSpellCheckLanguages =
- this.getSpellCheckLanguages_().filter(function(languageState) {
- return (languageState.spellCheckEnabled || languageState.isManaged) &&
- languageState.language.supportsSpellcheck;
- });
- switch (enabledSpellCheckLanguages.length) {
- case 0:
- return '';
- case 1:
- return enabledSpellCheckLanguages[0].language.displayName;
- case 2:
- return loadTimeData.getStringF(
- 'spellCheckSummaryTwoLanguages',
- enabledSpellCheckLanguages[0].language.displayName,
- enabledSpellCheckLanguages[1].language.displayName);
- case 3:
- // "foo, bar, and 1 other"
- return loadTimeData.getStringF(
- 'spellCheckSummaryThreeLanguages',
- enabledSpellCheckLanguages[0].language.displayName,
- enabledSpellCheckLanguages[1].language.displayName);
- default:
- // "foo, bar, and [N-2] others"
- return loadTimeData.getStringF(
- 'spellCheckSummaryMultipleLanguages',
- enabledSpellCheckLanguages[0].language.displayName,
- enabledSpellCheckLanguages[1].language.displayName,
- (enabledSpellCheckLanguages.length - 2).toLocaleString());
- }
- },
-
- /**
- * Returns whether spellcheck is disabled by policy or not.
- * @return {boolean}
- * @private
- */
- getSpellCheckDisabledByPolicy_: function() {
- const pref = /** @type {!chrome.settingsPrivate.PrefObject} */ (
- this.get('browser.enable_spellchecking', this.prefs));
- return pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED &&
- pref.value === false;
+ getIndicatorPrefForManagedSpellcheckLanguage_(isEnabled) {
+ return isEnabled ?
+ this.get('spellcheck.forced_dictionaries', this.prefs) :
+ this.get('spellcheck.blacklisted_dictionaries', this.prefs);
},
/**
* Returns an array of enabled languages, plus spellcheck languages that are
- * forced by policy.
+ * force-enabled by policy.
* @return {!Array<!LanguageState|!ForcedLanguageState>}
* @private
*/
getSpellCheckLanguages_: function() {
- return this.languages.enabled.concat(
- this.languages.forcedSpellCheckLanguages);
+ const supportedSpellcheckLanguages =
+ /** @type {!Array<!LanguageState|!ForcedLanguageState>} */ (
+ this.languages.enabled.filter(
+ (item) => item.language.supportsSpellcheck));
+ const supportedSpellcheckLanguagesSet =
+ new Set(supportedSpellcheckLanguages.map(x => x.language.code));
+
+ this.languages.forcedSpellCheckLanguages.forEach(forcedLanguage => {
+ if (!supportedSpellcheckLanguagesSet.has(forcedLanguage.language.code)) {
+ supportedSpellcheckLanguages.push(forcedLanguage);
+ }
+ });
+
+ return supportedSpellcheckLanguages;
},
/** @private */
@@ -575,6 +554,41 @@ Polymer({
this.notifyPath(
`spellCheckLanguages_.${i}.downloadDictionaryFailureCount`);
}
+
+ if (this.spellCheckLanguages_.length === 0) {
+ // If there are no supported spell check languages, automatically turn
+ // off spell check to indicate no spell check will happen.
+ this.setPrefValue('browser.enable_spellchecking', false);
+ }
+
+ if (this.spellCheckLanguages_.length === 1) {
+ const singleLanguage = this.spellCheckLanguages_[0];
+
+ // Hide list of spell check languages if there is only 1 language
+ // and we don't need to display any errors for that language
+ this.hideSpellCheckLanguages_ = !singleLanguage.isManaged &&
+ singleLanguage.downloadDictionaryFailureCount === 0;
+
+ // Turn off spell check if spell check for the 1 remaining language is off
+ if (!singleLanguage.spellCheckEnabled) {
+ this.setPrefValue('browser.enable_spellchecking', false);
+ this.languageSyncedWithBrowserEnableSpellchecking_ =
+ singleLanguage.language.code;
+ }
+
+ // Undo the sync if spell check appeared as turned off for the language
+ // because a download was still in progress. This only occurs when
+ // Settings is loaded for the very first time and dictionaries have not
+ // been downloaded yet.
+ if (this.languageSyncedWithBrowserEnableSpellchecking_ ===
+ singleLanguage.language.code &&
+ singleLanguage.spellCheckEnabled) {
+ this.setPrefValue('browser.enable_spellchecking', true);
+ }
+ } else {
+ this.hideSpellCheckLanguages_ = false;
+ this.languageSyncedWithBrowserEnableSpellchecking_ = undefined;
+ }
},
/** @private */
@@ -583,12 +597,26 @@ Polymer({
return;
}
- this.set('spellCheckDisabled_', this.getSpellCheckDisabledByPolicy_());
+ // If there is only 1 language, we hide the list of languages so users
+ // are unable to toggle on/off spell check specifically for the 1 language.
+ // Therefore, we need to treat the toggle for `browser.enable_spellchecking`
+ // as the toggle for the 1 language as well.
+ if (this.spellCheckLanguages_.length === 1) {
+ this.languageHelper.toggleSpellCheck(
+ this.spellCheckLanguages_[0].language.code,
+ !!this.getPref('browser.enable_spellchecking').value);
+ }
- // If the spellcheck section was expanded, close it.
- if (this.spellCheckDisabled_) {
- this.set('spellCheckOpened_', false);
+ // <if expr="_google_chrome">
+ // When spell check is disabled, automatically disable using the spelling
+ // service. This resets the spell check option to 'Use basic spell check'
+ // when spell check is turned off. This check is in an observer so that it
+ // can also correct any users who land on the Settings page and happen
+ // to have spelling service enabled but spell check disabled.
+ if (!this.getPref('browser.enable_spellchecking').value) {
+ this.setPrefValue('spellcheck.use_spelling_service', false);
}
+ // </if>
},
/**
@@ -600,10 +628,10 @@ Polymer({
},
/**
- * Handler for enabling or disabling spell check.
+ * Handler for enabling or disabling spell check for a specific language.
* @param {!{target: Element, model: !{item: !LanguageState}}} e
*/
- onSpellCheckChange_: function(e) {
+ onSpellCheckLanguageChange_: function(e) {
const item = e.model.item;
if (!item.language.supportsSpellcheck) {
return;
@@ -631,7 +659,7 @@ Polymer({
*/
onSpellCheckNameClick_: function(e) {
assert(!this.isSpellCheckNameClickDisabled_(e.model.item));
- this.onSpellCheckChange_(e);
+ this.onSpellCheckLanguageChange_(e);
},
/**
@@ -645,14 +673,6 @@ Polymer({
return item.isManaged || !item.language.supportsSpellcheck ||
item.downloadDictionaryFailureCount > 0;
},
-
- /**
- * @return {string}
- * @private
- */
- getSpellCheckListTwoLine_: function() {
- return this.spellCheckSecondaryText_.length ? 'two-line' : '';
- },
// </if>
/**
diff --git a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_feature_item.html b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_feature_item.html
index 4b72ad64117..a31ccceba62 100644
--- a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_feature_item.html
+++ b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_feature_item.html
@@ -1,13 +1,12 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
-<link rel="import" href="../settings_vars_css.html">
<link rel="import" href="multidevice_constants.html">
<link rel="import" href="multidevice_feature_behavior.html">
<link rel="import" href="multidevice_feature_toggle.html">
@@ -16,7 +15,7 @@
<template>
<style include="settings-shared">
#card {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
border-top-style: var(--feature-item-border-top-style, solid);
padding: var(--feature-item-row-padding);
}
@@ -48,10 +47,8 @@
if="[[hasSubpageClickHandler_(
feature, pageContentData, subpageRoute)]]"
restamp>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-labelledby="featureName"
- aria-describedby="featureSecondary"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow" aria-labelledby="featureName"
+ aria-describedby="featureSecondary"></cr-icon-button>
<div class="separator"></div>
</template>
<template is="dom-if"
diff --git a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_page.html b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_page.html
index d16ab4ea217..5e59df3da66 100644
--- a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_page.html
+++ b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_page.html
@@ -1,12 +1,12 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../route.html">
@@ -64,10 +64,9 @@
<template is="dom-if"
if="[[doesClickOpenSubpage_(pageContentData)]]"
restamp>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-labelledby="multidevice-label"
- aria-describedby="multideviceSubLabel"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-labelledby="multidevice-label"
+ aria-describedby="multideviceSubLabel"></cr-icon-button>
</template>
<div class="separator"></div>
</template>
diff --git a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.html b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.html
index f93b7cd9436..e621471c502 100644
--- a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.html
+++ b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.html
@@ -1,10 +1,11 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_listener_behavior.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
@@ -32,7 +33,7 @@
}
#forget-device-container {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
}
</style>
<div class="settings-box first">
@@ -87,7 +88,8 @@
<template is="dom-if"
if="[[doesAndroidMessagesRequireSetUp_(pageContentData)]]"
restamp>
- <paper-button disabled$="[[!isSuiteOn(pageContentData)]]"
+ <paper-button disabled$="[[isAndroidMessagesSetupButtonDisabled_(
+ pageContentData)]]"
on-click="handleAndroidMessagesButtonClick_"
slot="feature-controller">
$i18n{multideviceSetupButton}
@@ -98,21 +100,10 @@
</div>
</template>
<div id="forget-device-container">
- <div id="forget-device"
- class="settings-box two-line first"
+ <cr-link-row id="forget-device" class="hr"
on-click="handleForgetDeviceClick_"
- actionable>
- <div class="start">
- $i18n{multideviceForgetDevice}
- <div class="secondary" id="multideviceForgetDeviceSummary">
- $i18n{multideviceForgetDeviceSummary}
- </div>
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{multideviceForgetDevice}"
- aria-describedby="multideviceForgetDeviceSummary"></button>
- </paper-icon-button-light>
- </div>
+ label="$i18n{multideviceForgetDevice}"
+ sub-label="$i18n{multideviceForgetDeviceSummary}"></cr-link-row>
</div>
<cr-dialog id="forgetDeviceDialog">
<div slot="title">$i18n{multideviceForgetDevice}</div>
diff --git a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.js b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.js
index 990c459548f..08bc3dfbf10 100644
--- a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.js
+++ b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.js
@@ -134,4 +134,15 @@ Polymer({
// disabled, regardless if Messages requires further setup.
return !this.pageContentData.isAndroidSmsPairingComplete;
},
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ isAndroidMessagesSetupButtonDisabled_: function() {
+ const messagesFeatureState = this.getFeatureState(
+ settings.MultiDeviceFeature.MESSAGES);
+ return !this.isSuiteOn() || messagesFeatureState ===
+ settings.MultiDeviceFeatureState.PROHIBITED_BY_POLICY;
+ }
});
diff --git a/chromium/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html b/chromium/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html
index f7e8b8621a4..cd75b9639ab 100644
--- a/chromium/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html
+++ b/chromium/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html
@@ -1,10 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_row_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="startup_urls_page_browser_proxy.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../site_favicon.html">
@@ -23,11 +23,9 @@
<div class="text-elide secondary">[[model.url]]</div>
</div>
<template is="dom-if" if="[[editable]]">
- <paper-icon-button-light class="icon-more-vert">
- <button id="dots" on-click="onDotsTap_" title="$i18n{moreActions}"
- focus-row-control focus-type="menu">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" id="dots" on-click="onDotsTap_"
+ title="$i18n{moreActions}" focus-row-control focus-type="menu">
+ </cr-icon-button>
<cr-lazy-render id="menu">
<template>
<cr-action-menu>
diff --git a/chromium/chrome/browser/resources/settings/os_settings_resources.grd b/chromium/chrome/browser/resources/settings/os_settings_resources.grd
new file mode 100644
index 00000000000..71961bb6878
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/os_settings_resources.grd
@@ -0,0 +1,1465 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
+ <outputs>
+ <output filename="grit/os_settings_resources.h" type="rc_header">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="grit/os_settings_resources_map.cc"
+ type="resource_file_map_source" />
+ <output filename="grit/os_settings_resources_map.h"
+ type="resource_map_header" />
+ <output filename="os_settings_resources.pak" type="data_package" />
+ </outputs>
+ <release seq="1">
+ <structures>
+ <structure name="IDR_OS_SETTINGS_A11Y_PAGE_JS"
+ file="a11y_page/a11y_page.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_A11Y_PAGE_HTML"
+ file="a11y_page/a11y_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_MANAGE_A11Y_PAGE_JS"
+ file="a11y_page/manage_a11y_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MANAGE_A11Y_PAGE_HTML"
+ file="a11y_page/manage_a11y_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_TTS_SUBPAGE_JS"
+ file="a11y_page/tts_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_TTS_SUBPAGE_HTML"
+ file="a11y_page/tts_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MANIFEST"
+ file="manifest.json"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ABOUT_PAGE_BROWSER_PROXY_HTML"
+ file="about_page/about_page_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ABOUT_PAGE_BROWSER_PROXY_JS"
+ file="about_page/about_page_browser_proxy.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_ABOUT_PAGE_JS"
+ file="about_page/about_page.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_ABOUT_PAGE_HTML"
+ file="about_page/about_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_CHANNEL_SWITCHER_DIALOG_HTML"
+ file="about_page/channel_switcher_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CHANNEL_SWITCHER_DIALOG_JS"
+ file="about_page/channel_switcher_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DETAILED_BUILD_INFO_JS"
+ file="about_page/detailed_build_info.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DETAILED_BUILD_INFO_HTML"
+ file="about_page/detailed_build_info.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_UPDATE_WARNING_DIALOG_HTML"
+ file="about_page/update_warning_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_UPDATE_WARNING_DIALOG_JS"
+ file="about_page/update_warning_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ADD_SITE_DIALOG_HTML"
+ file="site_settings/add_site_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ADD_SITE_DIALOG_JS"
+ file="site_settings/add_site_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ALL_SITES_HTML"
+ file="site_settings/all_sites.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ALL_SITES_JS"
+ file="site_settings/all_sites.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SITE_ENTRY_HTML"
+ file="site_settings/site_entry.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_ENTRY_JS"
+ file="site_settings/site_entry.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CATEGORY_DEFAULT_SETTING_HTML"
+ file="site_settings/category_default_setting.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CATEGORY_DEFAULT_SETTING_JS"
+ file="site_settings/category_default_setting.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CATEGORY_SETTING_EXCEPTIONS_HTML"
+ file="site_settings/category_setting_exceptions.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_CATEGORY_SETTING_EXCEPTIONS_JS"
+ file="site_settings/category_setting_exceptions.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CHOOSER_EXCEPTION_LIST_HTML"
+ file="site_settings/chooser_exception_list.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CHOOSER_EXCEPTION_LIST_JS"
+ file="site_settings/chooser_exception_list.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CHOOSER_EXCEPTION_LIST_ENTRY_HTML"
+ file="site_settings/chooser_exception_list_entry.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CHOOSER_EXCEPTION_LIST_ENTRY_JS"
+ file="site_settings/chooser_exception_list_entry.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CR_SETTINGS_ANIMATED_PAGES_HTML"
+ file="settings_page/settings_animated_pages.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CR_SETTINGS_ANIMATED_PAGES_JS"
+ file="settings_page/settings_animated_pages.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_APPEARANCE_BROWSER_PROXY_HTML"
+ file="appearance_page/appearance_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_APPEARANCE_BROWSER_PROXY_JS"
+ file="appearance_page/appearance_browser_proxy.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_APPEARANCE_FONTS_PAGE_HTML"
+ file="appearance_page/appearance_fonts_page.html"
+ type="chrome_html"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_APPEARANCE_FONTS_PAGE_JS"
+ file="appearance_page/appearance_fonts_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_APPEARANCE_PAGE_HTML"
+ file="appearance_page/appearance_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_APPEARANCE_PAGE_JS"
+ file="appearance_page/appearance_page.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_APPEARANCE_HOME_URL_INPUT_HTML"
+ file="appearance_page/home_url_input.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_APPEARANCE_HOME_URL_INPUT_JS"
+ file="appearance_page/home_url_input.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_OS_SETTINGS_PAGE_JS"
+ file="chromeos/os_settings_page/os_settings_page.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_OS_SETTINGS_PAGE_HTML"
+ file="chromeos/os_settings_page/os_settings_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_EDIT_EXCEPTION_DIALOG_HTML"
+ file="site_settings/edit_exception_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_EDIT_EXCEPTION_DIALOG_JS"
+ file="site_settings/edit_exception_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_EXTENSION_CONTROL_BROWSER_PROXY_JS"
+ file="extension_control_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_EXTENSION_CONTROL_BROWSER_PROXY_HTML"
+ file="extension_control_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_FONTS_BROWSER_PROXY_HTML"
+ file="appearance_page/fonts_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_FONTS_BROWSER_PROXY_JS"
+ file="appearance_page/fonts_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LIFETIME_BROWSER_PROXY_HTML"
+ file="lifetime_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LIFETIME_BROWSER_PROXY_JS"
+ file="lifetime_browser_proxy.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_ON_STARTUP_BROWSER_PROXY_HTML"
+ file="on_startup_page/on_startup_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ON_STARTUP_BROWSER_PROXY_JS"
+ file="on_startup_page/on_startup_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ON_STARTUP_PAGE_HTML"
+ file="on_startup_page/on_startup_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ON_STARTUP_PAGE_JS"
+ file="on_startup_page/on_startup_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_SETTINGS_JS"
+ file="search_settings.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_STARTUP_URLS_PAGE_HTML"
+ file="on_startup_page/startup_urls_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_STARTUP_URLS_PAGE_JS"
+ file="on_startup_page/startup_urls_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_STARTUP_URLS_PAGE_BROWSER_PROXY_JS"
+ file="on_startup_page/startup_urls_page_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_STARTUP_URLS_PAGE_BROWSER_PROXY_HTML"
+ file="on_startup_page/startup_urls_page_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_STARTUP_URL_DIALOG_JS"
+ file="on_startup_page/startup_url_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_STARTUP_URL_DIALOG_HTML"
+ file="on_startup_page/startup_url_dialog.html"
+ type="chrome_html"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_STARTUP_URL_ENTRY_JS"
+ file="on_startup_page/startup_url_entry.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_STARTUP_URL_ENTRY_HTML"
+ file="on_startup_page/startup_url_entry.html"
+ type="chrome_html"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_CR_OS_SETTINGS_MAIN_HTML"
+ file="chromeos/os_settings_main/os_settings_main.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_CR_OS_SETTINGS_MAIN_JS"
+ file="chromeos/os_settings_main/os_settings_main.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CR_OS_SETTINGS_MENU_HTML"
+ file="chromeos/os_settings_menu/os_settings_menu.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_CR_OS_SETTINGS_MENU_JS"
+ file="chromeos/os_settings_menu/os_settings_menu.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CR_SETTINGS_SECTION_HTML"
+ file="settings_page/settings_section.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CR_SETTINGS_SECTION_JS"
+ file="settings_page/settings_section.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CR_SETTINGS_SUBPAGE_HTML"
+ file="settings_page/settings_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CR_SETTINGS_SUBPAGE_JS"
+ file="settings_page/settings_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CR_SETTINGS_PAGE_CSS_HTML"
+ file="settings_page_css.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CR_SETTINGS_ICONS_CSS_HTML"
+ file="settings_icons_css.html"
+ flattenhtml="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MAIN_PAGE_BEHAVIOR_HTML"
+ file="settings_page/main_page_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MAIN_PAGE_BEHAVIOR_JS"
+ file="settings_page/main_page_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SETTINGS_VARS_CSS_HTML"
+ file="settings_vars_css.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SETTINGS_SHARED_CSS_HTML"
+ file="settings_shared_css.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_CR_OS_SETTINGS_UI_HTML"
+ file="chromeos/os_settings_ui/os_settings_ui.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_CR_OS_SETTINGS_UI_JS"
+ file="chromeos/os_settings_ui/os_settings_ui.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_GLOBAL_SCROLL_TARGET_BEHAVIOR_HTML"
+ file="global_scroll_target_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_GLOBAL_SCROLL_TARGET_BEHAVIOR_JS"
+ file="global_scroll_target_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CHANGE_PASSWORD_BROWSER_PROXY_HTML"
+ file="change_password_page/change_password_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CHANGE_PASSWORD_BROWSER_PROXY_JS"
+ file="change_password_page/change_password_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CHANGE_PASSWORD_PAGE_HTML"
+ file="change_password_page/change_password_page.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_CHANGE_PASSWORD_PAGE_JS"
+ file="change_password_page/change_password_page.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_CLEAR_BROWSING_DATA_BROWSER_PROXY_HTML"
+ file="clear_browsing_data_dialog/clear_browsing_data_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CLEAR_BROWSING_DATA_BROWSER_PROXY_JS"
+ file="clear_browsing_data_dialog/clear_browsing_data_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CLEAR_BROWSING_DATA_DIALOG_HTML"
+ file="clear_browsing_data_dialog/clear_browsing_data_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CLEAR_BROWSING_DATA_DIALOG_JS"
+ file="clear_browsing_data_dialog/clear_browsing_data_dialog.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_HISTORY_DELETION_DIALOG_HTML"
+ file="clear_browsing_data_dialog/history_deletion_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_HISTORY_DELETION_DIALOG_JS"
+ file="clear_browsing_data_dialog/history_deletion_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SECURITY_KEYS_PAGE_HTML"
+ file="privacy_page/security_keys_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SECURITY_KEYS_PAGE_JS"
+ file="privacy_page/security_keys_subpage.js"
+ type="chrome_html"/>
+ <structure name="IDR_OS_SETTINGS_SECURITY_KEYS_SET_PIN_DIALOG_HTML"
+ file="privacy_page/security_keys_set_pin_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SECURITY_KEYS_SET_PIN_DIALOG_JS"
+ file="privacy_page/security_keys_set_pin_dialog.js"
+ type="chrome_html"/>
+ <structure name="IDR_OS_SETTINGS_SECURITY_KEYS_RESET_DIALOG_HTML"
+ file="privacy_page/security_keys_reset_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SECURITY_KEYS_RESET_DIALOG_JS"
+ file="privacy_page/security_keys_reset_dialog.js"
+ type="chrome_html"/>
+ <structure name="IDR_OS_SETTINGS_SECURITY_KEYS_DIALOG_BROWSER_PROXY_HTML"
+ file="privacy_page/security_keys_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SECURITY_KEYS_DIALOG_BROWSER_PROXY_JS"
+ file="privacy_page/security_keys_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_BOOLEAN_CONTROL_BEHAVIOR_HTML"
+ file="controls/settings_boolean_control_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_BOOLEAN_CONTROL_BEHAVIOR_JS"
+ file="controls/settings_boolean_control_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_CONTROLLED_BUTTON_JS"
+ file="controls/controlled_button.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_CONTROLLED_BUTTON_HTML"
+ file="controls/controlled_button.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_CONTROLLED_RADIO_BUTTON_JS"
+ file="controls/controlled_radio_button.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_CONTROLLED_RADIO_BUTTON_HTML"
+ file="controls/controlled_radio_button.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_EXTENSION_CONTROLLED_INDICATOR_JS"
+ file="controls/extension_controlled_indicator.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_EXTENSION_CONTROLLED_INDICATOR_HTML"
+ file="controls/extension_controlled_indicator.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_CHECKBOX_HTML"
+ file="controls/settings_checkbox.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_CHECKBOX_JS"
+ file="controls/settings_checkbox.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_DROPDOWN_MENU_HTML"
+ file="controls/settings_dropdown_menu.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_DROPDOWN_MENU_JS"
+ file="controls/settings_dropdown_menu.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_PASSWORD_PROMPT_DIALOG_JS"
+ file="controls/password_prompt_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_PASSWORD_PROMPT_DIALOG_HTML"
+ file="controls/password_prompt_dialog.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_PREF_CONTROL_BEHAVIOR_HTML"
+ file="controls/pref_control_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_PREF_CONTROL_BEHAVIOR_JS"
+ file="controls/pref_control_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_RADIO_GROUP_HTML"
+ file="controls/settings_radio_group.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_RADIO_GROUP_JS"
+ file="controls/settings_radio_group.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_SETTINGS_IDLE_LOAD_HTML"
+ file="controls/settings_idle_load.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_SETTINGS_IDLE_LOAD_JS"
+ file="controls/settings_idle_load.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_SLIDER_HTML"
+ file="controls/settings_slider.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_SLIDER_JS"
+ file="controls/settings_slider.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_TEXTAREA_HTML"
+ file="controls/settings_textarea.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_TEXTAREA_JS"
+ file="controls/settings_textarea.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_TOGGLE_BUTTON_HTML"
+ file="controls/settings_toggle_button.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONTROLS_TOGGLE_BUTTON_JS"
+ file="controls/settings_toggle_button.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_COOKIE_INFO_HTML"
+ file="site_settings/cookie_info.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_COOKIE_INFO_JS"
+ file="site_settings/cookie_info.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_BROWSER_PROXY_HTML"
+ file="device_page/device_page_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_BROWSER_PROXY_JS"
+ file="device_page/device_page_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DISPLAY_HTML"
+ file="device_page/display.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DISPLAY_JS"
+ file="device_page/display.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DISPLAY_LAYOUT_HTML"
+ file="device_page/display_layout.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DISPLAY_LAYOUT_JS"
+ file="device_page/display_layout.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DISPLAY_OVERSCAN_DIALOG_HTML"
+ file="device_page/display_overscan_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DISPLAY_OVERSCAN_DIALOG_JS"
+ file="device_page/display_overscan_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DRIVE_CACHE_DIALOG_HTML"
+ file="device_page/drive_cache_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DRIVE_CACHE_DIALOG_JS"
+ file="device_page/drive_cache_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_KEYBOARD_HTML"
+ file="device_page/keyboard.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_KEYBOARD_JS"
+ file="device_page/keyboard.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_POWER_HTML"
+ file="device_page/power.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_POWER_JS"
+ file="device_page/power.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_STORAGE_HTML"
+ file="device_page/storage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_STORAGE_JS"
+ file="device_page/storage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_STYLUS_HTML"
+ file="device_page/stylus.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_STYLUS_JS"
+ file="device_page/stylus.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_PAGE_HTML"
+ file="device_page/device_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_PAGE_JS"
+ file="device_page/device_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_POINTERS_HTML"
+ file="device_page/pointers.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_POINTERS_JS"
+ file="device_page/pointers.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DRAG_BEHAVIOR_HTML"
+ file="device_page/drag_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_DRAG_BEHAVIOR_JS"
+ file="device_page/drag_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_LAYOUT_BEHAVIOR_HTML"
+ file="device_page/layout_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_LAYOUT_BEHAVIOR_JS"
+ file="device_page/layout_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_NIGHT_LIGHT_SLIDER_HTML"
+ file="device_page/night_light_slider.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DEVICE_NIGHT_LIGHT_SLIDER_JS"
+ file="device_page/night_light_slider.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DOWNLOADS_BROWSER_PROXY_HTML"
+ file="downloads_page/downloads_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DOWNLOADS_BROWSER_PROXY_JS"
+ file="downloads_page/downloads_browser_proxy.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DOWNLOADS_PAGE_HTML"
+ file="downloads_page/downloads_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_DOWNLOADS_PAGE_JS"
+ file="downloads_page/downloads_page.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SMB_SHARES_PAGE_HTML"
+ file="downloads_page/smb_shares_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SMB_SHARES_PAGE_JS"
+ file="downloads_page/smb_shares_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_I18n_SETUP_HTML"
+ file="i18n_setup.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ICONS"
+ file="icons.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_POWERWASH_DIALOG_HTML"
+ file="reset_page/powerwash_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_POWERWASH_DIALOG_JS"
+ file="reset_page/powerwash_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_RESET_PAGE_HTML"
+ file="reset_page/reset_page.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_RESET_PAGE_JS"
+ file="reset_page/reset_page.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_RESET_PROFILE_DIALOG_HTML"
+ file="reset_page/reset_profile_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_RESET_PROFILE_DIALOG_JS"
+ file="reset_page/reset_profile_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_RESET_PROFILE_BANNER_HTML"
+ file="reset_page/reset_profile_banner.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_RESET_PROFILE_BANNER_JS"
+ file="reset_page/reset_profile_banner.js"
+ type="chrome_html"/>
+ <structure name="IDR_OS_SETTINGS_RESET_BROWSER_PROXY_JS"
+ file="reset_page/reset_browser_proxy.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_RESET_BROWSER_PROXY_HTML"
+ file="reset_page/reset_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_HTML"
+ file="languages_page/languages.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_JS"
+ file="languages_page/languages.js"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_BROWSER_PROXY_HTML"
+ file="languages_page/languages_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_BROWSER_PROXY_JS"
+ file="languages_page/languages_browser_proxy.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_ADD_LANGUAGES_DIALOG_HTML"
+ file="languages_page/add_languages_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_ADD_LANGUAGES_DIALOG_JS"
+ file="languages_page/add_languages_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_PAGE_HTML"
+ file="languages_page/languages_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_PAGE_JS"
+ file="languages_page/languages_page.js"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_MANAGE_INPUT_METHODS_PAGE_HTML"
+ file="languages_page/manage_input_methods_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_MANAGE_INPUT_METHODS_PAGE_JS"
+ file="languages_page/manage_input_methods_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_EDIT_DICTIONARY_PAGE_HTML"
+ file="languages_page/edit_dictionary_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LANGUAGES_EDIT_DICTIONARY_PAGE_JS"
+ file="languages_page/edit_dictionary_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MEDIA_PICKER_HTML"
+ file="site_settings/media_picker.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MEDIA_PICKER_JS"
+ file="site_settings/media_picker.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_AUTOFILL_PAGE_HTML"
+ file="autofill_page/autofill_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_AUTOFILL_PAGE_JS"
+ file="autofill_page/autofill_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CREDIT_CARD_LIST_HTML"
+ file="autofill_page/credit_card_list.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CREDIT_CARD_LIST_JS"
+ file="autofill_page/credit_card_list.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CREDIT_CARD_LIST_ENTRY_HTML"
+ file="autofill_page/credit_card_list_entry.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CREDIT_CARD_LIST_ENTRY_JS"
+ file="autofill_page/credit_card_list_entry.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PASSWORDS_SHARED_CSS_HTML"
+ file="autofill_page/passwords_shared_css.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CREDIT_CARD_EDIT_DIALOG_HTML"
+ file="autofill_page/credit_card_edit_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CREDIT_CARD_EDIT_DIALOG_JS"
+ file="autofill_page/credit_card_edit_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_AUTOFILL_SECTION_HTML"
+ file="autofill_page/autofill_section.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_AUTOFILL_SECTION_JS"
+ file="autofill_page/autofill_section.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ADDRESS_EDIT_DIALOG_HTML"
+ file="autofill_page/address_edit_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ADDRESS_EDIT_DIALOG_JS"
+ file="autofill_page/address_edit_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SHOW_PASSWORD_BEHAVIOR_HTML"
+ file="autofill_page/show_password_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SHOW_PASSWORD_BEHAVIOR_JS"
+ file="autofill_page/show_password_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PASSWORD_LIST_ITEM_HTML"
+ file="autofill_page/password_list_item.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_PASSWORD_LIST_ITEM_JS"
+ file="autofill_page/password_list_item.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PASSWORD_MANAGER_PROXY_HTML"
+ file="autofill_page/password_manager_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PASSWORD_MANAGER_PROXY_JS"
+ file="autofill_page/password_manager_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PASSWORDS_SECTION_HTML"
+ file="autofill_page/passwords_section.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PASSWORDS_SECTION_JS"
+ file="autofill_page/passwords_section.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_PASSWORD_EDIT_DIALOG_HTML"
+ file="autofill_page/password_edit_dialog.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_PASSWORD_EDIT_DIALOG_JS"
+ file="autofill_page/password_edit_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PASSWORDS_EXPORT_DIALOG_HTML"
+ file="autofill_page/passwords_export_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PASSWORDS_EXPORT_DIALOG_JS"
+ file="autofill_page/passwords_export_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PAYMENTS_SECTION_HTML"
+ file="autofill_page/payments_section.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PAYMENTS_SECTION_JS"
+ file="autofill_page/payments_section.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_HTML"
+ file="people_page/people_page.html"
+ type="chrome_html"
+ flattenhtml="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_JS"
+ file="people_page/people_page.js"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_SIGNOUT_DIALOG_HTML"
+ file="people_page/signout_dialog.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_SIGNOUT_DIALOG_JS"
+ file="people_page/signout_dialog.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_PROFILE_INFO_BROWSER_PROXY_HTML"
+ file="people_page/profile_info_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_PROFILE_INFO_BROWSER_PROXY_JS"
+ file="people_page/profile_info_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_SYNC_BROWSER_PROXY_HTML"
+ file="people_page/sync_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_SYNC_BROWSER_PROXY_JS"
+ file="people_page/sync_browser_proxy.js"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PREF_UTIL_HTML"
+ file="prefs/pref_util.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PREF_UTIL_JS"
+ file="prefs/pref_util.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PREFS_HTML"
+ file="prefs/prefs.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PREFS_JS"
+ file="prefs/prefs.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PREFS_BEHAVIOR_HTML"
+ file="prefs/prefs_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PREFS_BEHAVIOR_JS"
+ file="prefs/prefs_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PREFS_TYPES_HTML"
+ file="prefs/prefs_types.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PREFS_TYPES_JS"
+ file="prefs/prefs_types.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PRINTING_PAGE_HTML"
+ file="printing_page/printing_page.html"
+ preprocess="true"
+ allowexternalscript="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PRINTING_PAGE_JS"
+ file="printing_page/printing_page.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTER_SHARED_CSS_HTML"
+ file="printing_page/cups_printer_shared_css.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTING_PAGE_HTML"
+ file="printing_page/cups_printers.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTING_PAGE_JS"
+ file="printing_page/cups_printers.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_BROWSER_PROXY_HTML"
+ file="printing_page/cups_printers_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_BROWSER_PROXY_JS"
+ file="printing_page/cups_printers_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_LIST_HTML"
+ file="printing_page/cups_printers_list.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_LIST_JS"
+ file="printing_page/cups_printers_list.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_EDIT_PRINTER_DIALOG_HTML"
+ file="printing_page/cups_edit_printer_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_EDIT_PRINTER_DIALOG_JS"
+ file="printing_page/cups_edit_printer_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_ADD_PRINTER_DIALOG_HTML"
+ file="printing_page/cups_add_printer_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_ADD_PRINTER_DIALOG_JS"
+ file="printing_page/cups_add_printer_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_ADD_PRINTER_DIALOG_ELEMENTS_HTML"
+ file="printing_page/cups_add_printer_dialog_elements.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_ADD_PRINTER_DIALOG_ELEMENTS_JS"
+ file="printing_page/cups_add_printer_dialog_elements.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTER_DIALOG_UTIL_HTML"
+ file="printing_page/cups_printer_dialog_util.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTER_DIALOG_UTIL_JS"
+ file="printing_page/cups_printer_dialog_util.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CLOUD_PRINTING_PAGE_HTML"
+ file="printing_page/cloud_printers.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CLOUD_PRINTING_PAGE_JS"
+ file="printing_page/cloud_printers.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LOCAL_DATA_BROWSER_PROXY_HTML"
+ file="site_settings/local_data_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LOCAL_DATA_BROWSER_PROXY_JS"
+ file="site_settings/local_data_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_OPEN_WINDOW_PROXY_HTML"
+ file="open_window_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_OPEN_WINDOW_PROXY_JS"
+ file="open_window_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PAGE_VISIBILITY_HTML"
+ file="page_visibility.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PAGE_VISIBILITY_JS"
+ file="page_visibility.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_PDF_DOCUMENTS_HTML"
+ file="site_settings/pdf_documents.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PDF_DOCUMENTS_JS"
+ file="site_settings/pdf_documents.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PERSONALIZATION_OPTIONS_HTML"
+ file="privacy_page/personalization_options.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PERSONALIZATION_OPTIONS_JS"
+ file="privacy_page/personalization_options.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PRIVACY_PAGE_HTML"
+ file="privacy_page/privacy_page.html"
+ type="chrome_html"
+ flattenhtml="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PRIVACY_PAGE_JS"
+ file="privacy_page/privacy_page.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PRIVACY_PAGE_BROWSER_PROXY_HTML"
+ file="privacy_page/privacy_page_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PRIVACY_PAGE_BROWSER_PROXY_JS"
+ file="privacy_page/privacy_page_browser_proxy.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PROTOCOL_HANDLERS_HTML"
+ file="site_settings/protocol_handlers.html"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PROTOCOL_HANDLERS_JS"
+ file="site_settings/protocol_handlers.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ROUTE_HTML"
+ file="route.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ROUTE_JS"
+ file="route.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SITE_FAVICON_HTML"
+ file="site_favicon.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_FAVICON_JS"
+ file="site_favicon.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_DATA_HTML"
+ file="site_settings/site_data.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_DATA_JS"
+ file="site_settings/site_data.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_DATA_DETAILS_SUBPAGE_HTML"
+ file="site_settings/site_data_details_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_DATA_DETAILS_SUBPAGE_JS"
+ file="site_settings/site_data_details_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_DATA_ENTRY_HTML"
+ file="site_settings/site_data_entry.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_DATA_ENTRY_JS"
+ file="site_settings/site_data_entry.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_LIST_HTML"
+ file="site_settings/site_list.html"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_LIST_JS"
+ file="site_settings/site_list.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_LIST_ENTRY_HTML"
+ file="site_settings/site_list_entry.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_LIST_ENTRY_JS"
+ file="site_settings/site_list_entry.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_SETTINGS_BEHAVIOR_HTML"
+ file="site_settings/site_settings_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_SETTINGS_BEHAVIOR_JS"
+ file="site_settings/site_settings_behavior.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_CONSTANTS_JS"
+ file="site_settings/constants.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CONSTANTS_HTML"
+ file="site_settings/constants.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_SETTINGS_PAGE_HTML"
+ file="site_settings_page/site_settings_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_SETTINGS_PAGE_JS"
+ file="site_settings_page/site_settings_page.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SITE_SETTINGS_PREFS_BROWSER_PROXY_HTML"
+ file="site_settings/site_settings_prefs_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_SETTINGS_PREFS_BROWSER_PROXY_JS"
+ file="site_settings/site_settings_prefs_browser_proxy.js"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_DETAILS_HTML"
+ file="site_settings/site_details.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SITE_DETAILS_JS"
+ file="site_settings/site_details.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SITE_DETAILS_PERMISSION_HTML"
+ file="site_settings/site_details_permission.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SITE_DETAILS_PERMISSION_JS"
+ file="site_settings/site_details_permission.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_SEARCH_ENGINE_DIALOG_JS"
+ file="search_engines_page/search_engine_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_SEARCH_ENGINE_DIALOG_HTML"
+ file="search_engines_page/search_engine_dialog.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_SEARCH_ENGINE_ENTRY_JS"
+ file="search_engines_page/search_engine_entry.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_SEARCH_ENGINE_ENTRY_HTML"
+ file="search_engines_page/search_engine_entry.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_SEARCH_ENGINE_ENTRY_CSS_HTML"
+ file="search_engines_page/search_engine_entry_css.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_OMNIBOX_EXTENSION_ENTRY_JS"
+ file="search_engines_page/omnibox_extension_entry.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_OMNIBOX_EXTENSION_ENTRY_HTML"
+ file="search_engines_page/omnibox_extension_entry.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_SEARCH_ENGINES_LIST_JS"
+ file="search_engines_page/search_engines_list.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_SEARCH_ENGINES_LIST_HTML"
+ file="search_engines_page/search_engines_list.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_SEARCH_ENGINES_PAGE_JS"
+ file="search_engines_page/search_engines_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_PAGE_SEARCH_ENGINES_PAGE_HTML"
+ file="search_engines_page/search_engines_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_BROWSER_PROXY_JS"
+ file="search_engines_page/search_engines_browser_proxy.js"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_ENGINES_BROWSER_PROXY_HTML"
+ file="search_engines_page/search_engines_browser_proxy.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_GOOGLE_ASSISTANT_PAGE_GOOGLE_ASSISTANT_PAGE_JS"
+ file="google_assistant_page/google_assistant_page.js"
+ type="chrome_html"
+ allowexternalscript="true"/>
+ <structure name="IDR_OS_SETTINGS_GOOGLE_ASSISTANT_PAGE_GOOGLE_ASSISTANT_PAGE_HTML"
+ file="google_assistant_page/google_assistant_page.html"
+ type="chrome_html"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_GOOGLE_ASSISTANT_PAGE_GOOGLE_ASSISTANT_BROWSER_PROXY_JS"
+ file="google_assistant_page/google_assistant_browser_proxy.js"
+ type="chrome_html"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_GOOGLE_ASSISTANT_PAGE_GOOGLE_ASSISTANT_BROWSER_PROXY_HTML"
+ file="google_assistant_page/google_assistant_browser_proxy.html"
+ type="chrome_html"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_PAGE_JS"
+ file="search_page/search_page.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SEARCH_PAGE_HTML"
+ file="search_page/search_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SYNC_CONTROLS_JS"
+ file="people_page/sync_controls.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SYNC_CONTROLS_HTML"
+ file="people_page/sync_controls.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SYNC_PAGE_JS"
+ file="people_page/sync_page.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_SYNC_PAGE_HTML"
+ file="people_page/sync_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_SYSTEM_PAGE_BROWSER_PROXY_HTML"
+ file="system_page/system_page_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SYSTEM_PAGE_BROWSER_PROXY"
+ file="system_page/system_page_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SYSTEM_PAGE_HTML"
+ file="system_page/system_page.html"
+ preprocess="true"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SYSTEM_PAGE_JS"
+ file="system_page/system_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_SETTINGS_HTML"
+ preprocess="true"
+ file="chromeos/os_settings.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_LAZY_LOAD_HTML"
+ preprocess="true"
+ file="chromeos/lazy_load.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_WEBSITE_USAGE_PRIVATE_API_HTML"
+ file="site_settings/website_usage_private_api.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_WEBSITE_USAGE_PRIVATE_API_JS"
+ file="site_settings/website_usage_private_api.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ZOOM_LEVELS_HTML"
+ file="site_settings/zoom_levels.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ZOOM_LEVELS_JS"
+ file="site_settings/zoom_levels.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ANDROID_APPS_PAGE_HTML"
+ file="android_apps_page/android_apps_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ANDROID_APPS_PAGE_JS"
+ file="android_apps_page/android_apps_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ANDROID_APPS_SUBPAGE_HTML"
+ file="android_apps_page/android_apps_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ANDROID_APPS_SUBPAGE_JS"
+ file="android_apps_page/android_apps_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_ANDROID_APPS_BROWSER_PROXY_JS"
+ file="android_apps_page/android_apps_browser_proxy.js"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_ANDROID_APPS_BROWSER_PROXY_HTML"
+ file="android_apps_page/android_apps_browser_proxy.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_PAGE_HTML"
+ file="crostini_page/crostini_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_PAGE_JS"
+ file="crostini_page/crostini_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_SUBPAGE_HTML"
+ file="crostini_page/crostini_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_SUBPAGE_JS"
+ file="crostini_page/crostini_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_EXPORT_IMPORT_HTML"
+ file="crostini_page/crostini_export_import.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_EXPORT_IMPORT_JS"
+ file="crostini_page/crostini_export_import.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_SHARED_PATHS_HTML"
+ file="crostini_page/crostini_shared_paths.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_SHARED_PATHS_JS"
+ file="crostini_page/crostini_shared_paths.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_HTML"
+ file="crostini_page/crostini_shared_usb_devices.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_JS"
+ file="crostini_page/crostini_shared_usb_devices.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_BROWSER_PROXY_JS"
+ file="crostini_page/crostini_browser_proxy.js"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_CROSTINI_BROWSER_PROXY_HTML"
+ file="crostini_page/crostini_browser_proxy.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_KIOSK_NEXT_SHELL_PAGE_HTML"
+ file="kiosk_next_shell_page/kiosk_next_shell_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_KIOSK_NEXT_SHELL_PAGE_JS"
+ file="kiosk_next_shell_page/kiosk_next_shell_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_KIOSK_NEXT_SHELL_CONFIRMATION_DIALOG_HTML"
+ file="kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_KIOSK_NEXT_SHELL_CONFIRMATION_DIALOG_JS"
+ file="kiosk_next_shell_page/kiosk_next_shell_confirmation_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_BLUETOOTH_DEVICE_LIST_ITEM_HTML"
+ file="bluetooth_page/bluetooth_device_list_item.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_BLUETOOTH_DEVICE_LIST_ITEM_JS"
+ file="bluetooth_page/bluetooth_device_list_item.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_BLUETOOTH_PAGE_HTML"
+ file="bluetooth_page/bluetooth_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_BLUETOOTH_PAGE_JS"
+ file="bluetooth_page/bluetooth_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_BLUETOOTH_SUBPAGE_HTML"
+ file="bluetooth_page/bluetooth_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_BLUETOOTH_SUBPAGE_JS"
+ file="bluetooth_page/bluetooth_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DATE_TIME_PAGE_HTML"
+ file="date_time_page/date_time_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DATE_TIME_PAGE_JS"
+ file="date_time_page/date_time_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DATE_TIME_TYPES_HTML"
+ file="date_time_page/date_time_types.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_DATE_TIME_TYPES_JS"
+ file="date_time_page/date_time_types.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_TIMEZONE_SELECTOR_HTML"
+ file="date_time_page/timezone_selector.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_TIMEZONE_SELECTOR_JS"
+ file="date_time_page/timezone_selector.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_TIMEZONE_SUBPAGE_HTML"
+ file="date_time_page/timezone_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_TIMEZONE_SUBPAGE_JS"
+ file="date_time_page/timezone_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_CONFIG_HTML"
+ file="internet_page/internet_config.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_CONFIG_JS"
+ file="internet_page/internet_config.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_DETAIL_PAGE_HTML"
+ file="internet_page/internet_detail_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_DETAIL_PAGE_JS"
+ file="internet_page/internet_detail_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_KNOWN_NETWORKS_PAGE_HTML"
+ file="internet_page/internet_known_networks_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_KNOWN_NETWORKS_PAGE_JS"
+ file="internet_page/internet_known_networks_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_PAGE_BROWSER_PROXY_HTML"
+ file="internet_page/internet_page_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_PAGE_BROWSER_PROXY_JS"
+ file="internet_page/internet_page_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_PAGE_HTML"
+ file="internet_page/internet_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_PAGE_JS"
+ file="internet_page/internet_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_SHARED_CSS_HTML"
+ file="internet_page/internet_shared_css.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_SUBPAGE_HTML"
+ file="internet_page/internet_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_INTERNET_SUBPAGE_JS"
+ file="internet_page/internet_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_BROWSER_PROXY_HTML"
+ file="multidevice_page/multidevice_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_BROWSER_PROXY_JS"
+ file="multidevice_page/multidevice_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_CONSTANTS_HTML"
+ file="multidevice_page/multidevice_constants.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_CONSTANTS_JS"
+ file="multidevice_page/multidevice_constants.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_FEATURE_BEHAVIOR_HTML"
+ file="multidevice_page/multidevice_feature_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_FEATURE_BEHAVIOR_JS"
+ file="multidevice_page/multidevice_feature_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_FEATURE_ITEM_HTML"
+ file="multidevice_page/multidevice_feature_item.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_FEATURE_ITEM_JS"
+ file="multidevice_page/multidevice_feature_item.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_FEATURE_TOGGLE_HTML"
+ file="multidevice_page/multidevice_feature_toggle.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_FEATURE_TOGGLE_JS"
+ file="multidevice_page/multidevice_feature_toggle.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_PAGE_HTML"
+ file="multidevice_page/multidevice_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_PAGE_JS"
+ file="multidevice_page/multidevice_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_RADIO_BUTTON_HTML"
+ file="multidevice_page/multidevice_radio_button.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_RADIO_BUTTON_JS"
+ file="multidevice_page/multidevice_radio_button.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_SMARTLOCK_SUBPAGE_HTML"
+ file="multidevice_page/multidevice_smartlock_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_SMARTLOCK_SUBPAGE_JS"
+ file="multidevice_page/multidevice_smartlock_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_SUBPAGE_HTML"
+ file="multidevice_page/multidevice_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_SUBPAGE_JS"
+ file="multidevice_page/multidevice_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_TETHER_ITEM_HTML"
+ file="multidevice_page/multidevice_tether_item.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_MULTIDEVICE_TETHER_ITEM_JS"
+ file="multidevice_page/multidevice_tether_item.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_NETWORK_PROXY_SECTION_HTML"
+ file="internet_page/network_proxy_section.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_NETWORK_PROXY_SECTION_JS"
+ file="internet_page/network_proxy_section.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_NETWORK_SUMMARY_HTML"
+ file="internet_page/network_summary.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_NETWORK_SUMMARY_JS"
+ file="internet_page/network_summary.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_NETWORK_SUMMARY_ITEM_HTML"
+ file="internet_page/network_summary_item.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_NETWORK_SUMMARY_ITEM_JS"
+ file="internet_page/network_summary_item.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_TETHER_CONNECTION_DIALOG_HTML"
+ file="internet_page/tether_connection_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_TETHER_CONNECTION_DIALOG_JS"
+ file="internet_page/tether_connection_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_ACCOUNT_MANAGER_HTML"
+ file="people_page/account_manager.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_ACCOUNT_MANAGER_JS"
+ file="people_page/account_manager.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure
+ name="IDR_OS_SETTINGS_PEOPLE_PAGE_ACCOUNT_MANAGER_BROWSER_PROXY_HTML"
+ file="people_page/account_manager_browser_proxy.html"
+ type="chrome_html"
+ preprocess="true" />
+ <structure
+ name="IDR_OS_SETTINGS_PEOPLE_PAGE_ACCOUNT_MANAGER_BROWSER_PROXY_JS"
+ file="people_page/account_manager_browser_proxy.js"
+ type="chrome_html"
+ preprocess="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_CHANGE_PICTURE_HTML"
+ file="people_page/change_picture.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_PAGE_CHANGE_PICTURE_JS"
+ file="people_page/change_picture.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_CHANGE_PICTURE_BROWSER_PROXY_JS"
+ file="people_page/change_picture_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_CHANGE_PICTURE_BROWSER_PROXY_HTML"
+ file="people_page/change_picture_browser_proxy.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_LOCK_SCREEN_PASSWORD_PROMPT_DIALOG_JS"
+ file="people_page/lock_screen_password_prompt_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_LOCK_SCREEN_PASSWORD_PROMPT_DIALOG_HTML"
+ file="people_page/lock_screen_password_prompt_dialog.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_LOCK_SCREEN_JS"
+ file="people_page/lock_screen.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_LOCK_SCREEN_HTML"
+ file="people_page/lock_screen.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_LOCK_STATE_BEHAVIOR_JS"
+ file="people_page/lock_state_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_LOCK_STATE_BEHAVIOR_HTML"
+ file="people_page/lock_state_behavior.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_SETUP_PIN_DIALOG_JS"
+ file="people_page/setup_pin_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_SETUP_PIN_DIALOG_HTML"
+ file="people_page/setup_pin_dialog.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_FINGERPRINT_LIST_JS"
+ file="people_page/fingerprint_list.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_FINGERPRINT_LIST_HTML"
+ file="people_page/fingerprint_list.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_SETUP_FINGERPRINT_DIALOG_JS"
+ file="people_page/setup_fingerprint_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_SETUP_FINGERPRINT_DIALOG_HTML"
+ file="people_page/setup_fingerprint_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_FINGERPRINT_BROWSER_PROXY_JS"
+ file="people_page/fingerprint_browser_proxy.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PEOPLE_FINGERPRINT_BROWSER_PROXY_HTML"
+ file="people_page/fingerprint_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PLUGIN_VM_PAGE_HTML"
+ file="plugin_vm_page/plugin_vm_page.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PLUGIN_VM_PAGE_JS"
+ file="plugin_vm_page/plugin_vm_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PLUGIN_VM_SUBPAGE_HTML"
+ file="plugin_vm_page/plugin_vm_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_PLUGIN_VM_SUBPAGE_JS"
+ file="plugin_vm_page/plugin_vm_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_USERS_PAGE_ADD_USER_DIALOG_JS"
+ file="people_page/users_add_user_dialog.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_USERS_PAGE_ADD_USER_DIALOG_HTML"
+ file="people_page/users_add_user_dialog.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_USERS_PAGE_USER_LIST_JS"
+ file="people_page/user_list.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_USERS_PAGE_USER_LIST_HTML"
+ file="people_page/user_list.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ <structure name="IDR_OS_SETTINGS_USERS_PAGE_JS"
+ file="people_page/users_page.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_USERS_PAGE_HTML"
+ file="people_page/users_page.html"
+ type="chrome_html"
+ preprocess="true"
+ allowexternalscript="true" />
+ </structures>
+ </release>
+</grit>
diff --git a/chromium/chrome/browser/resources/settings/os_settings_resources_vulcanized.grd b/chromium/chrome/browser/resources/settings/os_settings_resources_vulcanized.grd
new file mode 100644
index 00000000000..93e58945ef3
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/os_settings_resources_vulcanized.grd
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
+ <outputs>
+ <output filename="grit/os_settings_resources.h" type="rc_header">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="grit/os_settings_resources_map.cc"
+ type="resource_map_source" />
+ <output filename="grit/os_settings_resources_map.h"
+ type="resource_map_header" />
+ <output filename="os_settings_resources.pak" type="data_package" />
+ </outputs>
+ <release seq="1">
+ <includes>
+ <include name="IDR_OS_SETTINGS_VULCANIZED_HTML"
+ file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\vulcanized.html"
+ use_base_dir="false"
+ flattenhtml="true"
+ allowexternalscript="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OS_SETTINGS_VULCANIZED_P2_HTML"
+ file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\vulcanized.p2.html"
+ use_base_dir="false"
+ flattenhtml="true"
+ allowexternalscript="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OS_SETTINGS_CRISPER_JS"
+ file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\crisper.js"
+ use_base_dir="false"
+ flattenhtml="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OS_SETTINGS_LAZY_LOAD_VULCANIZED_HTML"
+ file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\lazy_load.vulcanized.html"
+ use_base_dir="false"
+ flattenhtml="true"
+ allowexternalscript="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OS_SETTINGS_LAZY_LOAD_VULCANIZED_P2_HTML"
+ file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\lazy_load.vulcanized.p2.html"
+ use_base_dir="false"
+ flattenhtml="true"
+ allowexternalscript="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OS_SETTINGS_LAZY_LOAD_CRISPER_JS"
+ file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\lazy_load.crisper.js"
+ use_base_dir="false"
+ flattenhtml="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OS_SETTINGS_MANIFEST" file="manifest.json" type="BINDATA" compress="gzip" />
+ </includes>
+ </release>
+</grit>
diff --git a/chromium/chrome/browser/resources/settings/page_visibility.js b/chromium/chrome/browser/resources/settings/page_visibility.js
index a7103c7855a..c475e6758a7 100644
--- a/chromium/chrome/browser/resources/settings/page_visibility.js
+++ b/chromium/chrome/browser/resources/settings/page_visibility.js
@@ -3,14 +3,20 @@
// found in the LICENSE file.
/**
- * Specifies page visibility in guest mode in cr and cros.
+ * Specifies page visibility based on incognito status, Chrome OS guest mode,
+ * and whether or not to include OS settings. Once the Chrome OS SplitSettings
+ * project is completed this can be changed to only consider incognito and
+ * guest mode. https://crbug.com/950007
* @typedef {{
* advancedSettings: (boolean|undefined),
* appearance: (boolean|undefined|AppearancePageVisibility),
* autofill: (boolean|undefined),
+ * bluetooth: (boolean|undefined),
* dateTime: (boolean|undefined|DateTimePageVisibility),
* defaultBrowser: (boolean|undefined),
+ * device: (boolean|undefined),
* downloads: (boolean|undefined|DownloadsPageVisibility),
+ * internet: (boolean|undefined),
* multidevice: (boolean|undefined),
* onStartup: (boolean|undefined),
* people: (boolean|undefined),
@@ -18,7 +24,7 @@
* reset:(boolean|undefined),
* }}
*/
-let GuestModePageVisibility;
+let PageVisibility;
/**
* @typedef {{
@@ -56,10 +62,12 @@ let PrivacyPageVisibility;
cr.define('settings', function() {
/**
* Dictionary defining page visibility.
- * @type {!GuestModePageVisibility}
+ * @type {!PageVisibility}
*/
let pageVisibility;
+ const showOSSettings = loadTimeData.getBoolean('showOSSettings');
+
if (loadTimeData.getBoolean('isGuest')) {
// "if not chromeos" and "if chromeos" in two completely separate blocks
// to work around closure compiler.
@@ -77,6 +85,9 @@ cr.define('settings', function() {
// </if>
// <if expr="chromeos">
pageVisibility = {
+ internet: showOSSettings,
+ bluetooth: showOSSettings,
+ multidevice: false,
autofill: false,
people: false,
onStartup: false,
@@ -88,6 +99,7 @@ cr.define('settings', function() {
bookmarksBar: false,
pageZoom: false,
},
+ device: showOSSettings,
advancedSettings: true,
privacy: {
searchPrediction: false,
@@ -96,7 +108,6 @@ cr.define('settings', function() {
downloads: {
googleDrive: false,
},
- multidevice: false,
extensions: false,
};
// </if>
@@ -105,6 +116,9 @@ cr.define('settings', function() {
// after a property is set.
// <if expr="chromeos">
pageVisibility = {
+ internet: showOSSettings,
+ bluetooth: showOSSettings,
+ multidevice: showOSSettings,
autofill: true,
people: true,
onStartup: true,
@@ -116,6 +130,7 @@ cr.define('settings', function() {
bookmarksBar: true,
pageZoom: true,
},
+ device: showOSSettings,
advancedSettings: true,
privacy: {
searchPrediction: true,
@@ -124,7 +139,6 @@ cr.define('settings', function() {
downloads: {
googleDrive: true,
},
- multidevice: true,
extensions: true,
};
// </if>
diff --git a/chromium/chrome/browser/resources/settings/people_page/account_manager.html b/chromium/chrome/browser/resources/settings/people_page/account_manager.html
index d6d68bd89fe..613982729a6 100644
--- a/chromium/chrome/browser/resources/settings/people_page/account_manager.html
+++ b/chromium/chrome/browser/resources/settings/people_page/account_manager.html
@@ -1,12 +1,13 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
+<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/icon.html">
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
@@ -25,7 +26,11 @@
#outer {
margin-inline-end: var(--cr-section-padding);
- margin-inline-start: 10%;
+ margin-inline-start: 60px;
+ }
+
+ cr-policy-indicator {
+ margin-inline-end: 1em;
}
#account-list-header {
@@ -50,6 +55,10 @@
left: auto;
right: 60%;
}
+
+ .management-status {
+ color: var(--cr-secondary-text-color);
+ }
</style>
<div class="settings-box first">$i18n{accountManagerDescription}</div>
@@ -58,7 +67,12 @@
<div id="account-list-header" class="flex">
<h2>$i18n{accountListHeader}</h2>
</div>
- <paper-button id="add-account-button" on-tap="addAccount_">
+ <cr-policy-indicator
+ hidden="[[isSecondaryGoogleAccountSigninAllowed_()]]"
+ indicator-type="userPolicy">
+ </cr-policy-indicator>
+ <paper-button disabled="[[!isSecondaryGoogleAccountSigninAllowed_()]]"
+ id="add-account-button" on-tap="addAccount_">
<div id="add-account-icon"></div>
$i18n{addAccountLabel}
</paper-button>
@@ -101,12 +115,17 @@
</paper-button>
</template>
- <paper-icon-button-light class="icon-more-vert"
- hidden="[[item.isDeviceAccount]]">
- <button title="$i18n{moreActions}"
- on-click="onAccountActionsMenuButtonTap_">
- </button>
- </paper-icon-button-light>
+ <!-- If this is the Device Account, display the management status -->
+ <template is="dom-if" if="[[item.isDeviceAccount]]">
+ <span class="management-status">
+ [[getManagementLabel_(item)]]
+ </span>
+ </template>
+ <!-- Else, display a hamburger menu for removing the account -->
+ <template is="dom-if" if="[[!item.isDeviceAccount]]">
+ <cr-icon-button class="icon-more-vert" title="$i18n{moreActions}"
+ on-click="onAccountActionsMenuButtonTap_"></cr-icon-button>
+ </template>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/settings/people_page/account_manager.js b/chromium/chrome/browser/resources/settings/people_page/account_manager.js
index 37d637fecf6..eb24b962459 100644
--- a/chromium/chrome/browser/resources/settings/people_page/account_manager.js
+++ b/chromium/chrome/browser/resources/settings/people_page/account_manager.js
@@ -61,6 +61,15 @@ Polymer({
},
/**
+ * @return {boolean} True if secondary account sign-ins are allowed, false
+ * otherwise.
+ * @private
+ */
+ isSecondaryGoogleAccountSigninAllowed_: function() {
+ return loadTimeData.getBoolean('secondaryGoogleAccountSigninAllowed');
+ },
+
+ /**
* @param {string} iconUrl
* @return {string} A CSS image-set for multiple scale factors.
* @private
@@ -92,6 +101,21 @@ Polymer({
},
/**
+ * @param {!settings.Account} account
+ * @return {string} An appropriate management status label. e.g.
+ * "Primary account" for unmanaged accounts, "Managed by <Domain>"
+ * for Enterprise managed accounts etc.
+ * @private
+ */
+ getManagementLabel_: function(account) {
+ if (account.organization) {
+ return this.i18n('accountManagerManagedLabel', account.organization);
+ }
+
+ return this.i18n('accountManagerUnmanagedLabel');
+ },
+
+ /**
* @param {!CustomEvent<!{model: !{item: !settings.Account}}>} event
* @private
*/
diff --git a/chromium/chrome/browser/resources/settings/people_page/account_manager_browser_proxy.js b/chromium/chrome/browser/resources/settings/people_page/account_manager_browser_proxy.js
index c087831213d..a83b3dcbc69 100644
--- a/chromium/chrome/browser/resources/settings/people_page/account_manager_browser_proxy.js
+++ b/chromium/chrome/browser/resources/settings/people_page/account_manager_browser_proxy.js
@@ -19,6 +19,7 @@ cr.exportPath('settings');
* fullName: string,
* email: string,
* pic: string,
+ * organization: (string|undefined),
* }}
*/
settings.Account;
diff --git a/chromium/chrome/browser/resources/settings/people_page/fingerprint_browser_proxy.js b/chromium/chrome/browser/resources/settings/people_page/fingerprint_browser_proxy.js
index dba100aa3cd..8479d9ce8e1 100644
--- a/chromium/chrome/browser/resources/settings/people_page/fingerprint_browser_proxy.js
+++ b/chromium/chrome/browser/resources/settings/people_page/fingerprint_browser_proxy.js
@@ -64,7 +64,11 @@ cr.define('settings', function() {
*/
getNumFingerprints() {}
- startEnroll() {}
+ /**
+ * @param {string} authToken
+ */
+ startEnroll(authToken) {}
+
cancelCurrentEnroll() {}
/**
@@ -112,8 +116,8 @@ cr.define('settings', function() {
}
/** @override */
- startEnroll() {
- chrome.send('startEnroll');
+ startEnroll(authToken) {
+ chrome.send('startEnroll', [authToken]);
}
/** @override */
diff --git a/chromium/chrome/browser/resources/settings/people_page/fingerprint_list.html b/chromium/chrome/browser/resources/settings/people_page/fingerprint_list.html
index f9217a04255..998a9714d96 100644
--- a/chromium/chrome/browser/resources/settings/people_page/fingerprint_list.html
+++ b/chromium/chrome/browser/resources/settings/people_page/fingerprint_list.html
@@ -1,5 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/assert.html">
@@ -9,7 +10,6 @@
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-ripple/paper-ripple.html">
<link rel="import" href="fingerprint_browser_proxy.html">
<link rel="import" href="setup_fingerprint_dialog.html">
@@ -54,11 +54,9 @@
<paper-ripple noink></paper-ripple>
<cr-input value="{{item}}" on-change="onFingerprintLabelChanged_">
</cr-input>
- <paper-icon-button-light class="icon-delete-gray">
- <button on-click="onFingerprintDeleteTapped_"
- aria-label$="[[getButtonAriaLabel_(item)]]">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-delete-gray"
+ on-click="onFingerprintDeleteTapped_"
+ aria-label$="[[getButtonAriaLabel_(item)]]"></cr-icon-button>
</div>
</template>
</iron-list>
@@ -73,6 +71,7 @@
<template is="dom-if" if="[[showSetupFingerprintDialog_]]" restamp>
<settings-setup-fingerprint-dialog
+ auth-token="[[authToken]]"
on-add-fingerprint="updateFingerprintsList_"
on-close="onSetupFingerprintDialogClose_"
allow-add-another-finger="[[allowAddAnotherFinger_]]">
diff --git a/chromium/chrome/browser/resources/settings/people_page/fingerprint_list.js b/chromium/chrome/browser/resources/settings/people_page/fingerprint_list.js
index 0d4598dcc41..92cfb70ecef 100644
--- a/chromium/chrome/browser/resources/settings/people_page/fingerprint_list.js
+++ b/chromium/chrome/browser/resources/settings/people_page/fingerprint_list.js
@@ -23,6 +23,14 @@ Polymer({
properties: {
/**
+ * Authentication token provided by settings-people-page.
+ */
+ authToken: {
+ type: String,
+ value: '',
+ },
+
+ /**
* The list of fingerprint objects.
* @private {!Array<string>}
*/
diff --git a/chromium/chrome/browser/resources/settings/people_page/import_data_dialog.html b/chromium/chrome/browser/resources/settings/people_page/import_data_dialog.html
index f9203c1c8e6..8ba8062f92c 100644
--- a/chromium/chrome/browser/resources/settings/people_page/import_data_dialog.html
+++ b/chromium/chrome/browser/resources/settings/people_page/import_data_dialog.html
@@ -35,8 +35,7 @@
width: 100%;
}
- /* Prevent focus-outline to be chopped by the bottom of dialog body.
- TODO(scottchen): find a more general way to solve this. */
+ /* Prevent focus-outline to be chopped by the bottom of dialog body. */
.md-select {
margin-top: 2px;
}
diff --git a/chromium/chrome/browser/resources/settings/people_page/lock_screen.html b/chromium/chrome/browser/resources/settings/people_page/lock_screen.html
index 928777426e0..5947726a16d 100644
--- a/chromium/chrome/browser/resources/settings/people_page/lock_screen.html
+++ b/chromium/chrome/browser/resources/settings/people_page/lock_screen.html
@@ -3,6 +3,7 @@
<link rel="import" href="chrome://resources/cr_components/chromeos/quick_unlock/lock_screen_constants.html">
<link rel="import" href="chrome://resources/cr_elements/cr_radio_button/cr_radio_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_radio_group/cr_radio_group.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
@@ -35,7 +36,7 @@
}
cr-radio-button {
- --cr-radio-button-label: {
+ --cr-radio-button-slot: {
display: flex;
line-height: 154%; /* Apply 20px line-height to paper radio button
text to match rest of settings line-heights. */
@@ -49,7 +50,7 @@
}
.underbar {
- border-bottom: var(--settings-separator-line);
+ border-bottom: var(--cr-separator-line);
}
#unlockType[disabled] {
@@ -158,7 +159,7 @@
<settings-lock-screen-password-prompt-dialog
id="lockScreenPasswordPrompt"
on-close="onPasswordPromptDialogClose_" set-modes="{{setModes_}}"
- auth-token="{{authToken_}}">
+ auth-token="{{authToken}}">
</settings-lock-screen-password-prompt-dialog>
</template>
diff --git a/chromium/chrome/browser/resources/settings/people_page/lock_screen.js b/chromium/chrome/browser/resources/settings/people_page/lock_screen.js
index 1f2f6dbe40b..f0584fee7e4 100644
--- a/chromium/chrome/browser/resources/settings/people_page/lock_screen.js
+++ b/chromium/chrome/browser/resources/settings/people_page/lock_screen.js
@@ -41,9 +41,12 @@ Polymer({
/**
* Authentication token provided by lock-screen-password-prompt-dialog.
- * @private
*/
- authToken_: String,
+ authToken: {
+ type: String,
+ value: '',
+ notify: true,
+ },
/**
* writeUma_ is a function that handles writing uma stats. It may be
@@ -181,12 +184,12 @@ Polymer({
*/
onScreenLockChange_: function(event) {
const target = /** @type {!SettingsToggleButtonElement} */ (event.target);
- if (!this.authToken_) {
+ if (!this.authToken) {
console.error('Screen lock changed with expired token.');
target.checked = !target.checked;
return;
}
- this.setLockScreenEnabled(this.authToken_, target.checked);
+ this.setLockScreenEnabled(this.authToken, target.checked);
},
/**
diff --git a/chromium/chrome/browser/resources/settings/people_page/manage_profile.html b/chromium/chrome/browser/resources/settings/people_page/manage_profile.html
index dc3c77c510b..c2f444c6013 100644
--- a/chromium/chrome/browser/resources/settings/people_page/manage_profile.html
+++ b/chromium/chrome/browser/resources/settings/people_page/manage_profile.html
@@ -18,7 +18,7 @@
}
#selector {
- margin: 16px 20px;
+ margin: 16px 48px;
}
</style>
<div class="settings-box first">
diff --git a/chromium/chrome/browser/resources/settings/people_page/people_page.html b/chromium/chrome/browser/resources/settings/people_page/people_page.html
index 76966656d08..6926732db0f 100644
--- a/chromium/chrome/browser/resources/settings/people_page/people_page.html
+++ b/chromium/chrome/browser/resources/settings/people_page/people_page.html
@@ -1,6 +1,9 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
@@ -9,7 +12,6 @@
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="profile_info_browser_proxy.html">
<link rel="import" href="sync_browser_proxy.html">
@@ -83,7 +85,7 @@
cr-link-row {
--cr-link-row-icon-width: 40px;
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
}
.settings-box[actionable].sync-error #syncSecondary {
@@ -124,9 +126,6 @@
font-size: 1.1rem;
line-height: 1.625rem;
}
- --promo-separator: {
- display: none;
- }
}
</if>
</style>
@@ -164,16 +163,14 @@
</div>
</div>
<if expr="not chromeos">
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{editPerson}"
- aria-describedby="profile-name"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{editPerson}"
+ aria-describedby="profile-name"></cr-icon-button>
</if>
<if expr="chromeos">
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{changePictureTitle}"
- aria-describedby="profile-name"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{changePictureTitle}"
+ aria-describedby="profile-name"></cr-icon-button>
</if>
</div>
<if expr="not chromeos">
@@ -234,10 +231,8 @@
[[syncStatus.statusText]]
</div>
</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{sync}"
- aria-describedby="syncSecondary"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow" aria-label="$i18n{sync}"
+ aria-describedby="syncSecondary"></cr-icon-button>
</div>
</template>
@@ -259,40 +254,23 @@
<div class="start settings-box-text">
$i18n{profileNameAndPicture}
</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{editPerson}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{editPerson}"></cr-icon-button>
</div>
</template>
</if>
<if expr="chromeos">
- <div id="lock-screen-subpage-trigger" class="settings-box two-line"
- actionable on-click="onConfigureLockTap_">
- <div class="start settings-box-text">
- [[selectLockScreenTitleString(hasPinLogin)]]
- <div class="secondary" id="lockScreenSecondary">
- [[getPasswordState_(hasPin,
- prefs.settings.enable_screen_lock.value)]]
- </div>
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button
- aria-label$="[[selectLockScreenTitleString(hasPinLogin)]]"
- aria-describedby="lockScreenSecondary"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="lock-screen-subpage-trigger" class="hr"
+ on-click="onConfigureLockTap_"
+ label="[[selectLockScreenTitleString(hasPinLogin)]]"
+ sub-label="[[getPasswordState_(hasPin,
+ prefs.settings.enable_screen_lock.value)]]"></cr-link-row>
<template is="dom-if" if="[[isAccountManagerEnabled_]]">
- <div id="account-manager-subpage-trigger" class="settings-box"
- actionable on-click="onAccountManagerTap_">
- <div class="start settings-box-text">
- $i18n{accountManagerSubMenuLabel}
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{accountManagerSubMenuLabel}"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="account-manager-subpage-trigger" class="hr"
+ on-click="onAccountManagerTap_"
+ label="$i18n{accountManagerSubMenuLabel}"></cr-link-row>
</template>
<cr-link-row id="manage-other-people-subpage-trigger"
@@ -301,16 +279,9 @@
</if>
<if expr="not chromeos">
- <div class="settings-box" on-click="onImportDataTap_" actionable>
- <div class="start settings-box-text">
- $i18n{importTitle}
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button id="importDataDialogTrigger"
- aria-label="$i18n{importTitle}">
- </button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="importDataDialogTrigger"
+ label="$i18n{importTitle}"
+ on-click="onImportDataTap_"></cr-link-row>
</if>
</div>
@@ -352,14 +323,15 @@
page-title="[[selectLockScreenTitleString(hasPinLogin)]]"
associated-control="[[$$('#lock-screen-subpage-trigger')]]">
<settings-lock-screen
- prefs="{{prefs}}">
+ prefs="{{prefs}}" auth-token="{{authToken_}}">
</settings-lock-screen>
</settings-subpage>
</template>
<template is="dom-if" if="[[fingerprintUnlockEnabled_]]">
<template is="dom-if" route-path="/lockScreen/fingerprint" no-search>
<settings-subpage page-title="$i18n{lockScreenFingerprintTitle}">
- <settings-fingerprint-list></settings-fingerprint-list>
+ <settings-fingerprint-list auth-token="[[authToken_]]">
+ </settings-fingerprint-list>
</settings-subpage>
</template>
</template>
diff --git a/chromium/chrome/browser/resources/settings/people_page/people_page.js b/chromium/chrome/browser/resources/settings/people_page/people_page.js
index fd39f74b526..ed6c01f6043 100644
--- a/chromium/chrome/browser/resources/settings/people_page/people_page.js
+++ b/chromium/chrome/browser/resources/settings/people_page/people_page.js
@@ -29,7 +29,7 @@ Polymer({
/**
* This flag is used to conditionally show a set of new sign-in UIs to the
* profiles that have been migrated to be consistent with the web sign-ins.
- * TODO(scottchen): In the future when all profiles are completely migrated,
+ * TODO(tangltom): In the future when all profiles are completely migrated,
* this should be removed, and UIs hidden behind it should become default.
* @private
*/
@@ -44,7 +44,7 @@ Polymer({
/**
* This flag is used to conditionally show a set of sync UIs to the
* profiles that have been migrated to have a unified consent flow.
- * TODO(scottchen): In the future when all profiles are completely migrated,
+ * TODO(tangltom): In the future when all profiles are completely migrated,
* this should be removed, and UIs hidden behind it should become default.
* @private
*/
@@ -71,11 +71,20 @@ Polymer({
/**
* Dictionary defining page visibility.
- * @type {!GuestModePageVisibility}
+ * @type {!PageVisibility}
*/
pageVisibility: Object,
/**
+ * Authentication token provided by settings-lock-screen.
+ * @private
+ */
+ authToken_: {
+ type: String,
+ value: '',
+ },
+
+ /**
* The currently selected profile icon URL. May be a data URL.
* @private
*/
@@ -142,27 +151,26 @@ Polymer({
settings.routes.SYNC.path,
loadTimeData.getBoolean('unifiedConsentEnabled') ?
'#sync-setup' :
- '#sync-status .subpage-arrow button');
+ '#sync-status .subpage-arrow');
}
// <if expr="not chromeos">
if (settings.routes.MANAGE_PROFILE) {
map.set(
settings.routes.MANAGE_PROFILE.path,
loadTimeData.getBoolean('diceEnabled') ?
- '#edit-profile .subpage-arrow button' :
- '#picture-subpage-trigger .subpage-arrow button');
+ '#edit-profile .subpage-arrow' :
+ '#picture-subpage-trigger .subpage-arrow');
}
// </if>
// <if expr="chromeos">
if (settings.routes.CHANGE_PICTURE) {
map.set(
settings.routes.CHANGE_PICTURE.path,
- '#picture-subpage-trigger .subpage-arrow button');
+ '#picture-subpage-trigger .subpage-arrow');
}
if (settings.routes.LOCK_SCREEN) {
map.set(
- settings.routes.LOCK_SCREEN.path,
- '#lock-screen-subpage-trigger .subpage-arrow button');
+ settings.routes.LOCK_SCREEN.path, '#lock-screen-subpage-trigger');
}
if (settings.routes.ACCOUNTS) {
map.set(
@@ -172,32 +180,18 @@ Polymer({
if (settings.routes.ACCOUNT_MANAGER) {
map.set(
settings.routes.ACCOUNT_MANAGER.path,
- '#account-manager-subpage-trigger .subpage-arrow button');
+ '#account-manager-subpage-trigger');
}
// </if>
return map;
},
},
-
- /**
- * True if current user is child user.
- */
- isChild_: Boolean,
},
/** @private {?settings.SyncBrowserProxy} */
syncBrowserProxy_: null,
/** @override */
- created: function() {
- // <if expr="chromeos">
- chrome.usersPrivate.getCurrentUser(user => {
- this.isChild_ = user.isChild;
- });
- // </if>
- },
-
- /** @override */
attached: function() {
const profileInfoProxy = settings.ProfileInfoBrowserProxyImpl.getInstance();
profileInfoProxy.getProfileInfo().then(this.handleProfileInfo_.bind(this));
diff --git a/chromium/chrome/browser/resources/settings/people_page/settings_icon_camera_alt.svg b/chromium/chrome/browser/resources/settings/people_page/settings_icon_camera_alt.svg
index d8c79bb21df..dbe522a6b85 100644
--- a/chromium/chrome/browser/resources/settings/people_page/settings_icon_camera_alt.svg
+++ b/chromium/chrome/browser/resources/settings/people_page/settings_icon_camera_alt.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#FFFFFF" preserveAspectRatio="xMidYMid meet"><circle cx="12" cy="12" r="3.2"></circle><path d="M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"></path></svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#FFF"><circle cx="12" cy="12" r="3.2"/><path d="M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/people_page/setup_fingerprint_dialog.js b/chromium/chrome/browser/resources/settings/people_page/setup_fingerprint_dialog.js
index e3f1867824f..2f770c9f4e5 100644
--- a/chromium/chrome/browser/resources/settings/people_page/setup_fingerprint_dialog.js
+++ b/chromium/chrome/browser/resources/settings/people_page/setup_fingerprint_dialog.js
@@ -39,6 +39,13 @@ Polymer({
},
/**
+ * Authentication token provided by settings-fingerprint-list
+ */
+ authToken: {
+ type: String,
+ value: '',
+ },
+ /**
* The problem message to display.
* @private
*/
@@ -87,7 +94,7 @@ Polymer({
this.browserProxy_ = settings.FingerprintBrowserProxyImpl.getInstance();
this.$.arc.reset();
- this.browserProxy_.startEnroll();
+ this.browserProxy_.startEnroll(this.authToken);
this.$.dialog.showModal();
},
@@ -267,7 +274,7 @@ Polymer({
this.reset_();
this.$.arc.reset();
this.step_ = settings.FingerprintSetupStep.MOVE_FINGER;
- this.browserProxy_.startEnroll();
+ this.browserProxy_.startEnroll(this.authToken);
},
/**
diff --git a/chromium/chrome/browser/resources/settings/people_page/signout_dialog.html b/chromium/chrome/browser/resources/settings/people_page/signout_dialog.html
index af7c0a5c360..4a938428b72 100644
--- a/chromium/chrome/browser/resources/settings/people_page/signout_dialog.html
+++ b/chromium/chrome/browser/resources/settings/people_page/signout_dialog.html
@@ -3,6 +3,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="profile_info_browser_proxy.html">
@@ -13,7 +14,7 @@
<template>
<style include="settings-shared">
#dialog [slot=footer] .settings-box {
- --settings-box-row-padding: 0;
+ --cr-section-padding: 0;
}
.delete-profile-warning {
diff --git a/chromium/chrome/browser/resources/settings/people_page/sync_account_control.html b/chromium/chrome/browser/resources/settings/people_page/sync_account_control.html
index 4fed8da4055..54c40c4a736 100644
--- a/chromium/chrome/browser/resources/settings/people_page/sync_account_control.html
+++ b/chromium/chrome/browser/resources/settings/people_page/sync_account_control.html
@@ -1,12 +1,12 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="profile_info_browser_proxy.html">
<link rel="import" href="sync_browser_proxy.html">
<link rel="import" href="../i18n_setup.html">
@@ -112,6 +112,7 @@
}
#sign-in {
+ margin: auto 8px;
min-width: 100px;
}
@@ -139,10 +140,6 @@
:host([showing-promo]) #promo-description {
@apply --promo-description;
}
-
- :host([showing-promo]) #promo-separator {
- @apply --promo-separator;
- }
</style>
<div id="banner" hidden="[[syncStatus.signedIn]]"></div>
<div class$="settings-box first
@@ -155,8 +152,6 @@
</div>
<div class="secondary">[[subLabel_]]</div>
</div>
- <div id="promo-separator" class="separator"
- hidden="[[shouldShowAvatarRow_]]"></div>
<paper-button class="action-button" on-click="onSigninTap_"
disabled="[[syncStatus.setupInProgress]]" id="sign-in"
hidden="[[shouldShowAvatarRow_]]">
@@ -194,12 +189,10 @@
</div>
</div>
</div>
- <paper-icon-button-light class="icon-arrow-dropdown"
- hidden="[[syncStatus.signedIn]]">
- <button on-click="onMenuButtonTap_" id="dropdown-arrow"
- aria-label="$i18n{useAnotherAccount}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-arrow-dropdown"
+ hidden="[[syncStatus.signedIn]]" on-click="onMenuButtonTap_"
+ id="dropdown-arrow" aria-label="$i18n{useAnotherAccount}">
+ </cr-icon-button>
<div class="separator" hidden="[[syncStatus.signedIn]]"></div>
<paper-button id="sync-button" class="action-button"
hidden="[[syncStatus.signedIn]]" on-click="onSyncButtonTap_"
diff --git a/chromium/chrome/browser/resources/settings/people_page/sync_browser_proxy.js b/chromium/chrome/browser/resources/settings/people_page/sync_browser_proxy.js
index fffa2eceed2..4642000c02d 100644
--- a/chromium/chrome/browser/resources/settings/people_page/sync_browser_proxy.js
+++ b/chromium/chrome/browser/resources/settings/people_page/sync_browser_proxy.js
@@ -71,7 +71,6 @@ settings.StatusAction = {
* bookmarksSynced: boolean,
* encryptAllData: boolean,
* encryptAllDataAllowed: boolean,
- * enterGooglePassphraseBody: (string|undefined),
* enterPassphraseBody: (string|undefined),
* extensionsEnforced: boolean,
* extensionsRegistered: boolean,
@@ -79,7 +78,6 @@ settings.StatusAction = {
* fullEncryptionBody: string,
* passphrase: (string|undefined),
* passphraseRequired: boolean,
- * passphraseTypeIsCustom: boolean,
* passwordsEnforced: boolean,
* passwordsRegistered: boolean,
* passwordsSynced: boolean,
diff --git a/chromium/chrome/browser/resources/settings/people_page/sync_controls.html b/chromium/chrome/browser/resources/settings/people_page/sync_controls.html
index cf1c3ca84bf..29466647fec 100644
--- a/chromium/chrome/browser/resources/settings/people_page/sync_controls.html
+++ b/chromium/chrome/browser/resources/settings/people_page/sync_controls.html
@@ -7,13 +7,12 @@
<link rel="import" href="sync_browser_proxy.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
-<link rel="import" href="../settings_vars_css.html">
<dom-module id="settings-sync-controls">
<template>
<style include="settings-shared">
#sync-data-types .list-item:not([hidden]) ~ .list-item:not([hidden]) {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
}
.list-item {
diff --git a/chromium/chrome/browser/resources/settings/people_page/sync_page.html b/chromium/chrome/browser/resources/settings/people_page/sync_page.html
index 413b746710a..c68b40c9cbb 100644
--- a/chromium/chrome/browser/resources/settings/people_page/sync_page.html
+++ b/chromium/chrome/browser/resources/settings/people_page/sync_page.html
@@ -4,6 +4,7 @@
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/cr_radio_button/cr_radio_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_radio_group/cr_radio_group.html">
@@ -11,7 +12,6 @@
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="sync_browser_proxy.html">
<link rel="import" href="sync_controls.html">
<link rel="import" href="../privacy_page/personalization_options.html">
@@ -32,12 +32,12 @@
}
#sync-separator {
- border-bottom: var(--settings-separator-line);
+ border-bottom: var(--cr-separator-line);
}
#create-password-box {
/* In order to line up with the encryption radio box text. */
- margin-inline-start: var(--settings-indent-width);
+ margin-inline-start: var(--cr-section-indent-width);
}
#create-password-box {
@@ -53,10 +53,10 @@
}
#existingPassphrase {
- border-bottom: var(--settings-separator-line);
- border-top: var(--settings-separator-line);
+ border-bottom: var(--cr-separator-line);
+ border-top: var(--cr-separator-line);
/* This particular list frame is not indented. */
- padding-inline-start: var(--settings-box-row-padding);
+ padding-inline-start: var(--cr-section-padding);
}
#submitExistingPassphrase {
@@ -73,7 +73,7 @@
}
#other-sync-items > .list-item:not(.first) {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
}
.passphrase-reset-icon {
@@ -120,13 +120,14 @@
</div>
<template is="dom-if" if="[[shouldShowExistingPassphraseBelowAccount_(
- unifiedConsentEnabled, syncPrefs.passphraseRequired)]]">
+ unifiedConsentEnabled, syncPrefs.passphraseRequired)]]"
+ notify-dom-change on-dom-change="focusPassphraseInput_">
<div id="existingPassphrase" class="list-frame">
<div id="existingPassphraseTitle" class="list-item">
<div class="start settings-box-text">
<div>$i18n{existingPassphraseTitle}</div>
- <div class="secondary" inner-h-t-m-l="[[enterPassphrasePrompt_(
- syncPrefs.passphraseTypeIsCustom)]]">
+ <div class="secondary"
+ inner-h-t-m-l="[[syncPrefs.enterPassphraseBody]]">
</div>
</div>
</div>
@@ -169,12 +170,12 @@
<!-- TODO(http://crbug.com/862983) Remove this section once the Unified
Consent feature is launched. -->
<template is="dom-if" if="[[shouldShowExistingPassphraseInSyncSection_(
- unifiedConsentEnabled, syncPrefs.passphraseRequired)]]">
+ unifiedConsentEnabled, syncPrefs.passphraseRequired)]]"
+ notify-dom-change on-dom-change="focusPassphraseInput_">
<div id="existingPassphrase" class="list-frame">
<div class="list-item">
<div class="settings-box-text"
- inner-h-t-m-l="[[enterPassphrasePrompt_(
- syncPrefs.passphraseTypeIsCustom)]]">
+ inner-h-t-m-l="[[syncPrefs.enterPassphraseBody]]">
</div>
</div>
<div id="existingPassphraseContainer" class="list-item">
@@ -210,9 +211,8 @@
<div class="start">
$i18n{syncAdvancedPageTitle}
</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{syncAdvancedPageTitle}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{syncAdvancedPageTitle}"></cr-icon-button>
</div>
</template>
@@ -233,9 +233,7 @@
<div class="start settings-box-text">
$i18n{personalizeGoogleServicesTitle}
</div>
- <paper-icon-button-light actionable class="icon-external">
- <button></button>
- </paper-icon-button-light>
+ <cr-icon-button actionable class="icon-external"></cr-icon-button>
</a>
<a id="syncDashboardLink"
@@ -246,9 +244,7 @@
<div class="start settings-box-text">
$i18n{manageSyncedDataTitle}
</div>
- <paper-icon-button-light actionable class="icon-external">
- <button></button>
- </paper-icon-button-light>
+ <cr-icon-button actionable class="icon-external"></cr-icon-button>
</a>
<div id="encryptionDescription"
@@ -272,8 +268,7 @@
hidden="[[syncPrefs.passphraseRequired]]">
<cr-radio-group
id="encryptionRadioGroup"
- selected="[[selectedEncryptionRadio_(
- syncPrefs.passphraseTypeIsCustom)]]"
+ selected="[[selectedEncryptionRadio_(syncPrefs)]]"
on-selected-changed="onEncryptionRadioSelectionChanged_"
disabled$="[[disableEncryptionOptions_]]">
<cr-radio-button name="encrypt-with-google" class="list-item"
diff --git a/chromium/chrome/browser/resources/settings/people_page/sync_page.js b/chromium/chrome/browser/resources/settings/people_page/sync_page.js
index 98bb18b5b91..ae047ec65f8 100644
--- a/chromium/chrome/browser/resources/settings/people_page/sync_page.js
+++ b/chromium/chrome/browser/resources/settings/people_page/sync_page.js
@@ -291,30 +291,46 @@ Polymer({
currentRouteChanged: function() {
if (settings.getCurrentRoute() == settings.routes.SYNC) {
this.onNavigateToPage_();
- } else if (!settings.routes.SYNC.contains(settings.getCurrentRoute())) {
- // When the user is about to cancel the sync setup, but hasn't confirmed
- // the cancellation, navigate back and show the 'Cancel sync?' dialog.
- if (this.unifiedConsentEnabled && this.syncStatus &&
- this.syncStatus.setupInProgress && this.didAbort_ &&
- !this.setupCancelConfirmed_) {
- chrome.metricsPrivate.recordUserAction(
- 'Signin_Signin_BackOnAdvancedSyncSettings');
- // Yield so that other |currentRouteChanged| observers are called,
- // before triggering another navigation (and another round of observers
- // firing). Triggering navigation from within an observer leads to some
- // undefined behavior and runtime errors.
- requestAnimationFrame(() => {
- settings.navigateTo(settings.routes.SYNC);
- this.showSetupCancelDialog_ = true;
- // Flush to make sure that the setup cancel dialog is attached.
- Polymer.dom.flush();
- this.$$('#setupCancelDialog').showModal();
- });
- } else {
- this.setupCancelConfirmed_ = false;
- this.onNavigateAwayFromPage_();
- }
+ return;
+ }
+
+ if (settings.routes.SYNC.contains(settings.getCurrentRoute())) {
+ return;
+ }
+
+ const searchParams = settings.getQueryParameters().get('search');
+ if (searchParams) {
+ // User navigated away via searching. Cancel sync without showing
+ // confirmation dialog.
+ this.onNavigateAwayFromPage_();
+ return;
}
+
+ const userActionCancelsSetup =
+ this.syncStatus && this.syncStatus.setupInProgress && this.didAbort_;
+ if (this.unifiedConsentEnabled && userActionCancelsSetup &&
+ !this.setupCancelConfirmed_) {
+ chrome.metricsPrivate.recordUserAction(
+ 'Signin_Signin_BackOnAdvancedSyncSettings');
+ // Show the 'Cancel sync?' dialog.
+ // Yield so that other |currentRouteChanged| observers are called,
+ // before triggering another navigation (and another round of observers
+ // firing). Triggering navigation from within an observer leads to some
+ // undefined behavior and runtime errors.
+ requestAnimationFrame(() => {
+ settings.navigateTo(settings.routes.SYNC);
+ this.showSetupCancelDialog_ = true;
+ // Flush to make sure that the setup cancel dialog is attached.
+ Polymer.dom.flush();
+ this.$$('#setupCancelDialog').showModal();
+ });
+ return;
+ }
+
+ // Reset variable.
+ this.setupCancelConfirmed_ = false;
+
+ this.onNavigateAwayFromPage_();
},
/**
@@ -402,18 +418,6 @@ Polymer({
(this.syncStatus && this.syncStatus.supervisedUser)) {
this.creatingNewPassphrase_ = false;
}
-
- // Focus the password input box if password is needed to start sync.
- if (this.syncPrefs.passphraseRequired) {
- // Wait for the dom-if templates to render and subpage to become visible.
- listenOnce(document, 'show-container', () => {
- const input = /** @type {!CrInputElement} */ (
- this.$$('#existingPassphraseInput'));
- if (!input.matches(':focus-within')) {
- input.focus();
- }
- });
- }
},
/** @private */
@@ -531,18 +535,6 @@ Polymer({
},
/**
- * Computed binding returning text of the prompt for entering the passphrase.
- * @private
- */
- enterPassphrasePrompt_: function() {
- if (this.syncPrefs && this.syncPrefs.passphraseTypeIsCustom) {
- return this.syncPrefs.enterPassphraseBody;
- }
-
- return this.syncPrefs.enterGooglePassphraseBody;
- },
-
- /**
* Checks the supplied passphrases to ensure that they are not empty and that
* they match each other. Additionally, displays error UI if they are invalid.
* @return {boolean} Whether the check was successful (i.e., that the
@@ -697,6 +689,19 @@ Polymer({
}
settings.navigateTo(settings.routes.BASIC);
},
+
+ /**
+ * Focuses the passphrase input element if it is available and the page is
+ * visible.
+ * @private
+ */
+ focusPassphraseInput_: function() {
+ const passphraseInput =
+ /** @type {!CrInputElement} */ (this.$$('#existingPassphraseInput'));
+ if (passphraseInput && settings.getCurrentRoute() == settings.routes.SYNC) {
+ passphraseInput.focus();
+ }
+ },
});
})();
diff --git a/chromium/chrome/browser/resources/settings/people_page/user_list.html b/chromium/chrome/browser/resources/settings/people_page/user_list.html
index 1a12c33141c..34231952976 100644
--- a/chromium/chrome/browser/resources/settings/people_page/user_list.html
+++ b/chromium/chrome/browser/resources/settings/people_page/user_list.html
@@ -1,12 +1,14 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_scrollable_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
+<link rel="import" href="../settings_vars_css.html">
<dom-module id="settings-user-list">
<template>
@@ -18,7 +20,7 @@
}
.user {
- border-bottom: var(--settings-separator-line);
+ border-bottom: var(--cr-separator-line);
}
.user-icon {
@@ -46,10 +48,10 @@
[[item.displayEmail]]
</div>
</div>
- <paper-icon-button-light class="icon-clear"
- hidden="[[shouldHideCloseButton_(disabled, item.isOwner)]]">
- <button on-click="removeUser_"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-clear"
+ hidden="[[shouldHideCloseButton_(disabled, item.isOwner)]]"
+ title="$i18n{removeUserTooltip}" on-click="removeUser_">
+ </cr-icon-button>
</div>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html b/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html
index df9f67697f0..7915b03403e 100644
--- a/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html
+++ b/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html
@@ -18,8 +18,9 @@
<cr-dialog id="dialog" close-text="$i18n{close}">
<div slot="title">$i18n{addUsers}</div>
<div slot="body">
- <cr-input id="addUserInput" label="$i18n{addUsersEmail}" autofocus
- on-input="validate_" invalid="[[!isValid_]]">
+ <cr-input id="addUserInput" label="$i18n{addUsersEmail}"
+ invalid="[[shouldShowError_(isEmail_, isEmpty_)]]"
+ on-value-changed="onInput_" autofocus>
</cr-input>
</div>
<div slot="button-container">
@@ -27,7 +28,7 @@
$i18n{cancel}
</paper-button>
<paper-button on-click="addUser_" class="action-button"
- disabled$="[[!isValid_]]">
+ disabled$="[[!canAddUser_(isEmail_, isEmpty_)]]">
$i18n{add}
</paper-button>
</div>
diff --git a/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js b/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js
index 35fb0351629..3721024821d 100644
--- a/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js
+++ b/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js
@@ -34,37 +34,30 @@ Polymer({
properties: {
/** @private */
- isValid_: {
+ isEmail_: {
type: Boolean,
value: false,
},
+
+ /** @private */
+ isEmpty_: {
+ type: Boolean,
+ value: true,
+ },
},
open: function() {
- this.isValid_ = false;
+ this.$.addUserInput.value = '';
+ this.onInput_();
this.$.dialog.showModal();
- },
-
- /** @private */
- onCancelTap_: function() {
- this.$.dialog.cancel();
- },
-
- /**
- * Validates that the new user entered is valid.
- * @private
- * @return {boolean}
- */
- validate_: function() {
- const input = this.$.addUserInput.value;
- this.isValid_ = NAME_ONLY_REGEX.test(input) || EMAIL_REGEX.test(input);
- return this.isValid_;
+ // Set to valid initially since the user has not typed anything yet.
+ this.$.addUserInput.invalid = false;
},
/** @private */
addUser_: function() {
// May be submitted by the Enter key even if the input value is invalid.
- if (!this.validate_()) {
+ if (this.$.addUserInput.disabled) {
return;
}
@@ -87,6 +80,34 @@ Polymer({
this.$.addUserInput.value = '';
this.$.dialog.close();
},
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ canAddUser_: function() {
+ return this.isEmail_ && !this.isEmpty_;
+ },
+
+ /** @private */
+ onCancelTap_: function() {
+ this.$.dialog.cancel();
+ },
+
+ /** @private */
+ onInput_: function() {
+ const input = this.$.addUserInput.value;
+ this.isEmail_ = NAME_ONLY_REGEX.test(input) || EMAIL_REGEX.test(input);
+ this.isEmpty_ = input.length == 0;
+ },
+
+ /**
+ * @private
+ * @return {boolean}
+ */
+ shouldShowError_: function() {
+ return !this.isEmail_ && !this.isEmpty_;
+ },
});
})();
diff --git a/chromium/chrome/browser/resources/settings/people_page/users_page.html b/chromium/chrome/browser/resources/settings/people_page/users_page.html
index fbf44a44520..afdbbe7dfbc 100644
--- a/chromium/chrome/browser/resources/settings/people_page/users_page.html
+++ b/chromium/chrome/browser/resources/settings/people_page/users_page.html
@@ -1,7 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/html/action_link.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/action_link_css.html">
+<link rel="import" href="chrome://resources/html/action_link.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
@@ -19,7 +20,11 @@
#add-user-button {
/* Add user button must be lined up with the start of users' names. */
- margin-inline-start: var(--settings-box-row-indent);
+ margin-inline-start: var(--cr-section-indent-padding);
+ }
+
+ #add-user-button a {
+ outline: none;
}
.block {
diff --git a/chromium/chrome/browser/resources/settings/plugin_vm_page/BUILD.gn b/chromium/chrome/browser/resources/settings/plugin_vm_page/BUILD.gn
new file mode 100644
index 00000000000..d414bf60d79
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/plugin_vm_page/BUILD.gn
@@ -0,0 +1,28 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":plugin_vm_page",
+ ":plugin_vm_subpage",
+ ]
+}
+
+js_library("plugin_vm_page") {
+ deps = [
+ "..:route",
+ "../prefs:prefs_behavior",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+ externs_list = [ "$externs_path/settings_private.js" ]
+}
+
+js_library("plugin_vm_subpage") {
+ deps = [
+ "..:route",
+ "../prefs:prefs_behavior",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_page.html b/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_page.html
new file mode 100644
index 00000000000..458779025af
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_page.html
@@ -0,0 +1,36 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
+<link rel="import" href="chrome://resources/html/i18n_behavior.html">
+<link rel="import" href="../i18n_setup.html">
+<link rel="import" href="../settings_page/settings_animated_pages.html">
+<link rel="import" href="../settings_page/settings_subpage.html">
+<link rel="import" href="../settings_shared_css.html">
+<link rel="import" href="plugin_vm_subpage.html">
+
+<dom-module id="settings-plugin-vm-page">
+ <template>
+ <style include="settings-shared"></style>
+
+ <settings-animated-pages id="pages" section="pluginVm"
+ focus-config="[[focusConfig_]]">
+ <div route-path="default">
+ <cr-link-row id="pluginVmRow"
+ label="$i18n{pluginVmPageLabel}"
+ sub-label="$i18n{pluginVmPageSubtext}"
+ on-click="onSubpageClick_"></cr-link-row>
+ </div>
+
+ <template is="dom-if" route-path="/pluginVm/details">
+ <settings-subpage
+ associated-control="[[$$('#pluginVmRow')]]"
+ page-title="$i18n{pluginVmPageLabel}">
+ <settings-plugin-vm-subpage prefs="{{prefs}}">
+ </settings-plugin-vm-subpage>
+ </settings-subpage>
+ </template>
+ </settings-animated-pages>
+
+ </template>
+ <script src="plugin_vm_page.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_page.js b/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_page.js
new file mode 100644
index 00000000000..476442ba0e4
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_page.js
@@ -0,0 +1,39 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview
+ * 'plugin-vm-page' is the settings page for Plugin VM.
+ */
+
+Polymer({
+ is: 'settings-plugin-vm-page',
+
+ behaviors: [PrefsBehavior],
+
+ properties: {
+ /** Preferences state. */
+ prefs: {
+ type: Object,
+ notify: true,
+ },
+
+ /** @private {!Map<string, string>} */
+ focusConfig_: {
+ type: Object,
+ value: function() {
+ const map = new Map();
+ if (settings.routes.PLUGIN_VM_DETAILS) {
+ map.set(settings.routes.PLUGIN_VM_DETAILS.path, '#pluginVmRow');
+ }
+ return map;
+ },
+ },
+ },
+
+ /** @private */
+ onSubpageClick_: function(event) {
+ settings.navigateTo(settings.routes.PLUGIN_VM_DETAILS);
+ },
+});
diff --git a/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_subpage.html b/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_subpage.html
new file mode 100644
index 00000000000..3da3e1d882a
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_subpage.html
@@ -0,0 +1,14 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="../settings_shared_css.html">
+<link rel="import" href="../controls/settings_toggle_button.html">
+
+<dom-module id="settings-plugin-vm-subpage">
+ <template>
+ <style include="settings-shared"></style>
+ <!-- TODO(timloh): Wire this up to a pref. -->
+ <settings-toggle-button label="$i18n{pluginVmPrinterAccess}">
+ </settings-toggle-button>
+ </template>
+ <script src="plugin_vm_subpage.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_subpage.js b/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_subpage.js
new file mode 100644
index 00000000000..b4f3423896f
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/plugin_vm_page/plugin_vm_subpage.js
@@ -0,0 +1,22 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview
+ * 'plugin-vm-subpage' is the settings subpage for managing Plugin VM.
+ */
+
+Polymer({
+ is: 'settings-plugin-vm-subpage',
+
+ behaviors: [PrefsBehavior],
+
+ properties: {
+ /** Preferences state. */
+ prefs: {
+ type: Object,
+ notify: true,
+ },
+ },
+});
diff --git a/chromium/chrome/browser/resources/settings/printing_page/BUILD.gn b/chromium/chrome/browser/resources/settings/printing_page/BUILD.gn
index 5452ef37925..98917e28d85 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/printing_page/BUILD.gn
@@ -9,12 +9,11 @@ js_type_check("closure_compile") {
":cloud_printers",
":cups_add_printer_dialog",
":cups_add_printer_dialog_elements",
- ":cups_add_printer_dialog_util",
":cups_edit_printer_dialog",
+ ":cups_printer_dialog_util",
":cups_printers",
":cups_printers_browser_proxy",
":cups_printers_list",
- ":cups_set_manufacturer_model_behavior",
":printing_browser_proxy",
":printing_page",
]
@@ -29,7 +28,6 @@ js_library("cloud_printers") {
js_library("cups_add_printer_dialog") {
deps = [
":cups_printers_browser_proxy",
- ":cups_set_manufacturer_model_behavior",
"//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:web_ui_listener_behavior",
]
@@ -41,7 +39,7 @@ js_library("cups_add_printer_dialog_elements") {
]
}
-js_library("cups_add_printer_dialog_util") {
+js_library("cups_printer_dialog_util") {
deps = [
"//ui/webui/resources/js:cr",
]
@@ -49,7 +47,6 @@ js_library("cups_add_printer_dialog_util") {
js_library("cups_edit_printer_dialog") {
deps = [
- ":cups_set_manufacturer_model_behavior",
"//ui/webui/resources/cr_elements:cr_scrollable_behavior",
]
}
@@ -81,12 +78,6 @@ js_library("cups_printers_list") {
]
}
-js_library("cups_set_manufacturer_model_behavior") {
- deps = [
- ":cups_printers_browser_proxy",
- ]
-}
-
js_library("printing_browser_proxy") {
deps = [
"//ui/webui/resources/js:cr",
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cloud_printers.html b/chromium/chrome/browser/resources/settings/printing_page/cloud_printers.html
index 803741b84f6..21bcb4b9989 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cloud_printers.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cloud_printers.html
@@ -1,6 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../settings_shared_css.html">
@@ -24,10 +24,8 @@
<div class="start">
$i18n{printingManageCloudPrintDevices}
</div>
- <paper-icon-button-light actionable class="icon-external">
- <button aria-label="$i18n{printingManageCloudPrintDevices}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button actionable class="icon-external"
+ aria-label="$i18n{printingManageCloudPrintDevices}"></cr-icon-button>
</a>
</template>
<script src="cloud_printers.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html b/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html
index 37bd6416109..c86857a7750 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html
@@ -8,10 +8,9 @@
<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="cups_add_printer_dialog_elements.html">
-<link rel="import" href="cups_add_printer_dialog_util.html">
+<link rel="import" href="cups_printer_dialog_util.html">
<link rel="import" href="cups_printer_shared_css.html">
<link rel="import" href="cups_printers_browser_proxy.html">
-<link rel="import" href="cups_set_manufacturer_model_behavior.html">
<dom-module id="add-printer-discovery-dialog">
<template>
@@ -42,7 +41,8 @@
<add-printer-list printers="[[discoveredPrinters]]"
selected-printer="{{selectedPrinter}}">
</add-printer-list>
- <div class="center" id="noPrinterMessage" hidden>
+ <div class="center" id="noPrinterMessage"
+ hidden="[[discoveredPrinters.length]]">
$i18n{noPrinterNearbyMessage}
</div>
<div id="searchSpinner" hidden="[[!discovering_]]">
@@ -186,15 +186,14 @@
value="{{activePrinter.ppdModel}}">
</cr-searchable-drop-down>
</div>
- <div class="settings-box two-line last">
+ <div class="settings-box two-line">
<cr-input class="browse-file-input" readonly value="[[newUserPPD_]]"
label="$i18n{selectDriver}" invalid="[[invalidPPD_]]"
error-message="$i18n{selectDriverErrorMessage}" tabindex="-1">
- <paper-button class="browse-button" on-click="onBrowseFile_"
- slot="suffix">
- $i18n{selectDriverButtonText}
- </paper-button>
</cr-input>
+ <paper-button class="browse-button" on-click="onBrowseFile_">
+ $i18n{selectDriverButtonText}
+ </paper-button>
</div>
</div>
<div slot="dialog-buttons">
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js b/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js
index 8864868e82f..0b92efad7c5 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js
@@ -111,7 +111,6 @@ Polymer({
onPrinterDiscoveryDone_: function() {
this.discovering_ = false;
this.$$('add-printer-list').style.maxHeight = kPrinterListFullHeight + 'px';
- this.$.noPrinterMessage.hidden = !!this.discoveredPrinters.length;
if (!this.discoveredPrinters.length) {
this.selectedPrinter = getEmptyPrinter_();
@@ -209,14 +208,109 @@ Polymer({
Polymer({
is: 'add-printer-manufacturer-model-dialog',
- behaviors: [
- SetManufacturerModelBehavior,
+ properties: {
+ /** @type {!CupsPrinterInfo} */
+ activePrinter: {
+ type: Object,
+ notify: true,
+ },
+
+ /** @type {?Array<string>} */
+ manufacturerList: Array,
+
+ /** @type {?Array<string>} */
+ modelList: Array,
+
+ /**
+ * Whether the user selected PPD file is valid.
+ * @private
+ */
+ invalidPPD_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /**
+ * The base name of a newly selected PPD file.
+ * @private
+ */
+ newUserPPD_: String,
+ },
+
+ observers: [
+ 'selectedManufacturerChanged_(activePrinter.ppdManufacturer)',
],
+ /** @override */
+ attached: function() {
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .getCupsPrinterManufacturersList()
+ .then(this.manufacturerListChanged_.bind(this));
+ },
+
close: function() {
this.$$('add-printer-dialog').close();
},
+ /**
+ * @param {string} manufacturer The manufacturer for which we are retrieving
+ * models.
+ * @private
+ */
+ selectedManufacturerChanged_: function(manufacturer) {
+ // Reset model if manufacturer is changed.
+ this.set('activePrinter.ppdModel', '');
+ this.modelList = [];
+ if (manufacturer && manufacturer.length != 0) {
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .getCupsPrinterModelsList(manufacturer)
+ .then(this.modelListChanged_.bind(this));
+ }
+ },
+
+ /**
+ * @param {!ManufacturersInfo} manufacturersInfo
+ * @private
+ */
+ manufacturerListChanged_: function(manufacturersInfo) {
+ if (!manufacturersInfo.success) {
+ return;
+ }
+ this.manufacturerList = manufacturersInfo.manufacturers;
+ if (this.activePrinter.ppdManufacturer.length != 0) {
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .getCupsPrinterModelsList(this.activePrinter.ppdManufacturer)
+ .then(this.modelListChanged_.bind(this));
+ }
+ },
+
+ /**
+ * @param {!ModelsInfo} modelsInfo
+ * @private
+ */
+ modelListChanged_: function(modelsInfo) {
+ if (modelsInfo.success) {
+ this.modelList = modelsInfo.models;
+ }
+ },
+
+ /** @private */
+ onBrowseFile_: function() {
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .getCupsPrinterPPDPath()
+ .then(this.printerPPDPathChanged_.bind(this));
+ },
+
+ /**
+ * @param {string} path The full path to the selected PPD file
+ * @private
+ */
+ printerPPDPathChanged_: function(path) {
+ this.set('activePrinter.printerPPDPath', path);
+ this.invalidPPD_ = !path;
+ this.newUserPPD_ = settings.printing.getBaseName(path);
+ },
+
/** @private */
onCancelTap_: function() {
this.close();
@@ -321,7 +415,8 @@ Polymer({
/** @override */
ready: function() {
- this.addWebUIListener('on-add-cups-printer', this.onAddPrinter_.bind(this));
+ this.addWebUIListener(
+ 'on-add-or-edit-cups-printer', this.onAddPrinter_.bind(this));
this.addWebUIListener(
'on-manually-add-discovered-printer',
this.onManuallyAddDiscoveredPrinter_.bind(this));
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_elements.html b/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_elements.html
index d90c4acfbcd..83e2e9000bd 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_elements.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_elements.html
@@ -30,10 +30,8 @@
<template>
<style include="settings-shared">
#dialog {
- --cr-dialog-body-container: {
- /* Force a bottom border regardless of scroll state. */
- border-bottom: 1px solid var(--paper-grey-300);
- };
+ /* Force a bottom border regardless of scroll state. */
+ --cr-dialog-body-border-bottom: 1px solid var(--paper-grey-300);
}
#dialog [slot=body] {
height: 350px;
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_util.html b/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_util.html
deleted file mode 100644
index c7d68b6bd61..00000000000
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_util.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="cups_add_printer_dialog_util.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html b/chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html
index 6c65e2919f7..e1e85f94591 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html
@@ -5,35 +5,30 @@
<link rel="import" href="chrome://resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="cups_add_printer_dialog_elements.html">
-<link rel="import" href="cups_add_printer_dialog_util.html">
+<link rel="import" href="cups_printer_dialog_util.html">
<link rel="import" href="cups_printer_shared_css.html">
<link rel="import" href="cups_printers_browser_proxy.html">
-<link rel="import" href="cups_set_manufacturer_model_behavior.html">
<dom-module id="settings-cups-edit-printer-dialog">
<template>
- <style include="cups-printer-shared">
- /* This is needed to line up the existing PDD text with cr-input.
- TODO(scottchen): move away from using .settings-box just for margin,
- and then remove this hacky alignment. */
- .last {
- align-items: start;
- flex-direction: column;
- }
- </style>
+ <style include="cups-printer-shared"> </style>
<add-printer-dialog>
<div slot="dialog-title">$i18n{editPrinterDialogTitle}</div>
<div slot="dialog-body" scrollable>
<div class="settings-box first two-line">
<cr-input class="printer-name-input" autofocus
- value="{{activePrinter.printerName}}"
+ id="printerName"
+ value="{{pendingPrinter_.printerName}}"
+ on-input="onPrinterInfoChange_"
label="$i18n{printerName}"
maxlength=64>
</cr-input>
</div>
<div class="settings-box two-line">
<cr-input label="$i18n{printerAddress}"
- value="{{activePrinter.printerAddress}}"
+ id="printerAddress"
+ on-input="onPrinterInfoChange_"
+ value="{{pendingPrinter_.printerAddress}}"
disabled="[[!networkProtocolActive_]]"
maxlength=128>
</cr-input>
@@ -43,7 +38,7 @@
<div id="printerProtocol" class="label">$i18n{printerProtocol}</div>
<div class="secondary">
<select class="md-select" aria-labelledby="printerProtocol"
- value="[[activePrinter.printerProtocol]]"
+ value="[[pendingPrinter_.printerProtocol]]"
on-change="onProtocolChange_"
disabled="[[!networkProtocolActive_]]">
<option value="ipp" disabled="[[!networkProtocolActive_]]">
@@ -75,44 +70,41 @@
</div>
</div>
<div class="settings-box two-line">
- <cr-input label="$i18n{printerQueue}"
- value="{{activePrinter.printerQueue}}"
+ <cr-input id="printerQueue" label="$i18n{printerQueue}"
+ value="{{pendingPrinter_.printerQueue}}"
+ on-input="onPrinterInfoChange_"
disabled="[[!networkProtocolActive_]]"
maxlength=64>
</cr-input>
</div>
<div class="settings-box two-line">
<cr-input label="$i18n{printerURI}" readonly
- value="[[getPrinterURI_(activePrinter)]]">
+ value="[[getPrinterURI_(pendingPrinter_)]]">
</cr-input>
</div>
<div class="settings-box two-line">
<cr-searchable-drop-down items="[[manufacturerList]]"
+ id="printerPPDManufacturer"
label="$i18n{printerManufacturer}"
- value="{{activePrinter.ppdManufacturer}}">
+ value="{{pendingPrinter_.ppdManufacturer}}">
</cr-searchable-drop-down>
</div>
<div class="settings-box two-line">
<cr-searchable-drop-down items="[[modelList]]"
+ id="printerPPDModel"
label="$i18n{printerModel}"
- value="{{activePrinter.ppdModel}}">
+ value="{{pendingPrinter_.ppdModel}}">
</cr-searchable-drop-down>
</div>
- <div class="settings-box two-line last">
+ <div class="settings-box two-line">
<cr-input class="browse-file-input" readonly tabindex="-1"
- value="[[newUserPPD_]]" label="$i18n{selectDriver}"
+ value="[[userPPD_]]" label="$i18n{selectDriver}"
error-message="$i18n{selectDriverErrorMessage}"
invalid="[[invalidPPD_]]">
- <paper-button class="browse-button" on-click="onBrowseFile_"
- slot="suffix">
- $i18n{selectDriverButtonText}
- </paper-button>
</cr-input>
- <template is="dom-if" if="[[existingUserPPDMessage_]]">
- <div class="secondary" id="existingUserPPD">
- [[existingUserPPDMessage_]]
- </div>
- </template>
+ <paper-button class="browse-button" on-click="onBrowseFile_">
+ $i18n{selectDriverButtonText}
+ </paper-button>
</div>
</div>
<div slot="dialog-buttons">
@@ -121,7 +113,8 @@
$i18n{cancel}
</paper-button>
<paper-button class="action-button" on-click="onSaveTap_"
- disabled="[[!canSavePrinter_(activePrinter.*)]]">
+ disabled="[[!canSavePrinter_(pendingPrinter_.*,
+ printerInfoChanged_)]]">
$i18n{editPrinterButtonText}
</paper-button>
</div>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.js b/chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.js
index 17d358cd202..cb0d4a227fc 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.js
@@ -12,52 +12,117 @@ Polymer({
behaviors: [
CrScrollableBehavior,
- SetManufacturerModelBehavior,
],
properties: {
/**
+ * The currently saved printer.
+ * @type {CupsPrinterInfo}
+ */
+ activePrinter: Object,
+
+ /**
+ * Printer that holds the modified changes to activePrinter and only
+ * applies these changes when the save button is clicked.
+ * @type {CupsPrinterInfo}
+ */
+ pendingPrinter_: Object,
+
+ /**
* If the printer needs to be re-configured.
* @private {boolean}
*/
- needsReconfigured_: Boolean,
+ needsReconfigured_: {
+ type: Boolean,
+ value: false,
+ },
/**
* The current PPD in use by the printer.
* @private
*/
- existingUserPPDMessage_: String,
+ userPPD_: String,
+
+
+ /**
+ * Tracks whether the dialog is fully initialized. This is required because
+ * the dialog isn't fully initialized until Model and Manufacturer are set.
+ * Allows us to ignore changes made to these fields until initialization is
+ * complete.
+ * @private
+ */
+ arePrinterFieldsInitialized_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /**
+ * If the printer info has changed since loading this dialog. This will
+ * only track the freeform input fields, since the other fields contain
+ * input selected from dropdown menus.
+ * @private
+ */
+ printerInfoChanged_: {
+ type: Boolean,
+ value: false,
+ },
networkProtocolActive_: {
type: Boolean,
- computed: 'isNetworkProtocol_(activePrinter.printerProtocol)',
+ computed: 'isNetworkProtocol_(pendingPrinter_.printerProtocol)',
+ },
+
+ /** @type {?Array<string>} */
+ manufacturerList: Array,
+
+ /** @type {?Array<string>} */
+ modelList: Array,
+
+ /**
+ * Whether the user selected PPD file is valid.
+ * @private
+ */
+ invalidPPD_: {
+ type: Boolean,
+ value: false,
},
+
+ /**
+ * The base name of a newly selected PPD file.
+ * @private
+ */
+ newUserPPD_: String,
},
observers: [
- 'printerInfoChanged_(activePrinter.*)',
+ 'printerPathChanged_(pendingPrinter_.*)',
+ 'selectedEditManufacturerChanged_(pendingPrinter_.ppdManufacturer)',
+ 'onModelChanged_(pendingPrinter_.ppdModel)',
],
/** @override */
attached: function() {
+ // Create a copy of activePrinter so that we can modify its fields.
+ this.pendingPrinter_ = /** @type{CupsPrinterInfo} */
+ (Object.assign({}, this.activePrinter));
settings.CupsPrintersBrowserProxyImpl.getInstance()
- .getPrinterPpdManufacturerAndModel(this.activePrinter.printerId)
+ .getPrinterPpdManufacturerAndModel(this.pendingPrinter_.printerId)
.then(
this.onGetPrinterPpdManufacturerAndModel_.bind(this),
this.onGetPrinterPpdManufacturerAndModelFailed_.bind(this));
- const basename = this.getBaseName(this.activePrinter.printerPPDPath);
- if (basename) {
- this.existingUserPPDMessage_ =
- loadTimeData.getStringF('currentPpdMessage', basename);
- }
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .getCupsPrinterManufacturersList()
+ .then(this.manufacturerListChanged_.bind(this));
+ this.userPPD_ =
+ settings.printing.getBaseName(this.pendingPrinter_.printerPPDPath);
},
/**
* @param {!{path: string, value: string}} change
* @private
*/
- printerInfoChanged_: function(change) {
- if (change.path != 'activePrinter.printerName') {
+ printerPathChanged_: function(change) {
+ if (change.path != 'pendingPrinter_.printerName') {
this.needsReconfigured_ = true;
}
},
@@ -67,7 +132,13 @@ Polymer({
* @private
*/
onProtocolChange_: function(event) {
- this.set('activePrinter.printerProtocol', event.target.value);
+ this.set('pendingPrinter_.printerProtocol', event.target.value);
+ this.onPrinterInfoChange_();
+ },
+
+ /** @private */
+ onPrinterInfoChange_: function() {
+ this.printerInfoChanged_ = true;
},
/** @private */
@@ -77,9 +148,10 @@ Polymer({
/** @private */
onSaveTap_: function() {
+ this.updateActivePrinter_();
if (this.needsReconfigured_) {
- settings.CupsPrintersBrowserProxyImpl.getInstance().addCupsPrinter(
- this.activePrinter);
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .reconfigureCupsPrinter(this.activePrinter);
} else {
settings.CupsPrintersBrowserProxyImpl.getInstance().updateCupsPrinter(
this.activePrinter.printerId, this.activePrinter.printerName);
@@ -113,8 +185,8 @@ Polymer({
* @private
*/
onGetPrinterPpdManufacturerAndModel_: function(info) {
- this.set('activePrinter.ppdManufacturer', info.ppdManufacturer);
- this.set('activePrinter.ppdModel', info.ppdModel);
+ this.set('pendingPrinter_.ppdManufacturer', info.ppdManufacturer);
+ this.set('pendingPrinter_.ppdModel', info.ppdModel);
// |needsReconfigured_| needs to reset to false after |ppdManufacturer| and
// |ppdModel| are initialized to their correct values.
@@ -143,9 +215,104 @@ Polymer({
* @private
*/
canSavePrinter_: function() {
- return settings.printing.isNameAndAddressValid(this.activePrinter) &&
+ return this.printerInfoChanged_ && this.isPrinterValid();
+ },
+
+ /**
+ * @param {string} manufacturer The manufacturer for which we are retrieving
+ * models.
+ * @private
+ */
+ selectedEditManufacturerChanged_: function(manufacturer) {
+ // Reset model if manufacturer is changed.
+ this.set('pendingPrinter_.ppdModel', '');
+ this.modelList = [];
+ if (!!manufacturer && manufacturer.length != 0) {
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .getCupsPrinterModelsList(manufacturer)
+ .then(this.modelListChanged_.bind(this));
+ }
+ },
+
+ /**
+ * Sets printerInfoChanged_ to true to show that the model has changed.
+ * @private
+ */
+ onModelChanged_: function() {
+ if (this.arePrinterFieldsInitialized_) {
+ this.printerInfoChanged_ = true;
+ }
+ },
+
+ /** @private */
+ onBrowseFile_: function() {
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .getCupsPrinterPPDPath()
+ .then(this.printerPPDPathChanged_.bind(this));
+ },
+
+ /**
+ * @param {!ManufacturersInfo} manufacturersInfo
+ * @private
+ */
+ manufacturerListChanged_: function(manufacturersInfo) {
+ if (!manufacturersInfo.success) {
+ return;
+ }
+ this.manufacturerList = manufacturersInfo.manufacturers;
+ if (this.pendingPrinter_.ppdManufacturer.length != 0) {
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .getCupsPrinterModelsList(this.pendingPrinter_.ppdManufacturer)
+ .then(this.modelListChanged_.bind(this));
+ }
+ },
+
+ /**
+ * @param {!ModelsInfo} modelsInfo
+ * @private
+ */
+ modelListChanged_: function(modelsInfo) {
+ if (modelsInfo.success) {
+ this.modelList = modelsInfo.models;
+ // ModelListChanged_ is the final step of initializing pendingPrinter.
+ this.arePrinterFieldsInitialized_ = true;
+ }
+ },
+
+ /**
+ * @param {string} path The full path to the selected PPD file
+ * @private
+ */
+ printerPPDPathChanged_: function(path) {
+ this.set('pendingPrinter_.printerPPDPath', path);
+ this.invalidPPD_ = !path;
+ if (!this.invalidPPD_) {
+ // A new valid PPD file should be treated as a saveable change.
+ this.onPrinterInfoChange_();
+ }
+ this.userPPD_ = settings.printing.getBaseName(path);
+ },
+
+ /*
+ * Returns true if the printer has valid name, address, and PPD.
+ * @return {boolean}
+ */
+ isPrinterValid: function() {
+ return settings.printing.isNameAndAddressValid(this.pendingPrinter_) &&
settings.printing.isPPDInfoValid(
- this.activePrinter.ppdManufacturer, this.activePrinter.ppdModel,
- this.activePrinter.printerPPDPath);
+ this.pendingPrinter_.ppdManufacturer, this.pendingPrinter_.ppdModel,
+ this.pendingPrinter_.printerPPDPath);
+ },
+
+ /*
+ * Helper function to copy over modified fields to activePrinter.
+ * @private
+ */
+ updateActivePrinter_: function() {
+ this.activePrinter =
+ /** @type{CupsPrinterInfo} */ (Object.assign({}, this.pendingPrinter_));
+ // Set ppdModel since there is an observer that clears ppdmodel's value when
+ // ppdManufacturer changes.
+ this.activePrinter.ppdModel = this.pendingPrinter_.ppdModel;
},
});
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial_proxy.html b/chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.html
index 5147b5e2ea8..061146b255c 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial_proxy.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.html
@@ -1,2 +1,2 @@
<link rel="import" href="chrome://resources/html/cr.html">
-<script src="email_interstitial_proxy.js"></script>
+<script src="cups_printer_dialog_util.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_util.js b/chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.js
index cf9a0b60d78..d448aa64f05 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog_util.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.js
@@ -84,9 +84,22 @@ cr.define('settings.printing', function() {
return !!((manufacturer && model) || ppdPath);
}
+ /**
+ * Returns the base name of a filepath.
+ * @param {string} path The full path of the file
+ * @return {string} The base name of the file
+ */
+ function getBaseName(path) {
+ if (path && path.length > 0) {
+ return path.substring(path.lastIndexOf('/') + 1);
+ }
+ return '';
+ }
+
return {
isNetworkProtocol: isNetworkProtocol,
isNameAndAddressValid: isNameAndAddressValid,
isPPDInfoValid: isPPDInfoValid,
+ getBaseName: getBaseName,
};
});
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printer_shared_css.html b/chromium/chrome/browser/resources/settings/printing_page/cups_printer_shared_css.html
index 8b3f8c47bb3..50398e008d4 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printer_shared_css.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printer_shared_css.html
@@ -3,7 +3,6 @@
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="../settings_shared_css.html">
-<link rel="import" href="../settings_vars_css.html">
<!-- Common styles for CUPS printer settings. -->
<dom-module id="cups-printer-shared">
@@ -47,7 +46,8 @@
}
[slot='dialog-body'] .settings-box .browse-button {
- margin-inline-start: 5px;
+ margin-bottom: 8px;
+ margin-inline-start: 12px;
}
[slot='dialog-body'] .last {
@@ -78,7 +78,7 @@
padding: 0 24px;
text-align: start;
width: 100%;
- @apply --settings-actionable;
+ @apply --cr-actionable;
}
.list-item:focus {
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers.js b/chromium/chrome/browser/resources/settings/printing_page/cups_printers.js
index bf87461ea9b..19a7fe7fe32 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printers.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers.js
@@ -61,7 +61,8 @@ Polymer({
/** @override */
attached: function() {
- this.addWebUIListener('on-add-cups-printer', this.onAddPrinter_.bind(this));
+ this.addWebUIListener('on-add-or-edit-cups-printer',
+ this.onAddOrEditPrinter_.bind(this));
this.addWebUIListener(
'on-printers-changed', this.printersChanged_.bind(this));
this.networksChangedListener_ = this.refreshNetworks_.bind(this);
@@ -106,53 +107,59 @@ Polymer({
* @param {string} printerName
* @private
*/
- onAddPrinter_: function(result_code, printerName) {
- if (result_code == PrinterSetupResult.SUCCESS) {
- this.updateCupsPrintersList_();
- this.addPrinterResultText_ =
- loadTimeData.getStringF('printerAddedSuccessfulMessage', printerName);
- } else {
- switch (result_code) {
- case PrinterSetupResult.FATAL_ERROR:
- this.addPrinterResultText_ =
- loadTimeData.getString('printerAddedFatalErrorMessage');
- break;
- case PrinterSetupResult.PRINTER_UNREACHABLE:
- this.addPrinterResultText_ =
- loadTimeData.getString('printerAddedUnreachableMessage');
- break;
- case PrinterSetupResult.DBUS_ERROR:
- // Simply display a generic error message as this error should only
- // occur when a call to Dbus fails which isn't meaningful to the user.
- this.addPrinterResultText_ =
- loadTimeData.getString('printerAddedFailedmMessage');
- break;
- case PrinterSetupResult.NATIVE_PRINTERS_NOT_ALLOWED:
- this.addPrinterResultText_ = loadTimeData.getString(
- 'printerAddedNativePrintersNotAllowedMessage');
- break;
- case PrinterSetupResult.INVALID_PRINTER_UPDATE:
- this.addPrinterResultText_ =
- loadTimeData.getString('editPrinterInvalidPrinterUpdate');
- break;
- case PrinterSetupResult.PPD_TOO_LARGE:
- this.addPrinterResultText_ =
- loadTimeData.getString('printerAddedPpdTooLargeMessage');
- break;
- case PrinterSetupResult.INVALID_PPD:
- this.addPrinterResultText_ =
- loadTimeData.getString('printerAddedInvalidPpdMessage');
- break;
- case PrinterSetupResult.PPD_NOT_FOUND:
- this.addPrinterResultText_ =
- loadTimeData.getString('printerAddedPpdNotFoundMessage');
- break;
- case PrinterSetupResult.PPD_UNRETRIEVABLE:
- this.addPrinterResultText_ =
- loadTimeData.getString('printerAddedPpdUnretrievableMessage');
- break;
+ onAddOrEditPrinter_: function(result_code, printerName) {
+ switch (result_code) {
+ case PrinterSetupResult.SUCCESS:
+ this.updateCupsPrintersList_();
+ this.addPrinterResultText_ =
+ loadTimeData.getStringF('printerAddedSuccessfulMessage',
+ printerName);
+ break;
+ case PrinterSetupResult.EDIT_SUCCESS:
+ this.updateCupsPrintersList_();
+ this.addPrinterResultText_ =
+ loadTimeData.getStringF('printerEditedSuccessfulMessage',
+ printerName);
+ break;
+ case PrinterSetupResult.FATAL_ERROR:
+ this.addPrinterResultText_ =
+ loadTimeData.getString('printerAddedFatalErrorMessage');
+ break;
+ case PrinterSetupResult.PRINTER_UNREACHABLE:
+ this.addPrinterResultText_ =
+ loadTimeData.getString('printerAddedUnreachableMessage');
+ break;
+ case PrinterSetupResult.DBUS_ERROR:
+ // Simply display a generic error message as this error should only
+ // occur when a call to Dbus fails which isn't meaningful to the user.
+ this.addPrinterResultText_ =
+ loadTimeData.getString('printerAddedFailedMessage');
+ break;
+ case PrinterSetupResult.NATIVE_PRINTERS_NOT_ALLOWED:
+ this.addPrinterResultText_ = loadTimeData.getString(
+ 'printerAddedNativePrintersNotAllowedMessage');
+ break;
+ case PrinterSetupResult.INVALID_PRINTER_UPDATE:
+ this.addPrinterResultText_ =
+ loadTimeData.getString('editPrinterInvalidPrinterUpdate');
+ break;
+ case PrinterSetupResult.PPD_TOO_LARGE:
+ this.addPrinterResultText_ =
+ loadTimeData.getString('printerAddedPpdTooLargeMessage');
+ break;
+ case PrinterSetupResult.INVALID_PPD:
+ this.addPrinterResultText_ =
+ loadTimeData.getString('printerAddedInvalidPpdMessage');
+ break;
+ case PrinterSetupResult.PPD_NOT_FOUND:
+ this.addPrinterResultText_ =
+ loadTimeData.getString('printerAddedPpdNotFoundMessage');
+ break;
+ case PrinterSetupResult.PPD_UNRETRIEVABLE:
+ this.addPrinterResultText_ =
+ loadTimeData.getString('printerAddedPpdUnretrievableMessage');
+ break;
}
- }
this.$.errorToast.show();
},
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_browser_proxy.js b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_browser_proxy.js
index 5963d59e048..d083e828df6 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_browser_proxy.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_browser_proxy.js
@@ -92,6 +92,8 @@ const PrinterSetupResult = {
DBUS_ERROR: 3,
NATIVE_PRINTERS_NOT_ALLOWED: 4,
INVALID_PRINTER_UPDATE: 5,
+ COMPONENT_UNAVAILAVLE: 6,
+ EDIT_SUCCESS: 7,
PPD_TOO_LARGE: 10,
INVALID_PPD: 11,
PPD_NOT_FOUND: 12,
@@ -137,6 +139,11 @@ cr.define('settings', function() {
*/
addCupsPrinter(newPrinter) {}
+ /**
+ * @param {!CupsPrinterInfo} printer
+ */
+ reconfigureCupsPrinter(printer) {}
+
startDiscoveringPrinters() {}
stopDiscoveringPrinters() {}
@@ -200,6 +207,11 @@ cr.define('settings', function() {
}
/** @override */
+ reconfigureCupsPrinter(printer) {
+ chrome.send('reconfigureCupsPrinter', [printer]);
+ }
+
+ /** @override */
getCupsPrinterPPDPath() {
return cr.sendWithPromise('selectPPDFile');
}
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_list.html b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_list.html
index d303fa05f9d..c6f1c093516 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_list.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_list.html
@@ -1,8 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="cups_printers_browser_proxy.html">
<link rel="import" href="../settings_shared_css.html">
@@ -28,10 +28,8 @@
<div class="list-item">
<div class="printer-name text-elide">[[item.printerName]]</div>
<!--TODO(xdai): Add icon for enterprise CUPS printer. -->
- <paper-icon-button-light class="icon-more-vert">
- <button on-click="onOpenActionMenuTap_" title="$i18n{moreActions}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" on-click="onOpenActionMenuTap_"
+ title="$i18n{moreActions}"></cr-icon-button>
</div>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_set_manufacturer_model_behavior.html b/chromium/chrome/browser/resources/settings/printing_page/cups_set_manufacturer_model_behavior.html
deleted file mode 100644
index d7e49857795..00000000000
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_set_manufacturer_model_behavior.html
+++ /dev/null
@@ -1 +0,0 @@
-<script src="cups_set_manufacturer_model_behavior.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_set_manufacturer_model_behavior.js b/chromium/chrome/browser/resources/settings/printing_page/cups_set_manufacturer_model_behavior.js
deleted file mode 100644
index 9b9355fbcef..00000000000
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_set_manufacturer_model_behavior.js
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview SetManufacturerModelBehavior for selecting manufacturer and
- * model from the available lists for a printer.
- */
-
-/** @polymerBehavior */
-const SetManufacturerModelBehavior = {
- properties: {
- /** @type {!CupsPrinterInfo} */
- activePrinter: {
- type: Object,
- notify: true,
- },
-
- /** @type {?Array<string>} */
- manufacturerList: Array,
-
- /** @type {?Array<string>} */
- modelList: Array,
-
- /**
- * Whether the user selected PPD file is valid.
- * @private
- */
- invalidPPD_: {
- type: Boolean,
- value: false,
- },
-
- /**
- * The base name of a newly selected PPD file.
- * @private
- */
- newUserPPD_: String,
- },
-
- observers: [
- 'selectedManufacturerChanged_(activePrinter.ppdManufacturer)',
- ],
-
- /** @override */
- attached: function() {
- settings.CupsPrintersBrowserProxyImpl.getInstance()
- .getCupsPrinterManufacturersList()
- .then(this.manufacturerListChanged_.bind(this));
- },
-
- /**
- * @param {string} path The full path of the file
- * @return {string} The base name of the file
- * @public
- */
- getBaseName: function(path) {
- if (path && path.length > 0) {
- return path.substring(path.lastIndexOf('/') + 1);
- } else {
- return '';
- }
- },
-
- /**
- * @param {string} manufacturer The manufacturer for which we are retrieving
- * models.
- * @private
- */
- selectedManufacturerChanged_: function(manufacturer) {
- // Reset model if manufacturer is changed.
- this.set('activePrinter.ppdModel', '');
- this.modelList = [];
- if (!!manufacturer && manufacturer.length != 0) {
- settings.CupsPrintersBrowserProxyImpl.getInstance()
- .getCupsPrinterModelsList(manufacturer)
- .then(this.modelListChanged_.bind(this));
- }
- },
-
- /** @private */
- onBrowseFile_: function() {
- settings.CupsPrintersBrowserProxyImpl.getInstance()
- .getCupsPrinterPPDPath()
- .then(this.printerPPDPathChanged_.bind(this));
- },
-
- /**
- * @param {!ManufacturersInfo} manufacturersInfo
- * @private
- */
- manufacturerListChanged_: function(manufacturersInfo) {
- if (!manufacturersInfo.success) {
- return;
- }
- this.manufacturerList = manufacturersInfo.manufacturers;
- if (this.activePrinter.ppdManufacturer.length != 0) {
- settings.CupsPrintersBrowserProxyImpl.getInstance()
- .getCupsPrinterModelsList(this.activePrinter.ppdManufacturer)
- .then(this.modelListChanged_.bind(this));
- }
- },
-
- /**
- * @param {!ModelsInfo} modelsInfo
- * @private
- */
- modelListChanged_: function(modelsInfo) {
- if (modelsInfo.success) {
- this.modelList = modelsInfo.models;
- }
- },
-
- /**
- * @param {string} path The full path to the selected PPD file
- * @private
- */
- printerPPDPathChanged_: function(path) {
- this.set('activePrinter.printerPPDPath', path);
- this.invalidPPD_ = !path;
- this.newUserPPD_ = this.getBaseName(path);
- },
-};
diff --git a/chromium/chrome/browser/resources/settings/printing_page/printing_page.html b/chromium/chrome/browser/resources/settings/printing_page/printing_page.html
index b989628ae0e..3d892798674 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/printing_page.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/printing_page.html
@@ -1,6 +1,5 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="cloud_printers.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_page/settings_animated_pages.html">
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/BUILD.gn b/chromium/chrome/browser/resources/settings/privacy_page/BUILD.gn
index 23ba36da4d9..3077a5790ae 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/privacy_page/BUILD.gn
@@ -9,6 +9,9 @@ js_type_check("closure_compile") {
":personalization_options",
":privacy_page",
":privacy_page_browser_proxy",
+ ":security_keys_reset_dialog",
+ ":security_keys_set_pin_dialog",
+ ":security_keys_subpage",
]
}
@@ -19,6 +22,7 @@ js_library("personalization_options") {
"..:route",
"../controls:settings_toggle_button",
"../people_page:sync_browser_proxy",
+ "../prefs:prefs_behavior",
"//ui/webui/resources/js:web_ui_listener_behavior",
]
externs_list = [ "$externs_path/settings_private.js" ]
@@ -50,3 +54,36 @@ js_library("privacy_page") {
]
externs_list = [ "$externs_path/settings_private.js" ]
}
+
+js_library("security_keys_browser_proxy") {
+ deps = [
+ "//ui/webui/resources/js:cr",
+ ]
+ externs_list = [ "$externs_path/chrome_send.js" ]
+}
+
+js_library("security_keys_subpage") {
+ deps = [
+ ":security_keys_browser_proxy",
+ "..:route",
+ "../settings_page:settings_animated_pages",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+ externs_list = [ "$externs_path/settings_private.js" ]
+}
+
+js_library("security_keys_set_pin_dialog") {
+ deps = [
+ ":security_keys_browser_proxy",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+ externs_list = [ "$externs_path/settings_private.js" ]
+}
+
+js_library("security_keys_reset_dialog") {
+ deps = [
+ ":security_keys_browser_proxy",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+ externs_list = [ "$externs_path/settings_private.js" ]
+}
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.html b/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.html
index 13d16bb8ac0..7efe994e239 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.html
+++ b/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.html
@@ -6,6 +6,7 @@
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../lifetime_browser_proxy.html">
<link rel="import" href="../people_page/sync_browser_proxy.html">
+<link rel="import" href="../prefs/prefs_behavior.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="privacy_page_browser_proxy.html">
@@ -78,6 +79,7 @@
<if expr="_google_chrome">
<settings-toggle-button id="spellCheckControl"
pref="{{prefs.spellcheck.use_spelling_service}}"
+ on-settings-boolean-control-change="onUseSpellingServiceToggle_"
label="$i18n{spellingPref}"
sub-label="$i18n{spellingDescription}"
hidden="[[!showSpellCheckControl_(prefs.spellcheck.dictionaries)]]">
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.js b/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.js
index c6ffda16256..f3a7ad0b10b 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.js
+++ b/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.js
@@ -13,6 +13,7 @@ Polymer({
is: 'settings-personalization-options',
behaviors: [
+ PrefsBehavior,
WebUIListenerBehavior,
],
@@ -107,6 +108,20 @@ Polymer({
},
// </if>
+ // <if expr="_google_chrome">
+ /**
+ * @param {!Event} event
+ * @private
+ */
+ onUseSpellingServiceToggle_: function(event) {
+ // If turning on using the spelling service, automatically turn on
+ // spellcheck so that the spelling service can run.
+ if (event.target.checked) {
+ this.setPrefValue('browser.enable_spellchecking', true);
+ }
+ },
+ // </if>
+
/**
* @return {boolean}
* @private
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.html
index 750900dfc67..f1da2b75b06 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.html
+++ b/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.html
@@ -1,12 +1,14 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
+<link rel="import" href="security_keys_subpage.html">
<link rel="import" href="../clear_browsing_data_dialog/clear_browsing_data_dialog.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../lifetime_browser_proxy.html">
@@ -135,57 +137,34 @@
</settings-toggle-button>
</if>
<if expr="use_nss_certs or is_win or is_macosx">
- <div id="manageCertificates" class="settings-box two-line"
- actionable on-click="onManageCertificatesTap_">
- <div class="start">
- $i18n{manageCertificates}
- <div class="secondary" id="manageCertificatesSecondary">
- $i18n{manageCertificatesDescription}
- </div>
- </div>
-<if expr="use_nss_certs">
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{manageCertificates}"
- aria-describedby="manageCertificatesSecondary"></button>
- </paper-icon-button-light>
-</if>
+ <cr-link-row id="manageCertificates"
+ class="hr"
<if expr="not use_nss_certs">
- <paper-icon-button-light class="icon-external">
- <button aria-label="$i18n{manageCertificates}"
- aria-describedby="manageCertificatesSecondary"></button>
- </paper-icon-button-light>
+ external
</if>
- </div>
+ label="$i18n{manageCertificates}"
+ sub-label="$i18n{manageCertificatesDescription}"
+ on-click="onManageCertificatesTap_"></cr-link-row>
</if>
- <div id="site-settings-subpage-trigger"
- class="settings-box two-line" actionable
- on-click="onSiteSettingsTap_">
- <div class="start">
- [[siteSettingsPageTitle_()]]
- <div class="secondary" id="siteSettingsSecondary">
- $i18n{siteSettingsDescription}
- </div>
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label$="[[siteSettingsPageTitle_()]]"
- aria-describedby="siteSettingsSecondary"></button>
- </paper-icon-button-light>
- </div>
- <div class="settings-box two-line" id="clearBrowsingData"
- on-click="onClearBrowsingDataTap_" actionable>
- <div class="start">
- $i18n{clearBrowsingData}
- <div class="secondary" id="clearBrowsingDataSecondary">
- $i18n{clearBrowsingDataDescription}
- </div>
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button id="clearBrowsingDataTrigger"
- aria-label="$i18n{clearBrowsingData}"
- aria-describedby="clearBrowsingDataSecondary"></button>
- </paper-icon-button-light>
- </div>
+ <template is="dom-if" if="[[enableSecurityKeysSubpage_]]">
+ <cr-link-row id="security-keys-subpage-trigger"
+ class="hr"
+ label="$i18n{securityKeysTitle}"
+ sub-label="$i18n{securityKeysDesc}"
+ on-click="onSecurityKeysTap_"></cr-link-row>
+ </template>
+ <cr-link-row id="site-settings-subpage-trigger"
+ class="hr"
+ label="[[siteSettingsPageTitle_()]]"
+ sub-label="$i18n{siteSettingsDescription}"
+ on-click="onSiteSettingsTap_"></cr-link-row>
+ <cr-link-row id="clearBrowsingData"
+ class="hr"
+ label="$i18n{clearBrowsingData}"
+ sub-label="$i18n{clearBrowsingDataDescription}"
+ on-click="onClearBrowsingDataTap_"></cr-link-row>
</div>
+
<if expr="use_nss_certs">
<template is="dom-if" route-path="/certificates">
<settings-subpage
@@ -195,6 +174,17 @@
</settings-subpage>
</template>
</if>
+
+ <template is="dom-if" if="[[enableSecurityKeysSubpage_]]">
+ <template is="dom-if" route-path="/securityKeys">
+ <settings-subpage
+ associated-control="[[$$('#security-keys-subpage-trigger')]]"
+ page-title="$i18n{securityKeysTitle}">
+ <security-keys-subpage></security-keys-subpage>
+ </settings-subpage>
+ </template>
+ </template>
+
<template is="dom-if" route-path="/content">
<settings-subpage
associated-control="[[$$('#site-settings-subpage-trigger')]]"
@@ -278,15 +268,9 @@
label="$i18n{thirdPartyCookie}"
sub-label="$i18n{thirdPartyCookieSublabel}">
</settings-toggle-button>
- <div id="site-data-trigger" class="settings-box" actionable
- on-click="onSiteDataTap_">
- <div class="start" id="cookiesLink">
- $i18n{siteSettingsCookieLink}
- </div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-labelledby="cookiesLink"></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row id="site-data-trigger" class="hr"
+ on-click="onSiteDataTap_" label="$i18n{siteSettingsCookieLink}">
+ </cr-link-row>
<category-setting-exceptions
category="{{ContentSettingsTypes.COOKIES}}"
block-header="$i18n{siteSettingsBlock}"
@@ -462,9 +446,8 @@
target="_blank"
href="https://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html">
<div class="start">$i18n{adobeFlashStorage}</div>
- <paper-icon-button-light actionable class="icon-external">
- <button aria-label="$i18n{adobeFlashStorage}"></button>
- </paper-icon-button-light>
+ <cr-icon-button actionable class="icon-external"
+ aria-label="$i18n{adobeFlashStorage}"></cr-icon-button>
</a>
</if>
<category-setting-exceptions
@@ -557,6 +540,22 @@
</chooser-exception-list>
</settings-subpage>
</template>
+ <template is="dom-if" if="[[enableExperimentalWebPlatformFeatures_]]">
+ <template is="dom-if" route-path="/content/serialPorts" no-search>
+ <settings-subpage page-title="$i18n{siteSettingsSerialPorts}">
+ <category-default-setting
+ toggle-off-label="$i18n{siteSettingsSerialPortsBlock}"
+ toggle-on-label=
+ "$i18n{siteSettingsSerialPortsAskRecommended}"
+ category="{{ContentSettingsTypes.SERIAL_PORTS}}">
+ </category-default-setting>
+ <chooser-exception-list
+ category="{{ContentSettingsTypes.SERIAL_PORTS}}"
+ chooser-type="{{ChooserType.SERIAL_PORTS}}">
+ </chooser-exception-list>
+ </settings-subpage>
+ </template>
+ </template>
<template is="dom-if" route-path="/content/siteDetails" no-search>
<settings-subpage page-title="[[pageTitle]]">
<site-details
@@ -613,23 +612,21 @@
</if>
</settings-subpage>
</template>
- <template is="dom-if" if="[[enableClipboardContentSetting_]]">
- <template is="dom-if" route-path="/content/clipboard" no-search>
- <settings-subpage page-title="$i18n{siteSettingsClipboard}"
- search-label="$i18n{siteSettingsAllSitesSearch}"
- search-term="{{searchFilter_}}">
- <category-default-setting
- toggle-off-label="$i18n{siteSettingsClipboardBlock}"
- toggle-on-label="$i18n{siteSettingsClipboardAskRecommended}"
- category="{{ContentSettingsTypes.CLIPBOARD}}">
- </category-default-setting>
- <category-setting-exceptions
- category="{{ContentSettingsTypes.CLIPBOARD}}"
- block-header="$i18n{siteSettingsBlock}"
- search-filter="[[searchFilter_]]">
- </category-setting-exceptions>
- </settings-subpage>
- </template>
+ <template is="dom-if" route-path="/content/clipboard" no-search>
+ <settings-subpage page-title="$i18n{siteSettingsClipboard}"
+ search-label="$i18n{siteSettingsAllSitesSearch}"
+ search-term="{{searchFilter_}}">
+ <category-default-setting
+ toggle-off-label="$i18n{siteSettingsClipboardBlock}"
+ toggle-on-label="$i18n{siteSettingsClipboardAskRecommended}"
+ category="{{ContentSettingsTypes.CLIPBOARD}}">
+ </category-default-setting>
+ <category-setting-exceptions
+ category="{{ContentSettingsTypes.CLIPBOARD}}"
+ block-header="$i18n{siteSettingsBlock}"
+ search-filter="[[searchFilter_]]">
+ </category-setting-exceptions>
+ </settings-subpage>
</template>
<template is="dom-if" if="[[enablePaymentHandlerContentSetting_]]">
<template is="dom-if" route-path="/content/paymentHandler" no-search>
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.js b/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.js
index 7b09438b559..4b22eae6a4d 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.js
+++ b/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.js
@@ -111,27 +111,36 @@ Polymer({
},
/** @private */
- enableClipboardContentSetting_: {
+ enablePaymentHandlerContentSetting_: {
type: Boolean,
value: function() {
- return loadTimeData.getBoolean('enableClipboardContentSetting');
+ return loadTimeData.getBoolean('enablePaymentHandlerContentSetting');
}
},
/** @private */
- enablePaymentHandlerContentSetting_: {
+ enableSensorsContentSetting_: {
type: Boolean,
+ readOnly: true,
value: function() {
- return loadTimeData.getBoolean('enablePaymentHandlerContentSetting');
+ return loadTimeData.getBoolean('enableSensorsContentSetting');
}
},
/** @private */
- enableSensorsContentSetting_: {
+ enableExperimentalWebPlatformFeatures_: {
+ type: Boolean,
+ value: function() {
+ return loadTimeData.getBoolean('enableExperimentalWebPlatformFeatures');
+ },
+ },
+
+ /** @private */
+ enableSecurityKeysSubpage_: {
type: Boolean,
readOnly: true,
value: function() {
- return loadTimeData.getBoolean('enableSensorsContentSetting');
+ return loadTimeData.getBoolean('enableSecurityKeysSubpage');
}
},
@@ -142,21 +151,25 @@ Polymer({
const map = new Map();
// <if expr="use_nss_certs">
if (settings.routes.CERTIFICATES) {
- map.set(
- settings.routes.CERTIFICATES.path,
- '#manageCertificates .subpage-arrow button');
+ map.set(settings.routes.CERTIFICATES.path, '#manageCertificates');
}
// </if>
if (settings.routes.SITE_SETTINGS) {
map.set(
settings.routes.SITE_SETTINGS.path,
- '#site-settings-subpage-trigger .subpage-arrow button');
+ '#site-settings-subpage-trigger');
}
if (settings.routes.SITE_SETTINGS_SITE_DATA) {
map.set(
settings.routes.SITE_SETTINGS_SITE_DATA.path,
- '#site-data-trigger .subpage-arrow button');
+ '#site-data-trigger');
+ }
+
+ if (settings.routes.SECURITY_KEYS) {
+ map.set(
+ settings.routes.SECURITY_KEYS.path,
+ '#security-keys-subpage-trigger');
}
return map;
},
@@ -165,7 +178,7 @@ Polymer({
/**
* This flag is used to conditionally show a set of sync UIs to the
* profiles that have been migrated to have a unified consent flow.
- * TODO(scottchen): In the future when all profiles are completely migrated,
+ * TODO(tangltom): In the future when all profiles are completely migrated,
* this should be removed, and UIs hidden behind it should become default.
* @private
*/
@@ -360,7 +373,12 @@ Polymer({
/** @private */
onDialogClosed_: function() {
settings.navigateTo(settings.routes.CLEAR_BROWSER_DATA.parent);
- cr.ui.focusWithoutInk(assert(this.$.clearBrowsingDataTrigger));
+ cr.ui.focusWithoutInk(assert(this.$.clearBrowsingData));
+ },
+
+ /** @private */
+ onSecurityKeysTap_: function() {
+ settings.navigateTo(settings.routes.SECURITY_KEYS);
},
/**
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_browser_proxy.html b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_browser_proxy.html
new file mode 100644
index 00000000000..a4a3f9871df
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_browser_proxy.html
@@ -0,0 +1 @@
+<script src="security_keys_browser_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_browser_proxy.js b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_browser_proxy.js
new file mode 100644
index 00000000000..1be440a7f7c
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_browser_proxy.js
@@ -0,0 +1,89 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.exportPath('settings');
+
+cr.define('settings', function() {
+ /** @interface */
+ class SecurityKeysBrowserProxy {
+ /**
+ * Starts a PIN set/change operation by flashing all security keys. Resolves
+ * with a pair of numbers. The first is one if the process has immediately
+ * completed (i.e. failed). In this case the second is a CTAP error code.
+ * Otherwise the process is ongoing and must be completed by calling
+ * |setPIN|. In this case the second number is either the number of tries
+ * remaining to correctly specify the current PIN, or else null to indicate
+ * that no PIN is currently set.
+ * @return {!Promise<Array<number>>}
+ */
+ startSetPIN() {}
+
+ /**
+ * Attempts a PIN set/change operation. Resolves with a pair of numbers
+ * whose meaning is the same as with |startSetPIN|. The first number will
+ * always be 1 to indicate that the process has completed and thus the
+ * second will be the CTAP error code.
+ * @return {!Promise<Array<number>>}
+ */
+ setPIN(oldPIN, newPIN) {}
+
+ /**
+ * Starts a reset operation by flashing all security keys and sending a
+ * reset command to the one that the user activates. Resolves with a CTAP
+ * error code.
+ * @return {!Promise<number>}
+ */
+ reset() {}
+
+ /**
+ * Waits for a reset operation to complete. Resolves with a CTAP error code.
+ * @return {!Promise<number>}
+ */
+ completeReset() {}
+
+ /**
+ * Cancel all outstanding operations.
+ */
+ close() {}
+ }
+
+ /**
+ * @implements {settings.SecurityKeysBrowserProxy}
+ */
+ class SecurityKeysBrowserProxyImpl {
+ /** @override */
+ startSetPIN() {
+ return cr.sendWithPromise('securityKeyStartSetPIN');
+ }
+
+ /** @override */
+ setPIN(oldPIN, newPIN) {
+ return cr.sendWithPromise('securityKeySetPIN', oldPIN, newPIN);
+ }
+
+ /** @override */
+ reset() {
+ return cr.sendWithPromise('securityKeyReset');
+ }
+
+ /** @override */
+ completeReset() {
+ return cr.sendWithPromise('securityKeyCompleteReset');
+ }
+
+ /** @override */
+ close() {
+ return chrome.send('securityKeyClose');
+ }
+ }
+
+ // The singleton instance_ is replaced with a test version of this wrapper
+ // during testing.
+ cr.addSingletonGetter(SecurityKeysBrowserProxyImpl);
+
+ return {
+ SecurityKeysBrowserProxy: SecurityKeysBrowserProxy,
+ SecurityKeysBrowserProxyImpl: SecurityKeysBrowserProxyImpl,
+ };
+});
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.html b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.html
new file mode 100644
index 00000000000..fdec7c89f13
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.html
@@ -0,0 +1,59 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
+<link rel="import" href="chrome://resources/html/i18n_behavior.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-pages/iron-pages.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html">
+<link rel="import" href="../i18n_setup.html">
+<link rel="import" href="../settings_shared_css.html">
+<link rel="import" href="security_keys_browser_proxy.html">
+
+<dom-module id="settings-security-keys-reset-dialog">
+ <template>
+ <style include="settings-shared">
+ paper-spinner-lite {
+ padding-bottom: 12px;
+ }
+ </style>
+ <cr-dialog id="dialog" close-text="$i18n{close}" ignore-popstate
+ on-close="closeDialog_">
+ <div slot="title">[[title_]]</div>
+ <div slot="body">
+ <iron-pages attr-for-selected="id" selected="[[shown_]]">
+ <div id="initial">
+ <p>$i18n{securityKeysResetStep1}</p>
+ <paper-spinner-lite active></paper-spinner-lite>
+ </div>
+
+ <div id="noReset">
+ <p>$i18n{securityKeysNoReset}</p>
+ </div>
+
+ <div id="resetFailed">
+ <p>[[resetFailed_(errorCode_)]]</p>
+ </div>
+
+ <div id="reset2">
+ <p>$i18n{securityKeysResetStep2}</p>
+ </div>
+
+ <div id="resetSuccess">
+ <p>$i18n{securityKeysResetSuccess}</p>
+ </div>
+
+ <div id="resetNotAllowed">
+ <p>$i18n{securityKeysResetNotAllowed}</p>
+ </div>
+ </iron-pages>
+ </div>
+ <div slot="button-container">
+ <paper-button id="button" class$="[[maybeActionButton_(complete_)]]"
+ on-click="closeDialog_">
+ [[closeText_(complete_)]]
+ </paper-button>
+ </div>
+ </cr-dialog>
+ </template>
+ <script src="security_keys_reset_dialog.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.js b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.js
new file mode 100644
index 00000000000..8d433ba840e
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_reset_dialog.js
@@ -0,0 +1,130 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview 'settings-security-keys-reset-dialog' is a dialog for
+ * triggering factory resets of security keys.
+ */
+Polymer({
+ is: 'settings-security-keys-reset-dialog',
+
+ behaviors: [I18nBehavior],
+
+ properties: {
+ /**
+ * A CTAP error code for when the specific error was not recognised.
+ * @private
+ */
+ errorCode_: Number,
+
+ /**
+ * True iff the process has completed, successfully or otherwise.
+ * @private
+ */
+ complete_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /**
+ * The id of an element on the page that is currently shown.
+ * @private
+ */
+ shown_: {
+ type: String,
+ value: 'initial',
+ },
+
+ /**
+ * @private
+ */
+ title_: String,
+ },
+
+ /** @private {?settings.SecurityKeysBrowserProxy} */
+ browserProxy_: null,
+
+ /** @override */
+ attached: function() {
+ this.title_ = this.i18n('securityKeysResetTitle');
+ this.browserProxy_ = settings.SecurityKeysBrowserProxyImpl.getInstance();
+ this.$.dialog.showModal();
+
+ this.browserProxy_.reset().then(code => {
+ // code is a CTAP error code. See
+ // https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-client-to-authenticator-protocol-v2.0-rd-20180702.html#error-responses
+ if (code == 1 /* INVALID_COMMAND */) {
+ this.shown_ = 'noReset';
+ this.finish_();
+ } else if (code != 0 /* unknown error */) {
+ this.errorCode_ = code;
+ this.shown_ = 'resetFailed';
+ this.finish_();
+ } else {
+ this.title_ = this.i18n('securityKeysResetConfirmTitle');
+ this.shown_ = 'reset2';
+ this.browserProxy_.completeReset().then(code => {
+ this.title_ = this.i18n('securityKeysResetTitle');
+ if (code == 0 /* SUCCESS */) {
+ this.shown_ = 'resetSuccess';
+ } else if (code == 48 /* NOT_ALLOWED */) {
+ this.shown_ = 'resetNotAllowed';
+ } else /* unknown error */ {
+ this.errorCode_ = code;
+ this.shown_ = 'resetFailed';
+ }
+ this.finish_();
+ });
+ }
+ });
+ },
+
+ /** @private */
+ closeDialog_: function() {
+ this.$.dialog.close();
+ this.finish_();
+ },
+
+ /** @private */
+ finish_: function() {
+ if (this.complete_) {
+ return;
+ }
+ this.complete_ = true;
+ this.browserProxy_.close();
+ },
+
+ /**
+ @param {number} code CTAP error code.
+ @return {string} Contents of the error string that may be displayed
+ to the user. Used automatically by Polymer.
+ @private
+ */
+ resetFailed_: function(code) {
+ if (code === null) {
+ return '';
+ }
+ return this.i18n('securityKeysResetError', code.toString());
+ },
+
+ /**
+ * @param {boolean} complete Whether the dialog process is complete.
+ * @return {string} The label of the dialog button. Used automatically by
+ * Polymer.
+ * @private
+ */
+ closeText_: function(complete) {
+ return this.i18n(complete ? 'ok' : 'cancel');
+ },
+
+ /**
+ * @param {boolean} complete Whether the dialog process is complete.
+ * @return {string} The class of the dialog button. Used automatically by
+ * Polymer.
+ * @private
+ */
+ maybeActionButton_: function(complete) {
+ return complete ? 'action-button' : 'cancel-button';
+ },
+});
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.html b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.html
new file mode 100644
index 00000000000..96abaa0724b
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.html
@@ -0,0 +1,107 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
+<link rel="import" href="chrome://resources/html/i18n_behavior.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-pages/iron-pages.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html">
+<link rel="import" href="../i18n_setup.html">
+<link rel="import" href="../settings_shared_css.html">
+<link rel="import" href="security_keys_browser_proxy.html">
+
+<dom-module id="settings-security-keys-set-pin-dialog">
+ <template>
+ <style include="settings-shared">
+ cr-input {
+ display: inline-block;
+ padding-inline-end: 2em;
+ --cr-input-width: 8em;
+ }
+
+ #newPINRow {
+ display: flex;
+ flex-direction: row;
+ }
+
+ paper-spinner-lite {
+ padding-bottom: 12px;
+ }
+ </style>
+
+ <cr-dialog id="dialog" close-text="$i18n{close}" ignore-popstate
+ on-close="closeDialog_">
+ <div slot="title">[[title_]]</div>
+ <div slot="body">
+ <iron-pages attr-for-selected="id" selected="[[shown_]]">
+ <div id="initial">
+ <p>$i18n{securityKeysPINTouch}</p>
+ <paper-spinner-lite active></paper-spinner-lite>
+ </div>
+
+ <div id="noPINSupport">
+ <p>$i18n{securityKeysNoPIN}</p>
+ </div>
+
+ <div id="pinPrompt">
+ <div id="currentPINEntry">
+ <p>$i18nRaw{securityKeysCurrentPINIntro}</p>
+
+ <cr-input id="currentPIN" value="{{currentPIN_}}" minLength="4"
+ maxLength="255" spellcheck="false"
+ on-input="validateCurrentPIN_" invalid="[[!currentPINValid_]]"
+ label="$i18n{securityKeysCurrentPIN}" tabindex="0"
+ type="password"
+ error-message="[[mismatchErrorText_(mismatchErrorVisible_, retries_)]]">
+ </cr-input>
+ </div>
+
+ <p>$i18n{securityKeysNewPIN}</p>
+
+ <div id="newPINRow">
+ <cr-input id="newPIN" value="{{newPIN_}}" minLength="4"
+ maxLength="255" spellcheck="false" on-input="validateNewPIN_"
+ invalid="[[!newPINValid_]]" label="$i18n{securityKeysPIN}"
+ tabindex="0" type="password"></cr-input>
+ <cr-input id="confirmPIN" value="{{confirmPIN_}}" minLength="4"
+ maxLength="255" spellcheck="false"
+ on-input="validateConfirmPIN_" invalid="[[!confirmPINValid_]]"
+ label="$i18n{securityKeysConfirmPIN}" tabindex="0"
+ type="password"></cr-input>
+ </div>
+ </div>
+
+ <div id="success">
+ <p>$i18n{securityKeysPINSuccess}</p>
+ </div>
+
+ <div id="error">
+ <p>[[pinFailed_(errorCode_)]]</p>
+ </div>
+
+ <div id="locked">
+ <p>$i18n{securityKeysPINHardLock}</p>
+ </div>
+
+ <div id="reinsert">
+ <p>$i18n{securityKeysPINSoftLock}</p>
+ </div>
+ </iron-pages>
+ </div>
+
+ <div slot="button-container">
+ <paper-button id="closeButton"
+ class$="[[maybeActionButton_(complete_)]]"
+ on-click="closeDialog_">
+ [[closeText_(complete_)]]
+ </paper-button>
+ <paper-button id="pinSubmit" class="action-button"
+ on-click="pinSubmitNew_" disabled="[[!setPINButtonValid_]]"
+ hidden="[[complete_]]">
+ $i18n{securityKeysSetPINConfirm}
+ </paper-button>
+ </div>
+ </cr-dialog>
+ </template>
+ <script src="security_keys_set_pin_dialog.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.js b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.js
new file mode 100644
index 00000000000..1ed18cea22b
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.js
@@ -0,0 +1,343 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+'use strict';
+
+/**
+ @param {string} pin A candidate PIN.
+ @return {boolean} Whether the parameter was a valid PIN.
+ @private
+ */
+function isValidPIN(pin) {
+ // The UTF-8 encoding of the PIN must be between 4 and 63 bytes, and the
+ // final byte cannot be zero.
+ const utf8Encoded = new TextEncoder().encode(pin);
+ if (utf8Encoded.length < 4 || utf8Encoded.length > 63 ||
+ utf8Encoded[utf8Encoded.length - 1] == 0) {
+ return false;
+ }
+
+ // A PIN must contain at least four code-points. Javascript strings are UCS-2
+ // and the |length| property counts UCS-2 elements, not code-points. (For
+ // example, '\u{1f6b4}'.length == 2, but it's a single code-point.) Therefore,
+ // iterate over the string (which does yield codepoints) and check that four
+ // or more were seen.
+ let length = 0;
+ for (const codepoint of pin) {
+ length++;
+ }
+
+ return length >= 4;
+}
+
+/**
+ * @fileoverview 'settings-security-keys-set-pin-dialog' is a dialog for
+ * setting and changing security key PINs.
+ */
+Polymer({
+ is: 'settings-security-keys-set-pin-dialog',
+
+ behaviors: [I18nBehavior],
+
+ properties: {
+ /**
+ * Whether the value of the current PIN textbox is a valid PIN or not.
+ * @private
+ */
+ currentPINValid_: Boolean,
+
+ /** @private */
+ newPINValid_: Boolean,
+
+ /** @private */
+ confirmPINValid_: Boolean,
+
+ /**
+ * Whether the dialog is in a state where the Set PIN button should be
+ * enabled. Read by Polymer.
+ * @private
+ */
+ setPINButtonValid_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /**
+ * The value of the new PIN textbox. Read/write by Polymer.
+ * @private
+ */
+ newPIN_: {
+ type: String,
+ value: '',
+ },
+
+ /** @private */
+ confirmPIN_: {
+ type: String,
+ value: '',
+ },
+
+ /** @private */
+ currentPIN_: {
+ type: String,
+ value: '',
+ },
+
+ /**
+ * The number of PIN attempts remaining.
+ * @private
+ */
+ retries_: Number,
+
+ /**
+ * A CTAP error code when we don't recognise the specific error. Read by
+ * Polymer.
+ * @private
+ */
+ errorCode_: Number,
+
+ /**
+ * Whether the error message indicating an incorrect PIN should be visible.
+ * @private
+ */
+ mismatchErrorVisible_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /**
+ * Whether the dialog process has completed, successfully or otherwise.
+ * @private
+ */
+ complete_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /**
+ * The id of an element on the page that is currently shown.
+ * @private
+ */
+ shown_: {
+ type: String,
+ value: 'initial',
+ },
+
+ /** @private */
+ title_: String,
+ },
+
+ /** @private {?settings.SecurityKeysBrowserProxy} */
+ browserProxy_: null,
+
+ /** @override */
+ attached: function() {
+ this.title_ = this.i18n('securityKeysSetPINInitialTitle');
+ this.browserProxy_ = settings.SecurityKeysBrowserProxyImpl.getInstance();
+ this.$.dialog.showModal();
+
+ this.browserProxy_.startSetPIN().then(result => {
+ if (result[0]) {
+ // Operation is complete. result[1] is a CTAP error code. See
+ // https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-client-to-authenticator-protocol-v2.0-rd-20180702.html#error-responses
+ if (result[1] == 1 /* INVALID_COMMAND */) {
+ this.shown_ = 'noPINSupport';
+ this.finish_();
+ } else if (result[1] == 52 /* temporarily locked */) {
+ this.shown_ = 'reinsert';
+ this.finish_();
+ } else if (result[1] == 50 /* locked */) {
+ this.shown_ = 'locked';
+ this.finish_();
+ } else {
+ this.errorCode_ = result[1];
+ this.shown_ = 'error';
+ this.finish_();
+ }
+ } else if (result[1] == 0) {
+ // A device can also signal that it is locked by returning zero retries.
+ this.shown_ = 'locked';
+ this.finish_();
+ } else {
+ // Need to prompt for a pin. Initially set the text boxes to valid so
+ // that they don't all appear red without the user typing anything.
+ this.currentPINValid_ = true;
+ this.newPINValid_ = true;
+ this.confirmPINValid_ = true;
+
+ this.retries_ = result[1];
+ // retries_ may be null to indicate that there is currently no PIN set.
+ let focusTarget;
+ if (this.retries_ === null) {
+ this.$.currentPINEntry.hidden = true;
+ focusTarget = this.$.newPIN;
+ this.title_ = this.i18n('securityKeysSetPINCreateTitle');
+ } else {
+ this.$.currentPINEntry.hidden = false;
+ focusTarget = this.$.currentPIN;
+ this.title_ = this.i18n('securityKeysSetPINChangeTitle');
+ }
+
+ this.shown_ = 'pinPrompt';
+ // Focus cannot be set directly from within a backend callback.
+ window.setTimeout(function() {
+ focusTarget.focus();
+ }, 0);
+ this.fire('ui-ready'); // for test synchronization.
+ }
+ });
+ },
+
+ /** @private */
+ closeDialog_: function() {
+ this.$.dialog.close();
+ this.finish_();
+ },
+
+ /** @private */
+ finish_: function() {
+ if (this.complete_) {
+ return;
+ }
+ this.complete_ = true;
+ this.browserProxy_.close();
+ },
+
+ /** @private */
+ updatePINButtonValid_: function() {
+ this.setPINButtonValid_ =
+ (this.$.currentPINEntry.hidden ||
+ (this.currentPINValid_ && this.currentPIN_.length > 0)) &&
+ this.newPINValid_ && this.newPIN_.length > 0 && this.confirmPINValid_ &&
+ this.confirmPIN_.length > 0;
+ },
+
+ /** @private */
+ validateCurrentPIN_: function() {
+ this.currentPINValid_ = isValidPIN(this.currentPIN_);
+ this.updatePINButtonValid_();
+ // Typing in the current PIN box after an error makes the error message
+ // disappear.
+ this.mismatchErrorVisible_ = false;
+ },
+
+ /** @private */
+ validateNewPIN_: function() {
+ this.newPINValid_ = isValidPIN(this.newPIN_);
+ // The new PIN might have been changed to match the confirmation PIN, thus
+ // changing it might make the confirmation PIN valid. An empty value is
+ // considered valid to stop it immediately turning red before the user has
+ // entered anything, but |updatePINButtonValid_| knows that it needs to be
+ // non-empty before the dialog can be submitted.
+ this.confirmPINValid_ = this.confirmPIN_.length == 0 ||
+ (this.newPINValid_ && this.confirmPIN_ == this.newPIN_);
+ this.updatePINButtonValid_();
+ },
+
+ /** @private */
+ validateConfirmPIN_: function() {
+ this.confirmPINValid_ = this.confirmPIN_ == this.newPIN_;
+ this.updatePINButtonValid_();
+ },
+
+ /**
+ * Called by Polymer when the Set PIN button is activated.
+ * @private
+ */
+ pinSubmitNew_: function() {
+ this.setPINButtonValid_ = false;
+ this.browserProxy_.setPIN(this.currentPIN_, this.newPIN_).then(result => {
+ // This call always completes the process so result[0] is always 1.
+ // result[1] is a CTAP2 error code. See
+ // https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-client-to-authenticator-protocol-v2.0-rd-20180702.html#error-responses
+ if (result[1] == 0 /* SUCCESS */) {
+ this.shown_ = 'success';
+ this.finish_();
+ } else if (result[1] == 52 /* temporarily locked */) {
+ this.shown_ = 'reinsert';
+ this.finish_();
+ } else if (result[1] == 50 /* locked */) {
+ this.shown_ = 'locked';
+ this.finish_();
+ } else if (result[1] == 49 /* PIN_INVALID */) {
+ this.currentPIN_ = '';
+ this.currentPINValid_ = false;
+ this.retries_--;
+ this.mismatchErrorVisible_ = true;
+
+ // Focus cannot be set directly from within a backend callback. Also,
+ // directly focusing |currentPIN| doesn't always seem to work(!). Thus
+ // focus something else first, which is a hack that seems to solve the
+ // problem.
+ const preFocusTarget = this.$.newPIN;
+ const focusTarget = this.$.currentPIN;
+ window.setTimeout(function() {
+ preFocusTarget.focus();
+ focusTarget.focus();
+ }, 0);
+ this.fire('ui-ready'); // for test synchronization.
+ } else {
+ // Unknown error.
+ this.errorCode_ = result[1];
+ this.shown_ = 'error';
+ this.finish_();
+ }
+ });
+ },
+
+ /**
+ * Called by Polymer when |errorCode_| changes to set the error string.
+ * @param {number} code A CTAP error code.
+ * @private
+ */
+ pinFailed_: function(code) {
+ if (code === null) {
+ return '';
+ }
+ return this.i18n('securityKeysPINError', code.toString());
+ },
+
+ /**
+ * Called by Polymer to set the error text displayed when the user enters an
+ * incorrect PIN.
+ * @param {boolean} show Whether or not an error message should be shown.
+ * @param {number} retries The number of PIN attempts remaining.
+ * @return {string} The message to show under the text box.
+ * @private
+ */
+ mismatchErrorText_: function(show, retries) {
+ if (!show) {
+ return '';
+ }
+
+ // Warn the user if the number of retries is getting low.
+ if (1 < retries && retries <= 3) {
+ return this.i18n('securityKeysPINIncorrectRetriesPl', retries.toString());
+ }
+ if (retries == 1) {
+ return this.i18n('securityKeysPINIncorrectRetriesSin');
+ }
+ return this.i18n('securityKeysPINIncorrect');
+ },
+
+ /**
+ * @param {boolean} complete Whether the dialog process is complete.
+ * @return {string} The class of the Ok / Cancel button.
+ * @private
+ */
+ maybeActionButton_: function(complete) {
+ return complete ? 'action-button' : 'cancel-button';
+ },
+
+ /**
+ * @param {boolean} complete Whether the dialog process is complete.
+ * @return {string} The label of the Ok / Cancel button.
+ * @private
+ */
+ closeText_: function(complete) {
+ return this.i18n(complete ? 'ok' : 'cancel');
+ },
+});
+})();
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_subpage.html b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_subpage.html
new file mode 100644
index 00000000000..496b5bf74d7
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_subpage.html
@@ -0,0 +1,39 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
+<link rel="import" href="chrome://resources/html/cr.html">
+<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
+<link rel="import" href="../settings_shared_css.html">
+
+<link rel="import" href="security_keys_set_pin_dialog.html">
+<link rel="import" href="security_keys_reset_dialog.html">
+
+<dom-module id="security-keys-subpage">
+ <template>
+ <style include="settings-shared"></style>
+
+ <cr-link-row
+ id="setPINButton"
+ label="$i18n{securityKeysSetPIN}"
+ sub-label="$i18n{securityKeysSetPINDesc}"
+ on-click="onSetPIN_"></cr-link-row>
+ <cr-link-row
+ id="resetButton"
+ class="hr"
+ label="$i18n{securityKeysReset}"
+ sub-label="$i18n{securityKeysResetDesc}"
+ on-click="onReset_"></cr-link-row>
+
+ <template is="dom-if" if="[[showSetPINDialog_]]" restamp>
+ <settings-security-keys-set-pin-dialog on-close="onSetPINDialogClosed_">
+ </settings-security-keys-set-pin-dialog>
+ </template>
+
+ <template is="dom-if" if="[[showResetDialog_]]" restamp>
+ <settings-security-keys-reset-dialog on-close="onResetDialogClosed_">
+ </settings-security-keys-reset-dialog>
+ </template>
+
+ </template>
+ <script src="security_keys_subpage.js"></script>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_subpage.js b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_subpage.js
new file mode 100644
index 00000000000..a27010d8480
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_subpage.js
@@ -0,0 +1,46 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview 'security-keys-subpage' is a settings subpage
+ * containing operations on security keys.
+ */
+Polymer({
+ is: 'security-keys-subpage',
+
+ properties: {
+ /** @private */
+ showSetPINDialog_: {
+ type: Boolean,
+ value: false,
+ },
+ /** @private */
+ showResetDialog_: {
+ type: Boolean,
+ value: false,
+ },
+ },
+
+ /** @private */
+ onSetPIN_: function() {
+ this.showSetPINDialog_ = true;
+ },
+
+ /** @private */
+ onSetPINDialogClosed_: function() {
+ this.showSetPINDialog_ = false;
+ cr.ui.focusWithoutInk(this.$.setPINButton);
+ },
+
+ /** @private */
+ onReset_: function() {
+ this.showResetDialog_ = true;
+ },
+
+ /** @private */
+ onResetDialogClosed_: function() {
+ this.showResetDialog_ = false;
+ cr.ui.focusWithoutInk(this.$.resetButton);
+ },
+});
diff --git a/chromium/chrome/browser/resources/settings/reset_page/reset_page.html b/chromium/chrome/browser/resources/settings/reset_page/reset_page.html
index 4ef6b28ae4d..b441f7bd43b 100644
--- a/chromium/chrome/browser/resources/settings/reset_page/reset_page.html
+++ b/chromium/chrome/browser/resources/settings/reset_page/reset_page.html
@@ -3,7 +3,6 @@
<link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="reset_profile_dialog.html">
<link rel="import" href="../route.html">
diff --git a/chromium/chrome/browser/resources/settings/route.js b/chromium/chrome/browser/resources/settings/route.js
index 337b8c13d19..b647462a8a1 100644
--- a/chromium/chrome/browser/resources/settings/route.js
+++ b/chromium/chrome/browser/resources/settings/route.js
@@ -17,6 +17,7 @@
* ANDROID_APPS_DETAILS: (undefined|!settings.Route),
* CROSTINI: (undefined|!settings.Route),
* CROSTINI_DETAILS: (undefined|!settings.Route),
+ * CROSTINI_EXPORT_IMPORT: (undefined|!settings.Route),
* CROSTINI_SHARED_PATHS: (undefined|!settings.Route),
* CROSTINI_SHARED_USB_DEVICES: (undefined|!settings.Route),
* APPEARANCE: (undefined|!settings.Route),
@@ -60,6 +61,8 @@
* PASSWORDS: (undefined|!settings.Route),
* PAYMENTS: (undefined|!settings.Route),
* PEOPLE: (undefined|!settings.Route),
+ * PLUGIN_VM: (undefined|!settings.Route),
+ * PLUGIN_VM_DETAILS: (undefined|!settings.Route),
* POINTERS: (undefined|!settings.Route),
* POWER: (undefined|!settings.Route),
* PRINTING: (undefined|!settings.Route),
@@ -68,6 +71,7 @@
* RESET_DIALOG: (undefined|!settings.Route),
* SEARCH: (undefined|!settings.Route),
* SEARCH_ENGINES: (undefined|!settings.Route),
+ * SECURITY_KEYS: (undefined|!settings.Route),
* SIGN_OUT: (undefined|!settings.Route),
* SITE_SETTINGS: (undefined|!settings.Route),
* SITE_SETTINGS_ADS: (undefined|!settings.Route),
@@ -96,6 +100,7 @@
* SITE_SETTINGS_SITE_DETAILS: (undefined|!settings.Route),
* SITE_SETTINGS_UNSANDBOXED_PLUGINS: (undefined|!settings.Route),
* SITE_SETTINGS_USB_DEVICES: (undefined|!settings.Route),
+ * SITE_SETTINGS_SERIAL_PORTS: (undefined|!settings.Route),
* SITE_SETTINGS_ZOOM_LEVELS: (undefined|!settings.Route),
* SMART_LOCK: (undefined|!settings.Route),
* SMB_SHARES: (undefined|!settings.Route),
@@ -276,10 +281,18 @@ cr.define('settings', function() {
loadTimeData.getBoolean('showCrostini')) {
r.CROSTINI = r.BASIC.createSection('/crostini', 'crostini');
r.CROSTINI_DETAILS = r.CROSTINI.createChild('/crostini/details');
+ r.CROSTINI_EXPORT_IMPORT =
+ r.CROSTINI.createChild('/crostini/exportImport');
r.CROSTINI_SHARED_PATHS = r.CROSTINI.createChild('/crostini/sharedPaths');
r.CROSTINI_SHARED_USB_DEVICES =
r.CROSTINI.createChild('/crostini/sharedUsbDevices');
}
+
+ if (loadTimeData.valueExists('showPluginVm') &&
+ loadTimeData.getBoolean('showPluginVm')) {
+ r.PLUGIN_VM = r.BASIC.createSection('/pluginVm', 'pluginVm');
+ r.PLUGIN_VM_DETAILS = r.PLUGIN_VM.createChild('/pluginVm/details');
+ }
// </if>
if (pageVisibility.onStartup !== false) {
@@ -324,6 +337,9 @@ cr.define('settings', function() {
r.PRIVACY = r.ADVANCED.createSection('/privacy', 'privacy');
r.CERTIFICATES = r.PRIVACY.createChild('/certificates');
r.SITE_SETTINGS = r.PRIVACY.createChild('/content');
+ if (loadTimeData.getBoolean('enableSecurityKeysSubpage')) {
+ r.SECURITY_KEYS = r.PRIVACY.createChild('/securityKeys');
+ }
}
if (loadTimeData.getBoolean('enableSiteSettings')) {
@@ -367,6 +383,10 @@ cr.define('settings', function() {
r.SITE_SETTINGS.createChild('unsandboxedPlugins');
r.SITE_SETTINGS_MIDI_DEVICES = r.SITE_SETTINGS.createChild('midiDevices');
r.SITE_SETTINGS_USB_DEVICES = r.SITE_SETTINGS.createChild('usbDevices');
+ if (loadTimeData.getBoolean('enableExperimentalWebPlatformFeatures')) {
+ r.SITE_SETTINGS_SERIAL_PORTS =
+ r.SITE_SETTINGS.createChild('serialPorts');
+ }
r.SITE_SETTINGS_ZOOM_LEVELS = r.SITE_SETTINGS.createChild('zoomLevels');
r.SITE_SETTINGS_PDF_DOCUMENTS =
r.SITE_SETTINGS.createChild('pdfDocuments');
@@ -675,11 +695,11 @@ cr.define('settings', function() {
new URLSearchParams(window.location.search), true);
});
- // TODO(scottchen): Change to 'get routes() {}' in export when we fix a bug in
+ // TODO(dpapad): Change to 'get routes() {}' in export when we fix a bug in
// ChromePass that limits the syntax of what can be returned from cr.define().
const routes = routerInstance.getRoutes();
- // TODO(scottchen): Stop exposing all those methods directly on settings.*,
+ // TODO(dpapad): Stop exposing all those methods directly on settings.*,
// and instead update all clients to use the singleton instance directly
const getCurrentRoute = routerInstance.getCurrentRoute.bind(routerInstance);
const getRouteForPath = routerInstance.getRouteForPath.bind(routerInstance);
diff --git a/chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.html b/chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.html
index f3a4f14479f..43fcdba764a 100644
--- a/chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.html
+++ b/chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.html
@@ -1,9 +1,9 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_row_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../extension_control_browser_proxy.html">
<link rel="import" href="search_engine_entry_css.html">
<link rel="import" href="../settings_shared_css.html">
@@ -29,11 +29,9 @@
<span>[[engine.displayName]]</span>
</div>
<div class="keyword-column">[[engine.keyword]]</div>
- <paper-icon-button-light class="icon-more-vert">
- <button on-click="onDotsTap_" title="$i18n{moreActions}"
- focus-row-control focus-type="menu">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" on-click="onDotsTap_"
+ title="$i18n{moreActions}" focus-row-control focus-type="menu">
+ </cr-icon-button>
<cr-action-menu>
<button class="dropdown-item" on-click="onManageTap_"
id="manage">
diff --git a/chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.js b/chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.js
index 928a23cb523..a89c03f05e1 100644
--- a/chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.js
+++ b/chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.js
@@ -45,7 +45,7 @@ Polymer({
/** @private */
onDotsTap_: function() {
/** @type {!CrActionMenuElement} */ (this.$$('cr-action-menu'))
- .showAt(assert(this.$$('paper-icon-button-light button')), {
+ .showAt(assert(this.$$('cr-icon-button')), {
anchorAlignmentY: AnchorAlignment.AFTER_END,
});
},
diff --git a/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html b/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html
index 3dba82056d3..9715c76b469 100644
--- a/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html
+++ b/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html
@@ -1,11 +1,11 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_row_behavior.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../controls/extension_controlled_indicator.html">
<link rel="import" href="search_engine_entry_css.html">
<link rel="import" href="search_engines_browser_proxy.html">
@@ -46,11 +46,9 @@
</div>
<div id="keyword-column"><div>[[engine.keyword]]</div></div>
<div id="url-column" class="text-elide">[[engine.url]]</div>
- <paper-icon-button-light class="icon-more-vert">
- <button on-click="onDotsTap_" title="$i18n{moreActions}"
- focus-row-control focus-type="cr-menu-button">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" on-click="onDotsTap_"
+ title="$i18n{moreActions}" focus-row-control
+ focus-type="cr-menu-button"></cr-icon-button>
<cr-action-menu>
<button class="dropdown-item" on-click="onMakeDefaultTap_"
hidden$="[[!engine.canBeDefault]]" id="makeDefault">
diff --git a/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js b/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js
index ae413cdf7c6..998b42503c9 100644
--- a/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js
+++ b/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js
@@ -73,7 +73,7 @@ Polymer({
/** @private */
onDotsTap_: function() {
/** @type {!CrActionMenuElement} */ (this.$$('cr-action-menu'))
- .showAt(assert(this.$$('paper-icon-button-light button')), {
+ .showAt(assert(this.$$('cr-icon-button')), {
anchorAlignmentY: AnchorAlignment.AFTER_END,
});
},
@@ -87,7 +87,7 @@ Polymer({
this.closePopupMenu_();
this.fire('edit-search-engine', {
engine: this.engine,
- anchorElement: assert(this.$$('paper-icon-button-light button')),
+ anchorElement: assert(this.$$('cr-icon-button')),
});
},
diff --git a/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry_css.html b/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry_css.html
index 2bc74223771..3c01e83aebf 100644
--- a/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry_css.html
+++ b/chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry_css.html
@@ -5,11 +5,6 @@
margin-inline-end: 8px;
min-width: 16px;
}
-
- .dropdown-content {
- background: white;
- box-shadow: 0 2px 6px grey;
- }
</style>
</template>
</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/search_engines_page/search_engines_list.html b/chromium/chrome/browser/resources/settings/search_engines_page/search_engines_list.html
index 6d05837233f..78feab02378 100644
--- a/chromium/chrome/browser/resources/settings/search_engines_page/search_engines_list.html
+++ b/chromium/chrome/browser/resources/settings/search_engines_page/search_engines_list.html
@@ -1,7 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
+<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../settings_vars_css.html">
<link rel="import" href="search_engine_entry.html">
@@ -27,14 +28,14 @@
}
settings-search-engine-entry {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
}
:host([fixed-height]) #container {
/* Max items we show before scrolling is 6. Adding a 7th item to the
* list will add a scroll bar to the container. */
max-height: calc((var(--settings-row-min-height) +
- var(--settings-separator-height)) * 6);
+ var(--cr-separator-height)) * 6);
}
.icon-placeholder {
diff --git a/chromium/chrome/browser/resources/settings/search_engines_page/search_engines_page.html b/chromium/chrome/browser/resources/settings/search_engines_page/search_engines_page.html
index eb76e409d2e..4229a165c0e 100644
--- a/chromium/chrome/browser/resources/settings/search_engines_page/search_engines_page.html
+++ b/chromium/chrome/browser/resources/settings/search_engines_page/search_engines_page.html
@@ -1,5 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/action_link.html">
<link rel="import" href="chrome://resources/html/action_link_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
@@ -12,6 +13,7 @@
<link rel="import" href="omnibox_extension_entry.html">
<link rel="import" href="../global_scroll_target_behavior.html">
<link rel="import" href="../settings_shared_css.html">
+<link rel="import" href="../settings_vars_css.html">
<dom-module id="settings-search-engines-page">
<template>
@@ -23,7 +25,7 @@
}
settings-omnibox-extension-entry {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
}
</style>
<div class="settings-box first">
diff --git a/chromium/chrome/browser/resources/settings/search_page/search_page.html b/chromium/chrome/browser/resources/settings/search_page/search_page.html
index f015c9ff242..d2797c030ed 100644
--- a/chromium/chrome/browser/resources/settings/search_page/search_page.html
+++ b/chromium/chrome/browser/resources/settings/search_page/search_page.html
@@ -1,11 +1,12 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../controls/extension_controlled_indicator.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../icons.html">
@@ -37,7 +38,7 @@
}
.indented {
- margin-inline-start: var(--settings-indent-width);
+ margin-inline-start: var(--cr-section-indent-width);
}
</style>
<settings-animated-pages id="pages" section="search"
@@ -96,9 +97,8 @@
</div>
</div>
<template is="dom-if" if="[[assistantOn_]]">
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{searchGoogleAssistant}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{searchGoogleAssistant}"></cr-icon-button>
</template>
<template is="dom-if" if="[[!assistantOn_]]">
<div class="separator"></div>
diff --git a/chromium/chrome/browser/resources/settings/search_page/search_page.js b/chromium/chrome/browser/resources/settings/search_page/search_page.js
index bf8561c2242..114c3f15efc 100644
--- a/chromium/chrome/browser/resources/settings/search_page/search_page.js
+++ b/chromium/chrome/browser/resources/settings/search_page/search_page.js
@@ -90,7 +90,7 @@ Polymer({
if (settings.routes.GOOGLE_ASSISTANT) {
this.focusConfig_.set(
settings.routes.GOOGLE_ASSISTANT.path,
- '#assistant-subpage-trigger .subpage-arrow button');
+ '#assistant-subpage-trigger .subpage-arrow');
}
// </if>
},
diff --git a/chromium/chrome/browser/resources/settings/search_settings.js b/chromium/chrome/browser/resources/settings/search_settings.js
index 3a11f43af51..4360adcb678 100644
--- a/chromium/chrome/browser/resources/settings/search_settings.js
+++ b/chromium/chrome/browser/resources/settings/search_settings.js
@@ -39,8 +39,6 @@ cr.define('settings', function() {
'IMG',
'IRON-ICON',
'IRON-LIST',
- 'PAPER-ICON-BUTTON',
- 'PAPER-ICON-BUTTON-LIGHT',
'PAPER-RIPPLE',
'PAPER-SPINNER-LITE',
'SLOT',
diff --git a/chromium/chrome/browser/resources/settings/settings_icons_css.html b/chromium/chrome/browser/resources/settings/settings_icons_css.html
index 7a4e72d47e8..cdfd12f105a 100644
--- a/chromium/chrome/browser/resources/settings/settings_icons_css.html
+++ b/chromium/chrome/browser/resources/settings/settings_icons_css.html
@@ -5,10 +5,10 @@
<template>
<style>
<if expr="chromeos">
- paper-icon-button-light.icon-add-circle {
+ cr-icon-button.icon-add-circle {
background-image: url(./images/settings_icon_add_circle.svg);
}
- paper-icon-button-light.icon-add-wifi {
+ cr-icon-button.icon-add-wifi {
background-image: url(./images/settings_icon_add_wifi.svg);
}
</if>
diff --git a/chromium/chrome/browser/resources/settings/settings_main/settings_main.html b/chromium/chrome/browser/resources/settings/settings_main/settings_main.html
index 1f40668c4ca..bc533d98d06 100644
--- a/chromium/chrome/browser/resources/settings/settings_main/settings_main.html
+++ b/chromium/chrome/browser/resources/settings/settings_main/settings_main.html
@@ -57,7 +57,8 @@
<div>$i18nRaw{searchNoResultsHelp}</div>
</div>
<template is="dom-if"
- if="[[showManagedHeader_(inSearchMode_, showingSubpage_)]]">
+ if="[[showManagedHeader_(inSearchMode_, showingSubpage_,
+ showPages_.about)]]">
<managed-footnote></managed-footnote>
</template>
<template is="dom-if" if="[[showPages_.settings]]">
@@ -66,6 +67,7 @@
show-android-apps="[[showAndroidApps]]"
show-kiosk-next-shell="[[showKioskNextShell]]"
show-crostini="[[showCrostini]]"
+ show-plugin-vm="[[showPluginVm]]"
have-play-store-app="[[havePlayStoreApp]]"
on-showing-section="onShowingSection_"
on-subpage-expand="onShowingSubpage_"
@@ -77,6 +79,8 @@
<template is="dom-if" if="[[showPages_.about]]">
<settings-about-page role="main"
in-search-mode="[[inSearchMode_]]"
+ on-subpage-expand="onShowingSubpage_"
+ on-showing-main-page="onShowingMainPage_"
prefs="{{prefs}}"
show-crostini="[[showCrostini]]">
</settings-about-page>
diff --git a/chromium/chrome/browser/resources/settings/settings_main/settings_main.js b/chromium/chrome/browser/resources/settings/settings_main/settings_main.js
index 3e502755a89..28986afbff2 100644
--- a/chromium/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chromium/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -80,7 +80,7 @@ Polymer({
/**
* Dictionary defining page visibility.
- * @type {!GuestModePageVisibility}
+ * @type {!PageVisibility}
*/
pageVisibility: Object,
@@ -237,6 +237,7 @@ Polymer({
* @private
*/
showManagedHeader_: function() {
- return !this.inSearchMode_ && !this.showingSubpage_;
+ return !this.inSearchMode_ && !this.showingSubpage_ &&
+ !this.showPages_.about;
},
});
diff --git a/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.html b/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.html
index ee4fa7a5f50..e5c162ee2bf 100644
--- a/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.html
+++ b/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.html
@@ -51,7 +51,6 @@
}
#advancedButton {
- background-color: unset;
border: none;
border-radius: initial;
height: unset;
@@ -139,12 +138,16 @@
<iron-icon icon="settings:play-prism"></iron-icon>
$i18n{androidAppsPageTitle}
</a>
-</if>
-<if expr="chromeos">
<a href="/crostini" hidden="[[!showCrostini]]">
<iron-icon icon="settings:crostini-mascot"></iron-icon>
$i18n{crostiniPageTitle}
</a>
+ <a href="/pluginVm" hidden="[[!showPluginVm]]">
+ <!-- TODO(crbug.com/950738): The placeholder iron-icon here is needed
+ for spacing. Replace this once we get the proper icon. -->
+ <iron-icon icon="cr:info"></iron-icon>
+ $i18n{pluginVmPageTitle}
+ </a>
</if>
<if expr="not chromeos">
<a id="defaultBrowser" href="/defaultBrowser"
diff --git a/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.js b/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.js
index a603753fd93..a28c773d1ed 100644
--- a/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.js
+++ b/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.js
@@ -19,7 +19,7 @@ Polymer({
/**
* Dictionary defining page visibility.
- * @type {!GuestModePageVisibility}
+ * @type {!PageVisibility}
*/
pageVisibility: Object,
},
diff --git a/chromium/chrome/browser/resources/settings/settings_page/settings_subpage.html b/chromium/chrome/browser/resources/settings/settings_page/settings_subpage.html
index b6ab9f01812..56e73c80fcb 100644
--- a/chromium/chrome/browser/resources/settings/settings_page/settings_subpage.html
+++ b/chromium/chrome/browser/resources/settings/settings_page/settings_subpage.html
@@ -1,11 +1,11 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_search_field/cr_search_field.html">
<link rel="import" href="chrome://resources/html/find_shortcut_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-resizable-behavior/iron-resizable-behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-ripple/paper-ripple.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html">
<link rel="import" href="../icons.html">
@@ -44,7 +44,7 @@
width: var(--cr-icon-ripple-size);
}
- paper-icon-button-light {
+ cr-icon-button {
/* Centers the ripple on the icon with appropriate margin on right. */
margin-inline-end: 10px;
margin-inline-start: -10px;
@@ -65,10 +65,8 @@
}
</style>
<div class="settings-box first" id="headerLine">
- <paper-icon-button-light class="icon-arrow-back">
- <button id="closeButton" on-click="onTapBack_"
- aria-label="$i18n{back}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-arrow-back" id="closeButton"
+ on-click="onTapBack_" aria-label="$i18n{back}"></cr-icon-button>
<h1>[[pageTitle]]</h1>
<slot name="subpage-title-extra"></slot>
<template is="dom-if" if="[[learnMoreUrl]]">
diff --git a/chromium/chrome/browser/resources/settings/settings_resources.grd b/chromium/chrome/browser/resources/settings/settings_resources.grd
index dbff3ba1123..fa4b6f251d1 100644
--- a/chromium/chrome/browser/resources/settings/settings_resources.grd
+++ b/chromium/chrome/browser/resources/settings/settings_resources.grd
@@ -34,7 +34,7 @@
<structure name="IDR_SETTINGS_TTS_SUBPAGE_HTML"
file="a11y_page/tts_subpage.html"
type="chrome_html" />
- <structure name="IDR_MD_SETTINGS_MANIFEST"
+ <structure name="IDR_SETTINGS_MANIFEST"
file="manifest.json"
type="chrome_html" />
@@ -368,6 +368,30 @@
<structure name="IDR_SETTINGS_HISTORY_DELETION_DIALOG_JS"
file="clear_browsing_data_dialog/history_deletion_dialog.js"
type="chrome_html" />
+ <structure name="IDR_SETTINGS_SECURITY_KEYS_PAGE_HTML"
+ file="privacy_page/security_keys_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_SECURITY_KEYS_PAGE_JS"
+ file="privacy_page/security_keys_subpage.js"
+ type="chrome_html"/>
+ <structure name="IDR_SETTINGS_SECURITY_KEYS_SET_PIN_DIALOG_HTML"
+ file="privacy_page/security_keys_set_pin_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_SECURITY_KEYS_SET_PIN_DIALOG_JS"
+ file="privacy_page/security_keys_set_pin_dialog.js"
+ type="chrome_html"/>
+ <structure name="IDR_SETTINGS_SECURITY_KEYS_RESET_DIALOG_HTML"
+ file="privacy_page/security_keys_reset_dialog.html"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_SECURITY_KEYS_RESET_DIALOG_JS"
+ file="privacy_page/security_keys_reset_dialog.js"
+ type="chrome_html"/>
+ <structure name="IDR_SETTINGS_SECURITY_KEYS_DIALOG_BROWSER_PROXY_HTML"
+ file="privacy_page/security_keys_browser_proxy.html"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_SECURITY_KEYS_DIALOG_BROWSER_PROXY_JS"
+ file="privacy_page/security_keys_browser_proxy.js"
+ type="chrome_html" />
<structure name="IDR_SETTINGS_CONTROLS_BOOLEAN_CONTROL_BEHAVIOR_HTML"
file="controls/settings_boolean_control_behavior.html"
type="chrome_html" />
@@ -880,12 +904,6 @@
<structure name="IDR_SETTINGS_CUPS_PRINTERS_LIST_JS"
file="printing_page/cups_printers_list.js"
type="chrome_html" />
- <structure name="IDR_SETTINGS_CUPS_SET_MANUFACTURER_MODEL_BEHAVIOR_HTML"
- file="printing_page/cups_set_manufacturer_model_behavior.html"
- type="chrome_html" />
- <structure name="IDR_SETTINGS_CUPS_SET_MANUFACTURER_MODEL_BEHAVIOR_JS"
- file="printing_page/cups_set_manufacturer_model_behavior.js"
- type="chrome_html" />
<structure name="IDR_SETTINGS_CUPS_EDIT_PRINTER_DIALOG_HTML"
file="printing_page/cups_edit_printer_dialog.html"
type="chrome_html" />
@@ -904,11 +922,11 @@
<structure name="IDR_SETTINGS_CUPS_ADD_PRINTER_DIALOG_ELEMENTS_JS"
file="printing_page/cups_add_printer_dialog_elements.js"
type="chrome_html" />
- <structure name="IDR_SETTINGS_CUPS_ADD_PRINTER_DIALOG_UTIL_HTML"
- file="printing_page/cups_add_printer_dialog_util.html"
+ <structure name="IDR_SETTINGS_CUPS_PRINTER_DIALOG_UTIL_HTML"
+ file="printing_page/cups_printer_dialog_util.html"
type="chrome_html" />
- <structure name="IDR_SETTINGS_CUPS_ADD_PRINTER_DIALOG_UTIL_JS"
- file="printing_page/cups_add_printer_dialog_util.js"
+ <structure name="IDR_SETTINGS_CUPS_PRINTER_DIALOG_UTIL_JS"
+ file="printing_page/cups_printer_dialog_util.js"
type="chrome_html" />
</if>
<if expr="not chromeos">
@@ -1237,6 +1255,12 @@
<structure name="IDR_SETTINGS_CROSTINI_SUBPAGE_JS"
file="crostini_page/crostini_subpage.js"
type="chrome_html" />
+ <structure name="IDR_SETTINGS_CROSTINI_EXPORT_IMPORT_HTML"
+ file="crostini_page/crostini_export_import.html"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_CROSTINI_EXPORT_IMPORT_JS"
+ file="crostini_page/crostini_export_import.js"
+ type="chrome_html" />
<structure name="IDR_SETTINGS_CROSTINI_SHARED_PATHS_HTML"
file="crostini_page/crostini_shared_paths.html"
type="chrome_html" />
@@ -1520,6 +1544,18 @@
<structure name="IDR_SETTINGS_PEOPLE_FINGERPRINT_BROWSER_PROXY_HTML"
file="people_page/fingerprint_browser_proxy.html"
type="chrome_html" />
+ <structure name="IDR_SETTINGS_PLUGIN_VM_PAGE_HTML"
+ file="plugin_vm_page/plugin_vm_page.html"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_PLUGIN_VM_PAGE_JS"
+ file="plugin_vm_page/plugin_vm_page.js"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_PLUGIN_VM_SUBPAGE_HTML"
+ file="plugin_vm_page/plugin_vm_subpage.html"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_PLUGIN_VM_SUBPAGE_JS"
+ file="plugin_vm_page/plugin_vm_subpage.js"
+ type="chrome_html" />
<structure name="IDR_SETTINGS_USERS_PAGE_ADD_USER_DIALOG_JS"
file="people_page/users_add_user_dialog.js"
type="chrome_html" />
diff --git a/chromium/chrome/browser/resources/settings/settings_resources_vulcanized.grd b/chromium/chrome/browser/resources/settings/settings_resources_vulcanized.grd
index d6163532492..5420b5ed6a1 100644
--- a/chromium/chrome/browser/resources/settings/settings_resources_vulcanized.grd
+++ b/chromium/chrome/browser/resources/settings/settings_resources_vulcanized.grd
@@ -12,13 +12,13 @@
</outputs>
<release seq="1">
<includes>
- <include name="IDR_MD_SETTINGS_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\vulcanized.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MD_SETTINGS_VULCANIZED_P2_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\vulcanized.p2.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MD_SETTINGS_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\settings\crisper.js" use_base_dir="false" flattenhtml="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MD_SETTINGS_LAZY_LOAD_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\lazy_load.vulcanized.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MD_SETTINGS_LAZY_LOAD_VULCANIZED_P2_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\lazy_load.vulcanized.p2.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MD_SETTINGS_LAZY_LOAD_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\settings\lazy_load.crisper.js" use_base_dir="false" flattenhtml="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MD_SETTINGS_MANIFEST" file="manifest.json" type="BINDATA" compress="gzip" />
+ <include name="IDR_SETTINGS_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\vulcanized.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
+ <include name="IDR_SETTINGS_VULCANIZED_P2_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\vulcanized.p2.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
+ <include name="IDR_SETTINGS_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\settings\crisper.js" use_base_dir="false" flattenhtml="true" type="BINDATA" compress="gzip" />
+ <include name="IDR_SETTINGS_LAZY_LOAD_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\lazy_load.vulcanized.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
+ <include name="IDR_SETTINGS_LAZY_LOAD_VULCANIZED_P2_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\lazy_load.vulcanized.p2.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
+ <include name="IDR_SETTINGS_LAZY_LOAD_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\settings\lazy_load.crisper.js" use_base_dir="false" flattenhtml="true" type="BINDATA" compress="gzip" />
+ <include name="IDR_SETTINGS_MANIFEST" file="manifest.json" type="BINDATA" compress="gzip" />
</includes>
</release>
</grit>
diff --git a/chromium/chrome/browser/resources/settings/settings_shared_css.html b/chromium/chrome/browser/resources/settings/settings_shared_css.html
index 52486acacb4..5585da834a4 100644
--- a/chromium/chrome/browser/resources/settings/settings_shared_css.html
+++ b/chromium/chrome/browser/resources/settings/settings_shared_css.html
@@ -33,10 +33,6 @@
flex-shrink: 0; /* Prevent distortion of icons in cramped UI. */
}
- iron-icon[icon='cr:check'] {
- --iron-icon-fill-color: var(--google-green-500);
- }
-
iron-icon.policy {
margin-inline-end: var(--cr-controlled-by-spacing);
}
@@ -60,15 +56,10 @@
}
}
- .separator + paper-icon-button-light {
+ .separator + cr-icon-button {
margin-inline-start: var(--cr-icon-ripple-margin);
}
- /* For "Advanced" toggle button. */
- paper-button[toggles][active] {
- background-color: var(--paper-grey-300);
- }
-
/* Special case for buttons inside of toggle-buttons. */
.settings-box settings-toggle-button paper-button:last-of-type {
margin-inline-end: 16px;
@@ -115,10 +106,16 @@
}
cr-radio-group:focus {
+ /* TODO(dbeam): why is this here? It looks weird and I'm not sure how to
+ * actually trigger it with mouse/keyboard/screenreader. */
background-color: var(--google-grey-300);
outline: none;
}
+ :host-context([dark]) cr-radio-group:focus {
+ background-color: var(--google-grey-800);
+ }
+
/* See also: .no-min-width below. */
.text-elide {
@apply --cr-text-elide;
@@ -157,7 +154,7 @@
/* A thin separator line under a list item. */
.list-item.underbar {
- border-bottom: var(--settings-separator-line);
+ border-bottom: var(--cr-separator-line);
}
.list-item.selected {
@@ -251,7 +248,7 @@
/* A settings-box that is embedded in another settings-box (e.g. a control
* that is associated with a toggle button). */
.settings-box.embedded {
- padding-inline-start: var(--settings-box-row-indent);
+ padding-inline-start: var(--cr-section-indent-padding);
}
/* The lower line of text in a two-line row. */
@@ -305,22 +302,19 @@
[scrollable],
iron-list,
.list-item {
- --cr-paper-icon-button-margin: {
- margin-inline-end: 0;
- margin-inline-start: var(--cr-icon-button-margin-start);
- };
+ --cr-icon-button-margin-end: 0;
}
/* Helper for a list frame to automatically avoid the separator line. */
.vertical-list > *:not(:first-of-type) {
- border-top: var(--settings-separator-line);
+ border-top: var(--cr-separator-line);
}
/* The separator a vertical line like a horizontal rule <hr> tag, but goes
* the other way. An example is near the |sign out| button on the People
* settings. */
.separator {
- border-inline-start: var(--settings-separator-line);
+ border-inline-start: var(--cr-separator-line);
flex-shrink: 0;
/* Match paper-button's default height. */
height: 32px;
diff --git a/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.html b/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.html
index 372b651bd26..6e1e81d81d5 100644
--- a/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.html
+++ b/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.html
@@ -70,6 +70,7 @@
<settings-menu page-visibility="[[pageVisibility_]]"
show-android-apps="[[showAndroidApps_]]"
show-crostini="[[showCrostini_]]"
+ show-plugin-vm="[[showPluginVm_]]"
show-multidevice="[[showMultidevice_]]"
have-play-store-app="[[havePlayStoreApp_]]"
on-iron-activate="onIronActivate_"
@@ -85,6 +86,7 @@
show-android-apps="[[showAndroidApps_]]"
show-kiosk-next-shell="[[showKioskNextShell_]]"
show-crostini="[[showCrostini_]]"
+ show-plugin-vm="[[showPluginVm_]]"
show-multidevice="[[showMultidevice_]]"
have-play-store-app="[[havePlayStoreApp_]]"
advanced-toggle-expanded="{{advancedOpened_}}">
diff --git a/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.js b/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.js
index 025e9262353..291bf5c46bb 100644
--- a/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.js
+++ b/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.js
@@ -46,7 +46,7 @@ Polymer({
},
/**
- * @private {!GuestModePageVisibility}
+ * @private {!PageVisibility}
*/
pageVisibility_: {type: Object, value: settings.pageVisibility},
@@ -60,6 +60,9 @@ Polymer({
showCrostini_: Boolean,
/** @private */
+ showPluginVm_: Boolean,
+
+ /** @private */
havePlayStoreApp_: Boolean,
/** @private */
@@ -107,7 +110,12 @@ Polymer({
// <if expr="chromeos">
controlledSettingShared:
loadTimeData.getString('controlledSettingShared'),
- controlledSettingOwner: loadTimeData.getString('controlledSettingOwner'),
+ controlledSettingWithOwner:
+ loadTimeData.getString('controlledSettingWithOwner'),
+ controlledSettingNoOwner:
+ loadTimeData.getString('controlledSettingNoOwner'),
+ controlledSettingParent:
+ loadTimeData.getString('controlledSettingParent'),
// </if>
};
@@ -137,13 +145,23 @@ Polymer({
};
// </if>
- this.showAndroidApps_ = loadTimeData.valueExists('androidAppsVisible') &&
+ // The SplitSettings feature hides OS settings in the browser settings page.
+ // https://crbug.com/950007
+ const showOSSettings = loadTimeData.getBoolean('showOSSettings');
+ this.showAndroidApps_ = showOSSettings &&
+ loadTimeData.valueExists('androidAppsVisible') &&
loadTimeData.getBoolean('androidAppsVisible');
- this.showKioskNextShell_ = loadTimeData.valueExists('showKioskNextShell') &&
+ this.showKioskNextShell_ = showOSSettings &&
+ loadTimeData.valueExists('showKioskNextShell') &&
loadTimeData.getBoolean('showKioskNextShell');
- this.showCrostini_ = loadTimeData.valueExists('showCrostini') &&
+ this.showCrostini_ = showOSSettings &&
+ loadTimeData.valueExists('showCrostini') &&
loadTimeData.getBoolean('showCrostini');
- this.havePlayStoreApp_ = loadTimeData.valueExists('havePlayStoreApp') &&
+ this.showPluginVm_ = showOSSettings &&
+ loadTimeData.valueExists('showPluginVm') &&
+ loadTimeData.getBoolean('showPluginVm');
+ this.havePlayStoreApp_ = showOSSettings &&
+ loadTimeData.valueExists('havePlayStoreApp') &&
loadTimeData.getBoolean('havePlayStoreApp');
this.addEventListener('show-container', () => {
diff --git a/chromium/chrome/browser/resources/settings/settings_vars_css.html b/chromium/chrome/browser/resources/settings/settings_vars_css.html
index 5d4b4de8c0c..23ba1907b36 100644
--- a/chromium/chrome/browser/resources/settings/settings_vars_css.html
+++ b/chromium/chrome/browser/resources/settings/settings_vars_css.html
@@ -12,17 +12,12 @@
/* Some colors use non-MD colors. These custom colors are specified by
* UX design (bettes@). */
- --settings-actionable: var(--cr-actionable);
-
- --settings-box-row-padding: var(--cr-section-padding);
- --settings-box-row-indent: var(--cr-section-indent-padding);
- --settings-indent-width: var(--cr-section-indent-width);
--settings-disabled-opacity: .65;
--settings-error-color: var(--google-red-700);
--settings-list-frame-padding: {
- padding-inline-end: var(--settings-box-row-padding);
- padding-inline-start: var(--settings-box-row-indent);
+ padding-inline-end: var(--cr-section-padding);
+ padding-inline-start: var(--cr-section-indent-padding);
padding-bottom: 0;
padding-top: 0;
}
@@ -35,9 +30,6 @@
--settings-row-three-line-min-height:
var(--cr-section-three-line-min-height);
- --settings-separator-height: var(--cr-separator-height);
- --settings-separator-line: var(--cr-separator-line);
-
/* Spacing between a control (e.g. checkbox) and its label. */
--settings-control-label-spacing: 20px;
diff --git a/chromium/chrome/browser/resources/settings/site_settings/all_sites.html b/chromium/chrome/browser/resources/settings/site_settings/all_sites.html
index 8be1d5036dc..eb14758e277 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/all_sites.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/all_sites.html
@@ -1,12 +1,12 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/cr_elements/cr_search_field/cr_search_field.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
<link rel="import" href="../global_scroll_target_behavior.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
-<link rel="import" href="../settings_vars_css.html">
<link rel="import" href="site_entry.html">
<link rel="import" href="site_settings_behavior.html">
@@ -18,7 +18,7 @@
display: flex;
margin: 0 var(--cr-icon-button-margin-start);
margin-bottom: 50px;
- padding: 0 var(--settings-box-row-padding);
+ padding: 0 var(--cr-section-padding);
}
#sortMethod {
@@ -28,7 +28,7 @@
/* There is only one top-level heading for All Sites, so remove the
* additional leading padding used for lists. */
.list-frame.without-heading {
- padding-inline-start: var(--settings-box-row-padding);
+ padding-inline-start: var(--cr-section-padding);
}
</style>
<div id="sort">
diff --git a/chromium/chrome/browser/resources/settings/site_settings/category_default_setting.js b/chromium/chrome/browser/resources/settings/site_settings/category_default_setting.js
index b3e92551446..75922a8750b 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/category_default_setting.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/category_default_setting.js
@@ -124,6 +124,7 @@ Polymer({
case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS:
case settings.ContentSettingsTypes.MIDI_DEVICES:
case settings.ContentSettingsTypes.USB_DEVICES:
+ case settings.ContentSettingsTypes.SERIAL_PORTS:
// "Ask" vs "Blocked".
this.browserProxy.setDefaultValueForContentType(
this.category,
diff --git a/chromium/chrome/browser/resources/settings/site_settings/chooser_exception_list.js b/chromium/chrome/browser/resources/settings/site_settings/chooser_exception_list.js
index a017a58759c..7e37cdebf20 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/chooser_exception_list.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/chooser_exception_list.js
@@ -109,6 +109,10 @@ Polymer({
switch (this.chooserType) {
case settings.ChooserType.USB_DEVICES:
this.emptyListMessage_ = this.i18n('noUsbDevicesFound');
+ break;
+ case settings.ChooserType.SERIAL_PORTS:
+ this.emptyListMessage_ = this.i18n('noSerialPortsFound');
+ break;
default:
this.emptyListMessage_ = '';
}
diff --git a/chromium/chrome/browser/resources/settings/site_settings/constants.js b/chromium/chrome/browser/resources/settings/site_settings/constants.js
index de901e4a552..ec531757350 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/constants.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/constants.js
@@ -29,6 +29,7 @@ settings.ContentSettingsTypes = {
BACKGROUND_SYNC: 'background-sync',
MIDI_DEVICES: 'midi-sysex',
USB_DEVICES: 'usb-devices',
+ SERIAL_PORTS: 'serial-ports',
ZOOM_LEVELS: 'zoom-levels',
PROTECTED_CONTENT: 'protected-content',
ADS: 'ads',
@@ -61,6 +62,7 @@ settings.ContentSetting = {
settings.ChooserType = {
NONE: '',
USB_DEVICES: 'usb-devices-data',
+ SERIAL_PORTS: 'serial-ports-data',
};
/**
diff --git a/chromium/chrome/browser/resources/settings/site_settings/cookie_info.js b/chromium/chrome/browser/resources/settings/site_settings/cookie_info.js
index 742ddb488e9..d4aec05be80 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/cookie_info.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/cookie_info.js
@@ -34,8 +34,8 @@ const cookieInfo = {
['created', 'cookieCreated'], ['expires', 'cookieExpires']
],
'app_cache': [
- ['manifest', 'appCacheManifest'], ['size', 'localStorageSize'],
- ['created', 'cookieCreated'], ['accessed', 'cookieLastAccessed']
+ ['origin', 'appCacheOrigin'], ['size', 'localStorageSize'],
+ ['modified', 'localStorageLastModified']
],
'database': [
['origin', 'databaseOrigin'], ['size', 'localStorageSize'],
diff --git a/chromium/chrome/browser/resources/settings/site_settings/protocol_handlers.html b/chromium/chrome/browser/resources/settings/site_settings/protocol_handlers.html
index 5585ac729fd..269709ab022 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/protocol_handlers.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/protocol_handlers.html
@@ -1,10 +1,11 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../site_favicon.html">
@@ -52,9 +53,8 @@
</div>
</div>
- <paper-icon-button-light class="icon-more-vert">
- <button on-click="showMenu_" title="$i18n{moreActions}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" on-click="showMenu_"
+ title="$i18n{moreActions}"></cr-icon-button>
</div>
</template>
</div>
@@ -84,11 +84,9 @@
[[item.protocol_display_name]]
</div>
</div>
- <paper-icon-button-light class="icon-clear">
- <button id="removeIgnoredButton" on-click="onRemoveIgnored_"
- title="$i18n{handlerRemove}">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-clear" id="removeIgnoredButton"
+ on-click="onRemoveIgnored_" title="$i18n{handlerRemove}">
+ </cr-icon-button>
</div>
</template>
</div>
@@ -96,15 +94,8 @@
<if expr="chromeos">
<template is="dom-if" if="[[settingsAppAvailable_]]">
- <div class="settings-box first"
- on-click="onManageAndroidAppsClick_" actionable>
- <div class="start">
- <div>$i18n{androidAppsManageAppLinks}</div>
- </div>
- <paper-icon-button-light class="icon-external">
- <button></button>
- </paper-icon-button-light>
- </div>
+ <cr-link-row on-click="onManageAndroidAppsClick_"
+ label="$i18n{androidAppsManageAppLinks}" external></cr-link-row>
</template>
</if>
</template>
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_data.html b/chromium/chrome/browser/resources/settings/site_settings/site_data.html
index 3407b6032f7..ce8abf70394 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_data.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_data.html
@@ -10,7 +10,6 @@
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html">
<link rel="import" href="../global_scroll_target_behavior.html">
<link rel="import" href="../settings_shared_css.html">
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_data.js b/chromium/chrome/browser/resources/settings/site_settings/site_data.js
index d840f991c99..f15cb13e19b 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_data.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_data.js
@@ -165,8 +165,7 @@ Polymer({
/** @type {!IronListElement} */ (this.$$('iron-list'));
ironList.focusItem(index);
const siteToSelect = this.sites[index].site.replace(/[.]/g, '\\.');
- const button =
- this.$$(`#siteItem_${siteToSelect}`).$$('.subpage-arrow button');
+ const button = this.$$(`#siteItem_${siteToSelect}`).$$('.subpage-arrow');
cr.ui.focusWithoutInk(assert(button));
},
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_data_details_subpage.html b/chromium/chrome/browser/resources/settings/site_settings/site_data_details_subpage.html
index 5a4c641e955..c4529c642a5 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_data_details_subpage.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_data_details_subpage.html
@@ -1,9 +1,9 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="cookie_info.html">
@@ -28,9 +28,8 @@
[[getEntryDescription_(item)]]
</cr-expand-button>
<div class="separator"></div>
- <paper-icon-button-light class="icon-clear">
- <button data-id-path$="[[item.idPath]]" on-click="onRemove_"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-clear" data-id-path$="[[item.idPath]]"
+ on-click="onRemove_"></cr-icon-button>
</div>
<iron-collapse class="list-frame vertical-list"
opened="[[item.expanded_]]">
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_data_entry.html b/chromium/chrome/browser/resources/settings/site_settings/site_data_entry.html
index 27b5081bf95..5585d9a34c3 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_data_entry.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_data_entry.html
@@ -1,10 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_row_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../site_favicon.html">
<link rel="import" href="cookie_info.html">
@@ -22,16 +22,13 @@
<span class="url-directionality">[[model.site]]</span>
<div class="secondary">[[model.localData]]</div>
</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label$="[[model.site]]" focus-row-control
- focus-type="showDetails"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow" aria-label$="[[model.site]]"
+ focus-row-control focus-type="showDetails"></cr-icon-button>
<div class="separator"></div>
- <paper-icon-button-light class="icon-delete-gray">
- <button title$="[[i18n('siteSettingsCookieRemoveSite', model.site)]]"
- on-click="onRemove_" focus-row-control focus-type="remove">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-delete-gray"
+ title$="[[i18n('siteSettingsCookieRemoveSite', model.site)]]"
+ on-click="onRemove_" focus-row-control focus-type="remove">
+ </cr-icon-button>
</div>
</template>
<script src="site_data_entry.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_details.html b/chromium/chrome/browser/resources/settings/site_settings/site_details.html
index c4cb1f14bca..16e1db8047b 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_details.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_details.html
@@ -6,8 +6,9 @@
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
@@ -35,7 +36,7 @@
* that would normally be provided by the subheading. */
.list-frame.without-heading {
margin-top: 12px;
- padding-inline-start: var(--settings-box-row-padding);
+ padding-inline-start: var(--cr-section-padding);
}
#resetSettingsButton {
@@ -102,7 +103,6 @@
aria-label="$i18n{siteSettingsDelete}">
$i18n{siteSettingsDelete}
</paper-button>
- </paper-icon-button-light>
</div>
</div>
</div>
@@ -179,6 +179,13 @@
category="{{ContentSettingsTypes.USB_DEVICES}}" icon="settings:usb"
id="usbDevices" label="$i18n{siteSettingsUsbDevices}">
</site-details-permission>
+ <template is="dom-if" if="[[enableExperimentalWebPlatformFeatures_]]">
+ <site-details-permission
+ category="{{ContentSettingsTypes.SERIAL_PORTS}}"
+ icon="settings:serial-port" id="serialPorts"
+ label="$i18n{siteSettingsSerialPorts}">
+ </site-details-permission>
+ </template>
<site-details-permission
category="{{ContentSettingsTypes.UNSANDBOXED_PLUGINS}}"
icon="cr:extension" id="unsandboxedPlugins"
@@ -209,11 +216,9 @@
<div class="start">
$i18n{siteSettingsReset}
</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label="$i18n{siteSettingsReset}"
- aria-describedby="resetSettingsButton">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label="$i18n{siteSettingsReset}"
+ aria-describedby="resetSettingsButton"></cr-icon-button>
</div>
</template>
<website-usage-private-api id="usageApi"
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_details.js b/chromium/chrome/browser/resources/settings/site_settings/site_details.js
index e1f93e10f73..b882255e0a4 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_details.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_details.js
@@ -55,6 +55,14 @@ Polymer({
},
/** @private */
+ enableExperimentalWebPlatformFeatures_: {
+ type: Boolean,
+ value: function() {
+ return loadTimeData.getBoolean('enableExperimentalWebPlatformFeatures');
+ },
+ },
+
+ /** @private */
enableSiteSettings_: {
type: Boolean,
value: function() {
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_details_permission.js b/chromium/chrome/browser/resources/settings/site_settings/site_details_permission.js
index f6cce6086de..a7db9d61504 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_details_permission.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_details_permission.js
@@ -68,10 +68,6 @@ Polymer({
if (this.isNonDefaultAsk_(site.setting, site.source)) {
assert(
- this.$.permission.disabled,
- 'The \'Ask\' entry is for display-only and cannot be set by the ' +
- 'user.');
- assert(
this.$.permission.value == settings.ContentSetting.ASK,
'\'Ask\' should only show up when it\'s currently selected.');
}
@@ -266,8 +262,10 @@ Polymer({
assert(
source == settings.SiteSettingSource.EXTENSION ||
- source == settings.SiteSettingSource.POLICY,
- 'Only extensions or enterprise policy can change the setting to ASK.');
+ source == settings.SiteSettingSource.POLICY ||
+ source == settings.SiteSettingSource.PREFERENCE,
+ 'Only extensions, enterprise policy or preferences can change ' +
+ 'the setting to ASK.');
return true;
},
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_entry.html b/chromium/chrome/browser/resources/settings/site_settings/site_entry.html
index 2228a6d9eac..49b87662716 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_entry.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_entry.html
@@ -1,10 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_row_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../site_favicon.html">
@@ -70,29 +70,20 @@
</span>
</div>
</div>
- <paper-icon-button-light id="expandIcon" class="icon-expand-more"
- hidden$="[[!grouped_(siteGroup)]]">
- <button aria-label$="[[displayName_]]"
- aria-describedby="displayName" focus-row-control
- focus-type="expand">
- </button>
- </paper-icon-button-light>
- <paper-icon-button-light class="subpage-arrow"
- hidden$="[[grouped_(siteGroup)]]">
- <button aria-label$="[[displayName_]]"
- aria-describedby="displayName"
- focus-row-control focus-type="show-detail">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="expandIcon" class="icon-expand-more"
+ hidden$="[[!grouped_(siteGroup)]]" aria-label$="[[displayName_]]"
+ aria-describedby="displayName" focus-row-control
+ focus-type="expand"></cr-icon-button>
+ <cr-icon-button class="subpage-arrow"
+ hidden$="[[grouped_(siteGroup)]]" aria-label$="[[displayName_]]"
+ aria-describedby="displayName"
+ focus-row-control focus-type="show-detail"></cr-icon-button>
</div>
<div class="row-aligned" hidden$="[[!grouped_(siteGroup)]]">
<div class="separator"></div>
- <paper-icon-button-light class="icon-more-vert">
- <button id="overflowMenuButton" title="$i18n{moreActions}"
- on-click="showOverflowMenu_" focus-row-control
- focus-type="more-actions">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-more-vert" id="overflowMenuButton"
+ title="$i18n{moreActions}" on-click="showOverflowMenu_"
+ focus-row-control focus-type="more-actions"></cr-icon-button>
</div>
</div>
@@ -132,11 +123,10 @@
[[originCookiesItem_(cookiesNum_.*, index)]]
</span>
</div>
- <paper-icon-button-light class="subpage-arrow">
- <button aria-labelledby$="originSiteRepresentation"
- focus-row-control focus-type="detailed-sites">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-labelledby$="originSiteRepresentation"
+ focus-row-control focus-type="detailed-sites">
+ </cr-icon-button>
</div>
</template>
</div>
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_entry.js b/chromium/chrome/browser/resources/settings/site_settings/site_entry.js
index 3687703390c..412cbb05543 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_entry.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_entry.js
@@ -168,7 +168,7 @@ Polymer({
this.unlisten(this.button_, 'keydown', 'onButtonKeydown_');
}
this.button_ = /** @type Element */
- (this.root.querySelector('#toggleButton *:not([hidden]) button'));
+ (this.root.querySelector('#toggleButton *:not([hidden])'));
this.listen(assert(this.button_), 'keydown', 'onButtonKeydown_');
if (!this.grouped_(siteGroup)) {
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_list_entry.html b/chromium/chrome/browser/resources/settings/site_settings/site_list_entry.html
index 8fe5ddbb99c..f1350d35534 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_list_entry.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_list_entry.html
@@ -1,10 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_row_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../route.html">
@@ -46,11 +46,10 @@
id="siteDescription">[[siteDescription_]]</div>
</div>
<template is="dom-if" if="[[allowNavigateToSiteDetail_]]">
- <paper-icon-button-light class="subpage-arrow">
- <button aria-label$="[[model.displayName]]"
- aria-describedby="siteDescription" focus-row-control
- focus-type="site-details"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="subpage-arrow"
+ aria-label$="[[model.displayName]]"
+ aria-describedby="siteDescription" focus-row-control
+ focus-type="site-details"></cr-icon-button>
<div class="separator"></div>
</template>
</div>
@@ -60,20 +59,15 @@
on-focus="onShowTooltip_" focus-row-control focus-type="policy">
</cr-policy-pref-indicator>
</template>
- <paper-icon-button-light id="resetSiteContainer"
- class="icon-delete-gray"
- hidden="[[shouldHideResetButton_(model, readOnlyList)]]">
- <button id="resetSite" on-click="onResetButtonTap_"
- aria-label="$i18n{siteSettingsActionReset}" focus-row-control
- focus-type="reset"></button>
- </paper-icon-button-light>
- <paper-icon-button-light id="actionMenuButtonContainer"
- class="icon-more-vert"
- hidden="[[shouldHideActionMenu_(model, readOnlyList)]]">
- <button id="actionMenuButton" on-click="onShowActionMenuTap_"
- title="$i18n{moreActions}" focus-row-control focus-type="menu">
- </button>
- </paper-icon-button-light>
+ <cr-icon-button id="resetSite" class="icon-delete-gray"
+ hidden="[[shouldHideResetButton_(model, readOnlyList)]]"
+ on-click="onResetButtonTap_"
+ aria-label="$i18n{siteSettingsActionReset}" focus-row-control
+ focus-type="reset"></cr-icon-button>
+ <cr-icon-button id="actionMenuButton" class="icon-more-vert"
+ hidden="[[shouldHideActionMenu_(model, readOnlyList)]]"
+ on-click="onShowActionMenuTap_" title="$i18n{moreActions}"
+ focus-row-control focus-type="menu"></cr-icon-button>
</div>
</template>
<script src="site_list_entry.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_settings_behavior.js b/chromium/chrome/browser/resources/settings/site_settings/site_settings_behavior.js
index 75bb6d59574..309b8082c60 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_settings_behavior.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_settings_behavior.js
@@ -195,12 +195,12 @@ const SiteSettingsBehaviorImpl = {
addOrRemoveSettingWithFlag(
settings.ContentSettingsTypes.SENSORS, 'enableSensorsContentSetting');
addOrRemoveSettingWithFlag(
+ settings.ContentSettingsTypes.SERIAL_PORTS,
+ 'enableExperimentalWebPlatformFeatures');
+ addOrRemoveSettingWithFlag(
settings.ContentSettingsTypes.ADS,
'enableSafeBrowsingSubresourceFilter');
addOrRemoveSettingWithFlag(
- settings.ContentSettingsTypes.CLIPBOARD,
- 'enableClipboardContentSetting');
- addOrRemoveSettingWithFlag(
settings.ContentSettingsTypes.PAYMENT_HANDLER,
'enablePaymentHandlerContentSetting');
return this.contentTypes_.slice(0);
diff --git a/chromium/chrome/browser/resources/settings/site_settings/zoom_levels.html b/chromium/chrome/browser/resources/settings/site_settings/zoom_levels.html
index 4342bcf2fe2..f83154708ff 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/zoom_levels.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/zoom_levels.html
@@ -1,10 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/list_property_update_behavior.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../site_favicon.html">
@@ -46,11 +46,9 @@
<span class="url-directionality">[[item.displayName]]</span>
</div>
<div class="zoom-label">[[item.zoom]]</div>
- <paper-icon-button-light class="icon-clear">
- <button on-click="removeZoomLevel_"
- title="$i18n{siteSettingsRemoveZoomLevel}"
- tabindex$="[[tabIndex]]"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-clear" on-click="removeZoomLevel_"
+ title="$i18n{siteSettingsRemoveZoomLevel}"
+ tabindex$="[[tabIndex]]"></cr-icon-button>
</div>
</template>
</iron-list>
diff --git a/chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.html b/chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.html
index 3109d0976d3..858b13b7be4 100644
--- a/chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.html
+++ b/chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.html
@@ -4,7 +4,6 @@
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
@@ -194,6 +193,22 @@
'$i18nPolymer{siteSettingsUsbDevicesAsk}',
'$i18nPolymer{siteSettingsUsbDevicesBlock}')]]"></cr-link-row>
+ <template is="dom-if" if="[[enableExperimentalWebPlatformFeatures_]]">
+ <cr-link-row
+ class="hr two-line"
+ data-route="SITE_SETTINGS_SERIAL_PORTS"
+ icon-class="subpage-arrow"
+ id="serial-ports"
+ label="$i18n{siteSettingsSerialPorts}"
+ on-click="onTapNavigate_"
+ start-icon="settings:serial-port"
+ sub-label="[[defaultSettingLabel_(
+ default_.serialPorts,
+ '$i18nPolymer{siteSettingsSerialPortsAsk}',
+ '$i18nPolymer{siteSettingsSerialPortsBlock}')]]">
+ </cr-link-row>
+ </template>
+
<cr-link-row class="hr" data-route="SITE_SETTINGS_PDF_DOCUMENTS"
id="pdf-documents" label="$i18n{siteSettingsPdfDocuments}"
on-click="onTapNavigate_" start-icon="settings:pdf"></cr-link-row>
@@ -203,15 +218,15 @@
on-click="onTapNavigate_" start-icon="settings:protected-content">
</cr-link-row>
- <template is="dom-if" if="[[enableClipboardContentSetting_]]">
- <cr-link-row class="hr two-line" data-route="SITE_SETTINGS_CLIPBOARD"
- id="clipboard" label="$i18n{siteSettingsClipboard}"
- on-click="onTapNavigate_" start-icon="settings:clipboard"
- sub-label="[[defaultSettingLabel_(
- default_.clipboard,
- '$i18nPolymer{siteSettingsAskBeforeAccessing}',
- '$i18nPolymer{siteSettingsBlocked}')]]"></cr-link-row>
- </template>
+ <cr-link-row class="hr two-line" data-route="SITE_SETTINGS_CLIPBOARD"
+ id="clipboard" label="$i18n{siteSettingsClipboard}"
+ on-click="onTapNavigate_" start-icon="settings:clipboard"
+ sub-label="[[defaultSettingLabel_(
+ default_.clipboard,
+ '$i18nPolymer{siteSettingsAskBeforeAccessing}',
+ '$i18nPolymer{siteSettingsBlocked}')]]">
+ </cr-link-row>
+
<template is="dom-if" if="[[enablePaymentHandlerContentSetting_]]">
<cr-link-row class="hr two-line"
data-route="SITE_SETTINGS_PAYMENT_HANDLER" id="paymentHandler"
diff --git a/chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.js b/chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.js
index 0905c392b33..278ecb99344 100644
--- a/chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.js
+++ b/chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.js
@@ -52,20 +52,20 @@ Polymer({
},
/** @private */
- enableClipboardContentSetting_: {
+ enableSensorsContentSetting_: {
type: Boolean,
+ readOnly: true,
value: function() {
- return loadTimeData.getBoolean('enableClipboardContentSetting');
+ return loadTimeData.getBoolean('enableSensorsContentSetting');
}
},
/** @private */
- enableSensorsContentSetting_: {
+ enableExperimentalWebPlatformFeatures_: {
type: Boolean,
- readOnly: true,
value: function() {
- return loadTimeData.getBoolean('enableSensorsContentSetting');
- }
+ return loadTimeData.getBoolean('enableExperimentalWebPlatformFeatures');
+ },
},
/** @private */
@@ -126,6 +126,10 @@ Polymer({
pairs.push([R.SITE_SETTINGS_PAYMENT_HANDLER, 'paymentHandler']);
}
+ if (this.enableExperimentalWebPlatformFeatures_) {
+ pairs.push([R.SITE_SETTINGS_SERIAL_PORTS, 'serial-ports']);
+ }
+
pairs.forEach(([route, id]) => {
this.focusConfig.set(route.path, () => this.async(() => {
cr.ui.focusWithoutInk(assert(this.$$(`#${id}`)));
diff --git a/chromium/chrome/browser/resources/settings/system_page/system_page.html b/chromium/chrome/browser/resources/settings/system_page/system_page.html
index b9ce6d7e0ee..256673d3432 100644
--- a/chromium/chrome/browser/resources/settings/system_page/system_page.html
+++ b/chromium/chrome/browser/resources/settings/system_page/system_page.html
@@ -1,8 +1,8 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../controls/extension_controlled_indicator.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../lifetime_browser_proxy.html">
@@ -32,10 +32,9 @@
<div id="proxy" class="settings-box" on-click="onProxyTap_"
actionable$="[[!isProxyEnforcedByPolicy_]]">
<div class="start">$i18n{proxySettingsLabel}</div>
- <paper-icon-button-light class="icon-external"
- hidden$="[[isProxyEnforcedByPolicy_]]">
- <button aria-label="$i18n{proxySettingsLabel}"></button>
- </paper-icon-button-light>
+ <cr-icon-button class="icon-external"
+ hidden$="[[isProxyEnforcedByPolicy_]]"
+ aria-label="$i18n{proxySettingsLabel}"></cr-icon-button>
<template is="dom-if" if="[[isProxyEnforcedByPolicy_]]">
<cr-policy-pref-indicator pref="[[prefs.proxy]]"
icon-aria-label="$i18n{proxySettingsLabel}">
diff --git a/chromium/chrome/browser/resources/signin/dice_sync_confirmation/images/sync_confirmation_illustration.svg b/chromium/chrome/browser/resources/signin/dice_sync_confirmation/images/sync_confirmation_illustration.svg
index 2c1c44f7863..a0f12625866 100644
--- a/chromium/chrome/browser/resources/signin/dice_sync_confirmation/images/sync_confirmation_illustration.svg
+++ b/chromium/chrome/browser/resources/signin/dice_sync_confirmation/images/sync_confirmation_illustration.svg
@@ -1 +1 @@
-<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 168"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#4285f4;}.cls-3{fill:#e8e9eb;}.cls-4{fill:#f4f4f4;}.cls-5{fill:#bdc0c5;}.cls-6{fill:#34a751;}.cls-7{fill:#f7bb2a;}</style></defs><title>confirmation@1x</title><path class="cls-1" d="M256,89a41,41,0,0,0-41,39.13H297A41,41,0,0,0,256,89Z"/><path class="cls-2" d="M97.76,72H103c0-10.83,2.9-19.34,8.63-25.3,9-9.37,22.15-9.41,22.28-9.41L134,32c-.62,0-15.32,0-25.84,10.91C101.37,49.9,97.76,59.69,97.76,72Z"/><path class="cls-3" d="M82.41,102.42A35.27,35.27,0,0,1,67,106.75V112a40.36,40.36,0,0,0,18-5c8.23-4.61,18-14.42,18-35H97.76C97.76,86.48,92.6,96.71,82.41,102.42Z"/><path class="cls-3" d="M143.78,33.27v5.33h7.41a6.35,6.35,0,0,1-2.77,4.15,8.28,8.28,0,0,1-12.36-4.35h0a8.29,8.29,0,0,1,7.71-10.91A7.52,7.52,0,0,1,149,29.54L153,25.59A13.22,13.22,0,0,0,143.78,22a13.75,13.75,0,0,0-12.3,7.6,13.64,13.64,0,0,0,0,12.35h0a13.76,13.76,0,0,0,12.3,7.59,13.15,13.15,0,0,0,9.12-3.33A13.46,13.46,0,0,0,157,36.09a15.82,15.82,0,0,0-.25-2.82Z"/><path class="cls-3" d="M433,109h18v-8.48A11,11,0,0,0,433,109Z"/><path class="cls-3" d="M491,59.49H460.8a5.6,5.6,0,0,0-5.59,5.59v72.36A5.6,5.6,0,0,0,460.8,143H491a5.6,5.6,0,0,0,5.59-5.59V65.08A5.6,5.6,0,0,0,491,59.49Zm4.89,77.95a4.89,4.89,0,0,1-4.89,4.89H460.8a4.89,4.89,0,0,1-4.89-4.89V65.08a4.89,4.89,0,0,1,4.89-4.89H491a4.89,4.89,0,0,1,4.89,4.89Z"/><path class="cls-3" d="M418.43,92.8c6.1-10.92,17.06-16.46,32.56-16.46V70.72c-22,0-32.53,10.52-37.46,19.34a43.35,43.35,0,0,0-5.36,19.27h5.62A37.88,37.88,0,0,1,418.43,92.8Z"/><path class="cls-3" d="M342,50.45a9.28,9.28,0,0,1-8.17-4.86l-9.38-16.21A21.84,21.84,0,0,0,321,40.92a21,21,0,0,0,17.56,20.86l7-11.94A10.66,10.66,0,0,1,342,50.45Z"/><path class="cls-3" d="M347.91,33.67A9.58,9.58,0,0,1,351.45,41a8.47,8.47,0,0,1-1.28,4.61L340.66,62h1.26a20.93,20.93,0,0,0,15.21-6.49h-2.81a8.64,8.64,0,0,1,7.82-8.6,20.8,20.8,0,0,0,.87-5.82,21.63,21.63,0,0,0-1.23-7.35Z"/><path class="cls-3" d="M342,31.55l18.69.07a20.52,20.52,0,0,0-13.78-11A50.49,50.49,0,0,0,341,.16L341,0h-6c.6.9,1.14,1.79,1.62,2.67A44.81,44.81,0,0,1,341.83,20a20.87,20.87,0,0,0-15.94,7.49l6.88,12A9.47,9.47,0,0,1,342,31.55Z"/><circle class="cls-3" cx="342" cy="41" r="7.35" transform="translate(299.63 382.83) rotate(-89.77)"/><path class="cls-3" d="M258.56,166.88A37.06,37.06,0,0,1,221.77,144H226v-8.48a11,11,0,0,0-6.86-2.51c0-.16,0-.32,0-.48a37,37,0,0,1,34.36-39.47l-.07-1a38,38,0,0,0-35.29,40.53c0,.15,0,.3,0,.45A11,11,0,0,0,208,144h12.68a38,38,0,0,0,73.21-11.35l-1-.07A37,37,0,0,1,258.56,166.88Z"/><path class="cls-4" d="M62.72,48.5H0v88.33H67.51V53.28A4.78,4.78,0,0,0,62.72,48.5Z"/><path class="cls-5" d="M68,53.28A5.3,5.3,0,0,0,62.72,48H0v1H62.72A4.28,4.28,0,0,1,67,53.28v83.06H0v1H68Z"/><rect class="cls-5" y="143.01" width="86" height="0.99"/><path class="cls-5" d="M451.72,139.1V63.73a7.9,7.9,0,0,1,7.89-7.89h25.07v-.7H459.62a8.6,8.6,0,0,0-8.6,8.59V139.1a8.6,8.6,0,0,0,8.6,8.59H472V147H459.62A7.9,7.9,0,0,1,451.72,139.1Z"/><path class="cls-5" d="M495.22,55.55v.75a7.9,7.9,0,0,1,5.26,7.43V139.1a7.9,7.9,0,0,1-7.89,7.89H480.2v.7h12.39a8.6,8.6,0,0,0,8.6-8.59V63.73A8.61,8.61,0,0,0,495.22,55.55Z"/><path class="cls-6" d="M499.48,7.6c-11.6,11.7-11.6,28-11.59,28.74,0,.15,0,14.78-10,24.78-6.34,6.37-15.38,9.6-26.89,9.6v5.62c13.08,0,23.48-3.8,30.91-11.3,11.6-11.7,11.6-28,11.59-28.74,0-.15,0-14.78,10-24.78A29.73,29.73,0,0,1,512,5.58V0h-1.28A35.46,35.46,0,0,0,499.48,7.6Z"/><path class="cls-1" d="M62.56,99.28a11.77,11.77,0,0,0-9.48,5,7.42,7.42,0,0,0-2.7-.52c-4.49,0-8.12,4-8.12,9H74.75C74.75,105.3,69.29,99.28,62.56,99.28Z"/><path class="cls-5" d="M68,70v.53a8.35,8.35,0,0,1,8.44,7.94H68V79h9v-.26A8.88,8.88,0,0,0,68,70Z"/><path class="cls-5" d="M166.5,81a2,2,0,0,1,2-2h4.72V77a2.55,2.55,0,0,1,5.11,0V79h.49V77a3,3,0,0,0-6.09,0v1.44h-4.23A2.48,2.48,0,0,0,166,81v4.5h.49Z"/><path class="cls-5" d="M187,85.19h-1.43V81A2.49,2.49,0,0,0,183,78.48h-3.25V79H183a2,2,0,0,1,2,2v4.72H187a2.55,2.55,0,0,1,0,5.11H185v.49H187a3,3,0,0,0,0-6.09Z"/><path class="cls-5" d="M185,95.52a2,2,0,0,1-2,2h-4V96.08a3.27,3.27,0,0,0-6.54,0V98H173V96.08a2.78,2.78,0,0,1,5.56,0V98H183a2.49,2.49,0,0,0,2.48-2.48V92.26H185Z"/><path class="cls-5" d="M166.49,95.52v-4h1.43a3.27,3.27,0,1,0,0-6.54h-.24v.49h.24a2.78,2.78,0,0,1,0,5.56H166v4.5A2.49,2.49,0,0,0,168.48,98h3v-.49h-3A2,2,0,0,1,166.49,95.52Z"/><path class="cls-5" d="M231.5,32.3V47.11h2.64V32.3Zm2.15,14.32H232V32.79h1.66Z"/><path class="cls-5" d="M234.61,28H207.39A2.4,2.4,0,0,0,205,30.39v3.1h.49v-3.1a1.9,1.9,0,0,1,1.9-1.9h27.21a1.9,1.9,0,0,1,1.9,1.9V49a1.9,1.9,0,0,1-1.9,1.9H207.39a1.9,1.9,0,0,1-1.9-1.9V42.48l1.87,2.58,2.14-1.55-2.13-2.93,3.44-1.12L210,36.95l-3.43,1.11V34.44H205v.49h1.07v3.8l3.61-1.17.51,1.57-3.62,1.17,2.24,3.08-1.34,1L205,41v8a2.4,2.4,0,0,0,2.39,2.39h27.21A2.4,2.4,0,0,0,237,49V30.39A2.4,2.4,0,0,0,234.61,28Z"/><path class="cls-5" d="M219.68,34.44v3.62l-3.43-1.11-.82,2.51,3.44,1.12-2.13,2.93,2.14,1.55L221,42.14l2.12,2.92,2.14-1.55-2.13-2.93,3.44-1.12-.82-2.51-3.43,1.11V34.44Zm5.75,3.13.51,1.57-3.61,1.17,2.24,3.08-1.34,1L221,41.31l-2.23,3.06-1.34-1,2.24-3.08-3.62-1.17.51-1.57,3.61,1.17v-3.8h1.66v3.8Z"/><polygon class="cls-5" points="296.75 69.86 296.25 69.86 296.25 73.61 291.05 68.41 296.25 63.2 296.25 66.96 296.75 66.96 296.75 62 290.34 68.41 296.75 74.82 296.75 69.86"/><polygon class="cls-5" points="296.25 87.28 296.75 87.28 296.75 83.53 301.95 88.73 296.75 93.94 296.75 90.19 296.25 90.19 296.25 95.14 302.66 88.73 296.25 82.32 296.25 87.28"/><path class="cls-5" d="M296.5,68.07v.5a10,10,0,0,1,8.62,15.08l.43.25a10.5,10.5,0,0,0-9-15.83Z"/><path class="cls-5" d="M296.5,88.57a10,10,0,0,1-8.62-15.08l-.43-.25a10.5,10.5,0,0,0,9,15.83Z"/><path class="cls-5" d="M47,31.7V20.58H23.49v-3a2.1,2.1,0,0,1,2.09-2.11H44.4a2.11,2.11,0,0,1,2.11,2.11v2H47v-2A2.6,2.6,0,0,0,44.4,15H25.6A2.59,2.59,0,0,0,23,17.6v3.48H46.51V31.7a2.11,2.11,0,0,1-2.11,2.11H25.6a2.11,2.11,0,0,1-2.11-2.11v-8H45.94V23.2H23v8.5a2.6,2.6,0,0,0,2.6,2.6H44.4A2.6,2.6,0,0,0,47,31.7Z"/><path class="cls-5" d="M354,101.55a4.78,4.78,0,1,0,4.78,4.78A4.79,4.79,0,0,0,354,101.55Zm0,9.06a4.28,4.28,0,1,1,4.28-4.28A4.28,4.28,0,0,1,354,110.62Z"/><path class="cls-5" d="M365.9,102.27l-2.41-4.18a.88.88,0,0,0-1.05-.38l-2.88,1.16a9,9,0,0,0-1.85-1.07l-.43-3.06a.85.85,0,0,0-.85-.73h-4.84a.84.84,0,0,0-.84.73l-.43,3.06a9.33,9.33,0,0,0-1.85,1.07l-2.88-1.16a.85.85,0,0,0-1,.38l-2.42,4.19a.84.84,0,0,0,.22,1.09l2.44,1.9a7.56,7.56,0,0,0-.09,1.07,8,8,0,0,0,.07,1.07l-2.44,1.91a.88.88,0,0,0-.21,1.09l2.41,4.18a.87.87,0,0,0,1.05.38l2.88-1.16a9,9,0,0,0,1.85,1.07l.44,3.07a.87.87,0,0,0,.85.72h4.84a.83.83,0,0,0,.84-.73l.43-3.06a9.34,9.34,0,0,0,1.85-1.07l2.88,1.16a.85.85,0,0,0,1-.38l2.42-4.19a.84.84,0,0,0-.22-1.09l-2.41-1.91a9.82,9.82,0,0,0,.06-1.07,7.93,7.93,0,0,0-.07-1.07l2.44-1.91A.88.88,0,0,0,365.9,102.27Zm-.52.7-2.67,2.09,0,.15a7.28,7.28,0,0,1,.09,1.14,9.76,9.76,0,0,1-.07,1.15l0,.14,2.64,2.09a.33.33,0,0,1,.08.44L363,114.34a.34.34,0,0,1-.43.16l-3.14-1.26-.11.09a8.89,8.89,0,0,1-2,1.15l-.13.05-.47,3.36a.33.33,0,0,1-.34.29h-4.84a.36.36,0,0,1-.36-.3l-.47-3.34-.13-.06a8.58,8.58,0,0,1-2-1.15l-.11-.09-3.12,1.26a.36.36,0,0,1-.44-.16l-2.41-4.18a.37.37,0,0,1,.08-.45l2.67-2.09,0-.15a7.4,7.4,0,0,1-.09-1.14,7.28,7.28,0,0,1,.1-1.14l0-.15L342.64,103a.33.33,0,0,1-.08-.44L345,98.33a.34.34,0,0,1,.43-.16l3.14,1.26.11-.09a8.9,8.9,0,0,1,2-1.15l.13-.05.47-3.34a.34.34,0,0,1,.34-.3h4.84a.35.35,0,0,1,.36.3l.47,3.35.13.05a8.58,8.58,0,0,1,2,1.15l.11.09,3.12-1.26a.36.36,0,0,1,.44.16l2.41,4.18A.37.37,0,0,1,365.37,103Z"/><path class="cls-5" d="M62.56,99A12,12,0,0,0,53,104a7.64,7.64,0,0,0-2.62-.47c-4.62,0-8.38,4.14-8.38,9.24V113H75v-.28C75,105.15,69.42,99,62.56,99Zm11.93,13.44h-32c.13-4.66,3.61-8.4,7.87-8.4a7.19,7.19,0,0,1,2.62.5l.17.07.11-.15a11.5,11.5,0,0,1,9.28-4.9C69.06,99.56,74.35,105.31,74.49,112.44Z"/><path class="cls-5" d="M375.91,42.28a13.18,13.18,0,0,0-10.17,4.77A8.89,8.89,0,0,0,354,55.51v.27h35.1v-.27A13.24,13.24,0,0,0,375.91,42.28Zm-21.33,13a8.35,8.35,0,0,1,11.15-7.61l.18.06.12-.15a12.69,12.69,0,0,1,22.56,7.7Z"/><path class="cls-5" d="M441,33.51a2.5,2.5,0,1,0-2.5-2.5A2.51,2.51,0,0,0,441,33.51ZM441,29a2,2,0,1,1-2,2A2,2,0,0,1,441,29Z"/><path class="cls-5" d="M441,38a7,7,0,0,0,6.53-4.49H452V38h5V33.51h2v-5H447.53A7,7,0,1,0,441,38Zm0-13.48a6.48,6.48,0,0,1,6.11,4.32l.06.17h11.32v4h-2v4.49h-4V33h-5.3l-.06.17A6.48,6.48,0,1,1,441,24.52Z"/><path class="cls-7" d="M256,92v1a37,37,0,0,1,37,37h1A38,38,0,0,0,256,92Z"/><path class="cls-1" d="M411.08,121A16.81,16.81,0,0,0,398,127.27a11.21,11.21,0,0,0-15,10.58h44.93A16.85,16.85,0,0,0,411.08,121Z"/><path class="cls-3" d="M411.08,121.7a16.17,16.17,0,0,1,16.13,15.44H383.73a10.5,10.5,0,0,1,14-9.22l.47.17.31-.39a16.09,16.09,0,0,1,12.56-6m0-.7A16.81,16.81,0,0,0,398,127.27a11.21,11.21,0,0,0-15,10.58h44.93A16.85,16.85,0,0,0,411.08,121Z"/></svg> \ No newline at end of file
+<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 168"><defs><style>.cls-1{fill:#fff}.cls-3{fill:#e8e9eb}.cls-5{fill:#bdc0c5}</style></defs><path class="cls-1" d="M256 89a41 41 0 0 0-41 39.13h82A41 41 0 0 0 256 89z"/><path d="M97.76 72H103c0-10.83 2.9-19.34 8.63-25.3 9-9.37 22.15-9.41 22.28-9.41L134 32c-.62 0-15.32 0-25.84 10.91-6.79 6.99-10.4 16.78-10.4 29.09z" fill="#4285f4"/><path class="cls-3" d="M82.41 102.42A35.27 35.27 0 0 1 67 106.75V112a40.36 40.36 0 0 0 18-5c8.23-4.61 18-14.42 18-35h-5.24c0 14.48-5.16 24.71-15.35 30.42zM143.78 33.27v5.33h7.41a6.35 6.35 0 0 1-2.77 4.15 8.28 8.28 0 0 1-12.36-4.35 8.29 8.29 0 0 1 7.71-10.91 7.52 7.52 0 0 1 5.23 2.05l4-3.95a13.22 13.22 0 0 0-9.22-3.59 13.75 13.75 0 0 0-12.3 7.6 13.64 13.64 0 0 0 0 12.35 13.76 13.76 0 0 0 12.3 7.59 13.15 13.15 0 0 0 9.12-3.33 13.46 13.46 0 0 0 4.1-10.12 15.82 15.82 0 0 0-.25-2.82zM433 109h18v-8.48a11 11 0 0 0-18 8.48zM491 59.49h-30.2a5.6 5.6 0 0 0-5.59 5.59v72.36a5.6 5.6 0 0 0 5.59 5.56H491a5.6 5.6 0 0 0 5.59-5.59V65.08a5.6 5.6 0 0 0-5.59-5.59zm4.89 77.95a4.89 4.89 0 0 1-4.89 4.89h-30.2a4.89 4.89 0 0 1-4.89-4.89V65.08a4.89 4.89 0 0 1 4.89-4.89H491a4.89 4.89 0 0 1 4.89 4.89zM418.43 92.8c6.1-10.92 17.06-16.46 32.56-16.46v-5.62c-22 0-32.53 10.52-37.46 19.34a43.35 43.35 0 0 0-5.36 19.27h5.62a37.88 37.88 0 0 1 4.64-16.53zM342 50.45a9.28 9.28 0 0 1-8.17-4.86l-9.38-16.21A21.84 21.84 0 0 0 321 40.92a21 21 0 0 0 17.56 20.86l7-11.94a10.66 10.66 0 0 1-3.56.61z"/><path class="cls-3" d="M347.91 33.67a9.58 9.58 0 0 1 3.54 7.33 8.47 8.47 0 0 1-1.28 4.61L340.66 62h1.26a20.93 20.93 0 0 0 15.21-6.49h-2.81a8.64 8.64 0 0 1 7.82-8.6 20.8 20.8 0 0 0 .87-5.82 21.63 21.63 0 0 0-1.23-7.35z"/><path class="cls-3" d="M342 31.55l18.69.07a20.52 20.52 0 0 0-13.78-11A50.49 50.49 0 0 0 341 .16V0h-6c.6.9 1.14 1.79 1.62 2.67A44.81 44.81 0 0 1 341.83 20a20.87 20.87 0 0 0-15.94 7.49l6.88 12a9.47 9.47 0 0 1 9.23-7.94z"/><circle class="cls-3" cx="342" cy="41" r="7.35" transform="rotate(-89.77 342 40.997)"/><path class="cls-3" d="M258.56 166.88A37.06 37.06 0 0 1 221.77 144H226v-8.48a11 11 0 0 0-6.86-2.51v-.48a37 37 0 0 1 34.36-39.47l-.07-1a38 38 0 0 0-35.29 40.53v.45A11 11 0 0 0 208 144h12.68a38 38 0 0 0 73.21-11.35l-1-.07a37 37 0 0 1-34.33 34.3z"/><path d="M62.72 48.5H0v88.33h67.51V53.28a4.78 4.78 0 0 0-4.79-4.78z" fill="#f4f4f4"/><path class="cls-5" d="M68 53.28A5.3 5.3 0 0 0 62.72 48H0v1h62.72A4.28 4.28 0 0 1 67 53.28v83.06H0v1h68zM0 143.01h86v.99H0zM451.72 139.1V63.73a7.9 7.9 0 0 1 7.89-7.89h25.07v-.7h-25.06a8.6 8.6 0 0 0-8.6 8.59v75.37a8.6 8.6 0 0 0 8.6 8.59H472V147h-12.38a7.9 7.9 0 0 1-7.9-7.9zM495.22 55.55v.75a7.9 7.9 0 0 1 5.26 7.43v75.37a7.9 7.9 0 0 1-7.89 7.89H480.2v.7h12.39a8.6 8.6 0 0 0 8.6-8.59V63.73a8.61 8.61 0 0 0-5.97-8.18z"/><path d="M499.48 7.6c-11.6 11.7-11.6 28-11.59 28.74 0 .15 0 14.78-10 24.78-6.34 6.37-15.38 9.6-26.89 9.6v5.62c13.08 0 23.48-3.8 30.91-11.3 11.6-11.7 11.6-28 11.59-28.74 0-.15 0-14.78 10-24.78a29.73 29.73 0 0 1 8.5-5.94V0h-1.28a35.46 35.46 0 0 0-11.24 7.6z" fill="#34a751"/><path class="cls-1" d="M62.56 99.28a11.77 11.77 0 0 0-9.48 5 7.42 7.42 0 0 0-2.7-.52c-4.49 0-8.12 4-8.12 9h32.49c0-7.46-5.46-13.48-12.19-13.48z"/><path class="cls-5" d="M68 70v.53a8.35 8.35 0 0 1 8.44 7.94H68V79h9v-.26A8.88 8.88 0 0 0 68 70zM166.5 81a2 2 0 0 1 2-2h4.72v-2a2.55 2.55 0 0 1 5.11 0v2h.49v-2a3 3 0 0 0-6.09 0v1.44h-4.23A2.48 2.48 0 0 0 166 81v4.5h.49zM187 85.19h-1.43V81a2.49 2.49 0 0 0-2.57-2.52h-3.25V79H183a2 2 0 0 1 2 2v4.72h2a2.55 2.55 0 0 1 0 5.11h-2v.49h2a3 3 0 0 0 0-6.09zM185 95.52a2 2 0 0 1-2 2h-4v-1.44a3.27 3.27 0 0 0-6.54 0V98h.54v-1.92a2.78 2.78 0 0 1 5.56 0V98H183a2.49 2.49 0 0 0 2.48-2.48v-3.26H185zM166.49 95.52v-4h1.43a3.27 3.27 0 1 0 0-6.54h-.24v.49h.24a2.78 2.78 0 0 1 0 5.56H166v4.5a2.49 2.49 0 0 0 2.48 2.47h3v-.49h-3a2 2 0 0 1-1.99-1.99zM231.5 32.3v14.81h2.64V32.3zm2.15 14.32H232V32.79h1.66z"/><path class="cls-5" d="M234.61 28h-27.22a2.4 2.4 0 0 0-2.39 2.39v3.1h.49v-3.1a1.9 1.9 0 0 1 1.9-1.9h27.21a1.9 1.9 0 0 1 1.9 1.9V49a1.9 1.9 0 0 1-1.9 1.9h-27.21a1.9 1.9 0 0 1-1.9-1.9v-6.52l1.87 2.58 2.14-1.55-2.13-2.93 3.44-1.12-.81-2.51-3.43 1.11v-3.62H205v.49h1.07v3.8l3.61-1.17.51 1.57-3.62 1.17 2.24 3.08-1.34 1L205 41v8a2.4 2.4 0 0 0 2.39 2.39h27.21A2.4 2.4 0 0 0 237 49V30.39a2.4 2.4 0 0 0-2.39-2.39z"/><path class="cls-5" d="M219.68 34.44v3.62l-3.43-1.11-.82 2.51 3.44 1.12-2.13 2.93 2.14 1.55 2.12-2.92 2.12 2.92 2.14-1.55-2.13-2.93 3.44-1.12-.82-2.51-3.43 1.11v-3.62zm5.75 3.13l.51 1.57-3.61 1.17 2.24 3.08-1.34 1-2.23-3.08-2.23 3.06-1.34-1 2.24-3.08-3.62-1.17.51-1.57 3.61 1.17v-3.8h1.66v3.8zM296.75 69.86h-.5v3.75l-5.2-5.2 5.2-5.21v3.76h.5V62l-6.41 6.41 6.41 6.41v-4.96zM296.25 87.28h.5v-3.75l5.2 5.2-5.2 5.21v-3.75h-.5v4.95l6.41-6.41-6.41-6.41v4.96z"/><path class="cls-5" d="M296.5 68.07v.5a10 10 0 0 1 8.62 15.08l.43.25a10.5 10.5 0 0 0-9-15.83zM296.5 88.57a10 10 0 0 1-8.62-15.08l-.43-.25a10.5 10.5 0 0 0 9 15.83zM47 31.7V20.58H23.49v-3a2.1 2.1 0 0 1 2.09-2.11H44.4a2.11 2.11 0 0 1 2.11 2.11v2H47v-2A2.6 2.6 0 0 0 44.4 15H25.6a2.59 2.59 0 0 0-2.6 2.6v3.48h23.51V31.7a2.11 2.11 0 0 1-2.11 2.11H25.6a2.11 2.11 0 0 1-2.11-2.11v-8h22.45v-.5H23v8.5a2.6 2.6 0 0 0 2.6 2.6h18.8a2.6 2.6 0 0 0 2.6-2.6zM354 101.55a4.78 4.78 0 1 0 4.78 4.78 4.79 4.79 0 0 0-4.78-4.78zm0 9.06a4.28 4.28 0 1 1 4.28-4.28 4.28 4.28 0 0 1-4.28 4.29z"/><path class="cls-5" d="M365.9 102.27l-2.41-4.18a.88.88 0 0 0-1.05-.38l-2.88 1.16a9 9 0 0 0-1.85-1.07l-.43-3.06a.85.85 0 0 0-.85-.73h-4.84a.84.84 0 0 0-.84.73l-.43 3.06a9.33 9.33 0 0 0-1.85 1.07l-2.88-1.16a.85.85 0 0 0-1 .38l-2.42 4.19a.84.84 0 0 0 .22 1.09l2.44 1.9a7.56 7.56 0 0 0-.09 1.07 8 8 0 0 0 .07 1.07l-2.44 1.91a.88.88 0 0 0-.21 1.09l2.41 4.18a.87.87 0 0 0 1.05.38l2.88-1.16a9 9 0 0 0 1.85 1.07l.44 3.07a.87.87 0 0 0 .85.72h4.84a.83.83 0 0 0 .84-.73l.43-3.06a9.34 9.34 0 0 0 1.85-1.07l2.88 1.16a.85.85 0 0 0 1-.38l2.42-4.19a.84.84 0 0 0-.22-1.09l-2.41-1.91a9.82 9.82 0 0 0 .06-1.07 7.93 7.93 0 0 0-.07-1.07l2.44-1.91a.88.88 0 0 0 .2-1.08zm-.52.7l-2.67 2.09v.15a7.28 7.28 0 0 1 .09 1.14 9.76 9.76 0 0 1-.07 1.15v.14l2.64 2.09a.33.33 0 0 1 .08.44l-2.45 4.17a.34.34 0 0 1-.43.16l-3.14-1.26-.11.09a8.89 8.89 0 0 1-2 1.15l-.13.05-.47 3.36a.33.33 0 0 1-.34.29h-4.84a.36.36 0 0 1-.36-.3l-.47-3.34-.13-.06a8.58 8.58 0 0 1-2-1.15l-.11-.09-3.12 1.26a.36.36 0 0 1-.44-.16l-2.41-4.18a.37.37 0 0 1 .08-.45l2.67-2.09v-.15a7.4 7.4 0 0 1-.09-1.14 7.28 7.28 0 0 1 .1-1.14v-.15l-2.62-2.04a.33.33 0 0 1-.08-.44l2.44-4.23a.34.34 0 0 1 .43-.16l3.14 1.26.11-.09a8.9 8.9 0 0 1 2-1.15l.13-.05.47-3.34a.34.34 0 0 1 .34-.3h4.84a.35.35 0 0 1 .36.3l.47 3.35.13.05a8.58 8.58 0 0 1 2 1.15l.11.09 3.12-1.26a.36.36 0 0 1 .44.16l2.41 4.18a.37.37 0 0 1-.13.48zM62.56 99a12 12 0 0 0-9.56 5 7.64 7.64 0 0 0-2.62-.47c-4.62 0-8.38 4.14-8.38 9.24v.23h33v-.28C75 105.15 69.42 99 62.56 99zm11.93 13.44h-32c.13-4.66 3.61-8.4 7.87-8.4a7.19 7.19 0 0 1 2.62.5l.17.07.11-.15a11.5 11.5 0 0 1 9.28-4.9c6.52 0 11.81 5.75 11.95 12.88zM375.91 42.28a13.18 13.18 0 0 0-10.17 4.77A8.89 8.89 0 0 0 354 55.51v.27h35.1v-.27a13.24 13.24 0 0 0-13.19-13.23zm-21.33 13a8.35 8.35 0 0 1 11.15-7.61l.18.06.12-.15a12.69 12.69 0 0 1 22.56 7.7zM441 33.51a2.5 2.5 0 1 0-2.5-2.5 2.51 2.51 0 0 0 2.5 2.5zm0-4.51a2 2 0 1 1-2 2 2 2 0 0 1 2-2z"/><path class="cls-5" d="M441 38a7 7 0 0 0 6.53-4.49H452V38h5v-4.49h2v-5h-11.47A7 7 0 1 0 441 38zm0-13.48a6.48 6.48 0 0 1 6.11 4.32l.06.17h11.32v4h-2v4.49h-4V33h-5.3l-.06.17a6.48 6.48 0 1 1-6.13-8.65z"/><path d="M256 92v1a37 37 0 0 1 37 37h1a38 38 0 0 0-38-38z" fill="#f7bb2a"/><path class="cls-1" d="M411.08 121a16.81 16.81 0 0 0-13.08 6.27 11.21 11.21 0 0 0-15 10.58h44.93A16.85 16.85 0 0 0 411.08 121z"/><path class="cls-3" d="M411.08 121.7a16.17 16.17 0 0 1 16.13 15.44h-43.48a10.5 10.5 0 0 1 14-9.22l.47.17.31-.39a16.09 16.09 0 0 1 12.56-6m0-.7a16.81 16.81 0 0 0-13.07 6.27 11.21 11.21 0 0 0-15 10.58h44.93A16.85 16.85 0 0 0 411.08 121z"/></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/signin/dice_sync_confirmation/images/sync_confirmation_illustration_dark.svg b/chromium/chrome/browser/resources/signin/dice_sync_confirmation/images/sync_confirmation_illustration_dark.svg
new file mode 100644
index 00000000000..e75815eafcc
--- /dev/null
+++ b/chromium/chrome/browser/resources/signin/dice_sync_confirmation/images/sync_confirmation_illustration_dark.svg
@@ -0,0 +1 @@
+<svg width="512" height="168" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path fill="#202124" d="M0 0h512v128H0z"/><path d="M256 89c-21.933-.023-40 17.22-41 39.13h82c-1-21.91-19.067-39.153-41-39.13z" fill="#292A2D" fill-rule="nonzero"/><path d="M97.76 72H103c0-10.83 2.9-19.34 8.63-25.3 9-9.37 22.15-9.41 22.28-9.41L134 32c-.62 0-15.32 0-25.84 10.91-6.79 6.99-10.4 16.78-10.4 29.09z" fill="#8AB4F8" fill-rule="nonzero"/><path d="M82.41 102.42A35.27 35.27 0 0 1 67 106.75V112a40.36 40.36 0 0 0 18-5c8.23-4.61 18-14.42 18-35h-5.24c0 14.48-5.16 24.71-15.35 30.42zm61.37-69.15v5.33h7.41a6.35 6.35 0 0 1-2.77 4.15 8.28 8.28 0 0 1-12.36-4.35 8.29 8.29 0 0 1 7.71-10.91 7.52 7.52 0 0 1 5.23 2.05l4-3.95a13.22 13.22 0 0 0-9.22-3.59 13.75 13.75 0 0 0-12.3 7.6 13.64 13.64 0 0 0 0 12.35 13.76 13.76 0 0 0 12.3 7.59 13.15 13.15 0 0 0 9.12-3.33 13.46 13.46 0 0 0 4.1-10.12 15.82 15.82 0 0 0-.25-2.82h-12.97zM433 109h18v-8.48a11 11 0 0 0-18 8.48z" fill="#3C4043" fill-rule="nonzero"/><path d="M491 59.49h-30.2a5.6 5.6 0 0 0-5.59 5.59v72.36a5.6 5.6 0 0 0 5.59 5.56H491a5.6 5.6 0 0 0 5.59-5.59V65.08a5.6 5.6 0 0 0-5.59-5.59zm4.89 77.95c0 2.7-2.19 4.89-4.89 4.89h-30.2a4.89 4.89 0 0 1-4.89-4.89V65.08c0-2.7 2.19-4.89 4.89-4.89H491c2.7 0 4.89 2.19 4.89 4.89v72.36z" fill="#5F6368" fill-rule="nonzero"/><path d="M418.43 92.8c6.1-10.92 17.06-16.46 32.56-16.46v-5.62c-22 0-32.53 10.52-37.46 19.34a43.35 43.35 0 0 0-5.36 19.27h5.62a37.88 37.88 0 0 1 4.64-16.53zM342 50.45a9.28 9.28 0 0 1-8.17-4.86l-9.38-16.21A21.84 21.84 0 0 0 321 40.92c-.07 10.325 7.375 19.169 17.56 20.86l7-11.94a10.66 10.66 0 0 1-3.56.61z" fill="#3C4043" fill-rule="nonzero"/><path d="M347.91 33.67a9.58 9.58 0 0 1 3.54 7.33 8.47 8.47 0 0 1-1.28 4.61L340.66 62h1.26a20.93 20.93 0 0 0 15.21-6.49h-2.81a8.64 8.64 0 0 1 7.82-8.6 20.8 20.8 0 0 0 .87-5.82 21.63 21.63 0 0 0-1.23-7.35l-13.87-.07z" fill="#3C4043" fill-rule="nonzero"/><path d="M342 31.55l18.69.07a20.52 20.52 0 0 0-13.78-11A50.49 50.49 0 0 0 341 .16V0h-6c.6.9 1.14 1.79 1.62 2.67A44.81 44.81 0 0 1 341.83 20a20.87 20.87 0 0 0-15.94 7.49l6.88 12a9.47 9.47 0 0 1 9.23-7.94z" fill="#3C4043" fill-rule="nonzero"/><circle fill="#3C4043" fill-rule="nonzero" transform="rotate(-89.77 342.003 40.997)" cx="342.003" cy="40.997" r="7.35"/><path d="M258.56 166.88A37.06 37.06 0 0 1 221.77 144H226v-8.48a11 11 0 0 0-6.86-2.51v-.48a37 37 0 0 1 34.36-39.47l-.07-1a38 38 0 0 0-35.29 40.53v.45A11 11 0 0 0 208 144h12.68c6.553 16.464 23.616 26.214 41.128 23.499 17.511-2.715 30.822-17.173 32.082-34.849l-1-.07c-1.3 18.39-15.94 33.016-34.33 34.3z" fill="#5F6368" fill-rule="nonzero"/><path d="M62.72 48.5H0v88.33h67.51V53.28a4.78 4.78 0 0 0-4.79-4.78z" fill="#202124" fill-rule="nonzero"/><path d="M68 53.28A5.3 5.3 0 0 0 62.72 48H0v1h62.72A4.28 4.28 0 0 1 67 53.28v83.06H0v1h68V53.28zM0 143.01h86v.99H0z" fill="#3C4043" fill-rule="nonzero"/><path d="M451.72 139.1V63.73a7.9 7.9 0 0 1 7.89-7.89h25.07v-.7h-25.06a8.6 8.6 0 0 0-8.6 8.59v75.37a8.6 8.6 0 0 0 8.6 8.59H472V147h-12.38a7.9 7.9 0 0 1-7.9-7.9zm43.5-83.55v.75a7.9 7.9 0 0 1 5.26 7.43v75.37a7.9 7.9 0 0 1-7.89 7.89H480.2v.7h12.39a8.6 8.6 0 0 0 8.6-8.59V63.73a8.61 8.61 0 0 0-5.97-8.18z" fill="#5F6368" fill-rule="nonzero"/><path d="M499.48 7.6c-11.6 11.7-11.6 28-11.59 28.74 0 .15 0 14.78-10 24.78-6.34 6.37-15.38 9.6-26.89 9.6v5.62c13.08 0 23.48-3.8 30.91-11.3 11.6-11.7 11.6-28 11.59-28.74 0-.15 0-14.78 10-24.78a29.73 29.73 0 0 1 8.5-5.94V0h-1.28a35.46 35.46 0 0 0-11.24 7.6z" fill="#81C995" fill-rule="nonzero"/><path d="M62.56 99.28a11.77 11.77 0 0 0-9.48 5 7.42 7.42 0 0 0-2.7-.52c-4.49 0-8.12 4-8.12 9h32.49c0-7.46-5.46-13.48-12.19-13.48z" fill="#292A2D" fill-rule="nonzero"/><path d="M68 70v.53a8.35 8.35 0 0 1 8.44 7.94H68V79h9v-.26A8.88 8.88 0 0 0 68 70zm98.5 11a2 2 0 0 1 2-2h4.72v-2a2.555 2.555 0 1 1 5.11 0v2h.49v-2a3.045 3.045 0 0 0-6.09 0v1.44h-4.23A2.48 2.48 0 0 0 166 81v4.5h.49l.01-4.5zm20.5 4.19h-1.43V81a2.49 2.49 0 0 0-2.57-2.52h-3.25V79H183a2 2 0 0 1 2 2v4.72h2a2.555 2.555 0 1 1 0 5.11h-2v.49h2a3.045 3.045 0 0 0 0-6.09v-.04zm-2 10.33a2 2 0 0 1-2 2h-4v-1.44a3.27 3.27 0 0 0-6.54 0V98h.54v-1.92a2.78 2.78 0 1 1 5.56 0V98H183a2.49 2.49 0 0 0 2.48-2.48v-3.26H185v3.26zm-18.51 0v-4h1.43a3.27 3.27 0 0 0 0-6.54h-.24v.49h.24a2.78 2.78 0 1 1 0 5.56H166v4.5a2.49 2.49 0 0 0 2.48 2.47h3v-.49h-3a2 2 0 0 1-1.99-1.99zM231.5 32.3v14.81h2.64V32.3h-2.64zm2.15 14.32H232V32.79h1.66l-.01 13.83z" fill="#5F6368" fill-rule="nonzero"/><path d="M234.61 28h-27.22a2.4 2.4 0 0 0-2.39 2.39v3.1h.49v-3.1c0-1.05.85-1.9 1.9-1.9h27.21a1.9 1.9 0 0 1 1.9 1.9V49a1.9 1.9 0 0 1-1.9 1.9h-27.21a1.9 1.9 0 0 1-1.9-1.9v-6.52l1.87 2.58 2.14-1.55-2.13-2.93 3.44-1.12-.81-2.51-3.43 1.11v-3.62H205v.49h1.07v3.8l3.61-1.17.51 1.57-3.62 1.17 2.24 3.08-1.34 1L205 41v8a2.4 2.4 0 0 0 2.39 2.39h27.21A2.4 2.4 0 0 0 237 49V30.39a2.4 2.4 0 0 0-2.39-2.39z" fill="#5F6368" fill-rule="nonzero"/><path d="M219.68 34.44v3.62l-3.43-1.11-.82 2.51 3.44 1.12-2.13 2.93 2.14 1.55 2.12-2.92 2.12 2.92 2.14-1.55-2.13-2.93 3.44-1.12-.82-2.51-3.43 1.11v-3.62h-2.64zm5.75 3.13l.51 1.57-3.61 1.17 2.24 3.08-1.34 1-2.23-3.08-2.23 3.06-1.34-1 2.24-3.08-3.62-1.17.51-1.57 3.61 1.17v-3.8h1.66v3.8l3.6-1.15zm70.82 32.29v3.75l-5.2-5.2 5.2-5.21v3.76h.5V62l-6.41 6.41 6.41 6.41v-4.96zm0 17.42h.5v-3.75l5.2 5.2-5.2 5.21v-3.75h-.5v4.95l6.41-6.41-6.41-6.41z" fill="#5F6368" fill-rule="nonzero"/><path d="M296.5 68.07v.5a10 10 0 0 1 8.62 15.08l.43.25a10.5 10.5 0 0 0-9-15.83h-.05zm0 20.5a10 10 0 0 1-8.62-15.08l-.43-.25a10.5 10.5 0 0 0 9 15.83l.05-.5zM47 31.7V20.58H23.49v-3a2.1 2.1 0 0 1 2.09-2.11H44.4a2.11 2.11 0 0 1 2.11 2.11v2H47v-2A2.6 2.6 0 0 0 44.4 15H25.6a2.59 2.59 0 0 0-2.6 2.6v3.48h23.51V31.7a2.11 2.11 0 0 1-2.11 2.11H25.6a2.11 2.11 0 0 1-2.11-2.11v-8h22.45v-.5H23v8.5a2.6 2.6 0 0 0 2.6 2.6h18.8a2.6 2.6 0 0 0 2.6-2.6zm307 69.85a4.78 4.78 0 1 0 4.78 4.78 4.79 4.79 0 0 0-4.78-4.78zm0 9.06a4.28 4.28 0 1 1 4.28-4.28 4.28 4.28 0 0 1-4.28 4.29v-.01z" fill="#5F6368" fill-rule="nonzero"/><path d="M365.9 102.27l-2.41-4.18a.88.88 0 0 0-1.05-.38l-2.88 1.16a9 9 0 0 0-1.85-1.07l-.43-3.06a.85.85 0 0 0-.85-.73h-4.84a.84.84 0 0 0-.84.73l-.43 3.06a9.33 9.33 0 0 0-1.85 1.07l-2.88-1.16a.85.85 0 0 0-1 .38l-2.42 4.19a.84.84 0 0 0 .22 1.09l2.44 1.9a7.56 7.56 0 0 0-.09 1.07 8 8 0 0 0 .07 1.07l-2.44 1.91a.88.88 0 0 0-.21 1.09l2.41 4.18a.87.87 0 0 0 1.05.38l2.88-1.16a9 9 0 0 0 1.85 1.07l.44 3.07a.87.87 0 0 0 .85.72h4.84a.83.83 0 0 0 .84-.73l.43-3.06a9.34 9.34 0 0 0 1.85-1.07l2.88 1.16a.85.85 0 0 0 1-.38l2.42-4.19a.84.84 0 0 0-.22-1.09l-2.41-1.91c.04-.355.06-.713.06-1.07a7.93 7.93 0 0 0-.07-1.07l2.44-1.91a.88.88 0 0 0 .2-1.08zm-.52.7l-2.67 2.09v.15c.06.377.09.758.09 1.14 0 .384-.024.768-.07 1.15v.14l2.64 2.09a.33.33 0 0 1 .08.44l-2.45 4.17a.34.34 0 0 1-.43.16l-3.14-1.26-.11.09a8.89 8.89 0 0 1-2 1.15l-.13.05-.47 3.36a.33.33 0 0 1-.34.29h-4.84a.36.36 0 0 1-.36-.3l-.47-3.34-.13-.06a8.58 8.58 0 0 1-2-1.15l-.11-.09-3.12 1.26a.36.36 0 0 1-.44-.16l-2.41-4.18a.37.37 0 0 1 .08-.45l2.67-2.09v-.15a7.4 7.4 0 0 1-.09-1.14 7.28 7.28 0 0 1 .1-1.14v-.15l-2.62-2.04a.33.33 0 0 1-.08-.44l2.44-4.23a.34.34 0 0 1 .43-.16l3.14 1.26.11-.09a8.9 8.9 0 0 1 2-1.15l.13-.05.47-3.34a.34.34 0 0 1 .34-.3h4.84a.35.35 0 0 1 .36.3l.47 3.35.13.05a8.58 8.58 0 0 1 2 1.15l.11.09 3.12-1.26a.36.36 0 0 1 .44.16l2.41 4.18a.37.37 0 0 1-.13.48l.01-.03zM62.56 99a12 12 0 0 0-9.56 5 7.64 7.64 0 0 0-2.62-.47c-4.62 0-8.38 4.14-8.38 9.24v.23h33v-.28C75 105.15 69.42 99 62.56 99zm11.93 13.44h-32c.13-4.66 3.61-8.4 7.87-8.4a7.19 7.19 0 0 1 2.62.5l.17.07.11-.15a11.5 11.5 0 0 1 9.28-4.9c6.52 0 11.81 5.75 11.95 12.88zm301.42-70.16a13.18 13.18 0 0 0-10.17 4.77A8.89 8.89 0 0 0 354 55.51v.27h35.1v-.27c-.005-7.289-5.901-13.202-13.19-13.23zm-21.33 13a8.35 8.35 0 0 1 11.15-7.61l.18.06.12-.15a12.69 12.69 0 0 1 22.56 7.7h-34.01zM441 33.51a2.5 2.5 0 1 0-2.5-2.5 2.51 2.51 0 0 0 2.5 2.5zm0-4.51a2 2 0 1 1 0 4 2 2 0 0 1 0-4z" fill="#5F6368" fill-rule="nonzero"/><path d="M441 38a7 7 0 0 0 6.53-4.49H452V38h5v-4.49h2v-5h-11.47A7 7 0 1 0 441 38zm0-13.48a6.48 6.48 0 0 1 6.11 4.32l.06.17h11.32v4h-2v4.49h-4V33h-5.3l-.06.17a6.48 6.48 0 1 1-6.13-8.65z" fill="#5F6368" fill-rule="nonzero"/><path d="M256 92v1c20.435 0 37 16.565 37 37h1c0-20.987-17.013-38-38-38z" fill="#FED563" fill-rule="nonzero"/><path d="M411.08 121a16.81 16.81 0 0 0-13.08 6.27 11.21 11.21 0 0 0-15 10.58h44.93c0-9.306-7.544-16.85-16.85-16.85z" fill="#292A2D" fill-rule="nonzero"/><path d="M411.08 121.7c8.637.013 15.74 6.811 16.13 15.44h-43.48a10.5 10.5 0 0 1 14-9.22l.47.17.31-.39a16.09 16.09 0 0 1 12.56-6h.01zm-.01-.7a16.81 16.81 0 0 0-13.07 6.27 11.21 11.21 0 0 0-15 10.58h44.93c0-9.306-7.544-16.85-16.85-16.85h-.01z" fill="#5F6368" fill-rule="nonzero"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation.html b/chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation.html
index 2e52ef9dc28..7654603c402 100644
--- a/chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation.html
+++ b/chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation.html
@@ -1,8 +1,8 @@
<!doctype html>
-<html dir="$i18n{textdirection}" lang="$i18n{language}">
+<html dir="$i18n{textdirection}" lang="$i18n{language}" $i18n{dark}>
<head>
<meta charset="utf-8">
- <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
+ <link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="import" href="sync_confirmation_app.html"></link>
<style>
body {
@@ -10,12 +10,17 @@
padding: 0;
width: 512px;
}
+ [dark] body {
+ background-color: var(--md-background-color);
+ }
</style>
</head>
<body>
<sync-confirmation-app></sync-confirmation-app>
</body>
- <script src="chrome://resources/js/cr.js"></script>
- <script src="chrome://resources/js/util.js"></script>
+ <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
+ <link rel="import" href="chrome://resources/html/cr.html"></script>
+ <link rel="import" href="chrome://resources/html/util.html"></script>
<script src="sync_confirmation.js"></script>
+ <link rel="import" href="chrome://resources/html/dark_mode.html">
</html>
diff --git a/chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation_app.html b/chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation_app.html
index b2dcd13cb9b..badf36b444c 100644
--- a/chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation_app.html
+++ b/chromium/chrome/browser/resources/signin/dice_sync_confirmation/sync_confirmation_app.html
@@ -15,12 +15,13 @@
<template>
<style include="signin-dialog-shared paper-button-style">
:host {
+ color: var(--cr-primary-text-color);
display: block;
}
paper-button {
- padding-left: 16px;
- padding-right: 16px;
+ padding-inline-end: 16px;
+ padding-inline-start: 16px;
}
.action-container {
@@ -58,8 +59,11 @@
width: 100%;
}
+ :host-context([dark]) #illustration {
+ background-image: url(./images/sync_confirmation_illustration_dark.svg);
+ }
+
#illustration-container > img {
- background: white;
border-radius: 50%;
height: 68px;
left: 0;
@@ -71,7 +75,6 @@
}
.heading {
- color: var(--paper-grey-800);
font-weight: normal;
margin-bottom: 32px;
padding: 0 24px;
@@ -92,10 +95,10 @@
}
.secondary {
- color: var(--paper-grey-600);
+ color: var(--cr-secondary-text-color);
}
- #grey-banner {
+ :host-context(html:not([dark])) #grey-banner {
background: var(--paper-grey-50);
height: 128px;
top: 0;
diff --git a/chromium/chrome/browser/resources/signin/signin_shared_css.html b/chromium/chrome/browser/resources/signin/signin_shared_css.html
index 4efc337a197..8267ae51398 100644
--- a/chromium/chrome/browser/resources/signin/signin_shared_css.html
+++ b/chromium/chrome/browser/resources/signin/signin_shared_css.html
@@ -1,9 +1,11 @@
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+
<!-- Common styles for signin-related tab modal dialogs. -->
<dom-module id="signin-dialog-shared">
<template>
<style>
a {
- color: var(--google-blue-700);
+ color: var(--cr-link-color);
text-decoration: none;
}
@@ -13,14 +15,13 @@
}
.container {
- background-color: white;
- color: #333;
+ color: var(--cr-primary-text-color);
width: 448px;
}
.top-title-bar {
align-items: center;
- border-bottom: 1px solid var(--paper-grey-300);
+ border-bottom: var(--cr-separator-line);
display: flex;
font-size: 16px;
height: 52px;
@@ -39,7 +40,6 @@
justify-content: flex-start;
}
</if>
-
</style>
</template>
</dom-module>
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.css b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.css
deleted file mode 100644
index 74a0daf1300..00000000000
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.css
+++ /dev/null
@@ -1,322 +0,0 @@
-/* Copyright 2015 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file. */
-
-.picture img {
- border-radius: 50%;
- max-height: 100%;
- max-width: 100%;
-}
-
-.details {
- padding: 0 24px;
-}
-
-#picture-container {
- align-items: center;
- display: flex;
- justify-content: center;
- padding-bottom: 32px;
- padding-top: 24px;
-}
-
-.picture {
- height: 96px;
- margin-inline-start: 84px;
- position: relative;
- width: 96px;
-}
-
-#profile-picture,
-.checkmark-circle {
- position: absolute;
-}
-
-.message-container {
- display: flex;
- margin-bottom: 16px;
-}
-
-.message-container:last-child {
- margin-bottom: 32px;
-}
-
-.message-container .logo {
- background-size: cover;
- flex-shrink: 0;
- height: 20px;
- margin-inline-end: 20px;
- position: relative;
- top: -2px;
- width: 20px;
-}
-
-#chrome-logo {
- background-image: url(../../../../../ui/webui/resources/images/200-logo_chrome.png);
-}
-
-#googleg-logo {
- background-image: url(../../../../../ui/webui/resources/images/200-logo_googleg.png);
-}
-
-.message-container .title {
- font-weight: 500;
- margin-bottom: 4px;
-}
-
-.message-container .body {
- color: #646464;
-}
-
-.message-container .text {
- line-height: 20px;
-}
-
-.message-container #activityControlsCheckbox {
- margin-inline-start: 40px;
-}
-
-#undoButton {
- margin-inline-start: 8px;
-}
-
-#syncDisabledDetails {
- line-height: 20px;
- margin-bottom: 8px;
- margin-top: 16px;
- padding: 0 24px;
-}
-
-#illustration {
- height: 96px;
- margin: 0 auto;
- position: relative;
- width: 264px;
-}
-
-#checkmark-circle {
- background: rgb(66, 133, 244);
- border: 2px solid #fff;
- border-radius: 50%;
- bottom: 0;
- height: 24px;
- position: absolute;
- right: 0;
- transform: scale(0);
- width: 24px;
-}
-
-.loaded #checkmark-circle {
- animation: scale-circle 300ms cubic-bezier(0, 0, 0.2, 1) forwards;
-}
-
-@keyframes scale-circle {
- from { transform: scale(0); }
- to { transform: scale(1); }
-}
-
-#checkmark-check {
- left: 5px;
- position: absolute;
- top: 7px;
-}
-
-.loaded #checkmark-path {
- animation: draw-path 300ms cubic-bezier(0, 0, 0.2, 1) 100ms forwards;
-}
-
-@keyframes draw-path {
- from { stroke-dashoffset: 16; }
- to { stroke-dashoffset: 0; }
-}
-
-#icons {
- height: 96px;
- position: absolute;
- width: 264px;
-}
-
-#icons > div {
- animation-delay: 200ms;
- animation-duration: 1.4s;
- animation-fill-mode: forwards;
- animation-timing-function: cubic-bezier(0.25, 0.45, 0.4, 0.7);
- background-size: cover;
- opacity: 0;
- position: absolute;
-}
-
-#icon-bookmarks {
- background: url(../../../../../ui/webui/resources/images/icon_bookmarks.svg);
- height: 36px;
- left: 58px;
- top: 0;
- width: 36px;
-}
-
-#icon-extensions {
- background: url(../../../../../ui/webui/resources/images/icon_extensions.svg);
- height: 24px;
- left: 30px;
- top: 30px;
- width: 24px;
-}
-
-
-#icon-passwords {
- background: url(../../../../../ui/webui/resources/images/icon_passwords.svg);
- height: 30px;
- left: 38px;
- top: 66px;
- width: 40px;
-}
-
-#icon-history {
- background: url(../../../../../ui/webui/resources/images/icon_history.svg);
- height: 36px;
- left: 190px;
- top: 6px;
- width: 36px;
-}
-
-#icon-tabs {
- background: url(../../../../../ui/webui/resources/images/icon_tabs.svg);
- height: 24px;
- left: 222px;
- top: 44px;
- width: 24px;
-}
-
-#icon-themes {
- background: url(../../../../../ui/webui/resources/images/icon_themes.svg);
- height: 30px;
- left: 184px;
- top: 62px;
- width: 32px;
-}
-
-#icon-circle-open {
- border: 2px solid #000;
- border-radius: 50%;
- height: 8px;
- left: 6px;
- top: 56px;
- width: 8px;
-}
-
-.icon-circle {
- background: #000;
- border-radius: 50%;
- height: 4px;
- width: 4px;
-}
-
-#icon-circle-1 {
- left: 64px;
- top: 50px;
-}
-
-#icon-circle-2 {
- left: 178px;
- top: 18px;
-}
-
-#icon-circle-3 {
- left: 194px;
- top: 50px;
-}
-
-#icon-circle-4 {
- left: 258px;
- top: 36px;
-}
-
-.loaded .fade-top-left {
- animation-name: fade-in-icon-top-left;
-}
-
-.loaded .fade-top-right {
- animation-name: fade-in-icon-top-right;
-}
-
-.loaded .fade-middle-left {
- animation-name: fade-in-icon-middle-left;
-}
-
-.loaded .fade-middle-right {
- animation-name: fade-in-icon-middle-right;
-}
-
-.loaded .fade-bottom-left {
- animation-name: fade-in-icon-bottom-left;
-}
-
-.loaded .fade-bottom-right {
- animation-name: fade-in-icon-bottom-right;
-}
-
-@keyframes fade-in-icon-top-left {
- from {
- opacity: 0;
- transform: translate(0, 0);
- }
- to {
- opacity: 0.1;
- transform: translate(-4px, -4px);
- }
-}
-
-@keyframes fade-in-icon-top-right {
- from {
- opacity: 0;
- transform: translate(0, 0);
- }
- to {
- opacity: 0.1;
- transform: translate(4px, -4px);
- }
-}
-
-@keyframes fade-in-icon-middle-left {
- from {
- opacity: 0;
- transform: translate(0, 0);
- }
- to {
- opacity: 0.1;
- transform: translate(-4px, 0);
- }
-}
-
-@keyframes fade-in-icon-middle-right {
- from {
- opacity: 0;
- transform: translate(0, 0);
- }
- to {
- opacity: 0.1;
- transform: translate(4px, 0);
- }
-}
-
-@keyframes fade-in-icon-bottom-left {
- from {
- opacity: 0;
- transform: translate(0, 0);
- }
- to {
- opacity: 0.1;
- transform: translate(-4px, 4px);
- }
-}
-
-@keyframes fade-in-icon-bottom-right {
- from {
- opacity: 0;
- transform: translate(0, 0);
- }
- to {
- opacity: 0.1;
- transform: translate(4px, 4px);
- }
-}
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.html b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.html
index 1b5fc56fc6f..2f50edc96d1 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.html
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.html
@@ -1,22 +1,327 @@
<!doctype html>
-<html dir="$i18n{textdirection}" lang="$i18n{language}">
+<html dir="$i18n{textdirection}" lang="$i18n{language}" $i18n{dark}>
<head>
<meta charset="utf-8">
+ <link rel="stylesheet" href="chrome://resources/css/md_colors.css">
+ <style>
+ html {
+ background-color: var(--md-background-color);
+ }
+ </style>
+ </custom-style>
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="signin_shared_css.html">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
- <link rel="stylesheet" href="sync_confirmation.css"></link>
<custom-style>
<style is="custom-style" include="signin-dialog-shared paper-button-style">
-<if expr="is_macosx or is_linux">
+ .picture img {
+ border-radius: 50%;
+ max-height: 100%;
+ max-width: 100%;
+ }
+
+ .details {
+ padding: 0 24px;
+ }
+
+ #picture-container {
+ align-items: center;
+ display: flex;
+ justify-content: center;
+ padding-bottom: 32px;
+ padding-top: 24px;
+ }
+
+ .picture {
+ height: 96px;
+ margin-inline-start: 84px;
+ position: relative;
+ width: 96px;
+ }
+
+ #profile-picture,
+ .checkmark-circle {
+ position: absolute;
+ }
+
+ .message-container {
+ display: flex;
+ margin-bottom: 16px;
+ }
+
+ .message-container:last-child {
+ margin-bottom: 32px;
+ }
+
+ .message-container .logo {
+ background-size: cover;
+ flex-shrink: 0;
+ height: 20px;
+ margin-inline-end: 20px;
+ position: relative;
+ top: -2px;
+ width: 20px;
+ }
+
+ #chrome-logo {
+ background-image: url(../../../../../ui/webui/resources/images/200-logo_chrome.png);
+ }
+
+ #googleg-logo {
+ background-image: url(../../../../../ui/webui/resources/images/200-logo_googleg.png);
+ }
+
+ .message-container .title {
+ font-weight: 500;
+ margin-bottom: 4px;
+ }
+
+ .message-container .body {
+ color: var(--cr-secondary-text-color);
+ }
+
+ .message-container .text {
+ line-height: 20px;
+ }
+
+ .message-container #activityControlsCheckbox {
+ margin-inline-start: 40px;
+ }
+
#undoButton {
+<if expr="is_macosx or is_linux">
margin-inline-end: 8px;
- margin-inline-start: 0;
- }
</if>
+<if expr="not is_macosx and not is_linux">
+ margin-inline-start: 8px;
+</if>
+ }
+
+ #syncDisabledDetails {
+ line-height: 20px;
+ margin-bottom: 8px;
+ margin-top: 16px;
+ padding: 0 24px;
+ }
+
+ #illustration {
+ height: 96px;
+ margin: 0 auto;
+ position: relative;
+ width: 264px;
+ }
+
+ #checkmark-circle {
+ background: var(--google-blue-refresh-500);
+ border: 2px solid #fff;
+ border-radius: 50%;
+ bottom: 0;
+ height: 24px;
+ position: absolute;
+ right: 0;
+ transform: scale(0);
+ width: 24px;
+ }
+
+ [dark] #checkmark-circle {
+ background: var(--google-blue-refresh-300);
+ border-color: var(--google-grey-900);
+ }
+
+ .loaded #checkmark-circle {
+ animation: scale-circle 300ms cubic-bezier(0, 0, 0.2, 1) forwards;
+ }
+
+ @keyframes scale-circle {
+ from { transform: scale(0); }
+ to { transform: scale(1); }
+ }
+
+ #checkmark-check {
+ left: 5px;
+ position: absolute;
+ top: 7px;
+ }
+
+ .loaded #checkmark-path {
+ animation: draw-path 300ms cubic-bezier(0, 0, 0.2, 1) 100ms forwards;
+ }
+
+ @keyframes draw-path {
+ from { stroke-dashoffset: 16; }
+ to { stroke-dashoffset: 0; }
+ }
+
+ #icons {
+ height: 96px;
+ position: absolute;
+ width: 264px;
+ }
+
+ #icons > div {
+ -webkit-mask-repeat: no-repeat;
+ -webkit-mask-size: cover;
+ animation-delay: 200ms;
+ animation-duration: 1.4s;
+ animation-fill-mode: forwards;
+ animation-timing-function: cubic-bezier(0.25, 0.45, 0.4, 0.7);
+ background-color: black;
+ opacity: 0;
+ position: absolute;
+ }
+
+ [dark] #icons > div {
+ background-color: white;
+ }
+
+ #icon-bookmarks {
+ -webkit-mask-image: url(../../../../../ui/webui/resources/images/icon_bookmarks.svg);
+ height: 36px;
+ left: 58px;
+ top: 0;
+ width: 36px;
+ }
+
+ #icon-extensions {
+ -webkit-mask-image: url(../../../../../ui/webui/resources/images/icon_extensions.svg);
+ height: 24px;
+ left: 30px;
+ top: 30px;
+ width: 24px;
+ }
+
+ #icon-passwords {
+ -webkit-mask-image: url(../../../../../ui/webui/resources/images/icon_passwords.svg);
+ height: 30px;
+ left: 38px;
+ top: 66px;
+ width: 40px;
+ }
+
+ #icon-history {
+ -webkit-mask-image: url(../../../../../ui/webui/resources/images/icon_history.svg);
+ height: 36px;
+ left: 190px;
+ top: 6px;
+ width: 36px;
+ }
+
+ #icon-tabs {
+ -webkit-mask-image: url(../../../../../ui/webui/resources/images/icon_tabs.svg);
+ height: 24px;
+ left: 222px;
+ top: 44px;
+ width: 24px;
+ }
+
+ #icon-themes {
+ -webkit-mask-image: url(../../../../../ui/webui/resources/images/icon_themes.svg);
+ height: 30px;
+ left: 184px;
+ top: 62px;
+ width: 32px;
+ }
+
+ #icon-circle-open {
+ border: 2px solid #000;
+ border-radius: 50%;
+ height: 8px;
+ left: 6px;
+ top: 56px;
+ width: 8px;
+ }
+
+ [dark] #icon-circle-open {
+ border-color: white;
+ }
+
+ .icon-circle {
+ border-radius: 50%;
+ height: 4px;
+ width: 4px;
+ }
+
+ #icon-circle-1 {
+ left: 64px;
+ top: 50px;
+ }
+
+ #icon-circle-2 {
+ left: 178px;
+ top: 18px;
+ }
+
+ #icon-circle-3 {
+ left: 194px;
+ top: 50px;
+ }
+
+ #icon-circle-4 {
+ left: 258px;
+ top: 36px;
+ }
+
+ .loaded .fade-top-left {
+ animation-name: fade-in, icon-top-left;
+ }
+
+ .loaded .fade-top-right {
+ animation-name: fade-in, icon-top-right;
+ }
+
+ .loaded .fade-middle-left {
+ animation-name: fade-in, icon-middle-left;
+ }
+
+ .loaded .fade-middle-right {
+ animation-name: fade-in, icon-middle-right;
+ }
+
+ .loaded .fade-bottom-left {
+ animation-name: fade-in, icon-bottom-left;
+ }
+
+ .loaded .fade-bottom-right {
+ animation-name: fade-in, icon-bottom-right;
+ }
+
+ @keyframes fade-in {
+ from { opacity: 0; }
+ to { opacity: .1; }
+ }
+
+ @keyframes icon-top-left {
+ from { transform: translate(0, 0); }
+ to { transform: translate(-4px, -4px); }
+ }
+
+ @keyframes icon-top-right {
+ from { transform: translate(0, 0); }
+ to { transform: translate(4px, -4px); }
+ }
+
+ @keyframes icon-middle-left {
+ from { transform: translate(0, 0); }
+ to { transform: translate(-4px, 0); }
+ }
+
+ @keyframes icon-middle-right {
+ from { transform: translate(0, 0); }
+ to { transform: translate(4px, 0); }
+ }
+
+ @keyframes icon-bottom-left {
+ from { transform: translate(0, 0); }
+ to { transform: translate(-4px, 4px); }
+ }
+
+ @keyframes icon-bottom-right {
+ from { transform: translate(0, 0); }
+ to { transform: translate(4px, 4px); }
+ }
</style>
</custom-style>
</head>
@@ -111,9 +416,10 @@
</div>
</div>
</body>
- <script src="chrome://resources/js/cr.js"></script>
- <script src="chrome://resources/js/load_time_data.js"></script>
- <script src="chrome://resources/js/util.js"></script>
+ <link rel="import" href="chrome://resources/html/cr.html">
+ <link rel="import" href="chrome://resources/html/load_time_data.html">
+ <link rel="import" href="chrome://resources/html/util.html">
<script src="sync_confirmation.js"></script>
<script src="chrome://sync-confirmation/strings.js"></script>
+ <link rel="import" href="chrome://resources/html/dark_mode.html">
</html>
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.js b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.js
index a1e3687faad..1611ba92f48 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.js
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.js
@@ -93,7 +93,7 @@ cr.define('sync.confirmation', function() {
}
}
- // TODO(scottchen): clearFocus and setUserImageURL are called directly by the
+ // TODO(tangltom): clearFocus and setUserImageURL are called directly by the
// C++ handler. C++ handlers should not be calling JS functions by name
// anymore. They should be firing events with FireWebuiListener and have the
// page itself decide whether to listen or not listen to the event.
diff --git a/chromium/chrome/browser/resources/snippets_internals/BUILD.gn b/chromium/chrome/browser/resources/snippets_internals/BUILD.gn
index c636d01a7e6..fbb8573744a 100644
--- a/chromium/chrome/browser/resources/snippets_internals/BUILD.gn
+++ b/chromium/chrome/browser/resources/snippets_internals/BUILD.gn
@@ -12,13 +12,8 @@ js_type_check("closure_compile") {
js_library("snippets_internals") {
deps = [
+ "//chrome/browser/ui/webui/snippets_internals:mojo_bindings_js_library_for_compile",
"//third_party/jstemplate:jstemplate",
"//ui/webui/resources/js:util",
]
- extra_deps =
- [ "//chrome/browser/ui/webui/snippets_internals:mojo_bindings_js" ]
- externs_list = [
- "$root_gen_dir/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom.externs.js",
- "$externs_path/mojo.js",
- ]
}
diff --git a/chromium/chrome/browser/resources/snippets_internals/snippets_internals.html b/chromium/chrome/browser/resources/snippets_internals/snippets_internals.html
index 32cbe829a82..4c240d41655 100644
--- a/chromium/chrome/browser/resources/snippets_internals/snippets_internals.html
+++ b/chromium/chrome/browser/resources/snippets_internals/snippets_internals.html
@@ -13,11 +13,11 @@ found in the LICENSE file.
<link rel="stylesheet" href="snippets_internals.css">
<script src="chrome://resources/js/cr.js"></script>
- <script src="chrome://resources/js/mojo_bindings.js"></script>
+ <script src="chrome://resources/js/mojo_bindings_lite.js"></script>
<script src="chrome://resources/js/jstemplate_compiled.js"></script>
<script src="chrome://resources/js/util.js"></script>
- <script src="snippets_internals.mojom.js"></script>
+ <script src="snippets_internals.mojom-lite.js"></script>
<script src="snippets_internals.js"></script>
</head>
@@ -35,18 +35,6 @@ found in the LICENSE file.
<td id="flag-offlining-recent-pages-feature" class="value"></td>
</tr>
<tr>
- <td class="name">Asset Download Suggestions enabled</td>
- <td id="flag-asset-download-suggestions" class="value"></td>
- </tr>
- <tr>
- <td class="name">Offline Page Download Suggestions enabled</td>
- <td id="flag-offline-page-download-suggestions" class="value"></td>
- </tr>
- <tr>
- <td class="name">Bookmark Suggestions enabled</td>
- <td id="flag-bookmark-suggestions" class="value"></td>
- </tr>
- <tr>
<td class="name">Snippets fetch URL</td>
<td id="switch-fetch-url" class="value"></td>
</tr>
@@ -128,9 +116,6 @@ found in the LICENSE file.
<button id="background-fetch-button">
Fetch remote suggestions in the background in 2 seconds
</button>
- <button id="push-dummy-suggestion">
- Push dummy suggestion in 10 seconds
- </button>
<button id="last-json-button">Show the last JSON</button>
<div id="last-json-container" class="hidden">
<div id="last-json-text"></div>
diff --git a/chromium/chrome/browser/resources/snippets_internals/snippets_internals.js b/chromium/chrome/browser/resources/snippets_internals/snippets_internals.js
index 97ba3cd6f5e..27b09c38f16 100644
--- a/chromium/chrome/browser/resources/snippets_internals/snippets_internals.js
+++ b/chromium/chrome/browser/resources/snippets_internals/snippets_internals.js
@@ -4,10 +4,10 @@
'use strict';
-/** @type {snippetsInternals.mojom.PageHandlerPtr} */
+/** @type {snippetsInternals.mojom.PageHandlerProxy} */
let pageHandler = null;
-/** @type {snippetsInternals.mojom.PageImpl} */
+/** @type {snippetsInternals.mojom.PageInterface} */
let page = null;
/* Javascript module for chrome://snippets-internals. */
@@ -18,11 +18,11 @@ let page = null;
/**
* Sets all the properties contained in the mapping in the page.
* property map {id -> value}.
- * @param {Map} propertyMap Property name to value mapping.
+ * @param {!Object<string,string>} propertyMap Property name to value mapping.
*/
function setPropertiesInPage(propertyMap) {
- propertyMap.forEach(function(value, field) {
- setPropertyInPage(field, value);
+ Object.keys(propertyMap).forEach(function(field) {
+ setPropertyInPage(field, propertyMap[field]);
});
}
@@ -91,24 +91,17 @@ function getCategoryRankerProperties() {
const table = $(domId);
const rowTemplate = $('category-ranker-row');
- response.properties.forEach(function(value, field) {
+ Object.keys(response.properties).forEach(function(field) {
const row = document.importNode(rowTemplate.content, true);
const td = row.querySelectorAll('td');
td[0].textContent = field;
- td[1].textContent = value;
+ td[1].textContent = response.properties[field];
table.appendChild(row);
});
});
}
-/* Check if pushing dummy suggestions is possible. */
-function checkIfPushingDummySuggestionPossible() {
- pageHandler.isPushingDummySuggestionPossible().then(function(response) {
- $('push-dummy-suggestion').disabled = !response.result;
- });
-}
-
/* Retrieve the remote content suggestions properties. */
function getRemoteContentSuggestionsProperties() {
pageHandler.getRemoteContentSuggestionsProperties().then(function(response) {
@@ -194,7 +187,6 @@ function refreshContent() {
getUserClassifierProperties();
getCategoryRankerProperties();
getRemoteContentSuggestionsProperties();
- checkIfPushingDummySuggestionPossible();
}
/* Setup buttons and other event listeners. */
@@ -233,14 +225,6 @@ function setupEventListeners() {
});
});
- $('push-dummy-suggestion').addEventListener('click', function(event) {
- const content = $('push-dummy-suggestion').textContent;
- $('push-dummy-suggestion').textContent = '...';
- pageHandler.pushDummySuggestionInBackground(10).then(function(response) {
- $('push-dummy-suggestion').textContent = content;
- });
- });
-
$('last-json-button').addEventListener('click', function(event) {
pageHandler.getLastJson().then(function(response) {
const container = $('last-json-container');
@@ -279,13 +263,8 @@ function setupEventListeners() {
}
/* Represents the js-side of the IPC link. Backend talks to this. */
-/** @implements {snippetsInternals.mojom.PageImpl} */
+/** @implements {snippetsInternals.mojom.PageInterface} */
class SnippetsInternalsPageImpl {
- constructor(request) {
- this.binding_ =
- new mojo.Binding(snippetsInternals.mojom.Page, this, request);
- }
-
/* Callback for when suggestions change on the backend. */
onSuggestionsChanged() {
getSuggestionsByCategory();
@@ -295,17 +274,14 @@ class SnippetsInternalsPageImpl {
/* Main entry point. */
document.addEventListener('DOMContentLoaded', function() {
// Setup frontend mojo.
- const client = new snippetsInternals.mojom.PagePtr;
- assert(client);
- page = new SnippetsInternalsPageImpl(mojo.makeRequest(client));
+ page = new SnippetsInternalsPageImpl;
// Setup backend mojo.
- const pageHandlerFactory = new snippetsInternals.mojom.PageHandlerFactoryPtr;
- Mojo.bindInterface(
- snippetsInternals.mojom.PageHandlerFactory.name,
- mojo.makeRequest(pageHandlerFactory).handle);
+ const pageHandlerFactory =
+ snippetsInternals.mojom.PageHandlerFactory.getProxy();
// Give backend mojo a reference to frontend mojo.
+ const client = new snippetsInternals.mojom.Page(page).createProxy();
pageHandlerFactory.createPageHandler(client).then((response) => {
pageHandler = response.handler;
diff --git a/chromium/chrome/browser/resources/supervised_user_internals.css b/chromium/chrome/browser/resources/supervised_user_internals/supervised_user_internals.css
index 97d3dba0a3b..9fcb0f02f25 100644
--- a/chromium/chrome/browser/resources/supervised_user_internals.css
+++ b/chromium/chrome/browser/resources/supervised_user_internals/supervised_user_internals.css
@@ -23,8 +23,8 @@
#info .section {
display: inline-block;
- margin-left: auto;
- margin-right: auto;
+ margin-inline-end: auto;
+ margin-inline-start: auto;
}
#info .section.hidden {
diff --git a/chromium/chrome/browser/resources/supervised_user_internals.html b/chromium/chrome/browser/resources/supervised_user_internals/supervised_user_internals.html
index 3ae9ad21d60..809060b1dfb 100644
--- a/chromium/chrome/browser/resources/supervised_user_internals.html
+++ b/chromium/chrome/browser/resources/supervised_user_internals/supervised_user_internals.html
@@ -12,7 +12,6 @@ found in the LICENSE file.
<link rel="stylesheet" href="chrome://resources/css/list.css">
<link rel="stylesheet" href="supervised_user_internals.css">
<script src="chrome://resources/js/cr.js"></script>
-<script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://resources/js/util.js"></script>
</head>
diff --git a/chromium/chrome/browser/resources/supervised_user_internals.js b/chromium/chrome/browser/resources/supervised_user_internals/supervised_user_internals.js
index b999c6692b9..bc8286ae54a 100644
--- a/chromium/chrome/browser/resources/supervised_user_internals.js
+++ b/chromium/chrome/browser/resources/supervised_user_internals/supervised_user_internals.js
@@ -44,8 +44,6 @@ cr.define('chrome.supervised_user_internals', function() {
jstProcess(new JsEvalContext(info), $('basic-info'));
// Hack: Schedule another refresh after a while.
- // TODO(treib): Get rid of this once we're properly notified of all
- // relevant changes.
setTimeout(function() {
chrome.send('getBasicInfo');
}, 5000);
diff --git a/chromium/chrome/browser/resources/sync_file_system_internals/main.html b/chromium/chrome/browser/resources/sync_file_system_internals/main.html
index c058fbedcf2..b0fe20625eb 100644
--- a/chromium/chrome/browser/resources/sync_file_system_internals/main.html
+++ b/chromium/chrome/browser/resources/sync_file_system_internals/main.html
@@ -15,11 +15,9 @@ found in the LICENSE file.
<script src="chrome://resources/js/cr/event_target.js"></script>
<link rel="stylesheet" href="chrome://resources/css/tabs.css">
-<script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://resources/js/cr/ui.js"></script>
<script src="chrome://resources/js/cr/ui/tabs.js"></script>
<script src="chrome://resources/js/cr/ui/focus_outline_manager.js"></script>
-<script src="chrome://syncfs-internals/strings.js"></script>
<script src="chrome://syncfs-internals/utils.js"></script>
<body>
diff --git a/chromium/chrome/browser/resources/translate_internals/OWNERS b/chromium/chrome/browser/resources/translate_internals/OWNERS
deleted file mode 100644
index bb5c3afcabc..00000000000
--- a/chromium/chrome/browser/resources/translate_internals/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-file://components/translate/OWNERS
diff --git a/chromium/chrome/browser/resources/translate_internals/detection_logs.html b/chromium/chrome/browser/resources/translate_internals/detection_logs.html
deleted file mode 100644
index 81305647273..00000000000
--- a/chromium/chrome/browser/resources/translate_internals/detection_logs.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
-Copyright 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<div>
- <h2>Detection Logs <button id="detection-logs-dump">Dump</button></h2>
- <table>
- <thead>
- <tr>
- <th class="detection-logs-time">Time</th>
- <th class="detection-logs-url">URL</th>
- <th class="detection-logs-content-language">
- Content-Language
- </th>
- <th class="detection-logs-cld-language">
- Language detected by CLD
- </th>
- <th class="detection-logs-is-cld-reliable">
- Is CLD reliable?
- </th>
- <th class="detection-logs-has-notranslate">
- notranslate meta
- </th>
- <th class="detection-logs-html-root-language">
- html lang attribute
- </th>
- <th class="detection-logs-adopted-language">Adopted language</th>
- <th class="detection-logs-content">Content</th>
- </tr>
- </thead>
- <tbody></tbody>
- </table>
-</div>
diff --git a/chromium/chrome/browser/resources/translate_internals/error_logs.html b/chromium/chrome/browser/resources/translate_internals/error_logs.html
deleted file mode 100644
index ec842d0ea2d..00000000000
--- a/chromium/chrome/browser/resources/translate_internals/error_logs.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!--
-Copyright 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<div>
- <h2>Error Logs</h2>
- <table>
- <thead>
- <tr>
- <th class="error-logs-time">Time</th>
- <th class="error-logs-url">URL</th>
- <th class="error-logs-error">Error</th>
- </tr>
- </thead>
- <tbody></tbody>
- </table>
-</div>
diff --git a/chromium/chrome/browser/resources/translate_internals/event_logs.html b/chromium/chrome/browser/resources/translate_internals/event_logs.html
deleted file mode 100644
index 101b7f19817..00000000000
--- a/chromium/chrome/browser/resources/translate_internals/event_logs.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!--
-Copyright 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<div>
- <h2>Event Logs</h2>
- <table>
- <thead>
- <tr>
- <th class="event-logs-time">Time</th>
- <th class="event-logs-place">Filename: line</th>
- <th class="event-logs-message">Message</th>
- </tr>
- </thead>
- <tbody></tbody>
- </table>
-</div>
diff --git a/chromium/chrome/browser/resources/translate_internals/prefs.html b/chromium/chrome/browser/resources/translate_internals/prefs.html
deleted file mode 100644
index ff86b1021ae..00000000000
--- a/chromium/chrome/browser/resources/translate_internals/prefs.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!--
-Copyright 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<div>
- <section id="prefs-blocked-languages">
- <h2>Languages not translated (New)</h2>
- <ul></ul>
- </section>
- <section id="prefs-language-blacklist">
- <h2>Languages not translated<span> (Old)</span></h2>
- <ul></ul>
- </section>
- <section id="prefs-site-blacklist">
- <h2>Sites not translated</h2>
- <ul></ul>
- </section>
- <section id="prefs-whitelists">
- <h2>Languages always translated</h2>
- <ul></ul>
- </section>
- <section id="prefs-supported-languages">
- <h2>Supported languages</h2>
- <p id="prefs-supported-languages-last-updated">Last updated: <span></span></p>
- <ul id="prefs-supported-languages-languages"></ul>
- </section>
- <section>
- <h2>UX</h2>
- <p id="prefs-too-often-denied">Refrain from showing the translation prompt</p>
- </section>
- <section id="prefs-cld-version">
- <h2>CLD Version</h2>
- <p>$i18n{cld-version}</p>
- </section>
-</div>
-<div>
- <section id="prefs-dump">
- <h2>Dump</h2>
- <p class="dump"><p>
- </section>
- <section>
- <h2 id="override-variations-country">Override Variations Country</h2>
- <p id="country-override"></p>
- </section>
- <section>
- <h2 id="override-recent-target">
- Override <code>translate_recent_target</code>
- </h2>
- <p id="recent-override"></p>
- </section>
-</div>
diff --git a/chromium/chrome/browser/resources/translate_internals/translate_internals.css b/chromium/chrome/browser/resources/translate_internals/translate_internals.css
deleted file mode 100644
index 9d9a7f97b22..00000000000
--- a/chromium/chrome/browser/resources/translate_internals/translate_internals.css
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Copyright 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file. */
-
-body {
- color: #333;
-}
-
-h2 {
- font-size: 110%;
-}
-
-table {
- border-collapse: collapse;
- table-layout: fixed;
- width: 100%;
-}
-
-th,
-td {
- border-color: #666;
- border-style: solid;
- border-width: 1px;
- padding: 1px 4px;
-}
-
-tabpanel {
- padding-bottom: 10px;
-}
-
-tabpanel > div {
- display: -webkit-flex;
-}
-
-tabpanel > div > div {
- -webkit-flex: 1;
-}
-
-.dump {
- font-family: monospace;
- white-space: pre-wrap;
-}
-
-#tabpanel-prefs ul {
- list-style-type: none;
- padding-left: 0;
-}
-
-#tabpanel-prefs ul li {
- width: 100%;
-}
-
-#tabpanel-prefs button.dismissing {
- background-color: transparent;
- border-style: solid;
- border-width: 1px;
- color: #666;
- cursor: pointer;
- font-size: 110%;
- margin-left: 1em;
-}
-
-.detection-logs-time {
- width: 10%;
-}
-
-.detection-logs-url {
- width: 20%;
-}
-
-td.detection-logs-url {
- word-wrap: break-word;
-}
-
-.detection-logs-content-language {
- width: 10%;
-}
-
-.detection-logs-cld-language {
- width: 10%;
-}
-
-.detection-logs-is-cld-reliable {
- width: 5%;
-}
-
-.detection-logs-has-notranslate {
- width: 5%;
-}
-
-.detection-logs-html-root-language {
- width: 10%;
-}
-
-.detection-logs-adopted-language {
- width: 10%;
-}
-
-.detection-logs-content {
- width: 20%;
-}
-
-td.detection-logs-content div {
- font-family: monospace;
- max-height: 250px;
- overflow: auto;
- white-space: pre-wrap;
- word-wrap: break-word;
-}
-
-.error-logs-time {
- width: 20%;
-}
-
-.error-logs-url {
- width: 40%;
-}
-
-.error-logs-error {
- width: 40%;
-}
-
-.event-logs-time {
- width: 15%;
-}
-
-.event-logs-place {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- width: 35%;
-}
-
-.event-logs-message {
- width: 50%;
-}
-
-.prefs-setting-disabled {
- display: none;
-}
-
-#country-override input {
- margin-bottom: 1px;
-}
diff --git a/chromium/chrome/browser/resources/translate_internals/translate_internals.html b/chromium/chrome/browser/resources/translate_internals/translate_internals.html
deleted file mode 100644
index d6f4b68cc02..00000000000
--- a/chromium/chrome/browser/resources/translate_internals/translate_internals.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!doctype html>
-<html dir="$i18n{textdirection}" lang="$i18n{language}">
-<!--
-Copyright 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
- <head>
- <meta charset="utf-8">
- <title>Translate Internals</title>
- <link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
- <link rel="stylesheet" href="chrome://resources/css/tabs.css">
- <link rel="stylesheet" href="./translate_internals.css">
- <script src="chrome://resources/js/util.js"></script>
- <script src="chrome://resources/js/cr.js"></script>
- <script src="chrome://resources/js/cr/event_target.js"></script>
- <script src="chrome://resources/js/cr/ui.js"></script>
- <script src="chrome://resources/js/cr/ui/tabs.js"></script>
- <script src="chrome://resources/js/cr/ui/focus_outline_manager.js"></script>
- <script src="chrome://resources/js/load_time_data.js"></script>
- <script src="/strings.js"></script>
- <script src="./translate_internals.js"></script>
- </head>
-
- <body>
-
- <tabbox>
- <tabs>
- <tab>Prefs</tab>
- <tab>Detection Logs</tab>
- <tab>Error Logs</tab>
- <tab>Event Logs</tab>
- </tabs>
- <tabpanels>
-
- <tabpanel id="tabpanel-prefs">
- <div>
- <include src="prefs.html">
- </div>
- </tabpanel>
-
- <tabpanel id="tabpanel-detection-logs">
- <div>
- <include src="detection_logs.html">
- </div>
- </tabpanel>
-
- <tabpanel id="tabpanel-error-logs">
- <div>
- <include src="error_logs.html">
- </div>
- </tabpanel>
-
- <tabpanel id="tabpanel-event-logs">
- <div>
- <include src="event_logs.html">
- </div>
- </tabpanel>
-
- </tabpanels>
- </tabbox>
-
- </body>
-
-</html>
diff --git a/chromium/chrome/browser/resources/translate_internals/translate_internals.js b/chromium/chrome/browser/resources/translate_internals/translate_internals.js
deleted file mode 100644
index 7becb84a4a6..00000000000
--- a/chromium/chrome/browser/resources/translate_internals/translate_internals.js
+++ /dev/null
@@ -1,529 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-(function() {
-'use strict';
-
-cr.define('cr.translateInternals', function() {
- const detectionLogs = [];
-
- /**
- * Initializes UI and sends a message to the browser for
- * initialization.
- */
- function initialize() {
- cr.ui.decorate('tabbox', cr.ui.TabBox);
- chrome.send('requestInfo');
-
- const button = $('detection-logs-dump');
- button.addEventListener('click', onDetectionLogsDump);
-
- const tabpanelNodeList = document.getElementsByTagName('tabpanel');
- const tabpanels = Array.prototype.slice.call(tabpanelNodeList, 0);
- const tabpanelIds = tabpanels.map(function(tab) {
- return tab.id;
- });
-
- const tabNodeList = document.getElementsByTagName('tab');
- const tabs = Array.prototype.slice.call(tabNodeList, 0);
- tabs.forEach(function(tab) {
- tab.onclick = function(e) {
- const tabbox = document.querySelector('tabbox');
- const tabpanel = tabpanels[tabbox.selectedIndex];
- const hash = tabpanel.id.match(/(?:^tabpanel-)(.+)/)[1];
- window.location.hash = hash;
- };
- });
-
- const activateTabByHash = function() {
- let hash = window.location.hash;
-
- // Remove the first character '#'.
- hash = hash.substring(1);
-
- const id = 'tabpanel-' + hash;
- if (tabpanelIds.indexOf(id) == -1) {
- return;
- }
-
- $(id).selected = true;
- };
-
- window.onhashchange = activateTabByHash;
- activateTabByHash();
- }
-
- /*
- * Creates a button to dismiss an item.
- *
- * @param {Function} func Callback called when the button is clicked.
- */
- function createDismissingButton(func) {
- const button = document.createElement('button');
- button.textContent = 'X';
- button.classList.add('dismissing');
- button.addEventListener('click', function(e) {
- e.preventDefault();
- func();
- }, false);
- return button;
- }
-
- /**
- * Creates a new LI element with a button to dismiss the item.
- *
- * @param {string} text The lable of the LI element.
- * @param {Function} func Callback called when the button is clicked.
- */
- function createLIWithDismissingButton(text, func) {
- const span = document.createElement('span');
- span.textContent = text;
-
- const li = document.createElement('li');
- li.appendChild(span);
- li.appendChild(createDismissingButton(func));
- return li;
- }
-
- /**
- * Formats the language name to a human-readable text. For example, if
- * |langCode| is 'en', this may return 'en (English)'.
- *
- * @param {string} langCode ISO 639 language code.
- * @return {string} The formatted string.
- */
- function formatLanguageCode(langCode) {
- const key = 'language-' + langCode;
- if (loadTimeData.valueExists(key)) {
- const langName = loadTimeData.getString(key);
- return langCode + ' (' + langName + ')';
- }
-
- return langCode;
- }
-
- /**
- * Formats the error type to a human-readable text.
- *
- * @param {string} error Translation error type from the browser.
- * @return {string} The formatted string.
- */
- function formatTranslateErrorsType(error) {
- // This list is from chrome/common/translate/translate_errors.h.
- // If this header file is updated, the below list also should be updated.
- const errorStrs = {
- 0: 'None',
- 1: 'Network',
- 2: 'Initialization Error',
- 3: 'Unknown Language',
- 4: 'Unsupported Language',
- 5: 'Identical Languages',
- 6: 'Translation Error',
- 7: 'Translation Timeout',
- 8: 'Unexpected Script Error',
- 9: 'Bad Origin',
- 10: 'Script Load Error',
- };
-
- if (error < 0 || errorStrs.length <= error) {
- console.error('Invalid error code:', error);
- return 'Invalid Error Code';
- }
- return errorStrs[error];
- }
-
- /**
- * Handles the message of 'prefsUpdated' from the browser.
- *
- * @param {Object} detail the object which represents pref values.
- */
- function onPrefsUpdated(detail) {
- let ul;
-
- ul = document.querySelector('#prefs-blocked-languages ul');
- ul.innerHTML = '';
-
- if ('translate_blocked_languages' in detail) {
- const langs = detail['translate_blocked_languages'];
-
- langs.forEach(function(langCode) {
- const text = formatLanguageCode(langCode);
-
- const li = createLIWithDismissingButton(text, function() {
- chrome.send('removePrefItem', ['blocked_languages', langCode]);
- });
- ul.appendChild(li);
- });
- }
-
- ul = document.querySelector('#prefs-language-blacklist ul');
- ul.innerHTML = '';
-
- if ('translate_language_blacklist' in detail) {
- const langs = detail['translate_language_blacklist'];
-
- langs.forEach(function(langCode) {
- const text = formatLanguageCode(langCode);
-
- const li = createLIWithDismissingButton(text, function() {
- chrome.send('removePrefItem', ['language_blacklist', langCode]);
- });
- ul.appendChild(li);
- });
- }
-
- ul = document.querySelector('#prefs-site-blacklist ul');
- ul.innerHTML = '';
-
- if ('translate_site_blacklist' in detail) {
- const sites = detail['translate_site_blacklist'];
-
- sites.forEach(function(site) {
- const li = createLIWithDismissingButton(site, function() {
- chrome.send('removePrefItem', ['site_blacklist', site]);
- });
- ul.appendChild(li);
- });
- }
-
- ul = document.querySelector('#prefs-whitelists ul');
- ul.innerHTML = '';
-
- if ('translate_whitelists' in detail) {
- const pairs = detail['translate_whitelists'];
-
- Object.keys(pairs).forEach(function(fromLangCode) {
- const toLangCode = pairs[fromLangCode];
- const text = formatLanguageCode(fromLangCode) + ' \u2192 ' +
- formatLanguageCode(toLangCode);
-
- const li = createLIWithDismissingButton(text, function() {
- chrome.send(
- 'removePrefItem', ['whitelists', fromLangCode, toLangCode]);
- });
- ul.appendChild(li);
- });
- }
-
- let p = $('prefs-too-often-denied');
- p.classList.toggle(
- 'prefs-setting-disabled', !detail['translate_too_often_denied']);
- p.appendChild(createDismissingButton(
- chrome.send.bind(null, 'removePrefItem', ['too_often_denied'])));
-
- if ('translate_recent_target' in detail) {
- const recentTarget = detail['translate_recent_target'];
-
- p = $('recent-override');
-
- p.innerHTML = '';
-
- appendTextFieldWithButton(p, recentTarget, function(value) {
- chrome.send('setRecentTargetLanguage', [value]);
- });
- }
-
- p = document.querySelector('#prefs-dump p');
- const content = JSON.stringify(detail, null, 2);
- p.textContent = content;
- }
-
- /**
- * Handles the message of 'supportedLanguagesUpdated' from the browser.
- *
- * @param {Object} details the object which represents the supported
- * languages by the Translate server.
- */
- function onSupportedLanguagesUpdated(details) {
- const span =
- $('prefs-supported-languages-last-updated').querySelector('span');
- span.textContent = formatDate(new Date(details['last_updated']));
-
- const ul = $('prefs-supported-languages-languages');
- ul.innerHTML = '';
- const languages = details['languages'];
- for (let i = 0; i < languages.length; i++) {
- const language = languages[i];
- const li = document.createElement('li');
-
- const text = formatLanguageCode(language);
- li.innerText = text;
-
- ul.appendChild(li);
- }
- }
-
- /**
- * Handles the message of 'countryUpdated' from the browser.
- *
- * @param {Object} details the object containing the country
- * information.
- */
- function onCountryUpdated(details) {
- const p = $('country-override');
-
- p.innerHTML = '';
-
- if ('country' in details) {
- const country = details['country'];
-
- const h2 = $('override-variations-country');
- h2.title =
- ('Changing this value will override the permanent country stored ' +
- 'by variations. Normally, this value gets automatically updated ' +
- 'with a new value received from the variations server when ' +
- 'Chrome is updated.');
-
- appendTextFieldWithButton(p, country, function(value) {
- chrome.send('overrideCountry', [value]);
- });
-
- if ('update' in details && details['update']) {
- const div1 = document.createElement('div');
- div1.textContent = 'Permanent stored country updated.';
- const div2 = document.createElement('div');
- div2.textContent =
- ('You will need to restart your browser ' +
- 'for the changes to take effect.');
- p.appendChild(div1);
- p.appendChild(div2);
- }
- } else {
- p.textContent = 'Could not load country info from Variations.';
- }
- }
-
- /**
- * Adds '0's to |number| as a string. |width| is length of the string
- * including '0's.
- *
- * @param {string} number The number to be converted into a string.
- * @param {number} width The width of the returned string.
- * @return {string} The formatted string.
- */
- function padWithZeros(number, width) {
- const numberStr = number.toString();
- const restWidth = width - numberStr.length;
- if (restWidth <= 0) {
- return numberStr;
- }
-
- return Array(restWidth + 1).join('0') + numberStr;
- }
-
- /**
- * Formats |date| as a Date object into a string. The format is like
- * '2006-01-02 15:04:05'.
- *
- * @param {Date} date Date to be formatted.
- * @return {string} The formatted string.
- */
- function formatDate(date) {
- const year = date.getFullYear();
- const month = date.getMonth() + 1;
- const day = date.getDate();
- const hour = date.getHours();
- const minute = date.getMinutes();
- const second = date.getSeconds();
-
- const yearStr = padWithZeros(year, 4);
- const monthStr = padWithZeros(month, 2);
- const dayStr = padWithZeros(day, 2);
- const hourStr = padWithZeros(hour, 2);
- const minuteStr = padWithZeros(minute, 2);
- const secondStr = padWithZeros(second, 2);
-
- const str = yearStr + '-' + monthStr + '-' + dayStr + ' ' + hourStr + ':' +
- minuteStr + ':' + secondStr;
-
- return str;
- }
-
- /**
- * Appends a new TD element to the specified element.
- *
- * @param {string} parent The element to which a new TD element is appended.
- * @param {string} content The text content of the element.
- * @param {string} className The class name of the element.
- */
- function appendTD(parent, content, className) {
- const td = document.createElement('td');
- td.textContent = content;
- td.className = className;
- parent.appendChild(td);
- }
-
- /**
- * Handles the message of 'languageDetectionInfoAdded' from the
- * browser.
- *
- * @param {Object} detail The object which represents the logs.
- */
- function onLanguageDetectionInfoAdded(detail) {
- detectionLogs.push(detail);
-
- const tr = document.createElement('tr');
-
- appendTD(tr, formatDate(new Date(detail['time'])), 'detection-logs-time');
- appendTD(tr, detail['url'], 'detection-logs-url');
- appendTD(
- tr, formatLanguageCode(detail['content_language']),
- 'detection-logs-content-language');
- appendTD(
- tr, formatLanguageCode(detail['cld_language']),
- 'detection-logs-cld-language');
- appendTD(tr, detail['is_cld_reliable'], 'detection-logs-is-cld-reliable');
- appendTD(tr, detail['has_notranslate'], 'detection-logs-has-notranslate');
- appendTD(
- tr, formatLanguageCode(detail['html_root_language']),
- 'detection-logs-html-root-language');
- appendTD(
- tr, formatLanguageCode(detail['adopted_language']),
- 'detection-logs-adopted-language');
- appendTD(
- tr, formatLanguageCode(detail['content']), 'detection-logs-content');
-
- // TD (and TR) can't use the CSS property 'max-height', so DIV
- // in the content is needed.
- const contentTD = tr.querySelector('.detection-logs-content');
- const div = document.createElement('div');
- div.textContent = contentTD.textContent;
- contentTD.textContent = '';
- contentTD.appendChild(div);
-
- const tabpanel = $('tabpanel-detection-logs');
- const tbody = tabpanel.getElementsByTagName('tbody')[0];
- tbody.appendChild(tr);
- }
-
- /**
- * Handles the message of 'translateErrorDetailsAdded' from the
- * browser.
- *
- * @param {Object} details The object which represents the logs.
- */
- function onTranslateErrorDetailsAdded(details) {
- const tr = document.createElement('tr');
-
- appendTD(tr, formatDate(new Date(details['time'])), 'error-logs-time');
- appendTD(tr, details['url'], 'error-logs-url');
- appendTD(
- tr,
- details['error'] + ': ' + formatTranslateErrorsType(details['error']),
- 'error-logs-error');
-
- const tabpanel = $('tabpanel-error-logs');
- const tbody = tabpanel.getElementsByTagName('tbody')[0];
- tbody.appendChild(tr);
- }
-
- /**
- * Handles the message of 'translateEventDetailsAdded' from the browser.
- *
- * @param {Object} details The object which contains event information.
- */
- function onTranslateEventDetailsAdded(details) {
- const tr = document.createElement('tr');
- appendTD(tr, formatDate(new Date(details['time'])), 'event-logs-time');
- appendTD(
- tr, details['filename'] + ': ' + details['line'], 'event-logs-place');
- appendTD(tr, details['message'], 'event-logs-message');
-
- const tbody = $('tabpanel-event-logs').getElementsByTagName('tbody')[0];
- tbody.appendChild(tr);
- }
-
- /**
- * Appends an <input type="text" /> and a button to `elt`, and sets the value
- * of the <input> to `value`. When the button is clicked,
- * `buttonClickCallback` is called with the value of the <input> field.
- *
- * @param {HTMLElement} elt Container element to append to.
- * @param {string} value Initial value of the <input> element.
- * @param {Function} buttonClickCallback Function to call when the button is
- * clicked.
- */
- function appendTextFieldWithButton(elt, value, buttonClickCallback) {
- const input = document.createElement('input');
- input.type = 'text';
- input.value = value;
-
- const button = document.createElement('button');
- button.textContent = 'update';
- button.addEventListener('click', function() {
- buttonClickCallback(input.value);
- }, false);
-
- elt.appendChild(input);
- elt.appendChild(document.createElement('br'));
- elt.appendChild(button);
- }
-
- /**
- * The callback entry point from the browser. This function will be
- * called by the browser.
- *
- * @param {string} message The name of the sent message.
- * @param {Object} details The argument of the sent message.
- */
- function messageHandler(message, details) {
- switch (message) {
- case 'languageDetectionInfoAdded':
- onLanguageDetectionInfoAdded(details);
- break;
- case 'prefsUpdated':
- onPrefsUpdated(details);
- break;
- case 'supportedLanguagesUpdated':
- onSupportedLanguagesUpdated(details);
- break;
- case 'countryUpdated':
- onCountryUpdated(details);
- break;
- case 'translateErrorDetailsAdded':
- onTranslateErrorDetailsAdded(details);
- break;
- case 'translateEventDetailsAdded':
- onTranslateEventDetailsAdded(details);
- break;
- default:
- console.error('Unknown message:', message);
- break;
- }
- }
-
- /**
- * The callback of button#detetion-logs-dump.
- */
- function onDetectionLogsDump() {
- const data = JSON.stringify(detectionLogs);
- const blob = new Blob([data], {'type': 'text/json'});
- const url = URL.createObjectURL(blob);
- const filename = 'translate_internals_detect_logs_dump.json';
-
- const a = document.createElement('a');
- a.setAttribute('href', url);
- a.setAttribute('download', filename);
-
- const event = document.createEvent('MouseEvent');
- event.initMouseEvent(
- 'click', true, true, window, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null);
- a.dispatchEvent(event);
- }
-
- return {
- initialize: initialize,
- messageHandler: messageHandler,
- };
-});
-
-/**
- * The entry point of the UI.
- */
-function main() {
- cr.doc.addEventListener('DOMContentLoaded', cr.translateInternals.initialize);
-}
-
-main();
-})();
diff --git a/chromium/chrome/browser/resources/translate_internals/translate_internals_resources.grd b/chromium/chrome/browser/resources/translate_internals/translate_internals_resources.grd
deleted file mode 100644
index 3026b892c1b..00000000000
--- a/chromium/chrome/browser/resources/translate_internals/translate_internals_resources.grd
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
- <outputs>
- <output filename="grit/translate_internals_resources.h" type="rc_header">
- <emit emit_type='prepend'></emit>
- </output>
- <output filename="translate_internals_resources.pak" type="data_package" />
- </outputs>
- <release seq="1">
- <includes>
- <include name="IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HTML" file="translate_internals.html" flattenhtml="true" allowexternalscript="true" compress="gzip" type="BINDATA" />
- <include name="IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_JS" file="translate_internals.js" compress="gzip" type="BINDATA" />
- </includes>
- </release>
-</grit>
diff --git a/chromium/chrome/browser/resources/unpack_pak.py b/chromium/chrome/browser/resources/unpack_pak.py
index 9199e49ed3b..d73c71f112f 100755
--- a/chromium/chrome/browser/resources/unpack_pak.py
+++ b/chromium/chrome/browser/resources/unpack_pak.py
@@ -4,6 +4,9 @@
# found in the LICENSE file.
import argparse
+import collections
+import cStringIO
+import gzip
import os
import re
import sys
@@ -20,9 +23,16 @@ _SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..'))
sys.path.insert(1, os.path.join(_SRC_PATH, 'tools', 'grit'))
from grit.format import data_pack
+ResourceFile = collections.namedtuple('ResourceFile',
+ ['path', 'gzipped'])
+
+def UngzipString(data):
+ # Ungzipping using Python's built in gzip.
+ with gzip.GzipFile(fileobj=cStringIO.StringIO(data)) as gzip_file:
+ return gzip_file.read()
def ParseLine(line):
- return re.match(' {"([^"]+)", ([^},]+)', line)
+ return re.match(' {"([^"]+)", ([^},]+)(?:, ([^},]+))?', line)
def Unpack(pak_path, out_path):
@@ -43,23 +53,29 @@ def Unpack(pak_path, out_path):
assert resource_ids
# Associate numerical string IDs to files.
- resource_filenames = dict()
+ resource_files = dict()
resources_map_path = os.path.join(pak_dir, 'grit', pak_id + '_map.cc')
with open(resources_map_path) as resources_map:
for line in resources_map:
res = ParseLine(line)
if res:
- resource_filenames[res.group(2)] = res.group(1)
- assert resource_filenames
+ resource_files[res.group(2)] = ResourceFile(
+ path=res.group(1),
+ gzipped=res.group(3) == 'true')
+ assert resource_files
# Extract packed files, while preserving directory structure.
for (resource_id, text) in data.resources.iteritems():
- filename = resource_filenames[resource_ids[resource_id]]
- dirname = os.path.join(out_path, os.path.dirname(filename))
- if not os.path.exists(dirname):
- os.makedirs(dirname)
- with open(os.path.join(out_path, filename), 'w') as file:
- file.write(text)
+ resource_file = resource_files[resource_ids[resource_id]]
+ file_path = resource_file.path
+ file_gzipped = resource_file.gzipped
+ file_dir = os.path.join(out_path, os.path.dirname(file_path))
+ if not os.path.exists(file_dir):
+ os.makedirs(file_dir)
+ if file_gzipped:
+ text = UngzipString(text)
+ with open(os.path.join(out_path, file_path), 'w') as f:
+ f.write(text)
def main():
diff --git a/chromium/chrome/browser/resources/unpack_pak_test.py b/chromium/chrome/browser/resources/unpack_pak_test.py
index ca5b87a33cf..cbec57a6295 100755
--- a/chromium/chrome/browser/resources/unpack_pak_test.py
+++ b/chromium/chrome/browser/resources/unpack_pak_test.py
@@ -15,6 +15,13 @@ class UnpackPakTest(unittest.TestCase):
self.assertTrue(unpack_pak.ParseLine(' {"path.js", IDR_PATH, false}'))
self.assertTrue(unpack_pak.ParseLine(' {"path.js", IDR_PATH, true}'))
+ def testUngzipString(self):
+ self.assertEqual(
+ unpack_pak.UngzipString(
+ '\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\xcbH\xcd\xc9\xc9W' +
+ '(\xcf/\xcaI\x01\x00\x85\x11J\r\x0b\x00\x00\x00'),
+ 'hello world')
+
if __name__ == '__main__':
unittest.main()
diff --git a/chromium/chrome/browser/resources/usb_internals/BUILD.gn b/chromium/chrome/browser/resources/usb_internals/BUILD.gn
index 2d9afb3b67f..28ec89bb179 100644
--- a/chromium/chrome/browser/resources/usb_internals/BUILD.gn
+++ b/chromium/chrome/browser/resources/usb_internals/BUILD.gn
@@ -6,6 +6,7 @@ import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
+ ":descriptor_panel",
":device_page",
":usb_internals",
]
@@ -13,7 +14,7 @@ js_type_check("closure_compile") {
js_library("usb_internals") {
deps = [
- ":device_page"
+ ":device_page",
"//chrome/browser/ui/webui/usb_internals:mojo_bindings_js_library_for_compile",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:util",
@@ -22,4 +23,10 @@ js_library("usb_internals") {
}
js_library("devices_page") {
+ deps = [
+ ":descriptor_panel",
+ ]
+}
+
+js_library("descriptor_panel") {
}
diff --git a/chromium/chrome/browser/resources/usb_internals/descriptor_panel.js b/chromium/chrome/browser/resources/usb_internals/descriptor_panel.js
new file mode 100644
index 00000000000..2f03c52cc9a
--- /dev/null
+++ b/chromium/chrome/browser/resources/usb_internals/descriptor_panel.js
@@ -0,0 +1,1261 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * Javascript for DescriptorPanel UI, served from
+ * chrome://usb-internals/.
+ */
+
+cr.define('descriptor_panel', function() {
+ // Standard USB requests and descriptor types:
+ const GET_DESCRIPTOR_REQUEST = 0x06;
+ const DEVICE_DESCRIPTOR_TYPE = 0x01;
+ const CONFIGURATION_DESCRIPTOR_TYPE = 0x02;
+ const STRING_DESCRIPTOR_TYPE = 0x03;
+ const INTERFACE_DESCRIPTOR_TYPE = 0x04;
+ const ENDPOINT_DESCRIPTOR_TYPE = 0x05;
+
+ const DEVICE_DESCRIPTOR_LENGTH = 18;
+ const CONFIGURATION_DESCRIPTOR_LENGTH = 9;
+ const INTERFACE_DESCRIPTOR_LENGTH = 9;
+ const ENDPOINT_DESCRIPTOR_LENGTH = 7;
+
+ const CONTROL_TRANSFER_TIMEOUT_MS = 2000; // 2 seconds
+
+ // Language codes are defined in:
+ // https://docs.microsoft.com/en-us/windows/desktop/intl/language-identifier-constants-and-strings
+ const LANGUAGE_CODE_EN_US = 0x0409;
+
+ class DescriptorPanel {
+ /**
+ * @param {!device.mojom.UsbDeviceInterface} usbDeviceProxy
+ * @param {!HTMLElement} rootElement
+ * @param {DescriptorPanel=} stringDescriptorPanel
+ */
+ constructor(
+ usbDeviceProxy, rootElement, stringDescriptorPanel = undefined) {
+ /** @private {!device.mojom.UsbDeviceInterface} */
+ this.usbDeviceProxy_ = usbDeviceProxy;
+
+ /** @private {!HTMLElement} */
+ this.rootElement_ = rootElement;
+
+ this.clearView();
+
+ if (stringDescriptorPanel) {
+ /** @private {!DescriptorPanel} */
+ this.stringDescriptorPanel_ = stringDescriptorPanel;
+ }
+ }
+
+ /**
+ * Adds a display area which contains a tree view and a byte view.
+ * @return {{rawDataTreeRoot:!cr.ui.Tree,rawDataByteElement:!HTMLElement}}
+ * @private
+ */
+ addNewDescriptorDisplayElement_() {
+ const descriptorPanelTemplate =
+ document.querySelector('#descriptor-panel-template');
+ const descriptorPanelClone =
+ document.importNode(descriptorPanelTemplate.content, true);
+
+ /** @private {!HTMLElement} */
+ const rawDataTreeRoot =
+ descriptorPanelClone.querySelector('#raw-data-tree-view');
+ /** @private {!HTMLElement} */
+ const rawDataByteElement =
+ descriptorPanelClone.querySelector('#raw-data-byte-view');
+
+ cr.ui.decorate(rawDataTreeRoot, cr.ui.Tree);
+ rawDataTreeRoot.detail = {payload: {}, children: {}};
+
+ this.rootElement_.appendChild(descriptorPanelClone);
+ return {rawDataTreeRoot, rawDataByteElement};
+ }
+
+ /**
+ * Clears the data first before populating it with the new content.
+ */
+ clearView() {
+ this.rootElement_.querySelectorAll('.descriptor-panel')
+ .forEach(el => el.remove());
+ this.rootElement_.querySelectorAll('error').forEach(el => el.remove());
+ }
+
+ /**
+ * Renders a tree view to display the raw data in readable text.
+ * @param {!cr.ui.Tree|!cr.ui.TreeItem} root
+ * @param {!HTMLElement} rawDataByteElement
+ * @param {!Array<Object>} fields
+ * @param {!Uint8Array} rawData
+ * @param {number} offset
+ * @param {string=} parentClassName
+ * @return {number}
+ * @private
+ */
+ renderRawDataTree_(
+ root, rawDataByteElement, fields, rawData, offset,
+ parentClassName = undefined) {
+ const rawDataByteElements = rawDataByteElement.querySelectorAll('span');
+
+ for (const field of fields) {
+ const className = `field-offset-${offset}`;
+
+ const item = customTreeItem(
+ `${field.label}${field.formatter(rawData, offset)}`, className);
+
+ if (field.isIndex) {
+ this.renderIndexItem_(rawData[offset], item, field.label);
+ }
+
+ for (let i = 0; i < field.size; i++) {
+ rawDataByteElements[offset + i].classList.add(className);
+ if (parentClassName) {
+ rawDataByteElements[offset + i].classList.add(parentClassName);
+ }
+ }
+
+ root.add(item);
+
+ offset += field.size;
+ }
+
+ return offset;
+ }
+
+ /**
+ * Renders a get string descriptor button for the String Descriptor Index
+ * field, and adds an autocomplete value to the index input area in string
+ * descriptor panel.
+ * @param {number} index
+ * @param {cr.ui.TreeItem} item
+ * @param {string} fieldLabel
+ */
+ renderIndexItem_(index, item, fieldLabel) {
+ if (index > 0) {
+ if (!this.stringDescriptorPanel_.stringDescriptorIndexes.has(index)) {
+ const optionElement = cr.doc.createElement('option');
+ optionElement.label = index;
+ optionElement.value = index;
+ this.stringDescriptorPanel_.indexesListElement.appendChild(
+ optionElement);
+
+ this.stringDescriptorPanel_.stringDescriptorIndexes.add(index);
+ }
+
+ const buttonTemplate = document.querySelector('#raw-data-tree-button');
+ const button = document.importNode(buttonTemplate.content, true)
+ .querySelector('button');
+ item.querySelector('.tree-row').appendChild(button);
+ button.addEventListener('click', (event) => {
+ event.stopPropagation();
+ // Clear the previous string descriptors.
+ item.querySelector('.tree-children').textContent = '';
+ this.stringDescriptorPanel_.clearView();
+ this.stringDescriptorPanel_.renderStringDescriptorForAllLanguages(
+ index, item);
+ });
+ } else if (index < 0) {
+ // Delete the ': ' in fieldLabel.
+ const fieldName = fieldLabel.slice(0, -2);
+ this.showError_(`Invalid String Descriptor occurs in \
+ field ${fieldName} of this descriptor.`);
+ }
+ }
+
+ /**
+ * Checks the if the status of a descriptor read indicates success.
+ * @param {number} status
+ * @param {string} defaultMessage
+ * @private
+ */
+ checkDescriptorGetSuccess_(status, defaultMessage) {
+ let failReason = '';
+ switch (status) {
+ case device.mojom.UsbTransferStatus.COMPLETED:
+ return;
+ case device.mojom.UsbTransferStatus.SHORT_PACKET:
+ this.showError_('Descriptor is too short.');
+ return;
+ case device.mojom.UsbTransferStatus.BABBLE:
+ this.showError_('Descriptor is too long.');
+ return;
+ case device.mojom.UsbTransferStatus.TRANSFER_ERROR:
+ failReason = 'Transfer Error';
+ break;
+ case device.mojom.UsbTransferStatus.TIMEOUT:
+ failReason = 'Timeout';
+ break;
+ case device.mojom.UsbTransferStatus.CANCELLED:
+ failReason = 'Transfer was cancelled';
+ break;
+ case device.mojom.UsbTransferStatus.STALLED:
+ failReason = 'Transfer Error';
+ break;
+ case device.mojom.UsbTransferStatus.DISCONNECT:
+ failReason = 'Transfer stalled';
+ break;
+ case device.mojom.UsbTransferStatus.PERMISSION_DENIED:
+ failReason = 'Permission denied';
+ break;
+ }
+ this.showError_(`${defaultMessage} (Reason: ${failReason})`);
+ // Throws an error to stop rendering descriptor.
+ throw new Error(`${defaultMessage} (${failReason})`);
+ }
+
+ /**
+ * Shows an error message if error occurs in getting or rendering
+ * descriptors.
+ * @param {string} message
+ * @private
+ */
+ showError_(message) {
+ const errorTemplate = document.querySelector('#error');
+
+ const clone = document.importNode(errorTemplate.content, true);
+
+ const errorText = clone.querySelector('error');
+ errorText.textContent = message;
+
+ this.rootElement_.prepend(clone);
+ }
+
+ /**
+ * Gets device descriptor of current device.
+ * @return {!Uint8Array}
+ * @private
+ */
+ async getDeviceDescriptor_() {
+ /** @type {device.mojom.UsbControlTransferParams} */
+ const usbControlTransferParams = {};
+ usbControlTransferParams.type =
+ device.mojom.UsbControlTransferType.STANDARD;
+ usbControlTransferParams.recipient =
+ device.mojom.UsbControlTransferRecipient.DEVICE;
+ usbControlTransferParams.request = GET_DESCRIPTOR_REQUEST;
+ usbControlTransferParams.value = (DEVICE_DESCRIPTOR_TYPE << 8);
+ usbControlTransferParams.index = 0;
+ const length = DEVICE_DESCRIPTOR_LENGTH;
+ const timeout = CONTROL_TRANSFER_TIMEOUT_MS;
+
+ await this.usbDeviceProxy_.open();
+
+ const response = await this.usbDeviceProxy_.controlTransferIn(
+ usbControlTransferParams, length, timeout);
+
+ this.checkDescriptorGetSuccess_(
+ response.status, 'Failed to read the device descriptor.');
+
+ return new Uint8Array(response.data);
+ }
+
+ /**
+ * Renders a view to display device descriptor hex data in both tree view
+ * and raw form.
+ */
+ async renderDeviceDescriptor() {
+ let rawData;
+ try {
+ rawData = await this.getDeviceDescriptor_();
+ } catch (e) {
+ // Stop rendering if failed to read the device descriptor.
+ return;
+ }
+
+ const fields = [
+ {
+ label: 'Length: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Descriptor Type: ',
+ size: 1,
+ formatter: formatDescriptorType,
+ },
+ {
+ label: 'USB Version: ',
+ size: 2,
+ formatter: formatUsbVersion,
+ },
+ {
+ label: 'Class Code: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Subclass Code: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Protocol Code: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Control Pipe Maximum Packet Size: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Vendor ID: ',
+ size: 2,
+ formatter: formatTwoBytesToHex,
+ },
+ {
+ label: 'Product ID: ',
+ size: 2,
+ formatter: formatTwoBytesToHex,
+ },
+ {
+ label: 'Device Version: ',
+ size: 2,
+ formatter: formatUsbVersion,
+ },
+ {
+ label: 'Manufacturer String Index: ',
+ size: 1,
+ formatter: formatByte,
+ isIndex: true,
+ },
+ {
+ label: 'Product String Index: ',
+ size: 1,
+ formatter: formatByte,
+ isIndex: true,
+ },
+ {
+ label: 'Serial Number Index: ',
+ size: 1,
+ formatter: formatByte,
+ isIndex: true,
+ },
+ {
+ label: 'Number of Configurations: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ ];
+
+ const displayElement = this.addNewDescriptorDisplayElement_();
+ /** @type {!cr.ui.Tree} */
+ const rawDataTreeRoot = displayElement.rawDataTreeRoot;
+ /** @type {!HTMLElement} */
+ const rawDataByteElement = displayElement.rawDataByteElement;
+
+ renderRawDataBytes(rawDataByteElement, rawData);
+
+ let offset = 0;
+ offset = this.renderRawDataTree_(
+ rawDataTreeRoot, rawDataByteElement, fields, rawData, offset);
+
+ assert(
+ offset === DEVICE_DESCRIPTOR_LENGTH,
+ 'Device Descriptor Rendering Error');
+
+ addMappingAction(rawDataTreeRoot, rawDataByteElement);
+ }
+
+ /**
+ * Gets configuration descriptor of current device.
+ * @return {!Uint8Array}
+ * @private
+ */
+ async getConfigurationDescriptor_() {
+ /** @type {device.mojom.UsbControlTransferParams} */
+ const usbControlTransferParams = {};
+ usbControlTransferParams.type =
+ device.mojom.UsbControlTransferType.STANDARD;
+ usbControlTransferParams.recipient =
+ device.mojom.UsbControlTransferRecipient.DEVICE;
+ usbControlTransferParams.request = GET_DESCRIPTOR_REQUEST;
+ usbControlTransferParams.value = (CONFIGURATION_DESCRIPTOR_TYPE << 8);
+ usbControlTransferParams.index = 0;
+ let length = CONFIGURATION_DESCRIPTOR_LENGTH;
+ const timeout = CONTROL_TRANSFER_TIMEOUT_MS;
+
+ await this.usbDeviceProxy_.open();
+
+ let response = await this.usbDeviceProxy_.controlTransferIn(
+ usbControlTransferParams, length, timeout);
+
+ this.checkDescriptorGetSuccess_(
+ response.status,
+ 'Failed to read the device configuration descriptor to determine ' +
+ 'the total descriptor length.');
+
+ const data = new DataView(new Uint8Array(response.data).buffer);
+ length = data.getUint16(2, true);
+ // Re-gets the data use the full length.
+ response = await this.usbDeviceProxy_.controlTransferIn(
+ usbControlTransferParams, length, timeout);
+
+ this.checkDescriptorGetSuccess_(
+ response.status,
+ 'Failed to read the complete configuration descriptor.');
+
+ return new Uint8Array(response.data);
+ }
+
+ /**
+ * Renders a view to display configuration descriptor hex data in both tree
+ * view and raw form.
+ */
+ async renderConfigurationDescriptor() {
+ let rawData;
+ try {
+ rawData = await this.getConfigurationDescriptor_();
+ } catch (e) {
+ // Stop rendering if failed to read the configuration descriptor.
+ return;
+ }
+
+ const fields = [
+ {
+ label: 'Length: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Descriptor Type: ',
+ size: 1,
+ formatter: formatDescriptorType,
+ },
+ {
+ label: 'Total Length: ',
+ size: 2,
+ formatter: formatShort,
+ },
+ {
+ label: 'Number of Interfaces: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Configuration Value: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Configuration String Index: ',
+ size: 1,
+ formatter: formatByte,
+ isIndex: true,
+ },
+ {
+ label: 'Attribute Bitmap: ',
+ size: 1,
+ formatter: formatBitmap,
+ },
+ {
+ label: 'Max Power (2mA increments): ',
+ size: 1,
+ formatter: formatByte,
+ },
+ ];
+
+ const displayElement = this.addNewDescriptorDisplayElement_();
+ /** @type {!cr.ui.Tree} */
+ const rawDataTreeRoot = displayElement.rawDataTreeRoot;
+ /** @type {!HTMLElement} */
+ const rawDataByteElement = displayElement.rawDataByteElement;
+
+ renderRawDataBytes(rawDataByteElement, rawData);
+
+ let offset = 0;
+ const expectNumInterfaces = rawData[4];
+
+ offset = this.renderRawDataTree_(
+ rawDataTreeRoot, rawDataByteElement, fields, rawData, offset);
+
+ if (offset != CONFIGURATION_DESCRIPTOR_LENGTH) {
+ this.showError_(
+ 'An error occurred while rendering configuration descriptor.');
+ }
+
+ let indexInterface = 0;
+ let indexEndpoint = 0;
+ let indexUnknown = 0;
+ let expectNumEndpoints = 0;
+
+ while ((offset + 1) < rawData.length) {
+ // The descriptor length and type byte still exists.
+ switch (rawData[offset + 1]) {
+ case INTERFACE_DESCRIPTOR_TYPE:
+ [offset, expectNumEndpoints] = this.renderInterfaceDescriptor_(
+ rawDataTreeRoot, rawDataByteElement, rawData, offset,
+ indexInterface, expectNumEndpoints);
+ indexInterface++;
+ break;
+ case ENDPOINT_DESCRIPTOR_TYPE:
+ offset = this.renderEndpointDescriptor_(
+ rawDataTreeRoot, rawDataByteElement, rawData, offset,
+ indexEndpoint);
+ indexEndpoint++;
+ break;
+ default:
+ offset = this.renderUnknownDescriptor_(
+ rawDataTreeRoot, rawDataByteElement, rawData, offset,
+ indexUnknown);
+ indexUnknown++;
+ break;
+ }
+ }
+
+ if (expectNumInterfaces != indexInterface) {
+ this.showError_(`Expected to find \
+ ${expectNumInterfaces} interface descriptors \
+ but only encountered ${indexInterface}.`);
+ }
+
+ if (expectNumEndpoints != indexEndpoint) {
+ this.showError_(`Expected to find \
+ ${expectNumEndpoints} interface descriptors \
+ but only encountered ${indexEndpoint}.`);
+ }
+
+ assert(
+ offset === rawData.length,
+ 'Complete Configuration Descriptor Rendering Error');
+
+ addMappingAction(rawDataTreeRoot, rawDataByteElement);
+ }
+
+ /**
+ * Renders a tree item to display interface descriptor at index
+ * indexInterface.
+ * @param {!cr.ui.Tree} rawDataTreeRoot
+ * @param {!HTMLElement} rawDataByteElement
+ * @param {!Uint8Array} rawData
+ * @param {number} originalOffset
+ * @param {number} indexInterface
+ * @param {number} expectNumEndpoints
+ * @return {!Array<number>}
+ * @private
+ */
+ renderInterfaceDescriptor_(
+ rawDataTreeRoot, rawDataByteElement, rawData, originalOffset,
+ indexInterface, expectNumEndpoints) {
+ if (originalOffset + INTERFACE_DESCRIPTOR_LENGTH > rawData.length) {
+ this.showError_(`Failed to read the interface descriptor\
+ at index ${indexInterface}.`);
+ }
+
+ const interfaceItem = customTreeItem(
+ `Interface ${indexInterface}`,
+ `descriptor-interface-${indexInterface}`);
+ rawDataTreeRoot.add(interfaceItem);
+
+ const fields = [
+ {
+ label: 'Length: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Descriptor Type: ',
+ size: 1,
+ formatter: formatDescriptorType,
+ },
+ {
+ label: 'Interface Number: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Alternate String: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Number of Endpoint: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Interface Class Code: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Interface Subclass Code: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Interface Protocol Code: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Interface String Index: ',
+ size: 1,
+ formatter: formatByte,
+ isIndex: true,
+ },
+ ];
+
+ let offset = originalOffset;
+
+ expectNumEndpoints += rawData[offset + 4];
+
+ offset = this.renderRawDataTree_(
+ interfaceItem, rawDataByteElement, fields, rawData, offset,
+ `descriptor-interface-${indexInterface}`);
+
+ if (offset != originalOffset + INTERFACE_DESCRIPTOR_LENGTH) {
+ this.showError_(
+ `An error occurred while rendering interface descriptor at \
+ index ${indexInterface}.`);
+ }
+
+ return [offset, expectNumEndpoints];
+ }
+
+ /**
+ * Renders a tree item to display endpoint descriptor at index
+ * indexEndpoint.
+ * @param {!cr.ui.Tree} rawDataTreeRoot
+ * @param {!HTMLElement} rawDataByteElement
+ * @param {!Uint8Array} rawData
+ * @param {number} originalOffset
+ * @param {number} indexEndpoint
+ * @return {number}
+ * @private
+ */
+ renderEndpointDescriptor_(
+ rawDataTreeRoot, rawDataByteElement, rawData, originalOffset,
+ indexEndpoint) {
+ if (originalOffset + ENDPOINT_DESCRIPTOR_LENGTH > rawData.length) {
+ this.showError_(`Failed to read the endpoint descriptor at \
+ index ${indexEndpoint}.`);
+ }
+
+ const endpointItem = customTreeItem(
+ `Endpoint ${indexEndpoint}`, `descriptor-endpoint-${indexEndpoint}`);
+ rawDataTreeRoot.add(endpointItem);
+
+ const fields = [
+ {
+ label: 'Length: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Descriptor Type: ',
+ size: 1,
+ formatter: formatDescriptorType,
+ },
+ {
+ label: 'EndPoint Address: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Attribute Bitmap: ',
+ size: 1,
+ formatter: formatBitmap,
+ },
+ {
+ label: 'Max Packet Size: ',
+ size: 2,
+ formatter: formatShort,
+ },
+ {
+ label: 'Interval: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ ];
+
+ let offset = originalOffset;
+ offset = this.renderRawDataTree_(
+ endpointItem, rawDataByteElement, fields, rawData, offset,
+ `descriptor-endpoint-${indexEndpoint}`);
+
+ if (offset != originalOffset + ENDPOINT_DESCRIPTOR_LENGTH) {
+ this.showError_(
+ `An error occurred while rendering endpoint descriptor at \
+ index ${indexEndpoint}.`);
+ }
+
+ return offset;
+ }
+
+ /**
+ * Renders a tree item to display length and type of unknown descriptor at
+ * index indexUnknown.
+ * @param {!cr.ui.Tree} rawDataTreeRoot
+ * @param {!HTMLElement} rawDataByteElement
+ * @param {!Uint8Array} rawData
+ * @param {number} originalOffset
+ * @param {number} indexUnknown
+ * @return {number}
+ * @private
+ */
+ renderUnknownDescriptor_(
+ rawDataTreeRoot, rawDataByteElement, rawData, originalOffset,
+ indexUnknown) {
+ const length = rawData[originalOffset];
+
+ if (originalOffset + length > rawData.length) {
+ this.showError_(
+ `Failed to read the unknown descriptor at index ${indexUnknown}.`);
+ return;
+ }
+
+ const unknownItem = customTreeItem(
+ `Unknown Descriptor ${indexUnknown}`,
+ `descriptor-unknown-${indexUnknown}`);
+ rawDataTreeRoot.add(unknownItem);
+
+ const fields = [
+ {
+ label: 'Length: ',
+ size: 1,
+ formatter: formatByte,
+ },
+ {
+ label: 'Descriptor Type: ',
+ size: 1,
+ formatter: formatDescriptorType,
+ },
+ ];
+
+ let offset = originalOffset;
+ offset = this.renderRawDataTree_(
+ unknownItem, rawDataByteElement, fields, rawData, offset,
+ `descriptor-unknown-${indexUnknown}`);
+
+ const rawDataByteElements = rawDataByteElement.querySelectorAll('span');
+
+ for (; offset < originalOffset + length; offset++) {
+ rawDataByteElements[offset].classList.add(`field-offset-${offset}`);
+ rawDataByteElements[offset].classList.add(
+ `descriptor-unknown-${indexUnknown}`);
+ }
+
+ return offset;
+ }
+
+ /**
+ * Gets all the Supported Language Code of this device, and adds them to
+ * autocomplete value of the language code input area in string descriptor
+ * panel.
+ * @return {!Array<number>}
+ */
+ async getAllLanguageCodes() {
+ /** @type {device.mojom.UsbControlTransferParams} */
+ const usbControlTransferParams = {};
+ usbControlTransferParams.type =
+ device.mojom.UsbControlTransferType.STANDARD;
+ usbControlTransferParams.recipient =
+ device.mojom.UsbControlTransferRecipient.DEVICE;
+ usbControlTransferParams.request = GET_DESCRIPTOR_REQUEST;
+ usbControlTransferParams.value = (STRING_DESCRIPTOR_TYPE << 8);
+ usbControlTransferParams.index = 0;
+ const length = 0xFF;
+ const timeout = CONTROL_TRANSFER_TIMEOUT_MS;
+
+ await this.usbDeviceProxy_.open();
+
+ const response = await this.usbDeviceProxy_.controlTransferIn(
+ usbControlTransferParams, length, timeout);
+
+ try {
+ this.checkDescriptorGetSuccess_(
+ response.status,
+ 'Failed to read the device string descriptor to determine ' +
+ 'all supported languages.');
+ } catch (e) {
+ // Stop rendering autocomplete datalist if failed to read the string
+ // descriptor.
+ return;
+ }
+
+ const responseData = new Uint8Array(response.data);
+ this.languageCodesListElement_.innerText = '';
+
+ const optionAllElement = cr.doc.createElement('option');
+ optionAllElement.value = 'All';
+ this.languageCodesListElement_.appendChild(optionAllElement);
+
+ const languageCodesList = [];
+ // First two bytes are length and descriptor type(0x03);
+ for (let i = 2; i < responseData.length; i += 2) {
+ const languageCode = parseShort(responseData, i);
+
+ const optionElement = cr.doc.createElement('option');
+ optionElement.label = parseLanguageCode(languageCode);
+ optionElement.value = `0x${toHex(languageCode, 4)}`;
+
+ this.languageCodesListElement_.appendChild(optionElement);
+
+ languageCodesList.push(languageCode);
+ }
+
+ return languageCodesList;
+ }
+
+ /**
+ * Gets string descriptor of current device with index and language code.
+ * @param {number}
+ * @param {number}
+ * @return {{languageCode:string,rawData:!Uint8Array}}
+ * @private
+ */
+ async getStringDescriptorForLanguageCode_(index, languageCode) {
+ await this.usbDeviceProxy_.open();
+
+ /** @type {device.mojom.UsbControlTransferParams} */
+ const usbControlTransferParams = {};
+ usbControlTransferParams.type =
+ device.mojom.UsbControlTransferType.STANDARD;
+ usbControlTransferParams.recipient =
+ device.mojom.UsbControlTransferRecipient.DEVICE;
+ usbControlTransferParams.request = GET_DESCRIPTOR_REQUEST;
+ const length = 0xFF;
+ const timeout = CONTROL_TRANSFER_TIMEOUT_MS;
+
+ usbControlTransferParams.index = languageCode;
+
+ usbControlTransferParams.value = (STRING_DESCRIPTOR_TYPE << 8) | index;
+
+ const response = await this.usbDeviceProxy_.controlTransferIn(
+ usbControlTransferParams, length, timeout);
+
+ const languageCodeStr = parseLanguageCode(languageCode);
+ this.checkDescriptorGetSuccess_(
+ response.status, `Failed to read the device string descriptor of\
+ index: ${index}, language: ${languageCodeStr}.`);
+
+ const rawData = new Uint8Array(response.data);
+ return {languageCodeStr, rawData};
+ }
+
+ /**
+ * Gets string descriptor of current device with given index and language
+ * code.
+ * @param {number} index
+ * @param {number} languageCode
+ * @param {cr.ui.TreeItem=} treeItem
+ */
+ async renderStringDescriptorForLanguageCode(
+ index, languageCode, treeItem = undefined) {
+ this.rootElement_.hidden = false;
+
+ this.indexInput_.value = index;
+
+ let rawDataMap;
+ try {
+ rawDataMap =
+ await this.getStringDescriptorForLanguageCode_(index, languageCode);
+ } catch (e) {
+ // Stop rendering if failed to read the string descriptor.
+ return;
+ }
+
+ const languageStr = rawDataMap.languageCodeStr;
+ const rawData = rawDataMap.rawData;
+
+ const length = rawData[0];
+ if (length > rawData.length) {
+ this.showError_(`Failed to read the string descriptor at \
+ index ${index} in ${languageStr}.`);
+ return;
+ }
+
+ const fields = [
+ {
+ 'label': 'Length: ',
+ 'size': 1,
+ 'formatter': formatByte,
+ },
+ {
+ 'label': 'Descriptor Type: ',
+ 'size': 1,
+ 'formatter': formatDescriptorType,
+ },
+ ];
+
+ // The first two elements are length and descriptor type.
+ for (let i = 2; i < rawData.length; i += 2) {
+ const field = {
+ 'label': '',
+ 'size': 2,
+ 'formatter': formatLetter,
+ };
+ fields.push(field);
+ }
+
+ const displayElement = this.addNewDescriptorDisplayElement_();
+ /** @type {!cr.ui.Tree} */
+ const rawDataTreeRoot = displayElement.rawDataTreeRoot;
+ /** @type {!HTMLElement} */
+ const rawDataByteElement = displayElement.rawDataByteElement;
+
+ const stringDescriptorItem = customTreeItem(
+ `${languageStr}: ${decodeArray(rawData)}`,
+ `descriptor-string-${index}-language-code-${languageStr}`);
+ rawDataTreeRoot.add(stringDescriptorItem);
+ if (treeItem) {
+ treeItem.add(customTreeItem(`${languageStr}: ${decodeArray(rawData)}`));
+ treeItem.expanded = true;
+ }
+
+ renderRawDataBytes(rawDataByteElement, rawData);
+
+ let offset = 0;
+ offset = this.renderRawDataTree_(
+ stringDescriptorItem, rawDataByteElement, fields, rawData, offset,
+ `descriptor-string-${index}-language-code-${languageStr}`);
+
+ addMappingAction(rawDataTreeRoot, rawDataByteElement);
+ }
+
+ /**
+ * Gets string descriptor in all supported languages of current device with
+ * given index.
+ * @param {number} index
+ * @param {cr.ui.TreeItem=} treeItem
+ */
+ async renderStringDescriptorForAllLanguages(index, treeItem = undefined) {
+ this.rootElement_.hidden = false;
+
+ this.indexInput_.value = index;
+
+ /** @type {!Array<number>|undefined} */
+ const languageCodesList = await this.getAllLanguageCodes();
+
+ for (const languageCode of languageCodesList) {
+ await this.renderStringDescriptorForLanguageCode(
+ index, languageCode, treeItem);
+ }
+ }
+
+ /**
+ * Initializes the string descriptor panel for autocomplete functionality.
+ * @param {number} tabId
+ */
+ initialStringDescriptorPanel(tabId) {
+ // Binds the input area and datalist use each tab's unique id.
+ this.rootElement_.querySelectorAll('input').forEach(
+ el => el.setAttribute('list', `${el.getAttribute('list')}-${tabId}`));
+ this.rootElement_.querySelectorAll('datalist')
+ .forEach(el => el.id = `${el.id}-${tabId}`);
+
+ /** @type {!HTMLElement} */
+ const button = this.rootElement_.querySelector('button');
+ /** @type {!HTMLElement} */
+ this.indexInput_ = this.rootElement_.querySelector('#index-input');
+ /** @type {!HTMLElement} */
+ const languageCodeInput =
+ this.rootElement_.querySelector('#language-code-input');
+
+ button.addEventListener('click', () => {
+ this.clearView();
+ const index = Number.parseInt(this.indexInput_.value);
+ if (this.checkIndexValueValid_(index)) {
+ if (languageCodeInput.value === 'All') {
+ this.renderStringDescriptorForAllLanguages(index);
+ } else {
+ const languageCode = Number.parseInt(languageCodeInput.value);
+ if (this.checkLanguageCodeValueValid_(languageCode)) {
+ this.renderStringDescriptorForLanguageCode(index, languageCode);
+ }
+ }
+ }
+ });
+
+ /** @type {!Set<number>} */
+ this.stringDescriptorIndexes = new Set();
+ /** @type {!HTMLElement} */
+ this.indexesListElement =
+ this.rootElement_.querySelector(`#indexes-${tabId}`);
+ /** @type {!HTMLElement} */
+ this.languageCodesListElement_ =
+ this.rootElement_.querySelector(`#languages-${tabId}`);
+ }
+
+ /**
+ * Checks if the user input index is a valid uint8 number.
+ * @param {number} index
+ * @return {boolean}
+ */
+ checkIndexValueValid_(index) {
+ // index is 8 bit. 0 is reserved to query all supported language codes.
+ if (Number.isNaN(index) || index < 1 || index > 255) {
+ this.showError_('Invalid Index.');
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Checks if the user input language code is a valid uint16 number.
+ * @param {number} languageCode
+ * @return {boolean}
+ */
+ checkLanguageCodeValueValid_(languageCode) {
+ if (Number.isNaN(languageCode) || languageCode < 0 ||
+ languageCode > 65535) {
+ this.showError_('Invalid Language Code.');
+ return false;
+ }
+ return true;
+ }
+ }
+
+ /**
+ * Renders a customized TreeItem with the given content and class name.
+ * @param {string} itemLabel
+ * @param {string=} className
+ * @return {!cr.ui.TreeItem}
+ */
+ function customTreeItem(itemLabel, className = undefined) {
+ const item = new cr.ui.TreeItem({
+ label: itemLabel,
+ icon: '',
+ });
+ if (className) {
+ item.querySelector('.tree-row').classList.add(className);
+ }
+ return item;
+ }
+
+ /**
+ * Adds function for mapping between two views.
+ * @param {!cr.ui.Tree} rawDataTreeRoot
+ * @param {!HTMLElement} rawDataByteElement
+ */
+ function addMappingAction(rawDataTreeRoot, rawDataByteElement) {
+ // Highlights the byte(s) that hovered in the tree.
+ rawDataTreeRoot.querySelectorAll('.tree-row').forEach((el) => {
+ const classList = el.classList;
+ // classList[0] is 'tree-row'. classList[1] of tree item for fields
+ // starts with 'field-offset-', and classList[1] of tree item for
+ // descriptors (ie. endpoint descriptor) is descriptor type and index.
+ const fieldOffsetOrDescriptorClass = classList[1];
+ assert(
+ fieldOffsetOrDescriptorClass.startsWith('field-offset-') ||
+ fieldOffsetOrDescriptorClass.startsWith('descriptor-'));
+
+ el.addEventListener('pointerenter', (event) => {
+ rawDataByteElement.querySelectorAll(`.${fieldOffsetOrDescriptorClass}`)
+ .forEach((el) => el.classList.add('hovered-field'));
+ event.stopPropagation();
+ });
+
+ el.addEventListener('pointerleave', () => {
+ rawDataByteElement.querySelectorAll(`.${fieldOffsetOrDescriptorClass}`)
+ .forEach((el) => el.classList.remove('hovered-field'));
+ });
+
+ el.addEventListener('click', (event) => {
+ if (event.target.className != 'expand-icon') {
+ // Clears all the selected elements before select another.
+ rawDataByteElement.querySelectorAll('#raw-data-byte-view span')
+ .forEach((el) => el.classList.remove('selected-field'));
+
+ rawDataByteElement
+ .querySelectorAll(`.${fieldOffsetOrDescriptorClass}`)
+ .forEach((el) => el.classList.add('selected-field'));
+ }
+ });
+ });
+
+ // Selects the tree item that displays the byte hovered in the raw view.
+ const rawDataByteElements = rawDataByteElement.querySelectorAll('span');
+ rawDataByteElements.forEach((el) => {
+ const classList = el.classList;
+
+ const fieldOffsetClass = classList[0];
+ assert(fieldOffsetClass.startsWith('field-offset-'));
+
+ el.addEventListener('pointerenter', () => {
+ rawDataByteElement.querySelectorAll(`.${fieldOffsetClass}`)
+ .forEach((el) => el.classList.add('hovered-field'));
+ const el = rawDataTreeRoot.querySelector(`.${fieldOffsetClass}`);
+ if (el) {
+ el.classList.add('hover');
+ }
+ });
+
+ el.addEventListener('pointerleave', () => {
+ rawDataByteElement.querySelectorAll(`.${fieldOffsetClass}`)
+ .forEach((el) => el.classList.remove('hovered-field'));
+ const el = rawDataTreeRoot.querySelector(`.${fieldOffsetClass}`);
+ if (el) {
+ el.classList.remove('hover');
+ }
+ });
+
+ el.addEventListener('click', () => {
+ const el = rawDataTreeRoot.querySelector(`.${fieldOffsetClass}`);
+ if (el) {
+ el.click();
+ }
+ });
+ });
+ }
+
+ /**
+ * Renders an element to display the raw data in hex, byte by byte, and
+ * keeps every row no more than 16 bytes.
+ * @param {!HTMLElement} rawDataByteElement
+ * @param {!Uint8Array} rawData
+ */
+ function renderRawDataBytes(rawDataByteElement, rawData) {
+ const rawDataByteContainerTemplate =
+ document.querySelector('#raw-data-byte-container-template');
+ const rawDataByteContainerClone =
+ document.importNode(rawDataByteContainerTemplate.content, true);
+ const rawDataByteContainerElement =
+ rawDataByteContainerClone.querySelector('div');
+
+ const rawDataByteTemplate =
+ document.querySelector('#raw-data-byte-template');
+ for (const value of rawData) {
+ const rawDataByteClone =
+ document.importNode(rawDataByteTemplate.content, true);
+ const rawDataByteElement = rawDataByteClone.querySelector('span');
+
+ rawDataByteElement.textContent = toHex(value, 2);
+ rawDataByteContainerElement.appendChild(rawDataByteElement);
+ }
+ rawDataByteElement.appendChild(rawDataByteContainerElement);
+ }
+
+ /**
+ * Converts a number to a hexadecimal string padded with zeros to the given
+ * number of digits.
+ * @param {number} number
+ * @param {number} numOfDigits
+ * @return {string}
+ */
+ function toHex(number, numOfDigits) {
+ return number.toString(16)
+ .padStart(numOfDigits, '0')
+ .slice(0 - numOfDigits)
+ .toUpperCase();
+ }
+
+ /**
+ * Parses unicode array to string.
+ * @param {!Uint8Array} arr
+ * @return {string}
+ */
+ function decodeArray(arr) {
+ let str = '';
+ // The first two elements are length and descriptor type.
+ for (let i = 2; i < arr.length; i += 2) {
+ str += formatLetter(arr, i);
+ }
+ return str;
+ }
+
+ /**
+ * Parses one byte to decimal number string.
+ * @param {!Uint8Array} rawData
+ * @param {number} offset
+ * @return {string}
+ */
+ function formatByte(rawData, offset) {
+ return rawData[offset].toString();
+ }
+
+ /**
+ * Parses two bytes to decimal number.
+ * @param {!Uint8Array} rawData
+ * @param {number} offset
+ * @return {number}
+ */
+ function parseShort(rawData, offset) {
+ const data = new DataView(rawData.buffer);
+ return data.getUint16(offset, true);
+ }
+
+ /**
+ * Parses two bytes to decimal number string.
+ * @param {!Uint8Array} rawData
+ * @param {number} offset
+ * @return {string}
+ */
+ function formatShort(rawData, offset) {
+ return parseShort(rawData, offset).toString();
+ }
+
+ /**
+ * Parses two bytes to decimal number string.
+ * @param {!Uint8Array} rawData
+ * @param {number} offset
+ * @return {string}
+ */
+ function formatLetter(rawData, offset) {
+ const num = parseShort(rawData, offset);
+ return String.fromCodePoint(num);
+ }
+
+ /**
+ * Parses two bytes to a hex string.
+ * @param {!Uint8Array} rawData
+ * @param {number} offset
+ * @return {string}
+ */
+ function formatTwoBytesToHex(rawData, offset) {
+ const num = parseShort(rawData, offset);
+ return `0x${toHex(num, 4)}`;
+ }
+
+ /**
+ * Parses two bytes to USB version format.
+ * @param {!Uint8Array} rawData
+ * @param {number} offset
+ * @return {string}
+ */
+ function formatUsbVersion(rawData, offset) {
+ return `${rawData[offset + 1]}.${rawData[offset] >> 4}.${
+ rawData[offset] & 0x0F}`;
+ }
+
+ /**
+ * Parses one byte to a bitmap.
+ * @param {!Uint8Array} rawData
+ * @param {number} offset
+ * @return {string}
+ */
+ function formatBitmap(rawData, offset) {
+ return rawData[offset].toString(2).padStart(8, '0').slice(-8);
+ }
+
+ /**
+ * Parses descriptor type to a hex string.
+ * @param {!Uint8Array} rawData
+ * @param {number} offset
+ * @return {string}
+ */
+ function formatDescriptorType(rawData, offset) {
+ return `0x${toHex(rawData[offset], 2)}`;
+ }
+
+ /**
+ * Parses language code to readable language name.
+ * @param {number} languageCode
+ * @return {string}
+ */
+ function parseLanguageCode(languageCode) {
+ switch (languageCode) {
+ case LANGUAGE_CODE_EN_US:
+ return 'en-US';
+ default:
+ return `0x${toHex(languageCode, 4)}`;
+ }
+ }
+
+ return {
+ DescriptorPanel,
+ };
+});
diff --git a/chromium/chrome/browser/resources/usb_internals/devices_page.js b/chromium/chrome/browser/resources/usb_internals/devices_page.js
index 134977cf02f..e09e3afde31 100644
--- a/chromium/chrome/browser/resources/usb_internals/devices_page.js
+++ b/chromium/chrome/browser/resources/usb_internals/devices_page.js
@@ -8,36 +8,360 @@
*/
cr.define('devices_page', function() {
+ const UsbDeviceProxy = device.mojom.UsbDeviceProxy;
+
/**
- * Sets the device collection for the page's device table.
- * @param {!Array<!device.mojom.UsbDeviceInfo>} devices
+ * Page that contains a tab header and a tab panel displaying devices table.
*/
- function setDevices(devices) {
- const tableBody = $('device-list');
- tableBody.innerHTML = '';
+ class DevicesPage {
+ /**
+ * @param {!device.mojom.UsbDeviceManagerProxy} usbManager
+ */
+ constructor(usbManager) {
+ /** @private {device.mojom.UsbDeviceManagerProxy} */
+ this.usbManager_ = usbManager;
+
+ this.renderDeviceList_();
+ }
+
+ /**
+ * Sets the device collection for the page's device table.
+ * @private
+ */
+ async renderDeviceList_() {
+ const response = await this.usbManager_.getDevices();
+
+ /** @type {!Array<!device.mojom.UsbDeviceInfo>} */
+ const devices = response.results;
+
+ const tableBody = $('device-list');
+ tableBody.innerHTML = '';
- const rowTemplate = document.querySelector('#device-row');
+ const rowTemplate = document.querySelector('#device-row');
- for (const device of devices) {
- const clone = document.importNode(rowTemplate.content, true);
+ for (const device of devices) {
+ const clone = document.importNode(rowTemplate.content, true);
- const td = clone.querySelectorAll('td');
+ const td = clone.querySelectorAll('td');
- td[0].textContent = device.busNumber;
- td[1].textContent = device.portNumber;
- td[2].textContent = toHex(device.vendorId);
- td[3].textContent = toHex(device.productId);
- if (device.manufacturerName) {
- td[4].textContent = decodeString16(device.manufacturerName.data);
+ td[0].textContent = device.busNumber;
+ td[1].textContent = device.portNumber;
+ td[2].textContent = toHex(device.vendorId);
+ td[3].textContent = toHex(device.productId);
+ if (device.manufacturerName) {
+ td[4].textContent = decodeString16(device.manufacturerName.data);
+ }
+ if (device.productName) {
+ td[5].textContent = decodeString16(device.productName.data);
+ }
+ if (device.serialNumber) {
+ td[6].textContent = decodeString16(device.serialNumber.data);
+ }
+
+ const inspectButton = clone.querySelector('button');
+ inspectButton.addEventListener('click', () => {
+ this.switchToTab_(device);
+ });
+
+ tableBody.appendChild(clone);
}
+ }
+
+ /**
+ * Switches to the device's tab, creating one if necessary.
+ * @param {!device.mojom.UsbDeviceInfo} device
+ * @private
+ */
+ switchToTab_(device) {
+ const tabId = device.guid;
+
+ if (null == $(tabId)) {
+ const devicePage = new DevicePage(this.usbManager_, device);
+ }
+ $(tabId).selected = true;
+ }
+ }
+
+ /**
+ * Page that contains a tree view displaying devices detail and can get
+ * descriptors.
+ */
+ class DevicePage {
+ /**
+ * @param {!device.mojom.UsbDeviceManagerProxy} usbManager
+ * @param {!device.mojom.UsbDeviceInfo} device
+ */
+ constructor(usbManager, device) {
+ /** @private {device.mojom.UsbDeviceManagerProxy} */
+ this.usbManager_ = usbManager;
+
+ this.renderTab(device);
+ }
+
+ /**
+ * Renders a tab to display a tree view showing device's detail information.
+ * @param {!device.mojom.UsbDeviceInfo} device
+ * @private
+ */
+ renderTab(device) {
+ const tabs = document.querySelector('tabs');
+
+ const tabTemplate = document.querySelector('#tab-template');
+ const tabClone = document.importNode(tabTemplate.content, true);
+
+ const tab = tabClone.querySelector('tab');
if (device.productName) {
- td[5].textContent = decodeString16(device.productName.data);
+ tab.textContent = decodeString16(device.productName.data);
+ } else {
+ const vendorId = toHex(device.vendorId).slice(2);
+ const productId = toHex(device.productId).slice(2);
+ tab.textContent = `${vendorId}:${productId}`;
+ }
+ tab.id = device.guid;
+
+ tabs.appendChild(tabClone);
+ cr.ui.decorate('tab', cr.ui.Tab);
+
+ const tabPanels = document.querySelector('tabpanels');
+
+ const tabPanelTemplate = document.querySelector('#tabpanel-template');
+ const tabPanelClone = document.importNode(tabPanelTemplate.content, true);
+
+ /**
+ * Root of the WebContents tree of current device.
+ * @type {cr.ui.Tree|null}
+ */
+ const treeViewRoot = tabPanelClone.querySelector('#tree-view');
+ cr.ui.decorate(treeViewRoot, cr.ui.Tree);
+ treeViewRoot.detail = {payload: {}, children: {}};
+ // Clear the tree first before populating it with the new content.
+ treeViewRoot.innerText = '';
+ this.renderDeviceTree_(device, treeViewRoot);
+
+ const usbDeviceProxy = new UsbDeviceProxy;
+ this.usbManager_.getDevice(device.guid, usbDeviceProxy.$.createRequest());
+
+ const getStringDescriptorButton =
+ tabPanelClone.querySelector('#string-descriptor-button');
+ const stringDescriptorElement =
+ tabPanelClone.querySelector('.string-descriptor-panel');
+ const stringDescriptorPanel = new descriptor_panel.DescriptorPanel(
+ usbDeviceProxy, stringDescriptorElement);
+ stringDescriptorPanel.initialStringDescriptorPanel(tab.id);
+ getStringDescriptorButton.addEventListener('click', () => {
+ stringDescriptorElement.hidden = !stringDescriptorElement.hidden;
+
+ // Clear the panel before rendering new data.
+ stringDescriptorPanel.clearView();
+
+ if (!stringDescriptorElement.hidden) {
+ stringDescriptorPanel.getAllLanguageCodes();
+ }
+ });
+
+ const getDeviceDescriptorButton =
+ tabPanelClone.querySelector('#device-descriptor-button');
+ const deviceDescriptorElement =
+ tabPanelClone.querySelector('.device-descriptor-panel');
+ const deviceDescriptorPanel = new descriptor_panel.DescriptorPanel(
+ usbDeviceProxy, deviceDescriptorElement, stringDescriptorPanel);
+ getDeviceDescriptorButton.addEventListener('click', () => {
+ deviceDescriptorElement.hidden = !deviceDescriptorElement.hidden;
+
+ // Clear the panel before rendering new data.
+ deviceDescriptorPanel.clearView();
+
+ if (!deviceDescriptorElement.hidden) {
+ deviceDescriptorPanel.renderDeviceDescriptor();
+ }
+ });
+
+ const getConfigurationDescriptorButton =
+ tabPanelClone.querySelector('#configuration-descriptor-button');
+ const configurationDescriptorElement =
+ tabPanelClone.querySelector('.configuration-descriptor-panel');
+ const configurationDescriptorPanel = new descriptor_panel.DescriptorPanel(
+ usbDeviceProxy, configurationDescriptorElement,
+ stringDescriptorPanel);
+ getConfigurationDescriptorButton.addEventListener('click', () => {
+ configurationDescriptorElement.hidden =
+ !configurationDescriptorElement.hidden;
+
+ // Clear the panel before rendering new data.
+ configurationDescriptorPanel.clearView();
+
+ if (!configurationDescriptorElement.hidden) {
+ configurationDescriptorPanel.renderConfigurationDescriptor();
+ }
+ });
+
+ tabPanels.appendChild(tabPanelClone);
+ cr.ui.decorate('tabpanel', cr.ui.TabPanel);
+ }
+
+ /**
+ * Renders a tree to display the device's detail information.
+ * @param {!device.mojom.UsbDeviceInfo} device
+ * @param {!cr.ui.Tree} root
+ * @private
+ */
+ renderDeviceTree_(device, root) {
+ root.add(customTreeItem(`USB Version: ${device.usbVersionMajor}.${
+ device.usbVersionMinor}.${device.usbVersionSubminor}`));
+
+ root.add(customTreeItem(`Class Code: ${device.classCode}`));
+
+ root.add(customTreeItem(`Subclass Code: ${device.subclassCode}`));
+
+ root.add(customTreeItem(`Protocol Code: ${device.protocolCode}`));
+
+ root.add(customTreeItem(`Port Number: ${device.portNumber}`));
+
+ root.add(customTreeItem(`Vendor Id: ${toHex(device.vendorId)}`));
+
+ root.add(customTreeItem(`Product Id: ${toHex(device.productId)}`));
+
+ root.add(customTreeItem(`Device Version: ${device.deviceVersionMajor}.${
+ device.deviceVersionMinor}.${device.deviceVersionSubminor}`));
+
+ root.add(customTreeItem(`Manufacturer Name: ${
+ decodeString16(device.manufacturerName.data)}`));
+
+ root.add(customTreeItem(
+ `Product Name: ${decodeString16(device.productName.data)}`));
+
+ root.add(customTreeItem(
+ `Serial Number: ${decodeString16(device.serialNumber.data)}`));
+
+ root.add(customTreeItem(
+ `WebUSB Landing Page: ${device.webusbLandingPage.url}`));
+
+ root.add(customTreeItem(
+ `Active Configuration: ${device.activeConfiguration}`));
+
+ const configurationsArray = device.configurations;
+ this.renderConfigurationTreeItem_(configurationsArray, root);
+ }
+
+ /**
+ * Renders a tree item to display the device's configurations information.
+ * @param {!Array<!device.mojom.UsbConfigurationInfo>} configurationsArray
+ * @param {!cr.ui.TreeItem} root
+ * @private
+ */
+ renderConfigurationTreeItem_(configurationsArray, root) {
+ for (const configuration of configurationsArray) {
+ const configurationItem =
+ customTreeItem(`Configuration ${configuration.configurationValue}`);
+
+ if (configuration.configurationName) {
+ configurationItem.add(customTreeItem(`Configuration Name: ${
+ decodeString16(configuration.configurationName.data)}`));
+ }
+
+ const interfacesArray = configuration.interfaces;
+ this.renderInterfacesTreeItem_(interfacesArray, configurationItem);
+
+ root.add(configurationItem);
+ }
+ }
+
+ /**
+ * Renders a tree item to display the device's interfaces information.
+ * @param {!Array<!device.mojom.UsbInterfaceInfo>} interfacesArray
+ * @param {!cr.ui.TreeItem} root
+ * @private
+ */
+ renderInterfacesTreeItem_(interfacesArray, root) {
+ for (const currentInterface of interfacesArray) {
+ const interfaceItem =
+ customTreeItem(`Interface ${currentInterface.interfaceNumber}`);
+
+ const alternatesArray = currentInterface.alternates;
+ this.renderAlternatesTreeItem_(alternatesArray, interfaceItem);
+
+ root.add(interfaceItem);
}
- if (device.serialNumber) {
- td[6].textContent = decodeString16(device.serialNumber.data);
+ }
+
+ /**
+ * Renders a tree item to display the device's alternate interfaces
+ * information.
+ * @param {!Array<!device.mojom.UsbAlternateInterfaceInfo>} alternatesArray
+ * @param {!cr.ui.TreeItem} root
+ * @private
+ */
+ renderAlternatesTreeItem_(alternatesArray, root) {
+ for (const alternate of alternatesArray) {
+ const alternateItem =
+ customTreeItem(`Alternate ${alternate.alternateSetting}`);
+
+ alternateItem.add(customTreeItem(`Class Code: ${alternate.classCode}`));
+
+ alternateItem.add(
+ customTreeItem(`Subclass Code: ${alternate.subclassCode}`));
+
+ alternateItem.add(
+ customTreeItem(`Protocol Code: ${alternate.protocolCode}`));
+
+ if (alternate.interfaceName) {
+ alternateItem.add(customTreeItem(`Interface Name: ${
+ decodeString16(alternate.interfaceName.data)}`));
+ }
+
+ const endpointsArray = alternate.endpoints;
+ this.renderEndpointsTreeItem_(endpointsArray, alternateItem);
+
+ root.add(alternateItem);
}
+ }
+
+ /**
+ * Renders a tree item to display the device's endpoints information.
+ * @param {!Array<!device.mojom.UsbEndpointInfo>} endpointsArray
+ * @param {!cr.ui.TreeItem} root
+ * @private
+ */
+ renderEndpointsTreeItem_(endpointsArray, root) {
+ for (const endpoint of endpointsArray) {
+ let itemLabel = 'Endpoint ';
+
+ itemLabel += endpoint.endpointNumber;
- tableBody.appendChild(clone);
+ switch (endpoint.direction) {
+ case device.mojom.UsbTransferDirection.INBOUND:
+ itemLabel += ' (INBOUND)';
+ break;
+ case device.mojom.UsbTransferDirection.OUTBOUND:
+ itemLabel += ' (OUTBOUND)';
+ break;
+ }
+
+ const endpointItem = customTreeItem(itemLabel);
+
+ let usbTransferType = '';
+ switch (endpoint.type) {
+ case device.mojom.UsbTransferType.CONTROL:
+ usbTransferType = 'CONTROL';
+ break;
+ case device.mojom.UsbTransferType.ISOCHRONOUS:
+ usbTransferType = 'ISOCHRONOUS';
+ break;
+ case device.mojom.UsbTransferType.BULK:
+ usbTransferType = 'BULK';
+ break;
+ case device.mojom.UsbTransferType.INTERRUPT:
+ usbTransferType = 'INTERRUPT';
+ break;
+ }
+
+ endpointItem.add(
+ customTreeItem(`USB Transfer Type: ${usbTransferType}`));
+
+ endpointItem.add(customTreeItem(`Packet Size: ${endpoint.packetSize}`));
+
+ root.add(endpointItem);
+ }
}
}
@@ -56,10 +380,24 @@ cr.define('devices_page', function() {
* @return {string}
*/
function toHex(num) {
- return '0x' + num.toString(16).padStart(4, '0').slice(-4).toUpperCase();
+ return `0x${num.toString(16).padStart(4, '0').slice(-4).toUpperCase()}`;
+ }
+
+ /**
+ * Renders a customized TreeItem with the given content and class name.
+ * @param {string} itemLabel
+ * @return {!cr.ui.TreeItem}
+ * @private
+ */
+ function customTreeItem(itemLabel) {
+ return item = new cr.ui.TreeItem({
+ label: itemLabel,
+ icon: '',
+ });
}
return {
- setDevices: setDevices,
+ DevicePage,
+ DevicesPage,
};
-});
+}); \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/usb_internals/usb_internals.css b/chromium/chrome/browser/resources/usb_internals/usb_internals.css
index af12290b103..2dc79957903 100644
--- a/chromium/chrome/browser/resources/usb_internals/usb_internals.css
+++ b/chromium/chrome/browser/resources/usb_internals/usb_internals.css
@@ -3,6 +3,13 @@
* found in the LICENSE file.
*/
+ tabs {
+ position: sticky;
+ top: 0;
+ /* selected treeItem is 2 */
+ z-index: 3;
+ }
+
/* Devices Tab */
table.styled-table {
border-collapse: collapse;
@@ -32,3 +39,98 @@ table.styled-table,
.action-failure {
color: red;
}
+
+/* device page */
+.descriptor-button button {
+ width: 100%;
+}
+
+.descriptor-button {
+ position: sticky;
+ /* height of <tabs> */
+ top: 20px;
+ /* selected treeItem is 2 */
+ z-index: 3;
+}
+
+/* descriptor panel */
+.descriptor-panel {
+ display: flex;
+ overflow: visible;
+}
+
+.string-descriptor-panel input {
+ margin-inline-end: 16px;
+ margin-inline-start: 8px;
+}
+
+#raw-data-byte-view,
+#raw-data-tree-view {
+ flex: 1 0;
+}
+
+#raw-data-byte-view {
+ font-size: 14px;
+ line-height: 250%;
+ white-space: pre;
+}
+
+#raw-data-byte-view div {
+ position: sticky;
+ /* height of <tabs> and button */
+ top: 41px;
+}
+
+@media screen and (min-width: 1200px) {
+ #raw-data-byte-view div span:nth-child(16n)::after {
+ content: '\A';
+ }
+}
+
+@media screen and (min-width: 600px) and (max-width: 1199px) {
+ #raw-data-byte-view div span:nth-child(8n)::after {
+ content: '\A';
+ }
+}
+
+@media screen and (min-width: 300px) and (max-width: 599px) {
+ #raw-data-byte-view div span:nth-child(4n)::after {
+ content: '\A';
+ }
+}
+
+@media screen and (min-width: 150px) and (max-width: 299px) {
+ #raw-data-byte-view div span:nth-child(2n)::after {
+ content: '\A';
+ }
+}
+
+#raw-data-byte-view div span {
+ padding-inline-end: .5em;
+ padding-inline-start: .5em;
+}
+
+#raw-data-byte-view .selected-field {
+ background: red;
+}
+
+#raw-data-byte-view .hovered-field {
+ background: yellow;
+}
+
+.tree-row.hover {
+ background-color: hsl(214, 91%, 97%);
+ border-color: hsl(214, 91%, 85%);
+ z-index: 1;
+}
+
+.tree-row button {
+ margin-inline-start: 16px;
+}
+
+error {
+ color: red;
+ display: block;
+ font-size: 16px;
+ padding-inline-start: 20px;
+} \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/usb_internals/usb_internals.html b/chromium/chrome/browser/resources/usb_internals/usb_internals.html
index af7ff97c308..e809c6a27c3 100644
--- a/chromium/chrome/browser/resources/usb_internals/usb_internals.html
+++ b/chromium/chrome/browser/resources/usb_internals/usb_internals.html
@@ -6,6 +6,7 @@
<title>USB Internals</title>
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
<link rel="stylesheet" href="chrome://resources/css/tabs.css">
+ <link rel="stylesheet" href="chrome://resources/css/tree.css">
<link rel="stylesheet" href="usb_internals.css">
<script src="chrome://resources/js/assert.js"></script>
@@ -14,6 +15,7 @@
<script src="chrome://resources/js/cr/ui.js"></script>
<script src="chrome://resources/js/cr/ui/focus_outline_manager.js"></script>
<script src="chrome://resources/js/cr/ui/tabs.js"></script>
+ <script src="chrome://resources/js/cr/ui/tree.js"></script>
<script src="chrome://resources/js/mojo_bindings_lite.js"></script>
<script src="chrome://resources/js/util.js"></script>
<script src="chrome://resources/js/big_buffer.mojom-lite.js"></script>
@@ -28,6 +30,7 @@
<script src="device_manager_test.mojom-lite.js"></script>
<script src="usb_internals.mojom-lite.js"></script>
+ <script src="descriptor_panel.js"></script>
<script src="devices_page.js"></script>
</head>
@@ -127,6 +130,62 @@
</tabpanels>
</tabbox>
+
+ <template id="tab-template">
+ <tab></tab>
+ </template>
+
+ <template id="tabpanel-template">
+ <tabpanel>
+ <tree id="tree-view"></tree>
+ <div class="descriptor-button">
+ <button id="device-descriptor-button">Get Device Descriptor</button>
+ </div>
+ <div class="device-descriptor-panel" hidden></div>
+ <div class="descriptor-button">
+ <button id="configuration-descriptor-button">
+ Get Configuration Descriptor
+ </button>
+ </div>
+ <div class="configuration-descriptor-panel" hidden></div>
+ <div class="descriptor-button">
+ <button id="string-descriptor-button">Get String Descriptor</button>
+ </div>
+ <div class="string-descriptor-panel" hidden>
+ String Descriptor Index:
+ <input id="index-input" type="number" min="1" list="indexes">
+ <datalist id="indexes"></datalist>
+ Language Code:
+ <input id="language-code-input" list="languages">
+ <datalist id="languages"></datalist>
+ <button>GET</button>
+ </div>
+ </tabpanel>
+ </template>
+
+ <template id="descriptor-panel-template">
+ <div class="descriptor-panel">
+ <tree id="raw-data-tree-view"></tree>
+ <div id="raw-data-byte-view"></div>
+ </div>
+ </template>
+
+ <template id="raw-data-byte-container-template">
+ <div></div>>
+ </template>
+
+ <template id="raw-data-byte-template">
+ <span></span>
+ </template>
+
+ <template id="raw-data-tree-button">
+ <button>GET</button>
+ </template>
+
+ <template id="error">
+ <error></error>
+ </template>
+
<script src="usb_internals.js"></script>
</body>
diff --git a/chromium/chrome/browser/resources/usb_internals/usb_internals.js b/chromium/chrome/browser/resources/usb_internals/usb_internals.js
index accc7df317e..ff0683482ef 100644
--- a/chromium/chrome/browser/resources/usb_internals/usb_internals.js
+++ b/chromium/chrome/browser/resources/usb_internals/usb_internals.js
@@ -7,33 +7,36 @@
*/
cr.define('usb_internals', function() {
class UsbInternals {
- constructor() {
+ constructor() {}
+
+ async initializeViews() {
+ // window.setupFn() provides a hook for the test suite to perform setup
+ // actions after the page is loaded but before any script is run.
+ await window.setupFn();
+
const pageHandler = mojom.UsbInternalsPageHandler.getProxy();
// Connection to the UsbInternalsPageHandler instance running in the
// browser process.
- /** @private {device.mojom.UsbDeviceManagerProxy} */
- this.usbManager_ = new device.mojom.UsbDeviceManagerProxy;
- pageHandler.bindUsbDeviceManagerInterface(
- this.usbManager_.$.createRequest());
+ /** @type {device.mojom.UsbDeviceManagerProxy} */
+ const usbManager = new device.mojom.UsbDeviceManagerProxy;
+ await pageHandler.bindUsbDeviceManagerInterface(
+ usbManager.$.createRequest());
+
+ /** @private {devices_page.DevicesPage} */
+ this.devicesPage_ = new devices_page.DevicesPage(usbManager);
/** @private {device.mojom.UsbDeviceManagerTestProxy} */
this.usbManagerTest_ = new device.mojom.UsbDeviceManagerTestProxy;
- pageHandler.bindTestInterface(this.usbManagerTest_.$.createRequest());
-
- cr.ui.decorate('tabbox', cr.ui.TabBox);
-
- this.refreshDeviceList();
+ await pageHandler.bindTestInterface(
+ this.usbManagerTest_.$.createRequest());
$('add-test-device-form').addEventListener('submit', (event) => {
this.addTestDevice(event);
});
this.refreshTestDeviceList();
- }
- async refreshDeviceList() {
- const response = await this.usbManager_.getDevices();
- devices_page.setDevices(response.results);
+ cr.ui.decorate('tabbox', cr.ui.TabBox);
}
async refreshTestDeviceList() {
@@ -83,6 +86,11 @@ cr.define('usb_internals', function() {
};
});
+window.setupFn = window.setupFn || function() {
+ return Promise.resolve();
+};
+
document.addEventListener('DOMContentLoaded', () => {
- new usb_internals.UsbInternals();
-});
+ const usbInternalsPage = new usb_internals.UsbInternals();
+ usbInternalsPage.initializeViews();
+}); \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/md_user_manager/BUILD.gn b/chromium/chrome/browser/resources/user_manager/BUILD.gn
index ec9959fe082..ec9959fe082 100644
--- a/chromium/chrome/browser/resources/md_user_manager/BUILD.gn
+++ b/chromium/chrome/browser/resources/user_manager/BUILD.gn
diff --git a/chromium/chrome/browser/resources/md_user_manager/OWNERS b/chromium/chrome/browser/resources/user_manager/OWNERS
index 6a806bd5dad..6a806bd5dad 100644
--- a/chromium/chrome/browser/resources/md_user_manager/OWNERS
+++ b/chromium/chrome/browser/resources/user_manager/OWNERS
diff --git a/chromium/chrome/browser/resources/md_user_manager/control_bar.html b/chromium/chrome/browser/resources/user_manager/control_bar.html
index 08b1f572811..08b1f572811 100644
--- a/chromium/chrome/browser/resources/md_user_manager/control_bar.html
+++ b/chromium/chrome/browser/resources/user_manager/control_bar.html
diff --git a/chromium/chrome/browser/resources/md_user_manager/control_bar.js b/chromium/chrome/browser/resources/user_manager/control_bar.js
index b58e581518a..b58e581518a 100644
--- a/chromium/chrome/browser/resources/md_user_manager/control_bar.js
+++ b/chromium/chrome/browser/resources/user_manager/control_bar.js
diff --git a/chromium/chrome/browser/resources/md_user_manager/create_profile.html b/chromium/chrome/browser/resources/user_manager/create_profile.html
index fe7790cd469..8dd775543f9 100644
--- a/chromium/chrome/browser/resources/md_user_manager/create_profile.html
+++ b/chromium/chrome/browser/resources/user_manager/create_profile.html
@@ -112,6 +112,13 @@
margin-inline-end: 8px;
width: 20px;
}
+
+ cr-profile-avatar-selector {
+ max-height: 50vh;
+ overflow-x: hidden;
+ overflow-y: auto;
+ padding: 8px;
+ }
</style>
<div id="message-container" visible$="[[isMessageVisble_]]">
<iron-icon icon="cr:warning"></iron-icon>
diff --git a/chromium/chrome/browser/resources/md_user_manager/create_profile.js b/chromium/chrome/browser/resources/user_manager/create_profile.js
index 3ddd8cec635..3ddd8cec635 100644
--- a/chromium/chrome/browser/resources/md_user_manager/create_profile.js
+++ b/chromium/chrome/browser/resources/user_manager/create_profile.js
diff --git a/chromium/chrome/browser/resources/md_user_manager/error_dialog.html b/chromium/chrome/browser/resources/user_manager/error_dialog.html
index dcefc704daf..dcefc704daf 100644
--- a/chromium/chrome/browser/resources/md_user_manager/error_dialog.html
+++ b/chromium/chrome/browser/resources/user_manager/error_dialog.html
diff --git a/chromium/chrome/browser/resources/md_user_manager/error_dialog.js b/chromium/chrome/browser/resources/user_manager/error_dialog.js
index 0b15eb7f4e5..0b15eb7f4e5 100644
--- a/chromium/chrome/browser/resources/md_user_manager/error_dialog.js
+++ b/chromium/chrome/browser/resources/user_manager/error_dialog.js
diff --git a/chromium/chrome/browser/resources/md_user_manager/profile_browser_proxy.html b/chromium/chrome/browser/resources/user_manager/profile_browser_proxy.html
index 8fb6aa92fbf..8fb6aa92fbf 100644
--- a/chromium/chrome/browser/resources/md_user_manager/profile_browser_proxy.html
+++ b/chromium/chrome/browser/resources/user_manager/profile_browser_proxy.html
diff --git a/chromium/chrome/browser/resources/md_user_manager/profile_browser_proxy.js b/chromium/chrome/browser/resources/user_manager/profile_browser_proxy.js
index ac692311162..ac692311162 100644
--- a/chromium/chrome/browser/resources/md_user_manager/profile_browser_proxy.js
+++ b/chromium/chrome/browser/resources/user_manager/profile_browser_proxy.js
diff --git a/chromium/chrome/browser/resources/md_user_manager/shared_styles.html b/chromium/chrome/browser/resources/user_manager/shared_styles.html
index 6c729aa7d25..6c729aa7d25 100644
--- a/chromium/chrome/browser/resources/md_user_manager/shared_styles.html
+++ b/chromium/chrome/browser/resources/user_manager/shared_styles.html
diff --git a/chromium/chrome/browser/resources/md_user_manager/strings.html b/chromium/chrome/browser/resources/user_manager/strings.html
index 6b421a47c75..6b421a47c75 100644
--- a/chromium/chrome/browser/resources/md_user_manager/strings.html
+++ b/chromium/chrome/browser/resources/user_manager/strings.html
diff --git a/chromium/chrome/browser/resources/md_user_manager/user_manager.html b/chromium/chrome/browser/resources/user_manager/user_manager.html
index 43c8ecd46ac..43c8ecd46ac 100644
--- a/chromium/chrome/browser/resources/md_user_manager/user_manager.html
+++ b/chromium/chrome/browser/resources/user_manager/user_manager.html
diff --git a/chromium/chrome/browser/resources/md_user_manager/user_manager.js b/chromium/chrome/browser/resources/user_manager/user_manager.js
index 620f53d5354..7a1d49aec74 100644
--- a/chromium/chrome/browser/resources/md_user_manager/user_manager.js
+++ b/chromium/chrome/browser/resources/user_manager/user_manager.js
@@ -97,8 +97,7 @@ cr.define('cr.ui', function() {
* displayed.
*/
UserManager.showUserManagerScreen = function(showGuest, showAddPerson) {
- UserManager.getInstance().showScreen(
- {id: 'account-picker', data: {disableAddUser: false}});
+ UserManager.getInstance().showScreen({id: 'account-picker', data: {}});
// Hide control options if the user does not have the right permissions.
const controlBar = document.querySelector('control-bar');
controlBar.showGuest = showGuest;
diff --git a/chromium/chrome/browser/resources/md_user_manager/user_manager_pages.html b/chromium/chrome/browser/resources/user_manager/user_manager_pages.html
index 28ce262536b..28ce262536b 100644
--- a/chromium/chrome/browser/resources/md_user_manager/user_manager_pages.html
+++ b/chromium/chrome/browser/resources/user_manager/user_manager_pages.html
diff --git a/chromium/chrome/browser/resources/md_user_manager/user_manager_pages.js b/chromium/chrome/browser/resources/user_manager/user_manager_pages.js
index 591594d8147..04761b5b277 100644
--- a/chromium/chrome/browser/resources/md_user_manager/user_manager_pages.js
+++ b/chromium/chrome/browser/resources/user_manager/user_manager_pages.js
@@ -56,7 +56,7 @@ Polymer({
* This is to prevent events from propagating to the document element, which
* erroneously triggers user-pod selections.
*
- * TODO(scottchen): re-examine if its necessary for user_pod_row.js to bind
+ * TODO(tangltom): re-examine if its necessary for user_pod_row.js to bind
* listeners on the entire document element.
*
* @param {!Event} e
diff --git a/chromium/chrome/browser/resources/md_user_manager/user_manager_tutorial.html b/chromium/chrome/browser/resources/user_manager/user_manager_tutorial.html
index f714e514b4e..f714e514b4e 100644
--- a/chromium/chrome/browser/resources/md_user_manager/user_manager_tutorial.html
+++ b/chromium/chrome/browser/resources/user_manager/user_manager_tutorial.html
diff --git a/chromium/chrome/browser/resources/md_user_manager/user_manager_tutorial.js b/chromium/chrome/browser/resources/user_manager/user_manager_tutorial.js
index d365ca5b925..d365ca5b925 100644
--- a/chromium/chrome/browser/resources/md_user_manager/user_manager_tutorial.js
+++ b/chromium/chrome/browser/resources/user_manager/user_manager_tutorial.js
diff --git a/chromium/chrome/browser/resources/welcome/OWNERS b/chromium/chrome/browser/resources/welcome/OWNERS
index bfe00f2787d..08ee1a9630e 100644
--- a/chromium/chrome/browser/resources/welcome/OWNERS
+++ b/chromium/chrome/browser/resources/welcome/OWNERS
@@ -1,2 +1 @@
hcarmona@chromium.org
-scottchen@chromium.org
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/BUILD.gn b/chromium/chrome/browser/resources/welcome/onboarding_welcome/BUILD.gn
index 8ff98f9113b..c817f1fde8a 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/BUILD.gn
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/BUILD.gn
@@ -7,7 +7,6 @@ import("//third_party/closure_compiler/compile_js.gni")
group("closure_compile") {
deps = [
":welcome_files",
- "./email:closure_compile",
"./google_apps:closure_compile",
"./ntp_background:closure_compile",
"./set_as_default:closure_compile",
@@ -16,33 +15,18 @@ group("closure_compile") {
js_type_check("welcome_files") {
deps = [
- ":email_interstitial",
":landing_view",
":signin_view",
":welcome_app",
]
}
-js_library("email_interstitial") {
- deps = [
- ":email_interstitial_proxy",
- ":welcome_browser_proxy",
- "./email/:email_app_proxy",
- ]
-}
-
-js_library("email_interstitial_proxy") {
- deps = [
- "//ui/webui/resources/js:cr",
- ]
- externs_list = [ "$externs_path/metrics_private.js" ]
-}
-
js_library("landing_view") {
deps = [
":landing_view_proxy",
":navigation_behavior",
":welcome_browser_proxy",
+ "//ui/webui/resources/js:load_time_data",
]
}
@@ -58,7 +42,6 @@ js_library("signin_view") {
":navigation_behavior",
":signin_view_proxy",
":welcome_browser_proxy",
- "./email/:email_app_proxy",
]
}
@@ -83,7 +66,7 @@ js_library("welcome_app") {
"./shared:bookmark_proxy",
"./shared:nux_types",
"//ui/webui/resources/cr_elements/cr_view_manager:cr_view_manager",
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:promise_resolver",
]
}
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/BUILD.gn b/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/BUILD.gn
deleted file mode 100644
index 15c354b5f47..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/BUILD.gn
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//third_party/closure_compiler/compile_js.gni")
-
-js_type_check("closure_compile") {
- deps = [
- ":nux_email",
- ]
-}
-
-js_library("nux_email") {
- deps = [
- ":email_app_proxy",
- "../:navigation_behavior",
- "../shared:app_chooser",
- "../shared:nux_types",
- ]
-}
-
-js_library("email_app_proxy") {
- deps = [
- "../shared:app_proxy",
- "../shared:nux_types",
- "//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:load_time_data",
- ]
- externs_list = [
- "$externs_path/chrome_extensions.js",
- "$externs_path/chrome_send.js",
- "$externs_path/metrics_private.js",
- ]
-}
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/email_app_proxy.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/email_app_proxy.html
deleted file mode 100644
index 3dc5c92b1f3..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/email_app_proxy.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<link rel="import" href="chrome://welcome/shared/i18n_setup.html">
-<link rel="import" href="chrome://welcome/shared/module_metrics_proxy.html">
-<script src="email_app_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/email_app_proxy.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/email_app_proxy.js
deleted file mode 100644
index 65386917f53..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/email_app_proxy.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('nux', function() {
- /** @implements {nux.AppProxy} */
- class EmailAppProxyImpl {
- constructor() {
- /** @private {number} */
- this.savedProvider_;
- }
-
- /** @return {number} */
- getSavedProvider() {
- return this.savedProvider_;
- }
-
- /** @override */
- cacheBookmarkIcon(emailProviderId) {
- chrome.send('cacheEmailIcon', [emailProviderId]);
- }
-
- /** @override */
- getAppList() {
- return cr.sendWithPromise('getEmailList');
- }
-
- /** @override */
- recordProviderSelected(providerId) {
- this.savedProvider_ = providerId;
- chrome.metricsPrivate.recordEnumerationValue(
- 'FirstRun.NewUserExperience.EmailProvidersSelection', providerId,
- loadTimeData.getInteger('email_providers_enum_count'));
- }
- }
-
- cr.addSingletonGetter(EmailAppProxyImpl);
-
- return {
- EmailAppProxyImpl: EmailAppProxyImpl,
- };
-});
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/nux_email.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/nux_email.html
deleted file mode 100644
index 26a93302766..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/nux_email.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="../navigation_behavior.html">
-<link rel="import" href="../shared/app_chooser.html">
-<link rel="import" href="email_app_proxy.html">
-
-<dom-module id="nux-email">
- <template>
- <style>
- .email-ask {
- text-align: center;
- }
-
- .email-logo {
- content: -webkit-image-set(
- url(../images/email_provider_1x.png) 1x,
- url(../images/email_provider_2x.png) 2x);
- height: 38px;
- margin: auto;
- margin-bottom: 16px;
- width: 42px;
- }
-
- h1 {
- color: var(--google-grey-900);
- font-size: 1.5rem;
- font-weight: 500;
- margin: 0;
- margin-bottom: 48px;
- outline: none;
- }
- </style>
- <div class="email-ask">
- <div class="email-logo" alt=""></div>
- <h1 tabindex="-1">$i18n{emailProviderTitle}</h1>
- <app-chooser id="emailChooser" indicator-model="[[indicatorModel]]"
- single-select>
- </app-chooser>
- </div>
- </template>
- <script src="nux_email.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/nux_email.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/nux_email.js
deleted file mode 100644
index 8dabf5e1044..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email/nux_email.js
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-Polymer({
- is: 'nux-email',
-
- behaviors: [welcome.NavigationBehavior],
-
- properties: {
- /** @type {nux.stepIndicatorModel} */
- indicatorModel: Object,
- },
-
- /** @override */
- ready: function() {
- this.$.emailChooser.appProxy = nux.EmailAppProxyImpl.getInstance();
- this.$.emailChooser.metricsManager =
- new nux.ModuleMetricsManager(nux.EmailMetricsProxyImpl.getInstance());
- },
-
- onRouteEnter: function() {
- this.$.emailChooser.onRouteEnter();
- },
-
- onRouteExit: function() {
- this.$.emailChooser.onRouteExit();
- },
-
- onRouteUnload: function() {
- this.$.emailChooser.onRouteUnload();
- },
-});
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial.html
deleted file mode 100644
index 1f4ea5f8961..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!doctype html>
-<html dir="$i18n{textdirection}" lang="$i18n{language}">
- <head>
- <meta charset="utf-8">
- <title>$i18n{headerText}</title>
-
- <link rel="import" href="chrome://resources/html/polymer.html">
-
- <link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
- <link rel="import" href="chrome://resources/html/assert.html">
- <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
- <link rel="import" href="email/email_app_proxy.html">
- <link rel="import" href="email_interstitial_proxy.html">
- <link rel="import" href="shared/action_link_style_css.html">
- <link rel="import" href="shared/onboarding_background.html">
- <link rel="import" href="shared/splash_pages_shared_css.html">
- <link rel="import" href="welcome_browser_proxy.html">
-
- <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
- <style>
- body {
- margin: 0;
- }
- </style>
-
- <dom-module id="email-interstitial">
- <template>
- <style include="paper-button-style action-link-style splash-pages-shared-css">
- :host {
- align-items: center;
- display: flex;
- height: 100vh;
- justify-content: center;
- }
-
- h1 {
- margin-top: 0;
- outline: none;
- }
- </style>
- <onboarding-background></onboarding-background>
- <div id="container">
- <h1 tabindex="-1">$i18n{emailInterstitialTitle}</h1>
- <paper-button class="action-button" on-click="onContinueClick_">
- $i18n{emailInterstitialContinue}
- </paper-button>
- <button class="action-link" on-click="onNoThanksClick_">
- $i18n{noThanks}
- </button>
- </div>
- </template>
- <script src="email_interstitial.js"></script>
- </dom-module>
- </head>
- <body>
- <email-interstitial></email-interstitial>
- </body>
-</html>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial.js
deleted file mode 100644
index 3a92ce0d73d..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial.js
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview When user gets to chrome://welcome/email-interstitial, it will
- * also have a ?provider=... url param. This value is an ID that should match
- * one of the provider in the email list retrieved from the backend. If the user
- * chooses the continue button, they should be directed to the landing page of
- * that email provider.
- */
-Polymer({
- is: 'email-interstitial',
-
- /** @private */
- welcomeBrowserProxy_: null,
-
- /** @private {?nux.EmailInterstitialProxy} */
- emailInterstitialProxy_: null,
-
- /** @private {boolean} */
- finalized_: false,
-
- /** @override */
- ready: function() {
- this.welcomeBrowserProxy_ = welcome.WelcomeBrowserProxyImpl.getInstance();
- this.emailInterstitialProxy_ = nux.EmailInterstitialProxyImpl.getInstance();
- this.emailInterstitialProxy_.recordPageShown();
-
- window.addEventListener('beforeunload', () => {
- // Both buttons on this page will navigate to a new URL.
- if (this.finalized_) {
- return;
- }
- this.finalized_ = true;
- this.emailInterstitialProxy_.recordNavigatedAway();
- });
- },
-
- /** @override */
- attached: function() {
- // Focus heading for accessibility.
- this.$$('h1').focus();
- },
-
- /** @private */
- onContinueClick_: function() {
- // Prevent duplicate metrics if a user clicks "Continue" multiple times.
- if (this.finalized_) {
- return;
- }
- this.finalized_ = true;
- this.emailInterstitialProxy_.recordNext();
- const providerId =
- (new URL(window.location.href)).searchParams.get('provider');
- nux.EmailAppProxyImpl.getInstance().getAppList().then(list => {
- for (let i = 0; i < list.length; i++) {
- if (list[i].id == providerId) {
- this.welcomeBrowserProxy_.goToURL(list[i].url);
- return;
- }
- }
-
- // It shouldn't be possible to go to a URL with a non-existent provider
- // id.
- assertNotReached();
- });
- },
-
- /** @private */
- onNoThanksClick_: function() {
- this.finalized_ = true;
- this.emailInterstitialProxy_.recordSkip();
- this.welcomeBrowserProxy_.goToNewTabPage();
- }
-});
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial_proxy.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial_proxy.js
deleted file mode 100644
index 786a1d10fd6..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/email_interstitial_proxy.js
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('nux', function() {
- const NUX_EMAIL_INTERSTITIAL_INTERACTION_METRIC_NAME =
- 'FirstRun.NewUserExperience.EmailInterstitialInteraction';
-
- /**
- * NuxEmailInterstitialInteractions enum.
- * These values are persisted to logs and should not be renumbered or re-used.
- * See tools/metrics/histograms/enums.xml.
- * @enum {number}
- */
- const NuxEmailInterstitialInteractions = {
- PageShown: 0,
- NavigatedAway: 1,
- Skip: 2,
- Next: 3,
- };
-
- const NUX_EMAIL_INTERSTITIAL_INTERACTIONS_COUNT =
- Object.keys(NuxEmailInterstitialInteractions).length;
-
- /** @interface */
- class EmailInterstitialProxy {
- recordPageShown() {}
-
- recordNavigatedAway() {}
-
- recordSkip() {}
-
- recordNext() {}
- }
-
- /** @implements {nux.EmailInterstitialProxy} */
- class EmailInterstitialProxyImpl {
- /** @override */
- recordPageShown() {
- this.recordInteraction_(NuxEmailInterstitialInteractions.PageShown);
- }
-
- /** @override */
- recordNavigatedAway() {
- this.recordInteraction_(NuxEmailInterstitialInteractions.NavigatedAway);
- }
-
- /** @override */
- recordSkip() {
- this.recordInteraction_(NuxEmailInterstitialInteractions.Skip);
- }
-
- /** @override */
- recordNext() {
- this.recordInteraction_(NuxEmailInterstitialInteractions.Next);
- }
-
- /**
- * @param {number} interaction
- * @private
- */
- recordInteraction_(interaction) {
- chrome.metricsPrivate.recordEnumerationValue(
- NUX_EMAIL_INTERSTITIAL_INTERACTION_METRIC_NAME, interaction,
- NUX_EMAIL_INTERSTITIAL_INTERACTIONS_COUNT);
- }
- }
-
- cr.addSingletonGetter(EmailInterstitialProxyImpl);
-
- return {
- EmailInterstitialProxy: EmailInterstitialProxy,
- EmailInterstitialProxyImpl: EmailInterstitialProxyImpl,
- };
-});
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.html
index 2dac7e1b3d4..2cae5b135f9 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.html
@@ -13,17 +13,19 @@
}
.chrome-logo {
- content: -webkit-image-set(
- url(chrome://welcome/images/google_apps_1x.png) 1x,
- url(chrome://welcome/images/google_apps_2x.png) 2x);
+ content: url(../images/module_icons/google_light.svg);
height: 38px;
margin: auto;
margin-bottom: 16px;
width: 42px;
}
+ :host-context([dark]) .chrome-logo {
+ content: url(../images/module_icons/google_dark.svg);
+ }
+
h1 {
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
font-size: 1.5rem;
font-weight: 500;
margin: 0;
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/aol_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/aol_1x.png
deleted file mode 100644
index 566cf211fd5..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/aol_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/aol_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/aol_2x.png
deleted file mode 100644
index a316bf9182b..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/aol_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/blue_circle.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/blue_circle.svg
index 3f34976ca98..e177d8c531f 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/blue_circle.svg
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/blue_circle.svg
@@ -1,3 +1 @@
-<svg width="43px" height="43px" viewBox="0 0 43 43" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
- <circle fill="#1A73E8" fill-rule="evenodd" cx="21.5" cy="21.5" r="21.5"></circle>
-</svg> \ No newline at end of file
+<svg width="43" height="43" xmlns="http://www.w3.org/2000/svg"><circle fill-rule="evenodd" cx="21.5" cy="21.5" r="21.5"/></svg>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/green_rectangle.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/green_rectangle.svg
index 8cb0471291e..ca840fb14b2 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/green_rectangle.svg
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/green_rectangle.svg
@@ -1,3 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="371" height="371" viewBox="0 0 371 371">
- <path fill="#31A753" fill-rule="evenodd" d="M7.61078518,166.895209 L166.895209,7.61078518 C177.042923,-2.53692839 193.495617,-2.53692839 203.643331,7.61078518 L362.935748,166.903202 C373.083461,177.050916 373.083461,193.50361 362.935748,203.651324 L203.651324,362.935748 C193.50361,373.083461 177.050916,373.083461 166.903202,362.935748 L7.61078518,203.643331 C-2.53692839,193.495617 -2.53692839,177.042923 7.61078518,166.895209 Z"/>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="371" height="371"><path fill-rule="evenodd" d="M7.61 166.895L166.896 7.611c10.148-10.148 26.6-10.148 36.748 0l159.293 159.292c10.147 10.148 10.147 26.6 0 36.748L203.65 362.936c-10.147 10.147-26.6 10.147-36.748 0L7.611 203.643c-10.148-10.147-10.148-26.6 0-36.748z"/></svg>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_oval.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_oval.svg
index cf75ceb6861..e45a4973f0f 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_oval.svg
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_oval.svg
@@ -1,3 +1 @@
-<svg width="100px" height="100px" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
- <circle fill-rule="evenodd" fill="#F1F3F4" cx="50" cy="50" r="50"></circle>
-</svg> \ No newline at end of file
+<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle fill-rule="evenodd" cx="50" cy="50" r="50"/></svg>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_rounded_rectangle.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_rounded_rectangle.svg
index 71f9fd63b98..8154764d47e 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_rounded_rectangle.svg
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/grey_rounded_rectangle.svg
@@ -1,3 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="132" height="132" viewBox="0 0 132 132">
- <path fill="#F1F3F4" fill-rule="evenodd" d="M81.6025226,14.0007794 L117.999221,50.3974774 C136.666926,69.0651833 136.666926,99.3315147 117.999221,117.999221 C99.3315147,136.666926 69.0651833,136.666926 50.3974774,117.999221 L14.0007794,81.6025226 C-4.66692648,62.9348167 -4.66692648,32.6684853 14.0007794,14.0007794 C32.6684853,-4.66692648 62.9348167,-4.66692648 81.6025226,14.0007794 Z"/>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="132" height="132"><path fill-rule="evenodd" d="M81.603 14l36.396 36.397c18.668 18.668 18.668 48.935 0 67.602-18.667 18.668-48.934 18.668-67.602 0L14.001 81.603C-4.667 62.935-4.667 32.668 14 14 32.668-4.667 62.935-4.667 81.603 14z"/></svg>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/red_triangle.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/red_triangle.svg
index d89d1aeebdf..cc7e87d52ed 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/red_triangle.svg
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/red_triangle.svg
@@ -1,3 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="65" height="74" viewBox="0 0 65 74">
- <path fill="#E94235" fill-rule="evenodd" d="M64.5429228,7.29310524 L64.3644898,67.9344347 C64.1624511,71.340818 61.2707769,73.9365373 57.9057548,73.732136 C56.9598601,73.6746796 56.0401784,73.3950765 55.2195428,72.9154694 L3.60676683,42.7512281 C0.687353928,41.0450251 -0.312855086,37.266089 1.37273747,34.3107382 C1.84655098,33.4800006 2.50492275,32.7723367 3.29571384,32.2437891 L55.0869229,1.76670102 C57.9001639,-0.113607947 61.6864522,0.670655917 63.5438345,3.51840338 C64.2715067,4.63407375 64.6220761,5.95857646 64.5429228,7.29310524 Z"/>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="65" height="74"><path fill-rule="evenodd" d="M64.543 7.293l-.179 60.641c-.202 3.407-3.093 6.003-6.458 5.798a6.05 6.05 0 0 1-2.686-.817L3.607 42.751c-2.92-1.706-3.92-5.485-2.234-8.44a6.149 6.149 0 0 1 1.923-2.067l51.79-30.477c2.814-1.88 6.6-1.096 8.458 1.751a6.236 6.236 0 0 1 .999 3.775z"/></svg>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_dots.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_dots.svg
index 41ce568beb7..cba006f436c 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_dots.svg
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_dots.svg
@@ -1,46 +1 @@
-<svg width="76px" height="57px" viewBox="0 0 76 57" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
- <g fill-rule="evenodd" fill="#FDD663">
- <circle cx="14" cy="13" r="2"></circle>
- <circle cx="14" cy="2" r="2"></circle>
- <circle cx="14" cy="23" r="2"></circle>
- <circle cx="14" cy="34" r="2"></circle>
- <circle cx="14" cy="45" r="2"></circle>
- <circle cx="14" cy="55" r="2"></circle>
- <circle cx="2" cy="13" r="2"></circle>
- <circle cx="2" cy="2" r="2"></circle>
- <circle cx="2" cy="23" r="2"></circle>
- <circle cx="2" cy="34" r="2"></circle>
- <circle cx="2" cy="45" r="2"></circle>
- <circle cx="2" cy="55" r="2"></circle>
- <circle cx="26" cy="13" r="2"></circle>
- <circle cx="26" cy="2" r="2"></circle>
- <circle cx="26" cy="23" r="2"></circle>
- <circle cx="26" cy="34" r="2"></circle>
- <circle cx="26" cy="45" r="2"></circle>
- <circle cx="26" cy="55" r="2"></circle>
- <circle cx="38" cy="13" r="2"></circle>
- <circle cx="38" cy="2" r="2"></circle>
- <circle cx="38" cy="23" r="2"></circle>
- <circle cx="38" cy="34" r="2"></circle>
- <circle cx="38" cy="45" r="2"></circle>
- <circle cx="38" cy="55" r="2"></circle>
- <circle cx="50" cy="13" r="2"></circle>
- <circle cx="50" cy="2" r="2"></circle>
- <circle cx="50" cy="23" r="2"></circle>
- <circle cx="50" cy="34" r="2"></circle>
- <circle cx="50" cy="45" r="2"></circle>
- <circle cx="50" cy="55" r="2"></circle>
- <circle cx="62" cy="13" r="2"></circle>
- <circle cx="62" cy="2" r="2"></circle>
- <circle cx="62" cy="23" r="2"></circle>
- <circle cx="62" cy="34" r="2"></circle>
- <circle cx="62" cy="45" r="2"></circle>
- <circle cx="62" cy="55" r="2"></circle>
- <circle cx="74" cy="13" r="2"></circle>
- <circle cx="74" cy="2" r="2"></circle>
- <circle cx="74" cy="23" r="2"></circle>
- <circle cx="74" cy="34" r="2"></circle>
- <circle cx="74" cy="45" r="2"></circle>
- <circle cx="74" cy="55" r="2"></circle>
- </g>
-</svg> \ No newline at end of file
+<svg width="76" height="57" xmlns="http://www.w3.org/2000/svg"><g fill-rule="evenodd"><circle cx="14" cy="13" r="2"/><circle cx="14" cy="2" r="2"/><circle cx="14" cy="23" r="2"/><circle cx="14" cy="34" r="2"/><circle cx="14" cy="45" r="2"/><circle cx="14" cy="55" r="2"/><circle cx="2" cy="13" r="2"/><circle cx="2" cy="2" r="2"/><circle cx="2" cy="23" r="2"/><circle cx="2" cy="34" r="2"/><circle cx="2" cy="45" r="2"/><circle cx="2" cy="55" r="2"/><circle cx="26" cy="13" r="2"/><circle cx="26" cy="2" r="2"/><circle cx="26" cy="23" r="2"/><circle cx="26" cy="34" r="2"/><circle cx="26" cy="45" r="2"/><circle cx="26" cy="55" r="2"/><circle cx="38" cy="13" r="2"/><circle cx="38" cy="2" r="2"/><circle cx="38" cy="23" r="2"/><circle cx="38" cy="34" r="2"/><circle cx="38" cy="45" r="2"/><circle cx="38" cy="55" r="2"/><circle cx="50" cy="13" r="2"/><circle cx="50" cy="2" r="2"/><circle cx="50" cy="23" r="2"/><circle cx="50" cy="34" r="2"/><circle cx="50" cy="45" r="2"/><circle cx="50" cy="55" r="2"/><circle cx="62" cy="13" r="2"/><circle cx="62" cy="2" r="2"/><circle cx="62" cy="23" r="2"/><circle cx="62" cy="34" r="2"/><circle cx="62" cy="45" r="2"/><circle cx="62" cy="55" r="2"/><circle cx="74" cy="13" r="2"/><circle cx="74" cy="2" r="2"/><circle cx="74" cy="23" r="2"/><circle cx="74" cy="34" r="2"/><circle cx="74" cy="45" r="2"/><circle cx="74" cy="55" r="2"/></g></svg>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_semicircle.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_semicircle.svg
index 3fe924d3524..027d197e3b3 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_semicircle.svg
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/background_svgs/yellow_semicircle.svg
@@ -1,3 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="211" height="171" viewBox="0 0 211 171">
- <path fill="#FACF4C" fill-rule="evenodd" d="M152.95531,155.322875 C102.461259,184.681893 39.1648672,171.482614 4.01772623,126.776523 C0.528185501,122.337934 -5.16163709,112.29754 9.88388926,103.549542 C48.9517191,80.8341309 106.527836,47.3573508 182.61224,3.1192014 C196.248192,-4.80922088 200.05639,4.35165919 201.923,8.80779391 C224.340646,62.3251755 204.196032,125.529716 152.95531,155.322875 Z"/>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="211" height="171"><path fill-rule="evenodd" d="M152.955 155.323c-50.494 29.359-113.79 16.16-148.937-28.546-3.49-4.44-9.18-14.48 5.866-23.227L182.612 3.12c13.636-7.93 17.444 1.232 19.311 5.688 22.418 53.517 2.273 116.722-48.968 146.515z"/></svg>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/chrome_store_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/chrome_store_1x.png
deleted file mode 100644
index a299b4543fa..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/chrome_store_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/chrome_store_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/chrome_store_2x.png
deleted file mode 100644
index 8ccaa1c436c..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/chrome_store_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/email_provider_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/email_provider_1x.png
deleted file mode 100644
index 4ef0c29fc00..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/email_provider_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/email_provider_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/email_provider_2x.png
deleted file mode 100644
index 62b761482b0..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/email_provider_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/google_apps_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/google_apps_1x.png
deleted file mode 100644
index adaff6c6ee1..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/google_apps_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/google_apps_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/google_apps_2x.png
deleted file mode 100644
index eeccb7d66b6..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/google_apps_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/icloud_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/icloud_1x.png
deleted file mode 100644
index f3f75380ffb..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/icloud_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/icloud_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/icloud_2x.png
deleted file mode 100644
index a01c37dbf44..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/icloud_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/google_dark.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/google_dark.svg
new file mode 100644
index 00000000000..40991d56857
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/google_dark.svg
@@ -0,0 +1 @@
+<svg width="42" height="38" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-2 -2)" fill="none" fill-rule="evenodd"><path d="M31.235 26.057l11.432-.566a1.157 1.157 0 0 1 1.157 1.16 1.142 1.142 0 0 1-.128.515L38.52 37.192a1.174 1.174 0 0 1-1.977.163l-6.257-9.461a1.144 1.144 0 0 1 .247-1.612c.203-.148.45-.227.702-.225z" fill="#EE675C"/><path d="M23.239 25.28v-4.464h11.455c.171.756.306 1.464.306 2.46C35 30.128 30.313 35 23.25 35 16.484 35 11 29.624 11 23s5.483-12 12.239-12c3.304 0 6.07 1.188 8.187 3.132l-3.475 3.312c-.882-.816-2.411-1.788-4.712-1.788-4.051 0-7.356 3.3-7.356 7.344 0 4.044 3.305 7.344 7.356 7.344 4.687 0 6.413-3.18 6.73-5.064h-6.73z" fill="#8AB4F8" fill-rule="nonzero"/><path d="M7 7h32v32H7z"/><circle fill="#81C995" cx="10" cy="37.398" r="2"/><path d="M6.592 5.039c4.904-4.183 12.017-3.946 16.689.284.464.42 1.274 1.412-.187 2.658L6.321 22.291c-1.324 1.13-1.914.198-2.202-.254C.655 16.597 1.616 9.284 6.592 5.039z" fill="#FDD663" style="mix-blend-mode:screen"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/google_light.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/google_light.svg
new file mode 100644
index 00000000000..a0bed3be3f1
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/google_light.svg
@@ -0,0 +1 @@
+<svg width="42" height="38" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-2 -2)" fill="none" fill-rule="evenodd"><path d="M31.235 26.057l11.432-.566a1.157 1.157 0 0 1 1.157 1.16 1.142 1.142 0 0 1-.128.515L38.52 37.192a1.174 1.174 0 0 1-1.977.163l-6.257-9.461a1.144 1.144 0 0 1 .247-1.612c.203-.148.45-.227.702-.225z" fill="#E74133"/><path d="M23.239 25.678v-4.464h11.455c.171.756.306 1.464.306 2.46 0 6.852-4.687 11.724-11.75 11.724-6.767 0-12.25-5.376-12.25-12s5.483-12 12.239-12c3.304 0 6.07 1.188 8.187 3.132l-3.475 3.312c-.882-.816-2.411-1.788-4.712-1.788-4.051 0-7.356 3.3-7.356 7.344 0 4.044 3.305 7.344 7.356 7.344 4.687 0 6.413-3.18 6.73-5.064h-6.73z" fill="#1A73E8" fill-rule="nonzero"/><path d="M7 7.398h32v32H7z"/><circle fill="#31A753" cx="10" cy="37.398" r="2"/><path d="M6.592 5.039c4.904-4.183 12.017-3.946 16.689.284.464.42 1.274 1.412-.187 2.658L6.321 22.291c-1.324 1.13-1.914.198-2.202-.254C.655 16.597 1.616 9.284 6.592 5.039z" fill="#FACF4C" style="mix-blend-mode:multiply"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/set_default_dark.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/set_default_dark.svg
new file mode 100644
index 00000000000..414dff58eae
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/set_default_dark.svg
@@ -0,0 +1 @@
+<svg width="44" height="39" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path d="M14 3C7.929 3 3 7.929 3 14s4.929 11 11 11 11-4.929 11-11S20.071 3 14 3zm0-3c7.728 0 14 6.272 14 14s-6.272 14-14 14S0 21.728 0 14 6.272 0 14 0z" id="a"/><path d="M14 .667C21.36.667 27.333 6.64 27.333 14S21.36 27.333 14 27.333.667 21.36.667 14 6.64.667 14 .667zM3.333 14H9.2c4.543.029 6.562 2.308 6.058 6.836H10.65v3.293c1.054.349 2.18.538 3.35.538 5.887 0 10.667-4.78 10.667-10.667 0-.217-.007-.433-.02-.647-.876 1.32-2.203 1.98-3.98 1.98-2.85 0-4.275-1.222-4.275-3.665h-4.998c-.365-3.638.91-5.457 3.827-5.457 0-1.3.436-2.13 1.082-2.628A10.69 10.69 0 0 0 14 3.333C8.113 3.333 3.333 8.113 3.333 14z" id="c"/></defs><g transform="translate(-2 -2)" fill="none" fill-rule="evenodd"><path d="M33.235 28.659l11.432-.566a1.157 1.157 0 0 1 1.157 1.16 1.142 1.142 0 0 1-.128.515L40.52 39.794a1.174 1.174 0 0 1-1.977.163l-6.257-9.461a1.144 1.144 0 0 1 .247-1.612c.203-.148.45-.227.702-.225z" fill="#EE675C"/><g transform="translate(11 9)"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><use fill="#000" fill-rule="nonzero" xlink:href="#a"/><g mask="url(#b)" fill="#1A73E8"><path d="M-2-2h32v32H-2z"/></g><use fill="#8AB4F8" fill-rule="nonzero" xlink:href="#c"/></g><circle fill="#81C995" cx="9" cy="38.398" r="2"/><path d="M6.592 5.039c4.904-4.183 12.017-3.946 16.689.284.464.42 1.274 1.412-.187 2.658L6.321 22.291c-1.324 1.13-1.914.198-2.202-.254C.655 16.597 1.616 9.284 6.592 5.039z" fill="#FDDF8B" style="mix-blend-mode:screen"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/set_default_light.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/set_default_light.svg
new file mode 100644
index 00000000000..2a0c6ebd8ae
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/set_default_light.svg
@@ -0,0 +1 @@
+<svg width="44" height="39" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path d="M16 5C9.929 5 5 9.929 5 16s4.929 11 11 11 11-4.929 11-11S22.071 5 16 5zm0-3c7.728 0 14 6.272 14 14s-6.272 14-14 14S2 23.728 2 16 8.272 2 16 2z" id="a"/><path d="M16 2.667c7.36 0 13.333 5.973 13.333 13.333S23.36 29.333 16 29.333 2.667 23.36 2.667 16 8.64 2.667 16 2.667zM5.333 16H11.2c4.543.029 6.562 2.308 6.058 6.836H12.65v3.293c1.054.349 2.18.538 3.35.538 5.887 0 10.667-4.78 10.667-10.667 0-.217-.007-.433-.02-.647-.876 1.32-2.203 1.98-3.98 1.98-2.85 0-4.275-1.222-4.275-3.665h-4.998c-.365-3.638.91-5.457 3.827-5.457 0-1.3.436-2.13 1.082-2.628A10.69 10.69 0 0 0 16 5.333c-5.887 0-10.667 4.78-10.667 10.667z" id="c"/></defs><g transform="translate(-2 -2)" fill="none" fill-rule="evenodd"><path d="M33.235 28.659l11.432-.566a1.157 1.157 0 0 1 1.157 1.16 1.142 1.142 0 0 1-.128.515L40.52 39.794a1.174 1.174 0 0 1-1.977.163l-6.257-9.461a1.144 1.144 0 0 1 .247-1.612c.203-.148.45-.227.702-.225z" fill="#E74133"/><g transform="translate(9 7.398)"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><use fill="#000" fill-rule="nonzero" xlink:href="#a"/><g mask="url(#b)" fill="#1A73E8"><path d="M0 0h32v32H0z"/></g><mask id="d" fill="#fff"><use xlink:href="#c"/></mask><use fill="#000" fill-rule="nonzero" xlink:href="#c"/><g mask="url(#d)" fill="#1A73E8"><path d="M0 0h32v32H0z"/></g></g><circle fill="#31A753" cx="9" cy="38.398" r="2"/><path d="M6.592 5.039c4.904-4.183 12.017-3.946 16.689.284.464.42 1.274 1.412-.187 2.658L6.321 22.291c-1.324 1.13-1.914.198-2.202-.254C.655 16.597 1.616 9.284 6.592 5.039z" fill="#FACF4C" style="mix-blend-mode:multiply"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/wallpaper_dark.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/wallpaper_dark.svg
new file mode 100644
index 00000000000..45cfa17c7c9
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/wallpaper_dark.svg
@@ -0,0 +1 @@
+<svg width="44" height="39" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-2 -2)" fill="none" fill-rule="evenodd"><path d="M33.235 28.659l11.432-.566a1.157 1.157 0 0 1 1.157 1.16 1.142 1.142 0 0 1-.128.515L40.52 39.794a1.174 1.174 0 0 1-1.977.163l-6.257-9.461a1.144 1.144 0 0 1 .247-1.612c.203-.148.45-.227.702-.225z" fill="#EE675C"/><circle fill="#31A753" cx="9" cy="38.398" r="2"/><path d="M9 7h32v32H9z"/><path d="M34.333 13.667v18.666H15.667V13.667h18.666zm0-2.667H15.667A2.675 2.675 0 0 0 13 13.667v18.666C13 33.8 14.2 35 15.667 35h18.666C35.8 35 37 33.8 37 32.333V13.667C37 12.2 35.8 11 34.333 11zm-6.48 11.813l-4 5.16L21 24.52l-4 5.147h16l-5.147-6.854z" fill="#8AB4F8" fill-rule="nonzero"/><path d="M6.592 5.039c4.904-4.183 12.017-3.946 16.689.284.464.42 1.274 1.412-.187 2.658L6.321 22.291c-1.324 1.13-1.914.198-2.202-.254C.655 16.597 1.616 9.284 6.592 5.039z" fill="#FDDB79" style="mix-blend-mode:screen"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/wallpaper_light.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/wallpaper_light.svg
new file mode 100644
index 00000000000..300ae229be4
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/module_icons/wallpaper_light.svg
@@ -0,0 +1 @@
+<svg width="44" height="39" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-2 -2)" fill="none" fill-rule="evenodd"><path d="M33.235 28.659l11.432-.566a1.157 1.157 0 0 1 1.157 1.16 1.142 1.142 0 0 1-.128.515L40.52 39.794a1.174 1.174 0 0 1-1.977.163l-6.257-9.461a1.144 1.144 0 0 1 .247-1.612c.203-.148.45-.227.702-.225z" fill="#E74133"/><circle fill="#31A753" cx="9" cy="38.398" r="2"/><path d="M6.592 5.039c4.904-4.183 12.017-3.946 16.689.284.464.42 1.274 1.412-.187 2.658L6.321 22.291c-1.324 1.13-1.914.198-2.202-.254C.655 16.597 1.616 9.284 6.592 5.039z" fill="#FACF4C" style="mix-blend-mode:multiply"/><path d="M9 7h32v32H9z"/><path d="M34.333 13.667v18.666H15.667V13.667h18.666zm0-2.667H15.667A2.675 2.675 0 0 0 13 13.667v18.666C13 33.8 14.2 35 15.667 35h18.666C35.8 35 37 33.8 37 32.333V13.667C37 12.2 35.8 11 34.333 11zm-6.48 11.813l-4 5.16L21 24.52l-4 5.147h16l-5.147-6.854z" fill="#1A73E8" fill-rule="nonzero"/></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/ntp_background_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/ntp_background_1x.png
deleted file mode 100644
index fdc3f4f5d34..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/ntp_background_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/ntp_background_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/ntp_background_2x.png
deleted file mode 100644
index a6e31391566..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/ntp_background_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/outlook_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/outlook_1x.png
deleted file mode 100644
index 0c9bed6a262..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/outlook_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/outlook_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/outlook_2x.png
deleted file mode 100644
index ffa7774b099..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/outlook_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_1x.png
deleted file mode 100644
index c6d263734ab..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_2x.png
deleted file mode 100644
index b82f62010ee..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_illustration_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_illustration_1x.png
deleted file mode 100644
index 2624306c23b..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_illustration_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_illustration_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_illustration_2x.png
deleted file mode 100644
index ff642c38198..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_as_default_illustration_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_default_dark.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_default_dark.svg
new file mode 100644
index 00000000000..c17a605032e
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_default_dark.svg
@@ -0,0 +1 @@
+<svg width="454" height="185" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="a" d="M.707.43h56.32v56.32H.707z"/><path d="M7.527 0C3.668 0 .528 3.14.528 7v126c0 3.86 3.14 7 6.999 7h213c3.86 0 7-3.14 7-7V7c0-3.86-3.14-7-7-7" id="c"/><path d="M7.527 0C3.668 0 .528 3.14.528 7v126c0 3.86 3.14 7 6.999 7h213c3.86 0 7-3.14 7-7V7c0-3.86-3.14-7-7-7h-213z" id="e"/><path d="M7.527 0C3.668 0 .528 3.14.528 7v126c0 3.86 3.14 7 6.999 7h213c3.86 0 7-3.14 7-7V7c0-3.86-3.14-7-7-7" id="g"/><path d="M7.527 0C3.668 0 .528 3.14.528 7v126c0 3.86 3.14 7 6.999 7h213c3.86 0 7-3.14 7-7V7c0-3.86-3.14-7-7-7" id="i"/></defs><g fill="none" fill-rule="evenodd"><path d="M292.172 9.494l-38.26 10.251c-2.134.572-2.848 3.24-1.286 4.802l28.008 28.008c1.562 1.562 4.23.847 4.802-1.287l10.252-38.259c.57-2.134-1.382-4.087-3.516-3.515l-38.26 10.251c-2.134.572-2.848 3.24-1.286 4.802l28.008 28.008c1.562 1.562 4.23.847 4.802-1.287l10.252-38.259c.57-2.134-1.382-4.087-3.516-3.515" fill="#F1F3F4"/><path d="M90.398 148.926c-1.172.677-1.51 2.225-.714 3.32 7.039 9.677 20.395 12.674 30.99 6.557 10.595-6.117 14.678-19.182 9.815-30.117-.549-1.237-2.059-1.718-3.231-1.04l-36.86 21.28zM359.03 138.41l-28.754 28.755a3.115 3.115 0 0 1-4.406 0l-28.754-28.754a3.115 3.115 0 0 1 0-4.406l28.754-28.754a3.117 3.117 0 0 1 4.406 0l28.754 28.754a3.115 3.115 0 0 1 0 4.406" fill="#3C4043"/><g transform="translate(116 -.43)"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><path d="M57.027 28.59c0 15.553-12.607 28.16-28.16 28.16-15.552 0-28.16-12.607-28.16-28.16C.707 13.038 13.315.43 28.867.43c15.553 0 28.16 12.608 28.16 28.16" fill="#3C4043" mask="url(#b)"/></g><path d="M112.527 168.57c-3.859 0-7-3.14-7-7v-126c0-3.86 3.141-7 7-7h213c3.86 0 7 3.14 7 7v126c0 3.86-3.14 7-7 7h-213z" fill="#202124"/><g><g transform="translate(105 28.57)"><mask id="d" fill="#fff"><use xlink:href="#c"/></mask><path d="M186.408-14.069L152.47-4.976c-1.892.508-2.527 2.874-1.14 4.26l24.843 24.844c1.386 1.386 3.753.751 4.26-1.142l9.093-33.937c.507-1.893-1.225-3.625-3.118-3.118L152.47-4.976c-1.892.508-2.527 2.874-1.14 4.26l24.843 24.844c1.386 1.386 3.753.751 4.26-1.142l9.093-33.937c.507-1.893-1.225-3.625-3.118-3.118" fill="#E74133" mask="url(#d)"/></g><g transform="translate(105 28.57)"><mask id="f" fill="#fff"><use xlink:href="#e"/></mask><path d="M-15.803 120.8c-1.191.688-1.535 2.261-.726 3.373 7.154 9.836 20.727 12.881 31.495 6.665 10.768-6.217 14.917-19.495 9.976-30.608-.56-1.257-2.093-1.745-3.284-1.058L-15.803 120.8z" fill="#81C995" mask="url(#f)"/></g><g transform="translate(105 28.57)"><mask id="h" fill="#fff"><use xlink:href="#g"/></mask><path d="M252.702 109.755l-28.26 28.261a3.062 3.062 0 0 1-4.332 0l-28.262-28.26a3.064 3.064 0 0 1 0-4.332l28.262-28.26a3.062 3.062 0 0 1 4.331 0l28.261 28.26a3.064 3.064 0 0 1 0 4.331" fill="#FDDB79" mask="url(#h)"/></g><g transform="translate(105 28.57)"><mask id="j" fill="#fff"><use xlink:href="#i"/></mask><path d="M68.027-.25c0 15.464-12.536 28-28 28s-28-12.536-28-28 12.536-28 28-28 28 12.536 28 28" fill="#8AB4F8" mask="url(#j)"/></g></g><g><path d="M328.527 161.57a3 3 0 0 1-3 3h-213a3 3 0 0 1-3-3v-126a3 3 0 0 1 3-3h213a3 3 0 0 1 3 3v126zm4.5-141.5h-228a6.508 6.508 0 0 0-6.5 6.5v153.5h241V26.57c0-3.584-2.916-6.5-6.5-6.5z" fill="#3C4043"/><path d="M98.527 180.07V26.57c0-3.584 2.916-6.5 6.5-6.5h228c3.584 0 6.5 2.916 6.5 6.5v153.5h-241z" stroke="#202124" stroke-width="2"/><path d="M220.527 26.57a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" fill="#DADCE0"/><path d="M325.527 176.57h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5M307.527 176.57h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5M289.527 176.57h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5M124.527 176.57h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5M142.527 176.57h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5M160.527 176.57h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5M271.527 176.57h-105a1.5 1.5 0 0 0-1.5 1.5h108a1.5 1.5 0 0 0-1.5-1.5" fill="#202124"/><path d="M222.027 86.382c6.316 0 11.438 5.121 11.438 11.438s-5.122 11.438-11.438 11.438c-6.316 0-11.438-5.121-11.438-11.438s5.122-11.438 11.438-11.438" fill="#F1F1F1"/><path d="M217.527 97.82a7.5 7.5 0 0 1 7.5-7.5h14.701c-2.73-5.342-8.289-9-14.7-9-5.826 0-10.945 3.019-13.882 7.576v12.674h7.386l.001-.001a7.455 7.455 0 0 1-1.006-3.749" fill="#E74133"/><path d="M225.027 105.32a7.496 7.496 0 0 1-6.494-3.75l-7.389-12.671a16.424 16.424 0 0 0-2.617 8.921c0 8.853 6.973 16.077 15.726 16.481l7.271-7.271v-5.46h-.003a7.496 7.496 0 0 1-6.494 3.75" fill="#32A753"/><path d="M239.729 90.32h-14.701a7.5 7.5 0 0 1 6.495 11.248l.002.002-7.28 12.731c.259.012.52.019.783.019 9.112 0 16.5-7.387 16.5-16.5 0-2.701-.65-5.25-1.8-7.5" fill="#F9BB00"/><path d="M225.027 91.82a6 6 0 0 1 0 12 6 6 0 0 1 0-12" fill="#4285F4"/><path d="M81.027 184.57c-1.103 0-2-.897-2-2v-3a.5.5 0 0 1 .5-.5h279a.5.5 0 0 1 .5.5v3c0 1.103-.897 2-2 2h-276zM376.788 48.278c-1.15 1.04-1.092 2.885.145 3.822 5.88 4.453 14.278 4.246 19.948-.884 5.67-5.13 6.714-13.466 2.87-19.76-.81-1.324-2.64-1.567-3.79-.526l-19.173 17.348zM423.668 162.996c-.307 6.134-5.528 10.86-11.663 10.552-6.134-.306-10.858-5.528-10.552-11.662.307-6.135 5.528-10.859 11.662-10.553 6.135.307 10.859 5.53 10.553 11.663" fill="#3C4043"/><path d="M373.426 95.324l.34-6.812c.077-1.538-1.54-2.582-2.91-1.88l-6.07 3.111c-1.37.703-1.465 2.625-.172 3.46l5.729 3.701c1.293.836 3.006-.042 3.083-1.58l.34-6.812c.077-1.538-1.54-2.582-2.91-1.88l-6.07 3.111c-1.37.703-1.465 2.625-.172 3.46l5.729 3.701c1.293.836 3.006-.042 3.083-1.58" fill="#4285F4"/><path d="M67.022 136.045a4.5 4.5 0 1 1-8.99-.45 4.5 4.5 0 0 1 8.99.45" fill="#81C995"/><path d="M28.022 68.045a4.5 4.5 0 1 1-8.99-.45 4.5 4.5 0 0 1 8.99.45" fill="#FDDB79"/><path d="M426.024 87.47a2.999 2.999 0 0 1-3.147 2.846 2.999 2.999 0 1 1 3.146-2.846" fill="#3C4043"/><path d="M441.376 117.08a4 4 0 1 0 5.412 5.892l5.891-5.412a4 4 0 0 0-5.412-5.892l-5.891 5.413z" fill="#EE675C"/><path d="M13.507 125.467c4.518-2.411 6.563-7.644 5.12-12.363a1.701 1.701 0 0 0-2.427-1.013L.897 120.256a1.703 1.703 0 0 0-.511 2.58c3.117 3.827 8.602 5.042 13.12 2.631M67.06 68.092l-4.362-4.362c-2.266-2.266-2.266-5.973 0-8.24 2.266-2.265 5.973-2.265 8.24 0l4.361 4.363c2.266 2.265 2.266 5.973 0 8.239-2.266 2.266-5.973 2.266-8.239 0" fill="#3C4043"/></g></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_default_light.svg b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_default_light.svg
new file mode 100644
index 00000000000..e2cf75680eb
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/set_default_light.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="454" height="185"><defs><path id="a" d="M.707.43h56.32v56.32H.707z"/><path id="c" d="M7.527 0C3.668 0 .528 3.14.528 7v126c0 3.86 3.14 7 6.999 7h213c3.86 0 7-3.14 7-7V7c0-3.86-3.14-7-7-7"/><path id="e" d="M7.527 0C3.668 0 .528 3.14.528 7v126c0 3.86 3.14 7 6.999 7h213c3.86 0 7-3.14 7-7V7c0-3.86-3.14-7-7-7h-213z"/><path id="g" d="M7.527 0C3.668 0 .528 3.14.528 7v126c0 3.86 3.14 7 6.999 7h213c3.86 0 7-3.14 7-7V7c0-3.86-3.14-7-7-7"/><path id="i" d="M7.527 0C3.668 0 .528 3.14.528 7v126c0 3.86 3.14 7 6.999 7h213c3.86 0 7-3.14 7-7V7c0-3.86-3.14-7-7-7"/></defs><g fill="none" fill-rule="evenodd"><path fill="#F1F3F4" d="M292.172 9.494l-38.26 10.251c-2.134.572-2.848 3.24-1.286 4.802l28.008 28.008c1.562 1.562 4.23.847 4.802-1.287l10.252-38.259c.57-2.134-1.382-4.087-3.516-3.515l-38.26 10.251c-2.134.572-2.848 3.24-1.286 4.802l28.008 28.008c1.562 1.562 4.23.847 4.802-1.287l10.252-38.259c.57-2.134-1.382-4.087-3.516-3.515M90.398 148.926c-1.172.677-1.51 2.225-.714 3.32 7.039 9.677 20.395 12.674 30.99 6.557 10.595-6.117 14.678-19.182 9.815-30.117-.549-1.237-2.059-1.718-3.231-1.04l-36.86 21.28zm268.632-10.515l-28.754 28.754a3.115 3.115 0 0 1-4.406 0l-28.754-28.754a3.115 3.115 0 0 1 0-4.406l28.754-28.754a3.117 3.117 0 0 1 4.406 0l28.754 28.754a3.115 3.115 0 0 1 0 4.406"/><g transform="translate(116 -.43)"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><path fill="#F1F3F4" d="M57.027 28.59c0 15.553-12.607 28.16-28.16 28.16-15.552 0-28.16-12.607-28.16-28.16C.707 13.038 13.315.43 28.867.43c15.553 0 28.16 12.608 28.16 28.16" mask="url(#b)"/></g><path fill="#FFF" d="M112.527 168.57c-3.859 0-7-3.14-7-7v-126c0-3.86 3.141-7 7-7h213c3.86 0 7 3.14 7 7v126c0 3.86-3.14 7-7 7h-213z"/><g transform="translate(105 28.57)"><mask id="d" fill="#fff"><use xlink:href="#c"/></mask><path fill="#E74133" d="M186.408-14.069L152.47-4.976c-1.892.508-2.527 2.874-1.14 4.26l24.843 24.844c1.386 1.386 3.753.751 4.26-1.142l9.093-33.937c.507-1.893-1.225-3.625-3.118-3.118L152.47-4.976c-1.892.508-2.527 2.874-1.14 4.26l24.843 24.844c1.386 1.386 3.753.751 4.26-1.142l9.093-33.937c.507-1.893-1.225-3.625-3.118-3.118" mask="url(#d)"/><mask id="f" fill="#fff"><use xlink:href="#e"/></mask><path fill="#32A753" d="M-15.803 120.8c-1.191.688-1.535 2.261-.726 3.373 7.154 9.836 20.727 12.881 31.495 6.665 10.768-6.217 14.917-19.495 9.976-30.608-.56-1.257-2.093-1.745-3.284-1.058L-15.803 120.8z" mask="url(#f)"/><mask id="h" fill="#fff"><use xlink:href="#g"/></mask><path fill="#F9BB00" d="M252.702 109.755l-28.26 28.261a3.062 3.062 0 0 1-4.332 0l-28.262-28.26a3.064 3.064 0 0 1 0-4.332l28.262-28.26a3.062 3.062 0 0 1 4.331 0l28.261 28.26a3.064 3.064 0 0 1 0 4.331" mask="url(#h)"/><mask id="j" fill="#fff"><use xlink:href="#i"/></mask><path fill="#4285F4" d="M68.027-.25c0 15.464-12.536 28-28 28s-28-12.536-28-28 12.536-28 28-28 28 12.536 28 28" mask="url(#j)"/></g><g><path fill="#F1F3F4" d="M328.527 161.57a3 3 0 0 1-3 3h-213a3 3 0 0 1-3-3v-126a3 3 0 0 1 3-3h213a3 3 0 0 1 3 3v126zm4.5-141.5h-228a6.508 6.508 0 0 0-6.5 6.5v153.5h241V26.57c0-3.584-2.916-6.5-6.5-6.5z"/><path stroke="#DADCE0" stroke-width="2" d="M98.527 180.07V26.57c0-3.584 2.916-6.5 6.5-6.5h228c3.584 0 6.5 2.916 6.5 6.5v153.5h-241z"/><path fill="#DADCE0" d="M220.527 26.57a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m105 150h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5m-18 0h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5m-18 0h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5m-165 0h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5m18 0h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5m18 0h-12a1.5 1.5 0 0 0-1.5 1.5h15a1.5 1.5 0 0 0-1.5-1.5m111 0h-105a1.5 1.5 0 0 0-1.5 1.5h108a1.5 1.5 0 0 0-1.5-1.5"/><path fill="#F1F1F1" d="M219.027 86.382c6.316 0 11.438 5.121 11.438 11.438s-5.122 11.438-11.438 11.438c-6.316 0-11.438-5.121-11.438-11.438s5.122-11.438 11.438-11.438"/><path fill="#E74133" d="M217.527 97.82a7.5 7.5 0 0 1 7.5-7.5h14.701c-2.73-5.342-8.289-9-14.7-9-5.826 0-10.945 3.019-13.882 7.576v12.674h7.386l.001-.001a7.455 7.455 0 0 1-1.006-3.749"/><path fill="#32A753" d="M225.027 105.32a7.496 7.496 0 0 1-6.494-3.75l-7.389-12.671a16.424 16.424 0 0 0-2.617 8.921c0 8.853 6.973 16.077 15.726 16.481l7.271-7.271v-5.46h-.003a7.496 7.496 0 0 1-6.494 3.75"/><path fill="#F9BB00" d="M239.729 90.32h-14.701a7.5 7.5 0 0 1 6.495 11.248l.002.002-7.28 12.731c.259.012.52.019.783.019 9.112 0 16.5-7.387 16.5-16.5 0-2.701-.65-5.25-1.8-7.5"/><path fill="#4285F4" d="M225.027 91.82a6 6 0 0 1 0 12 6 6 0 0 1 0-12"/><path fill="#F1F3F4" d="M81.027 184.57c-1.103 0-2-.897-2-2v-3a.5.5 0 0 1 .5-.5h279a.5.5 0 0 1 .5.5v3c0 1.103-.897 2-2 2h-276zM376.788 48.278c-1.15 1.04-1.092 2.884.145 3.821 5.88 4.453 14.278 4.246 19.948-.884 5.67-5.13 6.714-13.466 2.87-19.76-.81-1.324-2.64-1.567-3.79-.526l-19.173 17.348zm46.88 114.718c-.307 6.134-5.528 10.86-11.663 10.552-6.134-.306-10.858-5.528-10.552-11.662.307-6.135 5.528-10.859 11.662-10.553 6.135.307 10.859 5.53 10.553 11.663"/><path fill="#4285F4" d="M373.426 95.324l.34-6.812c.077-1.538-1.54-2.582-2.91-1.88l-6.07 3.111c-1.37.703-1.465 2.625-.172 3.46l5.729 3.701c1.293.836 3.006-.042 3.083-1.58l.34-6.812c.077-1.538-1.54-2.582-2.91-1.88l-6.07 3.111c-1.37.703-1.465 2.625-.172 3.46l5.729 3.701c1.293.836 3.006-.042 3.083-1.58"/><path fill="#32A753" d="M67.022 136.045a4.5 4.5 0 1 1-8.99-.45 4.5 4.5 0 0 1 8.99.45"/><path fill="#F9BB00" d="M28.022 68.045a4.5 4.5 0 1 1-8.99-.45 4.5 4.5 0 0 1 8.99.45"/><path fill="#F1F3F4" d="M426.024 87.47a2.999 2.999 0 0 1-3.147 2.846 2.999 2.999 0 1 1 3.146-2.846"/><path fill="#E74133" d="M441.376 117.08a4 4 0 1 0 5.412 5.892l5.891-5.412a4 4 0 0 0-5.412-5.892l-5.891 5.413z"/><path fill="#F1F3F4" d="M13.507 125.467c4.518-2.411 6.563-7.644 5.12-12.363a1.701 1.701 0 0 0-2.427-1.013L.897 120.256a1.703 1.703 0 0 0-.511 2.58c3.117 3.827 8.602 5.042 13.12 2.631M67.06 68.092l-4.362-4.362c-2.266-2.266-2.266-5.973 0-8.24 2.266-2.265 5.973-2.265 8.24 0l4.361 4.363c2.266 2.265 2.266 5.973 0 8.239-2.266 2.266-5.973 2.266-8.239 0"/></g></g></svg> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/yahoo_1x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/yahoo_1x.png
deleted file mode 100644
index 3b0dcd407b7..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/yahoo_1x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/yahoo_2x.png b/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/yahoo_2x.png
deleted file mode 100644
index 1abc74d7988..00000000000
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/images/yahoo_2x.png
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.html
index 35b8622a09e..891d21751f9 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.html
@@ -6,6 +6,7 @@
<link rel="import" href="landing_view_proxy.html">
<link rel="import" href="navigation_behavior.html">
<link rel="import" href="shared/action_link_style_css.html">
+<link rel="import" href="shared/i18n_setup.html">
<link rel="import" href="shared/onboarding_background.html">
<link rel="import" href="shared/splash_pages_shared_css.html">
<link rel="import" href="welcome_browser_proxy.html">
@@ -13,20 +14,31 @@
<dom-module id="landing-view">
<template>
<style
- include="paper-button-style action-link-style splash-pages-shared-css">
+ include="animations paper-button-style action-link-style
+ splash-pages-shared-css">
+ onboarding-background {
+ --animation-delay: 275ms;
+ }
+
h1 {
outline: none;
}
+
+ .action-button,
+ .action-link {
+ --animation-delay: 150ms;
+ }
</style>
- <onboarding-background></onboarding-background>
<div id="container">
- <h2>$i18n{landingDescription}</h2>
- <h1 tabindex="-1">$i18n{landingTitle}</h1>
- <paper-button class="action-button" on-click="onNewUserClick_">
+ <onboarding-background class="fade-in"></onboarding-background>
+ <h2 class="fade-in">$i18n{landingDescription}</h2>
+ <h1 class="fade-in" tabindex="-1">$i18n{landingTitle}</h1>
+ <paper-button class="action-button fade-in" on-click="onNewUserClick_">
$i18n{landingNewUser}
</paper-button>
- <button class="action-link" on-click="onExistingUserClick_">
- $i18n{landingExistingUser}
+ <button class="action-link fade-in" on-click="onExistingUserClick_">
+ <span hidden$="[[!signinAllowed_]]">$i18n{landingExistingUser}</span>
+ <span hidden$="[[signinAllowed_]]">$i18n{skip}</span>
</button>
</div>
</template>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.js
index 2f17ffdab58..aa2900478fa 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/landing_view.js
@@ -7,6 +7,14 @@ Polymer({
behaviors: [welcome.NavigationBehavior],
+ properties: {
+ /** @private */
+ signinAllowed_: {
+ type: Boolean,
+ value: () => loadTimeData.getBoolean('signinAllowed'),
+ }
+ },
+
/** @private {?nux.LandingViewProxy} */
landingViewProxy_: null,
@@ -36,8 +44,12 @@ Polymer({
onExistingUserClick_: function() {
this.finalized_ = true;
this.landingViewProxy_.recordExistingUser();
- welcome.WelcomeBrowserProxyImpl.getInstance().handleActivateSignIn(
+ if (this.signinAllowed_) {
+ welcome.WelcomeBrowserProxyImpl.getInstance().handleActivateSignIn(
'chrome://welcome/returning-user');
+ } else {
+ welcome.navigateTo(welcome.Routes.RETURNING_USER, 1);
+ }
},
/** @private */
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/navigation_behavior.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/navigation_behavior.html
index 2bde7e152fd..1488b4d3f79 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/navigation_behavior.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/navigation_behavior.html
@@ -1,3 +1,5 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr.html">
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/ntp_background_proxy.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/ntp_background_proxy.js
index 3c86b2af0d3..d0715a1177d 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/ntp_background_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/ntp_background_proxy.js
@@ -26,6 +26,13 @@ cr.define('nux', function() {
*/
preloadImage(url) {}
+ recordBackgroundImageFailedToLoad() {}
+
+ /** @param {number} loadTime */
+ recordBackgroundImageLoadTime(loadTime) {}
+
+ recordBackgroundImageNeverLoaded() {}
+
/** @param {number} id */
setBackground(id) {}
}
@@ -53,6 +60,32 @@ cr.define('nux', function() {
}
/** @override */
+ recordBackgroundImageFailedToLoad() {
+ const ntpInteractions =
+ nux.NtpBackgroundMetricsProxyImpl.getInstance().getInteractions();
+ chrome.metricsPrivate.recordEnumerationValue(
+ 'FirstRun.NewUserExperience.NtpBackgroundInteraction',
+ ntpInteractions.BackgroundImageFailedToLoad,
+ Object.keys(ntpInteractions).length);
+ }
+
+ /** @override */
+ recordBackgroundImageLoadTime(loadTime) {
+ chrome.metricsPrivate.recordTime(
+ 'FirstRun.NewUserExperience.NtpBackgroundLoadTime', loadTime);
+ }
+
+ /** @override */
+ recordBackgroundImageNeverLoaded() {
+ const ntpInteractions =
+ nux.NtpBackgroundMetricsProxyImpl.getInstance().getInteractions();
+ chrome.metricsPrivate.recordEnumerationValue(
+ 'FirstRun.NewUserExperience.NtpBackgroundInteraction',
+ ntpInteractions.BackgroundImageNeverLoaded,
+ Object.keys(ntpInteractions).length);
+ }
+
+ /** @override */
setBackground(id) {
chrome.send('setBackground', [id]);
}
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.html
index 1ce760bf1c4..96b0b413ec9 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.html
@@ -9,6 +9,8 @@
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="../navigation_behavior.html">
+<link rel="import" href="../shared/animations_css.html">
+<link rel="import" href="../shared/chooser_shared_css.html">
<link rel="import" href="../shared/i18n_setup.html">
<link rel="import" href="../shared/module_metrics_proxy.html">
<link rel="import" href="../shared/step_indicator.html">
@@ -16,7 +18,7 @@
<dom-module id="nux-ntp-background">
<template>
- <style include="paper-button-style">
+ <style include="animations chooser-shared-css paper-button-style">
:host {
text-align: center;
}
@@ -40,7 +42,7 @@
#backgroundPreview::before {
/* Copied from browser/resources/local_ntp/custom_backgrounds.js */
- background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.3));
+ background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .3));
/* Pseudo element needs some content (even an empty string) to be
* displayed. */
content: '';
@@ -57,17 +59,19 @@
}
.ntp-background-logo {
- content: -webkit-image-set(
- url(chrome://welcome/images/ntp_background_1x.png) 1x,
- url(chrome://welcome/images/ntp_background_2x.png) 2x);
+ content: url(../images/module_icons/wallpaper_light.svg);
height: 39px;
margin: auto;
margin-bottom: 16px;
width: 44px;
}
+ :host-context([dark]) .ntp-background-logo {
+ content: url(../images/module_icons/wallpaper_dark.svg);
+ }
+
h1 {
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
font-size: 1.5rem;
font-weight: 500;
margin: 0;
@@ -88,15 +92,10 @@
width: 592px;
}
- .ntp-background-grid-button {
+ .option {
align-items: stretch;
- background: var(--cr-card-background-color);
- border: solid 1px var(--google-grey-refresh-300);
border-radius: 4px;
- color: var(--cr-secondary-text-color);
- cursor: pointer;
display: flex;
- flex-direction: column;
height: 100%;
overflow: hidden;
padding: 0;
@@ -105,82 +104,70 @@
width: 100%;
}
- #backgroundPreview.active + .content .ntp-background-grid-button {
+ #backgroundPreview.active + .content .option {
border-color: var(--google-grey-refresh-700);
}
- .ntp-background-grid-button:hover {
- box-shadow: 0 3px 6px 2px rgba(0, 36, 100, .1);
- }
-
/* Remove outline when button is focused using the mouse. */
- .ntp-background-grid-button:focus:not(.keyboard-focused) {
+ .option:focus:not(.keyboard-focused) {
outline: none;
}
.ntp-background-thumbnail {
- background-color: white;
+ background-color: var(--cr-card-background-color);
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
flex: 1;
}
- .art {
- background-image: url(../images/ntp_thumbnails/art.jpg);
- }
-
- .cityscape {
- background-image: url(../images/ntp_thumbnails/cityscape.jpg);
+ .option-name {
+ border-top: var(--cr-separator-line);
+ color: var(--navi-wallpaper-text-color);
+ height: 3rem;
+ line-height: 3rem;
+ overflow: hidden;
+ padding: 0 .75rem;
+ text-overflow: ellipsis;
}
- .earth {
- background-image: url(../images/ntp_thumbnails/earth.jpg);
+ .option[active] .option-name {
+ background: var(--cr-checked-color);
+ color: var(--cr-card-background-color);
}
- .geometric-shapes {
- background-image: url(../images/ntp_thumbnails/geometric_shapes.jpg);
+ .button-bar {
+ margin-top: 56px;
}
- .landscape {
- background-image: url(../images/ntp_thumbnails/landscape.jpg);
+ #skipButton {
+ background-color: var(--cr-card-background-color)
}
- .ntp-background-title {
- border-top: var(--cr-separator-line);
- font-size: 14px;
- height: 48px;
- line-height: 48px;
- overflow: hidden;
- padding: 0 12px;
- text-overflow: ellipsis;
+ #skipButton:hover {
+ background-image:
+ linear-gradient(var(--hover-bg-color), var(--hover-bg-color));
}
- .ntp-background-grid-button[active] .ntp-background-title {
- background: var(--google-blue-600);
- color: white;
+ /* Wallpaper Thumbnails */
+ .art {
+ background-image: url(../images/ntp_thumbnails/art.jpg);
}
- .button-bar {
- display: flex;
- justify-content: space-between;
- margin-top: 56px;
+ .cityscape {
+ background-image: url(../images/ntp_thumbnails/cityscape.jpg);
}
- .skip-button-container {
- background: white;
- border-radius: 4px;
+ .earth {
+ background-image: url(../images/ntp_thumbnails/earth.jpg);
}
- iron-icon[icon='cr:chevron-right'] {
- height: 20px;
- margin-inline-end: -10px;
- margin-inline-start: 6px;
- width: 20px;
+ .geometric-shapes {
+ background-image: url(../images/ntp_thumbnails/geometric_shapes.jpg);
}
- :host-context([dir=rtl]) iron-icon {
- transform: scaleX(-1);
+ .landscape {
+ background-image: url(../images/ntp_thumbnails/landscape.jpg);
}
</style>
<div
@@ -192,28 +179,26 @@
<div class="ntp-background-logo"></div>
<h1 tabindex="-1">$i18n{ntpBackgroundDescription}</h1>
- <div class="ntp-backgrounds-grid">
+ <div class="ntp-backgrounds-grid slide-in">
<template is="dom-repeat" items="[[backgrounds_]]">
<button
active$="[[isSelectedBackground_(item, selectedBackground_)]]"
- class="ntp-background-grid-button"
+ class="option"
on-click="onBackgroundClick_"
on-keyup="onBackgroundKeyUp_"
on-pointerdown="onBackgroundPointerDown_">
<div
class$="ntp-background-thumbnail [[item.thumbnailClass]]">
</div>
- <div class="ntp-background-title">[[item.title]]</div>
+ <div class="option-name">[[item.title]]</div>
</button>
</template>
</div>
<div class="button-bar">
- <div class="skip-button-container">
- <paper-button id="skipButton" on-click="onSkipClicked_">
- $i18n{skip}
- </paper-button>
- </div>
+ <paper-button id="skipButton" on-click="onSkipClicked_">
+ $i18n{skip}
+ </paper-button>
<step-indicator model="[[indicatorModel]]"></step-indicator>
<paper-button class="action-button"
on-click="onNextClicked_">
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.js
index 5c6e880b5f2..99e37a65861 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/ntp_background/nux_ntp_background.js
@@ -29,6 +29,9 @@ Polymer({
/** @private */
finalized_: false,
+ /** @private {boolean} */
+ imageIsLoading_: false,
+
/** @private {?nux.ModuleMetricsManager} */
metricsManager_: null,
@@ -65,6 +68,10 @@ Polymer({
},
onRouteExit: function() {
+ if (this.imageIsLoading_) {
+ this.ntpBackgroundProxy_.recordBackgroundImageNeverLoaded();
+ }
+
if (this.finalized_) {
return;
}
@@ -72,6 +79,10 @@ Polymer({
},
onRouteUnload: function() {
+ if (this.imageIsLoading_) {
+ this.ntpBackgroundProxy_.recordBackgroundImageNeverLoaded();
+ }
+
if (this.finalized_) {
return;
}
@@ -99,13 +110,24 @@ Polymer({
const id = this.selectedBackground_.id;
if (id > -1) {
+ this.imageIsLoading_ = true;
const imageUrl = this.selectedBackground_.imageUrl;
- this.ntpBackgroundProxy_.preloadImage(imageUrl).then(() => {
- if (this.selectedBackground_.id === id) {
- this.$.backgroundPreview.classList.add('active');
- this.$.backgroundPreview.style.backgroundImage = `url(${imageUrl})`;
- }
- });
+ const beforeLoadTime = window.performance.now();
+ this.ntpBackgroundProxy_.preloadImage(imageUrl).then(
+ () => {
+ if (this.selectedBackground_.id === id) {
+ this.imageIsLoading_ = false;
+ this.$.backgroundPreview.classList.add('active');
+ this.$.backgroundPreview.style.backgroundImage =
+ `url(${imageUrl})`;
+ }
+
+ this.ntpBackgroundProxy_.recordBackgroundImageLoadTime(
+ Math.floor(performance.now() - beforeLoadTime));
+ },
+ () => {
+ this.ntpBackgroundProxy_.recordBackgroundImageFailedToLoad();
+ });
} else {
this.$.backgroundPreview.classList.remove('active');
}
@@ -158,7 +180,7 @@ Polymer({
direction *= -1; // Reverse direction if RTL.
}
- const buttons = this.root.querySelectorAll('.ntp-background-grid-button');
+ const buttons = this.root.querySelectorAll('.option');
const targetIndex = Array.prototype.indexOf.call(buttons, element);
const oldFocus = buttons[targetIndex];
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/onboarding_welcome_resources.grd b/chromium/chrome/browser/resources/welcome/onboarding_welcome/onboarding_welcome_resources.grd
index 86b5392d116..c9ecd0b0850 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/onboarding_welcome_resources.grd
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/onboarding_welcome_resources.grd
@@ -1,243 +1,330 @@
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
- <output filename="grit/onboarding_welcome_resources.h" type="rc_header">
+ <output filename="grit/onboarding_welcome_resources.h"
+ type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/onboarding_welcome_resources_map.cc"
- type="resource_file_map_source" />
+ type="gzipped_resource_file_map_source" />
<output filename="grit/onboarding_welcome_resources_map.h"
- type="resource_map_header" />
- <output filename="onboarding_welcome_resources.pak" type="data_package" />
+ type="gzipped_resource_map_header" />
+ <output filename="onboarding_welcome_resources.pak"
+ type="data_package" />
</outputs>
<release seq="1">
<includes>
- <include name="IDR_NUX_EMAIL_AOL_1X" file="images\aol_1x.png" type="BINDATA"/>
- <include name="IDR_NUX_EMAIL_AOL_2X" file="images\aol_2x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_GMAIL_1X" file="images\gmail_1x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_GMAIL_2X" file="images\gmail_2x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_ICLOUD_1X" file="images\icloud_1x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_ICLOUD_2X" file="images\icloud_2x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_OUTLOOK_1X" file="images\outlook_1x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_OUTLOOK_2X" file="images\outlook_2x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_PROVIDER_LOGO_1X" file="images\email_provider_1x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_PROVIDER_LOGO_2X" file="images\email_provider_2x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_YAHOO_1X" file="images\yahoo_1x.png" type="BINDATA" />
- <include name="IDR_NUX_EMAIL_YAHOO_2X" file="images\yahoo_2x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_CHROME_STORE_1X" file="images\chrome_store_1x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_CHROME_STORE_2X" file="images\chrome_store_2x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_LOGO_1X" file="images\google_apps_1x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_LOGO_2X" file="images\google_apps_2x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_MAPS_1X" file="images\maps_1x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_MAPS_2X" file="images\maps_2x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_NEWS_1X" file="images\news_1x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_NEWS_2X" file="images\news_2x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_TRANSLATE_1X" file="images\translate_1x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_TRANSLATE_2X" file="images\translate_2x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_YOUTUBE_1X" file="images\youtube_1x.png" type="BINDATA" />
- <include name="IDR_NUX_GOOGLE_APPS_YOUTUBE_2X" file="images\youtube_2x.png" type="BINDATA" />
- <include name="IDR_NUX_NTP_BACKGROUND_LOGO_1X" file="images\ntp_background_1x.png" type="BINDATA" />
- <include name="IDR_NUX_NTP_BACKGROUND_LOGO_2X" file="images\ntp_background_2x.png" type="BINDATA" />
- <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_ART" file="images\ntp_thumbnails\art.jpg" type="BINDATA" />
- <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_CITYSCAPE" file="images\ntp_thumbnails\cityscape.jpg" type="BINDATA" />
- <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_EARTH" file="images\ntp_thumbnails\earth.jpg" type="BINDATA" />
- <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_GEOMETRIC_SHAPES" file="images\ntp_thumbnails\geometric_shapes.jpg" type="BINDATA" />
- <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_LANDSCAPE" file="images\ntp_thumbnails\landscape.jpg" type="BINDATA" />
- <include name="IDR_NUX_SET_AS_DEFAULT_ILLUSTRATION_1X" file="images\set_as_default_illustration_1x.png" type="BINDATA" />
- <include name="IDR_NUX_SET_AS_DEFAULT_ILLUSTRATION_2X" file="images\set_as_default_illustration_2x.png" type="BINDATA" />
- <include name="IDR_NUX_SET_AS_DEFAULT_LOGO_1X" file="images\set_as_default_1x.png" type="BINDATA" />
- <include name="IDR_NUX_SET_AS_DEFAULT_LOGO_2X" file="images\set_as_default_2x.png" type="BINDATA" />
- <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_BLUE_CIRCLE_SVG" file="images\background_svgs\blue_circle.svg" type="BINDATA" />
- <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_GREEN_RECTANGLE_SVG" file="images\background_svgs\green_rectangle.svg" type="BINDATA" />
- <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_GREY_OVAL_SVG" file="images\background_svgs\grey_oval.svg" type="BINDATA" />
- <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_GREY_ROUNDED_RECTANGLE_SVG" file="images\background_svgs\grey_rounded_rectangle.svg" type="BINDATA" />
- <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_RED_TRIANGLE_SVG" file="images\background_svgs\red_triangle.svg" type="BINDATA" />
- <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_YELLOW_DOTS_SVG" file="images\background_svgs\yellow_dots.svg" type="BINDATA" />
- <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_YELLOW_SEMICIRCLE_SVG" file="images\background_svgs\yellow_semicircle.svg" type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_GMAIL_1X"
+ file="images/gmail_1x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_GMAIL_2X"
+ file="images/gmail_2x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_MAPS_1X"
+ file="images/maps_1x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_MAPS_2X"
+ file="images/maps_2x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_NEWS_1X"
+ file="images/news_1x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_NEWS_2X"
+ file="images/news_2x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_TRANSLATE_1X"
+ file="images/translate_1x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_TRANSLATE_2X"
+ file="images/translate_2x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_YOUTUBE_1X"
+ file="images/youtube_1x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_GOOGLE_APPS_YOUTUBE_2X"
+ file="images/youtube_2x.png"
+ type="BINDATA" />
+ <include name="IDR_NUX_MODULE_ICONS_GOOGLE_DARK"
+ file="images/module_icons/google_dark.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_NUX_MODULE_ICONS_GOOGLE_LIGHT"
+ file="images/module_icons/google_light.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_NUX_MODULE_ICONS_SET_DEFAULT_DARK"
+ file="images/module_icons/set_default_dark.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_NUX_MODULE_ICONS_SET_DEFAULT_LIGHT"
+ file="images/module_icons/set_default_light.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_NUX_MODULE_ICONS_WALLPAPER_DARK"
+ file="images/module_icons/wallpaper_dark.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_NUX_MODULE_ICONS_WALLPAPER_LIGHT"
+ file="images/module_icons/wallpaper_light.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_ART"
+ file="images/ntp_thumbnails/art.jpg"
+ type="BINDATA" />
+ <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_CITYSCAPE"
+ file="images/ntp_thumbnails/cityscape.jpg"
+ type="BINDATA" />
+ <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_EARTH"
+ file="images/ntp_thumbnails/earth.jpg"
+ type="BINDATA" />
+ <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_GEOMETRIC_SHAPES"
+ file="images/ntp_thumbnails/geometric_shapes.jpg"
+ type="BINDATA" />
+ <include name="IDR_NUX_NTP_BACKGROUND_THUMBNAIL_LANDSCAPE"
+ file="images/ntp_thumbnails/landscape.jpg"
+ type="BINDATA" />
+ <include name="IDR_NUX_SET_DEFAULT_DARK"
+ file="images\set_default_dark.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_NUX_SET_DEFAULT_LIGHT"
+ file="images\set_default_light.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_BLUE_CIRCLE_SVG"
+ file="images/background_svgs/blue_circle.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_GREEN_RECTANGLE_SVG"
+ file="images/background_svgs/green_rectangle.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_GREY_OVAL_SVG"
+ file="images/background_svgs/grey_oval.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_GREY_ROUNDED_RECTANGLE_SVG"
+ file="images/background_svgs/grey_rounded_rectangle.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_RED_TRIANGLE_SVG"
+ file="images/background_svgs/red_triangle.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_YELLOW_DOTS_SVG"
+ file="images/background_svgs/yellow_dots.svg"
+ compress="gzip"
+ type="BINDATA" />
+ <include name="IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_YELLOW_SEMICIRCLE_SVG"
+ file="images/background_svgs/yellow_semicircle.svg"
+ compress="gzip"
+ type="BINDATA" />
</includes>
<structures>
- <structure name="IDR_WELCOME_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_HTML"
- file="email_interstitial.html"
- type="chrome_html"
- preprocess="true"/>
- <structure name="IDR_WELCOME_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_JS"
- file="email_interstitial.js"
- type="chrome_html"
- preprocess="true"/>
- <structure name="IDR_WELCOME_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_PROXY_HTML"
- file="email_interstitial_proxy.html"
- type="chrome_html"
- preprocess="true"/>
- <structure name="IDR_WELCOME_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_PROXY_JS"
- file="email_interstitial_proxy.js"
- type="chrome_html"
- preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_LANDING_VIEW_HTML"
file="landing_view.html"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_LANDING_VIEW_JS"
file="landing_view.js"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_LANDING_VIEW_PROXY_HTML"
file="landing_view_proxy.html"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_LANDING_VIEW_PROXY_JS"
file="landing_view_proxy.js"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_NAVIGATION_BEHAVIOR_HTML"
file="navigation_behavior.html"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_NAVIGATION_BEHAVIOR_JS"
file="navigation_behavior.js"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_NUX_SHARED_APP_CHOOSER_HTML"
- file="shared\app_chooser.html"
+ file="shared/app_chooser.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_NUX_SHARED_APP_CHOOSER_JS"
- file="shared\app_chooser.js"
+ file="shared/app_chooser.js"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_ACTION_LINK_STYLE_JS"
- file="shared\action_link_style.js"
+ file="shared/action_link_style.js"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_ACTION_LINK_STYLE_CSS_HTML"
- file="shared\action_link_style_css.html"
+ file="shared/action_link_style_css.html"
+ compress="gzip"
+ type="chrome_html" />
+ <structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_ANIMATIONS_CSS"
+ file="shared/animations_css.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_BOOKMARK_PROXY_HTML"
- file="shared\bookmark_proxy.html"
+ file="shared/bookmark_proxy.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_BOOKMARK_PROXY_JS"
- file="shared\bookmark_proxy.js"
+ file="shared/bookmark_proxy.js"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_CHOOSER_SHARED_CSS"
- file="shared\chooser_shared_css.html"
+ file="shared/chooser_shared_css.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_I18N_SETUP_HTML"
- file="shared\i18n_setup.html"
+ file="shared/i18n_setup.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_MODULE_METRICS_PROXY_HTML"
- file="shared\module_metrics_proxy.html"
+ file="shared/module_metrics_proxy.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_MODULE_METRICS_PROXY_JS"
- file="shared\module_metrics_proxy.js"
+ file="shared/module_metrics_proxy.js"
+ compress="gzip"
+ type="chrome_html" />
+ <structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_NAVI_COLORS_CSS"
+ file="shared/navi_colors_css.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_ONBOARDING_BACKGROUND_HTML"
- file="shared\onboarding_background.html"
+ file="shared/onboarding_background.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_ONBOARDING_BACKGROUND_JS"
- file="shared\onboarding_background.js"
+ file="shared/onboarding_background.js"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_STEP_INDICATOR_HTML"
- file="shared\step_indicator.html"
+ file="shared/step_indicator.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_STEP_INDICATOR_JS"
- file="shared\step_indicator.js"
+ file="shared/step_indicator.js"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SHARED_SPLASH_PAGES_SHARED_CSS"
- file="shared\splash_pages_shared_css.html"
+ file="shared/splash_pages_shared_css.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SIGNIN_VIEW_HTML"
file="signin_view.html"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SIGNIN_VIEW_JS"
file="signin_view.js"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SIGNIN_VIEW_PROXY_HTML"
file="signin_view_proxy.html"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_SIGNIN_VIEW_PROXY_JS"
file="signin_view_proxy.js"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_APP_HTML"
file="welcome_app.html"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_APP_JS"
file="welcome_app.js"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_BROWSER_PROXY_HTML"
file="welcome_browser_proxy.html"
+ compress="gzip"
type="chrome_html"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_BROWSER_PROXY_JS"
file="welcome_browser_proxy.js"
+ compress="gzip"
type="chrome_html"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_CSS"
file="welcome.css"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_HTML"
file="welcome.html"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_JS"
file="welcome.js"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
- <!-- NUX Email-->
- <structure name="IDR_EMAIL_APP_PROXY_HTML"
- file="email\email_app_proxy.html"
- type="chrome_html" />
- <structure name="IDR_EMAIL_APP_PROXY_JS"
- file="email\email_app_proxy.js"
- type="chrome_html" />
- <structure name="IDR_NUX_EMAIL_HTML"
- file="email\nux_email.html"
- type="chrome_html" />
- <structure name="IDR_NUX_EMAIL_JS"
- file="email\nux_email.js"
- type="chrome_html" />
-
<!-- NUX Google apps-->
<structure name="IDR_NUX_GOOGLE_APPS_HTML"
- file="google_apps\nux_google_apps.html"
+ file="google_apps/nux_google_apps.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_NUX_GOOGLE_APPS_JS"
- file="google_apps\nux_google_apps.js"
+ file="google_apps/nux_google_apps.js"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_GOOGLE_APP_PROXY_HTML"
- file="google_apps\google_app_proxy.html"
+ file="google_apps/google_app_proxy.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_GOOGLE_APP_PROXY_JS"
- file="google_apps\google_app_proxy.js"
+ file="google_apps/google_app_proxy.js"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_NUX_SET_AS_DEFAULT_HTML"
- file="set_as_default\nux_set_as_default.html"
+ file="set_as_default/nux_set_as_default.html"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_NUX_SET_AS_DEFAULT_JS"
- file="set_as_default\nux_set_as_default.js"
+ file="set_as_default/nux_set_as_default.js"
type="chrome_html"
+ compress="gzip"
preprocess="true"/>
<structure name="IDR_NUX_SET_AS_DEFAULT_PROXY_HTML"
- file="set_as_default\nux_set_as_default_proxy.html"
+ file="set_as_default/nux_set_as_default_proxy.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_NUX_SET_AS_DEFAULT_PROXY_JS"
- file="set_as_default\nux_set_as_default_proxy.js"
+ file="set_as_default/nux_set_as_default_proxy.js"
+ compress="gzip"
type="chrome_html" />
<!-- NUX NTP background-->
<structure name="IDR_NUX_NTP_BACKGROUND_HTML"
- file="ntp_background\nux_ntp_background.html"
+ file="ntp_background/nux_ntp_background.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_NUX_NTP_BACKGROUND_JS"
- file="ntp_background\nux_ntp_background.js"
+ file="ntp_background/nux_ntp_background.js"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_NUX_NTP_BACKGROUND_PROXY_HTML"
- file="ntp_background\ntp_background_proxy.html"
+ file="ntp_background/ntp_background_proxy.html"
+ compress="gzip"
type="chrome_html" />
<structure name="IDR_NUX_NTP_BACKGROUND_PROXY_JS"
- file="ntp_background\ntp_background_proxy.js"
+ file="ntp_background/ntp_background_proxy.js"
+ compress="gzip"
type="chrome_html" />
</structures>
</release>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/BUILD.gn b/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/BUILD.gn
index 70d75a12893..e633bc817e4 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/BUILD.gn
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/BUILD.gn
@@ -22,6 +22,7 @@ js_library("nux_set_as_default") {
js_library("nux_set_as_default_proxy") {
deps = [
+ "../shared:nux_types",
"//ui/webui/resources/js:cr",
]
externs_list = [
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.html
index c88537c4643..306a4e39de9 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.html
@@ -5,6 +5,7 @@
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="../navigation_behavior.html">
+<link rel="import" href="../shared/animations_css.html">
<link rel="import" href="../shared/i18n_setup.html">
<link rel="import" href="../shared/step_indicator.html">
<link rel="import" href="nux_set_as_default_proxy.html">
@@ -15,31 +16,35 @@
<dom-module id="nux-set-as-default">
<template>
- <style include="paper-button-style">
+ <style include="animations paper-button-style">
.container {
text-align: center;
}
.logo {
- content: -webkit-image-set(
- url(../images/set_as_default_1x.png) 1x,
- url(../images/set_as_default_2x.png) 2x);
+ content: url(../images/module_icons/set_default_light.svg);
display: inline-block;
height: 38px;
margin-bottom: 16px;
width: 42px;
}
+ :host-context([dark]) .logo {
+ content: url(../images/module_icons/set_default_dark.svg);
+ }
+
.illustration {
- content: -webkit-image-set(
- url(../images/set_as_default_illustration_1x.png) 1x,
- url(../images/set_as_default_illustration_2x.png) 2x);
+ content: url(../images/set_default_light.svg);
margin: auto;
width: 454px;
}
+ :host-context([dark]) .illustration {
+ content: url(../images/set_default_dark.svg);
+ }
+
h1 {
- color: var(--google-grey-900);
+ color: var(--cr-primary-text-color);
font-size: 1.5rem;
font-weight: 500;
line-height: 2.5rem;
@@ -48,7 +53,7 @@
}
h2 {
- color: var(--google-grey-900);
+ color: var(--cr-secondary-text-color);
font-size: 1.25rem;
font-weight: unset;
line-height: 1.875rem;
@@ -67,8 +72,8 @@
<if expr="is_win">
iron-icon[icon='cr:open-in-new'] {
height: 20px;
- margin-left: 6px;
- margin-right: -10px;
+ margin-inline-start: 6px;
+ margin-inline-end: -10px;
width: 20px;
}
</if>
@@ -77,7 +82,7 @@
<div class="logo"></div>
<h1 tabindex="-1">$i18n{setDefaultHeader}</h1>
<h2>$i18n{setDefaultSubHeader}</h2>
- <div class="illustration" aria-hidden="true"></div>
+ <div class="illustration slide-in" aria-hidden="true"></div>
<div class="button-bar">
<paper-button id="decline-button" on-click="onDeclineClick_">
$i18n{setDefaultSkip}
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.js
index bb8aa03dd36..6f0477b9db5 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default.js
@@ -86,6 +86,8 @@ Polymer({
onDefaultBrowserChange_: function(status) {
if (status.isDefault) {
this.browserProxy_.recordSuccessfullySetDefault();
+ // Triggers toast in the containing welcome-app.
+ this.fire('default-browser-change');
this.finished_();
return;
}
@@ -93,8 +95,10 @@ Polymer({
// <if expr="is_macosx">
// On Mac OS, we do not get a notification when the default browser changes.
// This will fake the notification.
- window.setTimeout(
- () => this.browserProxy_.requestDefaultBrowserState(), 100);
+ window.setTimeout(() => {
+ this.browserProxy_.requestDefaultBrowserState().then(
+ this.onDefaultBrowserChange_.bind(this));
+ }, 100);
// </if>
},
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default_proxy.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default_proxy.js
index 1596232b152..1fe1cec973f 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/nux_set_as_default_proxy.js
@@ -26,6 +26,7 @@ cr.define('nux', function() {
/** @interface */
class NuxSetAsDefaultProxy {
+ /** @return {!Promise<!nux.DefaultBrowserInfo>} */
requestDefaultBrowserState() {}
setAsDefault() {}
recordPageShown() {}
@@ -40,7 +41,7 @@ cr.define('nux', function() {
class NuxSetAsDefaultProxyImpl {
/** @override */
requestDefaultBrowserState() {
- chrome.send('requestDefaultBrowserState');
+ return cr.sendWithPromise('requestDefaultBrowserState');
}
/** @override */
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/action_link_style_css.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/action_link_style_css.html
index b4fb1e7b4ca..6e51989f3df 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/action_link_style_css.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/action_link_style_css.html
@@ -12,7 +12,7 @@
-webkit-appearance: none;
background: none;
border: none;
- color: var(--google-blue-700);
+ color: var(--cr-link-color);
display: inline-block;
font-family: inherit;
text-decoration: none;
@@ -31,4 +31,4 @@
</template>
</dom-module>
-<script src="action_link_style.js"></script> \ No newline at end of file
+<script src="action_link_style.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/animations_css.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/animations_css.html
new file mode 100644
index 00000000000..c79bd5443f6
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/animations_css.html
@@ -0,0 +1,39 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<dom-module id="animations">
+ <template>
+ <style>
+ @keyframes fade-in {
+ 0% { opacity: 0; }
+ 100% { opacity: 1; }
+ }
+
+ @keyframes slide-in {
+ 0% { transform: translateX(var(--slide-in-length, 40px)); }
+ 100% { transform: translateX(0); }
+ }
+
+ .fade-in {
+ animation-delay: var(--animation-delay, 0);
+ animation-duration: 200ms;
+ animation-fill-mode: forwards;
+ animation-name: fade-in;
+ animation-timing-function: ease-in;
+ opacity: 0;
+ }
+
+ .slide-in {
+ animation-delay: var(--animation-delay, 0);
+ animation-duration: 200ms;
+ animation-fill-mode: forwards;
+ animation-name: slide-in;
+ animation-timing-function: ease;
+ transform: translateX(30px);
+ }
+
+ :host-context(html[dir='rtl']) .slide-in {
+ --slide-in-length: -40px;
+ }
+ </style>
+ </template>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/app_chooser.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/app_chooser.html
index 5ad293f27f4..aa6755d4ebc 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/app_chooser.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/app_chooser.html
@@ -10,6 +10,7 @@
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="../navigation_behavior.html">
+<link rel="import" href="animations_css.html">
<link rel="import" href="bookmark_proxy.html">
<link rel="import" href="chooser_shared_css.html">
<link rel="import" href="i18n_setup.html">
@@ -18,7 +19,101 @@
<dom-module id="app-chooser">
<template>
- <style include="chooser-shared-css paper-button-style">
+ <style include="animations chooser-shared-css paper-button-style">
+ :host {
+ display: block;
+ white-space: nowrap;
+ }
+
+ .button-bar {
+ margin-top: 4rem;
+ }
+
+ .option {
+ -webkit-appearance: none;
+ align-items: center;
+ border-radius: 8px;
+ box-sizing: border-box;
+ display: inline-flex;
+ font-family: inherit;
+ height: 7.5rem;
+ justify-content: center;
+ outline: 0;
+ position: relative;
+ transition-duration: 500ms;
+ transition-property: box-shadow;
+ vertical-align: bottom;
+ width: 6.25rem;
+ }
+
+ .option:not(:first-of-type) {
+ margin-inline-start: 1.5rem;
+ }
+
+ .option[active] {
+ border: 1px solid var(--cr-checked-color);
+ color: var(--cr-checked-color);
+ font-weight: 500;
+ }
+
+ .option.keyboard-focused:focus {
+ outline: var(--navi-keyboard-focus-color) solid 3px;
+ }
+
+ .option-name {
+ flex-grow: 0;
+ line-height: 1.25rem;
+ text-align: center;
+ white-space: normal;
+ }
+
+ .option-icon {
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: contain;
+ height: 2rem;
+ margin: auto;
+ width: 2rem;
+ }
+
+ .option-icon-shadow {
+ background-color: var(--navi-option-icon-shadow-color);
+ border-radius: 50%;
+ display: flex;
+ height: 3rem;
+ margin-bottom: .25rem;
+ width: 3rem;
+ }
+
+ .option iron-icon {
+ --iron-icon-fill-color: var(--cr-card-background-color);
+ background: var(--navi-check-icon-color);
+ border-radius: 50%;
+ display: none;
+ height: .75rem;
+ margin: 0;
+ position: absolute;
+ right: .375rem;
+ top: .375rem;
+ width: .75rem;
+ }
+
+ :host-context([dir=rtl]) .option iron-icon {
+ left: .375rem;
+ right: unset;
+ }
+
+ .option.keyboard-focused:focus iron-icon[icon='cr:check'],
+ .option:hover iron-icon[icon='cr:check'],
+ .option[active] iron-icon[icon='cr:check'] {
+ display: block;
+ }
+
+ .option[active] iron-icon[icon='cr:check'] {
+ background: var(--cr-checked-color);
+ }
+
+ /* App Icons */
.gmail {
content: -webkit-image-set(
url(chrome://welcome/images/gmail_1x.png) 1x,
@@ -73,6 +168,12 @@
url(chrome://welcome/images/news_2x.png) 2x);
}
+ .search {
+ content: -webkit-image-set(
+ url(chrome://theme/IDS_ONBOARDING_WELCOME_SEARCH@1x) 1x,
+ url(chrome://theme/IDS_ONBOARDING_WELCOME_SEARCH@2x) 2x);
+ }
+
.web-store {
content: -webkit-image-set(
url(chrome://welcome/images/chrome_store_1x.png) 1x,
@@ -80,18 +181,20 @@
}
</style>
- <template is="dom-repeat" items="[[appList_]]">
- <button active$="[[item.selected]]"
- aria-pressed$="[[getAriaPressed_(item.selected)]]"
- on-click="onAppClick_" on-pointerdown="onAppPointerDown_"
- on-keyup="onAppKeyUp_" class="option">
- <div class="option-icon-shadow">
- <div class$="[[item.icon]] option-icon"></div>
- </div>
- <div class="option-name">[[item.name]]</div>
- <iron-icon icon="cr:check"></iron-icon>
- </button>
- </template>
+ <div class="slide-in">
+ <template is="dom-repeat" items="[[appList_]]">
+ <button active$="[[item.selected]]"
+ aria-pressed$="[[getAriaPressed_(item.selected)]]"
+ on-click="onAppClick_" on-pointerdown="onAppPointerDown_"
+ on-keyup="onAppKeyUp_" class="option">
+ <div class="option-icon-shadow">
+ <div class$="[[item.icon]] option-icon"></div>
+ </div>
+ <div class="option-name">[[item.name]]</div>
+ <iron-icon icon="cr:check"></iron-icon>
+ </button>
+ </template>
+ </div>
<div class="button-bar">
<paper-button id="noThanksButton" on-click="onNoThanksClicked_">
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/chooser_shared_css.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/chooser_shared_css.html
index 283c7f05282..97449a20159 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/chooser_shared_css.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/chooser_shared_css.html
@@ -1,113 +1,31 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="chrome://resources/html/md_select_css.html">
+<link rel="import" href="navi_colors_css.html">
<dom-module id="chooser-shared-css">
<template>
- <style>
- :host {
- color: var(--google-grey-900);
- display: block;
- white-space: nowrap;
- }
-
+ <style include="navi-colors-css">
.option {
- -webkit-appearance: none;
- align-items: center;
- background: white;
- border: 1px solid var(--google-grey-refresh-300);
- border-radius: 8px;
- box-sizing: border-box;
+ background: var(--cr-card-background-color);
+ border: 1px solid var(--navi-border-color);
+ color: var(--cr-primary-text-color);
cursor: pointer;
- display: inline-flex;
flex-direction: column;
- font-family: inherit;
- height: 7.5rem;
- justify-content: center;
- outline: 0;
- position: relative;
- transition-duration: 500ms;
- transition-property: box-shadow;
- vertical-align: bottom;
- width: 6.25rem;
}
.option:hover {
- box-shadow: 0 3px 6px 2px rgba(0, 36, 100, .1);
- }
-
- .option[active] {
- border: 1px solid var(--google-blue-600);
- color: var(--google-blue-600);
- font-weight: 500;
- }
-
- .option:not(:first-of-type) {
- margin-inline-start: 1.5rem;
- }
-
- .option.keyboard-focused:focus {
- outline: rgba(26, 115, 232, 0.4) solid 3px;
- }
-
- .option .option-name {
- flex-grow: 0;
- font-size: 0.875rem;
- line-height: 1.25rem;
- text-align: center;
- white-space: normal;
- }
-
- .option .option-icon {
- background-position: center;
- background-repeat: no-repeat;
- background-size: contain;
- height: 2rem;
- margin: auto;
- width: 2rem;
- }
-
- .option .option-icon-shadow {
- background-color: var(--google-grey-refresh-100);
- border-radius: 50%;
- display: flex;
- height: 3rem;
- margin-bottom: 0.25rem;
- width: 3rem;
- }
-
- :host-context([dir=rtl]) .option iron-icon {
- left: 0.375rem;
- right: unset;
- }
-
- .option iron-icon {
- --iron-icon-fill-color: white;
- background: lightgrey;
- border-radius: 50%;
- display: none;
- height: 0.75rem;
- margin: 0;
- position: absolute;
- right: 0.375rem;
- top: 0.375rem;
- width: 0.75rem;
- }
-
- .option.keyboard-focused:focus iron-icon[icon='cr:check'],
- .option:hover iron-icon[icon='cr:check'],
- .option[active] iron-icon[icon='cr:check'] {
- display: block;
+ box-shadow: var(--navi-option-box-shadow);
}
- .option[active] iron-icon[icon='cr:check'] {
- background: var(--google-blue-600);
+ .option-name {
+ font-size: .875rem;
}
.button-bar {
display: flex;
justify-content: space-between;
- margin-top: 4rem;
}
:host-context([dir=rtl]) iron-icon[icon='cr:chevron-right'] {
@@ -116,8 +34,8 @@
iron-icon[icon='cr:chevron-right'] {
height: 1.25rem;
- margin-inline-end: -0.625rem;
- margin-inline-start: 0.375rem;
+ margin-inline-end: -.625rem;
+ margin-inline-start: .375rem;
width: 1.25rem;
}
</style>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/module_metrics_proxy.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/module_metrics_proxy.js
index 4b20e0190b1..159a1870be0 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/module_metrics_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/module_metrics_proxy.js
@@ -196,37 +196,6 @@ cr.define('nux', function() {
};
});
-// This is done outside |cr.define| because the closure compiler wants a fully
-// qualified name for |nux.ModuleMetricsProxyImpl|.
-nux.EmailMetricsProxyImpl = class extends nux.ModuleMetricsProxyImpl {
- constructor() {
- /**
- * NuxEmailProvidersInteractions enum.
- * These values are persisted to logs and should not be renumbered or
- * re-used.
- * See tools/metrics/histograms/enums.xml.
- * @enum {number}
- */
- const NuxEmailProvidersInteractions = {
- PageShown: 0,
- DidNothingAndNavigatedAway: 1,
- DidNothingAndChoseSkip: 2,
- ChoseAnOptionAndNavigatedAway: 3,
- ChoseAnOptionAndChoseSkip: 4,
- ChoseAnOptionAndChoseNext: 5,
- ClickedDisabledNextButtonAndNavigatedAway: 6,
- ClickedDisabledNextButtonAndChoseSkip: 7,
- ClickedDisabledNextButtonAndChoseNext: 8,
- DidNothingAndChoseNext: 9,
- NavigatedAwayThroughBrowserHistory: 10,
- };
-
- super(
- 'FirstRun.NewUserExperience.EmailProvidersInteraction',
- NuxEmailProvidersInteractions);
- }
-};
-
nux.GoogleAppsMetricsProxyImpl = class extends nux.ModuleMetricsProxyImpl {
constructor() {
/**
@@ -276,14 +245,19 @@ nux.NtpBackgroundMetricsProxyImpl = class extends nux.ModuleMetricsProxyImpl {
ChoseAnOptionAndChoseSkip: 5,
ChoseAnOptionAndChoseNext: 6,
NavigatedAwayThroughBrowserHistory: 7,
+ BackgroundImageFailedToLoad: 8,
+ BackgroundImageNeverLoaded: 9,
};
super(
'FirstRun.NewUserExperience.NtpBackgroundInteraction',
NuxNtpBackgroundInteractions);
}
+
+ getInteractions() {
+ return this.interactions_;
+ }
};
-cr.addSingletonGetter(nux.EmailMetricsProxyImpl);
cr.addSingletonGetter(nux.GoogleAppsMetricsProxyImpl);
cr.addSingletonGetter(nux.NtpBackgroundMetricsProxyImpl);
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/navi_colors_css.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/navi_colors_css.html
new file mode 100644
index 00000000000..66c0fd81df9
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/navi_colors_css.html
@@ -0,0 +1,53 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="chrome://resources/html/md_select_css.html">
+
+<dom-module id="navi-colors-css">
+ <template>
+ <style>
+ :host {
+ --navi-border-color: var(--google-grey-refresh-300);
+ --navi-check-icon-color: lightgrey;
+ --navi-keyboard-focus-color: rgba(var(--google-blue-600-rgb), .4);
+ --navi-option-box-shadow:
+ 0 1px 2px 0 rgba(var(--google-grey-800-rgb), .3),
+ 0 3px 6px 2px rgba(var(--google-grey-800-rgb), .15);
+ --navi-option-icon-shadow-color: var(--google-grey-refresh-100);
+ --navi-shape-blue-color: rgb(26, 115, 232); /* #1A73E8 */
+ --navi-shape-green-color: rgb(49, 167, 83); /* #31A753 */
+ --navi-shape-grey-color: rgb(241, 243, 244); /* #F1F3F4 */
+ --navi-shape-red-color: rgb(233, 66, 53); /* #E94235 */
+ --navi-shape-yellow-dots-color: rgb(253, 214, 99); /* #FDD663 */
+ --navi-shape-yellow-semicircle-color: rgb(250, 207, 76); /* #FACF4C */
+ --navi-step-indicator-active: {
+ background: var(--google-blue-600);
+ opacity: .5; /* Only in light mode */
+ };
+ --navi-step-indicator-color: var(--google-grey-200);
+ --navi-wallpaper-text-color: var(--google-grey-refresh-700);
+ }
+
+ :host-context([dark]) {
+ --navi-border-color: var(--google-grey-refresh-700);
+ --navi-check-icon-color: var(--google-grey-refresh-700);
+ --navi-keyboard-focus-color:
+ rgba(var(--google-blue-refresh-300-rgb), .5);
+ --navi-option-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .3),
+ 0 3px 6px 2px rgba(0, 0, 0, .15);
+ --navi-option-icon-shadow-color: var(--google-grey-refresh-700);
+ --navi-shape-blue-color: rgb(138, 180, 248); /* #8AB4F8 */
+ --navi-shape-green-color: rgb(129, 201, 149); /* #81C995 */
+ --navi-shape-grey-color: rgb(154, 160, 166); /* #9AA0A6 */
+ --navi-shape-red-color: rgb(238, 103, 92); /* #EE675C */
+ /* --navi-shape-yellow-dots-color is same color in dark mode */
+ --navi-shape-yellow-semicircle-color: rgb(253, 214, 99); /* #FDD663 */
+ --navi-step-indicator-active: {
+ background: var(--google-blue-refresh-300);
+ };
+ --navi-step-indicator-color: var(--google-grey-refresh-500);
+ --navi-wallpaper-text-color: var(--google-grey-200);
+ }
+ </style>
+ </template>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/nux_types.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/nux_types.js
index e429b900cf6..f0222776a8f 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/nux_types.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/nux_types.js
@@ -23,7 +23,7 @@ nux.BookmarkListItem;
nux.stepIndicatorModel;
/**
- * TODO(scottchen): somehow reuse from
+ * TODO(hcarmona): somehow reuse from
* chrome/browser/resources/settings/default_browser_page/default_browser_browser_proxy.js
* @typedef {{
* canBeDefault: boolean,
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/onboarding_background.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/onboarding_background.html
index 6df7693a29d..b77b5945646 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/onboarding_background.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/onboarding_background.html
@@ -80,47 +80,92 @@
}
#blue-circle-container::after {
+ -webkit-mask: url(../images/background_svgs/blue_circle.svg) no-repeat
+ top left;
animation: blue-circle-anim-y 9s cubic-bezier(0.25, 0, 0.2, 1) infinite;
- content: url(../images/background_svgs/blue_circle.svg);
+ background-color: var(--navi-shape-blue-color);
+ content: ' '; /* Content needs to be non-empty */
+ height: 43px;
position: absolute;
+ width: 43px;
}
#yellow-dots {
+ -webkit-mask: url(../images/background_svgs/yellow_dots.svg) no-repeat
+ top left;
+ background-color: var(--navi-shape-yellow-dots-color);
+ content: ' '; /* Content needs to be non-empty */
+ height: 57px;
left: 13%;
top: 18%;
+ width: 76px;
}
#grey-rounded-rectangle {
+ -webkit-mask: url(../images/background_svgs/grey_rounded_rectangle.svg)
+ no-repeat top left;
animation: grey-rounded-rectangle-anim 10s cubic-bezier(0.4, 0, 0.2, 1)
infinite;
+ background-color: var(--navi-shape-grey-color);
+ content: ' '; /* Content needs to be non-empty */
+ height: 132px;
left: -42px;
top: 45%;
+ width: 132px;
}
#red-triangle {
+ -webkit-mask: url(../images/background_svgs/red_triangle.svg) no-repeat
+ bottom left;
animation: red-triangle-anim 9.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
+ background-color: var(--navi-shape-red-color);
bottom: 15%;
+ content: ' '; /* Content needs to be non-empty */
+ height: 74px;
left: 12%;
+ width: 65px;
}
#yellow-semicircle {
+ -webkit-mask: url(../images/background_svgs/yellow_semicircle.svg)
+ no-repeat top right;
animation: yellow-semicircle-anim 10s cubic-bezier(0.4, 0, 0.2, 1)
infinite;
+ background-color: var(--navi-shape-yellow-semicircle-color);
+ content: ' '; /* Content needs to be non-empty */
+ height: 171px;
right: 28.5%;
top: -50px;
transform: rotate(-7deg);
+ width: 211px;
}
#green-rectangle {
+ -webkit-mask: url(../images/background_svgs/green_rectangle.svg)
+ no-repeat bottom right;
animation: green-rectangle-anim 40s infinite linear;
+ background-color: var(--navi-shape-green-color);
bottom: 8%;
+ content: ' '; /* Content needs to be non-empty */
+ height: 371px;
right: -255px;
+ width: 371px;
}
#grey-oval {
+ -webkit-mask: url(../images/background_svgs/grey_oval.svg) no-repeat
+ bottom right;
+ background-color: var(--navi-shape-grey-color);
bottom: calc(8% + 24px); /* Relative to green-rectangle. */
+ content: ' '; /* Content needs to be non-empty */
+ height: 100px;
mix-blend-mode: multiply;
right: 48px;
+ width: 100px;
+ }
+
+ :host-context([dark]) #grey-oval {
+ mix-blend-mode: screen;
}
</style>
<div id="container">
@@ -128,17 +173,12 @@
the blue-circle svg, because the animation needs to curve so x and y
needs to be animated separately. -->
<span id="blue-circle-container"></span>
- <img id="green-rectangle" alt=""
- src="../images/background_svgs/green_rectangle.svg">
- <img id="grey-oval" alt="" src="../images/background_svgs/grey_oval.svg">
- <img id="grey-rounded-rectangle" alt=""
- src="../images/background_svgs/grey_rounded_rectangle.svg">
- <img id="red-triangle" alt=""
- src="../images/background_svgs/red_triangle.svg">
- <img id="yellow-dots" alt=""
- src="../images/background_svgs/yellow_dots.svg">
- <img id="yellow-semicircle" alt=""
- src="../images/background_svgs/yellow_semicircle.svg">
+ <span id="green-rectangle"></span>
+ <span id="grey-oval"></span>
+ <span id="grey-rounded-rectangle"></span>
+ <span id="red-triangle"></span>
+ <span id="yellow-dots"></span>
+ <span id="yellow-semicircle"></span>
</div>
</template>
<script src="onboarding_background.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/splash_pages_shared_css.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/splash_pages_shared_css.html
index c23baac6e64..d213efc69e8 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/splash_pages_shared_css.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/splash_pages_shared_css.html
@@ -1,21 +1,24 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="navi_colors_css.html">
<dom-module id="splash-pages-shared-css">
<template>
- <style>
+ <style include="navi-colors-css">
#container {
align-items: center;
display: flex;
flex-direction: column;
- height: 100%;
justify-content: center;
margin: auto;
+ min-height: 100%;
min-width: 800px;
+ position: relative;
}
h1 {
+ color: var(--cr-primary-text-color);
font-size: 4rem;
margin-bottom: 40px;
margin-top: 16px;
@@ -23,7 +26,7 @@
}
h2 {
- color: var(--google-grey-600);
+ color: var(--cr-secondary-text-color);
font-size: 1.5rem;
font-weight: 500;
line-height: 2.25rem;
@@ -49,4 +52,4 @@
}
</style>
</template>
-</dom-module> \ No newline at end of file
+</dom-module>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/step_indicator.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/step_indicator.html
index 22cf1147f3c..4ee644b06a9 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/step_indicator.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/shared/step_indicator.html
@@ -1,17 +1,18 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
+<link rel="import" href="navi_colors_css.html">
<dom-module id="step-indicator">
<template>
- <style>
+ <style include="navi-colors-css">
:host {
align-items: center;
display: flex;
}
span {
- background: var(--google-grey-200);
+ background: var(--navi-step-indicator-color);
border-radius: 50%;
display: inline-block;
height: 8px;
@@ -20,8 +21,7 @@
}
span.active {
- background: var(--google-blue-600);
- opacity: 0.5;
+ @apply --navi-step-indicator-active;
}
</style>
<template is="dom-repeat" items="[[dots_]]">
@@ -29,4 +29,4 @@
</template>
</template>
<script src="step_indicator.js"></script>
-</dom-module> \ No newline at end of file
+</dom-module>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.html
index 5b6f232a9f9..42e83873004 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.html
@@ -3,9 +3,9 @@
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
-<link rel="import" href="email/email_app_proxy.html">
<link rel="import" href="navigation_behavior.html">
<link rel="import" href="shared/action_link_style_css.html">
+<link rel="import" href="shared/animations_css.html">
<link rel="import" href="shared/i18n_setup.html">
<link rel="import" href="shared/onboarding_background.html">
<link rel="import" href="shared/splash_pages_shared_css.html">
@@ -15,13 +15,18 @@
<dom-module id="signin-view">
<template>
<style
- include="paper-button-style action-link-style splash-pages-shared-css">
+ include="animations paper-button-style action-link-style
+ splash-pages-shared-css">
+ onboarding-background {
+ --animation-delay: 150ms;
+ }
+
h1 {
outline: none;
}
</style>
- <onboarding-background></onboarding-background>
<div id="container">
+ <onboarding-background class="fade-in"></onboarding-background>
<h2>$i18n{signInSubHeader}</h2>
<h1 tabindex="-1">$i18n{signInHeader}</h1>
<paper-button class="action-button" on-click="onSignInClick_">
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.js
index e875ef76179..6d8532f640f 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/signin_view.js
@@ -8,10 +8,6 @@ Polymer({
behaviors: [welcome.NavigationBehavior],
/** @private {boolean} */
- shouldShowEmailInterstitial_:
- loadTimeData.getBoolean('showEmailInterstitial'),
-
- /** @private {boolean} */
finalized_: false,
/** @private {?welcome.WelcomeBrowserProxy} */
@@ -48,38 +44,17 @@ Polymer({
this.signinViewProxy_.recordNavigatedAway();
},
- /**
- * @return {?string}
- * @private
- */
- getTargetUrl_: function() {
- const savedProvider =
- nux.EmailAppProxyImpl.getInstance().getSavedProvider();
- if (savedProvider != undefined && this.shouldShowEmailInterstitial_) {
- return `chrome://welcome/email-interstitial?provider=${savedProvider}`;
- } else {
- return null;
- }
- },
-
- /**
- * When the user clicks sign-in, check whether or not they previously
- * selected an email provider they prefer to use. If so, direct them back to
- * the email-interstitial page, otherwise let it direct to NTP.
- * @private
- */
+ /** private */
onSignInClick_: function() {
this.finalized_ = true;
this.signinViewProxy_.recordSignIn();
- this.welcomeBrowserProxy_.handleActivateSignIn(this.getTargetUrl_());
+ this.welcomeBrowserProxy_.handleActivateSignIn(null);
},
/** @private */
onNoThanksClick_: function() {
this.finalized_ = true;
this.signinViewProxy_.recordSkip();
- // It's safe to assume sign-view is always going to be the last step, so
- // go to the target url directly. If there's no target, it lands on NTP.
- this.welcomeBrowserProxy_.handleUserDecline(this.getTargetUrl_());
+ this.welcomeBrowserProxy_.handleUserDecline();
}
});
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome.html
index 165ac0a3efb..d4bb3e8b950 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome.html
@@ -1,14 +1,21 @@
<!doctype html>
-<html dir="$i18n{textdirection}" lang="$i18n{language}">
+<html dir="$i18n{textdirection}" lang="$i18n{language}" $i18n{dark}>
<head>
<meta charset="utf-8">
<title>$i18n{headerText}</title>
<link rel="import" href="welcome_app.html">
+ <link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
- <link rel="stylesheet" href="chrome://welcome/welcome.css">
</head>
<body>
+ <style>
+ html[dark] {
+ background: var(--md-background-color);
+ }
+ </style>
<welcome-app></welcome-app>
<script src="/welcome.js"></script>
+ <link rel="import" href="chrome://resources/html/dark_mode.html">
+ <link rel="stylesheet" href="chrome://welcome/welcome.css">
</body>
</html>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.html b/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.html
index 5aeb85d4c95..cda34d44f91 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.html
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.html
@@ -1,11 +1,10 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/cr_elements/cr_toast/cr_toast.html">
<link rel="import" href="chrome://resources/cr_elements/cr_view_manager/cr_view_manager.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
-<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/promise_resolver.html">
<link rel="import" href="google_apps/nux_google_apps.html">
-<link rel="import" href="email/nux_email.html">
<link rel="import" href="landing_view.html">
<link rel="import" href="navigation_behavior.html">
<link rel="import" href="ntp_background/nux_ntp_background.html">
@@ -25,8 +24,8 @@
min-height: 100vh;
}
- #viewManager :-webkit-any(nux-email,
- nux-google-apps, nux-ntp-background, nux-set-as-default) {
+ #viewManager :-webkit-any(nux-google-apps, nux-ntp-background,
+ nux-set-as-default) {
/* Override cr-view-manager's default styling for view. */
bottom: initial;
left: initial;
@@ -35,10 +34,17 @@
right: initial;
top: initial;
}
+
+ cr-toast {
+ min-width: initial;
+ }
</style>
<cr-view-manager id="viewManager" hidden="[[!modulesInitialized_]]">
<landing-view id="step-landing" slot="view" class="active"></landing-view>
</cr-view-manager>
+ <cr-toast duration="3000">
+ <div>$i18n{defaultBrowserChanged}</div>
+ </cr-toast>
</template>
<script src="welcome_app.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.js
index 1445968d134..dc1a8e97a5e 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.js
@@ -17,8 +17,7 @@ let NuxOnboardingModules;
* @const {!Set<string>}
*/
const MODULES_WHITELIST = new Set([
- 'nux-email', 'nux-google-apps', 'nux-ntp-background', 'nux-set-as-default',
- 'signin-view'
+ 'nux-google-apps', 'nux-ntp-background', 'nux-set-as-default', 'signin-view'
]);
/**
@@ -26,9 +25,8 @@ const MODULES_WHITELIST = new Set([
* added.
* @const {!Set<string>}
*/
-const MODULES_NEEDING_INDICATOR = new Set([
- 'nux-email', 'nux-google-apps', 'nux-ntp-background', 'nux-set-as-default'
-]);
+const MODULES_NEEDING_INDICATOR =
+ new Set(['nux-google-apps', 'nux-ntp-background', 'nux-set-as-default']);
Polymer({
is: 'welcome-app',
@@ -38,9 +36,6 @@ Polymer({
/** @private {?welcome.Routes} */
currentRoute_: null,
- /** @private {?PromiseResolver} */
- defaultCheckPromise_: null,
-
/** @private {NuxOnboardingModules} */
modules_: {
'new-user': loadTimeData.getString('newUserModules').split(','),
@@ -56,28 +51,13 @@ Polymer({
},
},
- /** @override */
- ready: function() {
- this.defaultCheckPromise_ = new PromiseResolver();
-
- /** @param {!nux.DefaultBrowserInfo} status */
- const defaultCheckCallback = status => {
- if (status.isDefault || !status.canBeDefault) {
- this.defaultCheckPromise_.resolve(false);
- } else if (!status.isDisabledByPolicy && !status.isUnknownError) {
- this.defaultCheckPromise_.resolve(true);
- } else { // Unknown error.
- this.defaultCheckPromise_.resolve(false);
- }
-
- cr.removeWebUIListener(defaultCheckCallback);
- };
-
- cr.addWebUIListener('browser-default-state-changed', defaultCheckCallback);
+ listeners: {
+ 'default-browser-change': 'onDefaultBrowserChange_',
+ },
- // TODO(scottchen): convert the request to cr.sendWithPromise
- // (see https://crbug.com/874520#c6).
- nux.NuxSetAsDefaultProxyImpl.getInstance().requestDefaultBrowserState();
+ /** @private */
+ onDefaultBrowserChange_: function() {
+ this.$$('cr-toast').show();
},
/**
@@ -125,25 +105,37 @@ Polymer({
let modules = this.modules_[route];
assert(modules); // Modules should be defined if on a valid route.
+ /** @type {!Promise} */
+ const defaultBrowserPromise =
+ nux.NuxSetAsDefaultProxyImpl.getInstance()
+ .requestDefaultBrowserState()
+ .then((status) => {
+ if (status.isDefault || !status.canBeDefault) {
+ return false;
+ } else if (!status.isDisabledByPolicy && !status.isUnknownError) {
+ return true;
+ } else { // Unknown error.
+ return false;
+ }
+ });
+
// Wait until the default-browser state and bookmark visibility are known
// before anything initializes.
return Promise
.all([
- this.defaultCheckPromise_.promise,
+ defaultBrowserPromise,
nux.BookmarkBarManager.getInstance().initialized,
])
- .then(args => {
- const canSetDefault = args[0];
-
+ .then(([canSetDefault]) => {
modules = modules.filter(module => {
if (module == 'nux-set-as-default') {
return canSetDefault;
}
- if (module == 'nux-email') {
- // Show email module in en-US only until email recommendations
- // for other locales is figured out.
- return navigator.language == 'en-US';
+ if (!MODULES_WHITELIST.has(module)) {
+ // Makes sure the module specified by the feature configuration is
+ // whitelisted.
+ return false;
}
return true;
@@ -155,10 +147,6 @@ Polymer({
let indicatorActiveCount = 0;
modules.forEach((elementTagName, index) => {
- // Makes sure the module specified by the feature configuration is
- // whitelisted.
- assert(MODULES_WHITELIST.has(elementTagName));
-
const element = document.createElement(elementTagName);
element.id = 'step-' + (index + 1);
element.setAttribute('slot', 'view');
diff --git a/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_browser_proxy.js b/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_browser_proxy.js
index f08e9522144..8e97cb96c28 100644
--- a/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_browser_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/onboarding_welcome/welcome_browser_proxy.js
@@ -14,11 +14,7 @@ cr.define('welcome', function() {
/** @param {?string} redirectUrl the URL to go to, after signing in. */
handleActivateSignIn(redirectUrl) {}
- /**
- * @param {?string} redirectUrl the URL to go to after backend records the
- * user declining signin.
- */
- handleUserDecline(redirectUrl) {}
+ handleUserDecline() {}
/** @param {boolean=} replace */
goToNewTabPage(replace) {}
@@ -35,8 +31,8 @@ cr.define('welcome', function() {
}
/** @override */
- handleUserDecline(redirectUrl) {
- chrome.send('handleUserDecline', redirectUrl ? [redirectUrl] : []);
+ handleUserDecline() {
+ chrome.send('handleUserDecline');
}
/** @override */
diff --git a/chromium/chrome/browser/safe_browsing/BUILD.gn b/chromium/chrome/browser/safe_browsing/BUILD.gn
index 6da85c0a41e..b7a963c2cab 100644
--- a/chromium/chrome/browser/safe_browsing/BUILD.gn
+++ b/chromium/chrome/browser/safe_browsing/BUILD.gn
@@ -267,6 +267,16 @@ jumbo_static_library("safe_browsing") {
"telemetry/android/android_telemetry_service.h",
]
deps += [ "//components/safe_browsing/android:safe_browsing_mobile" ]
+ } else if (safe_browsing_mode == 3) {
+ sources += [
+ "../loader/safe_browsing_resource_throttle.cc",
+ "../loader/safe_browsing_resource_throttle.h",
+ "android/services_delegate_android.cc",
+ "android/services_delegate_android.h",
+ "telemetry/android/android_telemetry_service.cc",
+ "telemetry/android/android_telemetry_service.h",
+ ]
+ deps += [ "//components/safe_browsing/db:db" ]
}
}
}
@@ -302,7 +312,6 @@ source_set("test_support") {
"//chrome/common/safe_browsing:proto",
"//components/safe_browsing/db:database_manager",
"//components/safe_browsing/db:test_database_manager",
- "//components/safe_browsing/db:v4_feature_list",
"//components/safe_browsing/db:v4_protocol_manager_util",
"//content/public/browser:browser",
]
diff --git a/chromium/chrome/browser/security_events/BUILD.gn b/chromium/chrome/browser/security_events/BUILD.gn
deleted file mode 100644
index 924a1db97ce..00000000000
--- a/chromium/chrome/browser/security_events/BUILD.gn
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-static_library("security_events") {
- sources = [
- "security_event_recorder.h",
- "security_event_recorder_impl.cc",
- "security_event_recorder_impl.h",
- "security_event_sync_bridge.h",
- "security_event_sync_bridge_impl.cc",
- "security_event_sync_bridge_impl.h",
- ]
-
- deps = [
- "//components/keyed_service/core",
- "//components/sync",
- ]
-}
diff --git a/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc b/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc
index 809fd015e9e..0832417a9ff 100644
--- a/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc
+++ b/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc
@@ -77,7 +77,7 @@ void SpellCheckHostChromeImpl::CallSpellingService(
}
// Checks the user profile and sends a JSON-RPC request to the Spelling
- // service if a user enables the "Ask Google for suggestions" option. When
+ // service if a user enables the "Use enhanced spell check" option. When
// a response is received (including an error) from the remote Spelling
// service, calls CallSpellingServiceDone.
content::BrowserContext* context =
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
index 7be4a9191fd..5f9e87ac386 100644
--- a/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
+++ b/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
@@ -14,7 +14,7 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/files/important_file_writer.h"
-#include "base/md5.h"
+#include "base/hash/md5.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -297,6 +297,14 @@ void SpellcheckCustomDictionary::Load() {
weak_ptr_factory_.GetWeakPtr()));
}
+void SpellcheckCustomDictionary::WaitUntilReadyToSync(base::OnceClosure done) {
+ DCHECK(!wait_until_ready_to_sync_cb_);
+ if (is_loaded_)
+ std::move(done).Run();
+ else
+ wait_until_ready_to_sync_cb_ = std::move(done);
+}
+
syncer::SyncMergeResult SpellcheckCustomDictionary::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -436,6 +444,8 @@ void SpellcheckCustomDictionary::OnLoaded(
Apply(dictionary_change);
Sync(dictionary_change);
is_loaded_ = true;
+ if (wait_until_ready_to_sync_cb_)
+ std::move(wait_until_ready_to_sync_cb_).Run();
for (Observer& observer : observers_)
observer.OnCustomDictionaryLoaded();
if (!result->is_valid_file) {
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.h b/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
index 24cb54df2a1..e3ba992c9f1 100644
--- a/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
+++ b/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
@@ -147,6 +147,7 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary,
void Load() override;
// Overridden from syncer::SyncableService:
+ void WaitUntilReadyToSync(base::OnceClosure done) override;
syncer::SyncMergeResult MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -219,6 +220,8 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary,
// True if the dictionary has been loaded. Otherwise false.
bool is_loaded_;
+ base::OnceClosure wait_until_ready_to_sync_cb_;
+
// A post-startup task to fix the invalid custom dictionary file.
base::CancelableOnceClosure fix_invalid_file_;
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_factory.cc b/chromium/chrome/browser/spellchecker/spellcheck_factory.cc
index a982b2ee75a..8f070a23c6d 100644
--- a/chromium/chrome/browser/spellchecker/spellcheck_factory.cc
+++ b/chromium/chrome/browser/spellchecker/spellcheck_factory.cc
@@ -70,6 +70,8 @@ void SpellcheckServiceFactory::RegisterProfilePrefs(
user_prefs->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries);
user_prefs->RegisterListPref(
spellcheck::prefs::kSpellCheckForcedDictionaries);
+ user_prefs->RegisterListPref(
+ spellcheck::prefs::kSpellCheckBlacklistedDictionaries);
// Continue registering kSpellCheckDictionary for preference migration.
// TODO(estade): remove: crbug.com/751275
user_prefs->RegisterStringPref(
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc b/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc
new file mode 100644
index 00000000000..3c08eeab629
--- /dev/null
+++ b/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc
@@ -0,0 +1,134 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.h"
+
+#include <unordered_set>
+#include <utility>
+#include <vector>
+
+#include "base/strings/string_util.h"
+#include "base/syslog_logging.h"
+#include "base/values.h"
+#include "build/build_config.h"
+#include "chrome/common/pref_names.h"
+#include "components/policy/core/browser/policy_error_map.h"
+#include "components/policy/policy_constants.h"
+#include "components/prefs/pref_value_map.h"
+#include "components/spellcheck/browser/pref_names.h"
+#include "components/spellcheck/common/spellcheck_common.h"
+#include "components/strings/grit/components_strings.h"
+
+SpellcheckLanguageBlacklistPolicyHandler::
+ SpellcheckLanguageBlacklistPolicyHandler()
+ : TypeCheckingPolicyHandler(policy::key::kSpellcheckLanguageBlacklist,
+ base::Value::Type::LIST) {}
+
+SpellcheckLanguageBlacklistPolicyHandler::
+ ~SpellcheckLanguageBlacklistPolicyHandler() = default;
+
+bool SpellcheckLanguageBlacklistPolicyHandler::CheckPolicySettings(
+ const policy::PolicyMap& policies,
+ policy::PolicyErrorMap* errors) {
+ const base::Value* value = nullptr;
+ bool ok = CheckAndGetValue(policies, errors, &value);
+
+ std::vector<base::Value> blacklisted;
+ std::vector<std::string> unknown;
+ std::vector<std::string> duplicates;
+ SortBlacklistedLanguages(policies, &blacklisted, &unknown, &duplicates);
+
+#if !defined(OS_MACOSX)
+ for (const std::string language : duplicates) {
+ errors->AddError(policy_name(), IDS_POLICY_SPELLCHECK_BLACKLIST_IGNORE,
+ language);
+ }
+
+ for (const std::string language : unknown) {
+ errors->AddError(policy_name(), IDS_POLICY_SPELLCHECK_UNKNOWN_LANGUAGE,
+ language);
+ }
+#endif
+
+ return ok;
+}
+
+void SpellcheckLanguageBlacklistPolicyHandler::ApplyPolicySettings(
+ const policy::PolicyMap& policies,
+ PrefValueMap* prefs) {
+ // Ignore this policy if the SpellcheckEnabled policy disables spellcheck.
+ const base::Value* spellcheck_enabled_value =
+ policies.GetValue(policy::key::kSpellcheckEnabled);
+ if (spellcheck_enabled_value && spellcheck_enabled_value->GetBool() == false)
+ return;
+
+ // If this policy isn't set, don't modify spellcheck languages.
+ const base::Value* value = policies.GetValue(policy_name());
+ if (!value)
+ return;
+
+ // Set the blacklisted dictionaries preference based on this policy's values,
+ // and emit warnings for unknown or duplicate languages.
+ std::vector<base::Value> blacklisted;
+ std::vector<std::string> unknown;
+ std::vector<std::string> duplicates;
+ SortBlacklistedLanguages(policies, &blacklisted, &unknown, &duplicates);
+
+ for (const std::string language : duplicates) {
+ SYSLOG(WARNING)
+ << "SpellcheckLanguageBlacklist policy: an entry was also found in"
+ " the SpellcheckLanguage policy: \""
+ << language << "\". Blacklist entry will be ignored.";
+ }
+
+ for (const std::string language : unknown) {
+ SYSLOG(WARNING) << "SpellcheckLanguageBlacklist policy: Unknown or "
+ "unsupported language \""
+ << language << "\"";
+ }
+
+ prefs->SetValue(spellcheck::prefs::kSpellCheckBlacklistedDictionaries,
+ base::Value(std::move(blacklisted)));
+}
+
+void SpellcheckLanguageBlacklistPolicyHandler::SortBlacklistedLanguages(
+ const policy::PolicyMap& policies,
+ std::vector<base::Value>* const blacklisted,
+ std::vector<std::string>* const unknown,
+ std::vector<std::string>* const duplicates) {
+ const base::Value* value = policies.GetValue(policy_name());
+ if (!value)
+ return;
+
+ // Build a lookup of force-enabled spellcheck languages to find duplicates.
+ const base::Value* forced_enabled_value =
+ policies.GetValue(policy::key::kSpellcheckLanguage);
+ std::unordered_set<std::string> forced_languages_lookup;
+ if (forced_enabled_value) {
+ for (const auto& forced_language : forced_enabled_value->GetList())
+ forced_languages_lookup.insert(forced_language.GetString());
+ }
+
+ // Separate the valid languages from the unknown / unsupported languages and
+ // the languages that also appear in the SpellcheckLanguage policy.
+ const base::Value::ListStorage& blacklisted_languages = value->GetList();
+ for (const base::Value& language : blacklisted_languages) {
+ std::string current_language =
+ spellcheck::GetCorrespondingSpellCheckLanguage(
+ base::TrimWhitespaceASCII(language.GetString(), base::TRIM_ALL));
+
+ if (current_language.empty()) {
+ unknown->emplace_back(language.GetString());
+ } else {
+ if (forced_languages_lookup.find(language.GetString()) !=
+ forced_languages_lookup.end()) {
+ // If a language is both force-enabled and force-disabled, force-enable
+ // wins. Put the language in the list of duplicates.
+ duplicates->emplace_back(std::move(current_language));
+ } else {
+ blacklisted->emplace_back(std::move(current_language));
+ }
+ }
+ }
+}
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.h b/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.h
new file mode 100644
index 00000000000..ae8a4958fa3
--- /dev/null
+++ b/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.h
@@ -0,0 +1,34 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_LANGUAGE_BLACKLIST_POLICY_HANDLER_H_
+#define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_LANGUAGE_BLACKLIST_POLICY_HANDLER_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "components/policy/core/browser/configuration_policy_handler.h"
+
+// ConfigurationPolicyHandler for the SpellcheckLanguageBlacklist policy.
+class SpellcheckLanguageBlacklistPolicyHandler
+ : public policy::TypeCheckingPolicyHandler {
+ public:
+ SpellcheckLanguageBlacklistPolicyHandler();
+ ~SpellcheckLanguageBlacklistPolicyHandler() override;
+
+ // ConfigurationPolicyHandler:
+ bool CheckPolicySettings(const policy::PolicyMap& policies,
+ policy::PolicyErrorMap* errors) override;
+ void ApplyPolicySettings(const policy::PolicyMap& policies,
+ PrefValueMap* prefs) override;
+
+ private:
+ void SortBlacklistedLanguages(const policy::PolicyMap& policies,
+ std::vector<base::Value>* const blacklisted,
+ std::vector<std::string>* const unknown,
+ std::vector<std::string>* const duplicates);
+ DISALLOW_COPY_AND_ASSIGN(SpellcheckLanguageBlacklistPolicyHandler);
+};
+
+#endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_LANGUAGE_BLACKLIST_POLICY_HANDLER_H_
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc b/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc
index 7760642665c..c451930d32d 100644
--- a/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc
+++ b/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc
@@ -4,14 +4,20 @@
#include "chrome/browser/spellchecker/spellcheck_language_policy_handler.h"
-#include "base/strings/string_split.h"
+#include <utility>
+#include <vector>
+
#include "base/strings/string_util.h"
+#include "base/syslog_logging.h"
#include "base/values.h"
+#include "build/build_config.h"
#include "chrome/common/pref_names.h"
+#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_value_map.h"
#include "components/spellcheck/browser/pref_names.h"
#include "components/spellcheck/common/spellcheck_common.h"
+#include "components/strings/grit/components_strings.h"
SpellcheckLanguagePolicyHandler::SpellcheckLanguagePolicyHandler()
: TypeCheckingPolicyHandler(policy::key::kSpellcheckLanguage,
@@ -23,7 +29,20 @@ bool SpellcheckLanguagePolicyHandler::CheckPolicySettings(
const policy::PolicyMap& policies,
policy::PolicyErrorMap* errors) {
const base::Value* value = nullptr;
- return CheckAndGetValue(policies, errors, &value);
+ bool ok = CheckAndGetValue(policies, errors, &value);
+
+ std::vector<base::Value> forced;
+ std::vector<std::string> unknown;
+ SortForcedLanguages(policies, &forced, &unknown);
+
+#if !defined(OS_MACOSX)
+ for (const auto& language : unknown) {
+ errors->AddError(policy_name(), IDS_POLICY_SPELLCHECK_UNKNOWN_LANGUAGE,
+ language);
+ }
+#endif
+
+ return ok;
}
void SpellcheckLanguagePolicyHandler::ApplyPolicySettings(
@@ -35,25 +54,47 @@ void SpellcheckLanguagePolicyHandler::ApplyPolicySettings(
if (spellcheck_enabled_value && spellcheck_enabled_value->GetBool() == false)
return;
+ // If this policy isn't set, don't modify spellcheck languages.
const base::Value* value = policies.GetValue(policy_name());
if (!value)
return;
- const base::Value::ListStorage& languages = value->GetList();
+ // Set the forced dictionaries preference based on this policy's values,
+ // and emit warnings for unknown languages.
+ std::vector<base::Value> forced;
+ std::vector<std::string> unknown;
+ SortForcedLanguages(policies, &forced, &unknown);
+
+ for (const auto& language : unknown) {
+ SYSLOG(WARNING)
+ << "SpellcheckLanguage policy: Unknown or unsupported language \""
+ << language << "\"";
+ }
+
+ prefs->SetValue(spellcheck::prefs::kSpellCheckEnable, base::Value(true));
+ prefs->SetValue(spellcheck::prefs::kSpellCheckForcedDictionaries,
+ base::Value(std::move(forced)));
+}
+
+void SpellcheckLanguagePolicyHandler::SortForcedLanguages(
+ const policy::PolicyMap& policies,
+ std::vector<base::Value>* const forced,
+ std::vector<std::string>* const unknown) {
+ const base::Value* value = policies.GetValue(policy_name());
+ if (!value)
+ return;
- std::vector<base::Value> forced_language_list;
- for (const base::Value& language : languages) {
+ // Separate the valid languages from the unknown / unsupported languages.
+ const base::Value::ListStorage& forced_languages = value->GetList();
+ for (const base::Value& language : forced_languages) {
std::string current_language =
spellcheck::GetCorrespondingSpellCheckLanguage(
base::TrimWhitespaceASCII(language.GetString(), base::TRIM_ALL));
- if (!current_language.empty()) {
- forced_language_list.emplace_back(std::move(current_language));
+
+ if (current_language.empty()) {
+ unknown->emplace_back(language.GetString());
} else {
- LOG(WARNING) << "Unknown language requested: \"" << language << "\"";
+ forced->emplace_back(std::move(current_language));
}
}
-
- prefs->SetValue(spellcheck::prefs::kSpellCheckEnable, base::Value(true));
- prefs->SetValue(spellcheck::prefs::kSpellCheckForcedDictionaries,
- base::Value(std::move(forced_language_list)));
}
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.h b/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.h
index 4967d571c31..85f7224baac 100644
--- a/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.h
+++ b/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_LANGUAGE_POLICY_HANDLER_H_
#define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_LANGUAGE_POLICY_HANDLER_H_
+#include <vector>
+
#include "base/macros.h"
#include "components/policy/core/browser/configuration_policy_handler.h"
@@ -22,6 +24,9 @@ class SpellcheckLanguagePolicyHandler
PrefValueMap* prefs) override;
private:
+ void SortForcedLanguages(const policy::PolicyMap& policies,
+ std::vector<base::Value>* const forced,
+ std::vector<std::string>* const unknown);
DISALLOW_COPY_AND_ASSIGN(SpellcheckLanguagePolicyHandler);
};
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_service.cc b/chromium/chrome/browser/spellchecker/spellcheck_service.cc
index d92b0191155..0e200c58a16 100644
--- a/chromium/chrome/browser/spellchecker/spellcheck_service.cc
+++ b/chromium/chrome/browser/spellchecker/spellcheck_service.cc
@@ -98,6 +98,10 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context)
base::BindRepeating(&SpellcheckService::OnSpellCheckDictionariesChanged,
base::Unretained(this)));
pref_change_registrar_.Add(
+ spellcheck::prefs::kSpellCheckBlacklistedDictionaries,
+ base::BindRepeating(&SpellcheckService::OnSpellCheckDictionariesChanged,
+ base::Unretained(this)));
+ pref_change_registrar_.Add(
spellcheck::prefs::kSpellCheckUseSpellingService,
base::BindRepeating(&SpellcheckService::OnUseSpellingServiceChanged,
base::Unretained(this)));
@@ -235,12 +239,24 @@ void SpellcheckService::LoadHunspellDictionaries() {
const base::ListValue* forced_dictionaries =
prefs->GetList(spellcheck::prefs::kSpellCheckForcedDictionaries);
+ // Build a lookup of blacklisted dictionaries to skip loading them.
+ const base::ListValue* blacklisted_dictionaries =
+ prefs->GetList(spellcheck::prefs::kSpellCheckBlacklistedDictionaries);
+ std::unordered_set<std::string> blacklisted_dictionaries_lookup;
+ for (const auto& blacklisted_dict : blacklisted_dictionaries->GetList()) {
+ blacklisted_dictionaries_lookup.insert(blacklisted_dict.GetString());
+ }
+
// Merge both lists of dictionaries. Use a set to avoid duplicates.
std::set<std::string> dictionaries;
- for (const auto& dictionary_value : user_dictionaries->GetList())
- dictionaries.insert(dictionary_value.GetString());
- for (const auto& dictionary_value : forced_dictionaries->GetList())
+ for (const auto& dictionary_value : user_dictionaries->GetList()) {
+ if (blacklisted_dictionaries_lookup.find(dictionary_value.GetString()) ==
+ blacklisted_dictionaries_lookup.end())
+ dictionaries.insert(dictionary_value.GetString());
+ }
+ for (const auto& dictionary_value : forced_dictionaries->GetList()) {
dictionaries.insert(dictionary_value.GetString());
+ }
for (const auto& dictionary : dictionaries) {
hunspell_dictionaries_.push_back(
diff --git a/chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc b/chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc
index f36f7d66a38..6c0a57d3cce 100644
--- a/chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc
+++ b/chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc
@@ -16,14 +16,17 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind_test_util.h"
+#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "chrome/test/base/testing_profile.h"
#include "components/prefs/pref_service.h"
#include "components/spellcheck/browser/pref_names.h"
+#include "components/spellcheck/common/spellcheck_features.h"
#include "components/spellcheck/common/spellcheck_result.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "net/base/load_flags.h"
#include "net/http/http_util.h"
+#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
@@ -32,7 +35,17 @@
namespace {
-const char kSpellingServiceURL[] = "https://www.googleapis.com/rpc";
+struct SpellingServiceTestCase {
+ const wchar_t* request_text;
+ std::string sanitized_request_text;
+ SpellingServiceClient::ServiceType request_type;
+ net::HttpStatusCode response_status;
+ std::string response_data;
+ bool success;
+ const char* corrected_text;
+ std::string language;
+ bool restEndpoint;
+};
// A class derived from the SpellingServiceClient class used by the
// SpellingServiceClientTest class. This class sets the URLLoaderFactory so
@@ -87,7 +100,8 @@ class TestingSpellingServiceClient : public SpellingServiceClient {
// A test class used for testing the SpellingServiceClient class. This class
// implements a callback function used by the SpellingServiceClient class to
// monitor the class calls the callback with expected results.
-class SpellingServiceClientTest : public testing::Test {
+class SpellingServiceClientTest
+ : public testing::TestWithParam<SpellingServiceTestCase> {
public:
void OnTextCheckComplete(int tag,
bool success,
@@ -116,6 +130,7 @@ class SpellingServiceClientTest : public testing::Test {
content::TestBrowserThreadBundle thread_bundle_;
TestingSpellingServiceClient client_;
TestingProfile profile_;
+ base::test::ScopedFeatureList scoped_feature_list_;
};
} // namespace
@@ -123,7 +138,7 @@ class SpellingServiceClientTest : public testing::Test {
// Verifies that SpellingServiceClient::RequestTextCheck() creates a JSON
// request sent to the Spelling service as we expect. This test also verifies
// that it parses a JSON response from the service and calls the callback
-// function. To avoid sending JSON-RPC requests to the service, this test uses a
+// function. To avoid sending real requests to the service, this test uses a
// subclass of SpellingServiceClient that in turn sets the client's URL loader
// factory to a TestURLLoaderFactory. The client thinks it is issuing real
// network requests, but in fact the responses are entirely under our control
@@ -132,164 +147,329 @@ class SpellingServiceClientTest : public testing::Test {
// misspelled words with ones suggested by the service so this test can compare
// the corrected text with the expected results. (If there are not any
// misspelled words, |corrected_text| should be equal to |request_text|.)
-TEST_F(SpellingServiceClientTest, RequestTextCheck) {
- static const struct {
- const wchar_t* request_text;
- std::string sanitized_request_text;
- SpellingServiceClient::ServiceType request_type;
- net::HttpStatusCode response_status;
- std::string response_data;
- bool success;
- const char* corrected_text;
- std::string language;
- } kTests[] = {
- {
- L"", "", SpellingServiceClient::SUGGEST, net::HttpStatusCode(500), "",
- false, "", "af",
- },
- {
- L"chromebook", "chromebook", SpellingServiceClient::SUGGEST,
- net::HttpStatusCode(200), "{}", true, "chromebook", "af",
- },
- {
- L"chrombook", "chrombook", SpellingServiceClient::SUGGEST,
- net::HttpStatusCode(200),
- "{\n"
- " \"result\": {\n"
- " \"spellingCheckResponse\": {\n"
- " \"misspellings\": [{\n"
- " \"charStart\": 0,\n"
- " \"charLength\": 9,\n"
- " \"suggestions\": [{ \"suggestion\": \"chromebook\" }],\n"
- " \"canAutoCorrect\": false\n"
- " }]\n"
- " }\n"
- " }\n"
- "}",
- true, "chromebook", "af",
- },
- {
- L"", "", SpellingServiceClient::SPELLCHECK, net::HttpStatusCode(500),
- "", false, "", "en",
- },
- {
- L"I have been to USA.", "I have been to USA.",
- SpellingServiceClient::SPELLCHECK, net::HttpStatusCode(200), "{}",
- true, "I have been to USA.", "en",
- },
- {
- L"I have bean to USA.", "I have bean to USA.",
- SpellingServiceClient::SPELLCHECK, net::HttpStatusCode(200),
- "{\n"
- " \"result\": {\n"
- " \"spellingCheckResponse\": {\n"
- " \"misspellings\": [{\n"
- " \"charStart\": 7,\n"
- " \"charLength\": 4,\n"
- " \"suggestions\": [{ \"suggestion\": \"been\" }],\n"
- " \"canAutoCorrect\": false\n"
- " }]\n"
- " }\n"
- " }\n"
- "}",
- true, "I have been to USA.", "en",
- },
- {
- L"I\x2019mattheIn'n'Out.", "I'mattheIn'n'Out.",
- SpellingServiceClient::SPELLCHECK, net::HttpStatusCode(200),
- "{\n"
- " \"result\": {\n"
- " \"spellingCheckResponse\": {\n"
- " \"misspellings\": [{\n"
- " \"charStart\": 0,\n"
- " \"charLength\": 16,\n"
- " \"suggestions\":"
- " [{ \"suggestion\": \"I'm at the In'N'Out\" }],\n"
- " \"canAutoCorrect\": false\n"
- " }]\n"
- " }\n"
- " }\n"
- "}",
- true, "I'm at the In'N'Out.", "en",
- },
- };
+using Redirects =
+ std::vector<std::pair<net::RedirectInfo, network::ResourceResponseHead>>;
+
+TEST_P(SpellingServiceClientTest, RequestTextCheck) {
+ auto test_case = GetParam();
+ bool is_rest = test_case.restEndpoint;
+
+ if (is_rest) {
+ scoped_feature_list_.InitAndEnableFeature(
+ spellcheck::kSpellingServiceRestApi);
+ }
PrefService* pref = profile_.GetPrefs();
pref->SetBoolean(spellcheck::prefs::kSpellCheckEnable, true);
pref->SetBoolean(spellcheck::prefs::kSpellCheckUseSpellingService, true);
- for (size_t i = 0; i < base::size(kTests); ++i) {
- client_.test_url_loader_factory()->ClearResponses();
- net::HttpStatusCode http_status = kTests[i].response_status;
- network::ResourceResponseHead head;
- std::string headers(base::StringPrintf(
- "HTTP/1.1 %d %s\nContent-type: application/json\n\n",
- static_cast<int>(http_status), net::GetHttpReasonPhrase(http_status)));
- head.headers = new net::HttpResponseHeaders(
- net::HttpUtil::AssembleRawHeaders(headers.c_str(), headers.size()));
- head.mime_type = "application/json";
- network::URLLoaderCompletionStatus status;
- status.decoded_body_length = kTests[i].response_data.size();
- client_.test_url_loader_factory()->AddResponse(
- GURL(kSpellingServiceURL), head, kTests[i].response_data, status);
- net::HttpRequestHeaders intercepted_headers;
- std::string intercepted_body;
- client_.test_url_loader_factory()->SetInterceptor(
- base::BindLambdaForTesting(
- [&](const network::ResourceRequest& request) {
- intercepted_headers = request.headers;
- intercepted_body = network::GetUploadData(request);
- }));
- client_.SetExpectedTextCheckResult(kTests[i].success,
- kTests[i].sanitized_request_text,
- kTests[i].corrected_text);
- base::ListValue dictionary;
- dictionary.AppendString(kTests[i].language);
- pref->Set(spellcheck::prefs::kSpellCheckDictionaries, dictionary);
-
- client_.RequestTextCheck(
- &profile_, kTests[i].request_type,
- base::WideToUTF16(kTests[i].request_text),
- base::BindOnce(&SpellingServiceClientTest::OnTextCheckComplete,
- base::Unretained(this), 0));
- thread_bundle_.RunUntilIdle();
-
- // Verify the request content type was JSON. (The Spelling service returns
- // an internal server error when this content type is not JSON.)
- std::string request_content_type;
- ASSERT_TRUE(intercepted_headers.GetHeader(
- net::HttpRequestHeaders::kContentType, &request_content_type));
- EXPECT_EQ("application/json", request_content_type);
-
- // Parse the JSON sent to the service, and verify its parameters.
- std::unique_ptr<base::DictionaryValue> value(
- static_cast<base::DictionaryValue*>(
- base::JSONReader::ReadDeprecated(intercepted_body,
- base::JSON_ALLOW_TRAILING_COMMAS)
- .release()));
- ASSERT_TRUE(value.get());
- std::string method;
+ client_.test_url_loader_factory()->ClearResponses();
+ net::HttpStatusCode http_status = test_case.response_status;
+
+ network::ResourceResponseHead head;
+ std::string headers(base::StringPrintf(
+ "HTTP/1.1 %d %s\nContent-type: application/json\n\n",
+ static_cast<int>(http_status), net::GetHttpReasonPhrase(http_status)));
+ head.headers = new net::HttpResponseHeaders(
+ net::HttpUtil::AssembleRawHeaders(headers.c_str(), headers.size()));
+ head.mime_type = "application/json";
+
+ network::URLLoaderCompletionStatus status;
+ status.decoded_body_length = test_case.response_data.size();
+ GURL expected_request_url = client_.BuildEndpointUrl(test_case.request_type);
+ client_.test_url_loader_factory()->AddResponse(
+ expected_request_url, head, test_case.response_data, status, Redirects(),
+ network::TestURLLoaderFactory::ResponseProduceFlags::
+ kSendHeadersOnNetworkError);
+
+ net::HttpRequestHeaders intercepted_headers;
+ std::string intercepted_body;
+ GURL requested_url;
+ client_.test_url_loader_factory()->SetInterceptor(
+ base::BindLambdaForTesting([&](const network::ResourceRequest& request) {
+ intercepted_headers = request.headers;
+ intercepted_body = network::GetUploadData(request);
+ requested_url = request.url;
+ }));
+ client_.SetExpectedTextCheckResult(test_case.success,
+ test_case.sanitized_request_text,
+ test_case.corrected_text);
+
+ base::ListValue dictionary;
+ dictionary.AppendString(test_case.language);
+ pref->Set(spellcheck::prefs::kSpellCheckDictionaries, dictionary);
+
+ client_.RequestTextCheck(
+ &profile_, test_case.request_type,
+ base::WideToUTF16(test_case.request_text),
+ base::BindOnce(&SpellingServiceClientTest::OnTextCheckComplete,
+ base::Unretained(this), 0));
+ thread_bundle_.RunUntilIdle();
+
+ // Verify that the expected endpoint was hit (REST vs RPC).
+ ASSERT_EQ(requested_url.path(), expected_request_url.path());
+
+ // Verify the request content type was JSON. (The Spelling service returns
+ // an internal server error when this content type is not JSON.)
+ std::string request_content_type;
+ ASSERT_TRUE(intercepted_headers.GetHeader(
+ net::HttpRequestHeaders::kContentType, &request_content_type));
+ EXPECT_EQ("application/json", request_content_type);
+
+ // Parse the JSON sent to the service, and verify its parameters.
+ std::unique_ptr<base::DictionaryValue> value(
+ static_cast<base::DictionaryValue*>(
+ base::JSONReader::ReadDeprecated(intercepted_body,
+ base::JSON_ALLOW_TRAILING_COMMAS)
+ .release()));
+ ASSERT_TRUE(value.get());
+
+ std::string method;
+ std::string version;
+ if (is_rest) {
+ EXPECT_FALSE(value->GetString("method", &method));
+ EXPECT_FALSE(value->GetString("apiVersion", &version));
+ } else {
EXPECT_TRUE(value->GetString("method", &method));
EXPECT_EQ("spelling.check", method);
- std::string version;
EXPECT_TRUE(value->GetString("apiVersion", &version));
- EXPECT_EQ(base::StringPrintf("v%d", kTests[i].request_type), version);
- std::string sanitized_text;
- EXPECT_TRUE(value->GetString("params.text", &sanitized_text));
- EXPECT_EQ(kTests[i].sanitized_request_text, sanitized_text);
- std::string language;
- EXPECT_TRUE(value->GetString("params.language", &language));
- std::string expected_language =
- kTests[i].language.empty() ? std::string("en") : kTests[i].language;
- EXPECT_EQ(expected_language, language);
- std::string expected_country;
- ASSERT_TRUE(GetExpectedCountry(language, &expected_country));
- std::string country;
- EXPECT_TRUE(value->GetString("params.originCountry", &country));
- EXPECT_EQ(expected_country, country);
+ EXPECT_EQ(base::StringPrintf("v%d", test_case.request_type), version);
}
+
+ std::string sanitized_text;
+ EXPECT_TRUE(
+ value->GetString(is_rest ? "text" : "params.text", &sanitized_text));
+ EXPECT_EQ(test_case.sanitized_request_text, sanitized_text);
+ std::string language;
+ EXPECT_TRUE(
+ value->GetString(is_rest ? "language" : "params.language", &language));
+ std::string expected_language =
+ test_case.language.empty() ? std::string("en") : test_case.language;
+ EXPECT_EQ(expected_language, language);
+ std::string expected_country;
+ ASSERT_TRUE(GetExpectedCountry(language, &expected_country));
+ std::string country;
+ EXPECT_TRUE(value->GetString(
+ is_rest ? "originCountry" : "params.originCountry", &country));
+ EXPECT_EQ(expected_country, country);
}
+INSTANTIATE_TEST_SUITE_P(
+ SpellingService,
+ SpellingServiceClientTest,
+ testing::Values(
+ // Test cases for the RPC endpoint
+ SpellingServiceTestCase{
+ L"",
+ "",
+ SpellingServiceClient::SUGGEST,
+ net::HttpStatusCode(500),
+ "",
+ false,
+ "",
+ "af",
+ false,
+ },
+ SpellingServiceTestCase{
+ L"chromebook",
+ "chromebook",
+ SpellingServiceClient::SUGGEST,
+ net::HttpStatusCode(200),
+ "{}",
+ true,
+ "chromebook",
+ "af",
+ false,
+ },
+ SpellingServiceTestCase{
+ L"chrombook",
+ "chrombook",
+ SpellingServiceClient::SUGGEST,
+ net::HttpStatusCode(200),
+ "{\n"
+ " \"result\": {\n"
+ " \"spellingCheckResponse\": {\n"
+ " \"misspellings\": [{\n"
+ " \"charStart\": 0,\n"
+ " \"charLength\": 9,\n"
+ " \"suggestions\": [{ \"suggestion\": \"chromebook\" }],\n"
+ " \"canAutoCorrect\": false\n"
+ " }]\n"
+ " }\n"
+ " }\n"
+ "}",
+ true,
+ "chromebook",
+ "af",
+ false,
+ },
+ SpellingServiceTestCase{
+ L"",
+ "",
+ SpellingServiceClient::SPELLCHECK,
+ net::HttpStatusCode(500),
+ "",
+ false,
+ "",
+ "en",
+ false,
+ },
+ SpellingServiceTestCase{
+ L"I have been to USA.",
+ "I have been to USA.",
+ SpellingServiceClient::SPELLCHECK,
+ net::HttpStatusCode(200),
+ "{}",
+ true,
+ "I have been to USA.",
+ "en",
+ false,
+ },
+ SpellingServiceTestCase{
+ L"I have bean to USA.",
+ "I have bean to USA.",
+ SpellingServiceClient::SPELLCHECK,
+ net::HttpStatusCode(200),
+ "{\n"
+ " \"result\": {\n"
+ " \"spellingCheckResponse\": {\n"
+ " \"misspellings\": [{\n"
+ " \"charStart\": 7,\n"
+ " \"charLength\": 4,\n"
+ " \"suggestions\": [{ \"suggestion\": \"been\" }],\n"
+ " \"canAutoCorrect\": false\n"
+ " }]\n"
+ " }\n"
+ " }\n"
+ "}",
+ true,
+ "I have been to USA.",
+ "en",
+ false,
+ },
+ SpellingServiceTestCase{
+ L"I\x2019mattheIn'n'Out.",
+ "I'mattheIn'n'Out.",
+ SpellingServiceClient::SPELLCHECK,
+ net::HttpStatusCode(200),
+ "{\n"
+ " \"result\": {\n"
+ " \"spellingCheckResponse\": {\n"
+ " \"misspellings\": [{\n"
+ " \"charStart\": 0,\n"
+ " \"charLength\": 16,\n"
+ " \"suggestions\":"
+ " [{ \"suggestion\": \"I'm at the In'N'Out\" }],\n"
+ " \"canAutoCorrect\": false\n"
+ " }]\n"
+ " }\n"
+ " }\n"
+ "}",
+ true,
+ "I'm at the In'N'Out.",
+ "en",
+ false,
+ },
+
+ // Test cases for the REST endpoint
+ SpellingServiceTestCase{
+ L"",
+ "",
+ SpellingServiceClient::SUGGEST,
+ net::HttpStatusCode(500),
+ "",
+ false,
+ "",
+ "af",
+ true,
+ },
+ SpellingServiceTestCase{
+ L"chromebook",
+ "chromebook",
+ SpellingServiceClient::SUGGEST,
+ net::HttpStatusCode(200),
+ "{}",
+ true,
+ "chromebook",
+ "af",
+ true,
+ },
+ SpellingServiceTestCase{
+ L"chrombook",
+ "chrombook",
+ SpellingServiceClient::SUGGEST,
+ net::HttpStatusCode(200),
+ "{\n"
+ " \"spellingCheckResponse\": {\n"
+ " \"misspellings\": [{\n"
+ " \"charStart\": 0,\n"
+ " \"charLength\": 9,\n"
+ " \"suggestions\": [{ \"suggestion\": \"chromebook\" }],\n"
+ " \"canAutoCorrect\": false\n"
+ " }]\n"
+ " }\n"
+ "}",
+ true,
+ "chromebook",
+ "af",
+ true,
+ },
+ SpellingServiceTestCase{L"", "", SpellingServiceClient::SPELLCHECK,
+ net::HttpStatusCode(500), "", false, "", "en",
+ true},
+ SpellingServiceTestCase{
+ L"I have been to USA.",
+ "I have been to USA.",
+ SpellingServiceClient::SPELLCHECK,
+ net::HttpStatusCode(200),
+ "{}",
+ true,
+ "I have been to USA.",
+ "en",
+ true,
+ },
+ SpellingServiceTestCase{
+ L"I have bean to USA.",
+ "I have bean to USA.",
+ SpellingServiceClient::SPELLCHECK,
+ net::HttpStatusCode(200),
+ "{\n"
+ " \"spellingCheckResponse\": {\n"
+ " \"misspellings\": [{\n"
+ " \"charStart\": 7,\n"
+ " \"charLength\": 4,\n"
+ " \"suggestions\": [{ \"suggestion\": \"been\" }],\n"
+ " \"canAutoCorrect\": false\n"
+ " }]\n"
+ " }\n"
+ "}",
+ true,
+ "I have been to USA.",
+ "en",
+ true,
+ },
+ SpellingServiceTestCase{
+ L"I\x2019mattheIn'n'Out.",
+ "I'mattheIn'n'Out.",
+ SpellingServiceClient::SPELLCHECK,
+ net::HttpStatusCode(200),
+ "{\n"
+ " \"spellingCheckResponse\": {\n"
+ " \"misspellings\": [{\n"
+ " \"charStart\": 0,\n"
+ " \"charLength\": 16,\n"
+ " \"suggestions\":"
+ " [{ \"suggestion\": \"I'm at the In'N'Out\" }],\n"
+ " \"canAutoCorrect\": false\n"
+ " }]\n"
+ " }\n"
+ "}",
+ true,
+ "I'm at the In'N'Out.",
+ "en",
+ true,
+ }));
+
// Verify that SpellingServiceClient::IsAvailable() returns true only when it
// can send suggest requests or spellcheck requests.
TEST_F(SpellingServiceClientTest, AvailableServices) {
diff --git a/chromium/chrome/browser/ui/BUILD.gn b/chromium/chrome/browser/ui/BUILD.gn
index d4ff15d0fcd..7561cab1680 100644
--- a/chromium/chrome/browser/ui/BUILD.gn
+++ b/chromium/chrome/browser/ui/BUILD.gn
@@ -43,8 +43,6 @@ jumbo_split_static_library("ui") {
"app_list/app_list_util.h",
# All other browser/ui/app_list files go under enable_app_list below.
- "autofill/autofill_dialog_models.cc",
- "autofill/autofill_dialog_models.h",
"autofill/autofill_popup_controller.h",
"autofill/autofill_popup_controller_impl.cc",
"autofill/autofill_popup_controller_impl.h",
@@ -56,19 +54,22 @@ jumbo_split_static_library("ui") {
"autofill/autofill_popup_view_delegate.h",
"autofill/chrome_autofill_client.cc",
"autofill/chrome_autofill_client.h",
- "autofill/create_card_unmask_prompt_view.h",
- "autofill/credit_card_scanner_controller.cc",
- "autofill/credit_card_scanner_controller.h",
- "autofill/credit_card_scanner_view.cc",
- "autofill/credit_card_scanner_view.h",
- "autofill/credit_card_scanner_view_delegate.h",
+ "autofill/payments/autofill_dialog_models.cc",
+ "autofill/payments/autofill_dialog_models.h",
+ "autofill/payments/autofill_ui_util.cc",
+ "autofill/payments/autofill_ui_util.h",
+ "autofill/payments/create_card_unmask_prompt_view.h",
+ "autofill/payments/credit_card_scanner_controller.cc",
+ "autofill/payments/credit_card_scanner_controller.h",
+ "autofill/payments/credit_card_scanner_view.cc",
+ "autofill/payments/credit_card_scanner_view.h",
+ "autofill/payments/credit_card_scanner_view_delegate.h",
+ "autofill/payments/payments_ui_constants.h",
"autofill/popup_constants.h",
"autofill/popup_controller_common.cc",
"autofill/popup_controller_common.h",
"autofill/popup_view_common.cc",
"autofill/popup_view_common.h",
- "bloated_renderer/bloated_renderer_tab_helper.cc",
- "bloated_renderer/bloated_renderer_tab_helper.h",
"blocked_content/blocked_window_params.cc",
"blocked_content/blocked_window_params.h",
"blocked_content/list_item_position.cc",
@@ -83,8 +84,6 @@ jumbo_split_static_library("ui") {
"blocked_content/popup_tracker.h",
"blocked_content/safe_browsing_triggered_popup_blocker.cc",
"blocked_content/safe_browsing_triggered_popup_blocker.h",
- "blocked_content/scoped_visibility_tracker.cc",
- "blocked_content/scoped_visibility_tracker.h",
"blocked_content/tab_under_navigation_throttle.cc",
"blocked_content/tab_under_navigation_throttle.h",
"blocked_content/url_list_manager.cc",
@@ -209,6 +208,8 @@ jumbo_split_static_library("ui") {
"translate/translate_bubble_model_impl.h",
"translate/translate_bubble_view_state_transition.cc",
"translate/translate_bubble_view_state_transition.h",
+ "ui_features.cc",
+ "ui_features.h",
"uninstall_browser_prompt.h",
"view_ids.h",
"web_contents_sizer.h",
@@ -311,8 +312,8 @@ jumbo_split_static_library("ui") {
"webui/sync_internals_ui.h",
"webui/test_files_request_filter.cc",
"webui/test_files_request_filter.h",
- "webui/translate_internals/translate_internals_handler.cc",
- "webui/translate_internals/translate_internals_handler.h",
+ "webui/translate_internals/chrome_translate_internals_handler.cc",
+ "webui/translate_internals/chrome_translate_internals_handler.h",
"webui/translate_internals/translate_internals_ui.cc",
"webui/translate_internals/translate_internals_ui.h",
"webui/ukm/ukm_internals_ui.cc",
@@ -358,6 +359,7 @@ jumbo_split_static_library("ui") {
public_deps = [
"//components/dom_distiller/core",
"//components/sync",
+ "//components/sync:user_events",
"//components/translate/content/browser",
"//content/public/browser",
]
@@ -426,6 +428,7 @@ jumbo_split_static_library("ui") {
"//components/heap_profiling",
"//components/history/content/browser",
"//components/history/core/browser",
+ "//components/history/core/common",
"//components/image_fetcher/core",
"//components/infobars/core",
"//components/invalidation/impl",
@@ -482,6 +485,7 @@ jumbo_split_static_library("ui") {
"//components/sync_preferences",
"//components/sync_sessions",
"//components/tracing:startup_tracing",
+ "//components/translate/translate_internals",
"//components/ui_devtools",
"//components/ukm:ukm",
"//components/ukm/content",
@@ -507,11 +511,13 @@ jumbo_split_static_library("ui") {
"//device/base",
"//device/usb",
"//extensions/buildflags",
+ "//gpu/config",
"//media",
"//net:net",
"//ppapi/buildflags",
"//printing/buildflags",
"//rlz/buildflags",
+ "//services/device/public/cpp:device_features",
"//services/identity/public/cpp",
"//services/metrics/public/cpp:ukm_builders",
"//services/network/public/mojom",
@@ -604,8 +610,6 @@ jumbo_split_static_library("ui") {
"android/autofill/card_unmask_prompt_view_android.h",
"android/autofill/credit_card_scanner_view_android.cc",
"android/autofill/credit_card_scanner_view_android.h",
- "android/autofill/password_generation_popup_view_android.cc",
- "android/autofill/password_generation_popup_view_android.h",
"android/bluetooth_chooser_android.cc",
"android/bluetooth_chooser_android.h",
"android/chrome_http_auth_handler.cc",
@@ -687,6 +691,12 @@ jumbo_split_static_library("ui") {
"android/page_info/connection_info_popup_android.h",
"android/page_info/page_info_controller_android.cc",
"android/page_info/page_info_controller_android.h",
+ "android/passwords/manual_filling_view_android.cc",
+ "android/passwords/manual_filling_view_android.h",
+ "android/passwords/password_generation_dialog_view_android.cc",
+ "android/passwords/password_generation_dialog_view_android.h",
+ "android/passwords/password_generation_editing_popup_view_android.cc",
+ "android/passwords/password_generation_editing_popup_view_android.h",
"android/simple_message_box_android.cc",
"android/snackbars/auto_signin_prompt_controller.cc",
"android/snackbars/auto_signin_prompt_controller.h",
@@ -1043,16 +1053,25 @@ jumbo_split_static_library("ui") {
"tabs/tab_strip_model_order_controller.h",
"tabs/tab_strip_model_stats_recorder.cc",
"tabs/tab_strip_model_stats_recorder.h",
+ "tabs/tab_style.cc",
+ "tabs/tab_style.h",
"tabs/tab_switch_event_latency_recorder.cc",
"tabs/tab_switch_event_latency_recorder.h",
"tabs/tab_utils.cc",
"tabs/tab_utils.h",
- "tabs/window_activity_watcher.cc",
- "tabs/window_activity_watcher.h",
"task_manager/task_manager_columns.cc",
"task_manager/task_manager_columns.h",
"task_manager/task_manager_table_model.cc",
"task_manager/task_manager_table_model.h",
+ "thumbnails/thumbnail_image.cc",
+ "thumbnails/thumbnail_image.h",
+ "thumbnails/thumbnail_page_event_adapter.cc",
+ "thumbnails/thumbnail_page_event_adapter.h",
+ "thumbnails/thumbnail_page_observer.h",
+ "thumbnails/thumbnail_tab_helper.cc",
+ "thumbnails/thumbnail_tab_helper.h",
+ "thumbnails/thumbnail_utils.cc",
+ "thumbnails/thumbnail_utils.h",
"toolbar/app_menu_icon_controller.cc",
"toolbar/app_menu_icon_controller.h",
"toolbar/app_menu_model.cc",
@@ -1080,6 +1099,10 @@ jumbo_split_static_library("ui") {
"uma_browsing_activity_observer.h",
"unload_controller.cc",
"unload_controller.h",
+ "views/intent_picker_bubble_view.cc",
+ "views/intent_picker_bubble_view.h",
+ "views/location_bar/intent_picker_view.cc",
+ "views/location_bar/intent_picker_view.h",
"webui/app_launcher_login_handler.cc",
"webui/app_launcher_login_handler.h",
"webui/app_management/app_management_page_handler.cc",
@@ -1192,10 +1215,6 @@ jumbo_split_static_library("ui") {
"webui/settings/font_handler.h",
"webui/settings/languages_handler.cc",
"webui/settings/languages_handler.h",
- "webui/settings/md_settings_localized_strings_provider.cc",
- "webui/settings/md_settings_localized_strings_provider.h",
- "webui/settings/md_settings_ui.cc",
- "webui/settings/md_settings_ui.h",
"webui/settings/metrics_reporting_handler.cc",
"webui/settings/metrics_reporting_handler.h",
"webui/settings/on_startup_handler.cc",
@@ -1216,12 +1235,18 @@ jumbo_split_static_library("ui") {
"webui/settings/settings_cookies_view_handler.h",
"webui/settings/settings_import_data_handler.cc",
"webui/settings/settings_import_data_handler.h",
+ "webui/settings/settings_localized_strings_provider.cc",
+ "webui/settings/settings_localized_strings_provider.h",
"webui/settings/settings_media_devices_selection_handler.cc",
"webui/settings/settings_media_devices_selection_handler.h",
"webui/settings/settings_page_ui_handler.cc",
"webui/settings/settings_page_ui_handler.h",
+ "webui/settings/settings_security_key_handler.cc",
+ "webui/settings/settings_security_key_handler.h",
"webui/settings/settings_startup_pages_handler.cc",
"webui/settings/settings_startup_pages_handler.h",
+ "webui/settings/settings_ui.cc",
+ "webui/settings/settings_ui.h",
"webui/settings/site_settings_handler.cc",
"webui/settings/site_settings_handler.h",
"webui/settings_utils.cc",
@@ -1264,9 +1289,11 @@ jumbo_split_static_library("ui") {
"//chrome/browser/profile_resetter:profile_reset_report_proto",
"//chrome/browser/resource_coordinator:tab_metrics_event_proto",
"//chrome/browser/resource_coordinator/tab_ranker",
+ "//chrome/browser/safe_browsing:advanced_protection",
"//chrome/browser/ui/webui/app_management:mojo_bindings",
"//chrome/common:buildflags",
"//chrome/common:search_mojom",
+ "//chrome/services/app_service/public/cpp:app_service_proxy",
"//chrome/services/app_service/public/cpp:app_update",
"//chrome/services/app_service/public/mojom",
"//components/feedback/proto",
@@ -1278,7 +1305,7 @@ jumbo_split_static_library("ui") {
"//components/web_modal",
"//components/zoom",
"//device/bluetooth",
- "//services/device/public/cpp:device_features",
+ "//device/fido",
"//services/device/public/mojom",
"//services/identity/public/cpp",
"//services/metrics/public/cpp:metrics_cpp",
@@ -1291,6 +1318,10 @@ jumbo_split_static_library("ui") {
deps += [ "//ui/ozone" ]
}
+ if (is_linux && !is_chromeos) {
+ deps += [ "//ui/base/ime/linux" ]
+ }
+
if (!toolkit_views) {
sources += [ "media_router/cloud_services_dialog.cc" ]
}
@@ -1491,10 +1522,6 @@ jumbo_split_static_library("ui") {
"views/frame/top_controls_slide_controller_chromeos.h",
"views/ime_driver/input_method_bridge_chromeos.cc",
"views/ime_driver/input_method_bridge_chromeos.h",
- "views/intent_picker_bubble_view.cc",
- "views/intent_picker_bubble_view.h",
- "views/location_bar/intent_picker_view.cc",
- "views/location_bar/intent_picker_view.h",
"views/platform_keys_certificate_selector_chromeos.cc",
"views/platform_keys_certificate_selector_chromeos.h",
"views/profiles/profile_indicator_icon.cc",
@@ -1525,6 +1552,16 @@ jumbo_split_static_library("ui") {
"webui/chromeos/bluetooth_dialog_localized_strings_provider.h",
"webui/chromeos/bluetooth_pairing_dialog.cc",
"webui/chromeos/bluetooth_pairing_dialog.h",
+ "webui/chromeos/cellular_setup/cellular_setup_dialog.cc",
+ "webui/chromeos/cellular_setup/cellular_setup_dialog.h",
+ "webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.cc",
+ "webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.h",
+ "webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc",
+ "webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.h",
+ "webui/chromeos/cellular_setup/mobile_setup_dialog.cc",
+ "webui/chromeos/cellular_setup/mobile_setup_dialog.h",
+ "webui/chromeos/cellular_setup/mobile_setup_ui.cc",
+ "webui/chromeos/cellular_setup/mobile_setup_ui.h",
"webui/chromeos/certificate_manager_dialog_ui.cc",
"webui/chromeos/certificate_manager_dialog_ui.h",
"webui/chromeos/cryptohome_ui.cc",
@@ -1541,6 +1578,10 @@ jumbo_split_static_library("ui") {
"webui/chromeos/first_run/first_run_ui.h",
"webui/chromeos/image_source.cc",
"webui/chromeos/image_source.h",
+ "webui/chromeos/insession_password_change_handler_chromeos.cc",
+ "webui/chromeos/insession_password_change_handler_chromeos.h",
+ "webui/chromeos/insession_password_change_ui.cc",
+ "webui/chromeos/insession_password_change_ui.h",
"webui/chromeos/internet_config_dialog.cc",
"webui/chromeos/internet_config_dialog.h",
"webui/chromeos/internet_detail_dialog.cc",
@@ -1610,8 +1651,8 @@ jumbo_split_static_library("ui") {
"webui/chromeos/login/gaia_screen_handler.h",
"webui/chromeos/login/hid_detection_screen_handler.cc",
"webui/chromeos/login/hid_detection_screen_handler.h",
- "webui/chromeos/login/kiosk_app_menu_handler.cc",
- "webui/chromeos/login/kiosk_app_menu_handler.h",
+ "webui/chromeos/login/js_calls_container.cc",
+ "webui/chromeos/login/js_calls_container.h",
"webui/chromeos/login/kiosk_autolaunch_screen_handler.cc",
"webui/chromeos/login/kiosk_autolaunch_screen_handler.h",
"webui/chromeos/login/kiosk_enable_screen_handler.cc",
@@ -1651,16 +1692,10 @@ jumbo_split_static_library("ui") {
"webui/chromeos/login/update_screen_handler.h",
"webui/chromeos/login/user_board_screen_handler.cc",
"webui/chromeos/login/user_board_screen_handler.h",
- "webui/chromeos/login/user_image_screen_handler.cc",
- "webui/chromeos/login/user_image_screen_handler.h",
"webui/chromeos/login/welcome_screen_handler.cc",
"webui/chromeos/login/welcome_screen_handler.h",
"webui/chromeos/login/wrong_hwid_screen_handler.cc",
"webui/chromeos/login/wrong_hwid_screen_handler.h",
- "webui/chromeos/mobile_setup_dialog.cc",
- "webui/chromeos/mobile_setup_dialog.h",
- "webui/chromeos/mobile_setup_ui.cc",
- "webui/chromeos/mobile_setup_ui.h",
"webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc",
"webui/chromeos/multidevice_setup/multidevice_setup_dialog.h",
"webui/chromeos/multidevice_setup/multidevice_setup_handler.cc",
@@ -1735,12 +1770,16 @@ jumbo_split_static_library("ui") {
"webui/settings/chromeos/internet_handler.h",
"webui/settings/chromeos/multidevice_handler.cc",
"webui/settings/chromeos/multidevice_handler.h",
+ "webui/settings/chromeos/os_settings_ui.cc",
+ "webui/settings/chromeos/os_settings_ui.h",
"webui/settings/tts_handler.cc",
"webui/settings/tts_handler.h",
"webui/signin/inline_login_handler_chromeos.cc",
"webui/signin/inline_login_handler_chromeos.h",
"webui/signin/inline_login_handler_dialog_chromeos.cc",
"webui/signin/inline_login_handler_dialog_chromeos.h",
+ "webui/signin/inline_login_handler_modal_delegate.cc",
+ "webui/signin/inline_login_handler_modal_delegate.h",
"webui/version_handler_chromeos.cc",
"webui/version_handler_chromeos.h",
"window_sizer/window_sizer_ash.cc",
@@ -1753,16 +1792,23 @@ jumbo_split_static_library("ui") {
"//ash/public/cpp/resources:ash_public_unscaled_resources",
"//ash/public/cpp/vector_icons",
"//chrome/browser/chromeos",
+ "//chromeos",
"//chromeos/assistant:buildflags",
"//chromeos/audio",
+ "//chromeos/components/account_manager",
"//chromeos/components/multidevice",
"//chromeos/components/multidevice/debug_webui",
"//chromeos/components/multidevice/logging",
"//chromeos/components/proximity_auth",
"//chromeos/components/tether",
+ "//chromeos/constants",
"//chromeos/cryptohome",
"//chromeos/dbus",
- "//chromeos/dbus:cryptohome_proto",
+ "//chromeos/dbus/audio",
+ "//chromeos/dbus/cryptohome",
+ "//chromeos/dbus/cryptohome:cryptohome_proto",
+ "//chromeos/dbus/power",
+ "//chromeos/dbus/session_manager",
"//chromeos/dbus/system_clock",
"//chromeos/login/auth",
"//chromeos/login/login_state",
@@ -1778,6 +1824,7 @@ jumbo_split_static_library("ui") {
"//chromeos/services/multidevice_setup/public/mojom",
"//chromeos/settings",
"//chromeos/strings",
+ "//chromeos/system",
"//components/arc",
"//components/captive_portal",
"//components/consent_auditor:consent_auditor",
@@ -1792,7 +1839,7 @@ jumbo_split_static_library("ui") {
"//services/device/public/mojom",
"//services/ws/public/cpp",
"//services/ws/public/mojom",
- "//ui/base/ime",
+ "//ui/base/ime/chromeos",
"//ui/chromeos",
"//ui/chromeos/events",
"//ui/compositor_extra",
@@ -1823,6 +1870,10 @@ jumbo_split_static_library("ui") {
"views/close_bubble_on_tab_activation_helper.h",
"views/hats/hats_bubble_view.cc",
"views/hats/hats_bubble_view.h",
+ "views/profiles/incognito_menu_view.cc",
+ "views/profiles/incognito_menu_view.h",
+ "views/profiles/profile_menu_view_base.cc",
+ "views/profiles/profile_menu_view_base.h",
"webui/discards/discards_ui.cc",
"webui/discards/discards_ui.h",
"webui/signin/inline_login_handler.cc",
@@ -1865,8 +1916,6 @@ jumbo_split_static_library("ui") {
"views/profiles/dice_accounts_menu.h",
"views/profiles/profile_chooser_view.cc",
"views/profiles/profile_chooser_view.h",
- "views/profiles/profile_menu_view_base.cc",
- "views/profiles/profile_menu_view_base.h",
"views/profiles/signin_view_controller_delegate_views.cc",
"views/profiles/signin_view_controller_delegate_views.h",
"views/profiles/user_manager_view.cc",
@@ -1885,8 +1934,6 @@ jumbo_split_static_library("ui") {
"webui/settings/system_handler.h",
"webui/signin/inline_login_handler_impl.cc",
"webui/signin/inline_login_handler_impl.h",
- "webui/signin/md_user_manager_ui.cc",
- "webui/signin/md_user_manager_ui.h",
"webui/signin/signin_create_profile_handler.cc",
"webui/signin/signin_create_profile_handler.h",
"webui/signin/signin_email_confirmation_dialog.cc",
@@ -1907,16 +1954,14 @@ jumbo_split_static_library("ui") {
"webui/signin/sync_confirmation_ui.h",
"webui/signin/user_manager_screen_handler.cc",
"webui/signin/user_manager_screen_handler.h",
+ "webui/signin/user_manager_ui.cc",
+ "webui/signin/user_manager_ui.h",
"webui/welcome/nux/bookmark_handler.cc",
"webui/welcome/nux/bookmark_handler.h",
"webui/welcome/nux/bookmark_item.cc",
"webui/welcome/nux/bookmark_item.h",
"webui/welcome/nux/constants.cc",
"webui/welcome/nux/constants.h",
- "webui/welcome/nux/email_handler.cc",
- "webui/welcome/nux/email_handler.h",
- "webui/welcome/nux/email_providers_list.cc",
- "webui/welcome/nux/email_providers_list.h",
"webui/welcome/nux/google_apps_handler.cc",
"webui/welcome/nux/google_apps_handler.h",
"webui/welcome/nux/ntp_background_fetcher.cc",
@@ -2068,14 +2113,6 @@ jumbo_split_static_library("ui") {
"cocoa/main_menu_builder.h",
"cocoa/main_menu_builder.mm",
"cocoa/main_menu_item.h",
- "cocoa/media_picker/desktop_media_picker_bridge.h",
- "cocoa/media_picker/desktop_media_picker_bridge.mm",
- "cocoa/media_picker/desktop_media_picker_cocoa.h",
- "cocoa/media_picker/desktop_media_picker_cocoa.mm",
- "cocoa/media_picker/desktop_media_picker_controller.h",
- "cocoa/media_picker/desktop_media_picker_controller.mm",
- "cocoa/media_picker/desktop_media_picker_item.h",
- "cocoa/media_picker/desktop_media_picker_item.mm",
"cocoa/native_window_tracker_cocoa.h",
"cocoa/native_window_tracker_cocoa.mm",
"cocoa/nsmenuitem_additions.h",
@@ -2110,8 +2147,6 @@ jumbo_split_static_library("ui") {
"cocoa/touchbar/credit_card_autofill_touch_bar_controller.mm",
"cocoa/touchbar/web_textfield_touch_bar_controller.h",
"cocoa/touchbar/web_textfield_touch_bar_controller.mm",
- "cocoa/ui_localizer.h",
- "cocoa/ui_localizer.mm",
"cocoa/window_size_autosaver.h",
"cocoa/window_size_autosaver.mm",
"views/apps/chrome_app_window_client_views_mac.mm",
@@ -2122,6 +2157,8 @@ jumbo_split_static_library("ui") {
"views/frame/browser_non_client_frame_view_factory_mac.mm",
"views/frame/browser_non_client_frame_view_mac.h",
"views/frame/browser_non_client_frame_view_mac.mm",
+ "views/frame/immersive_mode_controller_mac.h",
+ "views/frame/immersive_mode_controller_mac.mm",
"views/frame/native_browser_frame_factory_mac.mm",
"views/tab_contents/chrome_web_contents_view_delegate_views_mac.h",
"views/tab_contents/chrome_web_contents_view_delegate_views_mac.mm",
@@ -2136,7 +2173,6 @@ jumbo_split_static_library("ui") {
allow_circular_includes_from += [ "//chrome/browser/apps/app_shim" ]
deps += [
- "//chrome/app/nibs:localizer_table",
"//chrome/browser/apps/app_shim",
"//extensions/components/native_app_window",
"//third_party/google_toolbox_for_mac",
@@ -2205,6 +2241,8 @@ jumbo_split_static_library("ui") {
"views/try_chrome_dialog_win/try_chrome_dialog.h",
"views/uninstall_view.cc",
"views/uninstall_view.h",
+ "webui/conflicts/conflicts_data_fetcher.cc",
+ "webui/conflicts/conflicts_data_fetcher.h",
"webui/conflicts/conflicts_handler.cc",
"webui/conflicts/conflicts_handler.h",
"webui/conflicts/conflicts_ui.cc",
@@ -2344,22 +2382,24 @@ jumbo_split_static_library("ui") {
if (toolkit_views) {
sources += [
- "autofill/local_card_migration_bubble.h",
- "autofill/local_card_migration_bubble_controller_impl.cc",
- "autofill/local_card_migration_bubble_controller_impl.h",
- "autofill/local_card_migration_controller_observer.h",
- "autofill/local_card_migration_dialog.h",
- "autofill/local_card_migration_dialog_controller_impl.cc",
- "autofill/local_card_migration_dialog_controller_impl.h",
- "autofill/local_card_migration_dialog_factory.h",
- "autofill/local_card_migration_dialog_state.h",
- "autofill/manage_migration_ui_controller.cc",
- "autofill/manage_migration_ui_controller.h",
- "autofill/save_card_bubble_controller_impl.cc",
- "autofill/save_card_bubble_controller_impl.h",
- "autofill/save_card_bubble_view.h",
- "autofill/save_card_ui.h",
+ "autofill/payments/local_card_migration_bubble.h",
+ "autofill/payments/local_card_migration_bubble_controller_impl.cc",
+ "autofill/payments/local_card_migration_bubble_controller_impl.h",
+ "autofill/payments/local_card_migration_controller_observer.h",
+ "autofill/payments/local_card_migration_dialog.h",
+ "autofill/payments/local_card_migration_dialog_controller_impl.cc",
+ "autofill/payments/local_card_migration_dialog_controller_impl.h",
+ "autofill/payments/local_card_migration_dialog_factory.h",
+ "autofill/payments/local_card_migration_dialog_state.h",
+ "autofill/payments/manage_migration_ui_controller.cc",
+ "autofill/payments/manage_migration_ui_controller.h",
+ "autofill/payments/save_card_bubble_controller_impl.cc",
+ "autofill/payments/save_card_bubble_controller_impl.h",
+ "autofill/payments/save_card_bubble_view.h",
+ "autofill/payments/save_card_ui.h",
"bubble_anchor_util.h",
+ "manifest_web_app_browser_controller.cc",
+ "manifest_web_app_browser_controller.h",
# This test header is included because it contains forward declarations
# needed for "friend" statements for use in tests.
@@ -2388,28 +2428,31 @@ jumbo_split_static_library("ui") {
"views/autofill/autofill_popup_base_view.h",
"views/autofill/autofill_popup_view_native_views.cc",
"views/autofill/autofill_popup_view_native_views.h",
- "views/autofill/card_unmask_prompt_views.cc",
- "views/autofill/card_unmask_prompt_views.h",
- "views/autofill/local_card_migration_bubble_views.cc",
- "views/autofill/local_card_migration_bubble_views.h",
- "views/autofill/local_card_migration_dialog_view.cc",
- "views/autofill/local_card_migration_dialog_view.h",
- "views/autofill/local_card_migration_error_dialog_view.cc",
- "views/autofill/local_card_migration_error_dialog_view.h",
- "views/autofill/local_card_migration_icon_view.cc",
- "views/autofill/local_card_migration_icon_view.h",
- "views/autofill/migratable_card_view.cc",
- "views/autofill/migratable_card_view.h",
- "views/autofill/save_card_bubble_views.cc",
- "views/autofill/save_card_bubble_views.h",
- "views/autofill/save_card_icon_view.cc",
- "views/autofill/save_card_icon_view.h",
- "views/autofill/save_card_manage_cards_bubble_views.cc",
- "views/autofill/save_card_manage_cards_bubble_views.h",
- "views/autofill/save_card_offer_bubble_views.cc",
- "views/autofill/save_card_offer_bubble_views.h",
- "views/autofill/save_card_sign_in_promo_bubble_views.cc",
- "views/autofill/save_card_sign_in_promo_bubble_views.h",
+ "views/autofill/payments/card_unmask_prompt_views.cc",
+ "views/autofill/payments/card_unmask_prompt_views.h",
+ "views/autofill/payments/dialog_view_ids.h",
+ "views/autofill/payments/local_card_migration_bubble_views.cc",
+ "views/autofill/payments/local_card_migration_bubble_views.h",
+ "views/autofill/payments/local_card_migration_dialog_view.cc",
+ "views/autofill/payments/local_card_migration_dialog_view.h",
+ "views/autofill/payments/local_card_migration_error_dialog_view.cc",
+ "views/autofill/payments/local_card_migration_error_dialog_view.h",
+ "views/autofill/payments/local_card_migration_icon_view.cc",
+ "views/autofill/payments/local_card_migration_icon_view.h",
+ "views/autofill/payments/migratable_card_view.cc",
+ "views/autofill/payments/migratable_card_view.h",
+ "views/autofill/payments/payments_view_util.cc",
+ "views/autofill/payments/payments_view_util.h",
+ "views/autofill/payments/save_card_bubble_views.cc",
+ "views/autofill/payments/save_card_bubble_views.h",
+ "views/autofill/payments/save_card_icon_view.cc",
+ "views/autofill/payments/save_card_icon_view.h",
+ "views/autofill/payments/save_card_manage_cards_bubble_views.cc",
+ "views/autofill/payments/save_card_manage_cards_bubble_views.h",
+ "views/autofill/payments/save_card_offer_bubble_views.cc",
+ "views/autofill/payments/save_card_offer_bubble_views.h",
+ "views/autofill/payments/save_card_sign_in_promo_bubble_views.cc",
+ "views/autofill/payments/save_card_sign_in_promo_bubble_views.h",
"views/autofill/view_util.cc",
"views/autofill/view_util.h",
"views/bookmarks/bookmark_bar_view.cc",
@@ -2459,6 +2502,16 @@ jumbo_split_static_library("ui") {
"views/content_setting_domain_list_view.h",
"views/cookie_info_view.cc",
"views/cookie_info_view.h",
+ "views/desktop_capture/desktop_media_list_controller.cc",
+ "views/desktop_capture/desktop_media_list_controller.h",
+ "views/desktop_capture/desktop_media_list_view.cc",
+ "views/desktop_capture/desktop_media_list_view.h",
+ "views/desktop_capture/desktop_media_picker_views.cc",
+ "views/desktop_capture/desktop_media_picker_views.h",
+ "views/desktop_capture/desktop_media_source_view.cc",
+ "views/desktop_capture/desktop_media_source_view.h",
+ "views/desktop_capture/desktop_media_tab_list.cc",
+ "views/desktop_capture/desktop_media_tab_list.h",
"views/device_chooser_content_view.cc",
"views/device_chooser_content_view.h",
"views/download/download_danger_prompt_views.cc",
@@ -2490,10 +2543,22 @@ jumbo_split_static_library("ui") {
"views/extensions/extension_keybinding_registry_views.cc",
"views/extensions/extension_keybinding_registry_views.h",
"views/extensions/extension_uninstall_dialog_view.cc",
- "views/extensions/pwa_confirmation_view.cc",
- "views/extensions/pwa_confirmation_view.h",
+ "views/extensions/extensions_menu_button.cc",
+ "views/extensions/extensions_menu_button.h",
+ "views/extensions/extensions_menu_view.cc",
+ "views/extensions/extensions_menu_view.h",
+ "views/extensions/extensions_toolbar_button.cc",
+ "views/extensions/extensions_toolbar_button.h",
+ "views/extensions/pwa_confirmation.cc",
+ "views/extensions/pwa_confirmation.h",
+ "views/extensions/pwa_confirmation_bubble_view.cc",
+ "views/extensions/pwa_confirmation_bubble_view.h",
+ "views/extensions/pwa_confirmation_dialog_view.cc",
+ "views/extensions/pwa_confirmation_dialog_view.h",
"views/extensions/web_app_info_image_source.cc",
"views/extensions/web_app_info_image_source.h",
+ "views/feature_promos/feature_promo_bubble_timeout.cc",
+ "views/feature_promos/feature_promo_bubble_timeout.h",
"views/feature_promos/feature_promo_bubble_view.cc",
"views/feature_promos/feature_promo_bubble_view.h",
"views/find_bar_host.cc",
@@ -2541,6 +2606,8 @@ jumbo_split_static_library("ui") {
"views/frame/system_menu_model_builder.h",
"views/frame/system_menu_model_delegate.cc",
"views/frame/system_menu_model_delegate.h",
+ "views/frame/tab_strip_region_view.cc",
+ "views/frame/tab_strip_region_view.h",
"views/frame/toolbar_button_provider.h",
"views/frame/top_container_view.cc",
"views/frame/top_container_view.h",
@@ -2664,8 +2731,8 @@ jumbo_split_static_library("ui") {
"views/overlay/skip_ad_label_button.h",
"views/overlay/track_image_button.cc",
"views/overlay/track_image_button.h",
- "views/page_action/page_action_icon_container_view.cc",
- "views/page_action/page_action_icon_container_view.h",
+ "views/page_action/omnibox_page_action_icon_container_view.cc",
+ "views/page_action/omnibox_page_action_icon_container_view.h",
"views/page_action/page_action_icon_view.cc",
"views/page_action/page_action_icon_view.h",
"views/page_action/pwa_install_view.cc",
@@ -2716,6 +2783,8 @@ jumbo_split_static_library("ui") {
"views/payments/error_message_view_controller.h",
"views/payments/order_summary_view_controller.cc",
"views/payments/order_summary_view_controller.h",
+ "views/payments/payment_handler_modal_dialog_manager_delegate.cc",
+ "views/payments/payment_handler_modal_dialog_manager_delegate.h",
"views/payments/payment_handler_web_flow_view_controller.cc",
"views/payments/payment_handler_web_flow_view_controller.h",
"views/payments/payment_method_view_controller.cc",
@@ -2812,13 +2881,15 @@ jumbo_split_static_library("ui") {
"views/tabs/tab_hover_card_bubble_view.h",
"views/tabs/tab_icon.cc",
"views/tabs/tab_icon.h",
+ "views/tabs/tab_renderer_data.cc",
+ "views/tabs/tab_renderer_data.h",
"views/tabs/tab_strip.cc",
"views/tabs/tab_strip.h",
"views/tabs/tab_strip_controller.h",
"views/tabs/tab_strip_layout.cc",
"views/tabs/tab_strip_layout.h",
- "views/tabs/tab_style.cc",
- "views/tabs/tab_style.h",
+ "views/tabs/tab_style_views.cc",
+ "views/tabs/tab_style_views.h",
"views/tabs/window_finder.h",
"views/task_manager_view.cc",
"views/task_manager_view.h",
@@ -2845,8 +2916,12 @@ jumbo_split_static_library("ui") {
"views/toolbar/toolbar_actions_bar_bubble_views.h",
"views/toolbar/toolbar_button.cc",
"views/toolbar/toolbar_button.h",
+ "views/toolbar/toolbar_icon_container_view.cc",
+ "views/toolbar/toolbar_icon_container_view.h",
"views/toolbar/toolbar_ink_drop_util.cc",
"views/toolbar/toolbar_ink_drop_util.h",
+ "views/toolbar/toolbar_page_action_icon_container_view.cc",
+ "views/toolbar/toolbar_page_action_icon_container_view.h",
"views/toolbar/toolbar_view.cc",
"views/toolbar/toolbar_view.h",
"views/touch_uma/touch_uma.cc",
@@ -2867,6 +2942,8 @@ jumbo_split_static_library("ui") {
"views/webauthn/authenticator_request_dialog_view.h",
"views/webauthn/authenticator_request_sheet_view.cc",
"views/webauthn/authenticator_request_sheet_view.h",
+ "views/webauthn/authenticator_select_account_sheet_view.cc",
+ "views/webauthn/authenticator_select_account_sheet_view.h",
"views/webauthn/authenticator_transport_selector_sheet_view.cc",
"views/webauthn/authenticator_transport_selector_sheet_view.h",
"views/webauthn/ble_device_selection_sheet_view.cc",
@@ -2879,6 +2956,8 @@ jumbo_split_static_library("ui") {
"views/webauthn/sheet_view_factory.h",
"views_mode_controller.cc",
"views_mode_controller.h",
+ "web_app_browser_controller.cc",
+ "web_app_browser_controller.h",
"webauthn/authenticator_request_sheet_model.h",
"webauthn/ble_device_hover_list_model.cc",
"webauthn/ble_device_hover_list_model.h",
@@ -2897,6 +2976,7 @@ jumbo_split_static_library("ui") {
"//components/constrained_window",
"//components/payments/content",
"//components/payments/core",
+ "//components/ui_devtools/views",
"//device/vr/buildflags:buildflags",
"//services/ws/public/cpp/input_devices",
"//ui/views:buildflags",
@@ -2976,7 +3056,6 @@ jumbo_split_static_library("ui") {
if (use_aura) {
deps += [
- "//components/ui_devtools/views",
"//services/ws/public/cpp",
"//services/ws/public/mojom",
]
@@ -3073,12 +3152,6 @@ jumbo_split_static_library("ui") {
"views/apps/shaped_app_window_targeter.h",
"views/color_chooser_aura.cc",
"views/color_chooser_aura.h",
- "views/desktop_capture/desktop_media_list_view.cc",
- "views/desktop_capture/desktop_media_list_view.h",
- "views/desktop_capture/desktop_media_picker_views.cc",
- "views/desktop_capture/desktop_media_picker_views.h",
- "views/desktop_capture/desktop_media_source_view.cc",
- "views/desktop_capture/desktop_media_source_view.h",
"views/dropdown_bar_host_aura.cc",
"views/frame/browser_non_client_frame_view_factory_chromeos.cc",
"views/ime/ime_window_frame_view.cc",
@@ -3303,10 +3376,6 @@ jumbo_split_static_library("ui") {
"app_list/page_break_app_item.h",
"app_list/page_break_constants.cc",
"app_list/page_break_constants.h",
- "app_list/plugin_vm/plugin_vm_app_item.cc",
- "app_list/plugin_vm/plugin_vm_app_item.h",
- "app_list/plugin_vm/plugin_vm_app_model_builder.cc",
- "app_list/plugin_vm/plugin_vm_app_model_builder.h",
"app_list/search/app_service_app_result.cc",
"app_list/search/app_service_app_result.h",
"app_list/search/arc_app_result.cc",
@@ -3366,7 +3435,10 @@ jumbo_split_static_library("ui") {
"views/plugin_vm/plugin_vm_launcher_view.cc",
"views/plugin_vm/plugin_vm_launcher_view.h",
]
- deps += [ "//chrome/services/app_service/public/cpp:app_update" ]
+ deps += [
+ "//chrome/services/app_service/public/cpp:app_update",
+ "//chrome/services/app_service/public/cpp:icon_loader",
+ ]
}
}
@@ -3480,12 +3552,18 @@ jumbo_split_static_library("ui") {
"views/extensions/media_galleries_dialog_views.h",
"views/extensions/media_gallery_checkbox_view.cc",
"views/extensions/media_gallery_checkbox_view.h",
+ "web_applications/system_web_app_ui_utils_chromeos.cc",
+ "web_applications/system_web_app_ui_utils_chromeos.h",
"web_applications/web_app_dialog_utils.cc",
"web_applications/web_app_dialog_utils.h",
"web_applications/web_app_metrics.cc",
"web_applications/web_app_metrics.h",
"web_applications/web_app_metrics_factory.cc",
"web_applications/web_app_metrics_factory.h",
+ "web_applications/web_app_ui_delegate_impl.cc",
+ "web_applications/web_app_ui_delegate_impl.h",
+ "web_applications/web_app_ui_delegate_impl_factory.cc",
+ "web_applications/web_app_ui_delegate_impl_factory.h",
"webui/extensions/extension_basic_info.cc",
"webui/extensions/extension_basic_info.h",
"webui/extensions/extension_icon_source.cc",
@@ -3496,11 +3574,7 @@ jumbo_split_static_library("ui") {
deps += [ "//apps/ui/views" ]
}
if (use_aura) {
- sources += [
- "views/chrome_javascript_native_dialog_factory_views.cc",
- "views/extensions/extension_popup_aura.cc",
- "views/extensions/extension_popup_aura.h",
- ]
+ sources += [ "views/chrome_javascript_native_dialog_factory_views.cc" ]
deps += [ "//ui/wm/public" ]
}
}
diff --git a/chromium/chrome/browser/ui/libgtkui/BUILD.gn b/chromium/chrome/browser/ui/libgtkui/BUILD.gn
index 407f90ce6b2..ced5ef6d9e7 100644
--- a/chromium/chrome/browser/ui/libgtkui/BUILD.gn
+++ b/chromium/chrome/browser/ui/libgtkui/BUILD.gn
@@ -106,6 +106,7 @@ jumbo_component("libgtkui") {
"//ui/aura",
"//ui/base",
"//ui/base/ime",
+ "//ui/base/ime/linux",
"//ui/display",
"//ui/events",
"//ui/events:dom_keyboard_layout",
diff --git a/chromium/chrome/browser/ui/views/BUILD.gn b/chromium/chrome/browser/ui/views/BUILD.gn
index 07f24ef87e2..9e4f35b6eb3 100644
--- a/chromium/chrome/browser/ui/views/BUILD.gn
+++ b/chromium/chrome/browser/ui/views/BUILD.gn
@@ -16,8 +16,6 @@ component("views") {
"event_utils.cc",
"event_utils.h",
"tab_icon_view_model.h",
- "tabs/tab_renderer_data.cc",
- "tabs/tab_renderer_data.h",
"tabs/tab_strip_observer.cc",
"tabs/tab_strip_observer.h",
"tabs/tab_strip_types.h",
diff --git a/chromium/chrome/browser/ui/webui/app_management/app_management.mojom b/chromium/chrome/browser/ui/webui/app_management/app_management.mojom
index 4053cde606d..cfad5cba531 100644
--- a/chromium/chrome/browser/ui/webui/app_management/app_management.mojom
+++ b/chromium/chrome/browser/ui/webui/app_management/app_management.mojom
@@ -61,9 +61,10 @@ interface Page {
// App Service. It should always match the AppPermission enum in
// app_permissions.mojom
enum ArcPermissionType {
- CAMERA,
- LOCATION,
- MICROPHONE,
+ CAMERA = 0,
+ LOCATION = 1,
+ MICROPHONE = 2,
+ NOTIFICATIONS = 3,
};
// This enum takes the important permission values from the
diff --git a/chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.cc b/chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.cc
index 91ff9966323..1cbf7dfcef8 100644
--- a/chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.cc
+++ b/chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.cc
@@ -9,10 +9,11 @@
#include "base/containers/flat_map.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/apps/app_service/app_service_proxy.h"
+#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/services/app_service/public/cpp/app_registry_cache.h"
+#include "chrome/services/app_service/public/cpp/app_service_proxy.h"
#include "chrome/services/app_service/public/mojom/types.mojom.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
@@ -48,7 +49,8 @@ AppManagementPageHandler::AppManagementPageHandler(
shelf_delegate_(this)
#endif
{
- apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile_);
+ apps::AppServiceProxy* proxy =
+ apps::AppServiceProxyFactory::GetForProfile(profile_);
// TODO(crbug.com/826982): revisit pending decision on AppServiceProxy in
// incognito
@@ -62,7 +64,8 @@ AppManagementPageHandler::~AppManagementPageHandler() {}
void AppManagementPageHandler::OnPinnedChanged(const std::string& app_id,
bool pinned) {
- apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile_);
+ apps::AppServiceProxy* proxy =
+ apps::AppServiceProxyFactory::GetForProfile(profile_);
// TODO(crbug.com/826982): revisit pending decision on AppServiceProxy in
// incognito
@@ -87,7 +90,8 @@ void AppManagementPageHandler::OnPinnedChanged(const std::string& app_id,
}
void AppManagementPageHandler::GetApps(GetAppsCallback callback) {
- apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile_);
+ apps::AppServiceProxy* proxy =
+ apps::AppServiceProxyFactory::GetForProfile(profile_);
// TODO(crbug.com/826982): revisit pending decision on AppServiceProxy in
// incognito
@@ -136,7 +140,8 @@ void AppManagementPageHandler::SetPinned(const std::string& app_id,
void AppManagementPageHandler::SetPermission(
const std::string& app_id,
apps::mojom::PermissionPtr permission) {
- apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile_);
+ apps::AppServiceProxy* proxy =
+ apps::AppServiceProxyFactory::GetForProfile(profile_);
// TODO(crbug.com/826982): revisit pending decision on AppServiceProxy in
// incognito
@@ -147,7 +152,8 @@ void AppManagementPageHandler::SetPermission(
}
void AppManagementPageHandler::Uninstall(const std::string& app_id) {
- apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile_);
+ apps::AppServiceProxy* proxy =
+ apps::AppServiceProxyFactory::GetForProfile(profile_);
// TODO(crbug.com/826982): revisit pending decision on AppServiceProxy in
// incognito
@@ -158,7 +164,8 @@ void AppManagementPageHandler::Uninstall(const std::string& app_id) {
}
void AppManagementPageHandler::OpenNativeSettings(const std::string& app_id) {
- apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile_);
+ apps::AppServiceProxy* proxy =
+ apps::AppServiceProxyFactory::GetForProfile(profile_);
// TODO(crbug.com/826982): revisit pending decision on AppServiceProxy in
// incognito
diff --git a/chromium/chrome/browser/ui/webui/app_management/app_management_ui.cc b/chromium/chrome/browser/ui/webui/app_management/app_management_ui.cc
index 2c9df00855e..b435f1b4290 100644
--- a/chromium/chrome/browser/ui/webui/app_management/app_management_ui.cc
+++ b/chromium/chrome/browser/ui/webui/app_management/app_management_ui.cc
@@ -26,7 +26,7 @@ namespace {
content::WebUIDataSource* CreateAppManagementUIHTMLSource(Profile* profile) {
content::WebUIDataSource* source =
- content::WebUIDataSource::Create(chrome::kChromeUIAppLauncherPageHost);
+ content::WebUIDataSource::Create(chrome::kChromeUIAppManagementHost);
source->AddLocalizedString("appListTitle", IDS_APP_MANAGEMENT_APP_LIST_TITLE);
source->AddLocalizedString("appNoPermission",
diff --git a/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.cc b/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.cc
index 307117aa58b..9c03d9fa3fe 100644
--- a/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.cc
@@ -5,12 +5,19 @@
#include "chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.h"
#include "base/bind.h"
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/bookmarks/bookmark_model_factory.h"
+#include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/pref_names.h"
+#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
+#include "components/bookmarks/managed/managed_bookmark_service.h"
+#include "components/bookmarks/test/bookmark_test_helpers.h"
#include "components/prefs/pref_service.h"
+#include "components/user_prefs/user_prefs.h"
BookmarksBrowserTest::BookmarksBrowserTest() {}
@@ -39,6 +46,48 @@ void BookmarksBrowserTest::SetCanEditBookmarks(bool canEdit) {
bookmarks::prefs::kEditBookmarksEnabled, canEdit);
}
+void BookmarksBrowserTest::SetupExtensionAPITest() {
+ // Add managed bookmarks.
+ Profile* profile = browser()->profile();
+ bookmarks::BookmarkModel* model =
+ BookmarkModelFactory::GetForBrowserContext(profile);
+ bookmarks::ManagedBookmarkService* managed =
+ ManagedBookmarkServiceFactory::GetForProfile(profile);
+ bookmarks::test::WaitForBookmarkModelToLoad(model);
+
+ base::ListValue list;
+ std::unique_ptr<base::DictionaryValue> node(new base::DictionaryValue());
+ node->SetString("name", "Managed Bookmark");
+ node->SetString("url", "http://www.chromium.org");
+ list.Append(std::move(node));
+ node.reset(new base::DictionaryValue());
+ node->SetString("name", "Managed Folder");
+ node->Set("children", std::make_unique<base::ListValue>());
+ list.Append(std::move(node));
+ profile->GetPrefs()->Set(bookmarks::prefs::kManagedBookmarks, list);
+ ASSERT_EQ(2, managed->managed_node()->child_count());
+}
+
+void BookmarksBrowserTest::SetupExtensionAPIEditDisabledTest() {
+ Profile* profile = browser()->profile();
+
+ // Provide some testing data here, since bookmark editing will be disabled
+ // within the extension.
+ bookmarks::BookmarkModel* model =
+ BookmarkModelFactory::GetForBrowserContext(profile);
+ bookmarks::test::WaitForBookmarkModelToLoad(model);
+ const bookmarks::BookmarkNode* bar = model->bookmark_bar_node();
+ const bookmarks::BookmarkNode* folder =
+ model->AddFolder(bar, 0, base::ASCIIToUTF16("Folder"));
+ model->AddURL(bar, 1, base::ASCIIToUTF16("AAA"),
+ GURL("http://aaa.example.com"));
+ model->AddURL(folder, 0, base::ASCIIToUTF16("BBB"),
+ GURL("http://bbb.example.com"));
+
+ PrefService* prefs = user_prefs::UserPrefs::Get(profile);
+ prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false);
+}
+
void BookmarksBrowserTest::HandleSetIncognitoAvailability(
const base::ListValue* args) {
AllowJavascript();
diff --git a/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.h b/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.h
index d15170bba9c..fe2bc149a2e 100644
--- a/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.h
+++ b/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_browsertest.h
@@ -17,6 +17,9 @@ class BookmarksBrowserTest : public WebUIBrowserTest,
void SetIncognitoAvailability(int availability);
void SetCanEditBookmarks(bool canEdit);
+ void SetupExtensionAPITest();
+ void SetupExtensionAPIEditDisabledTest();
+
private:
void HandleSetIncognitoAvailability(const base::ListValue* args);
void HandleSetCanEditBookmarks(const base::ListValue* args);
diff --git a/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc b/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc
index 0542e022aea..dd095e0a904 100644
--- a/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc
+++ b/chromium/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc
@@ -47,8 +47,8 @@ content::WebUIDataSource* CreateBookmarksUIHTMLSource(Profile* profile) {
// Build an Accelerator to describe undo shortcut
// NOTE: the undo shortcut is also defined in bookmarks/command_manager.js
- // TODO(b/893033): de-duplicate shortcut by moving all shortcut definitions
- // from JS to C++.
+ // TODO(crbug/893033): de-duplicate shortcut by moving all shortcut
+ // definitions from JS to C++.
ui::Accelerator undoAccelerator(ui::VKEY_Z, ui::EF_PLATFORM_ACCELERATOR);
source->AddString("undoDescription", l10n_util::GetStringFUTF16(
IDS_BOOKMARK_BAR_UNDO_DESCRIPTION,
@@ -122,10 +122,6 @@ content::WebUIDataSource* CreateBookmarksUIHTMLSource(Profile* profile) {
IDS_BOOKMARK_MANAGER_SEARCH_BUTTON);
AddLocalizedString(source, "sidebarAxLabel",
IDS_BOOKMARK_MANAGER_SIDEBAR_AX_LABEL);
- AddLocalizedString(source, "sidebarNodeCollapseAxLabel",
- IDS_BOOKMARK_MANAGER_SIDEBAR_NODE_COLLAPSE_AX_LABEL);
- AddLocalizedString(source, "sidebarNodeExpandAxLabel",
- IDS_BOOKMARK_MANAGER_SIDEBAR_NODE_EXPAND_AX_LABEL);
AddLocalizedString(source, "searchCleared", IDS_SEARCH_CLEARED);
AddLocalizedString(source, "searchResults", IDS_SEARCH_RESULTS);
AddLocalizedString(source, "saveEdit", IDS_SAVE);
@@ -197,9 +193,6 @@ content::WebUIDataSource* CreateBookmarksUIHTMLSource(Profile* profile) {
source->AddResourcePath("store_client.html", IDR_BOOKMARKS_STORE_CLIENT_HTML);
source->AddResourcePath("store_client.js", IDR_BOOKMARKS_STORE_CLIENT_JS);
source->AddResourcePath("strings.html", IDR_BOOKMARKS_STRINGS_HTML);
- source->AddResourcePath("toast_manager.html",
- IDR_BOOKMARKS_TOAST_MANAGER_HTML);
- source->AddResourcePath("toast_manager.js", IDR_BOOKMARKS_TOAST_MANAGER_JS);
source->AddResourcePath("toolbar.html", IDR_BOOKMARKS_TOOLBAR_HTML);
source->AddResourcePath("toolbar.js", IDR_BOOKMARKS_TOOLBAR_JS);
source->AddResourcePath("util.html", IDR_BOOKMARKS_UTIL_HTML);
diff --git a/chromium/chrome/browser/ui/webui/browser_switcher/OWNERS b/chromium/chrome/browser/ui/webui/browser_switcher/OWNERS
index 3bfa6d85787..02916cd005d 100644
--- a/chromium/chrome/browser/ui/webui/browser_switcher/OWNERS
+++ b/chromium/chrome/browser/ui/webui/browser_switcher/OWNERS
@@ -1,2 +1,4 @@
pastarmovj@chromium.org
nicolaso@chromium.org
+
+# COMPONENT: Enterprise>BrowserSwitcher
diff --git a/chromium/chrome/browser/ui/webui/browser_switcher/browser_switch_ui.cc b/chromium/chrome/browser/ui/webui/browser_switcher/browser_switch_ui.cc
index 9f5fd6a0119..55116062ce6 100644
--- a/chromium/chrome/browser/ui/webui/browser_switcher/browser_switch_ui.cc
+++ b/chromium/chrome/browser/ui/webui/browser_switcher/browser_switch_ui.cc
@@ -29,6 +29,7 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
@@ -71,16 +72,38 @@ content::WebUIDataSource* CreateBrowserSwitchUIHTMLSource(
auto* service = GetBrowserSwitcherService(web_ui);
source->AddInteger("launchDelay", service->prefs().GetDelay());
- source->AddLocalizedString("countdownTitle",
- IDS_ABOUT_BROWSER_SWITCH_COUNTDOWN_TITLE);
- source->AddLocalizedString("description",
- IDS_ABOUT_BROWSER_SWITCH_DESCRIPTION);
- source->AddLocalizedString("errorTitle",
- IDS_ABOUT_BROWSER_SWITCH_ERROR_TITLE);
- source->AddLocalizedString("genericError",
- IDS_ABOUT_BROWSER_SWITCH_GENERIC_ERROR);
- source->AddLocalizedString("openingTitle",
- IDS_ABOUT_BROWSER_SWITCH_OPENING_TITLE);
+ std::string browser_name = service->driver()->GetBrowserName();
+ source->AddString("browserName", browser_name);
+
+ if (browser_name.empty()) {
+ // Browser name could not be auto-detected. Say "alternative browser"
+ // instead of naming the browser.
+ source->AddLocalizedString(
+ "countdownTitle",
+ IDS_ABOUT_BROWSER_SWITCH_COUNTDOWN_TITLE_UNKNOWN_BROWSER);
+ source->AddLocalizedString(
+ "description", IDS_ABOUT_BROWSER_SWITCH_DESCRIPTION_UNKNOWN_BROWSER);
+ source->AddLocalizedString(
+ "errorTitle", IDS_ABOUT_BROWSER_SWITCH_ERROR_TITLE_UNKNOWN_BROWSER);
+ source->AddLocalizedString(
+ "genericError", IDS_ABOUT_BROWSER_SWITCH_GENERIC_ERROR_UNKNOWN_BROWSER);
+ source->AddLocalizedString(
+ "openingTitle", IDS_ABOUT_BROWSER_SWITCH_OPENING_TITLE_UNKNOWN_BROWSER);
+ } else {
+ // Browser name was auto-detected. Name it in the text.
+ source->AddLocalizedString(
+ "countdownTitle",
+ IDS_ABOUT_BROWSER_SWITCH_COUNTDOWN_TITLE_KNOWN_BROWSER);
+ source->AddLocalizedString(
+ "description", IDS_ABOUT_BROWSER_SWITCH_DESCRIPTION_KNOWN_BROWSER);
+ source->AddLocalizedString(
+ "errorTitle", IDS_ABOUT_BROWSER_SWITCH_ERROR_TITLE_KNOWN_BROWSER);
+ source->AddLocalizedString(
+ "genericError", IDS_ABOUT_BROWSER_SWITCH_GENERIC_ERROR_KNOWN_BROWSER);
+ source->AddLocalizedString(
+ "openingTitle", IDS_ABOUT_BROWSER_SWITCH_OPENING_TITLE_KNOWN_BROWSER);
+ }
+
source->AddLocalizedString("protocolError",
IDS_ABOUT_BROWSER_SWITCH_PROTOCOL_ERROR);
source->AddLocalizedString("title", IDS_ABOUT_BROWSER_SWITCH_TITLE);
diff --git a/chromium/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chromium/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 14811cf7131..c89eb5b38bb 100644
--- a/chromium/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chromium/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/ui/webui/autofill_internals_ui.h"
#include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h"
#include "chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.h"
+#include "chrome/browser/ui/webui/chromeos/insession_password_change_ui.h"
#include "chrome/browser/ui/webui/components_ui.h"
#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
#include "chrome/browser/ui/webui/crashes_ui.h"
@@ -52,7 +53,7 @@
#include "chrome/browser/ui/webui/policy_ui.h"
#include "chrome/browser/ui/webui/predictors/predictors_ui.h"
#include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h"
-#include "chrome/browser/ui/webui/settings/md_settings_ui.h"
+#include "chrome/browser/ui/webui/settings/settings_ui.h"
#include "chrome/browser/ui/webui/settings_utils.h"
#include "chrome/browser/ui/webui/signin_internals_ui.h"
#include "chrome/browser/ui/webui/supervised_user_internals_ui.h"
@@ -66,6 +67,7 @@
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/webui_url_constants.h"
#include "components/dom_distiller/core/dom_distiller_constants.h"
#include "components/dom_distiller/core/dom_distiller_features.h"
#include "components/dom_distiller/core/dom_distiller_service.h"
@@ -149,6 +151,8 @@
#include "chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_ui.h"
#include "chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h"
#include "chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.h"
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.h"
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.h"
#include "chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.h"
#include "chrome/browser/ui/webui/chromeos/cryptohome_ui.h"
#include "chrome/browser/ui/webui/chromeos/drive_internals_ui.h"
@@ -156,7 +160,6 @@
#include "chrome/browser/ui/webui/chromeos/internet_config_dialog.h"
#include "chrome/browser/ui/webui/chromeos/internet_detail_dialog.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
-#include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h"
#include "chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.h"
#include "chrome/browser/ui/webui/chromeos/network_ui.h"
#include "chrome/browser/ui/webui/chromeos/power_ui.h"
@@ -166,6 +169,7 @@
#include "chrome/browser/ui/webui/chromeos/smb_shares/smb_credentials_dialog.h"
#include "chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.h"
#include "chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_ui.h"
+#include "chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h"
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
#include "chromeos/components/multidevice/debug_webui/proximity_auth_ui.h"
#include "chromeos/components/multidevice/debug_webui/url_constants.h"
@@ -185,10 +189,10 @@
#include "chrome/browser/ui/sync/sync_promo_ui.h"
#include "chrome/browser/ui/webui/browser_switcher/browser_switch_ui.h"
#include "chrome/browser/ui/webui/signin/inline_login_ui.h"
-#include "chrome/browser/ui/webui/signin/md_user_manager_ui.h"
#include "chrome/browser/ui/webui/signin/signin_email_confirmation_ui.h"
#include "chrome/browser/ui/webui/signin/signin_error_ui.h"
#include "chrome/browser/ui/webui/signin/sync_confirmation_ui.h"
+#include "chrome/browser/ui/webui/signin/user_manager_ui.h"
#include "chrome/browser/ui/webui/welcome/welcome_ui.h"
#endif
@@ -226,10 +230,8 @@
#include "extensions/common/manifest.h"
#endif
-#if defined(SAFE_BROWSING_DB_LOCAL)
-#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
+#if defined(FULL_SAFE_BROWSING)
#include "chrome/browser/ui/webui/reset_password/reset_password_ui.h"
-#include "components/safe_browsing/features.h"
#endif
using content::WebUI;
@@ -428,7 +430,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
***************************************************************************/
#if !defined(OS_ANDROID)
if (AppManagementUI::IsEnabled() &&
- url.host_piece() == chrome::kChromeUIAppLauncherPageHost && profile &&
+ url.host_piece() == chrome::kChromeUIAppManagementHost && profile &&
!profile->IsGuestSession()) {
return &NewWebUI<AppManagementUI>;
}
@@ -449,6 +451,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
}
if (profile->IsGuestSession() &&
(url.host_piece() == chrome::kChromeUIAppLauncherPageHost ||
+ url.host_piece() == chrome::kChromeUIAppManagementHost ||
url.host_piece() == chrome::kChromeUIBookmarksHost ||
url.host_piece() == chrome::kChromeUIHistoryHost ||
url.host_piece() == chrome::kChromeUIExtensionsHost)) {
@@ -467,7 +470,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<NewTabUI>;
// Settings are implemented with native UI elements on Android.
if (url.host_piece() == chrome::kChromeUISettingsHost)
- return &NewWebUI<settings::MdSettingsUI>;
+ return &NewWebUI<settings::SettingsUI>;
if (url.host_piece() == chrome::kChromeUIExtensionsHost)
return &NewWebUI<extensions::ExtensionsUI>;
if (url.host_piece() == chrome::kChromeUIHistoryHost)
@@ -487,10 +490,19 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<SetAsDefaultBrowserUI>;
#endif
#if defined(OS_CHROMEOS)
+ if (url.host_piece() == chrome::kChromeUIPasswordChangeHost) {
+ if (!profile->GetPrefs()->GetBoolean(
+ prefs::kSamlInSessionPasswordChangeEnabled)) {
+ return nullptr;
+ }
+ return &NewWebUI<chromeos::InSessionPasswordChangeUI>;
+ }
if (url.host_piece() == chrome::kChromeUIAccountManagerWelcomeHost)
return &NewWebUI<chromeos::AccountManagerWelcomeUI>;
if (url.host_piece() == chrome::kChromeUIBluetoothPairingHost)
return &NewWebUI<chromeos::BluetoothPairingDialogUI>;
+ if (url.host_piece() == chrome::kChromeUICellularSetupHost)
+ return &NewWebUI<chromeos::cellular_setup::CellularSetupDialogUI>;
if (url.host_piece() == chrome::kChromeUICertificateManagerHost)
return &NewWebUI<chromeos::CertificateManagerDialogUI>;
if (url.host_piece() == chrome::kChromeUICryptohomeHost)
@@ -500,13 +512,15 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
if (url.host_piece() == chrome::kChromeUIFirstRunHost)
return &NewWebUI<chromeos::FirstRunUI>;
if (url.host_piece() == chrome::kChromeUIMobileSetupHost)
- return &NewWebUI<chromeos::MobileSetupUI>;
+ return &NewWebUI<chromeos::cellular_setup::MobileSetupUI>;
if (url.host_piece() == chrome::kChromeUIMultiDeviceSetupHost)
return &NewWebUI<chromeos::multidevice_setup::MultiDeviceSetupDialogUI>;
if (url.host_piece() == chrome::kChromeUINetworkHost)
return &NewWebUI<chromeos::NetworkUI>;
if (url.host_piece() == chrome::kChromeUIOobeHost)
return &NewWebUI<chromeos::OobeUI>;
+ if (url.host_piece() == chrome::kChromeUIOSSettingsHost)
+ return &NewWebUI<chromeos::settings::OSSettingsUI>;
if (url.host_piece() == chrome::kChromeUIPowerHost)
return &NewWebUI<chromeos::PowerUI>;
if (url.host_piece() == chromeos::multidevice::kChromeUIProximityAuthHost)
@@ -579,7 +593,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
#endif // defined(OS_ANDROID)
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
if (url.host_piece() == chrome::kChromeUIMdUserManagerHost)
- return &NewWebUI<MDUserManagerUI>;
+ return &NewWebUI<UserManagerUI>;
if (url.host_piece() == chrome::kChromeUISigninErrorHost &&
(!profile->IsOffTheRecord() ||
profile->GetOriginalProfile()->IsSystemProfile()))
@@ -687,14 +701,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<MediaEngagementUI>;
}
-#if defined(SAFE_BROWSING_DB_LOCAL)
- bool enable_reset_password =
- base::FeatureList::IsEnabled(
- safe_browsing::kForceEnableResetPasswordWebUI) ||
- safe_browsing::ChromePasswordProtectionService::
- IsPasswordReuseProtectionConfigured(profile);
- if (url.host_piece() == chrome::kChromeUIResetPasswordHost &&
- enable_reset_password) {
+#if defined(FULL_SAFE_BROWSING)
+ if (url.host_piece() == chrome::kChromeUIResetPasswordHost) {
return &NewWebUI<ResetPasswordUI>;
}
#endif
@@ -891,6 +899,10 @@ base::RefCountedMemory* ChromeWebUIControllerFactory::GetFaviconResourceBytes(
if (page_url.host_piece() == chrome::kChromeUIManagementHost)
return ManagementUI::GetFaviconResourceBytes(scale_factor);
+ // Android doesn't use the App Management page.
+ if (page_url.host_piece() == chrome::kChromeUIAppManagementHost)
+ return settings_utils::GetFaviconResourceBytes(scale_factor);
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
if (page_url.host_piece() == chrome::kChromeUIExtensionsHost) {
return extensions::ExtensionsUI::GetFaviconResourceBytes(scale_factor);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/OWNERS b/chromium/chrome/browser/ui/webui/chromeos/OWNERS
index 0c7e289e51e..d5176c55865 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/OWNERS
+++ b/chromium/chrome/browser/ui/webui/chromeos/OWNERS
@@ -4,5 +4,5 @@ satorux@chromium.org
stevenjb@chromium.org
xiyuan@chromium.org
-per-file network*=stevenjb@chromium.org
+per-file network*=file://chromeos/network/OWNERS
per-file drive_internals_ui.*=file://ui/file_manager/OWNERS
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc
index 5c276f89ff3..977f24ae326 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.cc
@@ -21,8 +21,8 @@ namespace chromeos {
namespace {
AccountManagerWelcomeDialog* g_dialog = nullptr;
-constexpr int kSigninDialogWidth = 600;
-constexpr int kSigninDialogHeight = 500;
+constexpr int kSigninDialogWidth = 768;
+constexpr int kSigninDialogHeight = 640;
constexpr int kMaxNumTimesShown = 1;
} // namespace
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc
index 10f0d45b755..22077439b60 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.cc
@@ -5,15 +5,24 @@
#include "chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.h"
#include "base/bind.h"
+#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/strings/grit/ui_strings.h"
namespace chromeos {
+namespace {
+
+constexpr char kAccountManagerLearnMoreURL[] =
+ "https://support.google.com/chromebook/?p=google_accounts";
+
+} // namespace
+
AccountManagerWelcomeUI::AccountManagerWelcomeUI(content::WebUI* web_ui)
: ui::WebDialogUI(web_ui), weak_factory_(this) {
content::WebUIDataSource* html_source = content::WebUIDataSource::Create(
@@ -28,8 +37,10 @@ AccountManagerWelcomeUI::AccountManagerWelcomeUI(content::WebUI* web_ui)
// Add localized strings.
html_source->AddLocalizedString("welcomeTitle",
IDS_ACCOUNT_MANAGER_WELCOME_TITLE);
- html_source->AddLocalizedString("welcomeMessage",
- IDS_ACCOUNT_MANAGER_WELCOME_TEXT);
+ html_source->AddString("welcomeMessage",
+ l10n_util::GetStringFUTF16(
+ IDS_ACCOUNT_MANAGER_WELCOME_TEXT,
+ base::ASCIIToUTF16(kAccountManagerLearnMoreURL)));
html_source->AddLocalizedString("okButton", IDS_APP_OK);
// Add required resources.
diff --git a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc
index 6aaa395f7a5..98c1e481487 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc
@@ -10,18 +10,39 @@
#include "ash/public/cpp/shell_window_ids.h"
#include "base/base64.h"
#include "base/bind.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
+#include "base/linux_util.h"
#include "base/memory/ref_counted_memory.h"
+#include "base/process/process_iterator.h"
+#include "base/strings/string_split.h"
+#include "base/strings/string_tokenizer.h"
+#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "base/values.h"
+#include "chrome/browser/chromeos/arc/tracing/arc_graphics_jank_detector.h"
+#include "chrome/browser/chromeos/arc/tracing/arc_system_model.h"
+#include "chrome/browser/chromeos/arc/tracing/arc_system_stat_collector.h"
#include "chrome/browser/chromeos/arc/tracing/arc_tracing_graphics_model.h"
#include "chrome/browser/chromeos/arc/tracing/arc_tracing_model.h"
+#include "chrome/browser/chromeos/file_manager/path_util.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
+#include "components/arc/arc_prefs.h"
+#include "components/arc/arc_util.h"
#include "components/exo/shell_surface_util.h"
-#include "components/exo/wm_helper_chromeos.h"
+#include "components/exo/surface.h"
+#include "components/exo/wm_helper.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/tracing_controller.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/codec/png_codec.h"
+#include "ui/views/widget/widget.h"
namespace chromeos {
@@ -30,35 +51,280 @@ namespace {
constexpr char kKeyIcon[] = "icon";
constexpr char kKeyTitle[] = "title";
constexpr char kKeyTasks[] = "tasks";
-constexpr char kTaskIdPrefix[] = "org.chromium.arc.";
-// Scans for all ARC windows and and extracts the title and optionally icon.
-void CreateTaskMap(aura::Window* window, base::DictionaryValue* tasks) {
- if (!window->IsVisible())
+constexpr char kLastTracingModelName[] = "last_tracing_model.json";
+
+// Maximum interval to display.
+constexpr base::TimeDelta kMaxIntervalToDisplay =
+ base::TimeDelta::FromSecondsD(3.0);
+
+base::FilePath GetLastTracingModelPath(Profile* profile) {
+ DCHECK(profile);
+ return file_manager::util::GetDownloadsFolderForProfile(profile).AppendASCII(
+ kLastTracingModelName);
+}
+
+std::pair<base::Value, std::string> MaybeLoadLastGraphicsModel(
+ const base::FilePath& last_model_path) {
+ std::string json_content;
+ if (!base::ReadFileToString(last_model_path, &json_content))
+ return std::make_pair(base::Value(), std::string());
+
+ base::Optional<base::Value> model = base::JSONReader::Read(json_content);
+ if (!model || !model->is_dict())
+ return std::make_pair(base::Value(), "Failed to read last tracing model");
+
+ arc::ArcTracingGraphicsModel graphics_model;
+ base::DictionaryValue* dictionary = nullptr;
+ model->GetAsDictionary(&dictionary);
+ if (!graphics_model.LoadFromValue(*dictionary))
+ return std::make_pair(base::Value(), "Failed to load last tracing model");
+
+ return std::make_pair(std::move(*model), "Loaded last tracing model");
+}
+
+class ProcessFilterPassAll : public base::ProcessFilter {
+ public:
+ ProcessFilterPassAll() = default;
+ ~ProcessFilterPassAll() override = default;
+
+ // base::ProcessFilter:
+ bool Includes(const base::ProcessEntry& process) const override {
+ return true;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ProcessFilterPassAll);
+};
+
+// Reads name of thread from /proc/pid/task/tid/status.
+bool ReadNameFromStatus(pid_t pid, pid_t tid, std::string* out_name) {
+ std::string status;
+ if (!base::ReadFileToString(base::FilePath(base::StringPrintf(
+ "/proc/%d/task/%d/status", pid, tid)),
+ &status)) {
+ return false;
+ }
+ base::StringTokenizer tokenizer(status, "\n");
+ while (tokenizer.GetNext()) {
+ base::StringPiece value_str(tokenizer.token_piece());
+ if (!value_str.starts_with("Name:"))
+ continue;
+ std::vector<base::StringPiece> split_value_str = base::SplitStringPiece(
+ value_str, "\t", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+ DCHECK_EQ(2U, split_value_str.size());
+ *out_name = split_value_str[1].as_string();
+ return true;
+ }
+
+ return false;
+}
+
+// Helper that clarifies thread and process names. Tracing events may not have
+// enough data for this. Also it determines the process pid the thread belongs
+// to.
+void UpdateThreads(arc::ArcSystemModel::ThreadMap* threads) {
+ ProcessFilterPassAll filter_pass_all;
+ base::ProcessIterator process_iterator(&filter_pass_all);
+
+ std::vector<pid_t> tids;
+ std::string name;
+ for (const auto& process : process_iterator.Snapshot()) {
+ tids.clear();
+ base::GetThreadsForProcess(process.pid(), &tids);
+ bool process_in_use = threads->find(process.pid()) != threads->end();
+ for (pid_t tid : tids) {
+ if (threads->find(tid) != threads->end()) {
+ process_in_use = true;
+ (*threads)[tid].pid = process.pid();
+ if (!ReadNameFromStatus(process.pid(), tid, &(*threads)[tid].name))
+ LOG(WARNING) << "Failed to update thread name " << tid;
+ }
+ }
+ if (process_in_use) {
+ (*threads)[process.pid()].pid = process.pid();
+ if (!ReadNameFromStatus(process.pid(), process.pid(),
+ &(*threads)[process.pid()].name)) {
+ LOG(WARNING) << "Failed to update process name " << process.pid();
+ }
+ }
+ }
+}
+
+std::pair<base::Value, std::string> BuildGraphicsModel(
+ const std::string& data,
+ base::DictionaryValue tasks_info,
+ std::unique_ptr<arc::ArcSystemStatCollector> system_stat_collector,
+ const base::TimeTicks& time_min,
+ const base::TimeTicks& time_max,
+ const base::FilePath& last_model_path) {
+ DCHECK(system_stat_collector);
+
+ arc::ArcTracingModel common_model;
+ const base::TimeTicks time_min_clamped =
+ std::max(time_min, time_max - kMaxIntervalToDisplay);
+ common_model.SetMinMaxTime(
+ (time_min_clamped - base::TimeTicks()).InMicroseconds(),
+ (time_max - base::TimeTicks()).InMicroseconds());
+
+ if (!common_model.Build(data))
+ return std::make_pair(base::Value(), "Failed to process tracing data");
+
+ system_stat_collector->Flush(time_min, time_max,
+ &common_model.system_model());
+
+ arc::ArcTracingGraphicsModel graphics_model;
+ if (!graphics_model.Build(common_model))
+ return std::make_pair(base::Value(), "Failed to build tracing model");
+
+ UpdateThreads(&graphics_model.system_model().thread_map());
+
+ std::unique_ptr<base::DictionaryValue> model = graphics_model.Serialize();
+ model->SetKey(kKeyTasks, std::move(tasks_info));
+
+ std::string json_content;
+ base::JSONWriter::WriteWithOptions(
+ *model, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json_content);
+ DCHECK(!json_content.empty());
+
+ if (!base::WriteFile(last_model_path, json_content.c_str(),
+ json_content.length())) {
+ LOG(ERROR) << "Failed serialize model to " << last_model_path.value()
+ << ".";
+ }
+
+ return std::make_pair(std::move(*model), "Tracing model is ready");
+}
+
+std::pair<base::Value, std::string> LoadGraphicsModel(
+ const std::string& json_text) {
+ arc::ArcTracingGraphicsModel graphics_model;
+ if (!graphics_model.LoadFromJson(json_text))
+ return std::make_pair(base::Value(), "Failed to load tracing model");
+
+ std::unique_ptr<base::DictionaryValue> model = graphics_model.Serialize();
+ return std::make_pair(std::move(*model), "Tracing model is loaded");
+}
+
+} // namespace
+
+ArcGraphicsTracingHandler::ArcGraphicsTracingHandler()
+ : wm_helper_(exo::WMHelper::HasInstance() ? exo::WMHelper::GetInstance()
+ : nullptr),
+ weak_ptr_factory_(this) {
+ DCHECK(wm_helper_);
+
+ aura::Window* const current_active = wm_helper_->GetActiveWindow();
+ if (current_active) {
+ OnWindowActivated(ActivationReason::ACTIVATION_CLIENT /* not used */,
+ current_active, nullptr);
+ }
+ wm_helper_->AddActivationObserver(this);
+}
+
+ArcGraphicsTracingHandler::~ArcGraphicsTracingHandler() {
+ wm_helper_->RemoveActivationObserver(this);
+ DiscardActiveArcWindow();
+
+ if (tracing_active_)
+ StopTracing();
+}
+
+void ArcGraphicsTracingHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "ready", base::BindRepeating(&ArcGraphicsTracingHandler::HandleReady,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "setStopOnJank",
+ base::BindRepeating(&ArcGraphicsTracingHandler::HandleSetStopOnJank,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "loadFromText",
+ base::BindRepeating(&ArcGraphicsTracingHandler::HandleLoadFromText,
+ base::Unretained(this)));
+}
+
+void ArcGraphicsTracingHandler::OnWindowActivated(ActivationReason reason,
+ aura::Window* gained_active,
+ aura::Window* lost_active) {
+ // Handle ARC current active window if any.
+ DiscardActiveArcWindow();
+
+ if (!gained_active)
return;
- // ARC window is top level window, all its parents have type not set.
- if (window->type() == aura::client::WINDOW_TYPE_UNKNOWN) {
- for (aura::Window* child_window : window->children())
- CreateTaskMap(child_window, tasks);
+ active_task_id_ = arc::GetWindowTaskId(gained_active);
+ if (active_task_id_ <= 0)
return;
+
+ arc_active_window_ = gained_active;
+ arc_active_window_->AddObserver(this);
+ arc_active_window_->AddPreTargetHandler(this);
+
+ // Limit tracing by newly activated window.
+ tracing_time_min_ = TRACE_TIME_TICKS_NOW();
+ jank_detector_ =
+ std::make_unique<arc::ArcGraphicsJankDetector>(base::BindRepeating(
+ &ArcGraphicsTracingHandler::OnJankDetected, base::Unretained(this)));
+
+ UpdateActiveArcWindowInfo();
+
+ exo::Surface* const surface = exo::GetShellMainSurface(arc_active_window_);
+ DCHECK(surface);
+ surface->SetCommitCallback(base::BindRepeating(
+ &ArcGraphicsTracingHandler::OnCommit, weak_ptr_factory_.GetWeakPtr()));
+}
+
+void ArcGraphicsTracingHandler::OnCommit(exo::Surface* surface) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ jank_detector_->OnSample();
+}
+
+void ArcGraphicsTracingHandler::OnJankDetected(const base::Time& timestamp) {
+ VLOG(1) << "Jank detected " << timestamp;
+ if (tracing_active_ && stop_on_jank_) {
+ StopTracing();
+ Activate();
}
+}
- // Verifies if this is top-level ARC window.
- const std::string* arc_app_id = exo::GetShellApplicationId(window);
- if (!arc_app_id)
+void ArcGraphicsTracingHandler::OnWindowPropertyChanged(aura::Window* window,
+ const void* key,
+ intptr_t old) {
+ DCHECK_EQ(arc_active_window_, window);
+ if (key != aura::client::kAppIconKey)
return;
- // Root surface may not have task id.
- const size_t prefix_pos = arc_app_id->find(kTaskIdPrefix);
- if (prefix_pos)
+ UpdateActiveArcWindowInfo();
+}
+
+void ArcGraphicsTracingHandler::OnWindowDestroying(aura::Window* window) {
+ DCHECK_EQ(arc_active_window_, window);
+ DiscardActiveArcWindow();
+}
+
+void ArcGraphicsTracingHandler::OnKeyEvent(ui::KeyEvent* event) {
+ DCHECK(arc_active_window_);
+ if (event->type() != ui::ET_KEY_RELEASED || event->key_code() != ui::VKEY_G ||
+ !event->IsControlDown() || !event->IsShiftDown()) {
return;
+ }
+ if (tracing_active_) {
+ StopTracing();
+ Activate();
+ } else {
+ StartTracing();
+ }
+}
+void ArcGraphicsTracingHandler::UpdateActiveArcWindowInfo() {
+ DCHECK(arc_active_window_);
base::DictionaryValue task_information;
- task_information.SetKey(kKeyTitle, base::Value(window->GetTitle()));
+ task_information.SetKey(kKeyTitle,
+ base::Value(arc_active_window_->GetTitle()));
const gfx::ImageSkia* app_icon =
- window->GetProperty(aura::client::kAppIconKey);
+ arc_active_window_->GetProperty(aura::client::kAppIconKey);
if (app_icon) {
std::vector<unsigned char> png_data;
if (gfx::PNGCodec::EncodeBGRASkBitmap(
@@ -72,74 +338,91 @@ void CreateTaskMap(aura::Window* window, base::DictionaryValue* tasks) {
}
}
- tasks->SetKey(arc_app_id->c_str() + strlen(kTaskIdPrefix),
- std::move(task_information));
+ tasks_info_.SetKey(base::StringPrintf("%d", active_task_id_),
+ std::move(task_information));
}
-std::unique_ptr<base::Value> BuildGraphicsModel(const std::string& data) {
- arc::ArcTracingModel common_model;
- if (!common_model.Build(data)) {
- LOG(ERROR) << "Failed to build common model";
- return nullptr;
- }
-
- arc::ArcTracingGraphicsModel graphics_model;
- if (!graphics_model.Build(common_model)) {
- LOG(ERROR) << "Failed to build graphic buffers model";
- return nullptr;
- }
+void ArcGraphicsTracingHandler::DiscardActiveArcWindow() {
+ if (!arc_active_window_)
+ return;
- std::unique_ptr<base::DictionaryValue> model = graphics_model.Serialize();
- base::DictionaryValue tasks;
- // Scan for ARC++ windows
- // TODO(https://crbug.com/887156): Fix the mash.
- if (!features::IsMultiProcessMash()) {
- CreateTaskMap(
- exo::WMHelperChromeOS::GetInstance()->GetPrimaryDisplayContainer(
- ash::kShellWindowId_DefaultContainer),
- &tasks);
- }
- model->SetKey(kKeyTasks, std::move(tasks));
+ exo::Surface* const surface = exo::GetShellMainSurface(arc_active_window_);
+ DCHECK(surface);
+ surface->SetCommitCallback(exo::Surface::CommitCallback());
- return model;
+ arc_active_window_->RemovePreTargetHandler(this);
+ arc_active_window_->RemoveObserver(this);
+ jank_detector_.reset();
+ arc_active_window_ = nullptr;
}
-} // namespace
-
-ArcGraphicsTracingHandler::ArcGraphicsTracingHandler()
- : weak_ptr_factory_(this) {}
+void ArcGraphicsTracingHandler::Activate() {
+ aura::Window* const window =
+ web_ui()->GetWebContents()->GetTopLevelNativeWindow();
+ if (!window) {
+ LOG(ERROR) << "Failed to activate, no top level window.";
+ return;
+ }
-ArcGraphicsTracingHandler::~ArcGraphicsTracingHandler() = default;
+ views::Widget* const widget = views::Widget::GetWidgetForNativeWindow(window);
+ if (!widget) {
+ LOG(ERROR) << "Failed to activate, no widget for top level window.";
+ return;
+ }
-void ArcGraphicsTracingHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "startTracing",
- base::BindRepeating(&ArcGraphicsTracingHandler::HandleStartTracing,
- base::Unretained(this)));
+ widget->Activate();
}
-void ArcGraphicsTracingHandler::StartTracing(double duration) {
+void ArcGraphicsTracingHandler::StartTracing() {
+ SetStatus("Collecting samples...");
+
base::trace_event::TraceConfig config(
"-*,exo,viz,toplevel,gpu,cc,blink,disabled-by-default-android "
"gfx,disabled-by-default-android hal",
base::trace_event::RECORD_CONTINUOUSLY);
config.EnableSystrace();
+ tracing_active_ = true;
+ if (jank_detector_)
+ jank_detector_->Reset();
+ system_stat_colletor_ = std::make_unique<arc::ArcSystemStatCollector>();
+ system_stat_colletor_->Start(kMaxIntervalToDisplay);
content::TracingController::GetInstance()->StartTracing(
config, base::BindOnce(&ArcGraphicsTracingHandler::OnTracingStarted,
- weak_ptr_factory_.GetWeakPtr(), duration));
+ weak_ptr_factory_.GetWeakPtr()));
}
void ArcGraphicsTracingHandler::StopTracing() {
- content::TracingController::GetInstance()->StopTracing(
- content::TracingController::CreateStringEndpoint(
- base::BindRepeating(&ArcGraphicsTracingHandler::OnTracingStopped,
- weak_ptr_factory_.GetWeakPtr())));
+ SetStatus("Building model...");
+
+ tracing_active_ = false;
+
+ tracing_time_max_ = TRACE_TIME_TICKS_NOW();
+
+ if (system_stat_colletor_)
+ system_stat_colletor_->Stop();
+
+ content::TracingController* const controller =
+ content::TracingController::GetInstance();
+
+ if (!controller->IsTracing())
+ return;
+
+ controller->StopTracing(content::TracingController::CreateStringEndpoint(
+ base::BindRepeating(&ArcGraphicsTracingHandler::OnTracingStopped,
+ weak_ptr_factory_.GetWeakPtr())));
+}
+
+void ArcGraphicsTracingHandler::SetStatus(const std::string& status) {
+ AllowJavascript();
+ CallJavascriptFunction("cr.ArcGraphicsTracing.setStatus",
+ base::Value(status.empty() ? "Idle" : status));
}
-void ArcGraphicsTracingHandler::OnTracingStarted(double duration) {
- tracing_timer_.Start(FROM_HERE, base::TimeDelta::FromSecondsD(duration),
- base::BindOnce(&ArcGraphicsTracingHandler::StopTracing,
- base::Unretained(this)));
+void ArcGraphicsTracingHandler::OnTracingStarted() {
+ tasks_info_.Clear();
+ UpdateActiveArcWindowInfo();
+
+ tracing_time_min_ = TRACE_TIME_TICKS_NOW();
}
void ArcGraphicsTracingHandler::OnTracingStopped(
@@ -147,35 +430,60 @@ void ArcGraphicsTracingHandler::OnTracingStopped(
base::RefCountedString* trace_data) {
std::string string_data;
string_data.swap(trace_data->data());
-
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
- base::BindOnce(&BuildGraphicsModel, std::move(string_data)),
+ base::BindOnce(&BuildGraphicsModel, std::move(string_data),
+ std::move(tasks_info_), std::move(system_stat_colletor_),
+ tracing_time_min_, tracing_time_max_,
+ GetLastTracingModelPath(Profile::FromWebUI(web_ui()))),
base::BindOnce(&ArcGraphicsTracingHandler::OnGraphicsModelReady,
weak_ptr_factory_.GetWeakPtr()));
}
void ArcGraphicsTracingHandler::OnGraphicsModelReady(
- std::unique_ptr<base::Value> model) {
- if (!model)
+ std::pair<base::Value, std::string> result) {
+ SetStatus(result.second);
+
+ if (!result.first.is_dict())
return;
- AllowJavascript();
- CallJavascriptFunction("cr.ArcGraphicsTracing.setModel", *model);
+
+ CallJavascriptFunction("cr.ArcGraphicsTracing.setModel",
+ std::move(result.first));
+}
+
+void ArcGraphicsTracingHandler::HandleReady(const base::ListValue* args) {
+ base::PostTaskWithTraitsAndReplyWithResult(
+ FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
+ base::BindOnce(&MaybeLoadLastGraphicsModel,
+ GetLastTracingModelPath(Profile::FromWebUI(web_ui()))),
+ base::BindOnce(&ArcGraphicsTracingHandler::OnGraphicsModelReady,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void ArcGraphicsTracingHandler::HandleSetStopOnJank(
+ const base::ListValue* args) {
+ DCHECK_EQ(1U, args->GetSize());
+ if (!args->GetList()[0].is_bool()) {
+ LOG(ERROR) << "Invalid input";
+ return;
+ }
+ stop_on_jank_ = args->GetList()[0].GetBool();
}
-void ArcGraphicsTracingHandler::HandleStartTracing(
+void ArcGraphicsTracingHandler::HandleLoadFromText(
const base::ListValue* args) {
- DCHECK_EQ(2U, args->GetSize());
- if ((!args->GetList()[0].is_double() && !args->GetList()[0].is_int()) ||
- (!args->GetList()[1].is_double() && !args->GetList()[1].is_int())) {
+ DCHECK_EQ(1U, args->GetSize());
+ if (!args->GetList()[0].is_string()) {
LOG(ERROR) << "Invalid input";
return;
}
- const double delay = args->GetList()[0].GetDouble();
- const double duration = args->GetList()[1].GetDouble();
- tracing_timer_.Start(FROM_HERE, base::TimeDelta::FromSecondsD(delay),
- base::BindOnce(&ArcGraphicsTracingHandler::StartTracing,
- base::Unretained(this), duration));
+
+ base::PostTaskWithTraitsAndReplyWithResult(
+ FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
+ base::BindOnce(&LoadGraphicsModel,
+ std::move(args->GetList()[0].GetString())),
+ base::BindOnce(&ArcGraphicsTracingHandler::OnGraphicsModelReady,
+ weak_ptr_factory_.GetWeakPtr()));
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h
index 661a2cce01c..dc37db92a82 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h
@@ -5,22 +5,38 @@
#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_ARC_GRAPHICS_TRACING_ARC_GRAPHICS_TRACING_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_ARC_GRAPHICS_TRACING_ARC_GRAPHICS_TRACING_HANDLER_H_
+#include <map>
#include <memory>
#include <utility>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/timer/timer.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "ui/aura/window_observer.h"
+#include "ui/events/event_handler.h"
+#include "ui/wm/public/activation_change_observer.h"
+
+namespace arc {
+class ArcGraphicsJankDetector;
+class ArcSystemStatCollector;
+} // namespace arc
namespace base {
class ListValue;
class RefCountedString;
} // namespace base
+namespace exo {
+class Surface;
+class WMHelper;
+} // namespace exo
+
namespace chromeos {
-class ArcGraphicsTracingHandler : public content::WebUIMessageHandler {
+class ArcGraphicsTracingHandler : public content::WebUIMessageHandler,
+ public wm::ActivationChangeObserver,
+ public aura::WindowObserver,
+ public ui::EventHandler {
public:
ArcGraphicsTracingHandler();
~ArcGraphicsTracingHandler() override;
@@ -28,22 +44,77 @@ class ArcGraphicsTracingHandler : public content::WebUIMessageHandler {
// content::WebUIMessageHandler:
void RegisterMessages() override;
+ // wm::ActivationChangeObserver:
+ void OnWindowActivated(ActivationReason reason,
+ aura::Window* gained_active,
+ aura::Window* lost_active) override;
+
+ // aura::WindowObserver:
+ void OnWindowPropertyChanged(aura::Window* window,
+ const void* key,
+ intptr_t old) override;
+ void OnWindowDestroying(aura::Window* window) override;
+
+ // ui::EventHandler:
+ void OnKeyEvent(ui::KeyEvent* event) override;
+
private:
- void StartTracing(double duration);
+ void Activate();
+ void StartTracing();
void StopTracing();
+ void SetStatus(const std::string& status);
- void OnTracingStarted(double duration);
+ void OnTracingStarted();
void OnTracingStopped(std::unique_ptr<const base::DictionaryValue> metadata,
base::RefCountedString* trace_data);
- // Called when graphics model is built and ready.
- void OnGraphicsModelReady(std::unique_ptr<base::Value> model);
+ // Called when graphics model is built or load. Extra string parameter
+ // contains a status. In case model cannot be built/load empty |base::Value|
+ // is returned.
+ void OnGraphicsModelReady(std::pair<base::Value, std::string> result);
// Handlers for calls from JS.
- void HandleStartTracing(const base::ListValue* args);
+ void HandleReady(const base::ListValue* args);
+ void HandleSetStopOnJank(const base::ListValue* args);
+ void HandleLoadFromText(const base::ListValue* args);
+
+ // Updates title and icon for the active ARC window.
+ void UpdateActiveArcWindowInfo();
+
+ // Stops tracking ARC window for janks.
+ void DiscardActiveArcWindow();
+
+ // Called from exo::Surface on commit.
+ void OnCommit(exo::Surface* surface);
+
+ // Called in case jank is detected in active ARC window.
+ void OnJankDetected(const base::Time& timestamp);
+
+ // Indicates that tracing was initiated by this handler.
+ bool tracing_active_ = false;
+
+ // Determines if tracing should stop in case jank is detected runtime.
+ bool stop_on_jank_ = true;
+
+ exo::WMHelper* const wm_helper_;
+ aura::Window* arc_active_window_ = nullptr;
+
+ // Time filter for tracing, since ARC++ window was activated last until
+ // tracing is stopped.
+ base::TimeTicks tracing_time_min_;
+ base::TimeTicks tracing_time_max_;
+
+ // Task id for current ARC window.
+ int active_task_id_ = -1;
+
+ // Used to detect janks for the currently active ARC++ window.
+ std::unique_ptr<arc::ArcGraphicsJankDetector> jank_detector_;
+
+ // Collects system stat runtime.
+ std::unique_ptr<arc::ArcSystemStatCollector> system_stat_colletor_;
- // To implement start/stop tracing.
- base::OneShotTimer tracing_timer_;
+ // Information about tasks, title and icon.
+ base::DictionaryValue tasks_info_;
base::WeakPtrFactory<ArcGraphicsTracingHandler> weak_ptr_factory_;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc
index e48715a0c66..95216bd990d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc
@@ -104,7 +104,7 @@ void AssistantOptInUI::OnDialogClosed() {
}
void AssistantOptInUI::Initialize() {
- js_calls_container_.ExecuteDeferredJSCalls();
+ js_calls_container_.ExecuteDeferredJSCalls(web_ui());
}
// AssistantOptInDialog
diff --git a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc
index 787a7a56b8c..abc7950d9dd 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc
@@ -14,11 +14,49 @@
#include "chromeos/services/assistant/public/features.h"
#include "components/arc/arc_prefs.h"
#include "components/consent_auditor/consent_auditor.h"
+#include "components/prefs/pref_service.h"
#include "components/user_manager/user_manager.h"
#include "services/identity/public/cpp/identity_manager.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
+namespace {
+
+bool IsPreferenceDefaultEnabled(const PrefService* prefs,
+ const std::string& path) {
+ const PrefService::Preference* pref = prefs->FindPreference(path);
+
+ if (pref->IsManaged())
+ return pref->GetValue()->GetBool();
+
+ if (pref->GetRecommendedValue())
+ return pref->GetRecommendedValue()->GetBool();
+
+ return true;
+}
+
+bool IsScreenContextDefaultEnabled(PrefService* prefs) {
+ return IsPreferenceDefaultEnabled(
+ prefs, arc::prefs::kVoiceInteractionContextEnabled);
+}
+
+bool IsScreenContextToggleDisabled(PrefService* prefs) {
+ return prefs->IsManagedPreference(
+ arc::prefs::kVoiceInteractionContextEnabled);
+}
+
+bool IsHotwordDefaultEnabled(PrefService* prefs) {
+ return IsPreferenceDefaultEnabled(
+ prefs, arc::prefs::kVoiceInteractionHotwordEnabled);
+}
+
+bool IsHotwordToggleDisabled(PrefService* prefs) {
+ return prefs->IsManagedPreference(
+ arc::prefs::kVoiceInteractionHotwordEnabled);
+}
+
+} // namespace
+
namespace chromeos {
void RecordAssistantOptInStatus(AssistantOptInFlowStatus status) {
@@ -106,11 +144,11 @@ base::Value CreateDisclosureData(const SettingZippyList& disclosure_list) {
// Helper method to create get more screen data.
base::Value CreateGetMoreData(bool email_optin_needed,
- const assistant::EmailOptInUi& email_optin_ui) {
+ const assistant::EmailOptInUi& email_optin_ui,
+ PrefService* prefs) {
base::Value get_more_data(base::Value::Type::LIST);
- if (!base::FeatureList::IsEnabled(
- assistant::features::kAssistantVoiceMatch)) {
+ if (!IsVoiceMatchEnabled(prefs)) {
// Process hotword data.
base::Value hotword_data(base::Value::Type::DICTIONARY);
hotword_data.SetKey("id", base::Value("hotword"));
@@ -120,7 +158,10 @@ base::Value CreateGetMoreData(bool email_optin_needed,
hotword_data.SetKey(
"description",
base::Value(l10n_util::GetStringUTF16(IDS_ASSISTANT_HOTWORD_DESC)));
- hotword_data.SetKey("defaultEnabled", base::Value(true));
+ hotword_data.SetKey("defaultEnabled",
+ base::Value(IsHotwordDefaultEnabled(prefs)));
+ hotword_data.SetKey("toggleDisabled",
+ base::Value(IsHotwordToggleDisabled(prefs)));
hotword_data.SetKey(
"iconUri",
base::Value("https://www.gstatic.com/images/icons/material/system/"
@@ -135,7 +176,10 @@ base::Value CreateGetMoreData(bool email_optin_needed,
IDS_ASSISTANT_SCREEN_CONTEXT_TITLE)));
context_data.SetKey("description", base::Value(l10n_util::GetStringUTF16(
IDS_ASSISTANT_SCREEN_CONTEXT_DESC)));
- context_data.SetKey("defaultEnabled", base::Value(true));
+ context_data.SetKey("defaultEnabled",
+ base::Value(IsScreenContextDefaultEnabled(prefs)));
+ context_data.SetKey("toggleDisabled",
+ base::Value(IsScreenContextToggleDisabled(prefs)));
context_data.SetKey(
"iconUri",
base::Value("https://www.gstatic.com/images/icons/material/system/"
@@ -231,4 +275,16 @@ bool IsHotwordDspAvailable() {
return false;
}
+bool IsVoiceMatchEnabled(const PrefService* prefs) {
+ if (!base::FeatureList::IsEnabled(assistant::features::kAssistantVoiceMatch))
+ return false;
+
+ // If the hotword preference is managed, then we should not do Voice Match
+ // if the administrator has disabled the hotword.
+ if (prefs->IsManagedPreference(arc::prefs::kVoiceInteractionHotwordEnabled))
+ return prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled);
+
+ return true;
+}
+
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.h b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.h
index 67b5c7e1bb1..53d49d18dca 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.h
@@ -7,12 +7,14 @@
#include <string>
-#include "base/callback.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chromeos/services/assistant/public/mojom/constants.mojom.h"
#include "chromeos/services/assistant/public/proto/settings_ui.pb.h"
-#include "components/prefs/pref_service.h"
-#include "services/service_manager/public/cpp/connector.h"
+
+class PrefService;
+class Profile;
+
+namespace base {
+class Value;
+} // namespace base
namespace chromeos {
@@ -61,7 +63,8 @@ base::Value CreateDisclosureData(const SettingZippyList& disclosure_list);
// Helper method to create get more screen data.
base::Value CreateGetMoreData(bool email_optin_needed,
- const assistant::EmailOptInUi& email_optin_ui);
+ const assistant::EmailOptInUi& email_optin_ui,
+ PrefService* prefs);
// Get string constants for settings ui.
base::Value GetSettingsUiStrings(const assistant::SettingsUi& settings_ui,
@@ -73,6 +76,8 @@ void RecordActivityControlConsent(Profile* profile,
bool IsHotwordDspAvailable();
+bool IsVoiceMatchEnabled(const PrefService* prefs);
+
} // namespace chromeos
#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_ASSISTANT_OPTIN_ASSISTANT_OPTIN_UTILS_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc
index 3dcc59bf70d..38cfba55fca 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.cc
@@ -21,13 +21,14 @@ namespace chromeos {
namespace {
-constexpr int kBluetoothPairingDialogHeight = 350;
+constexpr int kBluetoothPairingDialogHeight = 375;
void AddBluetoothStrings(content::WebUIDataSource* html_source) {
struct {
const char* name;
int id;
} localized_strings[] = {
+ {"bluetoothPairDeviceTitle", IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE_TITLE},
{"ok", IDS_OK},
{"cancel", IDS_CANCEL},
{"close", IDS_CLOSE},
@@ -68,9 +69,8 @@ BluetoothPairingDialog::BluetoothPairingDialog(
const base::string16& name_for_display,
bool paired,
bool connected)
- : SystemWebDialogDelegate(
- GURL(chrome::kChromeUIBluetoothPairingURL),
- l10n_util::GetStringUTF16(IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE_TITLE)),
+ : SystemWebDialogDelegate(GURL(chrome::kChromeUIBluetoothPairingURL),
+ base::string16() /* title */),
address_(address) {
device_data_.SetString("address", address);
device_data_.SetString("name", name_for_display);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/OWNERS b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/OWNERS
new file mode 100644
index 00000000000..e26edaf5262
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/OWNERS
@@ -0,0 +1,2 @@
+khorimoto@chromium.org
+tbarzic@chromium.org
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.cc
new file mode 100644
index 00000000000..6dbe658c960
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.cc
@@ -0,0 +1,99 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/browser_dialogs.h"
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/grit/cellular_setup_resources.h"
+#include "chrome/grit/cellular_setup_resources_map.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "ui/aura/window.h"
+
+namespace chromeos {
+
+namespace cellular_setup {
+
+namespace {
+
+// TODO(azeemarshad): Determine the exact height and width of the dialog. The
+// current mocks are unclear, so these are just a guess.
+constexpr int kDialogHeightPx = 850;
+constexpr int kDialogWidthPx = 650;
+
+CellularSetupDialog* dialog_instance = nullptr;
+
+} // namespace
+
+// static
+void CellularSetupDialog::ShowDialog(const std::string& cellular_network_guid) {
+ if (dialog_instance) {
+ dialog_instance->dialog_window()->Focus();
+ return;
+ }
+
+ dialog_instance = new CellularSetupDialog();
+
+ // Note: chrome::ShowWebDialog() is used instead of
+ // dialog_instance->ShowSystemDialog() because it provides the dialog to
+ // ability to switch to full-screen in tablet mode.
+ chrome::ShowWebDialog(nullptr /* parent */,
+ ProfileManager::GetActiveUserProfile(),
+ dialog_instance);
+}
+
+CellularSetupDialog::CellularSetupDialog()
+ : SystemWebDialogDelegate(GURL(chrome::kChromeUICellularSetupUrl),
+ base::string16()) {}
+
+CellularSetupDialog::~CellularSetupDialog() = default;
+
+void CellularSetupDialog::GetDialogSize(gfx::Size* size) const {
+ size->SetSize(kDialogWidthPx, kDialogHeightPx);
+}
+
+bool CellularSetupDialog::CanResizeDialog() const {
+ return false;
+}
+
+void CellularSetupDialog::OnDialogClosed(const std::string& json_retval) {
+ DCHECK(this == dialog_instance);
+ dialog_instance = nullptr;
+
+ // Note: The call below deletes |this|, so there is no further need to keep
+ // track of the pointer.
+ SystemWebDialogDelegate::OnDialogClosed(json_retval);
+}
+
+CellularSetupDialogUI::CellularSetupDialogUI(content::WebUI* web_ui)
+ : ui::MojoWebDialogUI(web_ui) {
+ content::WebUIDataSource* source =
+ content::WebUIDataSource::Create(chrome::kChromeUICellularSetupHost);
+
+ chromeos::cellular_setup::AddLocalizedStrings(source);
+ source->SetJsonPath("strings.js");
+ source->SetDefaultResource(IDR_CELLULAR_SETUP_CELLULAR_SETUP_DIALOG_HTML);
+
+ // Note: The |kCellularSetupResourcesSize| and |kCellularSetupResources|
+ // fields are defined in the generated file
+ // chrome/grit/cellular_setup_resources_map.h.
+ for (size_t i = 0; i < kCellularSetupResourcesSize; ++i) {
+ source->AddResourcePath(kCellularSetupResources[i].name,
+ kCellularSetupResources[i].value);
+ }
+
+ content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
+
+ // TODO(khorimoto): Add Mojo bindings to this WebUI so that Mojo calls can
+ // occur in JavaScript.
+}
+
+CellularSetupDialogUI::~CellularSetupDialogUI() = default;
+
+} // namespace cellular_setup
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.h b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.h
new file mode 100644
index 00000000000..164c12f02ce
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.h
@@ -0,0 +1,48 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_CELLULAR_SETUP_DIALOG_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_CELLULAR_SETUP_DIALOG_H_
+
+#include "base/macros.h"
+#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
+#include "ui/web_dialogs/web_dialog_ui.h"
+
+namespace chromeos {
+
+namespace cellular_setup {
+
+// Dialog which displays the cellular setup flow which allows users to
+// activate their un-activated SIM cards. This dialog is only used when the
+// kUpdatedCellularActivationUi flag is enabled; see go/cros-cellular-design.
+class CellularSetupDialog : public SystemWebDialogDelegate {
+ protected:
+ CellularSetupDialog();
+ ~CellularSetupDialog() override;
+
+ // ui::WebDialogDelegate
+ void GetDialogSize(gfx::Size* size) const override;
+ bool CanResizeDialog() const override;
+ void OnDialogClosed(const std::string& json_retval) override;
+
+ private:
+ friend void OpenCellularSetupDialog(const std::string& cellular_network_guid);
+ static void ShowDialog(const std::string& cellular_network_guid);
+
+ DISALLOW_COPY_AND_ASSIGN(CellularSetupDialog);
+};
+
+class CellularSetupDialogUI : public ui::MojoWebDialogUI {
+ public:
+ explicit CellularSetupDialogUI(content::WebUI* web_ui);
+ ~CellularSetupDialogUI() override;
+
+ DISALLOW_COPY_AND_ASSIGN(CellularSetupDialogUI);
+};
+
+} // namespace cellular_setup
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_CELLULAR_SETUP_DIALOG_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.cc b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.cc
new file mode 100644
index 00000000000..a95ee83f973
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.cc
@@ -0,0 +1,27 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.h"
+
+#include "base/feature_list.h"
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.h"
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_dialog.h"
+#include "chromeos/constants/chromeos_features.h"
+
+namespace chromeos {
+
+namespace cellular_setup {
+
+void OpenCellularSetupDialog(const std::string& cellular_network_guid) {
+ if (base::FeatureList::IsEnabled(
+ chromeos::features::kUpdatedCellularActivationUi)) {
+ CellularSetupDialog::ShowDialog(cellular_network_guid);
+ } else {
+ MobileSetupDialog::ShowByNetworkId(cellular_network_guid);
+ }
+}
+
+} // namespace cellular_setup
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.h b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.h
new file mode 100644
index 00000000000..e8477d8703f
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.h
@@ -0,0 +1,24 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_CELLULAR_SETUP_DIALOG_LAUNCHER_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_CELLULAR_SETUP_DIALOG_LAUNCHER_H_
+
+#include <string>
+
+namespace chromeos {
+
+namespace cellular_setup {
+
+// Opens the cellular setup dialog for the cellular network with the provided
+// GUID; if the dialog is already open, this function focuses it. Note that this
+// function may open a different dialog depending on whether the
+// kUpdatedCellularActivationUi flag is enabled.
+void OpenCellularSetupDialog(const std::string& cellular_network_guid);
+
+} // namespace cellular_setup
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_CELLULAR_SETUP_DIALOG_LAUNCHER_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc
new file mode 100644
index 00000000000..c8112a8f061
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.cc
@@ -0,0 +1,38 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.h"
+
+#include "base/stl_util.h"
+#include "chrome/browser/ui/webui/localized_string.h"
+#include "components/login/localized_values_builder.h"
+#include "components/strings/grit/components_strings.h"
+#include "content/public/browser/web_ui_data_source.h"
+
+namespace chromeos {
+
+namespace cellular_setup {
+
+namespace {
+
+// TODO(azeemarshad): Add localized strings for cellular setup flow.
+constexpr LocalizedString kLocalizedStringsWithoutPlaceholders[] = {
+ {"cancel", IDS_CANCEL},
+};
+
+} // namespace
+
+void AddLocalizedStrings(content::WebUIDataSource* html_source) {
+ AddLocalizedStringsBulk(html_source, kLocalizedStringsWithoutPlaceholders,
+ base::size(kLocalizedStringsWithoutPlaceholders));
+}
+
+void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) {
+ for (const auto& entry : kLocalizedStringsWithoutPlaceholders)
+ builder->Add(entry.name, entry.id);
+}
+
+} // namespace cellular_setup
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.h b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.h
new file mode 100644
index 00000000000..6ab522f5b34
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_localized_strings_provider.h
@@ -0,0 +1,30 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_CELLULAR_SETUP_LOCALIZED_STRINGS_PROVIDER_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_CELLULAR_SETUP_LOCALIZED_STRINGS_PROVIDER_H_
+
+namespace login {
+class LocalizedValuesBuilder;
+}
+
+namespace content {
+class WebUIDataSource;
+}
+
+namespace chromeos {
+
+namespace cellular_setup {
+
+// Adds the strings needed for the cellular setup flow to |html_source|.
+void AddLocalizedStrings(content::WebUIDataSource* html_source);
+
+// Same as AddLocalizedStrings() but for a LocalizedValuesBuilder.
+void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder);
+
+} // namespace cellular_setup
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_CELLULAR_SETUP_LOCALIZED_STRINGS_PROVIDER_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/mobile_setup_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_dialog.cc
index 76ff0738b50..542665cbd5a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/mobile_setup_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_dialog.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h"
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_dialog.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/mobile/mobile_activator.h"
@@ -21,6 +21,8 @@
namespace chromeos {
+namespace cellular_setup {
+
namespace {
constexpr int kMobileSetupDialogWidth = 850;
@@ -70,6 +72,10 @@ void MobileSetupDialog::GetDialogSize(gfx::Size* size) const {
size->SetSize(kMobileSetupDialogWidth, kMobileSetupDialogHeight);
}
+bool MobileSetupDialog::CanResizeDialog() const {
+ return true;
+}
+
std::string MobileSetupDialog::GetDialogArgs() const {
return std::string();
}
@@ -94,4 +100,6 @@ void MobileSetupDialog::OnCloseContents(content::WebContents* source,
l10n_util::GetStringUTF16(IDS_MOBILE_CANCEL_ACTIVATION));
}
+} // namespace cellular_setup
+
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_dialog.h
index e15ad870e3d..4739b83e39e 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_dialog.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_MOBILE_SETUP_DIALOG_H_
-#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_MOBILE_SETUP_DIALOG_H_
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_MOBILE_SETUP_DIALOG_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_MOBILE_SETUP_DIALOG_H_
#include "base/macros.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
@@ -12,23 +12,32 @@ namespace chromeos {
class NetworkState;
-class MobileSetupDialog : public SystemWebDialogDelegate {
- public:
- static void ShowByNetworkId(const std::string& network_id);
+namespace cellular_setup {
+// Dialog used for cellular activation flow when the
+// kUpdatedCellularActivationUi flag is disabled.
+// DEPRECATED: Being replaced by new UI; see https://crbug.com/778021.
+class MobileSetupDialog : public SystemWebDialogDelegate {
protected:
explicit MobileSetupDialog(const NetworkState& network);
~MobileSetupDialog() override;
// ui::WebDialogDelegate
void GetDialogSize(gfx::Size* size) const override;
+ bool CanResizeDialog() const override;
std::string GetDialogArgs() const override;
void OnCloseContents(content::WebContents* source,
bool* out_close_dialog) override;
+ private:
+ friend void OpenCellularSetupDialog(const std::string& cellular_network_guid);
+ static void ShowByNetworkId(const std::string& network_id);
+
DISALLOW_COPY_AND_ASSIGN(MobileSetupDialog);
};
+} // namespace cellular_setup
+
} // namespace chromeos
-#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_MOBILE_SETUP_DIALOG_H_
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_MOBILE_SETUP_DIALOG_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc
index 8fb50f2e459..060cab439e7 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h"
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.h"
#include <stddef.h>
@@ -46,6 +46,8 @@
namespace chromeos {
+namespace cellular_setup {
+
namespace {
// Host page JS API function names.
@@ -604,4 +606,6 @@ MobileSetupUI::MobileSetupUI(content::WebUI* web_ui) : ui::WebDialogUI(web_ui) {
MobileSetupUI::~MobileSetupUI() = default;
+} // namespace cellular_setup
+
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.h
index 8334f116b4a..a9d6fcc2c8e 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.h
@@ -2,16 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_MOBILE_SETUP_UI_H_
-#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_MOBILE_SETUP_UI_H_
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_MOBILE_SETUP_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_MOBILE_SETUP_UI_H_
#include "base/macros.h"
#include "ui/web_dialogs/web_dialog_ui.h"
namespace chromeos {
+namespace cellular_setup {
+
// A custom WebUI that defines datasource for mobile setup registration page
// that is used in Chrome OS activate modem and perform plan subscription tasks.
+// This WebUI is being replaced and is only shown when the
+// kUpdatedCellularActivationUi flag is disabled; see go/cros-cellular-design.
class MobileSetupUI : public ui::WebDialogUI {
public:
explicit MobileSetupUI(content::WebUI* web_ui);
@@ -21,6 +25,8 @@ class MobileSetupUI : public ui::WebDialogUI {
DISALLOW_COPY_AND_ASSIGN(MobileSetupUI);
};
+} // namespace cellular_setup
+
} // namespace chromeos
-#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_MOBILE_SETUP_UI_H_
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CELLULAR_SETUP_MOBILE_SETUP_UI_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc
index 8878f366d91..a2b95c06332 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc
@@ -7,7 +7,7 @@
#include "base/bind.h"
#include "base/task/post_task.h"
#include "base/values.h"
-#include "chromeos/dbus/cryptohome_client.h"
+#include "chromeos/dbus/cryptohome/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@@ -29,8 +29,7 @@ void CryptohomeWebUIHandler::RegisterMessages() {
}
void CryptohomeWebUIHandler::OnPageLoaded(const base::ListValue* args) {
- CryptohomeClient* cryptohome_client =
- DBusThreadManager::Get()->GetCryptohomeClient();
+ CryptohomeClient* cryptohome_client = CryptohomeClient::Get();
cryptohome_client->IsMounted(GetCryptohomeBoolCallback("is-mounted"));
cryptohome_client->TpmIsReady(GetCryptohomeBoolCallback("tpm-is-ready"));
diff --git a/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
index 46e535b2610..670f76e0edf 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
@@ -50,6 +50,7 @@
#include "google_apis/drive/drive_api_error_codes.h"
#include "google_apis/drive/drive_api_parser.h"
#include "google_apis/drive/time_util.h"
+#include "net/base/filename_util.h"
using content::BrowserThread;
@@ -760,6 +761,10 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
if (log_path.empty())
return;
+ MaybeCallJavascript(
+ "updateOtherServiceLogsUrl",
+ base::Value(net::FilePathToFileURL(log_path.DirName()).spec()));
+
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(&GetServiceLogContents, log_path,
diff --git a/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
index 210336fd343..85c54f11143 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
@@ -15,9 +15,9 @@
#include "chrome/browser/chromeos/system/fake_input_device_settings.h"
#include "chrome/browser/chromeos/system/input_device_settings.h"
#include "chrome/browser/ui/webui/chromeos/bluetooth_pairing_dialog.h"
+#include "chromeos/dbus/audio/fake_cras_audio_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_cras_audio_client.h"
-#include "chromeos/dbus/fake_power_manager_client.h"
+#include "chromeos/dbus/power/fake_power_manager_client.h"
#include "content/public/browser/web_ui.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_device.h"
@@ -141,25 +141,22 @@ class DeviceEmulatorMessageHandler::CrasAudioObserver
public:
explicit CrasAudioObserver(DeviceEmulatorMessageHandler* owner)
: owner_(owner) {
- owner_->fake_cras_audio_client_->AddObserver(this);
+ chromeos::FakeCrasAudioClient::Get()->AddObserver(this);
}
~CrasAudioObserver() override {
- owner_->fake_cras_audio_client_->RemoveObserver(this);
+ chromeos::FakeCrasAudioClient::Get()->RemoveObserver(this);
}
// chromeos::CrasAudioClient::Observer.
- void NodesChanged() override;
+ void NodesChanged() override { owner_->HandleRequestAudioNodes(nullptr); }
private:
DeviceEmulatorMessageHandler* owner_;
+
DISALLOW_COPY_AND_ASSIGN(CrasAudioObserver);
};
-void DeviceEmulatorMessageHandler::CrasAudioObserver::NodesChanged() {
- owner_->HandleRequestAudioNodes(nullptr);
-}
-
class DeviceEmulatorMessageHandler::PowerObserver
: public PowerManagerClient::Observer {
public:
@@ -201,8 +198,6 @@ DeviceEmulatorMessageHandler::DeviceEmulatorMessageHandler()
: fake_bluetooth_device_client_(
static_cast<bluez::FakeBluetoothDeviceClient*>(
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient())),
- fake_cras_audio_client_(static_cast<chromeos::FakeCrasAudioClient*>(
- chromeos::DBusThreadManager::Get()->GetCrasAudioClient())),
fake_power_manager_client_(chromeos::FakePowerManagerClient::Get()),
weak_ptr_factory_(this) {
device::BluetoothAdapterFactory::GetAdapter(
@@ -307,7 +302,8 @@ void DeviceEmulatorMessageHandler::HandleRequestAudioNodes(
// Get every active audio node and create a dictionary to
// send it to JavaScript.
base::ListValue audio_nodes;
- for (const AudioNode& node : fake_cras_audio_client_->node_list()) {
+ for (const AudioNode& node :
+ chromeos::FakeCrasAudioClient::Get()->node_list()) {
std::unique_ptr<base::DictionaryValue> audio_node(
new base::DictionaryValue());
@@ -339,7 +335,7 @@ void DeviceEmulatorMessageHandler::HandleInsertAudioNode(
CHECK(device_dict->GetString("id", &tmp_id));
CHECK(base::StringToUint64(tmp_id, &audio_node.id));
- fake_cras_audio_client_->InsertAudioNodeToList(audio_node);
+ chromeos::FakeCrasAudioClient::Get()->InsertAudioNodeToList(audio_node);
}
void DeviceEmulatorMessageHandler::HandleRemoveAudioNode(
@@ -349,7 +345,7 @@ void DeviceEmulatorMessageHandler::HandleRemoveAudioNode(
CHECK(args->GetString(0, &tmp_id));
CHECK(base::StringToUint64(tmp_id, &id));
- fake_cras_audio_client_->RemoveAudioNodeFromList(id);
+ chromeos::FakeCrasAudioClient::Get()->RemoveAudioNodeFromList(id);
}
void DeviceEmulatorMessageHandler::HandleSetHasTouchpad(
diff --git a/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h b/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
index 9c6690616ff..0aca35bab32 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
@@ -30,7 +30,6 @@ class FakeBluetoothDeviceClient;
namespace chromeos {
-class FakeCrasAudioClient;
class FakePowerManagerClient;
// Handler class for the Device Emulator page operations.
@@ -70,11 +69,11 @@ class DeviceEmulatorMessageHandler :
// that there can be multiple current active nodes.
void HandleRequestAudioNodes(const base::ListValue* args);
- // Create a node and add the node to the current AudioNodeList in
- // |fake_cras_audio_client_|.
+ // Create a node and add the node to the current AudioNodeList in the
+ // FakeCrasAudioClient.
void HandleInsertAudioNode(const base::ListValue* args);
- // Removes an AudioNode from the current list in |fake_cras_audio_client_|.
+ // Removes an AudioNode from the current list in the FakeCrasAudioClient
// based on the node id.
void HandleRemoveAudioNode(const base::ListValue* args);
@@ -88,7 +87,6 @@ class DeviceEmulatorMessageHandler :
// asynchronously.
void UpdateBatteryPercent(const base::ListValue* args);
void UpdateBatteryState(const base::ListValue* args);
- void UpdateExternalPower(const base::ListValue* args);
void UpdateTimeToEmpty(const base::ListValue* args);
void UpdateTimeToFull(const base::ListValue* args);
void UpdatePowerSources(const base::ListValue* args);
@@ -132,7 +130,6 @@ class DeviceEmulatorMessageHandler :
bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
std::unique_ptr<BluetoothObserver> bluetooth_observer_;
- FakeCrasAudioClient* fake_cras_audio_client_;
std::unique_ptr<CrasAudioObserver> cras_audio_observer_;
FakePowerManagerClient* fake_power_manager_client_;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/image_source.cc b/chromium/chrome/browser/ui/webui/chromeos/image_source.cc
index 5fe26023bb6..0c8e627e816 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/image_source.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/image_source.cc
@@ -16,7 +16,7 @@
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/task/post_task.h"
-#include "base/task/task_scheduler/task_scheduler.h"
+#include "base/task/thread_pool/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h"
#include "chrome/common/url_constants.h"
diff --git a/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.cc b/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.cc
new file mode 100644
index 00000000000..dc0f34653cd
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.cc
@@ -0,0 +1,90 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.h"
+
+#include <string>
+
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/macros.h"
+#include "base/values.h"
+#include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h"
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/pref_names.h"
+#include "chromeos/constants/chromeos_switches.h"
+#include "components/prefs/pref_service.h"
+#include "components/user_manager/user_manager.h"
+
+namespace chromeos {
+
+InSessionPasswordChangeHandler::InSessionPasswordChangeHandler() = default;
+InSessionPasswordChangeHandler::~InSessionPasswordChangeHandler() = default;
+
+void InSessionPasswordChangeHandler::HandleInitialize(
+ const base::ListValue* value) {
+ const Profile* profile = Profile::FromWebUI(web_ui());
+ CHECK(profile->GetPrefs()->GetBoolean(
+ prefs::kSamlInSessionPasswordChangeEnabled));
+
+ AllowJavascript();
+ base::Value params(base::Value::Type::DICTIONARY);
+ const std::string password_change_url =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kSamlPasswordChangeUrl);
+ params.SetKey("passwordChangeUrl", base::Value(password_change_url));
+ const user_manager::User* user =
+ ProfileHelper::Get()->GetUserByProfile(profile);
+ if (user)
+ params.SetKey("userName", base::Value(user->GetDisplayEmail()));
+ CallJavascriptFunction("insession.password.change.loadAuthExtension", params);
+}
+
+void InSessionPasswordChangeHandler::HandleChangePassword(
+ const base::ListValue* params) {
+ const base::Value& old_passwords = params->GetList()[0];
+ const base::Value& new_passwords = params->GetList()[1];
+ VLOG(4) << "Scraped " << old_passwords.GetList().size() << " old passwords";
+ VLOG(4) << "Scraped " << new_passwords.GetList().size() << " new passwords";
+ user_manager::User* user =
+ ProfileHelper::Get()->GetUserByProfile(Profile::FromWebUI(web_ui()));
+ user_manager::UserManager::Get()->SaveForceOnlineSignin(user->GetAccountId(),
+ true);
+ if (new_passwords.GetList().size() == 1 &&
+ old_passwords.GetList().size() > 0) {
+ UserContext user_context(*user);
+ user_context.SetKey(Key(new_passwords.GetList()[0].GetString()));
+ authenticator_ = new ChromeCryptohomeAuthenticator(this);
+ authenticator_->MigrateKey(user_context,
+ old_passwords.GetList()[0].GetString());
+ }
+}
+
+void InSessionPasswordChangeHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "initialize",
+ base::BindRepeating(&InSessionPasswordChangeHandler::HandleInitialize,
+ weak_factory_.GetWeakPtr()));
+ web_ui()->RegisterMessageCallback(
+ "changePassword",
+ base::BindRepeating(&InSessionPasswordChangeHandler::HandleChangePassword,
+ weak_factory_.GetWeakPtr()));
+}
+
+void InSessionPasswordChangeHandler::OnAuthSuccess(
+ const UserContext& user_context) {
+ VLOG(3) << "Cryptohome password is changed.";
+ user_manager::UserManager::Get()->SaveForceOnlineSignin(
+ user_context.GetAccountId(), false);
+ authenticator_.reset();
+}
+
+void InSessionPasswordChangeHandler::OnAuthFailure(const AuthFailure& error) {
+ // TODO(rsorokin): Ask user for the old password
+ VLOG(1) << "Failed to change cryptohome password: " << error.GetErrorString();
+ authenticator_.reset();
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.h b/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.h
new file mode 100644
index 00000000000..aed2376af21
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.h
@@ -0,0 +1,40 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_INSESSION_PASSWORD_CHANGE_HANDLER_CHROMEOS_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_INSESSION_PASSWORD_CHANGE_HANDLER_CHROMEOS_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/values.h"
+#include "chromeos/login/auth/auth_status_consumer.h"
+#include "chromeos/login/auth/cryptohome_authenticator.h"
+#include "content/public/browser/web_ui_message_handler.h"
+
+namespace chromeos {
+
+class InSessionPasswordChangeHandler : public content::WebUIMessageHandler,
+ AuthStatusConsumer {
+ public:
+ InSessionPasswordChangeHandler();
+ ~InSessionPasswordChangeHandler() override;
+
+ // content::WebUIMessageHandler:
+ void RegisterMessages() override;
+
+ void HandleInitialize(const base::ListValue*);
+ void HandleChangePassword(const base::ListValue* passwords);
+
+ // AuthStatusConsumer:
+ void OnAuthFailure(const AuthFailure& error) override;
+ void OnAuthSuccess(const UserContext& user_context) override;
+
+ private:
+ scoped_refptr<CryptohomeAuthenticator> authenticator_;
+ base::WeakPtrFactory<InSessionPasswordChangeHandler> weak_factory_{this};
+ DISALLOW_COPY_AND_ASSIGN(InSessionPasswordChangeHandler);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_INSESSION_PASSWORD_CHANGE_HANDLER_CHROMEOS_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_ui.cc
new file mode 100644
index 00000000000..eb4c9d46c12
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_ui.cc
@@ -0,0 +1,47 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/chromeos/insession_password_change_ui.h"
+
+#include <memory>
+
+#include "base/bind.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/chromeos/insession_password_change_handler_chromeos.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/webui_url_constants.h"
+#include "chrome/grit/browser_resources.h"
+#include "chrome/grit/generated_resources.h"
+#include "components/prefs/pref_service.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "ui/strings/grit/ui_strings.h"
+
+namespace chromeos {
+
+InSessionPasswordChangeUI::InSessionPasswordChangeUI(content::WebUI* web_ui)
+ : ui::WebDialogUI(web_ui) {
+ Profile* profile = Profile::FromWebUI(web_ui);
+ CHECK(profile->GetPrefs()->GetBoolean(
+ prefs::kSamlInSessionPasswordChangeEnabled));
+
+ content::WebUIDataSource* source =
+ content::WebUIDataSource::Create(chrome::kChromeUIPasswordChangeHost);
+
+ web_ui->AddMessageHandler(std::make_unique<InSessionPasswordChangeHandler>());
+
+ source->SetJsonPath("strings.js");
+
+ source->SetDefaultResource(IDR_PASSWORD_CHANGE_HTML);
+
+ source->AddResourcePath("password_change.css", IDR_PASSWORD_CHANGE_CSS);
+ source->AddResourcePath("authenticator.js",
+ IDR_PASSWORD_CHANGE_AUTHENTICATOR_JS);
+ source->AddResourcePath("password_change.js", IDR_PASSWORD_CHANGE_JS);
+
+ content::WebUIDataSource::Add(profile, source);
+}
+
+InSessionPasswordChangeUI::~InSessionPasswordChangeUI() = default;
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_ui.h b/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_ui.h
new file mode 100644
index 00000000000..b012a52592e
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/insession_password_change_ui.h
@@ -0,0 +1,25 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_INSESSION_PASSWORD_CHANGE_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_INSESSION_PASSWORD_CHANGE_UI_H_
+
+#include "base/macros.h"
+#include "ui/web_dialogs/web_dialog_ui.h"
+
+namespace chromeos {
+
+// For chrome:://password-change
+class InSessionPasswordChangeUI : public ui::WebDialogUI {
+ public:
+ explicit InSessionPasswordChangeUI(content::WebUI* web_ui);
+ ~InSessionPasswordChangeUI() override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InSessionPasswordChangeUI);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_INSESSION_PASSWORD_CHANGE_UI_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS b/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS
index 5a1a5f7ca14..dc266335d62 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS
@@ -1,4 +1,11 @@
+# (in PST)
achuith@chromium.org
alemate@chromium.org
jdufault@chromium.org
+tbarzic@chromium.org
+
+# (in CET)
+antrim@chromium.org
per-file *active_directory*=rsorokin@chromium.org
+
+# COMPONENT: UI>Shell>OOBE
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc
index 57a5c53c988..d29cbf62c3a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.cc
@@ -7,12 +7,12 @@
#include <memory>
#include "base/bind.h"
+#include "chrome/browser/chromeos/authpolicy/authpolicy_helper.h"
#include "chrome/browser/chromeos/login/oobe_screen.h"
#include "chrome/browser/chromeos/login/screens/core_oobe_view.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
#include "chrome/grit/generated_resources.h"
-#include "chromeos/login/auth/authpolicy_login_helper.h"
#include "chromeos/login/auth/key.h"
#include "components/login/localized_values_builder.h"
#include "components/user_manager/known_user.h"
@@ -22,7 +22,6 @@ namespace chromeos {
namespace {
-constexpr char kJsScreenPath[] = "login.ActiveDirectoryPasswordChangeScreen";
constexpr char kUsernameKey[] = "username";
constexpr char kErrorKey[] = "error";
@@ -42,10 +41,9 @@ ActiveDirectoryPasswordChangeScreenHandler::
CoreOobeView* core_oobe_view)
: BaseScreenHandler(OobeScreen::SCREEN_ACTIVE_DIRECTORY_PASSWORD_CHANGE,
js_calls_container),
- authpolicy_login_helper_(std::make_unique<AuthPolicyLoginHelper>()),
+ authpolicy_login_helper_(std::make_unique<AuthPolicyHelper>()),
core_oobe_view_(core_oobe_view),
weak_factory_(this) {
- set_call_js_prefix(kJsScreenPath);
}
ActiveDirectoryPasswordChangeScreenHandler::
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h
index 3f8d66dca16..74b41552268 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/active_directory_password_change_screen_handler.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/macros.h"
+#include "chrome/browser/chromeos/authpolicy/authpolicy_helper.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
-#include "chromeos/login/auth/authpolicy_login_helper.h"
namespace authpolicy {
class ActiveDirectoryAccountInfo;
@@ -49,8 +49,8 @@ class ActiveDirectoryPasswordChangeScreenHandler : public BaseScreenHandler {
// Shows the screen with the error message corresponding to |error|.
void ShowScreenWithError(int error);
- // Callback called by AuthPolicyLoginHelper::AuthenticateUser with results and
- // error code. (see AuthPolicyLoginHelper::AuthenticateUser)
+ // Callback called by AuthPolicyHelper::AuthenticateUser with results and
+ // error code. (see AuthPolicyHelper::AuthenticateUser)
void OnAuthFinished(
const std::string& username,
const Key& key,
@@ -59,7 +59,7 @@ class ActiveDirectoryPasswordChangeScreenHandler : public BaseScreenHandler {
// Helper to call AuthPolicyClient and cancel calls if needed. Used to change
// password on the Active Directory server.
- std::unique_ptr<AuthPolicyLoginHelper> authpolicy_login_helper_;
+ std::unique_ptr<AuthPolicyHelper> authpolicy_login_helper_;
// Non-owned. Used to display signin error.
CoreOobeView* core_oobe_view_ = nullptr;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.cc
index db98949d350..60b1c10d338 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.cc
@@ -14,8 +14,6 @@
namespace {
-const char kJsScreenPath[] = "login.AppDownloadingScreen";
-
int GetNumberOfUserSelectedApps() {
const Profile* profile = ProfileManager::GetActiveUserProfile();
const PrefService* pref_service = profile->GetPrefs();
@@ -32,7 +30,7 @@ namespace chromeos {
AppDownloadingScreenHandler::AppDownloadingScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.AppDownloadingScreen.userActed");
}
AppDownloadingScreenHandler::~AppDownloadingScreenHandler() {}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.h
index 9995b81a034..4a38e0314d6 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/app_downloading_screen_handler.h
@@ -6,13 +6,28 @@
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_DOWNLOADING_SCREEN_HANDLER_H_
#include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/app_downloading_screen_view.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
namespace chromeos {
class AppDownloadingScreen;
+class AppDownloadingScreenView {
+ public:
+ constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_APP_DOWNLOADING;
+
+ virtual ~AppDownloadingScreenView() = default;
+
+ // Sets screen this view belongs to.
+ virtual void Bind(AppDownloadingScreen* screen) = 0;
+
+ // Shows the contents of the screen.
+ virtual void Show() = 0;
+
+ // Hides the contents of the screen.
+ virtual void Hide() = 0;
+};
+
// The sole implementation of the AppDownloadingScreenView, using WebUI.
class AppDownloadingScreenHandler : public BaseScreenHandler,
public AppDownloadingScreenView {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc
index 388ffa6b821..9b9707d2b22 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc
@@ -9,6 +9,7 @@
#include "base/values.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
+#include "chrome/browser/chromeos/login/app_launch_controller.h"
#include "chrome/browser/chromeos/login/oobe_screen.h"
#include "chrome/browser/chromeos/login/screens/network_error.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
@@ -24,8 +25,6 @@
namespace {
-const char kJsScreenPath[] = "login.AppLaunchSplashScreen";
-
// Returns network name by service path.
std::string GetNetworkName(const std::string& service_path) {
const chromeos::NetworkState* network =
@@ -47,14 +46,13 @@ AppLaunchSplashScreenHandler::AppLaunchSplashScreenHandler(
: BaseScreenHandler(kScreenId, js_calls_container),
network_state_informer_(network_state_informer),
error_screen_(error_screen) {
- set_call_js_prefix(kJsScreenPath);
network_state_informer_->AddObserver(this);
}
AppLaunchSplashScreenHandler::~AppLaunchSplashScreenHandler() {
network_state_informer_->RemoveObserver(this);
- if (delegate_)
- delegate_->OnDeletingSplashScreenView();
+ if (controller_)
+ controller_->OnDeletingSplashScreenView();
}
void AppLaunchSplashScreenHandler::DeclareLocalizedValues(
@@ -131,8 +129,8 @@ void AppLaunchSplashScreenHandler::UpdateAppLaunchState(AppLaunchState state) {
}
void AppLaunchSplashScreenHandler::SetDelegate(
- AppLaunchSplashScreenHandler::Delegate* delegate) {
- delegate_ = delegate;
+ AppLaunchController* controller) {
+ controller_ = controller;
}
void AppLaunchSplashScreenHandler::ShowNetworkConfigureUI() {
@@ -140,7 +138,7 @@ void AppLaunchSplashScreenHandler::ShowNetworkConfigureUI() {
if (state == NetworkStateInformer::ONLINE) {
online_state_ = true;
if (!network_config_requested_) {
- delegate_->OnNetworkStateChanged(true);
+ controller_->OnNetworkStateChanged(true);
return;
}
}
@@ -198,15 +196,14 @@ void AppLaunchSplashScreenHandler::OnNetworkReady() {
void AppLaunchSplashScreenHandler::UpdateState(
NetworkError::ErrorReason reason) {
- if (!delegate_ ||
- (state_ != APP_LAUNCH_STATE_PREPARING_NETWORK &&
- state_ != APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT)) {
+ if (!controller_ || (state_ != APP_LAUNCH_STATE_PREPARING_NETWORK &&
+ state_ != APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT)) {
return;
}
bool new_online_state =
network_state_informer_->state() == NetworkStateInformer::ONLINE;
- delegate_->OnNetworkStateChanged(new_online_state);
+ controller_->OnNetworkStateChanged(new_online_state);
online_state_ = new_online_state;
}
@@ -250,33 +247,33 @@ int AppLaunchSplashScreenHandler::GetProgressMessageFromState(
}
void AppLaunchSplashScreenHandler::HandleConfigureNetwork() {
- if (delegate_)
- delegate_->OnConfigureNetwork();
+ if (controller_)
+ controller_->OnConfigureNetwork();
else
LOG(WARNING) << "No delegate set to handle network configuration.";
}
void AppLaunchSplashScreenHandler::HandleCancelAppLaunch() {
- if (delegate_)
- delegate_->OnCancelAppLaunch();
+ if (controller_)
+ controller_->OnCancelAppLaunch();
else
LOG(WARNING) << "No delegate set to handle cancel app launch";
}
void AppLaunchSplashScreenHandler::HandleNetworkConfigRequested() {
- if (!delegate_ || network_config_done_)
+ if (!controller_ || network_config_done_)
return;
network_config_requested_ = true;
- delegate_->OnNetworkConfigRequested(true);
+ controller_->OnNetworkConfigRequested(true);
}
void AppLaunchSplashScreenHandler::HandleContinueAppLaunch() {
DCHECK(online_state_);
- if (delegate_ && online_state_) {
+ if (controller_ && online_state_) {
network_config_requested_ = false;
network_config_done_ = true;
- delegate_->OnNetworkConfigRequested(false);
+ controller_->OnNetworkConfigRequested(false);
Show(app_id_);
}
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h
index a818ee89aac..250e858dfc6 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h
@@ -9,13 +9,51 @@
#include <string>
#include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_view.h"
#include "chrome/browser/chromeos/login/screens/error_screen.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
namespace chromeos {
+class AppLaunchController;
+
+// Interface for UI implementations of the AppLaunchSplashScreen.
+class AppLaunchSplashScreenView {
+ public:
+ enum AppLaunchState {
+ APP_LAUNCH_STATE_PREPARING_NETWORK,
+ APP_LAUNCH_STATE_INSTALLING_APPLICATION,
+ APP_LAUNCH_STATE_WAITING_APP_WINDOW,
+ APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT,
+ APP_LAUNCH_STATE_SHOWING_NETWORK_CONFIGURE_UI,
+ };
+
+ constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_APP_LAUNCH_SPLASH;
+
+ virtual ~AppLaunchSplashScreenView() {}
+
+ // Sets screen this view belongs to.
+ virtual void SetDelegate(AppLaunchController* controller) = 0;
+
+ // Shows the contents of the screen.
+ virtual void Show(const std::string& app_id) = 0;
+
+ // Hides the contents of the screen.
+ virtual void Hide() = 0;
+
+ // Set the current app launch state.
+ virtual void UpdateAppLaunchState(AppLaunchState state) = 0;
+
+ // Sets whether configure network control is visible.
+ virtual void ToggleNetworkConfig(bool visible) = 0;
+
+ // Shows the network error and configure UI.
+ virtual void ShowNetworkConfigureUI() = 0;
+
+ // Returns true if the default network has Internet access.
+ virtual bool IsNetworkReady() = 0;
+};
+
// A class that handles the WebUI hooks for the app launch splash screen.
class AppLaunchSplashScreenHandler
: public BaseScreenHandler,
@@ -41,7 +79,7 @@ class AppLaunchSplashScreenHandler
void Hide() override;
void ToggleNetworkConfig(bool visible) override;
void UpdateAppLaunchState(AppLaunchState state) override;
- void SetDelegate(AppLaunchSplashScreenHandler::Delegate* delegate) override;
+ void SetDelegate(AppLaunchController* controller) override;
void ShowNetworkConfigureUI() override;
bool IsNetworkReady() override;
@@ -58,7 +96,7 @@ class AppLaunchSplashScreenHandler
void HandleContinueAppLaunch();
void HandleNetworkConfigRequested();
- AppLaunchSplashScreenHandler::Delegate* delegate_ = nullptr;
+ AppLaunchController* controller_ = nullptr;
bool show_on_init_ = false;
std::string app_id_;
AppLaunchState state_ = APP_LAUNCH_STATE_PREPARING_NETWORK;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.cc
index 422e6ed06e5..ae7fa0e10db 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.cc
@@ -7,6 +7,7 @@
#include <memory>
#include "base/values.h"
+#include "chrome/browser/chromeos/login/arc_kiosk_controller.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
@@ -16,22 +17,15 @@
#include "ui/base/webui/web_ui_util.h"
#include "ui/gfx/image/image_skia.h"
-namespace {
-
-constexpr char kJsScreenPath[] = "login.ArcKioskSplashScreen";
-}
-
namespace chromeos {
ArcKioskSplashScreenHandler::ArcKioskSplashScreenHandler(
JSCallsContainer* js_calls_container)
- : BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
-}
+ : BaseScreenHandler(kScreenId, js_calls_container) {}
ArcKioskSplashScreenHandler::~ArcKioskSplashScreenHandler() {
- if (delegate_)
- delegate_->OnDeletingSplashScreenView();
+ if (controller_)
+ controller_->OnDeletingSplashScreenView();
}
void ArcKioskSplashScreenHandler::DeclareLocalizedValues(
@@ -79,9 +73,8 @@ void ArcKioskSplashScreenHandler::UpdateArcKioskState(ArcKioskState state) {
SetLaunchText(l10n_util::GetStringUTF8(GetProgressMessageFromState(state)));
}
-void ArcKioskSplashScreenHandler::SetDelegate(
- ArcKioskSplashScreenHandler::Delegate* delegate) {
- delegate_ = delegate;
+void ArcKioskSplashScreenHandler::SetDelegate(ArcKioskController* controller) {
+ controller_ = controller;
}
void ArcKioskSplashScreenHandler::PopulateAppInfo(
@@ -115,11 +108,11 @@ int ArcKioskSplashScreenHandler::GetProgressMessageFromState(
}
void ArcKioskSplashScreenHandler::HandleCancelArcKioskLaunch() {
- if (!delegate_) {
+ if (!controller_) {
LOG(WARNING) << "No delegate set to handle cancel app launch";
return;
}
- delegate_->OnCancelArcKioskLaunch();
+ controller_->OnCancelArcKioskLaunch();
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.h
index 1121cce9252..b5166a33c04 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler.h
@@ -8,7 +8,6 @@
#include <string>
#include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_view.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
namespace base {
@@ -17,6 +16,36 @@ class DictionaryValue;
namespace chromeos {
+class ArcKioskController;
+
+// Interface for UI implementations of the ArcKioskSplashScreen.
+class ArcKioskSplashScreenView {
+ public:
+ enum class ArcKioskState {
+ STARTING_SESSION,
+ WAITING_APP_LAUNCH,
+ WAITING_APP_WINDOW,
+ };
+
+ constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_ARC_KIOSK_SPLASH;
+
+ ArcKioskSplashScreenView() = default;
+
+ virtual ~ArcKioskSplashScreenView() = default;
+
+ // Shows the contents of the screen.
+ virtual void Show() = 0;
+
+ // Set the current ARC kiosk state.
+ virtual void UpdateArcKioskState(ArcKioskState state) = 0;
+
+ // Sets screen this view belongs to.
+ virtual void SetDelegate(ArcKioskController* controller) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ArcKioskSplashScreenView);
+};
+
// A class that handles the WebUI hooks for the ARC kiosk splash screen.
class ArcKioskSplashScreenHandler : public BaseScreenHandler,
public ArcKioskSplashScreenView {
@@ -36,14 +65,14 @@ class ArcKioskSplashScreenHandler : public BaseScreenHandler,
// ArcKioskSplashScreenView implementation:
void Show() override;
void UpdateArcKioskState(ArcKioskState state) override;
- void SetDelegate(ArcKioskSplashScreenHandler::Delegate* delegate) override;
+ void SetDelegate(ArcKioskController* controller) override;
void PopulateAppInfo(base::DictionaryValue* out_info);
void SetLaunchText(const std::string& text);
int GetProgressMessageFromState(ArcKioskState state);
void HandleCancelArcKioskLaunch();
- ArcKioskSplashScreenHandler::Delegate* delegate_ = nullptr;
+ ArcKioskController* controller_ = nullptr;
bool show_on_init_ = false;
DISALLOW_COPY_AND_ASSIGN(ArcKioskSplashScreenHandler);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc
index c0706b04796..56d55c7d0c9 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.cc
@@ -5,8 +5,8 @@
#include "chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h"
#include "base/command_line.h"
+#include "base/hash/sha1.h"
#include "base/i18n/timezone.h"
-#include "base/sha1.h"
#include "chrome/browser/chromeos/arc/arc_support_host.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h"
@@ -43,12 +43,6 @@ using ArcPlayTermsOfServiceConsent =
using sync_pb::UserConsentTypes;
-namespace {
-
-const char kJsScreenPath[] = "login.ArcTermsOfServiceScreen";
-
-} // namespace
-
namespace chromeos {
ArcTermsOfServiceScreenHandler::ArcTermsOfServiceScreenHandler(
@@ -56,7 +50,7 @@ ArcTermsOfServiceScreenHandler::ArcTermsOfServiceScreenHandler(
: BaseScreenHandler(kScreenId, js_calls_container),
is_child_account_(
user_manager::UserManager::Get()->IsLoggedInAsChildUser()) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.ArcTermsOfServiceScreen.userActed");
}
ArcTermsOfServiceScreenHandler::~ArcTermsOfServiceScreenHandler() {
@@ -139,6 +133,7 @@ void ArcTermsOfServiceScreenHandler::DeclareLocalizedValues(
builder->Add("arcTextReviewSettings", IDS_ARC_REVIEW_SETTINGS);
builder->Add("arcTextMetricsManagedEnabled",
IDS_ARC_OOBE_TERMS_DIALOG_METRICS_MANAGED_ENABLED);
+ builder->Add("arcTextMetricsDemoApps", IDS_ARC_OOBE_TERMS_DIALOG_DEMO_APPS);
builder->Add("arcAcceptAndContinueGoogleServiceConfirmation",
IDS_ARC_OPT_IN_ACCEPT_AND_CONTINUE_GOOGLE_SERVICE_CONFIRMATION);
builder->Add("arcLearnMoreStatistics",
@@ -282,7 +277,8 @@ void ArcTermsOfServiceScreenHandler::DoShow() {
// Hide the Skip button if the ToS screen can not be skipped during OOBE.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- chromeos::switches::kEnableArcOobeOptinNoSkip)) {
+ chromeos::switches::kEnableArcOobeOptinNoSkip) ||
+ arc::IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) {
CallJS("login.ArcTermsOfServiceScreen.hideSkipButton");
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h
index b6435e5a604..6a8fd69e7cd 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/arc_terms_of_service_screen_handler.h
@@ -54,7 +54,7 @@ class ArcTermsOfServiceScreenHandler
// OobeUI::Observer:
void OnCurrentScreenChanged(OobeScreen current_screen,
OobeScreen new_screen) override;
- void OnScreenInitialized(OobeScreen screen) override {}
+ void OnDestroyingOobeUI() override {}
// system::TimezoneSettings::Observer:
void TimezoneChanged(const icu::TimeZone& timezone) override;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc
index 395454ca5d6..540df02f96c 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/login/oobe_screen.h"
#include "chrome/browser/chromeos/login/screens/assistant_optin_flow_screen.h"
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/assistant/assistant_pref_util.h"
@@ -23,13 +24,13 @@
#include "components/arc/arc_prefs.h"
#include "components/login/localized_values_builder.h"
#include "components/prefs/pref_service.h"
+#include "components/user_manager/user_manager.h"
#include "services/service_manager/public/cpp/connector.h"
namespace chromeos {
namespace {
-constexpr char kJsScreenPath[] = "login.AssistantOptInFlowScreen";
constexpr char kSkipPressed[] = "skip-pressed";
constexpr char kNextPressed[] = "next-pressed";
constexpr char kRecordPressed[] = "record-pressed";
@@ -44,7 +45,7 @@ AssistantOptInFlowScreenHandler::AssistantOptInFlowScreenHandler(
: BaseScreenHandler(kScreenId, js_calls_container),
client_binding_(this),
weak_factory_(this) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.AssistantOptInFlowScreen.userActed");
}
AssistantOptInFlowScreenHandler::~AssistantOptInFlowScreenHandler() {
@@ -359,8 +360,11 @@ void AssistantOptInFlowScreenHandler::OnGetSettingsResponse(
// Process get more data.
email_optin_needed_ = settings_ui.has_email_opt_in_ui() &&
settings_ui.email_opt_in_ui().has_title();
+ auto* profile_helper = ProfileHelper::Get();
+ const auto* user = user_manager::UserManager::Get()->GetActiveUser();
auto get_more_data =
- CreateGetMoreData(email_optin_needed_, settings_ui.email_opt_in_ui());
+ CreateGetMoreData(email_optin_needed_, settings_ui.email_opt_in_ui(),
+ profile_helper->GetProfileByUser(user)->GetPrefs());
bool skip_get_more =
skip_third_party_disclosure && !get_more_data.GetList().size();
@@ -376,9 +380,9 @@ void AssistantOptInFlowScreenHandler::OnGetSettingsResponse(
// Pass string constants dictionary.
auto dictionary = GetSettingsUiStrings(settings_ui, activity_control_needed_);
- dictionary.SetKey("voiceMatchFeatureEnabled",
- base::Value(base::FeatureList::IsEnabled(
- assistant::features::kAssistantVoiceMatch)));
+ dictionary.SetKey("voiceMatchEnabled",
+ base::Value(IsVoiceMatchEnabled(
+ ProfileManager::GetActiveUserProfile()->GetPrefs())));
ReloadContent(dictionary);
}
@@ -444,12 +448,11 @@ void AssistantOptInFlowScreenHandler::HandleThirdPartyScreenUserAction(
void AssistantOptInFlowScreenHandler::HandleVoiceMatchScreenUserAction(
const std::string& action) {
- if (!base::FeatureList::IsEnabled(
- assistant::features::kAssistantVoiceMatch)) {
- return;
- }
PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
+ if (!IsVoiceMatchEnabled(prefs))
+ return;
+
if (action == kVoiceMatchDone) {
RecordAssistantOptInStatus(VOICE_MATCH_ENROLLMENT_DONE);
voice_match_enrollment_done_ = true;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.cc
index 37a61d6e58b..0bd92519d4d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_handler.cc
@@ -8,18 +8,11 @@
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-const char kJsScreenPath[] = "login.AutoEnrollmentCheckScreen";
-
-} // namespace
-
namespace chromeos {
AutoEnrollmentCheckScreenHandler::AutoEnrollmentCheckScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
}
AutoEnrollmentCheckScreenHandler::~AutoEnrollmentCheckScreenHandler() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc
index 6293cb90b89..57c6e84bfdc 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc
@@ -4,12 +4,35 @@
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
+#include "chrome/browser/chromeos/login/screens/base_screen.h"
+#include "chrome/browser/ui/webui/chromeos/login/base_webui_handler.h"
+#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
+
namespace chromeos {
BaseScreenHandler::BaseScreenHandler(OobeScreen oobe_screen,
JSCallsContainer* js_calls_container)
: BaseWebUIHandler(js_calls_container), oobe_screen_(oobe_screen) {}
-BaseScreenHandler::~BaseScreenHandler() {}
+BaseScreenHandler::~BaseScreenHandler() = default;
+
+void BaseScreenHandler::SetBaseScreen(BaseScreen* base_screen) {
+ if (base_screen_ == base_screen)
+ return;
+ base_screen_ = base_screen;
+}
+
+void BaseScreenHandler::RegisterMessages() {
+ if (!user_acted_method_path_.empty()) {
+ AddCallback(user_acted_method_path_, &BaseScreenHandler::HandleUserAction);
+ }
+
+ BaseWebUIHandler::RegisterMessages();
+}
+
+void BaseScreenHandler::HandleUserAction(const std::string& action_id) {
+ if (base_screen_)
+ base_screen_->OnUserAction(action_id);
+}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
index dcbbdedaf31..027f4a8ba67 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
@@ -11,6 +11,8 @@
namespace chromeos {
+class BaseScreen;
+
// Base class for the OOBE/Login WebUI handlers which provide methods specific
// to a particular OobeScreen.
class BaseScreenHandler : public BaseWebUIHandler {
@@ -21,10 +23,35 @@ class BaseScreenHandler : public BaseWebUIHandler {
OobeScreen oobe_screen() const { return oobe_screen_; }
+ void SetBaseScreen(BaseScreen* base_screen);
+
+ // BaseWebUIHandler:
+ void RegisterMessages() override;
+
+ protected:
+ // Set the method identifier for a userActed callback. The actual callback
+ // will be registered in RegisterMessages so this should be called in the
+ // constructor. This takes the full method path, ie,
+ // "login.WelcomeScreen.userActed".
+ //
+ // If this is not called then userActed-style callbacks will not be available
+ // for the screen.
+ void set_user_acted_method_path(const std::string& user_acted_method_path) {
+ user_acted_method_path_ = user_acted_method_path;
+ }
+
private:
+ // Handles user action.
+ void HandleUserAction(const std::string& action_id);
+
+ // Path that is used to invoke user actions.
+ std::string user_acted_method_path_;
+
// OobeScreen that this handler corresponds to.
OobeScreen oobe_screen_ = OobeScreen::SCREEN_UNKNOWN;
+ BaseScreen* base_screen_ = nullptr;
+
DISALLOW_COPY_AND_ASSIGN(BaseScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.cc
index 25d655fd322..021907c86b5 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.cc
@@ -8,46 +8,20 @@
#include "base/logging.h"
#include "base/values.h"
-#include "chrome/browser/chromeos/login/screens/base_screen.h"
-#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "components/login/localized_values_builder.h"
#include "content/public/browser/web_ui.h"
namespace chromeos {
-JSCallsContainer::JSCallsContainer() = default;
-
-JSCallsContainer::~JSCallsContainer() = default;
-
-void JSCallsContainer::ExecuteDeferredJSCalls() {
- DCHECK(!is_initialized());
- is_initialized_ = true;
- // Copy deferred_js_calls_ into a separate variable to avoid any potential
- // concurrent modifications.
- auto calls = std::move(deferred_js_calls_);
- for (const auto& call : calls)
- call.Run();
- // We're initialized so no more calls should have been queued.
- // TODO(jdufault): Rework this class API so that this is not possible.
- DCHECK(deferred_js_calls_.empty());
-}
-
BaseWebUIHandler::BaseWebUIHandler(JSCallsContainer* js_calls_container)
: js_calls_container_(js_calls_container) {}
-BaseWebUIHandler::~BaseWebUIHandler() {
- if (base_screen_)
- base_screen_->set_model_view_channel(nullptr);
-}
+BaseWebUIHandler::~BaseWebUIHandler() = default;
void BaseWebUIHandler::InitializeBase() {
page_is_ready_ = true;
Initialize();
- if (!pending_context_changes_.empty()) {
- CommitContextChanges(pending_context_changes_);
- pending_context_changes_.Clear();
- }
}
void BaseWebUIHandler::GetLocalizedStrings(base::DictionaryValue* dict) {
@@ -56,26 +30,10 @@ void BaseWebUIHandler::GetLocalizedStrings(base::DictionaryValue* dict) {
GetAdditionalParameters(dict);
}
-std::string BaseWebUIHandler::FullMethodPath(const std::string& method) const {
- DCHECK(!method.empty());
- return js_screen_path_prefix_ + method;
-}
-
void BaseWebUIHandler::RegisterMessages() {
- AddCallback(FullMethodPath("userActed"),
- &BaseScreenHandler::HandleUserAction);
- AddCallback(FullMethodPath("contextChanged"),
- &BaseScreenHandler::HandleContextChanged);
DeclareJSCallbacks();
}
-void BaseWebUIHandler::CommitContextChanges(const base::DictionaryValue& diff) {
- if (!page_is_ready())
- pending_context_changes_.MergeDictionary(&diff);
- else
- CallJS(FullMethodPath("contextChanged"), diff);
-}
-
void BaseWebUIHandler::GetAdditionalParameters(base::DictionaryValue* dict) {}
void BaseWebUIHandler::ShowScreen(OobeScreen screen) {
@@ -105,28 +63,26 @@ OobeScreen BaseWebUIHandler::GetCurrentScreen() const {
return oobe_ui->current_screen();
}
-gfx::NativeWindow BaseWebUIHandler::GetNativeWindow() {
- return LoginDisplayHost::default_host()->GetNativeWindow();
-}
-
-void BaseWebUIHandler::SetBaseScreen(BaseScreen* base_screen) {
- if (base_screen_ == base_screen)
- return;
- if (base_screen_)
- base_screen_->set_model_view_channel(nullptr);
- base_screen_ = base_screen;
- if (base_screen_)
- base_screen_->set_model_view_channel(this);
-}
-
-void BaseWebUIHandler::HandleUserAction(const std::string& action_id) {
- if (base_screen_)
- base_screen_->OnUserAction(action_id);
+void BaseWebUIHandler::InsertIntoList(std::vector<base::Value>*) {}
+
+void BaseWebUIHandler::MaybeRecordIncomingEvent(
+ const std::string& function_name,
+ const base::ListValue* args) {
+ if (js_calls_container_->record_all_events_for_test()) {
+ // Do a clone so |args| is still available for the actual handler.
+ std::vector<base::Value> arguments = std::move(args->Clone().GetList());
+ js_calls_container_->events()->emplace_back(
+ JSCallsContainer::Event(JSCallsContainer::Event::Type::kIncoming,
+ function_name, std::move(arguments)));
+ }
}
-void BaseWebUIHandler::HandleContextChanged(const base::DictionaryValue* diff) {
- if (diff && base_screen_)
- base_screen_->OnContextChanged(*diff);
+void BaseWebUIHandler::OnRawCallback(
+ const std::string& function_name,
+ const content::WebUI::MessageCallback callback,
+ const base::ListValue* args) {
+ MaybeRecordIncomingEvent(function_name, args);
+ callback.Run(args);
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h
index 9722baa6aaf..61c9eefd06b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h
@@ -6,15 +6,15 @@
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_
#include <string>
+#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/macros.h"
#include "chrome/browser/chromeos/login/oobe_screen.h"
-#include "chrome/browser/chromeos/login/screens/model_view_channel.h"
+#include "chrome/browser/ui/webui/chromeos/login/js_calls_container.h"
#include "components/login/base_screen_handler_utils.h"
-#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "ui/gfx/native_widget_types.h"
@@ -29,49 +29,14 @@ class LocalizedValuesBuilder;
namespace chromeos {
-class BaseScreen;
class OobeUI;
-// A helper class to store deferred Javascript calls, shared by subclasses of
-// BaseWebUIHandler.
-// TODO(jdufault): Move into a separate file
-class JSCallsContainer {
- public:
- JSCallsContainer();
- ~JSCallsContainer();
-
- // Used to decide whether the JS call should be deferred.
- bool is_initialized() const { return is_initialized_; }
-
- // Used to add deferred calls to.
- std::vector<base::Closure>& deferred_js_calls() { return deferred_js_calls_; }
-
- // Executes Javascript calls that were deferred while the instance was not
- // initialized yet.
- void ExecuteDeferredJSCalls();
-
- private:
- // Whether the instance is initialized.
- //
- // The instance becomes initialized after the corresponding message is
- // received from Javascript side.
- bool is_initialized_ = false;
-
- // Javascript calls that have been deferred while the instance was not
- // initialized yet.
- std::vector<base::Closure> deferred_js_calls_;
-};
-
// Base class for all oobe/login WebUI handlers. These handlers are the binding
// layer that allow the C++ and JavaScript code to communicate.
//
// If the deriving type is associated with a specific OobeScreen, it should
// derive from BaseScreenHandler instead of BaseWebUIHandler.
-//
-// TODO(jdufault): Move all OobeScreen related concepts out of BaseWebUIHandler
-// and into BaseScreenHandler.
-class BaseWebUIHandler : public content::WebUIMessageHandler,
- public ModelViewChannel {
+class BaseWebUIHandler : public content::WebUIMessageHandler {
public:
explicit BaseWebUIHandler(JSCallsContainer* js_calls_container);
~BaseWebUIHandler() override;
@@ -82,27 +47,10 @@ class BaseWebUIHandler : public content::WebUIMessageHandler,
// WebUIMessageHandler implementation:
void RegisterMessages() override;
- // ModelViewChannel implementation:
- void CommitContextChanges(const base::DictionaryValue& diff) override;
-
// This method is called when page is ready. It propagates to inherited class
// via virtual Initialize() method (see below).
void InitializeBase();
- // Set the prefix used when running CallJs with a method. For example,
- // set_call_js_prefix("Oobe")
- // CallJs("lock") -> Invokes JS global named "Oobe.lock"
- void set_call_js_prefix(const std::string& prefix) {
- js_screen_path_prefix_ = prefix + ".";
- }
-
- void set_async_assets_load_id(const std::string& async_assets_load_id) {
- async_assets_load_id_ = async_assets_load_id;
- }
- const std::string& async_assets_load_id() const {
- return async_assets_load_id_;
- }
-
protected:
// All subclasses should implement this method to provide localized values.
virtual void DeclareLocalizedValues(
@@ -110,110 +58,57 @@ class BaseWebUIHandler : public content::WebUIMessageHandler,
// All subclasses should implement this method to register callbacks for JS
// messages.
- //
- // TODO (ygorshenin, crbug.com/433797): make this method purely vrtual when
- // all screens will be switched to use ScreenContext.
virtual void DeclareJSCallbacks() {}
// Subclasses can override these methods to pass additional parameters
- // to loadTimeData. Generally, it is a bad approach, and it should be replaced
- // with Context at some point.
+ // to loadTimeData.
virtual void GetAdditionalParameters(base::DictionaryValue* parameters);
- void CallJS(const std::string& function_name) {
- if (js_calls_container_->is_initialized()) {
- web_ui()->CallJavascriptFunctionUnsafe(function_name);
- } else {
- js_calls_container_->deferred_js_calls().push_back(
- base::Bind(&BaseWebUIHandler::CallJavascriptFunctionImmediate<>,
- base::Unretained(this), function_name));
- }
- }
-
- template <typename A1>
- void CallJS(const std::string& function_name, const A1& arg1) {
- if (js_calls_container_->is_initialized()) {
- web_ui()->CallJavascriptFunctionUnsafe(function_name,
- ::login::MakeValue(arg1));
- } else {
- js_calls_container_->deferred_js_calls().push_back(base::Bind(
- &BaseWebUIHandler::CallJavascriptFunctionImmediate<base::Value>,
- base::Unretained(this), function_name,
- ::login::MakeValue(arg1).Clone()));
- }
- }
-
- template <typename A1, typename A2>
- void CallJS(const std::string& function_name,
- const A1& arg1,
- const A2& arg2) {
- if (js_calls_container_->is_initialized()) {
- web_ui()->CallJavascriptFunctionUnsafe(
- function_name, ::login::MakeValue(arg1), ::login::MakeValue(arg2));
- } else {
- js_calls_container_->deferred_js_calls().push_back(base::Bind(
- &BaseWebUIHandler::CallJavascriptFunctionImmediate<base::Value,
- base::Value>,
- base::Unretained(this), function_name,
- ::login::MakeValue(arg1).Clone(), ::login::MakeValue(arg2).Clone()));
- }
- }
-
- template <typename A1, typename A2, typename A3>
- void CallJS(const std::string& function_name,
- const A1& arg1,
- const A2& arg2,
- const A3& arg3) {
- if (js_calls_container_->is_initialized()) {
- web_ui()->CallJavascriptFunctionUnsafe(
- function_name, ::login::MakeValue(arg1), ::login::MakeValue(arg2),
- ::login::MakeValue(arg3));
- } else {
- js_calls_container_->deferred_js_calls().push_back(base::Bind(
- &BaseWebUIHandler::CallJavascriptFunctionImmediate<
- base::Value, base::Value, base::Value>,
- base::Unretained(this), function_name,
- ::login::MakeValue(arg1).Clone(), ::login::MakeValue(arg2).Clone(),
- ::login::MakeValue(arg3).Clone()));
+ // Run a JavaScript function. If the backing webui that this handler is not
+ // fully loaded, then the JS call will be deferred and executed after the
+ // initialize message.
+ //
+ // All CallJS invocations can be recorded for tests if CallJS recording is
+ // enabled.
+ template <typename... Args>
+ void CallJS(const std::string& function_name, const Args&... args) {
+ // Record the call if the WebUI is not loaded or if we are in a test.
+ if (!js_calls_container_->is_initialized() ||
+ js_calls_container_->record_all_events_for_test()) {
+ std::vector<base::Value> arguments;
+ InsertIntoList(&arguments, args...);
+ js_calls_container_->events()->emplace_back(
+ JSCallsContainer::Event(JSCallsContainer::Event::Type::kOutgoing,
+ function_name, std::move(arguments)));
}
- }
- template <typename A1, typename A2, typename A3, typename A4>
- void CallJS(const std::string& function_name,
- const A1& arg1,
- const A2& arg2,
- const A3& arg3,
- const A4& arg4) {
- if (js_calls_container_->is_initialized()) {
+ // Make the call now if the WebUI is loaded.
+ if (js_calls_container_->is_initialized())
web_ui()->CallJavascriptFunctionUnsafe(
- function_name, ::login::MakeValue(arg1), ::login::MakeValue(arg2),
- ::login::MakeValue(arg3), ::login::MakeValue(arg4));
- } else {
- js_calls_container_->deferred_js_calls().push_back(base::Bind(
- &BaseWebUIHandler::CallJavascriptFunctionImmediate<
- base::Value, base::Value, base::Value, base::Value>,
- base::Unretained(this), function_name,
- ::login::MakeValue(arg1).Clone(), ::login::MakeValue(arg2).Clone(),
- ::login::MakeValue(arg3).Clone(), ::login::MakeValue(arg4).Clone()));
- }
+ function_name, ::login::MakeValue(args).Clone()...);
}
- // Shortcut methods for adding WebUI callbacks.
+ // Register WebUI callbacks. The callbacks will be recorded if recording is
+ // enabled.
template <typename T>
- void AddRawCallback(const std::string& name,
+ void AddRawCallback(const std::string& function_name,
void (T::*method)(const base::ListValue* args)) {
+ content::WebUI::MessageCallback callback =
+ base::BindRepeating(method, base::Unretained(static_cast<T*>(this)));
web_ui()->RegisterMessageCallback(
- name,
- base::BindRepeating(method, base::Unretained(static_cast<T*>(this))));
+ function_name,
+ base::BindRepeating(&BaseWebUIHandler::OnRawCallback,
+ base::Unretained(this), function_name, callback));
}
-
template <typename T, typename... Args>
- void AddCallback(const std::string& name, void (T::*method)(Args...)) {
+ void AddCallback(const std::string& function_name,
+ void (T::*method)(Args...)) {
base::RepeatingCallback<void(Args...)> callback =
- base::Bind(method, base::Unretained(static_cast<T*>(this)));
+ base::BindRepeating(method, base::Unretained(static_cast<T*>(this)));
web_ui()->RegisterMessageCallback(
- name,
- base::BindRepeating(&::login::CallbackWrapper<Args...>, callback));
+ function_name,
+ base::BindRepeating(&BaseWebUIHandler::OnCallback<Args...>,
+ base::Unretained(this), function_name, callback));
}
// Called when the page is ready and handler can do initialization.
@@ -234,49 +129,49 @@ class BaseWebUIHandler : public content::WebUIMessageHandler,
// Whether page is ready.
bool page_is_ready() const { return page_is_ready_; }
- // Returns the window which shows us.
- virtual gfx::NativeWindow GetNativeWindow();
-
- void SetBaseScreen(BaseScreen* base_screen);
-
private:
friend class OobeUI;
- // This function provides a unique name for every overload of
- // CallJavascriptFunctionUnsafe, allowing it to be used in base::Bind.
+ // InsertIntoList takes a template parameter pack and expands into the
+ // following form:
+ //
+ // for (auto arg : args)
+ // stroage->emplace_back(::login::MakeValue(arg).Clone());
+ //
+ // This cannot be expressed with the current parameter pack expansion rules
+ // and the only way to do it is via compile-time recursion.
+ template <typename Head, typename... Tail>
+ void InsertIntoList(std::vector<base::Value>* storage,
+ const Head& head,
+ const Tail&... tail) {
+ storage->emplace_back(::login::MakeValue(head).Clone());
+ InsertIntoList(storage, tail...);
+ }
+ // Base condition for the recursion, when there are no more elements to
+ // insert. Does nothing.
+ void InsertIntoList(std::vector<base::Value>*);
+
+ // Record |function_name| and |args| as an incoming event if recording is
+ // enabled.
+ void MaybeRecordIncomingEvent(const std::string& function_name,
+ const base::ListValue* args);
+
+ // These two functions wrap Add(Raw)Callback so that the incoming JavaScript
+ // event can be recorded.
+ void OnRawCallback(const std::string& function_name,
+ const content::WebUI::MessageCallback callback,
+ const base::ListValue* args);
template <typename... Args>
- void CallJavascriptFunctionImmediate(const std::string& function_name,
- const Args&... args) {
- web_ui()->CallJavascriptFunctionUnsafe(function_name, args...);
+ void OnCallback(const std::string& function_name,
+ const base::RepeatingCallback<void(Args...)>& callback,
+ const base::ListValue* args) {
+ MaybeRecordIncomingEvent(function_name, args);
+ ::login::CallbackWrapper<Args...>(callback, args);
}
- // Returns full name of JS method based on screen and method names.
- std::string FullMethodPath(const std::string& method) const;
-
- // Handles user action.
- void HandleUserAction(const std::string& action_id);
-
- // Handles situation when screen context is changed.
- void HandleContextChanged(const base::DictionaryValue* diff);
-
// Keeps whether page is ready.
bool page_is_ready_ = false;
- BaseScreen* base_screen_ = nullptr;
-
- // Full name of the corresponding JS screen object. Can be empty, if
- // there are no corresponding screen object or several different
- // objects.
- std::string js_screen_path_prefix_;
-
- // The string id used in the async asset load in JS. If it is set to a
- // non empty value, the Initialize will be deferred until the underlying load
- // is finished.
- std::string async_assets_load_id_;
-
- // Pending changes to context which will be sent when the page will be ready.
- base::DictionaryValue pending_context_changes_;
-
JSCallsContainer* js_calls_container_ = nullptr; // non-owning pointers.
DISALLOW_COPY_AND_ASSIGN(BaseWebUIHandler);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
index 85c395cc24b..8dd92f5554b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
@@ -62,8 +62,6 @@ namespace chromeos {
namespace {
-const char kJsScreenPath[] = "cr.ui.Oobe";
-
bool IsRemoraRequisition() {
policy::DeviceCloudPolicyManagerChromeOS* policy_manager =
g_browser_process->platform_part()
@@ -94,7 +92,6 @@ CoreOobeHandler::CoreOobeHandler(JSCallsContainer* js_calls_container)
version_info_updater_(this),
weak_ptr_factory_(this) {
DCHECK(js_calls_container);
- set_call_js_prefix(kJsScreenPath);
AccessibilityManager* accessibility_manager = AccessibilityManager::Get();
CHECK(accessibility_manager);
accessibility_subscription_ = accessibility_manager->RegisterCallback(
@@ -208,7 +205,6 @@ void CoreOobeHandler::RegisterMessages() {
&CoreOobeHandler::HandleEnableDockedMagnifier);
AddCallback("setDeviceRequisition",
&CoreOobeHandler::HandleSetDeviceRequisition);
- AddCallback("screenAssetsLoaded", &CoreOobeHandler::HandleScreenAssetsLoaded);
AddRawCallback("skipToLoginForTesting",
&CoreOobeHandler::HandleSkipToLoginForTesting);
AddCallback("skipToUpdateForTesting",
@@ -217,7 +213,6 @@ void CoreOobeHandler::RegisterMessages() {
AddCallback("toggleResetScreen", &CoreOobeHandler::HandleToggleResetScreen);
AddCallback("toggleEnableDebuggingScreen",
&CoreOobeHandler::HandleEnableDebuggingScreen);
- AddCallback("headerBarVisible", &CoreOobeHandler::HandleHeaderBarVisible);
AddCallback("raiseTabKeyEvent", &CoreOobeHandler::HandleRaiseTabKeyEvent);
// Note: Used by enterprise_RemoraRequisitionDisplayUsage.py:
// TODO(felixe): Use chrome.system.display or cros_display_config.mojom,
@@ -303,10 +298,6 @@ void CoreOobeHandler::ReloadEulaContent(
CallJS("cr.ui.Oobe.reloadEulaContent", dictionary);
}
-void CoreOobeHandler::ShowControlBar(bool show) {
- CallJS("cr.ui.Oobe.showControlBar", show);
-}
-
void CoreOobeHandler::SetVirtualKeyboardShown(bool shown) {
CallJS("cr.ui.Oobe.setVirtualKeyboardShown", shown);
}
@@ -402,11 +393,6 @@ void CoreOobeHandler::HandleSetDeviceRequisition(
}
}
-void CoreOobeHandler::HandleScreenAssetsLoaded(
- const std::string& screen_async_load_id) {
- GetOobeUI()->OnScreenAssetsLoaded(screen_async_load_id);
-}
-
void CoreOobeHandler::HandleSkipToLoginForTesting(const base::ListValue* args) {
LoginScreenContext context;
@@ -479,11 +465,6 @@ void CoreOobeHandler::ShowOobeUI(bool show) {
UpdateOobeUIVisibility();
}
-void CoreOobeHandler::UpdateShutdownAndRebootVisibility(
- bool reboot_on_shutdown) {
- CallJS("cr.ui.Oobe.showShutdown", !reboot_on_shutdown);
-}
-
void CoreOobeHandler::SetLoginUserCount(int user_count) {
CallJS("cr.ui.Oobe.setLoginUserCount", user_count);
}
@@ -584,7 +565,6 @@ void CoreOobeHandler::UpdateKeyboardState() {
if (!features::IsUsingWindowService()) {
const bool is_keyboard_shown =
ChromeKeyboardControllerClient::Get()->is_keyboard_visible();
- ShowControlBar(!is_keyboard_shown);
SetVirtualKeyboardShown(is_keyboard_shown);
}
}
@@ -618,17 +598,12 @@ void CoreOobeHandler::OnAccessibilityStatusChanged(
void CoreOobeHandler::HandleLaunchHelpApp(double help_topic_id) {
if (!help_app_.get())
- help_app_ = new HelpAppLauncher(GetNativeWindow());
+ help_app_ = new HelpAppLauncher(
+ LoginDisplayHost::default_host()->GetNativeWindow());
help_app_->ShowHelpTopic(
static_cast<HelpAppLauncher::HelpTopic>(help_topic_id));
}
-void CoreOobeHandler::HandleHeaderBarVisible() {
- LoginDisplayHost* login_display_host = LoginDisplayHost::default_host();
- if (login_display_host)
- login_display_host->SetStatusAreaVisible(true);
-}
-
void CoreOobeHandler::HandleRaiseTabKeyEvent(bool reverse) {
ui::KeyEvent event(ui::ET_KEY_PRESSED, ui::VKEY_TAB, ui::EF_NONE);
if (reverse)
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
index 324e0f93d03..815091d2f96 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
@@ -104,7 +104,6 @@ class CoreOobeHandler : public BaseWebUIHandler,
void ClearErrors() override;
void ReloadContent(const base::DictionaryValue& dictionary) override;
void ReloadEulaContent(const base::DictionaryValue& dictionary) override;
- void ShowControlBar(bool show) override;
void SetVirtualKeyboardShown(bool displayed) override;
void SetClientAreaSize(int width, int height) override;
void ShowDeviceResetScreen() override;
@@ -134,13 +133,11 @@ class CoreOobeHandler : public BaseWebUIHandler,
void HandleSkipUpdateEnrollAfterEula();
void HandleUpdateCurrentScreen(const std::string& screen);
void HandleSetDeviceRequisition(const std::string& requisition);
- void HandleScreenAssetsLoaded(const std::string& screen_async_load_id);
void HandleSkipToLoginForTesting(const base::ListValue* args);
void HandleSkipToUpdateForTesting();
void HandleLaunchHelpApp(double help_topic_id);
void HandleToggleResetScreen();
void HandleEnableDebuggingScreen();
- void HandleHeaderBarVisible();
void HandleSetOobeBootstrappingSlave();
void HandleGetPrimaryDisplayNameForTesting(const base::ListValue* args);
void GetPrimaryDisplayNameCallback(
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.cc
index 74b95b90224..1c7189648e2 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.cc
@@ -9,18 +9,12 @@
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-constexpr char kJsScreenPath[] = "login.DemoPreferencesScreen";
-
-} // namespace
-
namespace chromeos {
DemoPreferencesScreenHandler::DemoPreferencesScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.DemoPreferencesScreen.userActed");
}
DemoPreferencesScreenHandler::~DemoPreferencesScreenHandler() {
@@ -39,6 +33,12 @@ void DemoPreferencesScreenHandler::Bind(DemoPreferencesScreen* screen) {
BaseScreenHandler::SetBaseScreen(screen);
}
+void DemoPreferencesScreenHandler::SetInputMethodId(
+ const std::string& input_method) {
+ CallJS("login.DemoPreferencesScreen.setInputMethodIdFromBackend",
+ input_method);
+}
+
void DemoPreferencesScreenHandler::Initialize() {}
void DemoPreferencesScreenHandler::DeclareLocalizedValues(
@@ -55,4 +55,31 @@ void DemoPreferencesScreenHandler::DeclareLocalizedValues(
builder->Add("countryDropdownLabel", IDS_COUNTRY_DROPDOWN_LABEL);
}
+void DemoPreferencesScreenHandler::DeclareJSCallbacks() {
+ AddCallback("DemoPreferencesScreen.setLocaleId",
+ &DemoPreferencesScreenHandler::HandleSetLocaleId);
+ AddCallback("DemoPreferencesScreen.setInputMethodId",
+ &DemoPreferencesScreenHandler::HandleSetInputMethodId);
+ AddCallback("DemoPreferencesScreen.setDemoModeCountry",
+ &DemoPreferencesScreenHandler::HandleSetDemoModeCountry);
+}
+
+void DemoPreferencesScreenHandler::HandleSetLocaleId(
+ const std::string& language_id) {
+ if (screen_)
+ screen_->SetLocale(language_id);
+}
+
+void DemoPreferencesScreenHandler::HandleSetInputMethodId(
+ const std::string& input_method_id) {
+ if (screen_)
+ screen_->SetInputMethod(input_method_id);
+}
+
+void DemoPreferencesScreenHandler::HandleSetDemoModeCountry(
+ const std::string& country_id) {
+ if (screen_)
+ screen_->SetDemoModeCountry(country_id);
+}
+
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.h
index 334a8c2383e..67cb16e2a68 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/demo_preferences_screen_handler.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_PREFERENCES_SCREEN_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_PREFERENCES_SCREEN_HANDLER_H_
+#include <string>
+
#include "chrome/browser/chromeos/login/screens/demo_preferences_screen_view.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
@@ -23,13 +25,19 @@ class DemoPreferencesScreenHandler : public BaseScreenHandler,
void Show() override;
void Hide() override;
void Bind(DemoPreferencesScreen* screen) override;
+ void SetInputMethodId(const std::string& input_method) override;
// BaseScreenHandler:
void Initialize() override;
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
+ void DeclareJSCallbacks() override;
private:
+ void HandleSetLocaleId(const std::string& language_id);
+ void HandleSetInputMethodId(const std::string& language_id);
+ void HandleSetDemoModeCountry(const std::string& country_id);
+
DemoPreferencesScreen* screen_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(DemoPreferencesScreenHandler);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.cc
index 41ed07ea4f2..13f49e44eab 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.cc
@@ -12,18 +12,12 @@
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-constexpr char kJsScreenPath[] = "login.DemoSetupScreen";
-
-} // namespace
-
namespace chromeos {
DemoSetupScreenHandler::DemoSetupScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.DemoSetupScreen.userActed");
}
DemoSetupScreenHandler::~DemoSetupScreenHandler() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.cc
index 1eb016f8a0c..799463ef898 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/device_disabled_screen_handler.cc
@@ -9,18 +9,11 @@
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-const char kJsScreenPath[] = "login.DeviceDisabledScreen";
-
-} // namespace
-
namespace chromeos {
DeviceDisabledScreenHandler::DeviceDisabledScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
}
DeviceDisabledScreenHandler::~DeviceDisabledScreenHandler() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.cc
index f65d9146088..f3d17c9f2a2 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.cc
@@ -4,18 +4,9 @@
#include "chrome/browser/ui/webui/chromeos/login/discover/discover_handler.h"
-namespace {
-
-const char kDiscoverJsPrefix[] = "discover.";
-
-} // namespace
-
namespace chromeos {
-DiscoverHandler::DiscoverHandler(const std::string& screen_name,
- JSCallsContainer* js_calls_container)
- : BaseWebUIHandler(js_calls_container) {
- set_call_js_prefix(kDiscoverJsPrefix + screen_name);
-}
+DiscoverHandler::DiscoverHandler(JSCallsContainer* js_calls_container)
+ : BaseWebUIHandler(js_calls_container) {}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.h
index 1793e28d4ab..b72962e2a1d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_handler.h
@@ -15,8 +15,7 @@ namespace chromeos {
// Base class for Discover modules WebUI message handler.
class DiscoverHandler : public BaseWebUIHandler {
public:
- DiscoverHandler(const std::string& module_name,
- JSCallsContainer* js_calls_container);
+ explicit DiscoverHandler(JSCallsContainer* js_calls_container);
~DiscoverHandler() override = default;
private:
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_ui.cc
index e1d4de0452c..9074fdcfb1d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/discover_ui.cc
@@ -100,7 +100,7 @@ void DiscoverUI::GetAdditionalParameters(base::DictionaryValue* dict) {
void DiscoverUI::Initialize() {
for (Observer& observer : observers_)
observer.OnInitialized();
- js_calls_container_.ExecuteDeferredJSCalls();
+ js_calls_container_.ExecuteDeferredJSCalls(web_ui_);
}
void DiscoverUI::Show() {}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_launch_help_app.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_launch_help_app.cc
index 39268c45e77..1617526e79f 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_launch_help_app.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_launch_help_app.cc
@@ -37,8 +37,7 @@ class DiscoverModuleLaunchHelpAppHandler : public DiscoverHandler {
DiscoverModuleLaunchHelpAppHandler::DiscoverModuleLaunchHelpAppHandler(
JSCallsContainer* js_calls_container)
- : DiscoverHandler(DiscoverModuleLaunchHelpApp::kModuleName,
- js_calls_container) {}
+ : DiscoverHandler(js_calls_container) {}
void DiscoverModuleLaunchHelpAppHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc
index f33be2524e7..b43a2040cf9 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.cc
@@ -50,7 +50,7 @@ class DiscoverModulePinSetupHandler : public DiscoverHandler {
DiscoverModulePinSetupHandler::DiscoverModulePinSetupHandler(
base::WeakPtr<DiscoverModulePinSetup> module,
JSCallsContainer* js_calls_container)
- : DiscoverHandler(DiscoverModulePinSetup::kModuleName, js_calls_container),
+ : DiscoverHandler(js_calls_container),
module_(module),
weak_factory_(this) {}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_redeem_offers.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_redeem_offers.cc
index ebac5c3add2..2368cb9767b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_redeem_offers.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_redeem_offers.cc
@@ -31,8 +31,7 @@ class DiscoverModuleRedeemOffersHandler : public DiscoverHandler {
DiscoverModuleRedeemOffersHandler::DiscoverModuleRedeemOffersHandler(
JSCallsContainer* js_calls_container)
- : DiscoverHandler(DiscoverModuleRedeemOffers::kModuleName,
- js_calls_container) {}
+ : DiscoverHandler(js_calls_container) {}
void DiscoverModuleRedeemOffersHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_set_wallpaper.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_set_wallpaper.cc
index 412b34e4c5b..302aaee430a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_set_wallpaper.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_set_wallpaper.cc
@@ -35,8 +35,7 @@ class DiscoverModuleSetWallpaperHandler : public DiscoverHandler {
DiscoverModuleSetWallpaperHandler::DiscoverModuleSetWallpaperHandler(
JSCallsContainer* js_calls_container)
- : DiscoverHandler(DiscoverModuleSetWallpaper::kModuleName,
- js_calls_container) {}
+ : DiscoverHandler(js_calls_container) {}
void DiscoverModuleSetWallpaperHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_sync_files.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_sync_files.cc
index af6248307d9..da7e72eb649 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_sync_files.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_sync_files.cc
@@ -30,8 +30,7 @@ class DiscoverModuleSyncFilesHandler : public DiscoverHandler {
DiscoverModuleSyncFilesHandler::DiscoverModuleSyncFilesHandler(
JSCallsContainer* js_calls_container)
- : DiscoverHandler(DiscoverModuleSyncFiles::kModuleName,
- js_calls_container) {}
+ : DiscoverHandler(js_calls_container) {}
void DiscoverModuleSyncFilesHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_welcome.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_welcome.cc
index 2eb387ed874..6ee59675fb7 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_welcome.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_welcome.cc
@@ -30,7 +30,7 @@ class DiscoverModuleWelcomeHandler : public DiscoverHandler {
DiscoverModuleWelcomeHandler::DiscoverModuleWelcomeHandler(
JSCallsContainer* js_calls_container)
- : DiscoverHandler(DiscoverModuleWelcome::kModuleName, js_calls_container) {}
+ : DiscoverHandler(js_calls_container) {}
void DiscoverModuleWelcomeHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/discover_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/discover_screen_handler.cc
index 7bd59779b1d..520c7c1f7e2 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/discover_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/discover_screen_handler.cc
@@ -6,18 +6,12 @@
#include "chrome/browser/chromeos/login/screens/discover_screen.h"
-namespace {
-
-const char kJsScreenPath[] = "login.DiscoverScreen";
-
-} // namespace
-
namespace chromeos {
DiscoverScreenHandler::DiscoverScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.DiscoverScreen.userActed");
}
DiscoverScreenHandler::~DiscoverScreenHandler() {}
@@ -26,7 +20,7 @@ void DiscoverScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {}
void DiscoverScreenHandler::RegisterMessages() {
- BaseWebUIHandler::RegisterMessages();
+ BaseScreenHandler::RegisterMessages();
discover_ui_.RegisterMessages(web_ui());
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc
index 0db2527cf58..675b9ba5791 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc
@@ -11,16 +11,19 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/login/oobe_screen.h"
+#include "chrome/browser/chromeos/login/screens/enable_debugging_screen.h"
+#include "chrome/browser/chromeos/login/screens/enable_debugging_screen_view.h"
+#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/chromeos/login/ui/login_web_dialog.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/constants/chromeos_switches.h"
-#include "chromeos/dbus/cryptohome_client.h"
+#include "chromeos/dbus/cryptohome/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/debug_daemon_client.h"
-#include "chromeos/dbus/power_manager_client.h"
+#include "chromeos/dbus/power/power_manager_client.h"
#include "components/login/localized_values_builder.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
@@ -28,24 +31,17 @@
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/base/l10n/l10n_util.h"
-namespace {
-
-const char kJsScreenPath[] = "login.EnableDebuggingScreen";
-
-} // namespace
-
namespace chromeos {
EnableDebuggingScreenHandler::EnableDebuggingScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container),
weak_ptr_factory_(this) {
- set_call_js_prefix(kJsScreenPath);
}
EnableDebuggingScreenHandler::~EnableDebuggingScreenHandler() {
- if (delegate_)
- delegate_->OnViewDestroyed(this);
+ if (screen_)
+ screen_->OnViewDestroyed(this);
}
void EnableDebuggingScreenHandler::ShowWithParams() {
@@ -56,8 +52,7 @@ void EnableDebuggingScreenHandler::ShowWithParams() {
DVLOG(1) << "Showing enable debugging screen.";
// Wait for cryptohomed before checking debugd. See http://crbug.com/440506.
- chromeos::CryptohomeClient* client =
- chromeos::DBusThreadManager::Get()->GetCryptohomeClient();
+ chromeos::CryptohomeClient* client = chromeos::CryptohomeClient::Get();
client->WaitForServiceToBeAvailable(base::Bind(
&EnableDebuggingScreenHandler::OnCryptohomeDaemonAvailabilityChecked,
weak_ptr_factory_.GetWeakPtr()));
@@ -76,8 +71,8 @@ void EnableDebuggingScreenHandler::Hide() {
weak_ptr_factory_.InvalidateWeakPtrs();
}
-void EnableDebuggingScreenHandler::SetDelegate(Delegate* delegate) {
- delegate_ = delegate;
+void EnableDebuggingScreenHandler::SetDelegate(EnableDebuggingScreen* screen) {
+ screen_ = screen;
if (page_is_ready())
Initialize();
}
@@ -127,7 +122,7 @@ void EnableDebuggingScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) {
}
void EnableDebuggingScreenHandler::Initialize() {
- if (!page_is_ready() || !delegate_)
+ if (!page_is_ready() || !screen_)
return;
if (show_on_init_) {
@@ -150,13 +145,13 @@ void EnableDebuggingScreenHandler::RegisterMessages() {
}
void EnableDebuggingScreenHandler::HandleOnCancel() {
- if (delegate_)
- delegate_->OnExit(false);
+ if (screen_)
+ screen_->OnExit(false);
}
void EnableDebuggingScreenHandler::HandleOnDone() {
- if (delegate_)
- delegate_->OnExit(true);
+ if (screen_)
+ screen_->OnExit(true);
}
void EnableDebuggingScreenHandler::HandleOnRemoveRootFSProtection() {
@@ -283,12 +278,10 @@ void EnableDebuggingScreenHandler::HandleOnLearnMore() {
l10n_util::GetStringUTF8(IDS_ENABLE_DEBUGGING_HELP);
const GURL data_url = GURL("data:text/html;charset=utf-8," + help_content);
- LoginWebDialog* dialog = new LoginWebDialog(
- Profile::FromWebUI(web_ui()),
- NULL,
- GetNativeWindow(),
- base::string16(),
- data_url);
+ LoginWebDialog* dialog =
+ new LoginWebDialog(Profile::FromWebUI(web_ui()), NULL,
+ LoginDisplayHost::default_host()->GetNativeWindow(),
+ base::string16(), data_url);
dialog->Show();
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h
index 34c4ee84f48..222824208fb 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.h
@@ -27,7 +27,7 @@ class EnableDebuggingScreenHandler : public EnableDebuggingScreenView,
// EnableDebuggingScreenView implementation:
void Show() override;
void Hide() override;
- void SetDelegate(Delegate* delegate) override;
+ void SetDelegate(EnableDebuggingScreen* screen) override;
// BaseScreenHandler implementation:
void DeclareLocalizedValues(
@@ -76,7 +76,7 @@ class EnableDebuggingScreenHandler : public EnableDebuggingScreenView,
// Updates UI state.
void UpdateUIState(UIState state);
- Delegate* delegate_ = nullptr;
+ EnableDebuggingScreen* screen_ = nullptr;
// Keeps whether screen should be shown right after initialization.
bool show_on_init_ = false;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
index 49d1fcd5ca3..57d39302423 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
@@ -30,11 +30,11 @@
#include "chromeos/cryptohome/async_method_caller.h"
#include "chromeos/cryptohome/cryptohome_util.h"
#include "chromeos/cryptohome/homedir_methods.h"
-#include "chromeos/dbus/cryptohome_client.h"
+#include "chromeos/dbus/cryptohome/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/power/power_manager_client.h"
+#include "chromeos/dbus/power/power_policy_controller.h"
#include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
-#include "chromeos/dbus/power_manager_client.h"
-#include "chromeos/dbus/power_policy_controller.h"
#include "components/login/localized_values_builder.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_thread.h"
@@ -49,8 +49,6 @@
namespace {
-constexpr char kJsScreenPath[] = "login.EncryptionMigrationScreen";
-
// Path to the mount point to check the available space.
constexpr char kCheckStoragePath[] = "/home";
@@ -259,13 +257,12 @@ EncryptionMigrationScreenHandler::EncryptionMigrationScreenHandler(
: BaseScreenHandler(kScreenId, js_calls_container),
tick_clock_(base::DefaultTickClock::GetInstance()),
weak_ptr_factory_(this) {
- set_call_js_prefix(kJsScreenPath);
free_disk_space_fetcher_ = base::Bind(&base::SysInfo::AmountOfFreeDiskSpace,
base::FilePath(kCheckStoragePath));
}
EncryptionMigrationScreenHandler::~EncryptionMigrationScreenHandler() {
- DBusThreadManager::Get()->GetCryptohomeClient()->RemoveObserver(this);
+ CryptohomeClient::Get()->RemoveObserver(this);
PowerManagerClient::Get()->RemoveObserver(this);
if (delegate_)
delegate_->OnViewDestroyed(this);
@@ -578,7 +575,7 @@ void EncryptionMigrationScreenHandler::StartMigration() {
} else {
auth_request = CreateAuthorizationRequest();
}
- DBusThreadManager::Get()->GetCryptohomeClient()->MountEx(
+ CryptohomeClient::Get()->MountEx(
cryptohome::CreateAccountIdentifierFromAccountId(
user_context_.GetAccountId()),
auth_request, mount,
@@ -605,8 +602,8 @@ void EncryptionMigrationScreenHandler::OnMountExistingVault(
cryptohome::MigrateToDircryptoRequest request;
request.set_minimal_migration(IsMinimalMigration());
- DBusThreadManager::Get()->GetCryptohomeClient()->AddObserver(this);
- DBusThreadManager::Get()->GetCryptohomeClient()->MigrateToDircrypto(
+ CryptohomeClient::Get()->AddObserver(this);
+ CryptohomeClient::Get()->MigrateToDircrypto(
cryptohome::CreateAccountIdentifierFromAccountId(
user_context_.GetAccountId()),
request,
@@ -653,7 +650,7 @@ void EncryptionMigrationScreenHandler::RemoveCryptohome() {
cryptohome::AccountIdentifier account_id_proto;
account_id_proto.set_account_id(cryptohome_id.id());
- DBusThreadManager::Get()->GetCryptohomeClient()->RemoveEx(
+ CryptohomeClient::Get()->RemoveEx(
account_id_proto,
base::BindOnce(&EncryptionMigrationScreenHandler::OnRemoveCryptohome,
weak_ptr_factory_.GetWeakPtr()));
@@ -714,7 +711,7 @@ void EncryptionMigrationScreenHandler::DircryptoMigrationProgress(
RecordMigrationResultSuccess(IsResumingIncompleteMigration(),
IsArcKiosk());
// Stop listening to the progress updates.
- DBusThreadManager::Get()->GetCryptohomeClient()->RemoveObserver(this);
+ CryptohomeClient::Get()->RemoveObserver(this);
// If the battery level decreased during migration, record the consumed
// battery level.
if (current_battery_percent_ &&
@@ -751,7 +748,7 @@ void EncryptionMigrationScreenHandler::DircryptoMigrationProgress(
RecordMigrationResultGeneralFailure(IsResumingIncompleteMigration(),
IsArcKiosk());
// Stop listening to the progress updates.
- DBusThreadManager::Get()->GetCryptohomeClient()->RemoveObserver(this);
+ CryptohomeClient::Get()->RemoveObserver(this);
// Shows error screen after removing user directory is completed.
RemoveCryptohome();
break;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
index 35364a39376..8e2c0c1bbca 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
@@ -15,9 +15,9 @@
#include "chrome/browser/chromeos/login/screens/encryption_migration_screen_view.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chromeos/cryptohome/cryptohome_parameters.h"
+#include "chromeos/dbus/cryptohome/cryptohome_client.h"
#include "chromeos/dbus/cryptohome/rpc.pb.h"
-#include "chromeos/dbus/cryptohome_client.h"
-#include "chromeos/dbus/power_manager_client.h"
+#include "chromeos/dbus/power/power_manager_client.h"
#include "chromeos/login/auth/user_context.h"
#include "services/device/public/mojom/wake_lock.mojom.h"
#include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h"
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc
index acdcf14933b..081fdff1bfb 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc
@@ -16,11 +16,10 @@
#include "chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h"
#include "chromeos/cryptohome/homedir_methods.h"
#include "chromeos/cryptohome/mock_async_method_caller.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_cryptohome_client.h"
-#include "chromeos/dbus/fake_power_manager_client.h"
-#include "chromeos/dbus/power_policy_controller.h"
-#include "chromeos/dbus/util/account_identifier_operators.h"
+#include "chromeos/dbus/cryptohome/account_identifier_operators.h"
+#include "chromeos/dbus/cryptohome/fake_cryptohome_client.h"
+#include "chromeos/dbus/power/fake_power_manager_client.h"
+#include "chromeos/dbus/power/power_policy_controller.h"
#include "chromeos/login/auth/key.h"
#include "chromeos/login/auth/user_context.h"
#include "components/account_id/account_id.h"
@@ -129,14 +128,10 @@ class EncryptionMigrationScreenHandlerTest : public testing::Test {
cryptohome::AsyncMethodCaller::InitializeForTesting(
mock_async_method_caller_);
- // Set up fake DBusThreadManager parts.
- fake_cryptohome_client_ = new FakeCryptohomeClient();
- DBusThreadManager::GetSetterForTesting()->SetCryptohomeClient(
- base::WrapUnique<CryptohomeClient>(fake_cryptohome_client_));
-
- PowerManagerClient::Initialize();
-
- DBusThreadManager::Initialize();
+ // Set up fake dbus clients.
+ CryptohomeClient::InitializeFake();
+ fake_cryptohome_client_ = FakeCryptohomeClient::Get();
+ PowerManagerClient::InitializeFake();
PowerPolicyController::Initialize(PowerManagerClient::Get());
@@ -145,7 +140,7 @@ class EncryptionMigrationScreenHandlerTest : public testing::Test {
user_context_.SetKey(
Key(Key::KeyType::KEY_TYPE_SALTED_SHA256, "salt", "secret"));
- js_calls_container_.ExecuteDeferredJSCalls();
+ js_calls_container_.ExecuteDeferredJSCalls(&test_web_ui_);
encryption_migration_screen_handler_ =
std::make_unique<TestEncryptionMigrationScreenHandler>(
&js_calls_container_);
@@ -165,8 +160,8 @@ class EncryptionMigrationScreenHandlerTest : public testing::Test {
encryption_migration_screen_handler_.reset();
PowerPolicyController::Shutdown();
- DBusThreadManager::Shutdown();
PowerManagerClient::Shutdown();
+ CryptohomeClient::Shutdown();
cryptohome::AsyncMethodCaller::Shutdown();
}
@@ -175,7 +170,7 @@ class EncryptionMigrationScreenHandlerTest : public testing::Test {
base::test::ScopedTaskEnvironment scoped_task_environment_;
std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_enabler_;
- FakeCryptohomeClient* fake_cryptohome_client_ = nullptr;
+ FakeCryptohomeClient* fake_cryptohome_client_ = nullptr; // unowned
cryptohome::MockAsyncMethodCaller* mock_async_method_caller_ = nullptr;
JSCallsContainer js_calls_container_;
std::unique_ptr<TestEncryptionMigrationScreenHandler>
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
index 45984e0ff00..bb90faa49a0 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h"
#include <algorithm>
+#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -17,11 +18,13 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
+#include "chrome/browser/chromeos/authpolicy/authpolicy_helper.h"
#include "chrome/browser/chromeos/login/error_screens_histogram_helper.h"
#include "chrome/browser/chromeos/login/help_app_launcher.h"
#include "chrome/browser/chromeos/login/oobe_screen.h"
#include "chrome/browser/chromeos/login/screens/network_error.h"
#include "chrome/browser/chromeos/login/signin_partition_manager.h"
+#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
@@ -29,7 +32,6 @@
#include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/grit/generated_resources.h"
-#include "chromeos/login/auth/authpolicy_login_helper.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "components/login/localized_values_builder.h"
@@ -45,8 +47,6 @@
namespace chromeos {
namespace {
-const char kJsScreenPath[] = "login.OAuthEnrollmentScreen";
-
// Enrollment step names.
const char kEnrollmentStepSignin[] = "signin";
const char kEnrollmentStepAdJoin[] = "ad-join";
@@ -139,21 +139,21 @@ constexpr struct {
IDS_AD_ENCRYPTION_LEGACY_SUBTITLE,
authpolicy::KerberosEncryptionTypes::ENC_TYPES_LEGACY}};
-std::unique_ptr<base::ListValue> GetEncryptionTypesList() {
+base::ListValue GetEncryptionTypesList() {
const authpolicy::KerberosEncryptionTypes default_types =
authpolicy::KerberosEncryptionTypes::ENC_TYPES_STRONG;
- auto encryption_list = std::make_unique<base::ListValue>();
+ base::ListValue encryption_list;
for (const auto& enc_types : kEncryptionTypes) {
- auto enc_option = std::make_unique<base::DictionaryValue>();
- enc_option->SetKey(
+ base::DictionaryValue enc_option;
+ enc_option.SetKey(
"title", base::Value(l10n_util::GetStringUTF16(enc_types.title_id)));
- enc_option->SetKey(
+ enc_option.SetKey(
"subtitle",
base::Value(l10n_util::GetStringUTF16(enc_types.subtitle_id)));
- enc_option->SetKey("value", base::Value(enc_types.id));
- enc_option->SetKey(
- "selected", base::Value(default_types == enc_types.encryption_types));
- encryption_list->Append(std::move(enc_option));
+ enc_option.SetKey("value", base::Value(enc_types.id));
+ enc_option.SetKey("selected",
+ base::Value(default_types == enc_types.encryption_types));
+ encryption_list.GetList().emplace_back(std::move(enc_option));
}
return encryption_list;
}
@@ -181,8 +181,6 @@ EnrollmentScreenHandler::EnrollmentScreenHandler(
error_screen_(error_screen),
histogram_helper_(new ErrorScreensHistogramHelper("Enrollment")),
weak_ptr_factory_(this) {
- set_call_js_prefix(kJsScreenPath);
- set_async_assets_load_id(GetOobeScreenName(kScreenId));
DCHECK(network_state_informer_.get());
DCHECK(error_screen_);
network_state_informer_->AddObserver(this);
@@ -262,7 +260,6 @@ void EnrollmentScreenHandler::ShowActiveDirectoryScreen(
if (!domain_join_config.empty()) {
active_directory_domain_join_config_ = domain_join_config;
- show_unlock_password_ = true;
active_directory_join_type_ =
ActiveDirectoryDomainJoinType::NOT_USING_CONFIGURATION;
}
@@ -271,7 +268,8 @@ void EnrollmentScreenHandler::ShowActiveDirectoryScreen(
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams",
std::string() /* machineName */, std::string() /* userName */,
static_cast<int>(ActiveDirectoryErrorState::NONE),
- show_unlock_password_);
+ !active_directory_domain_join_config_
+ .empty() /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin);
return;
}
@@ -284,28 +282,28 @@ void EnrollmentScreenHandler::ShowActiveDirectoryScreen(
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name,
username,
static_cast<int>(ActiveDirectoryErrorState::BAD_USERNAME),
- show_unlock_password_);
+ false /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin);
return;
case authpolicy::ERROR_BAD_PASSWORD:
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name,
username,
static_cast<int>(ActiveDirectoryErrorState::BAD_AUTH_PASSWORD),
- show_unlock_password_);
+ false /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin);
return;
case authpolicy::ERROR_MACHINE_NAME_TOO_LONG:
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name,
username,
static_cast<int>(ActiveDirectoryErrorState::MACHINE_NAME_TOO_LONG),
- show_unlock_password_);
+ false /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin);
return;
case authpolicy::ERROR_INVALID_MACHINE_NAME:
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name,
username,
static_cast<int>(ActiveDirectoryErrorState::MACHINE_NAME_INVALID),
- show_unlock_password_);
+ false /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin);
return;
case authpolicy::ERROR_PASSWORD_EXPIRED:
@@ -619,7 +617,7 @@ void EnrollmentScreenHandler::DeclareLocalizedValues(
void EnrollmentScreenHandler::GetAdditionalParameters(
base::DictionaryValue* parameters) {
- parameters->Set("encryptionTypesList", GetEncryptionTypesList());
+ parameters->SetKey("encryptionTypesList", GetEncryptionTypesList());
}
bool EnrollmentScreenHandler::IsOnEnrollmentScreen() const {
@@ -637,17 +635,18 @@ void EnrollmentScreenHandler::OnAdConfigurationUnlocked(
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams",
std::string() /* machineName */, std::string() /* userName */,
static_cast<int>(ActiveDirectoryErrorState::BAD_UNLOCK_PASSWORD),
- show_unlock_password_);
+ true /* show_unlock_password */);
return;
}
- std::unique_ptr<base::ListValue> options =
- base::ListValue::From(base::JSONReader::ReadDeprecated(
- unlocked_data, base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS));
- if (!options) {
+ active_directory_domain_join_config_.clear();
+ base::Optional<base::Value> options = base::JSONReader::Read(
+ unlocked_data, base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS);
+ if (!options || !options->is_list()) {
ShowError(IDS_AD_JOIN_CONFIG_NOT_PARSED, true);
- show_unlock_password_ = false;
- CallJS("login.OAuthEnrollmentScreen.setAdJoinConfiguration",
- base::ListValue());
+ CallJS("login.OAuthEnrollmentScreen.setAdJoinParams",
+ std::string() /* machineName */, std::string() /* userName */,
+ static_cast<int>(ActiveDirectoryErrorState::NONE),
+ false /* show_unlock_password */);
return;
}
base::DictionaryValue custom;
@@ -655,7 +654,6 @@ void EnrollmentScreenHandler::OnAdConfigurationUnlocked(
"name",
base::Value(l10n_util::GetStringUTF8(IDS_AD_CONFIG_SELECTION_CUSTOM)));
options->GetList().push_back(std::move(custom));
- show_unlock_password_ = false;
active_directory_join_type_ =
ActiveDirectoryDomainJoinType::USING_CONFIGURATION;
CallJS("login.OAuthEnrollmentScreen.setAdJoinConfiguration", *options);
@@ -805,7 +803,8 @@ void EnrollmentScreenHandler::HandleCompleteLogin(const std::string& user) {
void EnrollmentScreenHandler::OnGetCookiesForCompleteLogin(
const std::string& user,
- const std::vector<net::CanonicalCookie>& cookies) {
+ const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& excluded_cookies) {
std::string auth_code;
for (const auto& cookie : cookies) {
if (cookie.Name() == "oauth_code") {
@@ -827,7 +826,6 @@ void EnrollmentScreenHandler::HandleAdCompleteLogin(
const std::string& user_name,
const std::string& password) {
observe_network_failure_ = false;
- show_unlock_password_ = false;
DCHECK(controller_);
controller_->OnActiveDirectoryCredsProvided(
machine_name, distinguished_name,
@@ -836,7 +834,7 @@ void EnrollmentScreenHandler::HandleAdCompleteLogin(
void EnrollmentScreenHandler::HandleAdUnlockConfiguration(
const std::string& password) {
- AuthPolicyLoginHelper::DecryptConfiguration(
+ AuthPolicyHelper::DecryptConfiguration(
active_directory_domain_join_config_, password,
base::BindOnce(&EnrollmentScreenHandler::OnAdConfigurationUnlocked,
weak_ptr_factory_.GetWeakPtr()));
@@ -862,7 +860,8 @@ void EnrollmentScreenHandler::HandleDeviceAttributesProvided(
void EnrollmentScreenHandler::HandleOnLearnMore() {
if (!help_app_.get())
- help_app_ = new HelpAppLauncher(GetNativeWindow());
+ help_app_ = new HelpAppLauncher(
+ LoginDisplayHost::default_host()->GetNativeWindow());
help_app_->ShowHelpTopic(HelpAppLauncher::HELP_DEVICE_ATTRIBUTES);
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h
index aa5bf675b13..1c3e6cf860a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h
@@ -7,6 +7,7 @@
#include <memory>
#include <string>
+#include <vector>
#include "base/macros.h"
#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_view.h"
@@ -104,7 +105,8 @@ class EnrollmentScreenHandler
void HandleCompleteLogin(const std::string& user);
void OnGetCookiesForCompleteLogin(
const std::string& user,
- const std::vector<net::CanonicalCookie>& cookies);
+ const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& excluded_cookies);
void HandleAdCompleteLogin(const std::string& machine_name,
const std::string& distinguished_name,
const std::string& encryption_types,
@@ -170,9 +172,6 @@ class EnrollmentScreenHandler
ActiveDirectoryDomainJoinType active_directory_join_type_ =
ActiveDirectoryDomainJoinType::COUNT;
- // Whether unlock password input step should be shown.
- bool show_unlock_password_ = false;
-
// True if screen was not shown yet.
bool first_show_ = true;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc
index 3a51ef9ecae..1ed2833fb60 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc
@@ -13,18 +13,11 @@
#include "ui/chromeos/devicetype_utils.h"
#include "ui/strings/grit/ui_strings.h"
-namespace {
-
-const char kJsScreenPath[] = "login.ErrorMessageScreen";
-
-} // namespace
-
namespace chromeos {
ErrorScreenHandler::ErrorScreenHandler(JSCallsContainer* js_calls_container)
- : BaseScreenHandler(kScreenId, js_calls_container),
- weak_ptr_factory_(this) {
- set_call_js_prefix(kJsScreenPath);
+ : BaseScreenHandler(kScreenId, js_calls_container) {
+ set_user_acted_method_path("login.ErrorMessageScreen.userActed");
}
ErrorScreenHandler::~ErrorScreenHandler() {
@@ -39,14 +32,14 @@ void ErrorScreenHandler::Show() {
}
BaseScreenHandler::ShowScreen(kScreenId);
if (screen_)
- screen_->OnShow();
+ screen_->DoShow();
showing_ = true;
}
void ErrorScreenHandler::Hide() {
showing_ = false;
if (screen_)
- screen_->OnHide();
+ screen_->DoHide();
}
void ErrorScreenHandler::Bind(ErrorScreen* screen) {
@@ -63,6 +56,32 @@ void ErrorScreenHandler::ShowOobeScreen(OobeScreen screen) {
ShowScreen(screen);
}
+void ErrorScreenHandler::SetErrorStateCode(
+ NetworkError::ErrorState error_state) {
+ CallJS("login.ErrorMessageScreen.setErrorState",
+ static_cast<int>(error_state));
+}
+
+void ErrorScreenHandler::SetErrorStateNetwork(const std::string& network_name) {
+ CallJS("login.ErrorMessageScreen.setErrorStateNetwork", network_name);
+}
+
+void ErrorScreenHandler::SetGuestSigninAllowed(bool value) {
+ CallJS("login.ErrorMessageScreen.allowGuestSignin", value);
+}
+
+void ErrorScreenHandler::SetOfflineSigninAllowed(bool value) {
+ CallJS("login.ErrorMessageScreen.allowOfflineLogin", value);
+}
+
+void ErrorScreenHandler::SetShowConnectingIndicator(bool value) {
+ CallJS("login.ErrorMessageScreen.showConnectingIndicator", value);
+}
+
+void ErrorScreenHandler::SetUIState(NetworkError::UIState ui_state) {
+ CallJS("login.ErrorMessageScreen.setUIState", static_cast<int>(ui_state));
+}
+
void ErrorScreenHandler::RegisterMessages() {
AddCallback("hideCaptivePortal",
&ErrorScreenHandler::HandleHideCaptivePortal);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h
index d79f03dafb0..efe8c73ed12 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h
@@ -25,6 +25,12 @@ class ErrorScreenHandler : public BaseScreenHandler, public NetworkErrorView {
void Bind(ErrorScreen* screen) override;
void Unbind() override;
void ShowOobeScreen(OobeScreen screen) override;
+ void SetErrorStateCode(NetworkError::ErrorState error_state) override;
+ void SetErrorStateNetwork(const std::string& network_name) override;
+ void SetGuestSigninAllowed(bool value) override;
+ void SetOfflineSigninAllowed(bool value) override;
+ void SetShowConnectingIndicator(bool value) override;
+ void SetUIState(NetworkError::UIState ui_state) override;
// WebUIMessageHandler:
void RegisterMessages() override;
@@ -46,7 +52,7 @@ class ErrorScreenHandler : public BaseScreenHandler, public NetworkErrorView {
// Whether the error screen is currently shown.
bool showing_ = false;
- base::WeakPtrFactory<ErrorScreenHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<ErrorScreenHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ErrorScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
index 7c24280e298..fbb0b5d0cd1 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/chromeos/login/oobe_screen.h"
#include "chrome/browser/chromeos/login/screens/core_oobe_view.h"
#include "chrome/browser/chromeos/login/screens/eula_screen.h"
+#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
@@ -24,10 +25,6 @@
#include "rlz/buildflags/buildflags.h"
#include "url/gurl.h"
-namespace {
-constexpr char kJsScreenPath[] = "login.EulaScreen";
-}
-
namespace chromeos {
EulaScreenHandler::EulaScreenHandler(JSCallsContainer* js_calls_container,
@@ -35,7 +32,7 @@ EulaScreenHandler::EulaScreenHandler(JSCallsContainer* js_calls_container,
: BaseScreenHandler(kScreenId, js_calls_container),
core_oobe_view_(core_oobe_view),
weak_factory_(this) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.EulaScreen.userActed");
}
EulaScreenHandler::~EulaScreenHandler() {
@@ -68,7 +65,6 @@ void EulaScreenHandler::Unbind() {
void EulaScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
- builder->Add("eulaScreenTitle", IDS_EULA_SCREEN_TITLE);
builder->Add("eulaScreenAccessibleTitle", IDS_EULA_SCREEN_ACCESSIBLE_TITLE);
builder->Add("checkboxLogging", IDS_EULA_CHECKBOX_ENABLE_LOGGING);
builder->Add("back", IDS_EULA_BACK_BUTTON);
@@ -113,6 +109,8 @@ void EulaScreenHandler::DeclareJSCallbacks() {
AddCallback("eulaOnLearnMore", &EulaScreenHandler::HandleOnLearnMore);
AddCallback("eulaOnInstallationSettingsPopupOpened",
&EulaScreenHandler::HandleOnInstallationSettingsPopupOpened);
+ AddCallback("EulaScreen.usageStatsEnabled",
+ &EulaScreenHandler::HandleUsageStatsEnabled);
}
void EulaScreenHandler::GetAdditionalParameters(base::DictionaryValue* dict) {
@@ -141,7 +139,8 @@ void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) {
void EulaScreenHandler::HandleOnLearnMore() {
if (!help_app_.get())
- help_app_ = new HelpAppLauncher(GetNativeWindow());
+ help_app_ = new HelpAppLauncher(
+ LoginDisplayHost::default_host()->GetNativeWindow());
help_app_->ShowHelpTopic(HelpAppLauncher::HELP_STATS_USAGE);
}
@@ -150,6 +149,11 @@ void EulaScreenHandler::HandleOnInstallationSettingsPopupOpened() {
screen_->InitiatePasswordFetch();
}
+void EulaScreenHandler::HandleUsageStatsEnabled(bool enabled) {
+ if (screen_)
+ screen_->SetUsageStatsEnabled(enabled);
+}
+
void EulaScreenHandler::UpdateLocalizedValues(
::login::SecureModuleUsed secure_module_used) {
base::DictionaryValue updated_secure_module_strings;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h
index 13092f3acc6..df8d8c82096 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h
@@ -48,6 +48,7 @@ class EulaScreenHandler : public EulaView, public BaseScreenHandler {
// JS messages handlers.
void HandleOnLearnMore();
void HandleOnInstallationSettingsPopupOpened();
+ void HandleUsageStatsEnabled(bool enabled);
void UpdateLocalizedValues(::login::SecureModuleUsed secure_module_used);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc
index c26c0771842..3a5f9178d5c 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc
@@ -21,8 +21,6 @@
namespace {
-const char kJsScreenPath[] = "login.FingerprintSetupScreen";
-
// The max number of fingerprints that can be stored.
constexpr int kMaxAllowedFingerprints = 3;
@@ -52,7 +50,7 @@ namespace chromeos {
FingerprintSetupScreenHandler::FingerprintSetupScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.FingerprintSetupScreen.userActed");
service_manager::Connector* connector =
content::ServiceManagerConnection::GetForProcess()->GetConnector();
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index 362a6b70a12..e25fc11e925 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -8,6 +8,7 @@
#include "ash/public/cpp/ash_features.h"
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
@@ -22,6 +23,7 @@
#include "base/task/post_task.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/authpolicy/authpolicy_helper.h"
#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/chromeos/login/lock_screen_utils.h"
#include "chrome/browser/chromeos/login/reauth_stats.h"
@@ -54,7 +56,6 @@
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/constants/devicetype.h"
#include "chromeos/dbus/util/version_loader.h"
-#include "chromeos/login/auth/authpolicy_login_helper.h"
#include "chromeos/login/auth/user_context.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/login/localized_values_builder.h"
@@ -84,7 +85,6 @@ namespace chromeos {
namespace {
-const char kJsScreenPath[] = "login.GaiaSigninScreen";
const char kAuthIframeParentName[] = "signin-frame";
const char kRestrictiveProxyURL[] = "https://www.google.com/generate_204";
@@ -185,14 +185,6 @@ void UpdateAuthParams(base::DictionaryValue* params,
// nosignup flow if new users are not allowed.
if (!allow_new_user || is_restrictive_proxy)
params->SetString("flow", "nosignup");
-
- params->SetBoolean("supervisedUsersCanCreate", false);
-
- // Now check whether we're in multi-profiles user adding scenario and
- // disable GAIA right panel features if that's the case.
- if (UserAddingScreen::Get()->IsRunning()) {
- params->SetBoolean("supervisedUsersCanCreate", false);
- }
}
void RecordSAMLScrapingVerificationResultInHistogram(bool success) {
@@ -297,7 +289,6 @@ GaiaScreenHandler::GaiaScreenHandler(
active_directory_password_change_screen_handler),
weak_factory_(this) {
DCHECK(network_state_informer_.get());
- set_call_js_prefix(kJsScreenPath);
}
GaiaScreenHandler::~GaiaScreenHandler() {
@@ -355,7 +346,8 @@ void GaiaScreenHandler::LoadGaiaWithPartition(
base::BindOnce(&GaiaScreenHandler::OnSetCookieForLoadGaiaWithPartition,
weak_factory_.GetWeakPtr(), context, partition_name);
if (context.gaps_cookie.empty()) {
- std::move(callback).Run(true);
+ std::move(callback).Run(
+ net::CanonicalCookie::CookieInclusionStatus::INCLUDE);
return;
}
@@ -372,18 +364,23 @@ void GaiaScreenHandler::LoadGaiaWithPartition(
std::string gaps_cookie_value(kGAPSCookie);
gaps_cookie_value += "=" + context.gaps_cookie;
+ net::CookieOptions options;
+ options.set_include_httponly();
+ // Permit it to set a SameSite cookie if it wants to.
+ options.set_same_site_cookie_context(
+ net::CookieOptions::SameSiteCookieContext::SAME_SITE_STRICT);
std::unique_ptr<net::CanonicalCookie> cc(net::CanonicalCookie::Create(
GaiaUrls::GetInstance()->gaia_url(), gaps_cookie_value, base::Time::Now(),
- net::CookieOptions()));
+ options));
partition->GetCookieManagerForBrowserProcess()->SetCanonicalCookie(
- *cc.get(), "https", true /* modify_http_only */, std::move(callback));
+ *cc.get(), "https", options, std::move(callback));
}
void GaiaScreenHandler::OnSetCookieForLoadGaiaWithPartition(
const GaiaContext& context,
const std::string& partition_name,
- bool success) {
+ net::CanonicalCookie::CookieInclusionStatus status) {
std::unique_ptr<std::string> version = std::make_unique<std::string>();
std::unique_ptr<bool> consent = std::make_unique<bool>();
base::OnceClosure get_version_and_consent =
@@ -417,7 +414,7 @@ void GaiaScreenHandler::LoadGaiaWithPartitionAndVersionAndConsent(
params.SetInteger("screenMode", screen_mode);
if (screen_mode == GAIA_SCREEN_MODE_AD && !authpolicy_login_helper_)
- authpolicy_login_helper_ = std::make_unique<AuthPolicyLoginHelper>();
+ authpolicy_login_helper_ = std::make_unique<AuthPolicyHelper>();
if (screen_mode != GAIA_SCREEN_MODE_OFFLINE) {
const std::string app_locale = g_browser_process->GetApplicationLocale();
@@ -490,6 +487,10 @@ void GaiaScreenHandler::LoadGaiaWithPartitionAndVersionAndConsent(
params.SetString("webviewPartitionName", partition_name);
+ params.SetBoolean("extractSamlPasswordAttributes",
+ Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean(
+ prefs::kSamlInSessionPasswordChangeEnabled));
+
frame_state_ = FRAME_STATE_LOADING;
CallJS("login.GaiaSigninScreen.loadAuthExtension", params);
}
@@ -519,7 +520,6 @@ void GaiaScreenHandler::MonitorOfflineIdle(bool is_online) {
void GaiaScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
- builder->Add("signinScreenTitle", IDS_SIGNIN_SCREEN_TITLE_TAB_PROMPT);
builder->Add("guestSignin", IDS_BROWSE_WITHOUT_SIGNING_IN_HTML);
builder->Add("backButton", IDS_ACCNAME_BACK);
builder->Add("closeButton", IDS_CLOSE);
@@ -620,6 +620,12 @@ void GaiaScreenHandler::RegisterMessages() {
&GaiaScreenHandler::HandleUpdateSigninUIState);
AddCallback("showGuestInOobe", &GaiaScreenHandler::HandleShowGuestInOobe);
+ if (Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean(
+ prefs::kSamlInSessionPasswordChangeEnabled)) {
+ AddCallback("updatePasswordAttributes",
+ &GaiaScreenHandler::HandleUpdatePasswordAttributes);
+ }
+
// Allow UMA metrics collection from JS.
web_ui()->AddMessageHandler(std::make_unique<MetricsHandler>());
}
@@ -810,7 +816,8 @@ void GaiaScreenHandler::OnGetCookiesForCompleteAuthentication(
const std::string& password,
bool using_saml,
const ::login::StringList& services,
- const std::vector<net::CanonicalCookie>& cookies) {
+ const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& excluded_cookies) {
std::string auth_code, gaps_cookie;
for (const auto& cookie : cookies) {
if (cookie.Name() == kOAUTHCodeCookie)
@@ -943,6 +950,25 @@ void GaiaScreenHandler::HandleUpdateSigninUIState(int state) {
}
}
+void GaiaScreenHandler::HandleUpdatePasswordAttributes(
+ const std::string& passwordModifiedTimestamp,
+ const std::string& passwordExpirationTimestamp,
+ const std::string& passwordChangeUrl) {
+ CHECK(Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean(
+ prefs::kSamlInSessionPasswordChangeEnabled));
+ // TODO(olsen): Store this information in the user's session, use it to show a
+ // notification when the user's password is expired / is soon to expire.
+ if (passwordModifiedTimestamp.empty() &&
+ passwordExpirationTimestamp.empty() && passwordChangeUrl.empty()) {
+ VLOG(4) << "No password attributes extracted from SAML response";
+ } else {
+ VLOG(4) << "Extracted password attributes from SAML response: {";
+ VLOG(4) << "passwordModifiedTimestamp: " << passwordModifiedTimestamp;
+ VLOG(4) << "passwordExpirationTimestamp: " << passwordExpirationTimestamp;
+ VLOG(4) << "passwordChangeUrl: " << passwordChangeUrl << " }";
+ }
+}
+
void GaiaScreenHandler::HandleShowGuestInOobe(bool show) {
LoginScreenClient::Get()->login_screen()->SetShowGuestButtonInOobe(show);
}
@@ -1056,7 +1082,8 @@ void GaiaScreenHandler::SubmitLoginFormForTest() {
std::string code =
"document.getElementById('identifier').value = '" + test_user_ + "';"
"document.getElementById('nextButton').click();";
- frame->ExecuteJavaScriptForTests(base::ASCIIToUTF16(code));
+ frame->ExecuteJavaScriptForTests(base::ASCIIToUTF16(code),
+ base::NullCallback());
if (!test_services_.empty()) {
// Prefix each doublequote with backslash, so that it will remain correct
@@ -1065,13 +1092,15 @@ void GaiaScreenHandler::SubmitLoginFormForTest() {
base::ReplaceChars(test_services_, "\"", "\\\"", &escaped_services);
code = "document.getElementById('services').value = \"" + escaped_services +
"\";";
- frame->ExecuteJavaScriptForTests(base::ASCIIToUTF16(code));
+ frame->ExecuteJavaScriptForTests(base::ASCIIToUTF16(code),
+ base::NullCallback());
}
if (!test_pass_.empty()) {
code = "document.getElementById('password').value = '" + test_pass_ + "';";
code += "document.getElementById('nextButton').click();";
- frame->ExecuteJavaScriptForTests(base::ASCIIToUTF16(code));
+ frame->ExecuteJavaScriptForTests(base::ASCIIToUTF16(code),
+ base::NullCallback());
}
// Test properties are cleared in HandleCompleteLogin because the form
@@ -1116,7 +1145,8 @@ void GaiaScreenHandler::ShowSigninScreenForTest(const std::string& username,
// reload gaia then follow the loading case.
if (frame_state() == GaiaScreenHandler::FRAME_STATE_LOADED) {
SubmitLoginFormForTest();
- } else if (frame_state() != GaiaScreenHandler::FRAME_STATE_LOADING) {
+ } else if (frame_state() != GaiaScreenHandler::FRAME_STATE_LOADING &&
+ !auth_extension_being_loaded_) {
OnShowAddUser();
}
}
@@ -1206,7 +1236,7 @@ void GaiaScreenHandler::ShowGaiaScreenIfReady() {
LoadAuthExtension(!gaia_silent_load_ /* force */, false /* offline */);
signin_screen_handler_->UpdateUIState(
- SigninScreenHandler::UI_STATE_GAIA_SIGNIN, nullptr);
+ SigninScreenHandler::UI_STATE_GAIA_SIGNIN);
core_oobe_view_->UpdateKeyboardState();
if (gaia_silent_load_) {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
index 8ed8521137a..a4757c2b594 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
@@ -6,15 +6,16 @@
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_
#include <string>
+#include <vector>
#include "base/command_line.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "chrome/browser/chromeos/authpolicy/authpolicy_helper.h"
#include "chrome/browser/chromeos/login/screens/core_oobe_view.h"
#include "chrome/browser/chromeos/login/screens/gaia_view.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
-#include "chromeos/login/auth/authpolicy_login_helper.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "net/base/net_errors.h"
@@ -76,9 +77,10 @@ class GaiaScreenHandler : public BaseScreenHandler,
const std::string& partition_name);
// Called after the GAPS cookie, if present, is added to the cookie store.
- void OnSetCookieForLoadGaiaWithPartition(const GaiaContext& context,
- const std::string& partition_name,
- bool success);
+ void OnSetCookieForLoadGaiaWithPartition(
+ const GaiaContext& context,
+ const std::string& partition_name,
+ net::CanonicalCookie::CookieInclusionStatus status);
// Callback that loads GAIA after version and stat consent information has
// been retrieved.
@@ -126,7 +128,8 @@ class GaiaScreenHandler : public BaseScreenHandler,
const std::string& password,
bool using_saml,
const ::login::StringList& services,
- const std::vector<net::CanonicalCookie>& cookies);
+ const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& excluded_cookies);
void HandleCompleteLogin(const std::string& gaia_id,
const std::string& typed_email,
const std::string& password,
@@ -154,6 +157,13 @@ class GaiaScreenHandler : public BaseScreenHandler,
const std::string& gaia_id);
void HandleUpdateSigninUIState(int state);
+ // Allows for a password expiry notification to be shown using information
+ // extracted from the SAML response during SAML auth flow.
+ void HandleUpdatePasswordAttributes(
+ const std::string& passwordModifiedTimestamp,
+ const std::string& passwordExpirationTimestamp,
+ const std::string& passwordChangeUrl);
+
// Allows WebUI to control the login shelf's guest button visibility during
// OOBE.
void HandleShowGuestInOobe(bool show);
@@ -304,7 +314,7 @@ class GaiaScreenHandler : public BaseScreenHandler,
// Helper to call AuthPolicyClient and cancel calls if needed. Used to
// authenticate users against Active Directory server.
- std::unique_ptr<AuthPolicyLoginHelper> authpolicy_login_helper_;
+ std::unique_ptr<AuthPolicyHelper> authpolicy_login_helper_;
// Makes untrusted authority certificates from device policy available for
// client certificate discovery.
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc
index d7ba6f20b19..60421cb9df1 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc
@@ -20,12 +20,6 @@
#include "components/login/localized_values_builder.h"
#include "components/prefs/pref_service.h"
-namespace {
-
-const char kJsScreenPath[] = "login.HIDDetectionScreen";
-
-} // namespace
-
namespace chromeos {
HIDDetectionScreenHandler::HIDDetectionScreenHandler(
@@ -33,7 +27,6 @@ HIDDetectionScreenHandler::HIDDetectionScreenHandler(
CoreOobeView* core_oobe_view)
: BaseScreenHandler(kScreenId, js_calls_container),
core_oobe_view_(core_oobe_view) {
- set_call_js_prefix(kJsScreenPath);
}
HIDDetectionScreenHandler::~HIDDetectionScreenHandler() {
@@ -77,6 +70,53 @@ void HIDDetectionScreenHandler::CheckIsScreenRequired(
screen_->CheckIsScreenRequired(on_check_done);
}
+void HIDDetectionScreenHandler::SetKeyboardState(const std::string& value) {
+ keyboard_state_ = value;
+ CallJS("login.HIDDetectionScreen.setKeyboardState", value);
+}
+
+void HIDDetectionScreenHandler::SetMouseState(const std::string& value) {
+ mouse_state_ = value;
+ CallJS("login.HIDDetectionScreen.setMouseState", value);
+}
+
+void HIDDetectionScreenHandler::SetKeyboardPinCode(const std::string& value) {
+ keyboard_pin_code_ = value;
+ CallJS("login.HIDDetectionScreen.setKeyboardPinCode", value);
+}
+
+void HIDDetectionScreenHandler::SetNumKeysEnteredExpected(bool value) {
+ num_keys_entered_expected_ = value;
+ CallJS("login.HIDDetectionScreen.setNumKeysEnteredExpected", value);
+}
+
+void HIDDetectionScreenHandler::SetNumKeysEnteredPinCode(int value) {
+ num_keys_entered_pin_code_ = value;
+ CallJS("login.HIDDetectionScreen.setNumKeysEnteredPinCode", value);
+}
+
+void HIDDetectionScreenHandler::SetMouseDeviceName(const std::string& value) {
+ mouse_device_name_ = value;
+ CallJS("login.HIDDetectionScreen.setMouseDeviceName", value);
+}
+
+void HIDDetectionScreenHandler::SetKeyboardDeviceName(
+ const std::string& value) {
+ keyboard_device_name_ = value;
+ CallJS("login.HIDDetectionScreen.setKeyboardDeviceName", value);
+}
+
+void HIDDetectionScreenHandler::SetKeyboardDeviceLabel(
+ const std::string& value) {
+ keyboard_device_label_ = value;
+ CallJS("login.HIDDetectionScreen.setKeyboardDeviceLabel", value);
+}
+
+void HIDDetectionScreenHandler::SetContinueButtonEnabled(bool value) {
+ continue_button_enabled_ = value;
+ CallJS("login.HIDDetectionScreen.setContinueButtonEnabled", value);
+}
+
void HIDDetectionScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
builder->Add("hidDetectionContinue", IDS_HID_DETECTION_CONTINUE_BUTTON);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h
index 3aa4051823f..956d8dc9cbf 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h
@@ -35,6 +35,15 @@ class HIDDetectionScreenHandler
void Unbind() override;
void CheckIsScreenRequired(
const base::Callback<void(bool)>& on_check_done) override;
+ void SetKeyboardState(const std::string& value) override;
+ void SetMouseState(const std::string& value) override;
+ void SetKeyboardPinCode(const std::string& value) override;
+ void SetNumKeysEnteredExpected(bool value) override;
+ void SetNumKeysEnteredPinCode(int value) override;
+ void SetMouseDeviceName(const std::string& value) override;
+ void SetKeyboardDeviceName(const std::string& value) override;
+ void SetKeyboardDeviceLabel(const std::string& value) override;
+ void SetContinueButtonEnabled(bool value) override;
// BaseScreenHandler implementation:
void DeclareLocalizedValues(
@@ -45,10 +54,42 @@ class HIDDetectionScreenHandler
// Registers the preference for derelict state.
static void RegisterPrefs(PrefRegistrySimple* registry);
+ // State that has been exported to JS. Used by tests.
+ std::string keyboard_state_for_test() const { return keyboard_state_; }
+ std::string mouse_state_for_test() const { return mouse_state_; }
+ std::string keyboard_pin_code_for_test() const { return keyboard_pin_code_; }
+ bool num_keys_entered_expected_for_test() const {
+ return num_keys_entered_expected_;
+ }
+ int num_keys_entered_pin_code_for_test() const {
+ return num_keys_entered_pin_code_;
+ }
+ std::string mouse_device_name_for_test() const { return mouse_device_name_; }
+ std::string keyboard_device_name_for_test() const {
+ return keyboard_device_name_;
+ }
+ std::string keyboard_device_label_for_test() const {
+ return keyboard_device_label_;
+ }
+ bool continue_button_enabled_for_test() const {
+ return continue_button_enabled_;
+ }
+
private:
// JS messages handlers.
void HandleOnContinue();
+ // Cached values that have been sent to JS. Used by tests.
+ std::string keyboard_state_;
+ std::string mouse_state_;
+ std::string keyboard_pin_code_;
+ bool num_keys_entered_expected_ = false;
+ int num_keys_entered_pin_code_ = 0;
+ std::string mouse_device_name_;
+ std::string keyboard_device_name_;
+ std::string keyboard_device_label_;
+ bool continue_button_enabled_ = false;
+
HIDDetectionScreen* screen_ = nullptr;
CoreOobeView* core_oobe_view_ = nullptr;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container.cc b/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container.cc
new file mode 100644
index 00000000000..e2cc397832f
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container.cc
@@ -0,0 +1,52 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/chromeos/login/js_calls_container.h"
+
+#include "content/public/browser/web_ui.h"
+
+namespace chromeos {
+
+JSCallsContainer::Event::Event(Type type,
+ const std::string& function_name,
+ std::vector<base::Value>&& arguments)
+ : type(type),
+ function_name(function_name),
+ arguments(std::move(arguments)) {}
+
+JSCallsContainer::Event::~Event() = default;
+
+JSCallsContainer::Event::Event(Event&&) = default;
+
+JSCallsContainer::JSCallsContainer() = default;
+
+JSCallsContainer::~JSCallsContainer() = default;
+
+void JSCallsContainer::ExecuteDeferredJSCalls(content::WebUI* web_ui) {
+ DCHECK(!is_initialized());
+ is_initialized_ = true;
+
+ // Execute recorded outgoing events.
+ for (const auto& event : events_) {
+ if (event.type != Event::Type::kOutgoing)
+ continue;
+
+ // event.arguments is of type std::vector<base::Value>, but
+ // CallJavascriptFunctionUnsafe requires std::vector<const base::Value*>.
+ // Construct the new vector of pointers from the existing data.
+ std::vector<const base::Value*> args;
+ args.reserve(event.arguments.size());
+ auto* bp = event.arguments.data();
+ for (size_t i = 0; i < event.arguments.size(); ++i)
+ args.push_back(bp + i);
+ web_ui->CallJavascriptFunctionUnsafe(event.function_name, args);
+ }
+
+ // Reduce memory usage / drop potentially sensitive data if we're not
+ // recording for a test.
+ if (!record_all_events_for_test_)
+ events_.clear();
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container.h b/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container.h
new file mode 100644
index 00000000000..1b429e2097e
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container.h
@@ -0,0 +1,84 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_JS_CALLS_CONTAINER_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_JS_CALLS_CONTAINER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/values.h"
+
+namespace content {
+class WebUI;
+}
+
+namespace chromeos {
+
+// A helper class to store deferred Javascript calls, shared by subclasses of
+// BaseWebUIHandler.
+class JSCallsContainer {
+ public:
+ // An event is a message/JS call to or from WebUI.
+ struct Event {
+ enum class Type {
+ // This event was sent from C++ to JS.
+ kOutgoing,
+ // This event was sent from JS to C++.
+ kIncoming,
+ };
+
+ Event(Type type,
+ const std::string& function_name,
+ std::vector<base::Value>&& arguments);
+ ~Event();
+ Event(Event&&);
+ Event(const Event&) = delete;
+ Event& operator=(const Event&) = delete;
+
+ Type type;
+ std::string function_name;
+ std::vector<base::Value> arguments;
+ };
+
+ JSCallsContainer();
+ ~JSCallsContainer();
+ JSCallsContainer(const JSCallsContainer&) = delete;
+ JSCallsContainer& operator=(const JSCallsContainer&) = delete;
+
+ // Used to decide whether the JS call should be deferred.
+ bool is_initialized() const { return is_initialized_; }
+
+ // Enable event recording.
+ void set_record_all_events_for_test() { record_all_events_for_test_ = true; }
+
+ // If true then all JS calls should be recorded.
+ bool record_all_events_for_test() const {
+ return record_all_events_for_test_;
+ }
+
+ // Recorded events. This is mutable and can be modified.
+ std::vector<Event>* events() { return &events_; }
+
+ // Executes Javascript calls that were deferred while the instance was not
+ // initialized yet.
+ void ExecuteDeferredJSCalls(content::WebUI* web_ui);
+
+ private:
+ // Whether the instance is initialized.
+ //
+ // The instance becomes initialized after the corresponding message is
+ // received from Javascript side.
+ bool is_initialized_ = false;
+
+ // Decide if incoming and outgoing JS calls should be recorded. Recording
+ // should only be used for tests.
+ bool record_all_events_for_test_ = false;
+
+ std::vector<Event> events_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_JS_CALLS_CONTAINER_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container_test_api.cc b/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container_test_api.cc
new file mode 100644
index 00000000000..e485181f2d5
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container_test_api.cc
@@ -0,0 +1,49 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/chromeos/login/js_calls_container_test_api.h"
+
+#include <sstream>
+
+#include "chrome/browser/ui/webui/chromeos/login/js_calls_container.h"
+
+namespace chromeos {
+
+JSCallsContainerTestApi::JSCallsContainerTestApi(
+ JSCallsContainer* js_calls_container)
+ : js_calls_container_(js_calls_container) {
+ // Try to avoid a race condition where events potentially get dropped because
+ // recording hasn't been enabled yet.
+ DCHECK(js_calls_container_->record_all_events_for_test() ||
+ js_calls_container_->events()->empty());
+
+ js_calls_container_->set_record_all_events_for_test();
+}
+
+JSCallsContainerTestApi::~JSCallsContainerTestApi() {
+ auto build_function_string =
+ [](const JSCallsContainer::Event& event) -> std::string {
+ std::stringstream result;
+ result << event.function_name;
+ result << '(';
+ bool first = true;
+ for (const base::Value& value : event.arguments) {
+ if (!first)
+ result << ", ";
+ first = false;
+ result << value;
+ }
+ result << ')';
+ return result.str();
+ };
+
+ for (const auto& event : *js_calls_container_->events()) {
+ if (event.type == JSCallsContainer::Event::Type::kIncoming)
+ Incoming(build_function_string(event));
+ else
+ Outgoing(build_function_string(event));
+ }
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container_test_api.h b/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container_test_api.h
new file mode 100644
index 00000000000..f56b398f271
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/js_calls_container_test_api.h
@@ -0,0 +1,43 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_JS_CALLS_CONTAINER_TEST_API_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_JS_CALLS_CONTAINER_TEST_API_H_
+
+#include "base/macros.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace chromeos {
+
+class JSCallsContainer;
+
+// Enables setting up expectations for incoming and outgoing JavaScript in
+// OOBE/login. When constructed this automatically enables event recording;
+// JavaScript messages from before this is constructed may not be captured.
+//
+// Messages are automatically dispatched to the mocks in the destructor.
+class JSCallsContainerTestApi {
+ public:
+ explicit JSCallsContainerTestApi(JSCallsContainer* js_calls_container);
+ ~JSCallsContainerTestApi();
+
+ // |function| has arguments serialized to make matching easier. For example, a
+ // valid invocation looks like
+ //
+ // EXPECT_CALL(test_api,
+ // Outgoing("login.MyComponent.setUpdateRequired(true, 5)"));
+
+ // Notification from WebUI to C++
+ MOCK_METHOD1(Incoming, void(std::string function));
+ // Notification from C++ to WebUI
+ MOCK_METHOD1(Outgoing, void(std::string function));
+
+ private:
+ JSCallsContainer* const js_calls_container_;
+ DISALLOW_COPY_AND_ASSIGN(JSCallsContainerTestApi);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_JS_CALLS_CONTAINER_TEST_API_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc
deleted file mode 100644
index f0dee832975..00000000000
--- a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc
+++ /dev/null
@@ -1,216 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h"
-
-#include <stddef.h>
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/system/sys_info.h"
-#include "base/values.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h"
-#include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
-#include "chrome/browser/chromeos/login/existing_user_controller.h"
-#include "chrome/browser/chromeos/login/screens/network_error.h"
-#include "chrome/grit/generated_resources.h"
-#include "chromeos/constants/chromeos_switches.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/web_ui.h"
-#include "extensions/grit/extensions_browser_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/webui/web_ui_util.h"
-
-namespace chromeos {
-
-namespace {
-
-// JS functions that define new and old kiosk UI API.
-const char kKioskSetAppsNewAPI[] = "login.AccountPickerScreen.setApps";
-const char kKioskSetAppsOldAPI[] = "login.AppsMenuButton.setApps";
-const char kKioskShowErrorNewAPI[] = "login.AccountPickerScreen.showAppError";
-const char kKioskShowErrorOldAPI[] = "login.AppsMenuButton.showError";
-
-} // namespace
-
-KioskAppMenuHandler::KioskAppMenuHandler(
- const scoped_refptr<NetworkStateInformer>& network_state_informer)
- : is_webui_initialized_(false),
- network_state_informer_(network_state_informer),
- weak_ptr_factory_(this) {
- KioskAppManager::Get()->AddObserver(this);
- network_state_informer_->AddObserver(this);
- ArcKioskAppManager::Get()->AddObserver(this);
-}
-
-KioskAppMenuHandler::~KioskAppMenuHandler() {
- KioskAppManager::Get()->RemoveObserver(this);
- network_state_informer_->RemoveObserver(this);
- ArcKioskAppManager::Get()->RemoveObserver(this);
-}
-
-void KioskAppMenuHandler::GetLocalizedStrings(
- base::DictionaryValue* localized_strings) {
- localized_strings->SetString(
- "showApps",
- l10n_util::GetStringUTF16(IDS_KIOSK_APPS_BUTTON));
- localized_strings->SetString(
- "confirmKioskAppDiagnosticModeFormat",
- l10n_util::GetStringUTF16(IDS_LOGIN_CONFIRM_KIOSK_DIAGNOSTIC_FORMAT));
- localized_strings->SetString(
- "confirmKioskAppDiagnosticModeYes",
- l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL));
- localized_strings->SetString(
- "confirmKioskAppDiagnosticModeNo",
- l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL));
- localized_strings->SetBoolean(
- "kioskAppHasLaunchError",
- KioskAppLaunchError::Get() != KioskAppLaunchError::NONE);
-}
-
-void KioskAppMenuHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "initializeKioskApps",
- base::BindRepeating(&KioskAppMenuHandler::HandleInitializeKioskApps,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "kioskAppsLoaded",
- base::BindRepeating(&KioskAppMenuHandler::HandleKioskAppsLoaded,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "checkKioskAppLaunchError",
- base::BindRepeating(&KioskAppMenuHandler::HandleCheckKioskAppLaunchError,
- base::Unretained(this)));
-}
-
-// static
-bool KioskAppMenuHandler::EnableNewKioskUI() {
- // Turn off new kiosk UI for M34/35.
- // TODO(xiyuan, nkostylev): Revist for http://crbug.com/362062.
- return false;
-}
-
-void KioskAppMenuHandler::SendKioskApps() {
- if (!is_webui_initialized_)
- return;
-
- KioskAppManager::Apps apps;
- KioskAppManager::Get()->GetApps(&apps);
-
- base::ListValue apps_list;
- for (size_t i = 0; i < apps.size(); ++i) {
- const KioskAppManager::App& app_data = apps[i];
-
- std::unique_ptr<base::DictionaryValue> app_info(
- new base::DictionaryValue());
- app_info->SetBoolean("isApp", true);
- app_info->SetString("id", app_data.app_id);
- app_info->SetBoolean("isAndroidApp", false);
- // Unused for native apps. Added for consistency with Android apps.
- app_info->SetString("account_email", app_data.account_id.GetUserEmail());
- app_info->SetString("label", app_data.name);
-
- std::string icon_url;
- if (app_data.icon.isNull()) {
- icon_url =
- webui::GetBitmapDataUrl(*ui::ResourceBundle::GetSharedInstance()
- .GetImageNamed(IDR_APP_DEFAULT_ICON)
- .ToSkBitmap());
- } else {
- icon_url = webui::GetBitmapDataUrl(*app_data.icon.bitmap());
- }
- app_info->SetString("iconUrl", icon_url);
-
- apps_list.Append(std::move(app_info));
- }
-
- ArcKioskAppManager::Apps arc_apps;
- ArcKioskAppManager::Get()->GetAllApps(&arc_apps);
- for (size_t i = 0; i < arc_apps.size(); ++i) {
- std::unique_ptr<base::DictionaryValue> app_info(
- new base::DictionaryValue());
- app_info->SetBoolean("isApp", true);
- app_info->SetBoolean("isAndroidApp", true);
- app_info->SetString("id", arc_apps[i]->app_id());
- app_info->SetString("account_email",
- arc_apps[i]->account_id().GetUserEmail());
- app_info->SetString("label", arc_apps[i]->name());
-
- std::string icon_url;
- if (arc_apps[i]->icon().isNull()) {
- icon_url =
- webui::GetBitmapDataUrl(*ui::ResourceBundle::GetSharedInstance()
- .GetImageNamed(IDR_APP_DEFAULT_ICON)
- .ToSkBitmap());
- } else {
- icon_url = webui::GetBitmapDataUrl(*arc_apps[i]->icon().bitmap());
- }
- app_info->SetString("iconUrl", icon_url);
-
- apps_list.Append(std::move(app_info));
- }
-
- web_ui()->CallJavascriptFunctionUnsafe(
- EnableNewKioskUI() ? kKioskSetAppsNewAPI : kKioskSetAppsOldAPI,
- apps_list);
-}
-
-void KioskAppMenuHandler::HandleInitializeKioskApps(
- const base::ListValue* args) {
- is_webui_initialized_ = true;
- SendKioskApps();
- UpdateState(NetworkError::ERROR_REASON_UPDATE);
-}
-
-void KioskAppMenuHandler::HandleKioskAppsLoaded(
- const base::ListValue* args) {
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_KIOSK_APPS_LOADED,
- content::NotificationService::AllSources(),
- content::NotificationService::NoDetails());
-}
-
-void KioskAppMenuHandler::HandleCheckKioskAppLaunchError(
- const base::ListValue* args) {
- KioskAppLaunchError::Error error = KioskAppLaunchError::Get();
- if (error == KioskAppLaunchError::NONE)
- return;
- KioskAppLaunchError::RecordMetricAndClear();
-
- const std::string error_message = KioskAppLaunchError::GetErrorMessage(error);
- bool new_kiosk_ui = EnableNewKioskUI();
- web_ui()->CallJavascriptFunctionUnsafe(
- new_kiosk_ui ? kKioskShowErrorNewAPI : kKioskShowErrorOldAPI,
- base::Value(error_message));
-}
-
-void KioskAppMenuHandler::OnKioskAppsSettingsChanged() {
- SendKioskApps();
-}
-
-void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) {
- SendKioskApps();
-}
-
-void KioskAppMenuHandler::OnKioskAppDataLoadFailure(const std::string& app_id) {
- SendKioskApps();
-}
-
-void KioskAppMenuHandler::UpdateState(NetworkError::ErrorReason reason) {
- if (network_state_informer_->state() == NetworkStateInformer::ONLINE)
- KioskAppManager::Get()->RetryFailedAppDataFetch();
-}
-
-void KioskAppMenuHandler::OnArcKioskAppsChanged() {
- SendKioskApps();
-}
-
-} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h
deleted file mode 100644
index ce1e5473701..00000000000
--- a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_KIOSK_APP_MENU_HANDLER_H_
-#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_KIOSK_APP_MENU_HANDLER_H_
-
-#include <memory>
-#include <string>
-
-#include "base/compiler_specific.h"
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h"
-#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
-#include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h"
-#include "chrome/browser/chromeos/login/screens/network_error.h"
-#include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
-#include "content/public/browser/web_ui_message_handler.h"
-
-namespace chromeos {
-
-// KioskAppMenuHandler supplies kiosk apps data to apps menu on sign-in
-// screen when app mode is enabled and handles "launchKioskApp" request
-// from the apps menu.
-class KioskAppMenuHandler
- : public content::WebUIMessageHandler,
- public KioskAppManagerObserver,
- public NetworkStateInformer::NetworkStateInformerObserver,
- public ArcKioskAppManager::ArcKioskAppManagerObserver {
- public:
- explicit KioskAppMenuHandler(
- const scoped_refptr<NetworkStateInformer>& network_state_informer);
- ~KioskAppMenuHandler() override;
-
- void GetLocalizedStrings(base::DictionaryValue* localized_strings);
-
- // content::WebUIMessageHandler overrides:
- void RegisterMessages() override;
-
- // Returns true if new kiosk UI is enabled.
- static bool EnableNewKioskUI();
-
- private:
- // Sends all kiosk apps to webui.
- void SendKioskApps();
-
- // JS callbacks.
- void HandleInitializeKioskApps(const base::ListValue* args);
- void HandleKioskAppsLoaded(const base::ListValue* args);
- void HandleCheckKioskAppLaunchError(const base::ListValue* args);
-
- // KioskAppManagerObserver overrides:
- void OnKioskAppsSettingsChanged() override;
- void OnKioskAppDataChanged(const std::string& app_id) override;
- void OnKioskAppDataLoadFailure(const std::string& app_id) override;
-
- // NetworkStateInformer::NetworkStateInformerObserver overrides:
- void UpdateState(NetworkError::ErrorReason reason) override;
-
- // ArcKioskAppManager::ArcKioskAppManagerObserver overrides:
- void OnArcKioskAppsChanged() override;
-
- // True when WebUI is initialized. Otherwise don't allow calling JS functions.
- bool is_webui_initialized_;
-
- scoped_refptr<NetworkStateInformer> network_state_informer_;
-
- base::WeakPtrFactory<KioskAppMenuHandler> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(KioskAppMenuHandler);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_KIOSK_APP_MENU_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc
index ba35003786e..078bcd97af2 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc
@@ -16,7 +16,7 @@
#include "chrome/grit/generated_resources.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/session_manager_client.h"
+#include "chromeos/dbus/session_manager/session_manager_client.h"
#include "components/login/localized_values_builder.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
@@ -24,18 +24,11 @@
#include "content/public/browser/notification_service.h"
#include "ui/base/webui/web_ui_util.h"
-namespace {
-
-const char kJsScreenPath[] = "login.AutolaunchScreen";
-
-} // namespace
-
namespace chromeos {
KioskAutolaunchScreenHandler::KioskAutolaunchScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
KioskAppManager::Get()->AddObserver(this);
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
index 41a6c0dffa9..1f4eb1d8cd6 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
@@ -17,19 +17,12 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
-namespace {
-
-const char kJsScreenPath[] = "login.KioskEnableScreen";
-
-} // namespace
-
namespace chromeos {
KioskEnableScreenHandler::KioskEnableScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container),
weak_ptr_factory_(this) {
- set_call_js_prefix(kJsScreenPath);
}
KioskEnableScreenHandler::~KioskEnableScreenHandler() {
@@ -74,7 +67,6 @@ void KioskEnableScreenHandler::SetDelegate(Delegate* delegate) {
void KioskEnableScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
- builder->Add("kioskEnableTitle", IDS_KIOSK_ENABLE_SCREEN_WARNING);
builder->Add("kioskEnableWarningText",
IDS_KIOSK_ENABLE_SCREEN_WARNING);
builder->Add("kioskEnableWarningDetails",
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.cc b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.cc
index 7189ed29cf2..63a72505d35 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.cc
@@ -18,12 +18,6 @@ MockInputMethodManagerWithInputMethods::
~MockInputMethodManagerWithInputMethods() {
}
-std::unique_ptr<input_method::InputMethodDescriptors>
-MockInputMethodManagerWithInputMethods::GetSupportedInputMethods() const {
- return std::unique_ptr<input_method::InputMethodDescriptors>(
- new input_method::InputMethodDescriptors(descriptors_));
-}
-
void MockInputMethodManagerWithInputMethods::AddInputMethod(
const std::string& id,
const std::string& raw_layout,
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h
index 8136458bc60..1b460c9f073 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h
@@ -22,10 +22,6 @@ class MockInputMethodManagerWithInputMethods
MockInputMethodManagerWithInputMethods();
~MockInputMethodManagerWithInputMethods() override;
- // input_method::MockInputMethodManagerImpl:
- std::unique_ptr<input_method::InputMethodDescriptors>
- GetSupportedInputMethods() const override;
-
void AddInputMethod(const std::string& id,
const std::string& raw_layout,
const std::string& language_code);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
index 46a99135a0d..7449e5194ca 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
@@ -16,7 +16,7 @@
#include "chrome/browser/chromeos/customization/customization_document.h"
#include "chrome/browser/chromeos/input_method/input_method_configuration.h"
#include "chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h"
-#include "chromeos/system/statistics_provider.h"
+#include "chromeos/system/fake_statistics_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ime/chromeos/component_extension_ime_manager.h"
@@ -59,8 +59,10 @@ class L10nUtilTest : public testing::Test {
private:
base::test::ScopedTaskEnvironment scoped_task_environment_;
-
+ system::ScopedFakeStatisticsProvider scoped_fake_statistics_provider_;
MockInputMethodManagerWithInputMethods* input_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(L10nUtilTest);
};
L10nUtilTest::L10nUtilTest()
@@ -69,13 +71,10 @@ L10nUtilTest::L10nUtilTest()
input_manager_->SetComponentExtensionIMEManager(
std::make_unique<ComponentExtensionIMEManager>());
- chromeos::system::StatisticsProvider::GetInstance()
- ->StartLoadingMachineStatistics(false);
base::RunLoop().RunUntilIdle();
}
L10nUtilTest::~L10nUtilTest() {
- chromeos::system::StatisticsProvider::GetInstance()->Shutdown();
chromeos::input_method::Shutdown();
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.cc
index f48656a41ef..d0cdb09f4bf 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.cc
@@ -8,18 +8,11 @@
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-const char kJsScreenPath[] = "login.MarketingOptInScreen";
-
-} // namespace
-
namespace chromeos {
MarketingOptInScreenHandler::MarketingOptInScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
}
MarketingOptInScreenHandler::~MarketingOptInScreenHandler() {}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/multidevice_setup_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/multidevice_setup_screen_handler.cc
index bc735441b1d..4ceafb89644 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/multidevice_setup_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/multidevice_setup_screen_handler.cc
@@ -9,18 +9,12 @@
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-const char kJsScreenPath[] = "login.MultiDeviceSetupScreen";
-
-} // namespace
-
namespace chromeos {
MultiDeviceSetupScreenHandler::MultiDeviceSetupScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.MultiDeviceSetupScreen.userActed");
}
MultiDeviceSetupScreenHandler::~MultiDeviceSetupScreenHandler() = default;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
index e4224b78652..f6f70ea5851 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
@@ -17,19 +17,13 @@
#include "chromeos/network/network_state_handler.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-const char kJsScreenPath[] = "login.NetworkScreen";
-
-} // namespace
-
namespace chromeos {
NetworkScreenHandler::NetworkScreenHandler(JSCallsContainer* js_calls_container,
CoreOobeView* core_oobe_view)
: BaseScreenHandler(kScreenId, js_calls_container),
core_oobe_view_(core_oobe_view) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.NetworkScreen.userActed");
DCHECK(core_oobe_view_);
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc
index def6426b4f1..a0e563f6057 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc
@@ -99,7 +99,8 @@ void OobeDisplayChooser::MoveToTouchDisplay() {
config_properties->set_primary = true;
cros_display_config_ptr_->SetDisplayProperties(
base::NumberToString(device.target_display_id),
- std::move(config_properties), base::DoNothing());
+ std::move(config_properties), ash::mojom::DisplayConfigSource::kUser,
+ base::DoNothing());
break;
}
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc
index 083f591158e..3a5adc9c22c 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc
@@ -48,6 +48,7 @@ class TestCrosDisplayConfig : public ash::mojom::CrosDisplayConfigController {
GetDisplayUnitInfoListCallback callback) override {}
void SetDisplayProperties(const std::string& id,
ash::mojom::DisplayConfigPropertiesPtr properties,
+ ash::mojom::DisplayConfigSource source,
SetDisplayPropertiesCallback callback) override {
if (properties->set_primary) {
int64_t display_id;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
index 2cbdfee5e0a..96901b262e3 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -59,7 +59,6 @@
#include "chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h"
-#include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.h"
@@ -77,7 +76,6 @@
#include "chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h"
-#include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/user_image_source.h"
@@ -131,8 +129,6 @@ constexpr char kArcPlaystoreLogoPath[] = "playstore.svg";
constexpr char kArcSupervisionIconPath[] = "supervision_icon.png";
constexpr char kCustomElementsHTMLPath[] = "custom_elements.html";
constexpr char kCustomElementsJSPath[] = "custom_elements.js";
-constexpr char kCustomElementsUserPodHTMLPath[] =
- "custom_elements_user_pod.html";
constexpr char kDiscoverJSPath[] = "discover_app.js";
constexpr char kKeyboardUtilsJSPath[] = "keyboard_utils.js";
constexpr char kLoginJSPath[] = "login.js";
@@ -148,11 +144,6 @@ constexpr char kLogo24PX2XSvgPath[] = "logo_24px-2x.svg";
constexpr char kSyncConsentIcons[] = "sync-consent-icons.html";
#endif
-// Paths for deferred resource loading.
-constexpr char kEnrollmentCSSPath[] = "enrollment.css";
-constexpr char kEnrollmentHTMLPath[] = "enrollment.html";
-constexpr char kEnrollmentJSPath[] = "enrollment.js";
-
// Adds various product logo resources.
void AddProductLogoResources(content::WebUIDataSource* source) {
// Required for Assistant OOBE.
@@ -191,14 +182,6 @@ void AddArcScreensResources(content::WebUIDataSource* source) {
IDR_ARC_SUPPORT_RECOMMEND_APP_LIST_VIEW_HTML);
}
-// Adds Enterprise Enrollment resources.
-void AddEnterpriseEnrollmentResources(content::WebUIDataSource* source) {
- // Deferred resources.
- source->AddResourcePath(kEnrollmentHTMLPath, IDR_OOBE_ENROLLMENT_HTML);
- source->AddResourcePath(kEnrollmentCSSPath, IDR_OOBE_ENROLLMENT_CSS);
- source->AddResourcePath(kEnrollmentJSPath, IDR_OOBE_ENROLLMENT_JS);
-}
-
void AddFingerprintResources(content::WebUIDataSource* source) {
if (quick_unlock::IsFingerprintReaderOnKeyboard()) {
source->AddResourcePath("fingerprint_scanner_animation.png",
@@ -267,12 +250,6 @@ content::WebUIDataSource* CreateOobeUIDataSource(
AddFingerprintResources(source);
AddSyncConsentResources(source);
AddArcScreensResources(source);
- AddEnterpriseEnrollmentResources(source);
-
- if (display_type == OobeUI::kLoginDisplay) {
- source->AddResourcePath(kCustomElementsUserPodHTMLPath,
- IDR_CUSTOM_ELEMENTS_USER_POD_HTML);
- }
source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS);
source->OverrideContentSecurityPolicyChildSrc(base::StringPrintf(
@@ -284,7 +261,8 @@ content::WebUIDataSource* CreateOobeUIDataSource(
const bool is_running_test = command_line->HasSwitch(::switches::kTestName) ||
command_line->HasSwitch(::switches::kTestType);
if (is_running_test)
- source->SetRequestFilter(::test::GetTestFilesRequestFilter());
+ source->SetRequestFilter(::test::GetTestShouldHandleRequest(),
+ ::test::GetTestFilesRequestFilter());
return source;
}
@@ -369,7 +347,7 @@ void OobeUI::ConfigureOobeDisplay() {
AddScreenHandler(
std::make_unique<ErrorScreenHandler>(js_calls_container_.get()));
- error_screen_.reset(new ErrorScreen(nullptr, GetView<ErrorScreenHandler>()));
+ error_screen_ = std::make_unique<ErrorScreen>(GetView<ErrorScreenHandler>());
ErrorScreen* error_screen = error_screen_.get();
AddScreenHandler(std::make_unique<EnrollmentScreenHandler>(
@@ -391,9 +369,6 @@ void OobeUI::ConfigureOobeDisplay() {
std::make_unique<AppDownloadingScreenHandler>(js_calls_container_.get()));
AddScreenHandler(
- std::make_unique<UserImageScreenHandler>(js_calls_container_.get()));
-
- AddScreenHandler(
std::make_unique<UserBoardScreenHandler>(js_calls_container_.get()));
AddScreenHandler(
@@ -457,12 +432,6 @@ void OobeUI::ConfigureOobeDisplay() {
AddScreenHandler(std::make_unique<MultiDeviceSetupScreenHandler>(
js_calls_container_.get()));
- // Initialize KioskAppMenuHandler. Note that it is NOT a screen handler.
- auto kiosk_app_menu_handler =
- std::make_unique<KioskAppMenuHandler>(network_state_informer_);
- kiosk_app_menu_handler_ = kiosk_app_menu_handler.get();
- web_ui()->AddMessageHandler(std::move(kiosk_app_menu_handler));
-
Profile* profile = Profile::FromWebUI(web_ui());
// Set up the chrome://theme/ source, for Chrome logo.
content::URLDataSource::Add(profile, std::make_unique<ThemeSource>(profile));
@@ -551,7 +520,10 @@ OobeUI::OobeUI(content::WebUI* web_ui, const GURL& url)
&OobeUI::BindPrivilegedHostDeviceSetter, base::Unretained(this)));
}
-OobeUI::~OobeUI() {}
+OobeUI::~OobeUI() {
+ for (Observer& observer : observer_list_)
+ observer.OnDestroyingOobeUI();
+}
CoreOobeView* OobeUI::GetCoreOobeView() {
return core_handler_;
@@ -661,10 +633,6 @@ MultiDeviceSetupScreenView* OobeUI::GetMultiDeviceSetupScreenView() {
return GetView<MultiDeviceSetupScreenHandler>();
}
-UserImageView* OobeUI::GetUserImageView() {
- return GetView<UserImageScreenHandler>();
-}
-
ErrorScreen* OobeUI::GetErrorScreen() {
return error_screen_.get();
}
@@ -681,10 +649,6 @@ NetworkScreenView* OobeUI::GetNetworkScreenView() {
return GetView<NetworkScreenHandler>();
}
-void OobeUI::OnShutdownPolicyChanged(bool reboot_on_shutdown) {
- core_handler_->UpdateShutdownAndRebootVisibility(reboot_on_shutdown);
-}
-
AppLaunchSplashScreenView* OobeUI::GetAppLaunchSplashScreenView() {
return GetView<AppLaunchSplashScreenHandler>();
}
@@ -702,7 +666,6 @@ void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
handler->GetLocalizedStrings(localized_strings);
const std::string& app_locale = g_browser_process->GetApplicationLocale();
webui::SetLoadTimeDataDefaults(app_locale, localized_strings);
- kiosk_app_menu_handler_->GetLocalizedStrings(localized_strings);
#if defined(GOOGLE_CHROME_BUILD)
localized_strings->SetString("buildType", "chrome");
@@ -715,8 +678,6 @@ void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
localized_strings->SetString("highlightStrength",
keyboard_driven_oobe ? "strong" : "normal");
- bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI();
- localized_strings->SetString("newKioskUI", new_kiosk_ui ? "on" : "off");
localized_strings->SetString(
"showViewsLock", ash::switches::IsUsingViewsLock() ? "on" : "off");
localized_strings->SetString(
@@ -739,32 +700,18 @@ void OobeUI::AddScreenHandler(std::unique_ptr<BaseScreenHandler> handler) {
}
void OobeUI::InitializeHandlers() {
- js_calls_container_->ExecuteDeferredJSCalls();
+ js_calls_container_->ExecuteDeferredJSCalls(web_ui());
ready_ = true;
for (size_t i = 0; i < ready_callbacks_.size(); ++i)
ready_callbacks_[i].Run();
ready_callbacks_.clear();
- // Notify 'initialize' for synchronously loaded screens.
- for (BaseWebUIHandler* handler : webui_only_handlers_) {
- if (handler->async_assets_load_id().empty()) {
- handler->InitializeBase();
- }
- }
- for (BaseScreenHandler* handler : screen_handlers_) {
- if (handler->async_assets_load_id().empty()) {
- handler->InitializeBase();
- ScreenInitialized(handler->oobe_screen());
- }
- }
-
- // Instantiate the ShutdownPolicyHandler.
- shutdown_policy_handler_.reset(
- new ShutdownPolicyHandler(CrosSettings::Get(), this));
+ for (BaseWebUIHandler* handler : webui_only_handlers_)
+ handler->InitializeBase();
- // Trigger an initial update.
- shutdown_policy_handler_->NotifyDelegateWithShutdownPolicy();
+ for (BaseScreenHandler* handler : screen_handlers_)
+ handler->InitializeBase();
}
void OobeUI::CurrentScreenChanged(OobeScreen new_screen) {
@@ -775,11 +722,6 @@ void OobeUI::CurrentScreenChanged(OobeScreen new_screen) {
observer.OnCurrentScreenChanged(current_screen_, new_screen);
}
-void OobeUI::ScreenInitialized(OobeScreen screen) {
- for (Observer& observer : observer_list_)
- observer.OnScreenInitialized(screen);
-}
-
bool OobeUI::IsScreenInitialized(OobeScreen screen) {
for (BaseScreenHandler* handler : screen_handlers_) {
if (handler->oobe_screen() == screen) {
@@ -789,22 +731,6 @@ bool OobeUI::IsScreenInitialized(OobeScreen screen) {
return false;
}
-void OobeUI::OnScreenAssetsLoaded(const std::string& async_assets_load_id) {
- DCHECK(!async_assets_load_id.empty());
-
- for (BaseWebUIHandler* handler : webui_only_handlers_) {
- if (handler->async_assets_load_id() == async_assets_load_id) {
- handler->InitializeBase();
- }
- }
- for (BaseScreenHandler* handler : screen_handlers_) {
- if (handler->async_assets_load_id() == async_assets_load_id) {
- handler->InitializeBase();
- ScreenInitialized(handler->oobe_screen());
- }
- }
-}
-
bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) {
if (!ready_)
ready_callbacks_.push_back(display_is_ready_callback);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
index 9c111fdd79e..f848ebf7cd3 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
@@ -15,7 +15,6 @@
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "chrome/browser/chromeos/login/oobe_screen.h"
-#include "chrome/browser/chromeos/settings/shutdown_policy_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h"
#include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
@@ -50,7 +49,6 @@ class DiscoverScreenView;
class FingerprintSetupScreenView;
class GaiaView;
class HIDDetectionView;
-class KioskAppMenuHandler;
class KioskAutolaunchScreenView;
class KioskEnableScreenView;
class LoginScreenContext;
@@ -67,7 +65,6 @@ class SigninScreenHandlerDelegate;
class SyncConsentScreenView;
class TermsOfServiceScreenView;
class UserBoardView;
-class UserImageView;
class UpdateView;
class UpdateRequiredView;
class SupervisionTransitionScreenView;
@@ -78,8 +75,7 @@ class WrongHWIDScreenView;
// - welcome screen (setup language/keyboard/network).
// - eula screen (CrOS (+ OEM) EULA content/TPM password/crash reporting).
// - update screen.
-class OobeUI : public ui::MojoWebUIController,
- public ShutdownPolicyHandler::Delegate {
+class OobeUI : public ui::MojoWebUIController {
public:
// List of known types of OobeUI. Type added as path in chrome://oobe url, for
// example chrome://oobe/user-adding.
@@ -98,7 +94,7 @@ class OobeUI : public ui::MojoWebUIController,
virtual void OnCurrentScreenChanged(OobeScreen current_screen,
OobeScreen new_screen) = 0;
- virtual void OnScreenInitialized(OobeScreen screen) = 0;
+ virtual void OnDestroyingOobeUI() = 0;
protected:
virtual ~Observer() {}
@@ -125,7 +121,6 @@ class OobeUI : public ui::MojoWebUIController,
ArcTermsOfServiceScreenView* GetArcTermsOfServiceScreenView();
RecommendAppsScreenView* GetRecommendAppsScreenView();
AppDownloadingScreenView* GetAppDownloadingScreenView();
- UserImageView* GetUserImageView();
ErrorScreen* GetErrorScreen();
WrongHWIDScreenView* GetWrongHWIDScreenView();
AutoEnrollmentCheckScreenView* GetAutoEnrollmentCheckScreenView();
@@ -144,9 +139,6 @@ class OobeUI : public ui::MojoWebUIController,
NetworkScreenView* GetNetworkScreenView();
MarketingOptInScreenView* GetMarketingOptInScreenView();
- // ShutdownPolicyHandler::Delegate
- void OnShutdownPolicyChanged(bool reboot_on_shutdown) override;
-
// Collects localized strings from the owned handlers.
void GetLocalizedStrings(base::DictionaryValue* localized_strings);
@@ -156,15 +148,8 @@ class OobeUI : public ui::MojoWebUIController,
// Called when the screen has changed.
void CurrentScreenChanged(OobeScreen screen);
- // Called when the screen was initialized.
- void ScreenInitialized(OobeScreen screen);
-
bool IsScreenInitialized(OobeScreen screen);
- // Invoked after the async assets load. The screen handler that has the same
- // async assets load id will be initialized.
- void OnScreenAssetsLoaded(const std::string& async_assets_load_id);
-
bool IsJSReady(const base::Closure& display_is_ready_callback);
// Shows or hides OOBE UI elements.
@@ -252,9 +237,6 @@ class OobeUI : public ui::MojoWebUIController,
std::vector<BaseWebUIHandler*> webui_only_handlers_; // Non-owning pointers.
std::vector<BaseScreenHandler*> screen_handlers_; // Non-owning pointers.
- KioskAppMenuHandler* kiosk_app_menu_handler_ =
- nullptr; // Non-owning pointers.
-
std::unique_ptr<ErrorScreen> error_screen_;
// Id of the current oobe/login screen.
@@ -273,9 +255,6 @@ class OobeUI : public ui::MojoWebUIController,
// List of registered observers.
base::ObserverList<Observer>::Unchecked observer_list_;
- // Observer of CrosSettings watching the kRebootOnShutdown policy.
- std::unique_ptr<ShutdownPolicyHandler> shutdown_policy_handler_;
-
std::unique_ptr<OobeDisplayChooser> oobe_display_chooser_;
// Store the deferred JS calls before the screen handler instance is
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc
index e5894cda505..32cb05dfb22 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc
@@ -18,8 +18,6 @@
namespace {
-const char kJsScreenPath[] = "login.RecommendAppsScreen";
-
constexpr const char kUserActionSkip[] = "recommendAppsSkip";
constexpr const char kUserActionRetry[] = "recommendAppsRetry";
constexpr const char kUserActionInstall[] = "recommendAppsInstall";
@@ -76,7 +74,6 @@ namespace chromeos {
RecommendAppsScreenHandler::RecommendAppsScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
}
RecommendAppsScreenHandler::~RecommendAppsScreenHandler() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc
index 8b46908ed4f..187aa5d01cd 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc
@@ -13,21 +13,15 @@
#include "chrome/browser/chromeos/login/screens/reset_screen.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
-#include "chromeos/dbus/session_manager_client.h"
+#include "chromeos/dbus/session_manager/session_manager_client.h"
#include "components/login/localized_values_builder.h"
#include "components/strings/grit/components_strings.h"
-namespace {
-
-const char kJsScreenPath[] = "login.ResetScreen";
-
-} // namespace
-
namespace chromeos {
ResetScreenHandler::ResetScreenHandler(JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.ResetScreen.userActed");
}
ResetScreenHandler::~ResetScreenHandler() {
@@ -35,6 +29,16 @@ ResetScreenHandler::~ResetScreenHandler() {
screen_->OnViewDestroyed(this);
}
+void ResetScreenHandler::Bind(ResetScreen* screen) {
+ screen_ = screen;
+ BaseScreenHandler::SetBaseScreen(screen_);
+}
+
+void ResetScreenHandler::Unbind() {
+ screen_ = nullptr;
+ BaseScreenHandler::SetBaseScreen(nullptr);
+}
+
void ResetScreenHandler::Show() {
if (!page_is_ready()) {
show_on_init_ = true;
@@ -48,7 +52,6 @@ void ResetScreenHandler::Hide() {
void ResetScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
- builder->Add("resetScreenTitle", IDS_RESET_SCREEN_TITLE);
builder->Add("resetScreenAccessibleTitle", IDS_RESET_SCREEN_TITLE);
builder->Add("resetScreenIconTitle", IDS_RESET_SCREEN_ICON_TITLE);
builder->Add("resetScreenIllustrationTitle",
@@ -94,6 +97,11 @@ void ResetScreenHandler::DeclareLocalizedValues(
builder->Add("confirmResetButton", IDS_RESET_SCREEN_POPUP_CONFIRM_BUTTON);
}
+void ResetScreenHandler::DeclareJSCallbacks() {
+ AddCallback("ResetScreen.setTpmFirmwareUpdateChecked",
+ &ResetScreenHandler::HandleSetTpmFirmwareUpdateChecked);
+}
+
void ResetScreenHandler::Initialize() {
if (!page_is_ready())
return;
@@ -104,14 +112,70 @@ void ResetScreenHandler::Initialize() {
}
}
-void ResetScreenHandler::Bind(ResetScreen* screen) {
- screen_ = screen;
- BaseScreenHandler::SetBaseScreen(screen_);
+void ResetScreenHandler::SetIsRollbackAvailable(bool value) {
+ is_rollback_available_ = value;
+ CallJS("login.ResetScreen.setIsRollbackAvailable", value);
}
-void ResetScreenHandler::Unbind() {
- screen_ = nullptr;
- BaseScreenHandler::SetBaseScreen(nullptr);
+void ResetScreenHandler::SetIsRollbackChecked(bool value) {
+ is_rollback_checked_ = value;
+ CallJS("login.ResetScreen.setIsRollbackChecked", value);
+}
+
+void ResetScreenHandler::SetIsTpmFirmwareUpdateAvailable(bool value) {
+ CallJS("login.ResetScreen.setIsTpmFirmwareUpdateAvailable", value);
+}
+
+void ResetScreenHandler::SetIsTpmFirmwareUpdateChecked(bool value) {
+ is_tpm_firmware_update_checked_ = value;
+ CallJS("login.ResetScreen.setIsTpmFirmwareUpdateChecked", value);
+}
+
+void ResetScreenHandler::SetIsTpmFirmwareUpdateEditable(bool value) {
+ CallJS("login.ResetScreen.setIsTpmFirmwareUpdateEditable", value);
+}
+
+void ResetScreenHandler::SetTpmFirmwareUpdateMode(
+ tpm_firmware_update::Mode value) {
+ mode_ = value;
+ CallJS("login.ResetScreen.setTpmFirmwareUpdateMode", static_cast<int>(value));
+}
+
+void ResetScreenHandler::SetIsConfirmational(bool value) {
+ CallJS("login.ResetScreen.setIsConfirmational", value);
+}
+
+void ResetScreenHandler::SetIsOfficialBuild(bool value) {
+ CallJS("login.ResetScreen.setIsOfficialBuild", value);
+}
+
+void ResetScreenHandler::SetScreenState(State value) {
+ state_ = value;
+ CallJS("login.ResetScreen.setScreenState", static_cast<int>(value));
+}
+
+ResetView::State ResetScreenHandler::GetScreenState() {
+ return state_;
+}
+
+tpm_firmware_update::Mode ResetScreenHandler::GetTpmFirmwareUpdateMode() {
+ return mode_;
+}
+
+bool ResetScreenHandler::GetIsRollbackAvailable() {
+ return is_rollback_available_;
+}
+
+bool ResetScreenHandler::GetIsRollbackChecked() {
+ return is_rollback_checked_;
+}
+
+bool ResetScreenHandler::GetIsTpmFirmwareUpdateChecked() {
+ return is_tpm_firmware_update_checked_;
+}
+
+void ResetScreenHandler::HandleSetTpmFirmwareUpdateChecked(bool value) {
+ is_tpm_firmware_update_checked_ = value;
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h
index f69d5b2cb65..e23e06bf8e5 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h
@@ -8,6 +8,7 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "chrome/browser/chromeos/login/screens/reset_view.h"
+#include "chrome/browser/chromeos/tpm_firmware_update.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "content/public/browser/web_ui.h"
@@ -29,14 +30,37 @@ class ResetScreenHandler : public ResetView,
// BaseScreenHandler implementation:
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
+ void DeclareJSCallbacks() override;
void Initialize() override;
+ void SetIsRollbackAvailable(bool value) override;
+ void SetIsRollbackChecked(bool value) override;
+ void SetIsTpmFirmwareUpdateAvailable(bool value) override;
+ void SetIsTpmFirmwareUpdateChecked(bool value) override;
+ void SetIsTpmFirmwareUpdateEditable(bool value) override;
+ void SetTpmFirmwareUpdateMode(tpm_firmware_update::Mode value) override;
+ void SetIsConfirmational(bool value) override;
+ void SetIsOfficialBuild(bool value) override;
+ void SetScreenState(State value) override;
+ State GetScreenState() override;
+ tpm_firmware_update::Mode GetTpmFirmwareUpdateMode() override;
+ bool GetIsRollbackAvailable() override;
+ bool GetIsRollbackChecked() override;
+ bool GetIsTpmFirmwareUpdateChecked() override;
private:
+ void HandleSetTpmFirmwareUpdateChecked(bool value);
+
ResetScreen* screen_ = nullptr;
// If true, Initialize() will call Show().
bool show_on_init_ = false;
+ ResetView::State state_ = ResetView::State::kRestartRequired;
+ tpm_firmware_update::Mode mode_ = tpm_firmware_update::Mode::kNone;
+ bool is_rollback_available_ = false;
+ bool is_rollback_checked_ = false;
+ bool is_tpm_firmware_update_checked_ = false;
+
DISALLOW_COPY_AND_ASSIGN(ResetScreenHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
index 7f656be840c..d0fec1de240 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -12,8 +12,6 @@
#include "ash/public/cpp/login_constants.h"
#include "ash/public/cpp/wallpaper_types.h"
-#include "ash/public/interfaces/constants.mojom.h"
-#include "ash/public/interfaces/shutdown.mojom.h"
#include "ash/public/interfaces/tray_action.mojom.h"
#include "base/bind.h"
#include "base/i18n/number_formatting.h"
@@ -83,7 +81,7 @@
#include "chromeos/components/proximity_auth/screenlock_bridge.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/power_manager_client.h"
+#include "chromeos/dbus/power/power_manager_client.h"
#include "chromeos/login/auth/key.h"
#include "chromeos/login/auth/user_context.h"
#include "chromeos/network/network_state.h"
@@ -102,9 +100,7 @@
#include "components/version_info/version_info.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/common/service_manager_connection.h"
#include "google_apis/gaia/gaia_auth_util.h"
-#include "services/service_manager/public/cpp/connector.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/base/ime/chromeos/ime_keyboard.h"
#include "ui/base/ime/chromeos/input_method_descriptor.h"
@@ -326,14 +322,6 @@ void SigninScreenHandler::DeclareLocalizedValues(
builder->Add("submitButtonAccessibleName",
IDS_LOGIN_POD_SUBMIT_BUTTON_ACCESSIBLE_NAME);
builder->Add("signedIn", IDS_SCREEN_LOCK_ACTIVE_USER);
- builder->Add("launchAppButton", IDS_LAUNCH_APP_BUTTON);
- builder->Add("restart", IDS_ASH_SHELF_RESTART_BUTTON);
- builder->Add("shutDown", IDS_ASH_SHELF_SHUTDOWN_BUTTON);
- builder->Add("addUser", IDS_ASH_ADD_USER_BUTTON);
- builder->Add("browseAsGuest", IDS_ASH_BROWSE_AS_GUEST_BUTTON);
- builder->Add("moreOptions", IDS_MORE_OPTIONS_BUTTON);
- builder->Add("cancel", IDS_ASH_SHELF_CANCEL_BUTTON);
- builder->Add("signOutUser", IDS_ASH_SHELF_SIGN_OUT_BUTTON);
builder->Add("offlineLogin", IDS_OFFLINE_LOGIN_HTML);
builder->Add("ownerUserPattern", IDS_LOGIN_POD_OWNER_USER);
builder->Add("removeUser", IDS_LOGIN_POD_REMOVE_USER);
@@ -440,15 +428,6 @@ void SigninScreenHandler::DeclareLocalizedValues(
IDS_ENTERPRISE_ENROLLMENT_AUTH_FATAL_ERROR);
builder->Add("insecureURLEnrollmentError",
IDS_ENTERPRISE_ENROLLMENT_AUTH_INSECURE_URL_ERROR);
-
- builder->Add("unrecoverableCryptohomeErrorMessageTitle",
- IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_TITLE);
- builder->Add("unrecoverableCryptohomeErrorMessage",
- IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_MESSAGE);
- builder->Add("unrecoverableCryptohomeErrorContinue",
- IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_CONTINUE);
- builder->Add("unrecoverableCryptohomeErrorRecreatingProfile",
- IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_WAIT_MESSAGE);
}
void SigninScreenHandler::RegisterMessages() {
@@ -460,7 +439,6 @@ void SigninScreenHandler::RegisterMessages() {
&SigninScreenHandler::HandleLaunchPublicSession);
AddRawCallback("offlineLogin", &SigninScreenHandler::HandleOfflineLogin);
AddCallback("rebootSystem", &SigninScreenHandler::HandleRebootSystem);
- AddCallback("shutdownSystem", &SigninScreenHandler::HandleShutdownSystem);
AddCallback("removeUser", &SigninScreenHandler::HandleRemoveUser);
AddCallback("toggleEnrollmentScreen",
&SigninScreenHandler::HandleToggleEnrollmentScreen);
@@ -470,7 +448,6 @@ void SigninScreenHandler::RegisterMessages() {
&SigninScreenHandler::HandleToggleKioskEnableScreen);
AddCallback("accountPickerReady",
&SigninScreenHandler::HandleAccountPickerReady);
- AddCallback("signOutUser", &SigninScreenHandler::HandleSignOutUser);
AddCallback("openInternetDetailDialog",
&SigninScreenHandler::HandleOpenInternetDetailDialog);
AddCallback("loginVisible", &SigninScreenHandler::HandleLoginVisible);
@@ -497,14 +474,6 @@ void SigninScreenHandler::RegisterMessages() {
AddCallback("maxIncorrectPasswordAttempts",
&SigninScreenHandler::HandleMaxIncorrectPasswordAttempts);
AddCallback("sendFeedback", &SigninScreenHandler::HandleSendFeedback);
- AddCallback("sendFeedbackAndResyncUserData",
- &SigninScreenHandler::HandleSendFeedbackAndResyncUserData);
-
- // This message is sent by the kiosk app menu, but is handled here
- // so we can tell the delegate to launch the app.
- AddCallback("launchKioskApp", &SigninScreenHandler::HandleLaunchKioskApp);
- AddCallback("launchArcKioskApp",
- &SigninScreenHandler::HandleLaunchArcKioskApp);
}
void SigninScreenHandler::Show(const LoginScreenContext& context,
@@ -592,23 +561,20 @@ void SigninScreenHandler::ShowImpl() {
->GetImeKeyboard()
->SetCapsLockEnabled(false);
- base::DictionaryValue params;
- params.SetBoolean("disableAddUser", AllWhitelistedUsersPresent());
- UpdateUIState(UI_STATE_ACCOUNT_PICKER, &params);
+ UpdateUIState(UI_STATE_ACCOUNT_PICKER);
}
}
-void SigninScreenHandler::UpdateUIState(UIState ui_state,
- base::DictionaryValue* params) {
+void SigninScreenHandler::UpdateUIState(UIState ui_state) {
switch (ui_state) {
case UI_STATE_GAIA_SIGNIN:
ui_state_ = UI_STATE_GAIA_SIGNIN;
- ShowScreenWithData(OobeScreen::SCREEN_GAIA_SIGNIN, params);
+ ShowScreen(OobeScreen::SCREEN_GAIA_SIGNIN);
break;
case UI_STATE_ACCOUNT_PICKER:
ui_state_ = UI_STATE_ACCOUNT_PICKER;
gaia_screen_handler_->CancelShowGaiaAsync();
- ShowScreenWithData(OobeScreen::SCREEN_ACCOUNT_PICKER, params);
+ ShowScreen(OobeScreen::SCREEN_ACCOUNT_PICKER);
break;
default:
NOTREACHED();
@@ -850,12 +816,6 @@ void SigninScreenHandler::Initialize() {
}
}
-gfx::NativeWindow SigninScreenHandler::GetNativeWindow() {
- if (native_window_delegate_)
- return native_window_delegate_->GetNativeWindow();
- return nullptr;
-}
-
void SigninScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterDictionaryPref(prefs::kUsersLastInputMethod);
}
@@ -967,8 +927,7 @@ void SigninScreenHandler::OnPreferencesChanged() {
// We need to reload GAIA if UI_STATE_UNKNOWN or the allow new user setting
// has changed so that reloaded GAIA shows/hides the option to create a new
// account.
- UpdateUIState(UI_STATE_ACCOUNT_PICKER, nullptr);
- UpdateAddButtonStatus();
+ UpdateUIState(UI_STATE_ACCOUNT_PICKER);
}
}
@@ -1008,10 +967,6 @@ void SigninScreenHandler::ShowWhitelistCheckFailedError() {
gaia_screen_handler_->ShowWhitelistCheckFailedError();
}
-void SigninScreenHandler::ShowUnrecoverableCrypthomeErrorDialog() {
- CallJS("login.UnrecoverableCryptohomeErrorScreen.show");
-}
-
void SigninScreenHandler::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -1074,11 +1029,6 @@ bool SigninScreenHandler::ShouldLoadGaia() const {
is_account_picker_showing_first_time_;
}
-void SigninScreenHandler::UpdateAddButtonStatus() {
- CallJS("cr.ui.login.DisplayManager.updateAddUserButtonStatus",
- AllWhitelistedUsersPresent());
-}
-
void SigninScreenHandler::HandleAuthenticateUser(const AccountId& account_id,
const std::string& password,
bool authenticated_by_pin) {
@@ -1178,16 +1128,7 @@ void SigninScreenHandler::HandleOfflineLogin(const base::ListValue* args) {
gaia_screen_handler_->set_populated_email(email);
gaia_screen_handler_->LoadAuthExtension(true /* force */, true /* offline */);
- UpdateUIState(UI_STATE_GAIA_SIGNIN, nullptr);
-}
-
-void SigninScreenHandler::HandleShutdownSystem() {
- ash::mojom::ShutdownControllerPtr shutdown_controller;
- content::ServiceManagerConnection::GetForProcess()
- ->GetConnector()
- ->BindInterface(ash::mojom::kServiceName, &shutdown_controller);
-
- shutdown_controller->RequestShutdownFromLoginScreen();
+ UpdateUIState(UI_STATE_GAIA_SIGNIN);
}
void SigninScreenHandler::HandleRebootSystem() {
@@ -1207,7 +1148,6 @@ void SigninScreenHandler::HandleRemoveUser(const AccountId& account_id) {
if (!delegate_)
return;
delegate_->RemoveUser(account_id);
- UpdateAddButtonStatus();
}
void SigninScreenHandler::HandleToggleEnrollmentScreen() {
@@ -1239,8 +1179,7 @@ void SigninScreenHandler::HandleToggleKioskAutolaunchScreen() {
void SigninScreenHandler::LoadUsers(const user_manager::UserList& users,
const base::ListValue& users_list) {
- CallJS("login.AccountPickerScreen.loadUsers", users_list,
- delegate_->IsShowGuest());
+ CallJS("login.AccountPickerScreen.loadUsers", users_list);
// Enable pin for any users who can use it.
// TODO(jdufault): Cache pin state in BrowserProcess::local_state() so we
@@ -1266,19 +1205,6 @@ void SigninScreenHandler::HandleAccountPickerReady() {
return;
}
- PrefService* prefs = g_browser_process->local_state();
- if (prefs->GetBoolean(prefs::kFactoryResetRequested)) {
- if (core_oobe_view_)
- core_oobe_view_->ShowDeviceResetScreen();
-
- return;
- } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) {
- if (core_oobe_view_)
- core_oobe_view_->ShowEnableDebuggingScreen();
-
- return;
- }
-
is_account_picker_showing_first_time_ = true;
// The wallpaper may have been set before the instance is initialized, so make
@@ -1303,11 +1229,6 @@ void SigninScreenHandler::HandleAccountPickerReady() {
delegate_->OnSigninScreenReady();
}
-void SigninScreenHandler::HandleSignOutUser() {
- if (delegate_)
- delegate_->Signout();
-}
-
void SigninScreenHandler::HandleOpenInternetDetailDialog() {
// Empty string opens the internet detail dialog for the default network.
InternetDetailDialog::ShowDialog("");
@@ -1443,22 +1364,6 @@ void SigninScreenHandler::SendPublicSessionKeyboardLayouts(
account_id, locale, *keyboard_layouts);
}
-void SigninScreenHandler::HandleLaunchKioskApp(const AccountId& app_account_id,
- bool diagnostic_mode) {
- UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_account_id);
- SigninSpecifics specifics;
- specifics.kiosk_diagnostic_mode = diagnostic_mode;
- if (delegate_)
- delegate_->Login(context, specifics);
-}
-
-void SigninScreenHandler::HandleLaunchArcKioskApp(
- const AccountId& app_account_id) {
- UserContext context(user_manager::USER_TYPE_ARC_KIOSK_APP, app_account_id);
- if (delegate_)
- delegate_->Login(context, SigninSpecifics());
-}
-
void SigninScreenHandler::HandleGetTabletModeState() {
CallJS("login.AccountPickerScreen.setTabletModeState",
TabletModeClient::Get()->tablet_mode_enabled());
@@ -1496,21 +1401,6 @@ void SigninScreenHandler::HandleSendFeedback() {
weak_factory_.GetWeakPtr()));
}
-void SigninScreenHandler::HandleSendFeedbackAndResyncUserData() {
- const std::string description = base::StringPrintf(
- "Auto generated feedback for http://crbug.com/547857.\n"
- "(uniquifier:%s)",
- base::NumberToString(base::Time::Now().ToInternalValue()).c_str());
-
- login_feedback_ =
- std::make_unique<LoginFeedback>(Profile::FromWebUI(web_ui()));
- login_feedback_->Request(
- description,
- base::BindOnce(
- &SigninScreenHandler::OnUnrecoverableCryptohomeFeedbackFinished,
- weak_factory_.GetWeakPtr()));
-}
-
bool SigninScreenHandler::AllWhitelistedUsersPresent() {
CrosSettings* cros_settings = CrosSettings::Get();
bool allow_new_user = false;
@@ -1574,15 +1464,6 @@ void SigninScreenHandler::OnFeedbackFinished() {
login_feedback_.reset();
}
-void SigninScreenHandler::OnUnrecoverableCryptohomeFeedbackFinished() {
- CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI");
-
- // Recreate user's cryptohome after the feedback is attempted.
- HandleResyncUserData();
-
- login_feedback_.reset();
-}
-
void SigninScreenHandler::OnAllowedInputMethodsChanged() {
if (!webui_visible_)
return;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
index 57de4217785..9256d90029a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
@@ -26,7 +26,7 @@
#include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chromeos/components/proximity_auth/screenlock_bridge.h"
-#include "chromeos/dbus/power_manager_client.h"
+#include "chromeos/dbus/power/power_manager_client.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/notification_observer.h"
@@ -47,7 +47,6 @@ enum class TrayActionState;
} // namespace ash
namespace base {
-class DictionaryValue;
class ListValue;
}
@@ -93,7 +92,6 @@ class LoginDisplayWebUIHandler {
virtual void ShowPasswordChangedDialog(bool show_password_error,
const std::string& email) = 0;
virtual void ShowWhitelistCheckFailedError() = 0;
- virtual void ShowUnrecoverableCrypthomeErrorDialog() = 0;
virtual void LoadUsers(const user_manager::UserList& users,
const base::ListValue& users_list) = 0;
@@ -225,7 +223,7 @@ class SigninScreenHandler
// OobeUI::Observer implementation:
void OnCurrentScreenChanged(OobeScreen current_screen,
OobeScreen new_screen) override;
- void OnScreenInitialized(OobeScreen screen) override {}
+ void OnDestroyingOobeUI() override {}
// ash::mojom::WallpaperObserver implementation:
void OnWallpaperChanged(uint32_t image_id) override;
@@ -261,9 +259,8 @@ class SigninScreenHandler
void ShowImpl();
// Updates current UI of the signin screen according to |ui_state|
- // argument. Optionally it can pass screen initialization data via
- // |params| argument.
- void UpdateUIState(UIState ui_state, base::DictionaryValue* params);
+ // argument.
+ void UpdateUIState(UIState ui_state);
void UpdateStateInternal(NetworkError::ErrorReason reason, bool force_update);
void SetupAndShowOfflineMessage(NetworkStateInformer::State state,
@@ -276,7 +273,6 @@ class SigninScreenHandler
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
void Initialize() override;
- gfx::NativeWindow GetNativeWindow() override;
// WebUIMessageHandler implementation:
void RegisterMessages() override;
@@ -298,7 +294,6 @@ class SigninScreenHandler
const std::string& email) override;
void ShowErrorScreen(LoginDisplay::SigninError error_id) override;
void ShowWhitelistCheckFailedError() override;
- void ShowUnrecoverableCrypthomeErrorDialog() override;
void LoadUsers(const user_manager::UserList& users,
const base::ListValue& users_list) override;
@@ -313,8 +308,6 @@ class SigninScreenHandler
// TabletModeClientObserver:
void OnTabletModeToggled(bool enabled) override;
- void UpdateAddButtonStatus();
-
// Restore input focus to current user pod.
void RefocusCurrentPod();
@@ -338,7 +331,6 @@ class SigninScreenHandler
const std::string& locale,
const std::string& input_method);
void HandleOfflineLogin(const base::ListValue* args);
- void HandleShutdownSystem();
void HandleRebootSystem();
void HandleRemoveUser(const AccountId& account_id);
void HandleToggleEnrollmentScreen();
@@ -354,7 +346,6 @@ class SigninScreenHandler
// * After OOBE enrollment when policy contains device local accounts.
// * On multiple sign-in account selection.
void HandleAccountPickerReady();
- void HandleSignOutUser();
void HandleOpenInternetDetailDialog();
void HandleLoginVisible(const std::string& source);
void HandleCancelPasswordChangedFlow(const AccountId& account_id);
@@ -378,7 +369,6 @@ class SigninScreenHandler
void HandleFirstIncorrectPasswordAttempt(const AccountId& account_id);
void HandleMaxIncorrectPasswordAttempts(const AccountId& account_id);
void HandleSendFeedback();
- void HandleSendFeedbackAndResyncUserData();
// Implements user sign-in.
void AuthenticateExistingUser(const AccountId& account_id,
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/supervision_transition_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/supervision_transition_screen_handler.cc
index a79033e88a7..afbd0859f76 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/supervision_transition_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/supervision_transition_screen_handler.cc
@@ -21,7 +21,6 @@
namespace {
-constexpr char kJsScreenPath[] = "login.SupervisionTransitionScreen";
constexpr base::TimeDelta kWaitingTimeout = base::TimeDelta::FromMinutes(2);
} // namespace
@@ -31,7 +30,6 @@ namespace chromeos {
SupervisionTransitionScreenHandler::SupervisionTransitionScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
}
SupervisionTransitionScreenHandler::~SupervisionTransitionScreenHandler() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.cc
index 471107776a9..b9f404dbace 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.cc
@@ -12,8 +12,6 @@
namespace {
-const char kJsScreenPath[] = "login.SyncConsentScreen";
-
// This helper function gets strings from WebUI and a set of known string
// resource ids, and converts strings back to IDs. It CHECKs if string is not
// found in resources.
@@ -60,7 +58,7 @@ namespace chromeos {
SyncConsentScreenHandler::SyncConsentScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.SyncConsentScreen.userActed");
}
SyncConsentScreenHandler::~SyncConsentScreenHandler() {}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc
index 9b5753eeb4c..ea0e3ccab1d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc
@@ -30,12 +30,6 @@
#include "content/public/browser/web_ui.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
-namespace {
-
-const char kJsScreenPath[] = "login.TermsOfServiceScreen";
-
-} // namespace
-
namespace chromeos {
TermsOfServiceScreenHandler::TermsOfServiceScreenHandler(
@@ -43,7 +37,6 @@ TermsOfServiceScreenHandler::TermsOfServiceScreenHandler(
CoreOobeView* core_oobe_view)
: BaseScreenHandler(kScreenId, js_calls_container),
core_oobe_view_(core_oobe_view) {
- set_call_js_prefix(kJsScreenPath);
}
TermsOfServiceScreenHandler::~TermsOfServiceScreenHandler() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.cc
index 16995e2b874..a91034af634 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.cc
@@ -13,18 +13,11 @@
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-const char kJsScreenPath[] = "login.UpdateRequiredScreen";
-
-} // namespace
-
namespace chromeos {
UpdateRequiredScreenHandler::UpdateRequiredScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
}
UpdateRequiredScreenHandler::~UpdateRequiredScreenHandler() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
index 97bae0b70fd..caa21e642c3 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
@@ -13,17 +13,11 @@
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-const char kJsScreenPath[] = "login.UpdateScreen";
-
-} // namespace
-
namespace chromeos {
UpdateScreenHandler::UpdateScreenHandler(JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.UpdateScreen.userActed");
}
UpdateScreenHandler::~UpdateScreenHandler() {
@@ -31,12 +25,63 @@ UpdateScreenHandler::~UpdateScreenHandler() {
screen_->OnViewDestroyed(this);
}
+void UpdateScreenHandler::Show() {
+ if (!page_is_ready()) {
+ show_on_init_ = true;
+ return;
+ }
+ ShowScreen(kScreenId);
+}
+
+void UpdateScreenHandler::Hide() {}
+
+void UpdateScreenHandler::Bind(UpdateScreen* screen) {
+ screen_ = screen;
+ BaseScreenHandler::SetBaseScreen(screen_);
+}
+
+void UpdateScreenHandler::Unbind() {
+ screen_ = nullptr;
+ BaseScreenHandler::SetBaseScreen(nullptr);
+}
+
+void UpdateScreenHandler::SetEstimatedTimeLeft(int value) {
+ CallJS("login.UpdateScreen.setEstimatedTimeLeft", value);
+}
+
+void UpdateScreenHandler::SetShowEstimatedTimeLeft(bool value) {
+ CallJS("login.UpdateScreen.showEstimatedTimeLeft", value);
+}
+
+void UpdateScreenHandler::SetUpdateCompleted(bool value) {
+ CallJS("login.UpdateScreen.setUpdateCompleted", value);
+}
+
+void UpdateScreenHandler::SetShowCurtain(bool value) {
+ CallJS("login.UpdateScreen.showUpdateCurtain", value);
+}
+
+void UpdateScreenHandler::SetProgressMessage(const base::string16& value) {
+ CallJS("login.UpdateScreen.setProgressMessage", value);
+}
+
+void UpdateScreenHandler::SetProgress(int value) {
+ CallJS("login.UpdateScreen.setUpdateProgress", value);
+}
+
+void UpdateScreenHandler::SetRequiresPermissionForCellular(bool value) {
+ CallJS("login.UpdateScreen.setRequiresPermissionForCellular", value);
+}
+
+void UpdateScreenHandler::SetCancelUpdateShortcutEnabled(bool value) {
+ CallJS("login.UpdateScreen.setCancelUpdateShortcutEnabled", value);
+}
+
void UpdateScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
builder->Add("checkingForUpdatesMsg", IDS_CHECKING_FOR_UPDATE_MSG);
builder->Add("installingUpdateDesc", IDS_UPDATE_MSG);
builder->Add("updateCompeletedMsg", IDS_UPDATE_COMPLETED);
- builder->Add("updateScreenTitle", IDS_UPDATE_SCREEN_TITLE);
builder->Add("updateScreenAccessibleTitle",
IDS_UPDATE_SCREEN_ACCESSIBLE_TITLE);
builder->Add("checkingForUpdates", IDS_CHECKING_FOR_UPDATES);
@@ -72,25 +117,4 @@ void UpdateScreenHandler::Initialize() {
}
}
-void UpdateScreenHandler::Show() {
- if (!page_is_ready()) {
- show_on_init_ = true;
- return;
- }
- ShowScreen(kScreenId);
-}
-
-void UpdateScreenHandler::Hide() {
-}
-
-void UpdateScreenHandler::Bind(UpdateScreen* screen) {
- screen_ = screen;
- BaseScreenHandler::SetBaseScreen(screen_);
-}
-
-void UpdateScreenHandler::Unbind() {
- screen_ = nullptr;
- BaseScreenHandler::SetBaseScreen(nullptr);
-}
-
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h
index 5f8648349f1..fbca33da5f1 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h
@@ -25,6 +25,14 @@ class UpdateScreenHandler : public UpdateView, public BaseScreenHandler {
void Hide() override;
void Bind(UpdateScreen* screen) override;
void Unbind() override;
+ void SetEstimatedTimeLeft(int value) override;
+ void SetShowEstimatedTimeLeft(bool value) override;
+ void SetUpdateCompleted(bool value) override;
+ void SetShowCurtain(bool value) override;
+ void SetProgressMessage(const base::string16& value) override;
+ void SetProgress(int value) override;
+ void SetRequiresPermissionForCellular(bool value) override;
+ void SetCancelUpdateShortcutEnabled(bool value) override;
// BaseScreenHandler:
void DeclareLocalizedValues(
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc
index 2042a7dbb39..857cdfe006e 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc
@@ -94,12 +94,12 @@ void UserBoardScreenHandler::SetAuthType(
void UserBoardScreenHandler::Bind(UserSelectionScreen* screen) {
screen_ = screen;
- BaseWebUIHandler::SetBaseScreen(screen_);
+ SetBaseScreen(screen_);
}
void UserBoardScreenHandler::Unbind() {
screen_ = nullptr;
- BaseWebUIHandler::SetBaseScreen(nullptr);
+ SetBaseScreen(nullptr);
}
base::WeakPtr<UserBoardView> UserBoardScreenHandler::GetWeakPtr() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc
deleted file mode 100644
index f922809bc2f..00000000000
--- a/chromium/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h"
-
-#include <utility>
-
-#include "base/base64.h"
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/metrics/histogram_macros.h"
-#include "base/stl_util.h"
-#include "base/values.h"
-#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
-#include "chrome/browser/chromeos/login/existing_user_controller.h"
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-#include "chrome/browser/chromeos/login/screens/user_image_screen.h"
-#include "chrome/browser/chromeos/login/ui/login_display_webui.h"
-#include "chrome/browser/chromeos/login/users/default_user_image/default_user_images.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/grit/browser_resources.h"
-#include "chrome/grit/generated_resources.h"
-#include "chromeos/audio/chromeos_sounds.h"
-#include "components/login/localized_values_builder.h"
-#include "components/strings/grit/components_strings.h"
-#include "components/user_manager/user.h"
-#include "media/audio/sounds/sounds_manager.h"
-#include "net/base/data_url.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "url/gurl.h"
-
-namespace {
-
-const char kJsScreenPath[] = "login.UserImageScreen";
-
-} // namespace
-
-namespace chromeos {
-
-UserImageScreenHandler::UserImageScreenHandler(
- JSCallsContainer* js_calls_container)
- : BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- media::SoundsManager* manager = media::SoundsManager::Get();
- manager->Initialize(SOUND_OBJECT_DELETE,
- bundle.GetRawDataResource(IDR_SOUND_OBJECT_DELETE_WAV));
- manager->Initialize(SOUND_CAMERA_SNAP,
- bundle.GetRawDataResource(IDR_SOUND_CAMERA_SNAP_WAV));
-}
-
-UserImageScreenHandler::~UserImageScreenHandler() {
- if (screen_)
- screen_->OnViewDestroyed(this);
-}
-
-void UserImageScreenHandler::Initialize() {
- if (show_on_init_) {
- Show();
- show_on_init_ = false;
- }
-}
-
-void UserImageScreenHandler::Bind(UserImageScreen* screen) {
- screen_ = screen;
- BaseScreenHandler::SetBaseScreen(screen_);
-}
-
-void UserImageScreenHandler::Unbind() {
- screen_ = nullptr;
- BaseScreenHandler::SetBaseScreen(nullptr);
-}
-
-void UserImageScreenHandler::Show() {
- if (!page_is_ready()) {
- show_on_init_ = true;
- return;
- }
- screen_show_time_ = base::Time::Now();
- ShowScreen(kScreenId);
-
- // When shown, query camera presence.
- if (screen_ && is_ready_)
- screen_->OnScreenReady();
-}
-
-void UserImageScreenHandler::Hide() {
-}
-
-void UserImageScreenHandler::DeclareLocalizedValues(
- ::login::LocalizedValuesBuilder* builder) {
- builder->Add("userImageScreenTitle", IDS_USER_IMAGE_SCREEN_TITLE);
- builder->Add("userImageScreenDescription",
- IDS_USER_IMAGE_SCREEN_DESCRIPTION);
- builder->Add("takePhoto", IDS_OPTIONS_CHANGE_PICTURE_TAKE_PHOTO);
- builder->Add("captureVideo", IDS_OPTIONS_CHANGE_PICTURE_CAPTURE_VIDEO);
- builder->Add("discardPhoto", IDS_OPTIONS_CHANGE_PICTURE_DISCARD_PHOTO);
- builder->Add("switchModeToCamera",
- IDS_OPTIONS_CHANGE_PICTURE_SWITCH_MODE_TO_CAMERA);
- builder->Add("switchModeToVideo",
- IDS_OPTIONS_CHANGE_PICTURE_SWITCH_MODE_TO_VIDEO);
- builder->Add("profilePhoto", IDS_IMAGE_SCREEN_PROFILE_PHOTO);
- builder->Add("profilePhotoLoading",
- IDS_IMAGE_SCREEN_PROFILE_LOADING_PHOTO);
- builder->Add("okButtonText", IDS_OK);
- builder->Add("photoFromCamera", IDS_OPTIONS_CHANGE_PICTURE_PHOTO_FROM_CAMERA);
- builder->Add("syncingPreferences", IDS_IMAGE_SCREEN_SYNCING_PREFERENCES);
-}
-
-void UserImageScreenHandler::RegisterMessages() {
- AddCallback("getImages", &UserImageScreenHandler::HandleGetImages);
- AddCallback("screenReady", &UserImageScreenHandler::HandleScreenReady);
- AddCallback("discardPhoto", &UserImageScreenHandler::HandleDiscardPhoto);
- AddCallback("photoTaken", &UserImageScreenHandler::HandlePhotoTaken);
- AddCallback("selectImage", &UserImageScreenHandler::HandleSelectImage);
- AddCallback("onUserImageAccepted",
- &UserImageScreenHandler::HandleImageAccepted);
- AddCallback("onUserImageScreenShown",
- &UserImageScreenHandler::HandleScreenShown);
-}
-
-// TODO(antrim) : It looks more like parameters for "Init" rather than callback.
-void UserImageScreenHandler::HandleGetImages() {
- base::DictionaryValue result;
- result.SetInteger("first", default_user_image::GetFirstDefaultImage());
- std::unique_ptr<base::ListValue> default_images =
- default_user_image::GetAsDictionary(true /* all */);
- result.Set("images", std::move(default_images));
- CallJS("login.UserImageScreen.setDefaultImages", result);
-}
-
-void UserImageScreenHandler::HandleScreenReady() {
- is_ready_ = true;
- if (screen_)
- screen_->OnScreenReady();
-}
-
-void UserImageScreenHandler::HandlePhotoTaken(const std::string& image_url) {
- AccessibilityManager::Get()->PlayEarcon(
- SOUND_CAMERA_SNAP, PlaySoundOption::ONLY_IF_SPOKEN_FEEDBACK_ENABLED);
-
- std::string raw_data;
- base::StringPiece url(image_url);
- const char kDataUrlPrefix[] = "data:image/png;base64,";
- const size_t kDataUrlPrefixLength = base::size(kDataUrlPrefix) - 1;
- if (!url.starts_with(kDataUrlPrefix) ||
- !base::Base64Decode(url.substr(kDataUrlPrefixLength), &raw_data)) {
- LOG(WARNING) << "Invalid image URL";
- return;
- }
-
- if (screen_)
- screen_->OnPhotoTaken(raw_data);
-}
-
-void UserImageScreenHandler::HandleDiscardPhoto() {
- AccessibilityManager::Get()->PlayEarcon(
- SOUND_OBJECT_DELETE, PlaySoundOption::ONLY_IF_SPOKEN_FEEDBACK_ENABLED);
-}
-
-void UserImageScreenHandler::HandleSelectImage(const std::string& image_type,
- const std::string& image_url,
- bool is_user_selection) {
- if (screen_)
- screen_->OnImageSelected(image_type, image_url, is_user_selection);
-}
-
-void UserImageScreenHandler::HandleImageAccepted() {
- if (screen_)
- screen_->OnImageAccepted();
-}
-
-void UserImageScreenHandler::HandleScreenShown() {
- DCHECK(!screen_show_time_.is_null());
-
- base::TimeDelta delta = base::Time::Now() - screen_show_time_;
- VLOG(1) << "Screen load time: " << delta.InSecondsF();
- UMA_HISTOGRAM_TIMES("UserImage.ScreenIsShownTime", delta);
-}
-
-void UserImageScreenHandler::HideCurtain() {
- CallJS("login.UserImageScreen.hideCurtain");
-}
-
-} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h
deleted file mode 100644
index 3fea9aab370..00000000000
--- a/chromium/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_
-#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_
-
-#include <string>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/time/time.h"
-#include "chrome/browser/chromeos/login/screens/user_image_view.h"
-#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
-#include "ui/gfx/image/image_skia.h"
-#include "ui/gfx/native_widget_types.h"
-
-namespace chromeos {
-
-// WebUI implementation of UserImageView. It is used to interact with the JS
-// page allowing user to select an avatar.
-class UserImageScreenHandler : public UserImageView, public BaseScreenHandler {
- public:
- explicit UserImageScreenHandler(JSCallsContainer* js_calls_container);
- ~UserImageScreenHandler() override;
-
- private:
- // BaseScreenHandler implementation:
- void Initialize() override;
- void DeclareLocalizedValues(
- ::login::LocalizedValuesBuilder* builder) override;
-
- // WebUIMessageHandler implementation:
- void RegisterMessages() override;
-
- // UserImageView implementation:
- void Bind(UserImageScreen* screen) override;
- void Unbind() override;
- void Show() override;
- void Hide() override;
- void HideCurtain() override;
-
- // Sends image data to the page.
- void HandleGetImages();
-
- // Screen ready to be shown.
- void HandleScreenReady();
-
- // Handles photo taken with WebRTC UI.
- void HandlePhotoTaken(const std::string& image_url);
-
- // Handles 'discard-photo' button click.
- void HandleDiscardPhoto();
-
- // Handles clicking on default user image.
- void HandleSelectImage(const std::string& image_type,
- const std::string& image_url,
- bool is_user_selection);
-
- // Called when user accept the image closing the screen.
- void HandleImageAccepted();
-
- // Called when the user image screen has been loaded and shown.
- void HandleScreenShown();
-
- UserImageScreen* screen_ = nullptr;
-
- // Keeps whether screen should be shown right after initialization.
- bool show_on_init_ = false;
-
- // Keeps whether screen has loaded all default images and redy to be shown.
- bool is_ready_ = false;
-
- base::Time screen_show_time_;
-
- DISALLOW_COPY_AND_ASSIGN(UserImageScreenHandler);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc
index 7df979af8c5..d8c998bf9bb 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc
@@ -35,12 +35,6 @@
#include "ui/base/ime/chromeos/extension_ime_util.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
-namespace {
-
-const char kJsScreenPath[] = "login.WelcomeScreen";
-
-} // namespace
-
namespace chromeos {
// WelcomeScreenHandler, public: -----------------------------------------------
@@ -49,7 +43,7 @@ WelcomeScreenHandler::WelcomeScreenHandler(JSCallsContainer* js_calls_container,
CoreOobeView* core_oobe_view)
: BaseScreenHandler(kScreenId, js_calls_container),
core_oobe_view_(core_oobe_view) {
- set_call_js_prefix(kJsScreenPath);
+ set_user_acted_method_path("login.WelcomeScreen.userActed");
DCHECK(core_oobe_view_);
}
@@ -114,10 +108,6 @@ void WelcomeScreenHandler::SetInputMethodId(
CallJS("login.WelcomeScreen.onInputMethodIdSetFromBackend", input_method_id);
}
-void WelcomeScreenHandler::SetTimezoneId(const std::string& timezone_id) {
- CallJS("login.WelcomeScreen.onTimezoneIdSetFromBackend", timezone_id);
-}
-
// WelcomeScreenHandler, BaseScreenHandler implementation: --------------------
void WelcomeScreenHandler::DeclareLocalizedValues(
@@ -127,8 +117,6 @@ void WelcomeScreenHandler::DeclareLocalizedValues(
else
builder->Add("welcomeScreenGreeting", IDS_WELCOME_SCREEN_GREETING);
- builder->Add("welcomeScreenTitle", IDS_WELCOME_SCREEN_TITLE);
-
// MD-OOBE (oobe-welcome-md)
builder->Add("debuggingFeaturesLink", IDS_WELCOME_ENABLE_DEV_FEATURES_LINK);
builder->Add("timezoneDropdownLabel", IDS_TIMEZONE_DROPDOWN_LABEL);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h
index de60b3cecef..38b5be34a27 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h
@@ -9,7 +9,6 @@
#include <string>
#include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/welcome_view.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
namespace base {
@@ -19,6 +18,36 @@ class ListValue;
namespace chromeos {
class CoreOobeView;
+class WelcomeScreen;
+
+// Interface for WelcomeScreenHandler.
+class WelcomeView {
+ public:
+ constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_OOBE_WELCOME;
+
+ virtual ~WelcomeView() {}
+
+ // Shows the contents of the screen.
+ virtual void Show() = 0;
+
+ // Hides the contents of the screen.
+ virtual void Hide() = 0;
+
+ // Binds |screen| to the view.
+ virtual void Bind(WelcomeScreen* screen) = 0;
+
+ // Unbinds model from the view.
+ virtual void Unbind() = 0;
+
+ // Stops demo mode detection.
+ virtual void StopDemoModeDetection() = 0;
+
+ // Reloads localized contents.
+ virtual void ReloadLocalizedContent() = 0;
+
+ // Change the current input method.
+ virtual void SetInputMethodId(const std::string& input_method_id) = 0;
+};
// WebUI implementation of WelcomeScreenView. It is used to interact with
// the welcome screen (part of the page) of the OOBE.
@@ -28,8 +57,7 @@ class WelcomeScreenHandler : public WelcomeView, public BaseScreenHandler {
CoreOobeView* core_oobe_view);
~WelcomeScreenHandler() override;
- private:
- // WelcomeView implementation:
+ // WelcomeView:
void Show() override;
void Hide() override;
void Bind(WelcomeScreen* screen) override;
@@ -37,15 +65,15 @@ class WelcomeScreenHandler : public WelcomeView, public BaseScreenHandler {
void StopDemoModeDetection() override;
void ReloadLocalizedContent() override;
void SetInputMethodId(const std::string& input_method_id) override;
- void SetTimezoneId(const std::string& timezone_id) override;
- // BaseScreenHandler implementation:
+ // BaseScreenHandler:
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
void DeclareJSCallbacks() override;
void GetAdditionalParameters(base::DictionaryValue* dict) override;
void Initialize() override;
+ private:
// JS callbacks.
void HandleSetLocaleId(const std::string& locale_id);
void HandleSetInputMethodId(const std::string& input_method_id);
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc
index dacdaa0de6f..a8331d2c29f 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc
@@ -8,18 +8,11 @@
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
-namespace {
-
-const char kJsScreenPath[] = "login.WrongHWIDScreen";
-
-} // namespace
-
namespace chromeos {
WrongHWIDScreenHandler::WrongHWIDScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
- set_call_js_prefix(kJsScreenPath);
}
WrongHWIDScreenHandler::~WrongHWIDScreenHandler() {
diff --git a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_handler.cc
index 29d6bbc74f8..3ccb3286b03 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_handler.cc
@@ -8,7 +8,7 @@
#include "base/bind_helpers.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/settings_window_manager_chromeos.h"
#include "chrome/browser/ui/webui/chromeos/user_image_source.h"
#include "chrome/common/webui_url_constants.h"
#include "components/user_manager/user.h"
@@ -60,8 +60,8 @@ void MultideviceSetupHandler::HandleGetProfileInfo(
void MultideviceSetupHandler::HandleOpenMultiDeviceSettings(
const base::ListValue* args) {
DCHECK(args->empty());
- chrome::ShowSettingsSubPageForProfile(Profile::FromWebUI(web_ui()),
- chrome::kConnectedDevicesSubPage);
+ chrome::SettingsWindowManager::GetInstance()->ShowOSSettings(
+ Profile::FromWebUI(web_ui()), chrome::kConnectedDevicesSubPage);
}
} // namespace multidevice_setup
diff --git a/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc
index 7494e78e108..1513366c2d6 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc
@@ -14,6 +14,7 @@
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/extensions/tab_helper.h"
+#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog_launcher.h"
#include "chrome/browser/ui/webui/chromeos/internet_config_dialog.h"
#include "chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.h"
#include "chrome/common/url_constants.h"
@@ -37,8 +38,10 @@ namespace chromeos {
namespace {
+constexpr char kAddNetwork[] = "addNetwork";
constexpr char kGetNetworkProperties[] = "getShillNetworkProperties";
constexpr char kGetDeviceProperties[] = "getShillDeviceProperties";
+constexpr char kOpenCellularActivationUi[] = "openCellularActivationUi";
bool GetServicePathFromGuid(const std::string& guid,
std::string* service_path) {
@@ -84,6 +87,10 @@ class NetworkConfigMessageHandler : public content::WebUIMessageHandler {
// WebUIMessageHandler implementation.
void RegisterMessages() override {
web_ui()->RegisterMessageCallback(
+ kAddNetwork,
+ base::BindRepeating(&NetworkConfigMessageHandler::AddNetwork,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
kGetNetworkProperties,
base::BindRepeating(
&NetworkConfigMessageHandler::GetShillNetworkProperties,
@@ -94,9 +101,10 @@ class NetworkConfigMessageHandler : public content::WebUIMessageHandler {
&NetworkConfigMessageHandler::GetShillDeviceProperties,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
- "addNetwork",
- base::BindRepeating(&NetworkConfigMessageHandler::AddNetwork,
- base::Unretained(this)));
+ kOpenCellularActivationUi,
+ base::BindRepeating(
+ &NetworkConfigMessageHandler::OpenCellularActivationUi,
+ base::Unretained(this)));
}
private:
@@ -165,6 +173,19 @@ class NetworkConfigMessageHandler : public content::WebUIMessageHandler {
weak_ptr_factory_.GetWeakPtr(), type, kGetDeviceProperties));
}
+ void OpenCellularActivationUi(const base::ListValue* arg_list) {
+ const NetworkState* cellular_network =
+ NetworkHandler::Get()->network_state_handler()->FirstNetworkByType(
+ NetworkTypePattern::Cellular());
+ if (cellular_network)
+ cellular_setup::OpenCellularSetupDialog(cellular_network->guid());
+
+ AllowJavascript();
+ CallJavascriptFunction(
+ base::StringPrintf("NetworkUI.%sResult", kOpenCellularActivationUi),
+ base::Value(cellular_network != nullptr));
+ }
+
void GetShillDevicePropertiesSuccess(
const std::string& device_path,
const base::DictionaryValue& dictionary) {
@@ -263,6 +284,17 @@ void NetworkUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
l10n_util::GetStringUTF16(IDS_NETWORK_UI_FAVORITE_NETWORKS));
localized_strings->SetString(
"devicesLabel", l10n_util::GetStringUTF16(IDS_NETWORK_UI_DEVICES));
+
+ localized_strings->SetString(
+ "cellularActivationLabel",
+ l10n_util::GetStringUTF16(IDS_NETWORK_UI_NO_CELLULAR_ACTIVATION_LABEL));
+ localized_strings->SetString(
+ "cellularActivationButtonText",
+ l10n_util::GetStringUTF16(
+ IDS_NETWORK_UI_OPEN_CELLULAR_ACTIVATION_BUTTON_TEXT));
+ localized_strings->SetString(
+ "noCellularErrorText",
+ l10n_util::GetStringUTF16(IDS_NETWORK_UI_NO_CELLULAR_ERROR_TEXT));
}
NetworkUI::NetworkUI(content::WebUI* web_ui)
diff --git a/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc
index a40bd56e9ba..a5e4b5daf33 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc
@@ -12,7 +12,9 @@
#include "base/bind_helpers.h"
#include "base/build_time.h"
#include "base/macros.h"
+#include "base/scoped_observer.h"
#include "base/values.h"
+#include "chrome/browser/chromeos/set_time_dialog.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/system/timezone_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -20,8 +22,8 @@
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/dbus/system_clock/system_clock_client.h"
-#include "chromeos/login/login_state/login_state.h"
#include "chromeos/settings/timezone_settings.h"
+#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
@@ -35,19 +37,16 @@ class SetTimeMessageHandler : public content::WebUIMessageHandler,
public chromeos::SystemClockClient::Observer,
public system::TimezoneSettings::Observer {
public:
- SetTimeMessageHandler() {
- system::TimezoneSettings::GetInstance()->AddObserver(this);
- SystemClockClient::Get()->AddObserver(this);
- }
-
- ~SetTimeMessageHandler() override {
- system::TimezoneSettings::GetInstance()->RemoveObserver(this);
- SystemClockClient::Get()->RemoveObserver(this);
- }
+ SetTimeMessageHandler() = default;
+ ~SetTimeMessageHandler() override = default;
// WebUIMessageHandler:
void RegisterMessages() override {
web_ui()->RegisterMessageCallback(
+ "setTimePageReady",
+ base::BindRepeating(&SetTimeMessageHandler::OnPageReady,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
"setTimeInSeconds",
base::BindRepeating(&SetTimeMessageHandler::OnSetTime,
base::Unretained(this)));
@@ -57,10 +56,22 @@ class SetTimeMessageHandler : public content::WebUIMessageHandler,
base::Unretained(this)));
}
+ void OnJavascriptAllowed() override {
+ clock_observer_.Add(SystemClockClient::Get());
+ timezone_observer_.Add(system::TimezoneSettings::GetInstance());
+ }
+
+ void OnJavascriptDisallowed() override {
+ clock_observer_.RemoveAll();
+ timezone_observer_.RemoveAll();
+ }
+
private:
+ void OnPageReady(const base::ListValue* args) { AllowJavascript(); }
+
// SystemClockClient::Observer:
void SystemClockUpdated() override {
- web_ui()->CallJavascriptFunctionUnsafe("settime.TimeSetter.updateTime");
+ FireWebUIListener("system-clock-updated");
}
// UI actually shows real device timezone, but only allows changing the user
@@ -70,8 +81,7 @@ class SetTimeMessageHandler : public content::WebUIMessageHandler,
// system::TimezoneSettings::Observer:
void TimezoneChanged(const icu::TimeZone& timezone) override {
base::Value timezone_id(system::TimezoneSettings::GetTimezoneID(timezone));
- web_ui()->CallJavascriptFunctionUnsafe("settime.TimeSetter.setTimezone",
- timezone_id);
+ FireWebUIListener("system-timezone-changed", timezone_id);
}
// Handler for Javascript call to set the system clock when the user sets a
@@ -102,6 +112,11 @@ class SetTimeMessageHandler : public content::WebUIMessageHandler,
system::SetTimezoneFromUI(profile, timezone_id);
}
+ ScopedObserver<SystemClockClient, SystemClockClient::Observer>
+ clock_observer_{this};
+ ScopedObserver<system::TimezoneSettings, system::TimezoneSettings::Observer>
+ timezone_observer_{this};
+
DISALLOW_COPY_AND_ASSIGN(SetTimeMessageHandler);
};
@@ -116,19 +131,19 @@ SetTimeUI::SetTimeUI(content::WebUI* web_ui) : WebDialogUI(web_ui) {
source->AddLocalizedString("setTimeTitle", IDS_SET_TIME_TITLE);
source->AddLocalizedString("prompt", IDS_SET_TIME_PROMPT);
- source->AddLocalizedString("doneButton", IDS_SET_TIME_BUTTON_CLOSE);
- source->AddLocalizedString("timezone",
- IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION);
+ source->AddLocalizedString("timezoneLabel", IDS_SET_TIME_TIMEZONE_LABEL);
source->AddLocalizedString("dateLabel", IDS_SET_TIME_DATE_LABEL);
source->AddLocalizedString("timeLabel", IDS_SET_TIME_TIME_LABEL);
+ source->AddLocalizedString("doneButton", IDS_DONE);
base::DictionaryValue values;
+ // List of list of strings: [[ID, name], [ID, name], ...]
values.Set("timezoneList", chromeos::system::GetTimezoneList());
// If we are not logged in, we need to show the time zone dropdown.
// Otherwise, we can leave |currentTimezoneId| blank.
std::string current_timezone_id;
- if (!LoginState::Get()->IsUserLoggedIn())
+ if (SetTimeDialog::ShouldShowTimezone())
CrosSettings::Get()->GetString(kSystemTimezone, &current_timezone_id);
values.SetString("currentTimezoneId", current_timezone_id);
values.SetDouble("buildTime", base::GetBuildTime().ToJsTime());
@@ -136,14 +151,17 @@ SetTimeUI::SetTimeUI(content::WebUI* web_ui) : WebDialogUI(web_ui) {
source->AddLocalizedStrings(values);
source->SetJsonPath("strings.js");
- source->AddResourcePath("set_time.css", IDR_SET_TIME_CSS);
- source->AddResourcePath("set_time.js", IDR_SET_TIME_JS);
- source->SetDefaultResource(IDR_SET_TIME_HTML);
+ source->UseGzip();
+ source->AddResourcePath("set_time_browser_proxy.html",
+ IDR_SET_TIME_BROWSER_PROXY_HTML);
+ source->AddResourcePath("set_time_browser_proxy.js",
+ IDR_SET_TIME_BROWSER_PROXY_JS);
+ source->AddResourcePath("set_time_dialog.js", IDR_SET_TIME_DIALOG_JS);
+ source->SetDefaultResource(IDR_SET_TIME_DIALOG_HTML);
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
}
-SetTimeUI::~SetTimeUI() {
-}
+SetTimeUI::~SetTimeUI() = default;
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/set_time_ui_browsertest.js b/chromium/chrome/browser/ui/webui/chromeos/set_time_ui_browsertest.js
deleted file mode 100644
index 1249c87450f..00000000000
--- a/chromium/chrome/browser/ui/webui/chromeos/set_time_ui_browsertest.js
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-GEN('#if defined(OS_CHROMEOS)');
-
-/**
- * SetTimeWebUITest tests loading and interacting with the SetTimeUI web UI,
- * which is normally shown as a dialog.
- * @constructor
- * @extends {testing.Test}
- */
-function SetTimeWebUITest() {}
-
-SetTimeWebUITest.prototype = {
- __proto__: testing.Test.prototype,
-
- /**
- * Browse to set time dialog.
- * @override
- */
- browsePreload: 'chrome://set-time/',
-};
-
-TEST_F('SetTimeWebUITest', 'testChangeTimezone', function() {
- assertEquals(this.browsePreload, document.location.href);
-
- var TimeSetter = settime.TimeSetter;
-
- // Verify timezone.
- TimeSetter.setTimezone('America/New_York');
- expectEquals('America/New_York', $('timezone-select').value);
- TimeSetter.setTimezone('Europe/Moscow');
- expectEquals('Europe/Moscow', $('timezone-select').value);
-});
-
-GEN('#endif');
diff --git a/chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc
index 2e5b4c353f2..614813d57ed 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/slow_ui.cc
@@ -49,9 +49,10 @@ content::WebUIDataSource* CreateSlowUIHTMLSource() {
source->AddLocalizedString("slowDescription", IDS_SLOW_DESCRIPTION);
source->AddLocalizedString("slowWarning", IDS_SLOW_WARNING);
- source->SetJsonPath("strings.js");
source->AddResourcePath("slow.js", IDR_SLOW_JS);
+ source->AddResourcePath("slow.css", IDR_SLOW_CSS);
source->SetDefaultResource(IDR_SLOW_HTML);
+ source->UseGzip();
return source;
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc
index c85fa6da82c..c7cc5bffd2d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_share_dialog.cc
@@ -19,7 +19,7 @@ namespace chromeos {
namespace smb_dialog {
namespace {
-constexpr int kSmbShareDialogHeight = 522;
+constexpr int kSmbShareDialogHeight = 524;
void AddSmbSharesStrings(content::WebUIDataSource* html_source) {
// Add strings specific to smb_dialog.
diff --git a/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc b/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc
index 1c5c87bf0d9..cb9f0cb2843 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc
@@ -94,6 +94,10 @@ void SystemWebDialogDelegate::GetDialogSize(gfx::Size* size) const {
size->SetSize(kDialogWidth, kDialogHeight);
}
+bool SystemWebDialogDelegate::CanResizeDialog() const {
+ return false;
+}
+
std::string SystemWebDialogDelegate::GetDialogArgs() const {
return std::string();
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h b/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h
index d28c825317d..2d9cc364a82 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h
@@ -49,6 +49,7 @@ class SystemWebDialogDelegate : public ui::WebDialogDelegate {
void GetWebUIMessageHandlers(
std::vector<content::WebUIMessageHandler*>* handlers) const override;
void GetDialogSize(gfx::Size* size) const override;
+ bool CanResizeDialog() const override;
std::string GetDialogArgs() const override;
void OnDialogShown(content::WebUI* webui,
content::RenderViewHost* render_view_host) override;
@@ -72,6 +73,9 @@ class SystemWebDialogDelegate : public ui::WebDialogDelegate {
protected:
FRIEND_TEST_ALL_PREFIXES(SystemWebDialogLoginTest, NonModalTest);
+
+ // Returns the dialog window (pointer to |aura::Window|). This will be a
+ // |nullptr| if the dialog has not been created yet.
gfx::NativeWindow dialog_window() const { return dialog_window_; }
private:
@@ -79,7 +83,7 @@ class SystemWebDialogDelegate : public ui::WebDialogDelegate {
base::string16 title_;
content::WebUI* webui_ = nullptr;
ui::ModalType modal_type_;
- gfx::NativeWindow dialog_window_;
+ gfx::NativeWindow dialog_window_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(SystemWebDialogDelegate);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/video_source.cc b/chromium/chrome/browser/ui/webui/chromeos/video_source.cc
index c269329efd6..c42955ad542 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/video_source.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/video_source.cc
@@ -14,7 +14,7 @@
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/task/post_task.h"
-#include "base/task/task_scheduler/task_scheduler.h"
+#include "base/task/thread_pool/thread_pool.h"
#include "base/task_runner_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/common/url_constants.h"
diff --git a/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc b/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
new file mode 100644
index 00000000000..e75d19e24b7
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
@@ -0,0 +1,511 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h"
+
+#include <string>
+#include <utility>
+
+#include "base/task/post_task.h"
+#include "base/win/windows_version.h"
+#include "chrome/browser/conflicts/module_database_win.h"
+#include "content/public/browser/browser_task_traits.h"
+#include "content/public/browser/browser_thread.h"
+
+#if defined(GOOGLE_CHROME_BUILD)
+#include "base/enterprise_util.h"
+#include "base/win/win_util.h"
+#include "chrome/browser/conflicts/incompatible_applications_updater_win.h"
+#include "chrome/browser/conflicts/module_blacklist_cache_updater_win.h"
+#endif
+
+namespace {
+
+// Converts the process_types bit field to a simple string representation where
+// each process type is represented by a letter. E.g. B for browser process.
+// Full process names are not used in order to save horizontal space in the
+// conflicts UI.
+std::string GetProcessTypesString(const ModuleInfoData& module_data) {
+ uint32_t process_types = module_data.process_types;
+
+ if (!process_types)
+ return "None";
+
+ std::string result;
+ if (process_types & ProcessTypeToBit(content::PROCESS_TYPE_BROWSER))
+ result.append("B");
+ if (process_types & ProcessTypeToBit(content::PROCESS_TYPE_RENDERER))
+ result.append("R");
+ // TODO(pmonette): Add additional process types as more get supported.
+
+ return result;
+}
+
+#if defined(GOOGLE_CHROME_BUILD)
+
+// Strings used twice.
+constexpr char kNotLoaded[] = "Not loaded";
+constexpr char kAllowedInProcessType[] = "Allowed - Loaded in allowed process";
+constexpr char kAllowedInputMethodEditor[] = "Allowed - Input method editor";
+constexpr char kAllowedMatchingCertificate[] = "Allowed - Matching certificate";
+constexpr char kAllowedMicrosoftModule[] = "Allowed - Microsoft module";
+constexpr char kAllowedWhitelisted[] = "Allowed - Whitelisted";
+constexpr char kNotAnalyzed[] =
+ "Tolerated - Not analyzed (See https://crbug.com/892294)";
+constexpr char kAllowedSameDirectory[] =
+#if defined(OFFICIAL_BUILD)
+ // In official builds, modules in the Chrome directory are blocked but they
+ // won't cause a warning because the warning would blame Chrome itself.
+ "Tolerated - In executable directory";
+#else // !defined(OFFICIAL_BUILD)
+ // In developer builds, DLLs that are part of Chrome are not signed and thus
+ // the easy way to identify them is to check that they are in the same
+ // directory (or child folder) as the main exe.
+ "Allowed - In executable directory (dev builds only)";
+#endif
+
+void AppendString(base::StringPiece input, std::string* output) {
+ if (!output->empty())
+ *output += ", ";
+ input.AppendToString(output);
+}
+
+// Returns a string describing the current module blocking status: loaded or
+// not, blocked or not, was in blacklist cache or not, bypassed blocking or not.
+std::string GetBlockingStatusString(
+ const ModuleBlacklistCacheUpdater::ModuleBlockingState& blocking_state) {
+ std::string status;
+
+ // Output status regarding the blacklist cache, current blocking, and
+ // load status.
+ if (blocking_state.was_blocked)
+ status = "Blocked";
+ if (!blocking_state.was_loaded)
+ AppendString(kNotLoaded, &status);
+ else if (blocking_state.was_in_blacklist_cache)
+ AppendString("Bypassed blocking", &status);
+ if (blocking_state.was_in_blacklist_cache)
+ AppendString("In blacklist cache", &status);
+
+ return status;
+}
+
+// Returns a string describing the blocking decision related to a module. This
+// returns the empty string to indicate that the warning decision description
+// should be used instead.
+std::string GetBlockingDecisionString(
+ const ModuleBlacklistCacheUpdater::ModuleBlockingState& blocking_state,
+ IncompatibleApplicationsUpdater* incompatible_applications_updater) {
+ using BlockingDecision = ModuleBlacklistCacheUpdater::ModuleBlockingDecision;
+
+ // Append status regarding the logic that will be applied during the next
+ // startup.
+ switch (blocking_state.blocking_decision) {
+ case BlockingDecision::kUnknown:
+ NOTREACHED();
+ break;
+ case BlockingDecision::kNotLoaded:
+ return kNotLoaded;
+ case BlockingDecision::kAllowedInProcessType:
+ return kAllowedInProcessType;
+ case BlockingDecision::kAllowedIME:
+ return kAllowedInputMethodEditor;
+ case BlockingDecision::kAllowedSameCertificate:
+ return kAllowedMatchingCertificate;
+ case BlockingDecision::kAllowedSameDirectory:
+ return kAllowedSameDirectory;
+ case BlockingDecision::kAllowedMicrosoft:
+ return kAllowedMicrosoftModule;
+ case BlockingDecision::kAllowedWhitelisted:
+ return kAllowedWhitelisted;
+ case BlockingDecision::kNotAnalyzed:
+ return kNotAnalyzed;
+ case BlockingDecision::kTolerated:
+ // This is a module explicitly allowed to load by the Module List
+ // component. But it is still valid for a potential warning, and so the
+ // warning status is used instead.
+ if (incompatible_applications_updater)
+ break;
+ return "Tolerated - Will be blocked in the future";
+ case BlockingDecision::kDisallowedExplicit:
+ return "Disallowed - Explicitly blacklisted";
+ case BlockingDecision::kDisallowedImplicit:
+ return "Disallowed - Implicitly blacklisted";
+ }
+
+ // Returning an empty string indicates that the warning status should be used.
+ return std::string();
+}
+
+// Returns a string describing the warning decision that was made regarding a
+// module.
+std::string GetModuleWarningDecisionString(
+ const ModuleInfoKey& module_key,
+ IncompatibleApplicationsUpdater* incompatible_applications_updater) {
+ using WarningDecision =
+ IncompatibleApplicationsUpdater::ModuleWarningDecision;
+
+ WarningDecision warning_decision =
+ incompatible_applications_updater->GetModuleWarningDecision(module_key);
+
+ switch (warning_decision) {
+ case WarningDecision::kNotLoaded:
+ return kNotLoaded;
+ case WarningDecision::kAllowedInProcessType:
+ return kAllowedInProcessType;
+ case WarningDecision::kAllowedIME:
+ return kAllowedInputMethodEditor;
+ case WarningDecision::kAllowedShellExtension:
+ return "Tolerated - Shell extension";
+ case WarningDecision::kAllowedSameCertificate:
+ return kAllowedMatchingCertificate;
+ case WarningDecision::kAllowedSameDirectory:
+ return kAllowedSameDirectory;
+ case WarningDecision::kAllowedMicrosoft:
+ return kAllowedMicrosoftModule;
+ case WarningDecision::kAllowedWhitelisted:
+ return kAllowedWhitelisted;
+ case WarningDecision::kNotAnalyzed:
+ return kNotAnalyzed;
+ case WarningDecision::kNoTiedApplication:
+ return "Tolerated - Could not tie to an installed application";
+ case WarningDecision::kIncompatible:
+ return "Incompatible";
+ case WarningDecision::kAddedToBlacklist:
+ case WarningDecision::kUnknown:
+ NOTREACHED();
+ break;
+ }
+
+ return std::string();
+}
+
+std::string GetModuleStatusString(
+ const ModuleInfoKey& module_key,
+ IncompatibleApplicationsUpdater* incompatible_applications_updater,
+ ModuleBlacklistCacheUpdater* module_blacklist_cache_updater) {
+ if (!incompatible_applications_updater && !module_blacklist_cache_updater)
+ return std::string();
+
+ std::string status;
+
+ // The blocking status is shown over the warning status.
+ if (module_blacklist_cache_updater) {
+ const ModuleBlacklistCacheUpdater::ModuleBlockingState& blocking_state =
+ module_blacklist_cache_updater->GetModuleBlockingState(module_key);
+
+ status = GetBlockingStatusString(blocking_state);
+
+ std::string blocking_string = GetBlockingDecisionString(
+ blocking_state, incompatible_applications_updater);
+ if (!blocking_string.empty()) {
+ AppendString(blocking_string, &status);
+ return status;
+ }
+
+ // An empty |blocking_string| indicates that a warning decision string
+ // should be used instead.
+ }
+
+ if (incompatible_applications_updater) {
+ AppendString(GetModuleWarningDecisionString(
+ module_key, incompatible_applications_updater),
+ &status);
+ }
+
+ return status;
+}
+#endif // defined(GOOGLE_CHROME_BUILD)
+
+enum ThirdPartyFeaturesStatus {
+ // The third-party features are not available in non-Google Chrome builds.
+ kNonGoogleChromeBuild,
+ // The third-party features are not available on Windows 7.
+ kNotAvailableWin7,
+ // The third-party features are temporarily disabled on domain-joined
+ // machines because of a known issue with third-party blocking and the
+ // IAttachmentExecute::Save() API (https://crbug.com/870998).
+ // TODO(pmonette): Move IAttachmentExecute::Save() to a utility process and
+ // remove this.
+ kEnterpriseManaged,
+ // The ThirdPartyBlockingEnabled group policy is disabled.
+ kPolicyDisabled,
+ // Both the IncompatibleApplicationsWarning and the
+ // ThirdPartyModulesBlocking features are disabled.
+ kFeatureDisabled,
+ // The Module List version received is invalid.
+ kModuleListInvalid,
+ // There is no Module List version available.
+ kNoModuleListAvailable,
+ // Only the IncompatibleApplicationsWarning feature is initialized.
+ kWarningInitialized,
+ // Only the ThirdPartyModulesBlocking feature is initialized.
+ kBlockingInitialized,
+ // Both the IncompatibleApplicationsWarning and the
+ // ThirdPartyModulesBlocking feature are initialized.
+ kWarningAndBlockingInitialized,
+};
+
+#if defined(GOOGLE_CHROME_BUILD)
+ThirdPartyFeaturesStatus GetThirdPartyFeaturesStatus(
+ base::Optional<ThirdPartyConflictsManager::State>
+ third_party_conflicts_manager_state) {
+ // The ThirdPartyConflictsManager instance exists if we have its state.
+ if (third_party_conflicts_manager_state.has_value()) {
+ switch (third_party_conflicts_manager_state.value()) {
+ case ThirdPartyConflictsManager::State::kModuleListInvalidFailure:
+ return kModuleListInvalid;
+ case ThirdPartyConflictsManager::State::kNoModuleListAvailableFailure:
+ return kNoModuleListAvailable;
+ case ThirdPartyConflictsManager::State::kWarningInitialized:
+ return kWarningInitialized;
+ case ThirdPartyConflictsManager::State::kBlockingInitialized:
+ return kBlockingInitialized;
+ case ThirdPartyConflictsManager::State::kWarningAndBlockingInitialized:
+ return kWarningAndBlockingInitialized;
+ case ThirdPartyConflictsManager::State::kDestroyed:
+ // Turning off the feature via group policy is the only way to have the
+ // manager destroyed.
+ return kPolicyDisabled;
+ }
+ }
+
+ // Figure out why the manager instance doesn't exist.
+ if (base::win::GetVersion() <= base::win::VERSION_WIN7)
+ return kNotAvailableWin7;
+
+ if (!ModuleDatabase::IsThirdPartyBlockingPolicyEnabled())
+ return kPolicyDisabled;
+
+ if (!IncompatibleApplicationsUpdater::IsWarningEnabled() &&
+ !ModuleBlacklistCacheUpdater::IsBlockingEnabled()) {
+ return kFeatureDisabled;
+ }
+
+ if (base::IsMachineExternallyManaged())
+ return kEnterpriseManaged;
+
+ // The above 3 cases are the only possible reasons why the manager wouldn't
+ // exist.
+ NOTREACHED();
+ return kFeatureDisabled;
+}
+#endif
+
+bool IsThirdPartyFeatureEnabled(ThirdPartyFeaturesStatus status) {
+ return status == kWarningInitialized || status == kBlockingInitialized ||
+ status == kWarningAndBlockingInitialized;
+}
+
+std::string GetThirdPartyFeaturesStatusString(ThirdPartyFeaturesStatus status) {
+ switch (status) {
+ case ThirdPartyFeaturesStatus::kNonGoogleChromeBuild:
+ return "The third-party features are not available in non-Google Chrome "
+ "builds.";
+ case ThirdPartyFeaturesStatus::kNotAvailableWin7:
+ return "The third-party features are not available on Windows 7.";
+ case ThirdPartyFeaturesStatus::kEnterpriseManaged:
+ return "The third-party features are temporarily disabled for clients on "
+ "domain-joined machines.";
+ case ThirdPartyFeaturesStatus::kPolicyDisabled:
+ return "The ThirdPartyBlockingEnabled group policy is disabled.";
+ case ThirdPartyFeaturesStatus::kFeatureDisabled:
+ if (base::win::GetVersion() < base::win::VERSION_WIN10)
+ return "The ThirdPartyModulesBlocking feature is disabled.";
+
+ return "Both the IncompatibleApplicationsWarning and "
+ "ThirdPartyModulesBlocking features are disabled.";
+ case ThirdPartyFeaturesStatus::kModuleListInvalid:
+ return "Disabled - The Module List component version is invalid.";
+ case ThirdPartyFeaturesStatus::kNoModuleListAvailable:
+ return "Disabled - There is no Module List version available.";
+ case ThirdPartyFeaturesStatus::kWarningInitialized:
+ DCHECK_GE(base::win::GetVersion(), base::win::VERSION_WIN10);
+ return "The IncompatibleApplicationsWarning feature is enabled, while "
+ "the ThirdPartyModulesBlocking feature is disabled.";
+ case ThirdPartyFeaturesStatus::kBlockingInitialized:
+ if (base::win::GetVersion() < base::win::VERSION_WIN10)
+ return "The ThirdPartyModulesBlocking feature is enabled.";
+
+ return "The ThirdPartyModulesBlocking feature is enabled, while the "
+ "IncompatibleApplicationsWarning feature is disabled.";
+ case ThirdPartyFeaturesStatus::kWarningAndBlockingInitialized:
+ DCHECK_GE(base::win::GetVersion(), base::win::VERSION_WIN10);
+ return "Both the IncompatibleApplicationsWarning and "
+ "ThirdPartyModulesBlocking features are enabled";
+ }
+}
+
+void OnConflictsDataFetched(
+ ConflictsDataFetcher::OnConflictsDataFetchedCallback
+ on_conflicts_data_fetched_callback,
+ base::DictionaryValue results,
+ ThirdPartyFeaturesStatus third_party_features_status) {
+ // Third-party conflicts status.
+ results.SetBoolean("thirdPartyFeatureEnabled",
+ IsThirdPartyFeatureEnabled(third_party_features_status));
+ results.SetString(
+ "thirdPartyFeatureStatus",
+ GetThirdPartyFeaturesStatusString(third_party_features_status));
+
+ std::move(on_conflicts_data_fetched_callback).Run(std::move(results));
+}
+
+#if defined(GOOGLE_CHROME_BUILD)
+void OnModuleDataFetched(ConflictsDataFetcher::OnConflictsDataFetchedCallback
+ on_conflicts_data_fetched_callback,
+ base::DictionaryValue results,
+ base::Optional<ThirdPartyConflictsManager::State>
+ third_party_conflicts_manager_state) {
+ OnConflictsDataFetched(
+ std::move(on_conflicts_data_fetched_callback), std::move(results),
+ GetThirdPartyFeaturesStatus(third_party_conflicts_manager_state));
+}
+#endif // defined(GOOGLE_CHROME_BUILD)
+
+} // namespace
+
+ConflictsDataFetcher::~ConflictsDataFetcher() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
+ if (module_list_)
+ ModuleDatabase::GetInstance()->RemoveObserver(this);
+}
+
+// static
+ConflictsDataFetcher::UniquePtr ConflictsDataFetcher::Create(
+ OnConflictsDataFetchedCallback on_conflicts_data_fetched_callback) {
+ return std::unique_ptr<ConflictsDataFetcher, base::OnTaskRunnerDeleter>(
+ new ConflictsDataFetcher(std::move(on_conflicts_data_fetched_callback)),
+ base::OnTaskRunnerDeleter(ModuleDatabase::GetTaskRunner()));
+}
+
+ConflictsDataFetcher::ConflictsDataFetcher(
+ OnConflictsDataFetchedCallback on_conflicts_data_fetched_callback)
+ : on_conflicts_data_fetched_callback_(
+ std::move(on_conflicts_data_fetched_callback))
+#if defined(GOOGLE_CHROME_BUILD)
+ ,
+ weak_ptr_factory_(this)
+#endif
+{
+ DETACH_FROM_SEQUENCE(sequence_checker_);
+
+ ModuleDatabase::GetTaskRunner()->PostTask(
+ FROM_HERE,
+ base::BindOnce(
+ &ConflictsDataFetcher::InitializeOnModuleDatabaseTaskRunner,
+ base::Unretained(this)));
+}
+
+void ConflictsDataFetcher::InitializeOnModuleDatabaseTaskRunner() {
+#if defined(GOOGLE_CHROME_BUILD)
+ // If the ThirdPartyConflictsManager instance exists, wait until it is fully
+ // initialized before retrieving the list of modules.
+ auto* third_party_conflicts_manager =
+ ModuleDatabase::GetInstance()->third_party_conflicts_manager();
+ if (third_party_conflicts_manager) {
+ third_party_conflicts_manager->ForceInitialization(base::BindRepeating(
+ &ConflictsDataFetcher::OnManagerInitializationComplete,
+ weak_ptr_factory_.GetWeakPtr()));
+ return;
+ }
+#endif
+
+ GetListOfModules();
+}
+
+#if defined(GOOGLE_CHROME_BUILD)
+void ConflictsDataFetcher::OnManagerInitializationComplete(
+ ThirdPartyConflictsManager::State state) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
+ third_party_conflicts_manager_state_ = state;
+
+ GetListOfModules();
+}
+#endif // defined(GOOGLE_CHROME_BUILD)
+
+void ConflictsDataFetcher::GetListOfModules() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
+ // The request is handled asynchronously, filling up the |module_list_|,
+ // and will callback via OnModuleDatabaseIdle() on completion.
+ module_list_ = std::make_unique<base::ListValue>();
+
+ auto* module_database = ModuleDatabase::GetInstance();
+ module_database->IncreaseInspectionPriority();
+ module_database->AddObserver(this);
+}
+
+void ConflictsDataFetcher::OnNewModuleFound(const ModuleInfoKey& module_key,
+ const ModuleInfoData& module_data) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(module_list_);
+
+ auto data = std::make_unique<base::DictionaryValue>();
+
+ data->SetString("third_party_module_status", std::string());
+#if defined(GOOGLE_CHROME_BUILD)
+ if (ModuleDatabase::GetInstance()->third_party_conflicts_manager()) {
+ auto* incompatible_applications_updater =
+ ModuleDatabase::GetInstance()
+ ->third_party_conflicts_manager()
+ ->incompatible_applications_updater();
+ auto* module_blacklist_cache_updater =
+ ModuleDatabase::GetInstance()
+ ->third_party_conflicts_manager()
+ ->module_blacklist_cache_updater();
+
+ data->SetString(
+ "third_party_module_status",
+ GetModuleStatusString(module_key, incompatible_applications_updater,
+ module_blacklist_cache_updater));
+ }
+#endif // defined(GOOGLE_CHROME_BUILD)
+
+ std::string type_string;
+ if (module_data.module_properties & ModuleInfoData::kPropertyShellExtension)
+ type_string = "Shell extension";
+ data->SetString("type_description", type_string);
+
+ const auto& inspection_result = *module_data.inspection_result;
+ data->SetString("location", inspection_result.location);
+ data->SetString("name", inspection_result.basename);
+ data->SetString("product_name", inspection_result.product_name);
+ data->SetString("description", inspection_result.description);
+ data->SetString("version", inspection_result.version);
+ data->SetString("digital_signer", inspection_result.certificate_info.subject);
+ data->SetString("code_id", GenerateCodeId(module_key));
+ data->SetString("process_types", GetProcessTypesString(module_data));
+
+ module_list_->Append(std::move(data));
+}
+
+void ConflictsDataFetcher::OnModuleDatabaseIdle() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(module_list_);
+
+ ModuleDatabase::GetInstance()->RemoveObserver(this);
+
+ base::DictionaryValue results;
+ results.SetInteger("moduleCount", module_list_->GetSize());
+ results.Set("moduleList", std::move(module_list_));
+
+#if defined(GOOGLE_CHROME_BUILD)
+ // The state of third-party features must be determined on the UI thread.
+ base::PostTaskWithTraits(
+ FROM_HERE, {content::BrowserThread::UI},
+ base::BindOnce(
+ OnModuleDataFetched, std::move(on_conflicts_data_fetched_callback_),
+ std::move(results), std::move(third_party_conflicts_manager_state_)));
+#else
+ // The third-party features are always disabled on Chromium builds.
+ base::PostTaskWithTraits(
+ FROM_HERE, {content::BrowserThread::UI},
+ base::BindOnce(OnConflictsDataFetched,
+ std::move(on_conflicts_data_fetched_callback_),
+ std::move(results), kNonGoogleChromeBuild));
+#endif
+}
diff --git a/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h b/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h
new file mode 100644
index 00000000000..e1d0533b403
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h
@@ -0,0 +1,84 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CONFLICTS_CONFLICTS_DATA_FETCHER_H_
+#define CHROME_BROWSER_UI_WEBUI_CONFLICTS_CONFLICTS_DATA_FETCHER_H_
+
+#include <memory>
+
+#include "base/callback.h"
+#include "base/optional.h"
+#include "base/sequence_checker.h"
+#include "base/sequenced_task_runner.h"
+#include "build/build_config.h"
+#include "chrome/browser/conflicts/module_database_observer_win.h"
+
+#if defined(GOOGLE_CHROME_BUILD)
+#include "chrome/browser/conflicts/third_party_conflicts_manager_win.h"
+#endif
+
+namespace base {
+class DictionaryValue;
+class ListValue;
+} // namespace base
+
+// This class is responsible for gathering the list of modules for the
+// chrome://conflicts page and the state of the third-party features on the
+// ModuleDatabase task runner and sending it back to the UI thread. The instance
+// should be deleted once the OnConflictsDataFetchedCallback is invoked.
+class ConflictsDataFetcher : public ModuleDatabaseObserver {
+ public:
+ using UniquePtr =
+ std::unique_ptr<ConflictsDataFetcher, base::OnTaskRunnerDeleter>;
+ using OnConflictsDataFetchedCallback =
+ base::OnceCallback<void(base::DictionaryValue results)>;
+
+ ~ConflictsDataFetcher() override;
+
+ // Creates the instance and initializes it on the ModuleDatabase task runner.
+ // |on_conflicts_data_fetched_callback| will be invoked on the caller's
+ // sequence.
+ static UniquePtr Create(
+ OnConflictsDataFetchedCallback on_conflicts_data_fetched_callback);
+
+ private:
+ explicit ConflictsDataFetcher(
+ OnConflictsDataFetchedCallback on_conflicts_data_fetched_callback);
+
+ void InitializeOnModuleDatabaseTaskRunner();
+
+#if defined(GOOGLE_CHROME_BUILD)
+ // Invoked when the ThirdPartyConflictsManager initialization state is
+ // available.
+ void OnManagerInitializationComplete(ThirdPartyConflictsManager::State state);
+#endif
+
+ // Registers this instance to the ModuleDatabase to retrieve the list of
+ // modules via the ModuleDatabaseObserver API.
+ void GetListOfModules();
+
+ // ModuleDatabaseObserver:
+ void OnNewModuleFound(const ModuleInfoKey& module_key,
+ const ModuleInfoData& module_data) override;
+ void OnModuleDatabaseIdle() override;
+
+ OnConflictsDataFetchedCallback on_conflicts_data_fetched_callback_;
+
+ // Temporarily holds the module list while the modules are being
+ // enumerated.
+ std::unique_ptr<base::ListValue> module_list_;
+
+ SEQUENCE_CHECKER(sequence_checker_);
+
+#if defined(GOOGLE_CHROME_BUILD)
+ base::Optional<ThirdPartyConflictsManager::State>
+ third_party_conflicts_manager_state_;
+
+ base::WeakPtrFactory<ConflictsDataFetcher> weak_ptr_factory_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(ConflictsDataFetcher);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_CONFLICTS_CONFLICTS_DATA_FETCHER_H_
diff --git a/chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.cc b/chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.cc
index f0ed130bea4..55b5fc5ef3e 100644
--- a/chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.cc
+++ b/chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.cc
@@ -7,404 +7,46 @@
#include <utility>
#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/feature_list.h"
-#include "base/strings/string16.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_piece.h"
#include "base/values.h"
-#include "base/win/windows_version.h"
-#include "chrome/browser/conflicts/module_database_win.h"
-#include "chrome/browser/conflicts/module_info_win.h"
-#include "chrome/common/chrome_features.h"
#include "chrome/grit/generated_resources.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_ui.h"
-#include "ui/base/l10n/l10n_util.h"
-#if defined(GOOGLE_CHROME_BUILD)
-#include "base/enterprise_util.h"
-#include "base/win/win_util.h"
-#include "chrome/browser/conflicts/incompatible_applications_updater_win.h"
-#include "chrome/browser/conflicts/module_blacklist_cache_updater_win.h"
-#endif
+ConflictsHandler::ConflictsHandler()
+ : conflicts_data_fetcher_(nullptr, base::OnTaskRunnerDeleter(nullptr)),
+ weak_ptr_factory_(this) {}
-namespace {
-
-#if defined(GOOGLE_CHROME_BUILD)
-
-// Strings used twice.
-constexpr char kNotLoaded[] = "Not loaded";
-constexpr char kAllowedInputMethodEditor[] = "Allowed - Input method editor";
-constexpr char kAllowedMatchingCertificate[] = "Allowed - Matching certificate";
-constexpr char kAllowedMicrosoftModule[] = "Allowed - Microsoft module";
-constexpr char kAllowedWhitelisted[] = "Allowed - Whitelisted";
-constexpr char kNotAnalyzed[] =
- "Tolerated - Not analyzed (See https://crbug.com/892294)";
-constexpr char kAllowedSameDirectory[] =
-#if defined(OFFICIAL_BUILD)
- // In official builds, modules in the Chrome directory are blocked but they
- // won't cause a warning because the warning would blame Chrome itself.
- "Tolerated - In executable directory";
-#else // !defined(OFFICIAL_BUILD)
- // In developer builds, DLLs that are part of Chrome are not signed and thus
- // the easy way to identify them is to check that they are in the same
- // directory (or child folder) as the main exe.
- "Allowed - In executable directory (dev builds only)";
-#endif
-
-void AppendString(base::StringPiece input, std::string* output) {
- if (!output->empty())
- *output += ", ";
- input.AppendToString(output);
-}
-
-// Returns a string describing the current module blocking status: loaded or
-// not, blocked or not, was in blacklist cache or not, bypassed blocking or not.
-std::string GetBlockingStatusString(
- const ModuleBlacklistCacheUpdater::ModuleBlockingState& blocking_state) {
- std::string status;
-
- // Output status regarding the blacklist cache, current blocking, and
- // load status.
- if (blocking_state.was_blocked)
- status = "Blocked";
- if (!blocking_state.was_loaded)
- AppendString(kNotLoaded, &status);
- else if (blocking_state.was_in_blacklist_cache)
- AppendString("Bypassed blocking", &status);
- if (blocking_state.was_in_blacklist_cache)
- AppendString("In blacklist cache", &status);
-
- return status;
-}
-
-// Returns a string describing the blocking decision related to a module. This
-// returns the empty string to indicate that the warning decision description
-// should be used instead.
-std::string GetBlockingDecisionString(
- const ModuleBlacklistCacheUpdater::ModuleBlockingState& blocking_state,
- IncompatibleApplicationsUpdater* incompatible_applications_updater) {
- using BlockingDecision = ModuleBlacklistCacheUpdater::ModuleBlockingDecision;
-
- // Append status regarding the logic that will be applied during the next
- // startup.
- switch (blocking_state.blocking_decision) {
- case BlockingDecision::kUnknown:
- NOTREACHED();
- break;
- case BlockingDecision::kAllowedIME:
- return kAllowedInputMethodEditor;
- case BlockingDecision::kAllowedSameCertificate:
- return kAllowedMatchingCertificate;
- case BlockingDecision::kAllowedSameDirectory:
- return kAllowedSameDirectory;
- case BlockingDecision::kAllowedMicrosoft:
- return kAllowedMicrosoftModule;
- case BlockingDecision::kAllowedWhitelisted:
- return kAllowedWhitelisted;
- case BlockingDecision::kNotAnalyzed:
- return kNotAnalyzed;
- case BlockingDecision::kTolerated:
- // This is a module explicitly allowed to load by the Module List
- // component. But it is still valid for a potential warning, and so the
- // warning status is used instead.
- if (incompatible_applications_updater)
- break;
- return "Tolerated - Will be blocked in the future";
- case BlockingDecision::kDisallowedExplicit:
- return "Disallowed - Explicitly blacklisted";
- case BlockingDecision::kDisallowedImplicit:
- return "Disallowed - Implicitly blacklisted";
- }
-
- // Returning an empty string indicates that the warning status should be used.
- return std::string();
-}
-
-// Returns a string describing the warning decision that was made regarding a
-// module.
-std::string GetModuleWarningDecisionString(
- const ModuleInfoKey& module_key,
- IncompatibleApplicationsUpdater* incompatible_applications_updater) {
- using WarningDecision =
- IncompatibleApplicationsUpdater::ModuleWarningDecision;
-
- WarningDecision warning_decision =
- incompatible_applications_updater->GetModuleWarningDecision(module_key);
-
- switch (warning_decision) {
- case WarningDecision::kNotLoaded:
- return kNotLoaded;
- case WarningDecision::kAllowedIME:
- return kAllowedInputMethodEditor;
- case WarningDecision::kAllowedShellExtension:
- return "Tolerated - Shell extension";
- case WarningDecision::kAllowedSameCertificate:
- return kAllowedMatchingCertificate;
- case WarningDecision::kAllowedSameDirectory:
- return kAllowedSameDirectory;
- case WarningDecision::kAllowedMicrosoft:
- return kAllowedMicrosoftModule;
- case WarningDecision::kAllowedWhitelisted:
- return kAllowedWhitelisted;
- case WarningDecision::kNotAnalyzed:
- return kNotAnalyzed;
- case WarningDecision::kNoTiedApplication:
- return "Tolerated - Could not tie to an installed application";
- case WarningDecision::kIncompatible:
- return "Incompatible";
- case WarningDecision::kAddedToBlacklist:
- case WarningDecision::kUnknown:
- NOTREACHED();
- break;
- }
-
- return std::string();
-}
-
-std::string GetModuleStatusString(
- const ModuleInfoKey& module_key,
- IncompatibleApplicationsUpdater* incompatible_applications_updater,
- ModuleBlacklistCacheUpdater* module_blacklist_cache_updater) {
- if (!incompatible_applications_updater && !module_blacklist_cache_updater)
- return std::string();
-
- std::string status;
-
- // The blocking status is shown over the warning status.
- if (module_blacklist_cache_updater) {
- const ModuleBlacklistCacheUpdater::ModuleBlockingState& blocking_state =
- module_blacklist_cache_updater->GetModuleBlockingState(module_key);
-
- status = GetBlockingStatusString(blocking_state);
-
- std::string blocking_string = GetBlockingDecisionString(
- blocking_state, incompatible_applications_updater);
- if (!blocking_string.empty()) {
- AppendString(blocking_string, &status);
- return status;
- }
-
- // An empty |blocking_string| indicates that a warning decision string
- // should be used instead.
- }
-
- if (incompatible_applications_updater) {
- AppendString(GetModuleWarningDecisionString(
- module_key, incompatible_applications_updater),
- &status);
- }
-
- return status;
-}
-#endif // defined(GOOGLE_CHROME_BUILD)
-
-} // namespace
-
-ConflictsHandler::ConflictsHandler() : weak_ptr_factory_(this) {}
-
-ConflictsHandler::~ConflictsHandler() {
- if (module_list_)
- ModuleDatabase::GetInstance()->RemoveObserver(this);
-}
+ConflictsHandler::~ConflictsHandler() = default;
void ConflictsHandler::RegisterMessages() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
web_ui()->RegisterMessageCallback(
"requestModuleList",
base::BindRepeating(&ConflictsHandler::HandleRequestModuleList,
base::Unretained(this)));
}
-void ConflictsHandler::OnNewModuleFound(const ModuleInfoKey& module_key,
- const ModuleInfoData& module_data) {
- DCHECK(module_list_);
-
- auto data = std::make_unique<base::DictionaryValue>();
-
- data->SetString("third_party_module_status", std::string());
-#if defined(GOOGLE_CHROME_BUILD)
- if (ModuleDatabase::GetInstance()->third_party_conflicts_manager()) {
- auto* incompatible_applications_updater =
- ModuleDatabase::GetInstance()
- ->third_party_conflicts_manager()
- ->incompatible_applications_updater();
- auto* module_blacklist_cache_updater =
- ModuleDatabase::GetInstance()
- ->third_party_conflicts_manager()
- ->module_blacklist_cache_updater();
-
- data->SetString(
- "third_party_module_status",
- GetModuleStatusString(module_key, incompatible_applications_updater,
- module_blacklist_cache_updater));
- }
-#endif // defined(GOOGLE_CHROME_BUILD)
-
- std::string type_string;
- if (module_data.module_properties & ModuleInfoData::kPropertyShellExtension)
- type_string = "Shell extension";
- data->SetString("type_description", type_string);
-
- const auto& inspection_result = *module_data.inspection_result;
- data->SetString("location", inspection_result.location);
- data->SetString("name", inspection_result.basename);
- data->SetString("product_name", inspection_result.product_name);
- data->SetString("description", inspection_result.description);
- data->SetString("version", inspection_result.version);
- data->SetString("digital_signer", inspection_result.certificate_info.subject);
- data->SetString("code_id", GenerateCodeId(module_key));
-
- module_list_->Append(std::move(data));
-}
-
-void ConflictsHandler::OnModuleDatabaseIdle() {
- DCHECK(module_list_);
- DCHECK(!module_list_callback_id_.empty());
-
- ModuleDatabase::GetInstance()->RemoveObserver(this);
-
- base::DictionaryValue results;
- results.SetInteger("moduleCount", module_list_->GetSize());
- results.Set("moduleList", std::move(module_list_));
-
- // Third-party conflicts status.
- ThirdPartyFeaturesStatus third_party_features_status =
- third_party_features_status_.value();
- results.SetBoolean("thirdPartyFeatureEnabled",
- IsThirdPartyFeatureEnabled(third_party_features_status));
- results.SetString(
- "thirdPartyFeatureStatus",
- GetThirdPartyFeaturesStatusString(third_party_features_status));
-
- AllowJavascript();
- ResolveJavascriptCallback(base::Value(module_list_callback_id_), results);
-}
-
void ConflictsHandler::HandleRequestModuleList(const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
// Make sure the JS doesn't call 'requestModuleList' more than once.
// TODO(739291): It would be better to kill the renderer instead of the
// browser for malformed messages.
- CHECK(!module_list_);
-
CHECK_EQ(1U, args->GetSize());
CHECK(args->GetString(0, &module_list_callback_id_));
-#if defined(GOOGLE_CHROME_BUILD)
- // If the ThirdPartyConflictsManager instance exists, wait until it is fully
- // initialized before retrieving the list of modules.
- auto* third_party_conflicts_manager =
- ModuleDatabase::GetInstance()->third_party_conflicts_manager();
- if (third_party_conflicts_manager) {
- third_party_conflicts_manager->ForceInitialization(
- base::BindRepeating(&ConflictsHandler::OnManagerInitializationComplete,
- weak_ptr_factory_.GetWeakPtr()));
- return;
- }
-
- // Figure out why the manager instance doesn't exist.
- if (!ModuleDatabase::IsThirdPartyBlockingPolicyEnabled())
- third_party_features_status_ = kPolicyDisabled;
-
- if (!base::FeatureList::IsEnabled(features::kThirdPartyModulesBlocking) &&
- !IncompatibleApplicationsUpdater::IsWarningEnabled()) {
- third_party_features_status_ = kFeatureDisabled;
- }
-
- if (base::IsMachineExternallyManaged())
- third_party_features_status_ = kEnterpriseManaged;
-
- // The above 3 cases are the only possible reasons why the manager wouldn't
- // exist.
- DCHECK(third_party_features_status_.has_value());
-#else // defined(GOOGLE_CHROME_BUILD)
- third_party_features_status_ = kNonGoogleChromeBuild;
-#endif
-
- GetListOfModules();
-}
-
-#if defined(GOOGLE_CHROME_BUILD)
-void ConflictsHandler::OnManagerInitializationComplete(
- ThirdPartyConflictsManager::State state) {
- switch (state) {
- case ThirdPartyConflictsManager::State::kModuleListInvalidFailure:
- third_party_features_status_ = kModuleListInvalid;
- break;
- case ThirdPartyConflictsManager::State::kNoModuleListAvailableFailure:
- third_party_features_status_ = kNoModuleListAvailable;
- break;
- case ThirdPartyConflictsManager::State::kWarningInitialized:
- third_party_features_status_ = kWarningInitialized;
- break;
- case ThirdPartyConflictsManager::State::kBlockingInitialized:
- third_party_features_status_ = kBlockingInitialized;
- break;
- case ThirdPartyConflictsManager::State::kWarningAndBlockingInitialized:
- third_party_features_status_ = kWarningAndBlockingInitialized;
- break;
- case ThirdPartyConflictsManager::State::kDestroyed:
- // Turning off the feature via group policy is the only way to have the
- // manager destroyed.
- third_party_features_status_ = kPolicyDisabled;
- break;
- }
-
- GetListOfModules();
+ conflicts_data_fetcher_ = ConflictsDataFetcher::Create(
+ base::BindOnce(&ConflictsHandler::OnConflictsDataFetched,
+ weak_ptr_factory_.GetWeakPtr()));
}
-#endif // defined(GOOGLE_CHROME_BUILD)
-void ConflictsHandler::GetListOfModules() {
- // The request is handled asynchronously, filling up the |module_list_|,
- // and will callback via OnModuleDatabaseIdle() on completion.
- module_list_ = std::make_unique<base::ListValue>();
-
- auto* module_database = ModuleDatabase::GetInstance();
- module_database->IncreaseInspectionPriority();
- module_database->AddObserver(this);
-}
-
-// static
-bool ConflictsHandler::IsThirdPartyFeatureEnabled(
- ThirdPartyFeaturesStatus status) {
- return status == kWarningInitialized || status == kBlockingInitialized ||
- status == kWarningAndBlockingInitialized;
-}
-
-// static
-std::string ConflictsHandler::GetThirdPartyFeaturesStatusString(
- ThirdPartyFeaturesStatus status) {
- switch (status) {
- case ThirdPartyFeaturesStatus::kNonGoogleChromeBuild:
- return "The third-party features are not available in non-Google Chrome "
- "builds.";
- case ThirdPartyFeaturesStatus::kEnterpriseManaged:
- return "The third-party features are temporarily disabled for clients on "
- "domain-joined machines.";
- case ThirdPartyFeaturesStatus::kPolicyDisabled:
- return "The ThirdPartyBlockingEnabled group policy is disabled.";
- case ThirdPartyFeaturesStatus::kFeatureDisabled:
- if (base::win::GetVersion() < base::win::VERSION_WIN10)
- return "The ThirdPartyModulesBlocking feature is disabled.";
+void ConflictsHandler::OnConflictsDataFetched(base::DictionaryValue results) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ DCHECK(!module_list_callback_id_.empty());
- return "Both the IncompatibleApplicationsWarning and "
- "ThirdPartyModulesBlocking features are disabled.";
- case ThirdPartyFeaturesStatus::kModuleListInvalid:
- return "Disabled - The Module List component version is invalid.";
- case ThirdPartyFeaturesStatus::kNoModuleListAvailable:
- return "Disabled - There is no Module List version available.";
- case ThirdPartyFeaturesStatus::kWarningInitialized:
- DCHECK_GE(base::win::GetVersion(), base::win::VERSION_WIN10);
- return "The IncompatibleApplicationsWarning feature is enabled, while "
- "the ThirdPartyModulesBlocking feature is disabled.";
- case ThirdPartyFeaturesStatus::kBlockingInitialized:
- if (base::win::GetVersion() < base::win::VERSION_WIN10)
- return "The ThirdPartyModulesBlocking feature is enabled.";
+ conflicts_data_fetcher_ = nullptr;
- return "The ThirdPartyModulesBlocking feature is enabled, while the "
- "IncompatibleApplicationsWarning feature is disabled.";
- case ThirdPartyFeaturesStatus::kWarningAndBlockingInitialized:
- DCHECK_GE(base::win::GetVersion(), base::win::VERSION_WIN10);
- return "Both the IncompatibleApplicationsWarning and "
- "ThirdPartyModulesBlocking features are enabled";
- }
+ AllowJavascript();
+ ResolveJavascriptCallback(base::Value(module_list_callback_id_), results);
}
diff --git a/chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.h b/chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.h
index 99ff0e656e4..35f4dcc7d36 100644
--- a/chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.h
+++ b/chromium/chrome/browser/ui/webui/conflicts/conflicts_handler.h
@@ -5,94 +5,40 @@
#ifndef CHROME_BROWSER_UI_WEBUI_CONFLICTS_CONFLICTS_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_CONFLICTS_CONFLICTS_HANDLER_H_
-#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/conflicts/module_database_observer_win.h"
+#include "chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h"
#include "content/public/browser/web_ui_message_handler.h"
-#if defined(GOOGLE_CHROME_BUILD)
-#include "chrome/browser/conflicts/third_party_conflicts_manager_win.h"
-#endif
-
namespace base {
+class DictionaryValue;
class Listvalue;
}
// This class takes care of sending the list of all loaded modules to the
// chrome://conflicts WebUI page when it is requested.
-class ConflictsHandler : public content::WebUIMessageHandler,
- public ModuleDatabaseObserver {
+class ConflictsHandler : public content::WebUIMessageHandler {
public:
ConflictsHandler();
~ConflictsHandler() override;
private:
- enum ThirdPartyFeaturesStatus {
- // The third-party features are not available in non-Google Chrome builds.
- kNonGoogleChromeBuild,
- // The third-party features are temporarily disabled on domain-joined
- // machines because of a known issue with third-party blocking and the
- // IAttachmentExecute::Save() API (https://crbug.com/870998).
- // TODO(pmonette): Move IAttachmentExecute::Save() to a utility process and
- // remove this.
- kEnterpriseManaged,
- // The ThirdPartyBlockingEnabled group policy is disabled.
- kPolicyDisabled,
- // Both the IncompatibleApplicationsWarning and the
- // ThirdPartyModulesBlocking features are disabled.
- kFeatureDisabled,
- // The Module List version received is invalid.
- kModuleListInvalid,
- // There is no Module List version available.
- kNoModuleListAvailable,
- // Only the IncompatibleApplicationsWarning feature is initialized.
- kWarningInitialized,
- // Only the ThirdPartyModulesBlocking feature is initialized.
- kBlockingInitialized,
- // Both the IncompatibleApplicationsWarning and the
- // ThirdPartyModulesBlocking feature are initialized.
- kWarningAndBlockingInitialized,
- };
-
// content::WebUIMessageHandler:
void RegisterMessages() override;
- // ModuleDatabaseObserver:
- void OnNewModuleFound(const ModuleInfoKey& module_key,
- const ModuleInfoData& module_data) override;
- void OnModuleDatabaseIdle() override;
-
// Callback for the "requestModuleList" message.
void HandleRequestModuleList(const base::ListValue* args);
-#if defined(GOOGLE_CHROME_BUILD)
- // Invoked when the ThirdPartyConflictsManager initialization state is
- // available.
- void OnManagerInitializationComplete(ThirdPartyConflictsManager::State state);
-#endif
-
- // Registers this instance to the ModuleDatabase to retrieve the list of
- // modules via the ModuleDatabaseObserver API.
- void GetListOfModules();
-
- // Returns true if one of the third-party features is enabled and active.
- static bool IsThirdPartyFeatureEnabled(ThirdPartyFeaturesStatus status);
-
- // Returns the status string of the third-party features.
- static std::string GetThirdPartyFeaturesStatusString(
- ThirdPartyFeaturesStatus status);
+ void OnConflictsDataFetched(base::DictionaryValue results);
// The ID of the callback that will get invoked with the module list.
std::string module_list_callback_id_;
- // Temporarily holds the module list while the modules are being
- // enumerated.
- std::unique_ptr<base::ListValue> module_list_;
-
- base::Optional<ThirdPartyFeaturesStatus> third_party_features_status_;
+ // Responsible for fetching the list of modules from the ModuleDatabase, which
+ // lives on a different sequence.
+ ConflictsDataFetcher::UniquePtr conflicts_data_fetcher_;
base::WeakPtrFactory<ConflictsHandler> weak_ptr_factory_;
diff --git a/chromium/chrome/browser/ui/webui/cookies_tree_model_util.cc b/chromium/chrome/browser/ui/webui/cookies_tree_model_util.cc
index 6beaf18c4ba..d372f98a958 100644
--- a/chromium/chrome/browser/ui/webui/cookies_tree_model_util.cc
+++ b/chromium/chrome/browser/ui/webui/cookies_tree_model_util.cc
@@ -25,7 +25,6 @@
#include "extensions/buildflags/buildflags.h"
#include "net/cookies/canonical_cookie.h"
#include "storage/common/fileapi/file_system_types.h"
-#include "third_party/blink/public/mojom/appcache/appcache_info.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/text/bytes_formatting.h"
@@ -51,9 +50,6 @@ const char kKeySendFor[] = "sendfor";
const char kKeyAccessibleToScript[] = "accessibleToScript";
const char kKeySize[] = "size";
const char kKeyOrigin[] = "origin";
-const char kKeyManifest[] = "manifest";
-
-const char kKeyAccessed[] = "accessed";
const char kKeyCreated[] = "created";
const char kKeyExpires[] = "expires";
const char kKeyModified[] = "modified";
@@ -155,16 +151,14 @@ bool CookiesTreeModelUtil::GetCookieTreeNodeDictionary(
case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: {
dict->SetString(kKeyType, "app_cache");
- const blink::mojom::AppCacheInfo& appcache_info =
- *node.GetDetailedInfo().appcache_info;
-
- dict->SetString(kKeyManifest, appcache_info.manifest_url.spec());
- dict->SetString(kKeySize, ui::FormatBytes(appcache_info.size));
- dict->SetString(kKeyCreated, base::UTF16ToUTF8(
- base::TimeFormatFriendlyDateAndTime(appcache_info.creation_time)));
- dict->SetString(kKeyAccessed, base::UTF16ToUTF8(
- base::TimeFormatFriendlyDateAndTime(appcache_info.last_access_time)));
+ const content::StorageUsageInfo& usage_info =
+ *node.GetDetailedInfo().usage_info;
+ dict->SetString(kKeyOrigin, usage_info.origin.Serialize());
+ dict->SetString(kKeySize, ui::FormatBytes(usage_info.total_size_bytes));
+ dict->SetString(kKeyModified,
+ base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
+ usage_info.last_modified)));
break;
}
case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: {
diff --git a/chromium/chrome/browser/ui/webui/crashes_ui.cc b/chromium/chrome/browser/ui/webui/crashes_ui.cc
index a5e5fd09899..bd4ba6632fc 100644
--- a/chromium/chrome/browser/ui/webui/crashes_ui.cc
+++ b/chromium/chrome/browser/ui/webui/crashes_ui.cc
@@ -106,7 +106,7 @@ CrashesDOMHandler::CrashesDOMHandler()
}
CrashesDOMHandler::~CrashesDOMHandler() {
- upload_list_->CancelCallback();
+ upload_list_->CancelLoadCallback();
}
void CrashesDOMHandler::RegisterMessages() {
diff --git a/chromium/chrome/browser/ui/webui/dark_mode_handler.cc b/chromium/chrome/browser/ui/webui/dark_mode_handler.cc
index cf5e50ad21d..3569eb0c7a9 100644
--- a/chromium/chrome/browser/ui/webui/dark_mode_handler.cc
+++ b/chromium/chrome/browser/ui/webui/dark_mode_handler.cc
@@ -9,8 +9,8 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/values.h"
-#include "chrome/browser/browser_features.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/ui_features.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "ui/native_theme/native_theme.h"
@@ -65,7 +65,6 @@ std::unique_ptr<base::DictionaryValue> DarkModeHandler::GetDataSourceUpdate()
auto update = std::make_unique<base::DictionaryValue>();
bool use_dark_mode = UseDarkMode();
update->SetKey("dark", base::Value(use_dark_mode ? "dark" : ""));
- update->SetKey("darkMode", base::Value(use_dark_mode));
return update;
}
diff --git a/chromium/chrome/browser/ui/webui/dark_mode_handler.h b/chromium/chrome/browser/ui/webui/dark_mode_handler.h
index 6d42a71765d..a47965ac677 100644
--- a/chromium/chrome/browser/ui/webui/dark_mode_handler.h
+++ b/chromium/chrome/browser/ui/webui/dark_mode_handler.h
@@ -61,8 +61,8 @@ class DarkModeHandler : public content::WebUIMessageHandler {
bool UseDarkMode() const;
- // Generates a dictionary with "dark" and "darkMode" i18n keys based on
- // |using_dark_|. Called initialize and on each change for notifications.
+ // Generates a dictionary with "dark" i18n key based on |using_dark_|. Called
+ // in Initialize() and on each change for notifications.
std::unique_ptr<base::DictionaryValue> GetDataSourceUpdate() const;
void OnDarkModeChanged(bool dark_mode);
diff --git a/chromium/chrome/browser/ui/webui/dark_mode_handler_unittest.cc b/chromium/chrome/browser/ui/webui/dark_mode_handler_unittest.cc
index e9dca146dc9..8efcdd048ee 100644
--- a/chromium/chrome/browser/ui/webui/dark_mode_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/dark_mode_handler_unittest.cc
@@ -7,8 +7,8 @@
#include "base/test/scoped_feature_list.h"
#include "base/token.h"
#include "base/values.h"
-#include "chrome/browser/browser_features.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/ui_features.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/test/test_browser_thread_bundle.h"
@@ -48,16 +48,12 @@ class DarkModeHandlerTest : public testing::Test {
const auto* replacements = source()->GetReplacements();
const auto dark_it = replacements->find("dark");
- const auto* local_strings = source()->GetLocalizedStrings();
- const auto* dark_mode =
- local_strings->FindKeyOfType("darkMode", base::Value::Type::BOOLEAN);
-
- if (dark_it == replacements->end() || !dark_mode) {
+ if (dark_it == replacements->end()) {
ADD_FAILURE();
return false;
}
- return dark_it->second == "dark" && dark_mode->GetBool();
+ return dark_it->second == "dark";
}
private:
diff --git a/chromium/chrome/browser/ui/webui/device_log_ui.cc b/chromium/chrome/browser/ui/webui/device_log_ui.cc
index 5cec52a31c3..fcf70251b2a 100644
--- a/chromium/chrome/browser/ui/webui/device_log_ui.cc
+++ b/chromium/chrome/browser/ui/webui/device_log_ui.cc
@@ -78,6 +78,7 @@ DeviceLogUI::DeviceLogUI(content::WebUI* web_ui)
html->AddLocalizedString("logTypeUsbText", IDS_DEVICE_LOG_TYPE_USB);
html->AddLocalizedString("logTypeHidText", IDS_DEVICE_LOG_TYPE_HID);
html->AddLocalizedString("logTypePrinterText", IDS_DEVICE_LOG_TYPE_PRINTER);
+ html->AddLocalizedString("logTypeFidoText", IDS_DEVICE_LOG_TYPE_FIDO);
html->AddLocalizedString("logEntryFormat", IDS_DEVICE_LOG_ENTRY);
html->SetJsonPath("strings.js");
diff --git a/chromium/chrome/browser/ui/webui/download_internals/download_internals_ui.cc b/chromium/chrome/browser/ui/webui/download_internals/download_internals_ui.cc
index 4208aeecdc8..9cbcaea9424 100644
--- a/chromium/chrome/browser/ui/webui/download_internals/download_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/download_internals/download_internals_ui.cc
@@ -36,7 +36,6 @@ DownloadInternalsUI::DownloadInternalsUI(content::WebUI* web_ui)
html_source->UseGzip();
Profile* profile = Profile::FromWebUI(web_ui);
- html_source->AddBoolean("isIncognito", profile->IsOffTheRecord());
content::WebUIDataSource::Add(profile, html_source);
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc b/chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc
index 9f595a7bbb7..b11826238c4 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc
@@ -15,6 +15,7 @@
#include "base/values.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/safe_browsing/advanced_protection_status_manager.h"
#include "chrome/browser/ui/webui/dark_mode_handler.h"
#include "chrome/browser/ui/webui/downloads/downloads_dom_handler.h"
#include "chrome/browser/ui/webui/managed_ui_handler.h"
@@ -35,6 +36,8 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/content_features.h"
+#include "ui/base/accelerators/accelerator.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
using content::BrowserContext;
@@ -73,12 +76,26 @@ content::WebUIDataSource* CreateDownloadsUIHTMLSource(Profile* profile) {
// Dangerous file.
source->AddLocalizedString("dangerFileDesc",
IDS_BLOCK_REASON_GENERIC_DOWNLOAD);
- source->AddLocalizedString("dangerDownloadDesc",
- IDS_BLOCK_REASON_DANGEROUS_DOWNLOAD);
- source->AddLocalizedString("dangerUncommonDesc",
- IDS_BLOCK_REASON_UNCOMMON_DOWNLOAD);
- source->AddLocalizedString("dangerSettingsDesc",
- IDS_BLOCK_REASON_UNWANTED_DOWNLOAD);
+
+ bool requests_ap_verdicts = safe_browsing::AdvancedProtectionStatusManager::
+ RequestsAdvancedProtectionVerdicts(profile);
+
+ source->AddLocalizedString(
+ "dangerDownloadDesc",
+ requests_ap_verdicts
+ ? IDS_BLOCK_REASON_DANGEROUS_DOWNLOAD_IN_ADVANCED_PROTECTION
+ : IDS_BLOCK_REASON_DANGEROUS_DOWNLOAD);
+ source->AddLocalizedString(
+ "dangerUncommonDesc",
+ requests_ap_verdicts
+ ? IDS_BLOCK_REASON_UNCOMMON_DOWNLOAD_IN_ADVANCED_PROTECTION
+ : IDS_BLOCK_REASON_UNCOMMON_DOWNLOAD);
+ source->AddLocalizedString(
+ "dangerSettingsDesc",
+ requests_ap_verdicts
+ ? IDS_BLOCK_REASON_UNWANTED_DOWNLOAD_IN_ADVANCED_PROTECTION
+ : IDS_BLOCK_REASON_UNWANTED_DOWNLOAD);
+
source->AddLocalizedString("dangerSave", IDS_CONFIRM_DOWNLOAD);
source->AddLocalizedString("dangerRestore", IDS_CONFIRM_DOWNLOAD_RESTORE);
source->AddLocalizedString("dangerDiscard", IDS_DISCARD_DOWNLOAD);
@@ -94,6 +111,19 @@ content::WebUIDataSource* CreateDownloadsUIHTMLSource(Profile* profile) {
IDS_DOWNLOAD_LINK_REMOVE_ARIA_LABEL);
source->AddLocalizedString("controlRetry", IDS_DOWNLOAD_LINK_RETRY);
source->AddLocalizedString("controlledByUrl", IDS_DOWNLOAD_BY_EXTENSION_URL);
+ source->AddLocalizedString("toastClearedAll", IDS_DOWNLOAD_TOAST_CLEARED_ALL);
+ source->AddLocalizedString("toastRemovedFromList",
+ IDS_DOWNLOAD_TOAST_REMOVED_FROM_LIST);
+ source->AddLocalizedString("undo", IDS_DOWNLOAD_UNDO);
+
+ // Build an Accelerator to describe undo shortcut
+ // NOTE: the undo shortcut is also defined in downloads/downloads.html
+ // TODO(crbug/893033): de-duplicate shortcut by moving all shortcut
+ // definitions from JS to C++.
+ ui::Accelerator undoAccelerator(ui::VKEY_Z, ui::EF_PLATFORM_ACCELERATOR);
+ source->AddString("undoDescription", l10n_util::GetStringFUTF16(
+ IDS_DOWNLOAD_UNDO_DESCRIPTION,
+ undoAccelerator.GetShortcutText()));
PrefService* prefs = profile->GetPrefs();
source->AddBoolean("allowDeletingHistory",
diff --git a/chromium/chrome/browser/ui/webui/eoc_internals/eoc_internals_ui.cc b/chromium/chrome/browser/ui/webui/eoc_internals/eoc_internals_ui.cc
index 7bf61851c53..f8bb27ec3d9 100644
--- a/chromium/chrome/browser/ui/webui/eoc_internals/eoc_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/eoc_internals/eoc_internals_ui.cc
@@ -26,7 +26,8 @@ EocInternalsUI::EocInternalsUI(content::WebUI* web_ui)
source->AddResourcePath("eoc_internals.css", IDR_EOC_INTERNALS_CSS);
source->AddResourcePath("eoc_internals.js", IDR_EOC_INTERNALS_JS);
- source->AddResourcePath("eoc_internals.mojom.js", IDR_EOC_INTERNALS_MOJO_JS);
+ source->AddResourcePath("eoc_internals.mojom-lite.js",
+ IDR_EOC_INTERNALS_MOJOM_LITE_JS);
source->SetDefaultResource(IDR_EOC_INTERNALS_HTML);
source->UseGzip();
diff --git a/chromium/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc b/chromium/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc
index 427748838b9..22fee225778 100644
--- a/chromium/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc
+++ b/chromium/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc
@@ -111,9 +111,9 @@ KioskAppsHandler::KioskAppsHandler(OwnerSettingsServiceChromeOS* service)
weak_ptr_factory_(this) {}
KioskAppsHandler::~KioskAppsHandler() {
- // TODO(scottchen): This is needed because OnJavascriptDisallowed only called
+ // TODO(tommycli): This is needed because OnJavascriptDisallowed only called
// with refresh or off-page navigation, otherwise DCHECK triggered when
- // exiting. Ask tommycli for more information.
+ // exiting.
kiosk_app_manager_->RemoveObserver(this);
}
diff --git a/chromium/chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc b/chromium/chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc
index 7af2b48f715..7d66742b077 100644
--- a/chromium/chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc
@@ -276,7 +276,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionsActivityLogTest, TestActivityLogVisible) {
// The querySelectors and shadowRoots are used here in order to penetrate
// multiple nested shadow DOMs created by Polymer components
// in the chrome://extensions page.
- // See chrome/browser/resources/md_extensions for the Polymer code.
+ // See chrome/browser/resources/extensions for the Polymer code.
// This test only serves as an end to end test, and most of the functionality
// is covered in the JS unit tests.
bool has_api_call = false;
diff --git a/chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc
index 5708b886b51..9ac40798da8 100644
--- a/chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc
+++ b/chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -128,101 +128,105 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
{"searchResultsPlural", IDS_SEARCH_RESULTS_PLURAL},
{"searchResultsSingular", IDS_SEARCH_RESULTS_SINGULAR},
- // Multi-use strings defined in md_extensions_strings.grdp.
- {"remove", IDS_MD_EXTENSIONS_REMOVE},
+ // Multi-use strings defined in extensions_strings.grdp.
+ {"remove", IDS_EXTENSIONS_REMOVE},
// Add extension-specific strings.
{"title", IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE},
- {"toolbarTitle", IDS_MD_EXTENSIONS_TOOLBAR_TITLE},
- {"mainMenu", IDS_MD_EXTENSIONS_MENU_BUTTON_LABEL},
- {"search", IDS_MD_EXTENSIONS_SEARCH},
+ {"toolbarTitle", IDS_EXTENSIONS_TOOLBAR_TITLE},
+ {"mainMenu", IDS_EXTENSIONS_MENU_BUTTON_LABEL},
+ {"search", IDS_EXTENSIONS_SEARCH},
// TODO(dpapad): Use a single merged string resource for "Clear search".
{"clearSearch", IDS_DOWNLOAD_CLEAR_SEARCH},
- {"sidebarExtensions", IDS_MD_EXTENSIONS_SIDEBAR_EXTENSIONS},
- {"appsTitle", IDS_MD_EXTENSIONS_APPS_TITLE},
- {"noExtensionsOrApps", IDS_MD_EXTENSIONS_NO_INSTALLED_ITEMS},
- {"noDescription", IDS_MD_EXTENSIONS_NO_DESCRIPTION},
- {"viewInStore", IDS_MD_EXTENSIONS_ITEM_CHROME_WEB_STORE},
- {"extensionWebsite", IDS_MD_EXTENSIONS_ITEM_EXTENSION_WEBSITE},
+ {"sidebarExtensions", IDS_EXTENSIONS_SIDEBAR_EXTENSIONS},
+ {"appsTitle", IDS_EXTENSIONS_APPS_TITLE},
+ {"noExtensionsOrApps", IDS_EXTENSIONS_NO_INSTALLED_ITEMS},
+ {"noDescription", IDS_EXTENSIONS_NO_DESCRIPTION},
+ {"viewInStore", IDS_EXTENSIONS_ITEM_CHROME_WEB_STORE},
+ {"extensionWebsite", IDS_EXTENSIONS_ITEM_EXTENSION_WEBSITE},
{"dropToInstall", IDS_EXTENSIONS_INSTALL_DROP_TARGET},
- {"errorsPageHeading", IDS_MD_EXTENSIONS_ERROR_PAGE_HEADING},
- {"clearActivities", IDS_MD_EXTENSIONS_CLEAR_ACTIVITIES},
- {"clearAll", IDS_MD_EXTENSIONS_ERROR_CLEAR_ALL},
- {"clearEntry", IDS_MD_EXTENSIONS_A11Y_CLEAR_ENTRY},
+ {"errorsPageHeading", IDS_EXTENSIONS_ERROR_PAGE_HEADING},
+ {"clearActivities", IDS_EXTENSIONS_CLEAR_ACTIVITIES},
+ {"clearAll", IDS_EXTENSIONS_ERROR_CLEAR_ALL},
+ {"clearEntry", IDS_EXTENSIONS_A11Y_CLEAR_ENTRY},
{"logLevel", IDS_EXTENSIONS_LOG_LEVEL_INFO},
{"warnLevel", IDS_EXTENSIONS_LOG_LEVEL_WARN},
{"errorLevel", IDS_EXTENSIONS_LOG_LEVEL_ERROR},
- {"anonymousFunction", IDS_MD_EXTENSIONS_ERROR_ANONYMOUS_FUNCTION},
- {"errorContext", IDS_MD_EXTENSIONS_ERROR_CONTEXT},
- {"errorContextUnknown", IDS_MD_EXTENSIONS_ERROR_CONTEXT_UNKNOWN},
- {"stackTrace", IDS_MD_EXTENSIONS_ERROR_STACK_TRACE},
+ {"anonymousFunction", IDS_EXTENSIONS_ERROR_ANONYMOUS_FUNCTION},
+ {"errorContext", IDS_EXTENSIONS_ERROR_CONTEXT},
+ {"errorContextUnknown", IDS_EXTENSIONS_ERROR_CONTEXT_UNKNOWN},
+ {"stackTrace", IDS_EXTENSIONS_ERROR_STACK_TRACE},
// TODO(dpapad): Unify with Settings' IDS_SETTINGS_WEB_STORE.
- {"openChromeWebStore", IDS_MD_EXTENSIONS_SIDEBAR_OPEN_CHROME_WEB_STORE},
- {"keyboardShortcuts", IDS_MD_EXTENSIONS_SIDEBAR_KEYBOARD_SHORTCUTS},
+ {"openChromeWebStore", IDS_EXTENSIONS_SIDEBAR_OPEN_CHROME_WEB_STORE},
+ {"keyboardShortcuts", IDS_EXTENSIONS_SIDEBAR_KEYBOARD_SHORTCUTS},
{"incognitoInfoWarning", IDS_EXTENSIONS_INCOGNITO_WARNING},
- {"hostPermissionsDescription",
- IDS_MD_EXTENSIONS_HOST_PERMISSIONS_DESCRIPTION},
- {"hostPermissionsEdit", IDS_MD_EXTENSIONS_HOST_PERMISSIONS_EDIT},
- {"hostPermissionsHeading", IDS_MD_EXTENSIONS_ITEM_HOST_PERMISSIONS_HEADING},
- {"hostAccessOnClick", IDS_MD_EXTENSIONS_HOST_ACCESS_ON_CLICK},
- {"hostAccessOnSpecificSites",
- IDS_MD_EXTENSIONS_HOST_ACCESS_ON_SPECIFIC_SITES},
- {"hostAccessOnAllSites", IDS_MD_EXTENSIONS_HOST_ACCESS_ON_ALL_SITES},
+ {"hostPermissionsDescription", IDS_EXTENSIONS_HOST_PERMISSIONS_DESCRIPTION},
+ {"hostPermissionsEdit", IDS_EXTENSIONS_HOST_PERMISSIONS_EDIT},
+ {"hostPermissionsHeading", IDS_EXTENSIONS_ITEM_HOST_PERMISSIONS_HEADING},
+ {"hostAccessOnClick", IDS_EXTENSIONS_HOST_ACCESS_ON_CLICK},
+ {"hostAccessOnSpecificSites", IDS_EXTENSIONS_HOST_ACCESS_ON_SPECIFIC_SITES},
+ {"hostAccessOnAllSites", IDS_EXTENSIONS_HOST_ACCESS_ON_ALL_SITES},
{"hostAllowedHosts", IDS_EXTENSIONS_ITEM_ALLOWED_HOSTS},
- {"itemId", IDS_MD_EXTENSIONS_ITEM_ID},
- {"itemInspectViews", IDS_MD_EXTENSIONS_ITEM_INSPECT_VIEWS},
+ {"itemId", IDS_EXTENSIONS_ITEM_ID},
+ {"itemInspectViews", IDS_EXTENSIONS_ITEM_INSPECT_VIEWS},
// NOTE: This text reads "<n> more". It's possible that it should be using
// a plural string instead. Unfortunately, this is non-trivial since we
// don't expose that capability to JS yet. Since we don't know it's a
// problem, use a simple placeholder for now.
- {"itemInspectViewsExtra", IDS_MD_EXTENSIONS_ITEM_INSPECT_VIEWS_EXTRA},
- {"noActiveViews", IDS_MD_EXTENSIONS_ITEM_NO_ACTIVE_VIEWS},
- {"itemAllowIncognito", IDS_MD_EXTENSIONS_ITEM_ALLOW_INCOGNITO},
- {"itemDescriptionLabel", IDS_MD_EXTENSIONS_ITEM_DESCRIPTION},
- {"itemDependencies", IDS_MD_EXTENSIONS_ITEM_DEPENDENCIES},
- {"itemDependentEntry", IDS_MD_EXTENSIONS_DEPENDENT_ENTRY},
- {"itemDetails", IDS_MD_EXTENSIONS_ITEM_DETAILS},
- {"itemErrors", IDS_MD_EXTENSIONS_ITEM_ERRORS},
- {"accessibilityErrorLine", IDS_MD_EXTENSIONS_ACCESSIBILITY_ERROR_LINE},
+ {"itemInspectViewsExtra", IDS_EXTENSIONS_ITEM_INSPECT_VIEWS_EXTRA},
+ {"noActiveViews", IDS_EXTENSIONS_ITEM_NO_ACTIVE_VIEWS},
+ {"itemAllowIncognito", IDS_EXTENSIONS_ITEM_ALLOW_INCOGNITO},
+ {"itemDescriptionLabel", IDS_EXTENSIONS_ITEM_DESCRIPTION},
+ {"itemDependencies", IDS_EXTENSIONS_ITEM_DEPENDENCIES},
+ {"itemDependentEntry", IDS_EXTENSIONS_DEPENDENT_ENTRY},
+ {"itemDetails", IDS_EXTENSIONS_ITEM_DETAILS},
+ {"itemErrors", IDS_EXTENSIONS_ITEM_ERRORS},
+ {"accessibilityErrorLine", IDS_EXTENSIONS_ACCESSIBILITY_ERROR_LINE},
{"accessibilityErrorMultiLine",
- IDS_MD_EXTENSIONS_ACCESSIBILITY_ERROR_MULTI_LINE},
- {"activityLogPageHeading", IDS_MD_EXTENSIONS_ACTIVITY_LOG_PAGE_HEADING},
- {"activityLogTypeColumn", IDS_MD_EXTENSIONS_ACTIVITY_LOG_TYPE_COLUMN},
- {"activityLogNameColumn", IDS_MD_EXTENSIONS_ACTIVITY_LOG_NAME_COLUMN},
- {"activityLogCountColumn", IDS_MD_EXTENSIONS_ACTIVITY_LOG_COUNT_COLUMN},
- {"activityLogTimeColumn", IDS_MD_EXTENSIONS_ACTIVITY_LOG_TIME_COLUMN},
- {"activityLogSearchLabel", IDS_MD_EXTENSIONS_ACTIVITY_LOG_SEARCH_LABEL},
+ IDS_EXTENSIONS_ACCESSIBILITY_ERROR_MULTI_LINE},
+ {"activityLogPageHeading", IDS_EXTENSIONS_ACTIVITY_LOG_PAGE_HEADING},
+ {"activityLogTypeColumn", IDS_EXTENSIONS_ACTIVITY_LOG_TYPE_COLUMN},
+ {"activityLogNameColumn", IDS_EXTENSIONS_ACTIVITY_LOG_NAME_COLUMN},
+ {"activityLogCountColumn", IDS_EXTENSIONS_ACTIVITY_LOG_COUNT_COLUMN},
+ {"activityLogTimeColumn", IDS_EXTENSIONS_ACTIVITY_LOG_TIME_COLUMN},
+ {"activityLogSearchLabel", IDS_EXTENSIONS_ACTIVITY_LOG_SEARCH_LABEL},
{"activityLogHistoryTabHeading",
- IDS_MD_EXTENSIONS_ACTIVITY_LOG_HISTORY_TAB_HEADING},
+ IDS_EXTENSIONS_ACTIVITY_LOG_HISTORY_TAB_HEADING},
{"activityLogStreamTabHeading",
- IDS_MD_EXTENSIONS_ACTIVITY_LOG_STREAM_TAB_HEADING},
- {"startActivityStream", IDS_MD_EXTENSIONS_START_ACTIVITY_STREAM},
- {"stopActivityStream", IDS_MD_EXTENSIONS_STOP_ACTIVITY_STREAM},
- {"emptyStreamStarted", IDS_MD_EXTENSIONS_EMPTY_STREAM_STARTED},
- {"emptyStreamStopped", IDS_MD_EXTENSIONS_EMPTY_STREAM_STOPPED},
- {"appIcon", IDS_MD_EXTENSIONS_APP_ICON},
- {"extensionIcon", IDS_MD_EXTENSIONS_EXTENSION_ICON},
- {"extensionA11yAssociation", IDS_MD_EXTENSIONS_EXTENSION_A11Y_ASSOCIATION},
- {"itemIdHeading", IDS_MD_EXTENSIONS_ITEM_ID_HEADING},
- {"extensionEnabled", IDS_MD_EXTENSIONS_EXTENSION_ENABLED},
- {"appEnabled", IDS_MD_EXTENSIONS_APP_ENABLED},
+ IDS_EXTENSIONS_ACTIVITY_LOG_STREAM_TAB_HEADING},
+ {"startActivityStream", IDS_EXTENSIONS_START_ACTIVITY_STREAM},
+ {"stopActivityStream", IDS_EXTENSIONS_STOP_ACTIVITY_STREAM},
+ {"emptyStreamStarted", IDS_EXTENSIONS_EMPTY_STREAM_STARTED},
+ {"emptyStreamStopped", IDS_EXTENSIONS_EMPTY_STREAM_STOPPED},
+ {"activityArgumentsHeading", IDS_EXTENSIONS_ACTIVITY_ARGUMENTS_HEADING},
+ {"webRequestInfoHeading", IDS_EXTENSIONS_WEB_REQUEST_INFO_HEADING},
+ {"activityLogMoreActionsLabel",
+ IDS_EXTENSIONS_ACTIVITY_LOG_MORE_ACTIONS_LABEL},
+ {"activityLogExpandAll", IDS_EXTENSIONS_ACTIVITY_LOG_EXPAND_ALL},
+ {"activityLogCollapseAll", IDS_EXTENSIONS_ACTIVITY_LOG_COLLAPSE_ALL},
+ {"appIcon", IDS_EXTENSIONS_APP_ICON},
+ {"extensionIcon", IDS_EXTENSIONS_EXTENSION_ICON},
+ {"extensionA11yAssociation", IDS_EXTENSIONS_EXTENSION_A11Y_ASSOCIATION},
+ {"itemIdHeading", IDS_EXTENSIONS_ITEM_ID_HEADING},
+ {"extensionEnabled", IDS_EXTENSIONS_EXTENSION_ENABLED},
+ {"appEnabled", IDS_EXTENSIONS_APP_ENABLED},
{"installWarnings", IDS_EXTENSIONS_INSTALL_WARNINGS},
{"itemExtensionPath", IDS_EXTENSIONS_PATH},
- {"itemOff", IDS_MD_EXTENSIONS_ITEM_OFF},
- {"itemOn", IDS_MD_EXTENSIONS_ITEM_ON},
- {"itemOptions", IDS_MD_EXTENSIONS_ITEM_OPTIONS},
- {"itemPermissions", IDS_MD_EXTENSIONS_ITEM_PERMISSIONS},
- {"itemPermissionsEmpty", IDS_MD_EXTENSIONS_ITEM_PERMISSIONS_EMPTY},
- {"itemRemoveExtension", IDS_MD_EXTENSIONS_ITEM_REMOVE_EXTENSION},
- {"itemSiteAccess", IDS_MD_EXTENSIONS_ITEM_SITE_ACCESS},
- {"itemSiteAccessAddHost", IDS_MD_EXTENSIONS_ITEM_SITE_ACCESS_ADD_HOST},
- {"itemSiteAccessEmpty", IDS_MD_EXTENSIONS_ITEM_SITE_ACCESS_EMPTY},
- {"itemSource", IDS_MD_EXTENSIONS_ITEM_SOURCE},
- {"itemSourcePolicy", IDS_MD_EXTENSIONS_ITEM_SOURCE_POLICY},
- {"itemSourceSideloaded", IDS_MD_EXTENSIONS_ITEM_SOURCE_SIDELOADED},
- {"itemSourceUnpacked", IDS_MD_EXTENSIONS_ITEM_SOURCE_UNPACKED},
- {"itemSourceWebstore", IDS_MD_EXTENSIONS_ITEM_SOURCE_WEBSTORE},
- {"itemVersion", IDS_MD_EXTENSIONS_ITEM_VERSION},
+ {"itemOff", IDS_EXTENSIONS_ITEM_OFF},
+ {"itemOn", IDS_EXTENSIONS_ITEM_ON},
+ {"itemOptions", IDS_EXTENSIONS_ITEM_OPTIONS},
+ {"itemPermissions", IDS_EXTENSIONS_ITEM_PERMISSIONS},
+ {"itemPermissionsEmpty", IDS_EXTENSIONS_ITEM_PERMISSIONS_EMPTY},
+ {"itemRemoveExtension", IDS_EXTENSIONS_ITEM_REMOVE_EXTENSION},
+ {"itemSiteAccess", IDS_EXTENSIONS_ITEM_SITE_ACCESS},
+ {"itemSiteAccessAddHost", IDS_EXTENSIONS_ITEM_SITE_ACCESS_ADD_HOST},
+ {"itemSiteAccessEmpty", IDS_EXTENSIONS_ITEM_SITE_ACCESS_EMPTY},
+ {"itemSource", IDS_EXTENSIONS_ITEM_SOURCE},
+ {"itemSourcePolicy", IDS_EXTENSIONS_ITEM_SOURCE_POLICY},
+ {"itemSourceSideloaded", IDS_EXTENSIONS_ITEM_SOURCE_SIDELOADED},
+ {"itemSourceUnpacked", IDS_EXTENSIONS_ITEM_SOURCE_UNPACKED},
+ {"itemSourceWebstore", IDS_EXTENSIONS_ITEM_SOURCE_WEBSTORE},
+ {"itemVersion", IDS_EXTENSIONS_ITEM_VERSION},
// TODO(dpapad): Replace this with an Extensions specific string.
{"itemSize", IDS_DIRECTORY_LISTING_SIZE},
{"itemAllowOnFileUrls", IDS_EXTENSIONS_ALLOW_FILE_ACCESS},
@@ -233,46 +237,46 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
{"itemRepair", IDS_EXTENSIONS_REPAIR_CORRUPTED},
{"itemReload", IDS_EXTENSIONS_RELOAD_TERMINATED},
{"loadErrorCouldNotLoadManifest",
- IDS_MD_EXTENSIONS_LOAD_ERROR_COULD_NOT_LOAD_MANIFEST},
- {"loadErrorHeading", IDS_MD_EXTENSIONS_LOAD_ERROR_HEADING},
- {"loadErrorFileLabel", IDS_MD_EXTENSIONS_LOAD_ERROR_FILE_LABEL},
- {"loadErrorErrorLabel", IDS_MD_EXTENSIONS_LOAD_ERROR_ERROR_LABEL},
- {"loadErrorRetry", IDS_MD_EXTENSIONS_LOAD_ERROR_RETRY},
- {"loadingActivities", IDS_MD_EXTENSIONS_LOADING_ACTIVITIES},
- {"noActivities", IDS_MD_EXTENSIONS_NO_ACTIVITIES},
+ IDS_EXTENSIONS_LOAD_ERROR_COULD_NOT_LOAD_MANIFEST},
+ {"loadErrorHeading", IDS_EXTENSIONS_LOAD_ERROR_HEADING},
+ {"loadErrorFileLabel", IDS_EXTENSIONS_LOAD_ERROR_FILE_LABEL},
+ {"loadErrorErrorLabel", IDS_EXTENSIONS_LOAD_ERROR_ERROR_LABEL},
+ {"loadErrorRetry", IDS_EXTENSIONS_LOAD_ERROR_RETRY},
+ {"loadingActivities", IDS_EXTENSIONS_LOADING_ACTIVITIES},
+ {"noActivities", IDS_EXTENSIONS_NO_ACTIVITIES},
{"noErrorsToShow", IDS_EXTENSIONS_ERROR_NO_ERRORS_CODE_MESSAGE},
{"runtimeHostsDialogInputError",
- IDS_MD_EXTENSIONS_RUNTIME_HOSTS_DIALOG_INPUT_ERROR},
+ IDS_EXTENSIONS_RUNTIME_HOSTS_DIALOG_INPUT_ERROR},
{"runtimeHostsDialogInputLabel",
- IDS_MD_EXTENSIONS_RUNTIME_HOSTS_DIALOG_INPUT_LABEL},
- {"runtimeHostsDialogTitle", IDS_MD_EXTENSIONS_RUNTIME_HOSTS_DIALOG_TITLE},
- {"packDialogTitle", IDS_MD_EXTENSIONS_PACK_DIALOG_TITLE},
- {"packDialogWarningTitle", IDS_MD_EXTENSIONS_PACK_DIALOG_WARNING_TITLE},
- {"packDialogErrorTitle", IDS_MD_EXTENSIONS_PACK_DIALOG_ERROR_TITLE},
- {"packDialogProceedAnyway", IDS_MD_EXTENSIONS_PACK_DIALOG_PROCEED_ANYWAY},
- {"packDialogBrowse", IDS_MD_EXTENSIONS_PACK_DIALOG_BROWSE_BUTTON},
+ IDS_EXTENSIONS_RUNTIME_HOSTS_DIALOG_INPUT_LABEL},
+ {"runtimeHostsDialogTitle", IDS_EXTENSIONS_RUNTIME_HOSTS_DIALOG_TITLE},
+ {"packDialogTitle", IDS_EXTENSIONS_PACK_DIALOG_TITLE},
+ {"packDialogWarningTitle", IDS_EXTENSIONS_PACK_DIALOG_WARNING_TITLE},
+ {"packDialogErrorTitle", IDS_EXTENSIONS_PACK_DIALOG_ERROR_TITLE},
+ {"packDialogProceedAnyway", IDS_EXTENSIONS_PACK_DIALOG_PROCEED_ANYWAY},
+ {"packDialogBrowse", IDS_EXTENSIONS_PACK_DIALOG_BROWSE_BUTTON},
{"packDialogExtensionRoot",
- IDS_MD_EXTENSIONS_PACK_DIALOG_EXTENSION_ROOT_LABEL},
- {"packDialogKeyFile", IDS_MD_EXTENSIONS_PACK_DIALOG_KEY_FILE_LABEL},
+ IDS_EXTENSIONS_PACK_DIALOG_EXTENSION_ROOT_LABEL},
+ {"packDialogKeyFile", IDS_EXTENSIONS_PACK_DIALOG_KEY_FILE_LABEL},
{"packDialogContent", IDS_EXTENSION_PACK_DIALOG_HEADING},
- {"packDialogConfirm", IDS_MD_EXTENSIONS_PACK_DIALOG_CONFIRM_BUTTON},
- {"shortcutNotSet", IDS_MD_EXTENSIONS_SHORTCUT_NOT_SET},
- {"shortcutScopeGlobal", IDS_MD_EXTENSIONS_SHORTCUT_SCOPE_GLOBAL},
- {"shortcutScopeLabel", IDS_MD_EXTENSIONS_SHORTCUT_SCOPE_LABEL},
- {"shortcutScopeInChrome", IDS_MD_EXTENSIONS_SHORTCUT_SCOPE_IN_CHROME},
- {"shortcutTypeAShortcut", IDS_MD_EXTENSIONS_TYPE_A_SHORTCUT},
- {"shortcutIncludeStartModifier", IDS_MD_EXTENSIONS_INCLUDE_START_MODIFIER},
- {"shortcutTooManyModifiers", IDS_MD_EXTENSIONS_TOO_MANY_MODIFIERS},
- {"shortcutNeedCharacter", IDS_MD_EXTENSIONS_NEED_CHARACTER},
- {"toolbarDevMode", IDS_MD_EXTENSIONS_DEVELOPER_MODE},
- {"toolbarLoadUnpacked", IDS_MD_EXTENSIONS_TOOLBAR_LOAD_UNPACKED},
- {"toolbarPack", IDS_MD_EXTENSIONS_TOOLBAR_PACK},
- {"toolbarUpdateNow", IDS_MD_EXTENSIONS_TOOLBAR_UPDATE_NOW},
- {"toolbarUpdateNowTooltip", IDS_MD_EXTENSIONS_TOOLBAR_UPDATE_NOW_TOOLTIP},
- {"toolbarUpdateDone", IDS_MD_EXTENSIONS_TOOLBAR_UPDATE_DONE},
- {"toolbarUpdatingToast", IDS_MD_EXTENSIONS_TOOLBAR_UPDATING_TOAST},
+ {"packDialogConfirm", IDS_EXTENSIONS_PACK_DIALOG_CONFIRM_BUTTON},
+ {"shortcutNotSet", IDS_EXTENSIONS_SHORTCUT_NOT_SET},
+ {"shortcutScopeGlobal", IDS_EXTENSIONS_SHORTCUT_SCOPE_GLOBAL},
+ {"shortcutScopeLabel", IDS_EXTENSIONS_SHORTCUT_SCOPE_LABEL},
+ {"shortcutScopeInChrome", IDS_EXTENSIONS_SHORTCUT_SCOPE_IN_CHROME},
+ {"shortcutTypeAShortcut", IDS_EXTENSIONS_TYPE_A_SHORTCUT},
+ {"shortcutIncludeStartModifier", IDS_EXTENSIONS_INCLUDE_START_MODIFIER},
+ {"shortcutTooManyModifiers", IDS_EXTENSIONS_TOO_MANY_MODIFIERS},
+ {"shortcutNeedCharacter", IDS_EXTENSIONS_NEED_CHARACTER},
+ {"toolbarDevMode", IDS_EXTENSIONS_DEVELOPER_MODE},
+ {"toolbarLoadUnpacked", IDS_EXTENSIONS_TOOLBAR_LOAD_UNPACKED},
+ {"toolbarPack", IDS_EXTENSIONS_TOOLBAR_PACK},
+ {"toolbarUpdateNow", IDS_EXTENSIONS_TOOLBAR_UPDATE_NOW},
+ {"toolbarUpdateNowTooltip", IDS_EXTENSIONS_TOOLBAR_UPDATE_NOW_TOOLTIP},
+ {"toolbarUpdateDone", IDS_EXTENSIONS_TOOLBAR_UPDATE_DONE},
+ {"toolbarUpdatingToast", IDS_EXTENSIONS_TOOLBAR_UPDATING_TOAST},
{"updateRequiredByPolicy",
- IDS_MD_EXTENSIONS_DISABLED_UPDATE_REQUIRED_BY_POLICY},
+ IDS_EXTENSIONS_DISABLED_UPDATE_REQUIRED_BY_POLICY},
{"viewActivityLog", IDS_EXTENSIONS_VIEW_ACTIVITY_LOG},
{"viewBackgroundPage", IDS_EXTENSIONS_BACKGROUND_PAGE},
{"viewIncognito", IDS_EXTENSIONS_VIEW_INCOGNITO},
@@ -280,17 +284,17 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
{"viewIframe", IDS_EXTENSIONS_VIEW_IFRAME},
#if defined(OS_CHROMEOS)
- {"manageKioskApp", IDS_MD_EXTENSIONS_MANAGE_KIOSK_APP},
- {"kioskAddApp", IDS_MD_EXTENSIONS_KIOSK_ADD_APP},
- {"kioskAddAppHint", IDS_MD_EXTENSIONS_KIOSK_ADD_APP_HINT},
- {"kioskEnableAutoLaunch", IDS_MD_EXTENSIONS_KIOSK_ENABLE_AUTO_LAUNCH},
- {"kioskDisableAutoLaunch", IDS_MD_EXTENSIONS_KIOSK_DISABLE_AUTO_LAUNCH},
- {"kioskAutoLaunch", IDS_MD_EXTENSIONS_KIOSK_AUTO_LAUNCH},
- {"kioskInvalidApp", IDS_MD_EXTENSIONS_KIOSK_INVALID_APP},
+ {"manageKioskApp", IDS_EXTENSIONS_MANAGE_KIOSK_APP},
+ {"kioskAddApp", IDS_EXTENSIONS_KIOSK_ADD_APP},
+ {"kioskAddAppHint", IDS_EXTENSIONS_KIOSK_ADD_APP_HINT},
+ {"kioskEnableAutoLaunch", IDS_EXTENSIONS_KIOSK_ENABLE_AUTO_LAUNCH},
+ {"kioskDisableAutoLaunch", IDS_EXTENSIONS_KIOSK_DISABLE_AUTO_LAUNCH},
+ {"kioskAutoLaunch", IDS_EXTENSIONS_KIOSK_AUTO_LAUNCH},
+ {"kioskInvalidApp", IDS_EXTENSIONS_KIOSK_INVALID_APP},
{"kioskDisableBailout",
- IDS_MD_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_LABEL},
+ IDS_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_LABEL},
{"kioskDisableBailoutWarningTitle",
- IDS_MD_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_TITLE},
+ IDS_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_TITLE},
#endif
};
AddLocalizedStringsBulk(source, kLocalizedStrings,
@@ -298,10 +302,10 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
source->AddString("errorLinesNotShownSingular",
l10n_util::GetPluralStringFUTF16(
- IDS_MD_EXTENSIONS_ERROR_LINES_NOT_SHOWN, 1));
+ IDS_EXTENSIONS_ERROR_LINES_NOT_SHOWN, 1));
source->AddString("errorLinesNotShownPlural",
l10n_util::GetPluralStringFUTF16(
- IDS_MD_EXTENSIONS_ERROR_LINES_NOT_SHOWN, 2));
+ IDS_EXTENSIONS_ERROR_LINES_NOT_SHOWN, 2));
source->AddString(
"itemSuspiciousInstall",
l10n_util::GetStringFUTF16(
@@ -317,7 +321,7 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
source->AddString(
"kioskDisableBailoutWarningBody",
l10n_util::GetStringFUTF16(
- IDS_MD_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_BODY,
+ IDS_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_BODY,
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME)));
#endif
source->AddString(
@@ -336,11 +340,11 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
source->AddString(kLoadTimeClassesKey, GetLoadTimeClasses(in_dev_mode));
#if BUILDFLAG(OPTIMIZE_WEBUI)
- source->AddResourcePath("crisper.js", IDR_MD_EXTENSIONS_CRISPER_JS);
+ source->AddResourcePath("crisper.js", IDR_EXTENSIONS_CRISPER_JS);
source->SetDefaultResource(
- base::FeatureList::IsEnabled(features::kWebUIPolymer2) ?
- IDR_MD_EXTENSIONS_VULCANIZED_P2_HTML :
- IDR_MD_EXTENSIONS_VULCANIZED_HTML);
+ base::FeatureList::IsEnabled(features::kWebUIPolymer2)
+ ? IDR_EXTENSIONS_VULCANIZED_P2_HTML
+ : IDR_EXTENSIONS_VULCANIZED_HTML);
source->UseGzip();
#else
// Add all MD Extensions resources.
@@ -348,7 +352,7 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
source->AddResourcePath(kExtensionsResources[i].name,
kExtensionsResources[i].value);
}
- source->SetDefaultResource(IDR_MD_EXTENSIONS_EXTENSIONS_HTML);
+ source->SetDefaultResource(IDR_EXTENSIONS_EXTENSIONS_HTML);
#endif
return source;
diff --git a/chromium/chrome/browser/ui/webui/favicon_source.cc b/chromium/chrome/browser/ui/webui/favicon_source.cc
index 7a04b208ed9..77ab61af121 100644
--- a/chromium/chrome/browser/ui/webui/favicon_source.cc
+++ b/chromium/chrome/browser/ui/webui/favicon_source.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/history/top_sites_factory.h"
@@ -19,27 +20,42 @@
#include "components/history/core/browser/top_sites.h"
#include "components/sync_sessions/open_tabs_ui_delegate.h"
#include "components/sync_sessions/session_sync_service.h"
+#include "content/public/browser/web_contents.h"
#include "net/url_request/url_request.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/native_theme/native_theme.h"
#include "ui/resources/grit/ui_resources.h"
+#include "url/gurl.h"
-FaviconSource::IconRequest::IconRequest()
- : size_in_dip(gfx::kFaviconSize), device_scale_factor(1.0f) {
+namespace {
+favicon::FaviconRequestOrigin ParseFaviconRequestOrigin(const GURL& url) {
+ GURL history_url(chrome::kChromeUIHistoryURL);
+ if (url == history_url.Resolve("/syncedTabs"))
+ return favicon::FaviconRequestOrigin::HISTORY_SYNCED_TABS;
+ if (url == history_url)
+ return favicon::FaviconRequestOrigin::HISTORY;
+ return favicon::FaviconRequestOrigin::UNKNOWN;
}
+} // namespace
+
+FaviconSource::IconRequest::IconRequest()
+ : size_in_dip(gfx::kFaviconSize),
+ device_scale_factor(1.0f),
+ icon_request_origin(favicon::FaviconRequestOrigin::UNKNOWN) {}
FaviconSource::IconRequest::IconRequest(
const content::URLDataSource::GotDataCallback& cb,
const GURL& path,
int size,
- float scale)
+ float scale,
+ favicon::FaviconRequestOrigin origin)
: callback(cb),
request_path(path),
size_in_dip(size),
- device_scale_factor(scale) {
-}
+ device_scale_factor(scale),
+ icon_request_origin(origin) {}
FaviconSource::IconRequest::IconRequest(const IconRequest& other) = default;
@@ -84,15 +100,22 @@ void FaviconSource::StartDataRequest(
int desired_size_in_pixel =
std::ceil(parsed.size_in_dip * parsed.device_scale_factor);
+ content::WebContents* web_contents = wc_getter.Run();
+ // web_contents->GetURL will not necessarily yield the original URL that
+ // started the request, but for collecting metrics for chrome://history and
+ // chrome://history/syncedTabs this will be ok.
+ favicon::FaviconRequestOrigin unsafe_request_origin =
+ web_contents ? ParseFaviconRequestOrigin(web_contents->GetURL())
+ : favicon::FaviconRequestOrigin::UNKNOWN;
if (parsed.is_icon_url) {
// TODO(michaelbai): Change GetRawFavicon to support combination of
// IconType.
favicon_service->GetRawFavicon(
url, favicon_base::IconType::kFavicon, desired_size_in_pixel,
- base::Bind(&FaviconSource::OnFaviconDataAvailable,
- base::Unretained(this),
- IconRequest(callback, url, parsed.size_in_dip,
- parsed.device_scale_factor)),
+ base::Bind(
+ &FaviconSource::OnFaviconDataAvailable, base::Unretained(this),
+ IconRequest(callback, url, parsed.size_in_dip,
+ parsed.device_scale_factor, unsafe_request_origin)),
&cancelable_task_tracker_);
} else {
// Intercept requests for prepopulated pages if TopSites exists.
@@ -123,10 +146,10 @@ void FaviconSource::StartDataRequest(
favicon_service->GetRawFaviconForPageURL(
url, {favicon_base::IconType::kFavicon}, desired_size_in_pixel,
fallback_to_host,
- base::Bind(&FaviconSource::OnFaviconDataAvailable,
- base::Unretained(this),
- IconRequest(callback, url, parsed.size_in_dip,
- parsed.device_scale_factor)),
+ base::Bind(
+ &FaviconSource::OnFaviconDataAvailable, base::Unretained(this),
+ IconRequest(callback, url, parsed.size_in_dip,
+ parsed.device_scale_factor, unsafe_request_origin)),
&cancelable_task_tracker_);
}
}
@@ -184,16 +207,26 @@ void FaviconSource::OnFaviconDataAvailable(
const IconRequest& request,
const favicon_base::FaviconRawBitmapResult& bitmap_result) {
if (bitmap_result.is_valid()) {
+ favicon::RecordFaviconRequestMetric(request.icon_request_origin,
+ favicon::FaviconAvailability::kLocal);
// Forward the data along to the networking system.
request.callback.Run(bitmap_result.bitmap_data.get());
- } else if (!HandleMissingResource(request)) {
+ } else if (HandleMissingResource(request)) {
+ favicon::RecordFaviconRequestMetric(request.icon_request_origin,
+ favicon::FaviconAvailability::kSync);
+ // The response was already treated by HandleMissingResource.
+ } else {
+ favicon::RecordFaviconRequestMetric(
+ request.icon_request_origin,
+ favicon::FaviconAvailability::kNotAvailable);
SendDefaultResponse(request);
}
}
void FaviconSource::SendDefaultResponse(
const content::URLDataSource::GotDataCallback& callback) {
- SendDefaultResponse(IconRequest(callback, GURL(), 16, 1.0f));
+ SendDefaultResponse(IconRequest(callback, GURL(), 16, 1.0f,
+ favicon::FaviconRequestOrigin::UNKNOWN));
}
void FaviconSource::SendDefaultResponse(const IconRequest& icon_request) {
diff --git a/chromium/chrome/browser/ui/webui/favicon_source.h b/chromium/chrome/browser/ui/webui/favicon_source.h
index 53e867313dd..4b72ee5a0cb 100644
--- a/chromium/chrome/browser/ui/webui/favicon_source.h
+++ b/chromium/chrome/browser/ui/webui/favicon_source.h
@@ -12,6 +12,7 @@
#include "base/memory/ref_counted.h"
#include "base/task/cancelable_task_tracker.h"
#include "components/favicon/core/favicon_service.h"
+#include "components/favicon_base/favicon_request_metrics.h"
#include "content/public/browser/url_data_source.h"
#include "ui/gfx/favicon_size.h"
@@ -78,7 +79,8 @@ class FaviconSource : public content::URLDataSource {
IconRequest(const content::URLDataSource::GotDataCallback& cb,
const GURL& path,
int size,
- float scale);
+ float scale,
+ favicon::FaviconRequestOrigin origin);
IconRequest(const IconRequest& other);
~IconRequest();
@@ -86,6 +88,7 @@ class FaviconSource : public content::URLDataSource {
GURL request_path;
int size_in_dip;
float device_scale_factor;
+ favicon::FaviconRequestOrigin icon_request_origin;
};
// Called when the favicon data is missing to perform additional checks to
diff --git a/chromium/chrome/browser/ui/webui/feed_internals/BUILD.gn b/chromium/chrome/browser/ui/webui/feed_internals/BUILD.gn
index a5a97629de3..846c29a4ccc 100644
--- a/chromium/chrome/browser/ui/webui/feed_internals/BUILD.gn
+++ b/chromium/chrome/browser/ui/webui/feed_internals/BUILD.gn
@@ -8,4 +8,8 @@ mojom("mojo_bindings") {
sources = [
"feed_internals.mojom",
]
+
+ public_deps = [
+ "//url/mojom:url_mojom_gurl",
+ ]
}
diff --git a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals.mojom b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals.mojom
index aa466691a47..bf6f965d32a 100644
--- a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals.mojom
+++ b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals.mojom
@@ -4,10 +4,24 @@
module feed_internals.mojom;
+import "url/mojom/url.mojom";
+
// General properties of Feed suggestions.
struct Properties {
- // Whether the Feed is enabled.
+ // Whether the Feed feature flag is enabled.
bool is_feed_enabled;
+
+ // Whether suggested articles section is expanded.
+ bool is_feed_visible;
+
+ // Whether suggested articles are allowed. Typically set by policy.
+ bool is_feed_allowed;
+
+ // Whether prefetching for offline availability is enabled.
+ bool is_prefetching_enabled;
+
+ // Feed fetch URL.
+ url.mojom.Url feed_fetch_url;
};
struct UserClassifier {
@@ -27,6 +41,9 @@ struct LastFetchProperties {
// Last fetch status.
int32 last_fetch_status;
+ // Reason for the last fetch.
+ string last_fetch_trigger;
+
// Last fetch time.
Time? last_fetch_time;
@@ -41,16 +58,16 @@ struct Suggestion {
string title;
// URL of the suggested page.
- string url;
+ url.mojom.Url url;
// Name of the content's publisher.
string publisher_name;
// URL of the image associated with the suggestion.
- string image_url;
+ url.mojom.Url image_url;
// URL of the suggested page's favicon.
- string favicon_url;
+ url.mojom.Url favicon_url;
};
// Time wrapper to allow for nullable objects.
@@ -77,6 +94,15 @@ interface PageHandler {
// Feed.
ClearCachedDataAndRefreshFeed();
+ // Trigger a refresh of the Feed.
+ RefreshFeed();
+
// Get the last known content with metadata.
GetCurrentContent() => (array<Suggestion> suggestions);
+
+ // Internal state dump of the Feed library's process scope.
+ GetFeedProcessScopeDump() => (string dump);
+
+ // Record all Feed metrics into a log.
+ GetFeedHistograms() => (string log);
};
diff --git a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.cc b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.cc
index d1601c39a7d..51c01b6e21d 100644
--- a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.cc
+++ b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.cc
@@ -4,10 +4,13 @@
#include "chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.h"
+#include <string>
#include <utility>
#include "base/feature_list.h"
+#include "base/metrics/statistics_recorder.h"
#include "base/time/time.h"
+#include "chrome/browser/android/feed/feed_debugging_bridge.h"
#include "chrome/browser/android/feed/feed_lifecycle_bridge.h"
#include "components/feed/content/feed_host_service.h"
#include "components/feed/content/feed_offline_host.h"
@@ -15,16 +18,30 @@
#include "components/feed/core/pref_names.h"
#include "components/feed/core/user_classifier.h"
#include "components/feed/feed_feature_list.h"
+#include "components/offline_pages/core/prefetch/prefetch_prefs.h"
#include "components/offline_pages/core/prefetch/suggestions_provider.h"
#include "components/prefs/pref_service.h"
namespace {
+const char kFeedHistogramPrefix[] = "ContentSuggestions.Feed.";
+
feed_internals::mojom::TimePtr ToMojoTime(base::Time time) {
return time.is_null() ? nullptr
: feed_internals::mojom::Time::New(time.ToJsTime());
}
+std::string TriggerTypeToString(feed::FeedSchedulerHost::TriggerType trigger) {
+ switch (trigger) {
+ case feed::FeedSchedulerHost::TriggerType::kNtpShown:
+ return "NTP Shown";
+ case feed::FeedSchedulerHost::TriggerType::kForegrounded:
+ return "Foregrounded";
+ case feed::FeedSchedulerHost::TriggerType::kFixedTimer:
+ return "Fixed Timer";
+ }
+}
+
} // namespace
FeedInternalsPageHandler::FeedInternalsPageHandler(
@@ -45,6 +62,12 @@ void FeedInternalsPageHandler::GetGeneralProperties(
properties->is_feed_enabled =
base::FeatureList::IsEnabled(feed::kInterestFeedContentSuggestions);
+ properties->is_feed_visible =
+ pref_service_->GetBoolean(feed::prefs::kArticlesListVisible);
+ properties->is_feed_allowed = IsFeedAllowed();
+ properties->is_prefetching_enabled =
+ offline_pages::prefetch_prefs::IsEnabled(pref_service_);
+ properties->feed_fetch_url = feed::GetFeedFetchUrlForDebugging();
std::move(callback).Run(std::move(properties));
}
@@ -72,6 +95,8 @@ void FeedInternalsPageHandler::GetLastFetchProperties(
properties->last_fetch_status =
feed_scheduler_host_->GetLastFetchStatusForDebugging();
+ properties->last_fetch_trigger = TriggerTypeToString(
+ feed_scheduler_host_->GetLastFetchTriggerTypeForDebugging());
properties->last_fetch_time =
ToMojoTime(pref_service_->GetTime(feed::prefs::kLastFetchAttemptTime));
properties->refresh_suppress_time =
@@ -89,8 +114,18 @@ void FeedInternalsPageHandler::ClearCachedDataAndRefreshFeed() {
feed::FeedLifecycleBridge::ClearCachedData();
}
+void FeedInternalsPageHandler::RefreshFeed() {
+ feed::TriggerRefreshForDebugging();
+}
+
void FeedInternalsPageHandler::GetCurrentContent(
GetCurrentContentCallback callback) {
+ if (!IsFeedAllowed()) {
+ std::move(callback).Run(
+ std::vector<feed_internals::mojom::SuggestionPtr>());
+ return;
+ }
+
feed_offline_host_->GetCurrentArticleSuggestions(base::BindOnce(
&FeedInternalsPageHandler::OnGetCurrentArticleSuggestionsDone,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
@@ -104,13 +139,29 @@ void FeedInternalsPageHandler::OnGetCurrentArticleSuggestionsDone(
for (offline_pages::PrefetchSuggestion result : results) {
auto suggestion = feed_internals::mojom::Suggestion::New();
suggestion->title = std::move(result.article_title);
- suggestion->url = result.article_url.spec();
+ suggestion->url = std::move(result.article_url);
suggestion->publisher_name = std::move(result.article_attribution);
- suggestion->image_url = result.thumbnail_url.spec();
- suggestion->favicon_url = result.favicon_url.spec();
+ suggestion->image_url = std::move(result.thumbnail_url);
+ suggestion->favicon_url = std::move(result.favicon_url);
suggestions.push_back(std::move(suggestion));
}
std::move(callback).Run(std::move(suggestions));
}
+
+void FeedInternalsPageHandler::GetFeedProcessScopeDump(
+ GetFeedProcessScopeDumpCallback callback) {
+ std::move(callback).Run(feed::GetFeedProcessScopeDumpForDebugging());
+}
+
+bool FeedInternalsPageHandler::IsFeedAllowed() {
+ return pref_service_->GetBoolean(feed::prefs::kEnableSnippets);
+}
+
+void FeedInternalsPageHandler::GetFeedHistograms(
+ GetFeedHistogramsCallback callback) {
+ std::string log;
+ base::StatisticsRecorder::WriteGraph(kFeedHistogramPrefix, &log);
+ std::move(callback).Run(log);
+}
diff --git a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.h b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.h
index 277fb4c4257..67f1327fe9a 100644
--- a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.h
+++ b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.h
@@ -39,7 +39,10 @@ class FeedInternalsPageHandler : public feed_internals::mojom::PageHandler {
void ClearUserClassifierProperties() override;
void GetLastFetchProperties(GetLastFetchPropertiesCallback) override;
void ClearCachedDataAndRefreshFeed() override;
+ void RefreshFeed() override;
void GetCurrentContent(GetCurrentContentCallback) override;
+ void GetFeedProcessScopeDump(GetFeedProcessScopeDumpCallback) override;
+ void GetFeedHistograms(GetFeedHistogramsCallback) override;
private:
// Binding from the mojo interface to concrete implementation.
@@ -49,6 +52,8 @@ class FeedInternalsPageHandler : public feed_internals::mojom::PageHandler {
GetCurrentContentCallback callback,
std::vector<offline_pages::PrefetchSuggestion> suggestions);
+ bool IsFeedAllowed();
+
// Services that provide the data and functionality.
feed::FeedSchedulerHost* feed_scheduler_host_;
feed::FeedOfflineHost* feed_offline_host_;
diff --git a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.cc b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.cc
index 32658cd8756..ab18f72b41c 100644
--- a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.cc
@@ -22,6 +22,7 @@ FeedInternalsUI::FeedInternalsUI(content::WebUI* web_ui)
source->AddResourcePath("feed_internals.js", IDR_FEED_INTERNALS_JS);
source->AddResourcePath("feed_internals.mojom-lite.js",
IDR_FEED_INTERNALS_MOJO_JS);
+ source->AddResourcePath("url/mojom/url.mojom-lite.js", IDR_URL_MOJOM_LITE_JS);
source->AddResourcePath("feed_internals.css", IDR_FEED_INTERNALS_CSS);
source->SetDefaultResource(IDR_FEED_INTERNALS_HTML);
source->UseGzip();
diff --git a/chromium/chrome/browser/ui/webui/flags_ui.cc b/chromium/chrome/browser/ui/webui/flags_ui.cc
index 37410de78d5..9a8710a35ce 100644
--- a/chromium/chrome/browser/ui/webui/flags_ui.cc
+++ b/chromium/chrome/browser/ui/webui/flags_ui.cc
@@ -51,6 +51,10 @@
#include "components/user_manager/user_manager.h"
#endif
+#if !defined(OS_ANDROID)
+#include "chrome/browser/ui/webui/dark_mode_handler.h"
+#endif
+
using content::WebContents;
using content::WebUIMessageHandler;
@@ -348,7 +352,13 @@ FlagsUI::FlagsUI(content::WebUI* web_ui)
#endif
// Set up the about:flags source.
- content::WebUIDataSource::Add(profile, CreateFlagsUIHTMLSource());
+ auto* source = CreateFlagsUIHTMLSource();
+#if !defined(OS_ANDROID)
+ // Android hasn't implemented NativeTheme::SystemDarkModeEnabled() yet, which
+ // DarkModeHandler relies on to determine "darkness".
+ DarkModeHandler::Initialize(web_ui, source);
+#endif
+ content::WebUIDataSource::Add(profile, source);
}
FlagsUI::~FlagsUI() {
diff --git a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc
index 943d9bd0818..fb31dea54af 100644
--- a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc
+++ b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc
@@ -19,7 +19,7 @@
#include "chrome/browser/ui/webui/help/help_utils_chromeos.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/power_manager_client.h"
+#include "chromeos/dbus/power/power_manager_client.h"
#include "chromeos/network/network_handler.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
diff --git a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
index 4127290b805..a19b61e6e61 100644
--- a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/fake_update_engine_client.h"
-#include "chromeos/dbus/shill_service_client.h"
+#include "chromeos/dbus/shill/shill_service_client.h"
#include "chromeos/network/network_handler.h"
#include "components/user_manager/scoped_user_manager.h"
#include "content/public/test/test_browser_thread_bundle.h"
diff --git a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.cc b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.cc
index d504f1e43b0..106d51160df 100644
--- a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.cc
+++ b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.cc
@@ -18,6 +18,7 @@
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h"
#include "components/previews/core/previews_experiments.h"
#include "components/previews/core/previews_switches.h"
+#include "net/base/features.h"
#include "net/nqe/network_quality_estimator_params.h"
#include "services/network/public/cpp/network_quality_tracker.h"
#include "services/network/public/cpp/network_switches.h"
@@ -99,7 +100,8 @@ std::string GetFeatureFlagStatus(const std::string& feature_name) {
std::string GetNonFlagEctValue() {
std::map<std::string, std::string> nqe_params;
- base::GetFieldTrialParams("NetworkQualityEstimator", &nqe_params);
+ base::GetFieldTrialParamsByFeature(net::features::kNetworkQualityEstimator,
+ &nqe_params);
if (nqe_params.find(net::kForceEffectiveConnectionType) != nqe_params.end()) {
return "Fieldtrial forced " +
nqe_params[net::kForceEffectiveConnectionType];
diff --git a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler_unittest.cc b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler_unittest.cc
index 972c02998cc..e308815f6e7 100644
--- a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler_unittest.cc
@@ -40,6 +40,7 @@
#include "components/previews/core/previews_switches.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "mojo/public/cpp/bindings/binding.h"
+#include "net/base/features.h"
#include "net/nqe/effective_connection_type.h"
#include "net/nqe/network_quality_estimator_params.h"
#include "services/network/public/cpp/network_switches.h"
@@ -543,8 +544,8 @@ TEST_F(InterventionsInternalsPageHandlerTest, GetFlagsEctForceFieldtrialValue) {
std::map<std::string, std::string> params;
params[net::kForceEffectiveConnectionType] = expected_ect;
- ASSERT_TRUE(base::AssociateFieldTrialParams(trial_name, group_name, params));
- base::FieldTrialList::CreateFieldTrial(trial_name, group_name);
+ scoped_feature_list_->InitAndEnableFeatureWithParameters(
+ net::features::kNetworkQualityEstimator, params);
page_handler_->GetPreviewsFlagsDetails(
base::BindOnce(&MockGetPreviewsFlagsCallback));
diff --git a/chromium/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc
index 4318cbcdd9e..122663b64ce 100644
--- a/chromium/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc
@@ -42,8 +42,8 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/browser_process.h"
#include "chrome/common/pref_names.h"
-#include "chromeos/account_manager/account_manager.h"
-#include "chromeos/account_manager/account_manager_factory.h"
+#include "chromeos/components/account_manager/account_manager.h"
+#include "chromeos/components/account_manager/account_manager_factory.h"
#include "chromeos/constants/chromeos_switches.h"
#include "components/prefs/pref_service.h"
#endif
diff --git a/chromium/chrome/browser/ui/webui/log_web_ui_url.cc b/chromium/chrome/browser/ui/webui/log_web_ui_url.cc
index cb42bf243ca..2c0253db04d 100644
--- a/chromium/chrome/browser/ui/webui/log_web_ui_url.cc
+++ b/chromium/chrome/browser/ui/webui/log_web_ui_url.cc
@@ -6,7 +6,7 @@
#include <stdint.h>
-#include "base/hash.h"
+#include "base/hash/hash.h"
#include "base/metrics/histogram_functions.h"
#include "chrome/common/url_constants.h"
#include "content/public/common/url_constants.h"
diff --git a/chromium/chrome/browser/ui/webui/log_web_ui_url_browsertest.cc b/chromium/chrome/browser/ui/webui/log_web_ui_url_browsertest.cc
index 47835d2bbe6..9bf7d5207f9 100644
--- a/chromium/chrome/browser/ui/webui/log_web_ui_url_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/log_web_ui_url_browsertest.cc
@@ -8,7 +8,7 @@
#include <vector>
-#include "base/hash.h"
+#include "base/hash/hash.h"
#include "base/macros.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/ui/browser.h"
diff --git a/chromium/chrome/browser/ui/webui/managed_ui_handler.cc b/chromium/chrome/browser/ui/webui/managed_ui_handler.cc
index 4a69e87e12c..538636e697d 100644
--- a/chromium/chrome/browser/ui/webui/managed_ui_handler.cc
+++ b/chromium/chrome/browser/ui/webui/managed_ui_handler.cc
@@ -7,7 +7,6 @@
#include <utility>
#include "base/bind.h"
-#include "base/feature_list.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
@@ -15,9 +14,7 @@
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/managed_ui.h"
-#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_ui.h"
@@ -123,15 +120,10 @@ std::unique_ptr<base::DictionaryValue> ManagedUIHandler::GetDataSourceUpdate()
const {
auto update = std::make_unique<base::DictionaryValue>();
- bool link_to_management_page = base::FeatureList::IsEnabled(
- features::kLinkManagedNoticeToChromeUIManagementURL);
-
update->SetKey("managedByOrg",
base::Value(l10n_util::GetStringFUTF16(
IDS_MANAGED_BY_ORG_WITH_HYPERLINK,
- base::UTF8ToUTF16(link_to_management_page
- ? chrome::kChromeUIManagementURL
- : chrome::kManagedUiLearnMoreUrl)
+ base::UTF8ToUTF16(chrome::kChromeUIManagementURL)
#if defined(OS_CHROMEOS)
,
ui::GetChromeOSDeviceName()
diff --git a/chromium/chrome/browser/ui/webui/managed_ui_handler_unittest.cc b/chromium/chrome/browser/ui/webui/managed_ui_handler_unittest.cc
index 756c7f2fedf..7f2201ca46a 100644
--- a/chromium/chrome/browser/ui/webui/managed_ui_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/managed_ui_handler_unittest.cc
@@ -7,7 +7,6 @@
#include "base/test/scoped_feature_list.h"
#include "base/token.h"
#include "base/values.h"
-#include "chrome/browser/browser_features.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h"
diff --git a/chromium/chrome/browser/ui/webui/management_a11y_browsertest.cc b/chromium/chrome/browser/ui/webui/management_a11y_browsertest.cc
new file mode 100644
index 00000000000..196f5abc01d
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/management_a11y_browsertest.cc
@@ -0,0 +1,26 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/management_a11y_browsertest.h"
+
+#include "base/path_service.h"
+#include "chrome/browser/extensions/chrome_test_extension_loader.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/common/chrome_paths.h"
+
+ManagementA11yUIBrowserTest::ManagementA11yUIBrowserTest() {
+ CHECK(base::PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_));
+ test_data_dir_ = test_data_dir_.AppendASCII("extensions");
+}
+
+ManagementA11yUIBrowserTest::~ManagementA11yUIBrowserTest() {}
+
+void ManagementA11yUIBrowserTest::InstallPowerfulPolicyEnforcedExtension() {
+ extensions::ChromeTestExtensionLoader loader(browser()->profile());
+ loader.set_ignore_manifest_warnings(true);
+ loader.set_grant_permissions(true);
+ loader.set_location(extensions::Manifest::EXTERNAL_POLICY_DOWNLOAD);
+ loader.LoadExtension(test_data_dir_.AppendASCII("good.crx"));
+}
diff --git a/chromium/chrome/browser/ui/webui/management_a11y_browsertest.h b/chromium/chrome/browser/ui/webui/management_a11y_browsertest.h
new file mode 100644
index 00000000000..a1e3bf75832
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/management_a11y_browsertest.h
@@ -0,0 +1,23 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_MANAGEMENT_A11Y_BROWSERTEST_H_
+#define CHROME_BROWSER_UI_WEBUI_MANAGEMENT_A11Y_BROWSERTEST_H_
+
+#include "base/files/file_path.h"
+#include "base/macros.h"
+#include "chrome/test/base/web_ui_browser_test.h"
+
+// C++ test fixture used by management_a11y_test.js.
+class ManagementA11yUIBrowserTest : public WebUIBrowserTest {
+ public:
+ ManagementA11yUIBrowserTest();
+ ~ManagementA11yUIBrowserTest() override;
+
+ protected:
+ void InstallPowerfulPolicyEnforcedExtension();
+ base::FilePath test_data_dir_;
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_MANAGEMENT_A11Y_BROWSERTEST_H_
diff --git a/chromium/chrome/browser/ui/webui/management_ui.cc b/chromium/chrome/browser/ui/webui/management_ui.cc
index 336a210eb9e..9b00b461b2a 100644
--- a/chromium/chrome/browser/ui/webui/management_ui.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui.cc
@@ -8,16 +8,18 @@
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/dark_mode_handler.h"
#include "chrome/browser/ui/webui/localized_string.h"
#include "chrome/browser/ui/webui/management_ui_handler.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h"
+#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
#include "components/safe_browsing/common/safebrowsing_constants.h"
#include "components/strings/grit/components_strings.h"
-#include "content/public/browser/web_ui.h"
#include "extensions/buildflags/buildflags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -27,47 +29,25 @@
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/grit/chromium_strings.h"
#include "ui/chromeos/devicetype_utils.h"
+#else // defined(OS_CHROMEOS)
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#endif // defined(OS_CHROMEOS)
namespace {
-#if defined(OS_CHROMEOS)
-
-base::string16 GetChromeOSManagementPageTitle() {
- policy::BrowserPolicyConnectorChromeOS* connector =
- g_browser_process->platform_part()->browser_policy_connector_chromeos();
- const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
- if (!connector->IsEnterpriseManaged()) {
- return l10n_util::GetStringFUTF16(IDS_MANAGEMENT_NOT_MANAGED_TITLE,
- l10n_util::GetStringUTF16(device_type));
- }
-
- std::string display_domain = connector->GetEnterpriseDisplayDomain();
-
- if (display_domain.empty()) {
- if (!connector->IsActiveDirectoryManaged()) {
- return l10n_util::GetStringFUTF16(IDS_MANAGEMENT_TITLE_MANAGED,
- l10n_util::GetStringUTF16(device_type));
- }
- display_domain = connector->GetRealm();
- }
-
- return l10n_util::GetStringFUTF16(IDS_MANAGEMENT_TITLE_BY,
- l10n_util::GetStringUTF16(device_type),
- base::UTF8ToUTF16(display_domain));
-}
-#endif // defined(OS_CHROMEOS)
-
-content::WebUIDataSource* CreateManagementUIHtmlSource() {
+content::WebUIDataSource* CreateManagementUIHtmlSource(Profile* profile) {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIManagementHost);
-#if defined(OS_CHROMEOS)
- source->AddString("title", GetChromeOSManagementPageTitle());
-#endif // defined(OS_CHROMEOS)
+ source->AddString("pageSubtitle",
+ ManagementUI::GetManagementPageSubtitle(profile));
static constexpr LocalizedString kLocalizedStrings[] = {
#if defined(OS_CHROMEOS)
+ {"learnMore", IDS_LEARN_MORE},
+ {"localTrustRoots", IDS_MANAGEMENT_LOCAL_TRUST_ROOTS},
+ {"managementTrustRootsConfigured", IDS_MANAGEMENT_TRUST_ROOTS_CONFIGURED},
{"deviceConfiguration", IDS_MANAGEMENT_DEVICE_CONFIGURATION},
{"deviceReporting", IDS_MANAGEMENT_DEVICE_REPORTING},
{kManagementLogUploadEnabled, IDS_MANAGEMENT_LOG_UPLOAD_ENABLED},
@@ -78,17 +58,20 @@ content::WebUIDataSource* CreateManagementUIHtmlSource() {
{kManagementReportNetworkInterfaces,
IDS_MANAGEMENT_REPORT_DEVICE_NETWORK_INTERFACES},
{kManagementReportUsers, IDS_MANAGEMENT_REPORT_DEVICE_USERS},
+ {kManagementPrinting, IDS_MANAGEMENT_REPORT_PRINTING},
#endif // defined(OS_CHROMEOS)
{"browserReporting", IDS_MANAGEMENT_BROWSER_REPORTING},
{"browserReportingExplanation",
IDS_MANAGEMENT_BROWSER_REPORTING_EXPLANATION},
{"extensionReporting", IDS_MANAGEMENT_EXTENSION_REPORTING},
- {"extensionsInstalled", IDS_MANAGEMENT_EXTENSIONS_INSTALLED},
+ {"extensionReportingTitle", IDS_MANAGEMENT_EXTENSIONS_INSTALLED},
{"extensionName", IDS_MANAGEMENT_EXTENSIONS_NAME},
{"extensionPermissions", IDS_MANAGEMENT_EXTENSIONS_PERMISSIONS},
- {"localTrustRoots", IDS_MANAGEMENT_LOCAL_TRUST_ROOTS},
- {"managementTrustRootsNotConfigured",
- IDS_MANAGEMENT_TRUST_ROOTS_NOT_CONFIGURED},
+ {"title", IDS_MANAGEMENT_TITLE},
+ {"toolbarTitle", IDS_MANAGEMENT_TOOLBAR_TITLE},
+ {"searchPrompt", IDS_SETTINGS_SEARCH_PROMPT},
+ {"clearSearch", IDS_DOWNLOAD_CLEAR_SEARCH},
+ {"backButton", IDS_ACCNAME_BACK},
#if BUILDFLAG(ENABLE_EXTENSIONS)
{kManagementExtensionReportMachineName,
IDS_MANAGEMENT_EXTENSION_REPORT_MACHINE_NAME},
@@ -114,15 +97,13 @@ content::WebUIDataSource* CreateManagementUIHtmlSource() {
l10n_util::GetStringFUTF16(
IDS_MANAGEMENT_EXTENSION_REPORT_SAFE_BROWSING_WARNINGS,
base::UTF8ToUTF16(safe_browsing::kSafeBrowsingUrl)));
-
-#if BUILDFLAG(ENABLE_EXTENSIONS)
-
-#endif // BUILDFLAG(ENABLE_EXTENSIONS)
-
#if defined(OS_CHROMEOS)
- source->AddLocalizedString("managementTrustRootsConfigured",
- IDS_MANAGEMENT_TRUST_ROOTS_CONFIGURED);
+ source->AddString("managementDeviceLearnMoreUrl",
+ chrome::kLearnMoreEnterpriseURL);
+ source->AddString("managementAccountLearnMoreUrl",
+ chrome::kManagedUiLearnMoreUrl);
#endif // defined(OS_CHROMEOS)
+
source->SetJsonPath("strings.js");
// Add required resources.
source->AddResourcePath("management_browser_proxy.html",
@@ -146,14 +127,55 @@ base::RefCountedMemory* ManagementUI::GetFaviconResourceBytes(
IDR_MANAGEMENT_FAVICON, scale_factor);
}
+// static
+base::string16 ManagementUI::GetManagementPageSubtitle(Profile* profile) {
+#if defined(OS_CHROMEOS)
+ policy::BrowserPolicyConnectorChromeOS* connector =
+ g_browser_process->platform_part()->browser_policy_connector_chromeos();
+ const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
+ if (!connector->IsEnterpriseManaged() &&
+ !policy::ProfilePolicyConnectorFactory::IsProfileManaged(profile)) {
+ return l10n_util::GetStringFUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE,
+ l10n_util::GetStringUTF16(device_type));
+ }
+
+ std::string display_domain = connector->GetEnterpriseDisplayDomain();
+
+ if (display_domain.empty())
+ display_domain = connector->GetRealm();
+ if (display_domain.empty())
+ display_domain = ManagementUIHandler::GetAccountDomain(profile);
+ if (display_domain.empty()) {
+ return l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED,
+ l10n_util::GetStringUTF16(device_type));
+ }
+ return l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ l10n_util::GetStringUTF16(device_type),
+ base::UTF8ToUTF16(display_domain));
+#else // defined(OS_CHROMEOS)
+ const auto management_domain = ManagementUIHandler::GetAccountDomain(profile);
+ const auto managed =
+ policy::ProfilePolicyConnectorFactory::IsProfileManaged(profile) ||
+ g_browser_process->browser_policy_connector()->HasMachineLevelPolicies();
+ if (management_domain.empty()) {
+ return l10n_util::GetStringUTF16(managed
+ ? IDS_MANAGEMENT_SUBTITLE
+ : IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE);
+ }
+ if (managed) {
+ return l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ base::UTF8ToUTF16(management_domain));
+ }
+ return l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE);
+#endif // defined(OS_CHROMEOS)
+}
+
ManagementUI::ManagementUI(content::WebUI* web_ui) : WebUIController(web_ui) {
- content::WebUIDataSource* source = CreateManagementUIHtmlSource();
- Profile* profile = Profile::FromWebUI(web_ui);
- auto management_ui_handler = std::make_unique<ManagementUIHandler>();
- management_ui_handler->InitializeManagementContextualStrings(profile, source);
- web_ui->AddMessageHandler(std::move(management_ui_handler));
+ content::WebUIDataSource* source =
+ CreateManagementUIHtmlSource(Profile::FromWebUI(web_ui));
+ ManagementUIHandler::Initialize(web_ui, source);
DarkModeHandler::Initialize(web_ui, source);
- content::WebUIDataSource::Add(profile, source);
+ content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
}
ManagementUI::~ManagementUI() {}
diff --git a/chromium/chrome/browser/ui/webui/management_ui.h b/chromium/chrome/browser/ui/webui/management_ui.h
index f3be72a22ed..86f66238d9b 100644
--- a/chromium/chrome/browser/ui/webui/management_ui.h
+++ b/chromium/chrome/browser/ui/webui/management_ui.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_WEBUI_MANAGEMENT_UI_H_
#include "base/macros.h"
+#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_ui_controller.h"
#include "ui/base/resource/scale_factor.h"
@@ -26,6 +27,8 @@ class ManagementUI : public content::WebUIController {
static base::RefCountedMemory* GetFaviconResourceBytes(
ui::ScaleFactor scale_factor);
+ static base::string16 GetManagementPageSubtitle(Profile* profile);
+
private:
DISALLOW_COPY_AND_ASSIGN(ManagementUI);
};
diff --git a/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc
new file mode 100644
index 00000000000..efc934ad8b1
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc
@@ -0,0 +1,130 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/json/json_reader.h"
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/policy/chrome_browser_policy_connector.h"
+#include "chrome/browser/policy/profile_policy_connector.h"
+#include "chrome/browser/policy/profile_policy_connector_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/webui/management_ui.h"
+#include "chrome/browser/ui/webui/management_ui_handler.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
+#include "components/policy/core/common/mock_configuration_policy_provider.h"
+#include "components/strings/grit/components_strings.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/test/browser_test_utils.h"
+#include "ui/base/l10n/l10n_util.h"
+
+class ManagementUITest : public InProcessBrowserTest {
+ public:
+ ManagementUITest() = default;
+ ~ManagementUITest() override = default;
+
+ void SetUpInProcessBrowserTestFixture() override {
+ EXPECT_CALL(provider_, IsInitializationComplete(testing::_))
+ .WillRepeatedly(testing::Return(true));
+ policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
+ }
+
+ void VerifyTexts(base::Value* actual_values,
+ std::map<std::string, base::string16>& expected_values) {
+ base::DictionaryValue* values_as_dict = NULL;
+ actual_values->GetAsDictionary(&values_as_dict);
+ for (const auto& val : expected_values) {
+ base::string16 actual_value;
+ values_as_dict->GetString(val.first, &actual_value);
+ ASSERT_EQ(actual_value, val.second);
+ }
+ }
+ policy::MockConfigurationPolicyProvider* provider() { return &provider_; }
+
+ policy::ProfilePolicyConnector* profile_policy_connector() {
+ return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(
+ browser()->profile());
+ }
+
+ private:
+ policy::MockConfigurationPolicyProvider provider_;
+
+ DISALLOW_COPY_AND_ASSIGN(ManagementUITest);
+};
+
+#if !defined(OS_CHROMEOS)
+IN_PROC_BROWSER_TEST_F(ManagementUITest, ManagementStateChange) {
+ profile_policy_connector()->OverrideIsManagedForTesting(false);
+ ui_test_utils::NavigateToURL(browser(), GURL("chrome://management"));
+
+ // The browser is not managed.
+ const std::string javascript =
+ "management.ManagementBrowserProxyImpl.getInstance()"
+ " .getContextualManagedData()"
+ " .then(managed_result => "
+ " domAutomationController.send(JSON.stringify(managed_result)));";
+
+ content::WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ std::string unmanaged_json;
+ ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents, javascript,
+ &unmanaged_json));
+
+ std::unique_ptr<base::Value> unmanaged_value_ptr =
+ base::JSONReader::ReadDeprecated(unmanaged_json);
+ std::map<std::string, base::string16> expected_unmanaged_values{
+ {"browserManagementNotice",
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl))},
+ {"extensionReportingTitle",
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED)},
+ {"pageSubtitle",
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE)},
+ {"accountManagedInfo.overview", base::string16()},
+ {"accountManagedInfo.data", base::string16()},
+ {"accountManagedInfo.setup", base::string16()},
+ };
+
+ VerifyTexts(unmanaged_value_ptr.get(), expected_unmanaged_values);
+
+ // The browser is managed.
+ profile_policy_connector()->OverrideIsManagedForTesting(true);
+
+ policy::PolicyMap policy_map;
+ policy_map.Set("test-policy", policy::POLICY_LEVEL_MANDATORY,
+ policy::POLICY_SCOPE_MACHINE, policy::POLICY_SOURCE_PLATFORM,
+ std::make_unique<base::Value>("hello world"), nullptr);
+ provider()->UpdateExtensionPolicy(policy_map,
+ kOnPremReportingExtensionBetaId);
+
+ contents = browser()->tab_strip_model()->GetActiveWebContents();
+ std::string managed_json;
+
+ ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents, javascript,
+ &managed_json));
+
+ std::unique_ptr<base::Value> managed_value_ptr =
+ base::JSONReader::ReadDeprecated(managed_json);
+ std::map<std::string, base::string16> expected_managed_values{
+ {"browserManagementNotice",
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_BROWSER_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl))},
+ {"extensionReportingTitle",
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED)},
+ {"pageSubtitle", l10n_util::GetStringUTF16(IDS_MANAGEMENT_SUBTITLE)},
+ {"accountManagedInfo.overview",
+ l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION_UNKNOWN_DOMAIN)},
+ {"accountManagedInfo.data",
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA)},
+ {"accountManagedInfo.setup",
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP)},
+ };
+
+ VerifyTexts(managed_value_ptr.get(), expected_managed_values);
+}
+#endif // !defined(OS_CHROMEOS)
diff --git a/chromium/chrome/browser/ui/webui/management_ui_handler.cc b/chromium/chrome/browser/ui/webui/management_ui_handler.cc
index 6535e87431f..d276f4c01e7 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_handler.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui_handler.cc
@@ -34,14 +34,16 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
-#include "chrome/browser/chromeos/policy/device_status_collector.h"
#include "chrome/browser/chromeos/policy/policy_cert_service.h"
#include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
+#include "chrome/browser/chromeos/policy/status_collector/device_status_collector.h"
#include "chrome/browser/chromeos/policy/status_uploader.h"
#include "chrome/browser/chromeos/policy/system_log_uploader.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/grit/chromium_strings.h"
+#include "components/prefs/pref_service.h"
#include "components/user_manager/user_manager.h"
+#include "ui/chromeos/devicetype_utils.h"
#endif // defined(OS_CHROMEOS)
#if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -107,12 +109,21 @@ enum class ReportingType {
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+#if defined(OS_CHROMEOS)
const char kManagementLogUploadEnabled[] = "managementLogUploadEnabled";
const char kManagementReportActivityTimes[] = "managementReportActivityTimes";
const char kManagementReportHardwareStatus[] = "managementReportHardwareStatus";
const char kManagementReportNetworkInterfaces[] =
"managementReportNetworkInterfaces";
const char kManagementReportUsers[] = "managementReportUsers";
+const char kManagementPrinting[] = "managementPrinting";
+const char kDeviceManagedInfo[] = "deviceManagedInfo";
+#endif // defined(OS_CHROMEOS)
+
+const char kOverview[] = "overview";
+const char kAccountManagedInfo[] = "accountManagedInfo";
+const char kSetup[] = "setup";
+const char kData[] = "data";
namespace {
@@ -120,6 +131,14 @@ bool IsProfileManaged(Profile* profile) {
return policy::ProfilePolicyConnectorFactory::IsProfileManaged(profile);
}
+#if defined(OS_CHROMEOS)
+bool IsDeviceManaged() {
+ policy::BrowserPolicyConnectorChromeOS* connector =
+ g_browser_process->platform_part()->browser_policy_connector_chromeos();
+ return connector->IsEnterpriseManaged();
+}
+#endif // defined(OS_CHROMEOS)
+
#if !defined(OS_CHROMEOS)
bool IsBrowserManaged() {
return g_browser_process->browser_policy_connector()
@@ -127,70 +146,6 @@ bool IsBrowserManaged() {
}
#endif // !defined(OS_CHROMEOS)
-std::string GetAccountDomain(Profile* profile) {
- auto username = profile->GetProfileUserName();
- size_t email_separator_pos = username.find('@');
- bool is_email = email_separator_pos != std::string::npos &&
- email_separator_pos < username.length() - 1;
-
- if (!is_email)
- return std::string();
-
- const std::string domain = gaia::ExtractDomainName(std::move(username));
-
- auto consumer_domain_pos = domain.find("gmail.com");
- if (consumer_domain_pos == std::string::npos)
- consumer_domain_pos = domain.find("googlemail.com");
-
- return consumer_domain_pos == std::string::npos ? domain : std::string();
-}
-
-#if !defined(OS_CHROMEOS)
-void GetDataManagementBrowserContextualSourceUpdate(
- base::DictionaryValue* update,
- Profile* profile,
- bool managed) {
- auto management_domain = GetAccountDomain(profile);
-
- if (management_domain.empty()) {
- update->SetString(
- "extensionsInstalled",
- l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
-
- update->SetString("browserManagementNotice",
- l10n_util::GetStringFUTF16(
- managed ? IDS_MANAGEMENT_BROWSER_NOTICE
- : IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
- base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
- update->SetString("title", l10n_util::GetStringUTF16(
- managed ? IDS_MANAGEMENT_TITLE
- : IDS_MANAGEMENT_NOT_MANAGED_TITLE));
-
- } else {
- update->SetString(
- "extensionsInstalled",
- l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
- base::UTF8ToUTF16(management_domain)));
-
- update->SetString(
- "browserManagementNotice",
- managed ? l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_MANAGEMENT_BY_NOTICE,
- base::UTF8ToUTF16(management_domain),
- base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl))
- : l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
- base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
- update->SetString(
- "title",
- managed
- ? l10n_util::GetStringFUTF16(IDS_MANAGEMENT_TITLE_BY,
- base::UTF8ToUTF16(management_domain))
- : l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_TITLE));
- }
-}
-#endif // !defined(OS_CHROMEOS)
-
#if defined(OS_CHROMEOS)
enum class DeviceReportingType {
@@ -198,7 +153,8 @@ enum class DeviceReportingType {
kDeviceActivity,
kDeviceStatistics,
kDevice,
- kLogs
+ kLogs,
+ kPrint
};
// Corresponds to DeviceReportingType in management_browser_proxy.js
@@ -214,6 +170,8 @@ std::string ToJSDeviceReportingType(const DeviceReportingType& type) {
return "device";
case DeviceReportingType::kLogs:
return "logs";
+ case DeviceReportingType::kPrint:
+ return "print";
default:
NOTREACHED() << "Unknown device reporting type";
return "device";
@@ -229,7 +187,7 @@ void AddDeviceReportingElement(base::Value* report_sources,
report_sources->GetList().push_back(std::move(data));
}
-void AddDeviceReportingInfo(base::Value* report_sources) {
+void AddDeviceReportingInfo(base::Value* report_sources, Profile* profile) {
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
@@ -243,24 +201,24 @@ void AddDeviceReportingInfo(base::Value* report_sources) {
if (!manager)
return;
- const policy::DeviceStatusCollector* collector =
- manager->GetStatusUploader()->device_status_collector();
+ const policy::StatusCollector* collector =
+ manager->GetStatusUploader()->status_collector();
// Elements appear on the page in the order they are added.
- if (collector->report_activity_times()) {
+ if (collector->ShouldReportActivityTimes()) {
AddDeviceReportingElement(report_sources, kManagementReportActivityTimes,
DeviceReportingType::kDeviceActivity);
} else {
- if (collector->report_users()) {
+ if (collector->ShouldReportUsers()) {
AddDeviceReportingElement(report_sources, kManagementReportUsers,
DeviceReportingType::kSupervisedUser);
}
}
- if (collector->report_hardware_status()) {
+ if (collector->ShouldReportHardwareStatus()) {
AddDeviceReportingElement(report_sources, kManagementReportHardwareStatus,
DeviceReportingType::kDeviceStatistics);
}
- if (collector->report_network_interfaces()) {
+ if (collector->ShouldReportNetworkInterfaces()) {
AddDeviceReportingElement(report_sources,
kManagementReportNetworkInterfaces,
DeviceReportingType::kDevice);
@@ -269,6 +227,12 @@ void AddDeviceReportingInfo(base::Value* report_sources) {
AddDeviceReportingElement(report_sources, kManagementLogUploadEnabled,
DeviceReportingType::kLogs);
}
+
+ if (profile->GetPrefs()->GetBoolean(
+ prefs::kPrintingSendUsernameAndFilenameEnabled)) {
+ AddDeviceReportingElement(report_sources, kManagementPrinting,
+ DeviceReportingType::kPrint);
+ }
}
#endif // defined(OS_CHROMEOS)
@@ -337,6 +301,26 @@ const char* GetReportingTypeValue(ReportingType reportingType) {
} // namespace
+// TODO(raleksandov) Move to util class or smth similar.
+// static
+std::string ManagementUIHandler::GetAccountDomain(Profile* profile) {
+ auto username = profile->GetProfileUserName();
+ size_t email_separator_pos = username.find('@');
+ bool is_email = email_separator_pos != std::string::npos &&
+ email_separator_pos < username.length() - 1;
+
+ if (!is_email)
+ return std::string();
+
+ const std::string domain = gaia::ExtractDomainName(std::move(username));
+
+ auto consumer_domain_pos = domain.find("gmail.com");
+ if (consumer_domain_pos == std::string::npos)
+ consumer_domain_pos = domain.find("googlemail.com");
+
+ return consumer_domain_pos == std::string::npos ? domain : std::string();
+}
+
ManagementUIHandler::ManagementUIHandler() {
#if BUILDFLAG(ENABLE_EXTENSIONS)
reporting_extension_ids_ = {kOnPremReportingExtensionStableId,
@@ -346,29 +330,32 @@ ManagementUIHandler::ManagementUIHandler() {
}
ManagementUIHandler::~ManagementUIHandler() {
-#if BUILDFLAG(ENABLE_EXTENSIONS)
- RemoveObservers();
-#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+ DisallowJavascript();
+}
+
+void ManagementUIHandler::Initialize(content::WebUI* web_ui,
+ content::WebUIDataSource* source) {
+ InitializeInternal(web_ui, source, Profile::FromWebUI(web_ui));
}
+// static
+void ManagementUIHandler::InitializeInternal(content::WebUI* web_ui,
+ content::WebUIDataSource* source,
+ Profile* profile) {
+ auto handler = std::make_unique<ManagementUIHandler>();
-void ManagementUIHandler::InitializeManagementContextualStrings(
- Profile* profile,
- content::WebUIDataSource* web_data_source) {
#if defined(OS_CHROMEOS)
- managed_ = IsProfileManaged(profile);
+ handler->managed_ = IsProfileManaged(profile) || IsDeviceManaged();
#else
- managed_ = IsProfileManaged(profile) || IsBrowserManaged();
+ handler->managed_ = IsProfileManaged(profile) || IsBrowserManaged();
#endif // defined(OS_CHROMEOS)
- web_data_source->AddLocalizedStrings(
- *GetDataManagementContextualSourceUpdate(profile));
- web_ui_data_source_name_ = web_data_source->GetSource();
+ web_ui->AddMessageHandler(std::move(handler));
}
void ManagementUIHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
- "getDeviceManagementStatus",
- base::BindRepeating(&ManagementUIHandler::HandleGetDeviceManagementStatus,
+ "getContextualManagedData",
+ base::BindRepeating(&ManagementUIHandler::HandleGetContextualManagedData,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"getExtensions",
@@ -391,6 +378,10 @@ void ManagementUIHandler::RegisterMessages() {
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
+void ManagementUIHandler::OnJavascriptAllowed() {
+ AddObservers();
+}
+
void ManagementUIHandler::OnJavascriptDisallowed() {
RemoveObservers();
}
@@ -492,7 +483,88 @@ void ManagementUIHandler::AddExtensionReportingInfo(
}
}
-const policy::PolicyService* ManagementUIHandler::GetPolicyService() const {
+base::DictionaryValue ManagementUIHandler::GetContextualManagedData(
+ Profile* profile) const {
+ base::DictionaryValue response;
+
+#if defined(OS_CHROMEOS)
+ policy::BrowserPolicyConnectorChromeOS* connector =
+ g_browser_process->platform_part()->browser_policy_connector_chromeos();
+ std::string management_domain = connector->GetEnterpriseDisplayDomain();
+ if (management_domain.empty())
+ management_domain = connector->GetRealm();
+ if (management_domain.empty())
+ management_domain = GetAccountDomain(profile);
+#else
+ std::string management_domain = GetAccountDomain(profile);
+#endif
+
+ if (management_domain.empty()) {
+ response.SetString(
+ "extensionReportingTitle",
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
+
+#if !defined(OS_CHROMEOS)
+ response.SetString("browserManagementNotice",
+ l10n_util::GetStringFUTF16(
+ managed_ ? IDS_MANAGEMENT_BROWSER_NOTICE
+ : IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
+ response.SetString("pageSubtitle",
+ l10n_util::GetStringUTF16(
+ managed_ ? IDS_MANAGEMENT_SUBTITLE
+ : IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
+#else
+ const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
+ response.SetString("pageSubtitle",
+ managed_ ? l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_SUBTITLE_MANAGED,
+ l10n_util::GetStringUTF16(device_type))
+ : l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE,
+ l10n_util::GetStringUTF16(device_type)));
+#endif // !defined(OS_CHROMEOS)
+
+ } else {
+ response.SetString(
+ "extensionReportingTitle",
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
+ base::UTF8ToUTF16(management_domain)));
+
+#if !defined(OS_CHROMEOS)
+ response.SetString(
+ "browserManagementNotice",
+ managed_ ? l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_MANAGEMENT_BY_NOTICE,
+ base::UTF8ToUTF16(management_domain),
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl))
+ : l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
+ response.SetString(
+ "pageSubtitle",
+ managed_
+ ? l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ base::UTF8ToUTF16(management_domain))
+ : l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
+#else
+ const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
+ response.SetString("pageSubtitle",
+ managed_ ? l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ l10n_util::GetStringUTF16(device_type),
+ base::UTF8ToUTF16(management_domain))
+ : l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE,
+ l10n_util::GetStringUTF16(device_type)));
+#endif // !defined(OS_CHROMEOS)
+ }
+ response.SetBoolean("managed", managed_);
+ GetManagementStatus(profile, &response);
+ return response;
+}
+
+policy::PolicyService* ManagementUIHandler::GetPolicyService() const {
return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(
Profile::FromWebUI(web_ui()))
->policy_service();
@@ -506,43 +578,130 @@ const extensions::Extension* ManagementUIHandler::GetEnabledExtension(
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
-std::unique_ptr<base::DictionaryValue>
-ManagementUIHandler::GetDataManagementContextualSourceUpdate(
- Profile* profile) const {
- auto update = std::make_unique<base::DictionaryValue>();
-#if !defined(OS_CHROMEOS)
- GetDataManagementBrowserContextualSourceUpdate(update.get(), profile,
- managed_);
-#endif // !defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS)
+void AddStatusDeviceManagedInfo(base::Value* status,
+ const std::string& device_domain) {
+ base::Value info(base::Value::Type::DICTIONARY);
+ info.SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_DEVICE_MANAGED_CLARIFICATION,
+ base::UTF8ToUTF16(device_domain))));
+ info.SetKey(kSetup, base::Value(l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_DEVICE_MANAGED_SETUP)));
+ info.SetKey(kData, base::Value(l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_DEVICE_MANAGED_DATA)));
+ status->SetKey(kDeviceManagedInfo, std::move(info));
+}
+
+void AddStatusDeviceAndAccountManagedInfo(
+ base::Value* status,
+ const std::string& device_and_account_domain) {
+ base::Value info(base::Value::Type::DICTIONARY);
+ info.SetKey(kOverview,
+ base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_CLARIFICATION,
+ base::UTF8ToUTF16(device_and_account_domain))));
+ info.SetKey(kSetup, base::Value(l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_SETUP)));
+ info.SetKey(kData, base::Value(l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_DATA)));
+ status->SetKey(kDeviceManagedInfo, std::move(info));
+}
+#endif // defined(OS_CHROMEOS)
- return update;
+void AddStatusAccountManagedInfo(base::Value* status,
+ const std::string& account_domain) {
+ base::Value info(base::Value::Type::DICTIONARY);
+ if (account_domain.empty()) {
+ info.SetKey(
+ kOverview,
+ base::Value(l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION_UNKNOWN_DOMAIN)));
+ } else {
+ info.SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION,
+ base::UTF8ToUTF16(account_domain))));
+ }
+ info.SetKey(kSetup, base::Value(l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP)));
+ info.SetKey(kData, base::Value(l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA)));
+ status->SetKey(kAccountManagedInfo, std::move(info));
}
-base::string16 ManagementUIHandler::GetEnterpriseManagementStatusString() {
- auto* profile = Profile::FromWebUI(web_ui());
- const bool account_managed = IsProfileManaged(profile);
+#if defined(OS_CHROMEOS)
+void AddStatusOverviewManagedDeviceAndAccount(
+ base::Value* status,
+ const std::string& device_domain,
+ const std::string& account_domain) {
+ status->SetKey(kOverview,
+ base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY,
+ base::UTF8ToUTF16(device_domain),
+ base::UTF8ToUTF16(account_domain))));
+ AddStatusDeviceManagedInfo(status, device_domain);
+ AddStatusAccountManagedInfo(status, account_domain);
+}
+
+void AddStatusOverviewManagedDeviceAndAccount(
+ base::Value* status,
+ const std::string& device_and_account_domain) {
+ status->SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY,
+ base::UTF8ToUTF16(device_and_account_domain))));
+ AddStatusDeviceAndAccountManagedInfo(status, device_and_account_domain);
+ status->SetKey(kAccountManagedInfo, base::Value());
+}
+
+void AddStatusOverviewManagedDevice(base::Value* status,
+ const std::string& device_domain) {
+ status->SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_DEVICE_MANAGED_BY,
+ base::UTF8ToUTF16(device_domain))));
+ AddStatusDeviceManagedInfo(status, device_domain);
+ status->SetKey(kAccountManagedInfo, base::Value());
+}
+
+#endif // defined(OS_CHROMEOS)
+
+void AddStatusOverviewManagedAccount(base::Value* status,
+ const std::string& account_domain) {
+#if defined(OS_CHROMEOS)
+ status->SetKey(kOverview, base::Value(l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_ACCOUNT_MANAGED_BY,
+ base::UTF8ToUTF16(account_domain))));
+ status->SetKey(kDeviceManagedInfo, base::Value());
+#endif // defined(OS_CHROMEOS)
+ AddStatusAccountManagedInfo(status, account_domain);
+}
+
+#if defined(OS_CHROMEOS)
+void AddStatusOverviewNotManaged(base::Value* status) {
+ status->SetKey(kOverview, base::Value(l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_DEVICE_NOT_MANAGED)));
+ status->SetKey(kAccountManagedInfo, base::Value());
+ status->SetKey(kDeviceManagedInfo, base::Value());
+}
+#endif // defined(OS_CHROMEOS)
+
+void ManagementUIHandler::GetManagementStatus(Profile* profile,
+ base::Value* status) const {
const std::string account_domain = GetAccountDomain(profile);
- bool profile_associated_with_gaia_account = true;
#if defined(OS_CHROMEOS)
- profile_associated_with_gaia_account =
+ const bool account_managed = IsProfileManaged(profile);
+ const bool profile_associated_with_gaia_account =
chromeos::IsProfileAssociatedWithGaiaAccount(profile);
-#endif // defined(OS_CHROMEOS)
- bool device_managed = false;
std::string device_domain;
-#if defined(OS_CHROMEOS)
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
- device_managed = connector->IsEnterpriseManaged();
+ const bool device_managed = connector->IsEnterpriseManaged();
if (device_managed)
device_domain = connector->GetEnterpriseDisplayDomain();
if (device_domain.empty() && connector->IsActiveDirectoryManaged())
device_domain = connector->GetRealm();
-#endif // defined(OS_CHROMEOS)
bool primary_user_managed = false;
std::string primary_user_account_domain;
-#if defined(OS_CHROMEOS)
auto* primary_user = user_manager::UserManager::Get()->GetPrimaryUser();
if (primary_user) {
auto* primary_profile =
@@ -552,47 +711,38 @@ base::string16 ManagementUIHandler::GetEnterpriseManagementStatusString() {
primary_user_account_domain = GetAccountDomain(primary_profile);
}
}
-#endif // defined(OS_CHROMEOS)
if (device_managed) {
DCHECK(!device_domain.empty());
if (account_managed) {
if (device_domain == account_domain ||
!profile_associated_with_gaia_account) {
- return l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY,
- base::UTF8ToUTF16(device_domain));
+ AddStatusOverviewManagedDeviceAndAccount(status, device_domain);
+ return;
}
DCHECK(!account_domain.empty());
- return l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY,
- base::UTF8ToUTF16(device_domain), base::UTF8ToUTF16(account_domain));
+ AddStatusOverviewManagedDeviceAndAccount(status, device_domain,
+ account_domain);
+ return;
}
- return l10n_util::GetStringFUTF16(IDS_MANAGEMENT_DEVICE_MANAGED_BY,
- base::UTF8ToUTF16(device_domain));
- }
-
- if (account_managed) {
- return l10n_util::GetStringFUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_BY,
- base::UTF8ToUTF16(account_domain));
+ AddStatusOverviewManagedDevice(status, device_domain);
+ return;
}
if (primary_user_managed) {
- return l10n_util::GetStringFUTF16(
- IDS_MANAGEMENT_ACCOUNT_MANAGED_BY,
- base::UTF8ToUTF16(primary_user_account_domain));
+ AddStatusOverviewManagedAccount(status, primary_user_account_domain);
+ return;
}
+#endif // defined(OS_CHROMEOS)
- return l10n_util::GetStringUTF16(IDS_MANAGEMENT_DEVICE_NOT_MANAGED);
-}
+ if (managed_) {
+ AddStatusOverviewManagedAccount(status, account_domain);
+ return;
+ }
-void ManagementUIHandler::HandleGetDeviceManagementStatus(
- const base::ListValue* args) {
- base::RecordAction(base::UserMetricsAction("ManagementPageViewed"));
- AllowJavascript();
- base::Value managed_string(GetEnterpriseManagementStatusString());
- ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
- managed_string);
+#if defined(OS_CHROMEOS)
+ AddStatusOverviewNotManaged(status);
+#endif // defined(OS_CHROMEOS)
}
void ManagementUIHandler::HandleGetExtensions(const base::ListValue* args) {
@@ -635,13 +785,20 @@ void ManagementUIHandler::HandleGetDeviceReportingInfo(
base::Value report_sources(base::Value::Type::LIST);
AllowJavascript();
- AddDeviceReportingInfo(&report_sources);
+ AddDeviceReportingInfo(&report_sources, Profile::FromWebUI(web_ui()));
ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
report_sources);
}
#endif // defined(OS_CHROMEOS)
+void ManagementUIHandler::HandleGetContextualManagedData(
+ const base::ListValue* args) {
+ AllowJavascript();
+ auto result = GetContextualManagedData(Profile::FromWebUI(web_ui()));
+ ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
+ std::move(result));
+}
void ManagementUIHandler::HandleInitBrowserReportingInfo(
const base::ListValue* args) {
@@ -649,7 +806,6 @@ void ManagementUIHandler::HandleInitBrowserReportingInfo(
AllowJavascript();
#if BUILDFLAG(ENABLE_EXTENSIONS)
AddExtensionReportingInfo(&report_sources);
- AddObservers();
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
report_sources);
@@ -684,7 +840,7 @@ void ManagementUIHandler::OnExtensionUnloaded(
void ManagementUIHandler::OnManagedStateChanged() {
auto* profile = Profile::FromWebUI(web_ui());
#if defined(OS_CHROMEOS)
- bool managed = IsProfileManaged(profile);
+ bool managed = IsProfileManaged(profile) || IsDeviceManaged();
#else
bool managed = IsProfileManaged(profile) || IsBrowserManaged();
#endif // defined(OS_CHROMEOS)
@@ -694,31 +850,13 @@ void ManagementUIHandler::OnManagedStateChanged() {
managed_ = managed;
- auto data_source_update = GetDataManagementContextualSourceUpdate(profile);
- FireWebUIListener("update-load-time-data", data_source_update->Clone());
-
- content::WebUIDataSource::Update(profile, web_ui_data_source_name_,
- std::move(data_source_update));
+ FireWebUIListener("managed_state_changed");
}
void ManagementUIHandler::OnPolicyUpdated(
- const policy::PolicyNamespace& ns,
+ const policy::PolicyNamespace& /*ns*/,
const policy::PolicyMap& /*previous*/,
const policy::PolicyMap& /*current*/) {
- const policy::PolicyNamespace
- on_prem_reporting_extension_stable_policy_namespace =
- policy::PolicyNamespace(policy::POLICY_DOMAIN_EXTENSIONS,
- kOnPremReportingExtensionStableId);
- const policy::PolicyNamespace
- on_prem_reporting_extension_beta_policy_namespace =
- policy::PolicyNamespace(policy::POLICY_DOMAIN_EXTENSIONS,
- kOnPremReportingExtensionBetaId);
-
- if (ns == on_prem_reporting_extension_stable_policy_namespace ||
- ns == on_prem_reporting_extension_beta_policy_namespace) {
- return;
- }
-
OnManagedStateChanged();
NotifyBrowserReportingInfoUpdated();
}
@@ -733,9 +871,7 @@ void ManagementUIHandler::AddObservers() {
extensions::ExtensionRegistry::Get(profile)->AddObserver(this);
- policy::PolicyService* policy_service =
- policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile)
- ->policy_service();
+ auto* policy_service = GetPolicyService();
policy_service->AddObserver(policy::POLICY_DOMAIN_EXTENSIONS, this);
pref_registrar_.Init(profile->GetPrefs());
diff --git a/chromium/chrome/browser/ui/webui/management_ui_handler.h b/chromium/chrome/browser/ui/webui/management_ui_handler.h
index 28cf7d19699..daca8ea6eb1 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_handler.h
+++ b/chromium/chrome/browser/ui/webui/management_ui_handler.h
@@ -9,6 +9,7 @@
#include <set>
#include <string>
+#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/strings/string16.h"
#include "chrome/common/url_constants.h"
@@ -23,6 +24,7 @@
#include "extensions/browser/extension_registry_observer.h"
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+#if defined(OS_CHROMEOS)
// Constants defining the IDs for the localized strings sent to the page as
// load time data.
extern const char kManagementLogUploadEnabled[];
@@ -30,6 +32,8 @@ extern const char kManagementReportActivityTimes[];
extern const char kManagementReportHardwareStatus[];
extern const char kManagementReportNetworkInterfaces[];
extern const char kManagementReportUsers[];
+extern const char kManagementPrinting[];
+#endif // defined(OS_CHROMEOS)
#if BUILDFLAG(ENABLE_EXTENSIONS)
extern const char kCloudReportingExtensionId[];
@@ -77,7 +81,6 @@ class PolicyService;
class Profile;
// The JavaScript message handler for the chrome://management page.
-// TODO(ydago): Increase test coverage of this class
#if BUILDFLAG(ENABLE_EXTENSIONS)
class ManagementUIHandler : public content::WebUIMessageHandler,
public extensions::ExtensionRegistryObserver,
@@ -89,30 +92,35 @@ class ManagementUIHandler : public content::WebUIMessageHandler {
ManagementUIHandler();
~ManagementUIHandler() override;
- void InitializeManagementContextualStrings(
- Profile* profile,
- content::WebUIDataSource* web_data_source);
+ static void Initialize(content::WebUI* web_ui,
+ content::WebUIDataSource* source);
+
// content::WebUIMessageHandler implementation.
void RegisterMessages() override;
+ void SetManagedForTesting(bool managed) { managed_ = managed; }
+
+ static std::string GetAccountDomain(Profile* profile);
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
+ void OnJavascriptAllowed() override;
void OnJavascriptDisallowed() override;
protected:
+ // Protected for testing.
+ static void InitializeInternal(content::WebUI* web_ui,
+ content::WebUIDataSource* source,
+ Profile* profile);
void AddExtensionReportingInfo(base::Value* report_sources);
- virtual const policy::PolicyService* GetPolicyService() const;
+ base::DictionaryValue GetContextualManagedData(Profile* profile) const;
+ virtual policy::PolicyService* GetPolicyService() const;
virtual const extensions::Extension* GetEnabledExtension(
const std::string& extensionId) const;
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
private:
- std::unique_ptr<base::DictionaryValue>
- GetDataManagementContextualSourceUpdate(Profile* profile) const;
-
- base::string16 GetEnterpriseManagementStatusString();
-
- void HandleGetDeviceManagementStatus(const base::ListValue* args);
+ void GetManagementStatus(Profile* profile, base::Value* status) const;
#if defined(OS_CHROMEOS)
void HandleGetDeviceReportingInfo(const base::ListValue* args);
@@ -124,6 +132,7 @@ class ManagementUIHandler : public content::WebUIMessageHandler {
void HandleGetLocalTrustRootsInfo(const base::ListValue* args);
#endif // defined(OS_CHROMEOS)
+ void HandleGetContextualManagedData(const base::ListValue* args);
void HandleInitBrowserReportingInfo(const base::ListValue* args);
#if BUILDFLAG(ENABLE_EXTENSIONS)
diff --git a/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc b/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc
index 4bc787f78cd..f081a564856 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc
@@ -6,20 +6,42 @@
#include <set>
#include <string>
+#include "base/strings/utf_string_conversions.h"
+
#include "chrome/browser/ui/webui/management_ui_handler.h"
+#include "chrome/test/base/testing_profile.h"
#include "components/policy/core/common/mock_policy_service.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_service.h"
+#include "components/strings/grit/components_strings.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/l10n/l10n_util.h"
+
+#if defined(OS_CHROMEOS)
+#include "ui/chromeos/devicetype_utils.h"
+#endif // defined(OS_CHROMEOS)
+
using testing::_;
+using testing::Return;
using testing::ReturnRef;
+struct ContextualManagementSourceUpdate {
+ base::string16* extension_reporting_title;
+ base::string16* browser_management_notice;
+ base::string16* subtitle;
+ base::string16* management_overview;
+ base::string16* management_overview_data_notice;
+ base::string16* management_overview_setup_notice;
+ bool* managed;
+};
+
class TestManagementUIHandler : public ManagementUIHandler {
public:
TestManagementUIHandler() = default;
@@ -31,13 +53,18 @@ class TestManagementUIHandler : public ManagementUIHandler {
cloud_reporting_extension_exists_ = enable;
}
+ base::DictionaryValue GetContextualManagedDataForTesting(
+ Profile* profile) const {
+ return GetContextualManagedData(profile);
+ }
+
base::Value GetExtensionReportingInfo() {
base::Value report_sources(base::Value::Type::LIST);
AddExtensionReportingInfo(&report_sources);
return report_sources;
}
- const policy::PolicyService* GetPolicyService() const override {
+ policy::PolicyService* GetPolicyService() const override {
return policy_service_;
}
@@ -66,12 +93,348 @@ class ManagementUIHandlerTests : public testing::Test {
std::make_unique<base::Value>(true), nullptr);
}
+ void ExtractContextualSourceUpdate(
+ const base::DictionaryValue& data,
+ const ContextualManagementSourceUpdate& extracted) {
+ data.GetString("extensionReportingTitle",
+ extracted.extension_reporting_title);
+ data.GetString("browserManagementNotice",
+ extracted.browser_management_notice);
+ data.GetString("pageSubtitle", extracted.subtitle);
+ data.GetString("accountManagedInfo.overview",
+ extracted.management_overview);
+ data.GetString("accountManagedInfo.data",
+ extracted.management_overview_data_notice);
+ data.GetString("accountManagedInfo.setup",
+ extracted.management_overview_setup_notice);
+ data.GetBoolean("managed", extracted.managed);
+ }
+
protected:
TestManagementUIHandler handler_;
+ content::TestBrowserThreadBundle thread_bundle_;
policy::MockPolicyService policy_service_;
policy::PolicyMap empty_policy_map_;
};
+#if !defined(OS_CHROMEOS)
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateUnmanagedNoDomain) {
+ auto profile = TestingProfile::Builder().Build();
+
+ base::string16 extension_reporting_title;
+ base::string16 browser_management_notice;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ base::string16 management_overview_data_notice;
+ base::string16 management_overview_setup_notice;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{&extension_reporting_title,
+ &browser_management_notice,
+ &subtitle,
+ &management_overview,
+ &management_overview_data_notice,
+ &management_overview_setup_notice,
+ &managed};
+
+ handler_.SetManagedForTesting(false);
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(data.DictSize(), 4u);
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
+ EXPECT_EQ(browser_management_notice,
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
+ EXPECT_EQ(management_overview, base::string16());
+ EXPECT_EQ(management_overview_data_notice, base::string16());
+ EXPECT_EQ(management_overview_setup_notice, base::string16());
+}
+
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateManagedNoDomain) {
+ auto profile = TestingProfile::Builder().Build();
+
+ base::string16 extension_reporting_title;
+ base::string16 browser_management_notice;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ base::string16 management_overview_data_notice;
+ base::string16 management_overview_setup_notice;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{&extension_reporting_title,
+ &browser_management_notice,
+ &subtitle,
+ &management_overview,
+ &management_overview_data_notice,
+ &management_overview_setup_notice,
+ &managed};
+
+ handler_.SetManagedForTesting(true);
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(data.DictSize(), 5u);
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
+ EXPECT_EQ(browser_management_notice,
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_BROWSER_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
+ EXPECT_EQ(subtitle, l10n_util::GetStringUTF16(IDS_MANAGEMENT_SUBTITLE));
+ EXPECT_EQ(management_overview,
+ l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION_UNKNOWN_DOMAIN));
+ EXPECT_EQ(management_overview_data_notice,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA));
+ EXPECT_EQ(management_overview_setup_notice,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP));
+ EXPECT_TRUE(managed);
+}
+
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateManagedConsumerDomain) {
+ TestingProfile::Builder builder;
+ builder.SetProfileName("managed@gmail.com");
+ auto profile = builder.Build();
+
+ base::string16 extensions_installed;
+ base::string16 browser_management_notice;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ base::string16 management_overview_data_notice;
+ base::string16 management_overview_setup_notice;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{&extensions_installed,
+ &browser_management_notice,
+ &subtitle,
+ &management_overview,
+ &management_overview_data_notice,
+ &management_overview_setup_notice,
+ &managed};
+
+ handler_.SetManagedForTesting(true);
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(data.DictSize(), 5u);
+ EXPECT_EQ(extensions_installed,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
+ EXPECT_EQ(browser_management_notice,
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_BROWSER_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
+ EXPECT_EQ(subtitle, l10n_util::GetStringUTF16(IDS_MANAGEMENT_SUBTITLE));
+ EXPECT_EQ(management_overview,
+ l10n_util::GetStringUTF16(
+ IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION_UNKNOWN_DOMAIN));
+ EXPECT_EQ(management_overview_data_notice,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA));
+ EXPECT_EQ(management_overview_setup_notice,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP));
+ EXPECT_TRUE(managed);
+}
+
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateUnmanagedKnownDomain) {
+ TestingProfile::Builder builder;
+ builder.SetProfileName("managed@manager.com");
+ auto profile = builder.Build();
+
+ base::string16 extension_reporting_title;
+ base::string16 browser_management_notice;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ base::string16 management_overview_data_notice;
+ base::string16 management_overview_setup_notice;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{&extension_reporting_title,
+ &browser_management_notice,
+ &subtitle,
+ &management_overview,
+ &management_overview_data_notice,
+ &management_overview_setup_notice,
+ &managed};
+
+ handler_.SetManagedForTesting(false);
+
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(data.DictSize(), 4u);
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
+ base::UTF8ToUTF16("manager.com")));
+ EXPECT_EQ(browser_management_notice,
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
+ EXPECT_EQ(management_overview, base::string16());
+ EXPECT_EQ(management_overview_data_notice, base::string16());
+ EXPECT_EQ(management_overview_setup_notice, base::string16());
+ EXPECT_FALSE(managed);
+}
+
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateUnmanagedCustomerDomain) {
+ TestingProfile::Builder builder;
+ builder.SetProfileName("managed@googlemail.com");
+ auto profile = builder.Build();
+
+ base::string16 extension_reporting_title;
+ base::string16 browser_management_notice;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ base::string16 management_overview_data_notice;
+ base::string16 management_overview_setup_notice;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{&extension_reporting_title,
+ &browser_management_notice,
+ &subtitle,
+ &management_overview,
+ &management_overview_data_notice,
+ &management_overview_setup_notice,
+ &managed};
+
+ handler_.SetManagedForTesting(false);
+
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(data.DictSize(), 4u);
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED));
+ EXPECT_EQ(browser_management_notice,
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_NOT_MANAGED_NOTICE,
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE));
+ EXPECT_EQ(management_overview, base::string16());
+ EXPECT_EQ(management_overview_data_notice, base::string16());
+ EXPECT_EQ(management_overview_setup_notice, base::string16());
+ EXPECT_FALSE(managed);
+}
+
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateManagedKnownDomain) {
+ TestingProfile::Builder builder;
+ builder.SetProfileName("managed@manager.com");
+ auto profile = builder.Build();
+
+ base::string16 extension_reporting_title;
+ base::string16 browser_management_notice;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ base::string16 management_overview_data_notice;
+ base::string16 management_overview_setup_notice;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{&extension_reporting_title,
+ &browser_management_notice,
+ &subtitle,
+ &management_overview,
+ &management_overview_data_notice,
+ &management_overview_setup_notice,
+ &managed};
+
+ handler_.SetManagedForTesting(true);
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(data.DictSize(), 5u);
+ EXPECT_EQ(extension_reporting_title,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
+ base::UTF8ToUTF16("manager.com")));
+ EXPECT_EQ(
+ browser_management_notice,
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_MANAGEMENT_BY_NOTICE, base::UTF8ToUTF16("manager.com"),
+ base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ base::UTF8ToUTF16("manager.com")));
+ EXPECT_EQ(
+ management_overview,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_CLARIFICATION,
+ base::UTF8ToUTF16("manager.com")));
+ EXPECT_EQ(management_overview_data_notice,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_DATA));
+ EXPECT_EQ(management_overview_setup_notice,
+ l10n_util::GetStringUTF16(IDS_MANAGEMENT_ACCOUNT_MANAGED_SETUP));
+ EXPECT_TRUE(managed);
+}
+
+#endif // !defined(OS_CHROMEOS)
+
+#if defined(OS_CHROMEOS)
+TEST_F(ManagementUIHandlerTests,
+ ManagementContextualSourceUpdateManagedAccountKnownDomain) {
+ TestingProfile::Builder builder;
+ builder.SetProfileName("managed@manager.com");
+ auto profile = builder.Build();
+ const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
+
+ base::string16 extensions_installed;
+ base::string16 browser_management_notice;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ base::string16 management_overview_data_notice;
+ base::string16 management_overview_setup_notice;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{&extensions_installed,
+ &browser_management_notice,
+ &subtitle,
+ &management_overview,
+ &management_overview_data_notice,
+ &management_overview_setup_notice,
+ &managed};
+
+ handler_.SetManagedForTesting(true);
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ l10n_util::GetStringUTF16(device_type),
+ base::UTF8ToUTF16("manager.com")));
+ EXPECT_TRUE(managed);
+}
+
+TEST_F(ManagementUIHandlerTests, ManagementContextualSourceUpdateUnmanaged) {
+ auto profile = TestingProfile::Builder().Build();
+ const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
+
+ base::string16 extension_reporting_title;
+ base::string16 browser_management_notice;
+ base::string16 subtitle;
+ base::string16 management_overview;
+ base::string16 management_overview_data_notice;
+ base::string16 management_overview_setup_notice;
+ bool managed;
+ ContextualManagementSourceUpdate extracted{&extension_reporting_title,
+ &browser_management_notice,
+ &subtitle,
+ &management_overview,
+ &management_overview_data_notice,
+ &management_overview_setup_notice,
+ &managed};
+
+ handler_.SetManagedForTesting(false);
+ auto data = handler_.GetContextualManagedDataForTesting(profile.get());
+ ExtractContextualSourceUpdate(data, extracted);
+ EXPECT_EQ(subtitle,
+ l10n_util::GetStringFUTF16(IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE,
+ l10n_util::GetStringUTF16(device_type)));
+ EXPECT_FALSE(managed);
+}
+#endif
+
TEST_F(ManagementUIHandlerTests, ExtensionReportingInfoNoPolicySetNoMessage) {
handler_.EnableCloudReportingExtension(false);
auto reporting_info = handler_.GetExtensionReportingInfo();
diff --git a/chromium/chrome/browser/ui/webui/media/webrtc_logs_ui.cc b/chromium/chrome/browser/ui/webui/media/webrtc_logs_ui.cc
index cf1891051ff..1684c692e11 100644
--- a/chromium/chrome/browser/ui/webui/media/webrtc_logs_ui.cc
+++ b/chromium/chrome/browser/ui/webui/media/webrtc_logs_ui.cc
@@ -184,7 +184,7 @@ WebRtcLogsDOMHandler::WebRtcLogsDOMHandler(Profile* profile)
WebRtcLogsDOMHandler::~WebRtcLogsDOMHandler() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- text_log_upload_list_->CancelCallback();
+ text_log_upload_list_->CancelLoadCallback();
}
void WebRtcLogsDOMHandler::RegisterMessages() {
diff --git a/chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.cc b/chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.cc
index a9af36aab49..75c75604250 100644
--- a/chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.cc
+++ b/chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.cc
@@ -62,6 +62,6 @@ TestingProfile::TestingFactories MediaRouterWebUITest::GetTestingFactories() {
return factories;
}
-BrowserWindow* MediaRouterWebUITest::CreateBrowserWindow() {
- return new DialogTestBrowserWindow;
+std::unique_ptr<BrowserWindow> MediaRouterWebUITest::CreateBrowserWindow() {
+ return std::make_unique<DialogTestBrowserWindow>();
}
diff --git a/chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.h b/chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.h
index 364e518e836..b52ae525fc6 100644
--- a/chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.h
+++ b/chromium/chrome/browser/ui/webui/media_router/media_router_web_ui_test.h
@@ -17,7 +17,7 @@ class MediaRouterWebUITest : public BrowserWithTestWindowTest {
protected:
// BrowserWithTestWindowTest:
TestingProfile::TestingFactories GetTestingFactories() override;
- BrowserWindow* CreateBrowserWindow() override;
+ std::unique_ptr<BrowserWindow> CreateBrowserWindow() override;
private:
// When this is set to true, MockMediaRouterUIService is instantiated.
diff --git a/chromium/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc b/chromium/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc
index 029f6403340..b6b9fe2eda5 100644
--- a/chromium/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc
@@ -1119,8 +1119,12 @@ void MediaRouterWebUIMessageHandler::MaybeUpdateFirstRunFlowData() {
AccountInfo MediaRouterWebUIMessageHandler::GetAccountInfo() {
identity::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(Profile::FromWebUI(web_ui()));
- return identity_manager ? identity_manager->GetPrimaryAccountInfo()
- : AccountInfo();
+ if (!identity_manager)
+ return AccountInfo();
+ base::Optional<AccountInfo> primary_account_info =
+ identity_manager->FindExtendedAccountInfoForAccount(
+ identity_manager->GetPrimaryAccountInfo());
+ return primary_account_info.value_or(AccountInfo{});
}
int MediaRouterWebUIMessageHandler::CurrentCastModeForRouteId(
diff --git a/chromium/chrome/browser/ui/webui/nacl_ui.cc b/chromium/chrome/browser/ui/webui/nacl_ui.cc
index 78babd67252..6fc7196596c 100644
--- a/chromium/chrome/browser/ui/webui/nacl_ui.cc
+++ b/chromium/chrome/browser/ui/webui/nacl_ui.cc
@@ -197,7 +197,7 @@ void NaClDomHandler::AddOperatingSystemInfo(base::ListValue* list) {
os_label += " SP" + base::NumberToString(os->service_pack().major);
if (os->service_pack().minor > 0)
os_label += "." + base::NumberToString(os->service_pack().minor);
- if (os->architecture() == base::win::OSInfo::X64_ARCHITECTURE)
+ if (os->GetArchitecture() == base::win::OSInfo::X64_ARCHITECTURE)
os_label += " 64 bit";
#endif
AddPair(list, l10n_util::GetStringUTF16(IDS_VERSION_UI_OS),
diff --git a/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
index a70b0ac0095..9a0fe68249c 100644
--- a/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -12,6 +12,7 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/memory/weak_ptr.h"
#include "base/task/post_task.h"
#include "base/values.h"
diff --git a/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 0ebb19b3121..d52d5c7d397 100644
--- a/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -22,6 +22,7 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/extensions/bookmark_app_extension_util.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_ui_util.h"
@@ -254,6 +255,10 @@ void AppLauncherHandler::RegisterMessages() {
base::BindRepeating(&AppLauncherHandler::HandleCreateAppShortcut,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
+ "installAppLocally",
+ base::BindRepeating(&AppLauncherHandler::HandleInstallAppLocally,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
"showAppInfo", base::BindRepeating(&AppLauncherHandler::HandleShowAppInfo,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
@@ -618,6 +623,29 @@ void AppLauncherHandler::HandleCreateAppShortcut(const base::ListValue* args) {
base::Callback<void(bool)>());
}
+void AppLauncherHandler::HandleInstallAppLocally(const base::ListValue* args) {
+ std::string extension_id;
+ CHECK(args->GetString(0, &extension_id));
+
+ const Extension* extension =
+ extension_service_->GetExtensionById(extension_id, true);
+ if (!extension)
+ return;
+
+ auto* profile = Profile::FromBrowserContext(
+ web_ui()->GetWebContents()->GetBrowserContext());
+ SetBookmarkAppIsLocallyInstalled(profile, extension, true);
+ if (extensions::CanBookmarkAppCreateOsShortcuts()) {
+ extensions::BookmarkAppCreateOsShortcuts(
+ profile, extension, true /* add_to_desktop */, base::DoNothing());
+ }
+
+ // Use the appAdded to update the app icon's color to no longer be greyscale.
+ std::unique_ptr<base::DictionaryValue> app_info(GetAppInfo(extension));
+ if (app_info)
+ web_ui()->CallJavascriptFunctionUnsafe("ntp.appAdded", *app_info);
+}
+
void AppLauncherHandler::HandleShowAppInfo(const base::ListValue* args) {
std::string extension_id;
CHECK(args->GetString(0, &extension_id));
diff --git a/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.h
index 5e9bf46b6e0..c2a7659aeb9 100644
--- a/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.h
+++ b/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.h
@@ -112,6 +112,10 @@ class AppLauncherHandler
// [extension_id].
void HandleCreateAppShortcut(const base::ListValue* args);
+ // Handles the "installAppLocally" message with |args| containing
+ // [extension_id].
+ void HandleInstallAppLocally(const base::ListValue* args);
+
// Handles the "showAppInfo" message with |args| containing [extension_id].
void HandleShowAppInfo(const base::ListValue* args);
diff --git a/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc
index 5026d255ad9..f565648b2d4 100644
--- a/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -8,11 +8,13 @@
#include <string>
#include "base/bind.h"
+#include "base/feature_list.h"
#include "base/i18n/rtl.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
#include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
@@ -29,6 +31,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/native_theme/native_theme.h"
#include "url/gurl.h"
namespace {
@@ -50,7 +53,11 @@ const char* GetHtmlTextDirection(const base::string16& text) {
///////////////////////////////////////////////////////////////////////////////
// NewTabUI
-NewTabUI::NewTabUI(content::WebUI* web_ui) : content::WebUIController(web_ui) {
+NewTabUI::NewTabUI(content::WebUI* web_ui)
+ : content::WebUIController(web_ui),
+ dark_mode_observer_(ui::NativeTheme::GetInstanceForNativeUi(),
+ base::BindRepeating(&NewTabUI::OnDarkModeChanged,
+ base::Unretained(this))) {
web_ui->OverrideTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE));
Profile* profile = GetProfile();
@@ -69,6 +76,8 @@ NewTabUI::NewTabUI(content::WebUI* web_ui) : content::WebUIController(web_ui) {
pref_change_registrar_.Add(
prefs::kWebKitDefaultFontSize,
base::Bind(&NewTabUI::OnDefaultFontSizeChanged, base::Unretained(this)));
+
+ dark_mode_observer_.Start();
}
NewTabUI::~NewTabUI() {}
@@ -82,6 +91,16 @@ void NewTabUI::OnShowBookmarkBarChanged() {
attached);
}
+void NewTabUI::OnDarkModeChanged(bool /*dark_mode*/) {
+ if (!web_ui() || !web_ui()->CanCallJavascript())
+ return;
+
+ bool enabled = base::FeatureList::IsEnabled(features::kWebUIDarkMode);
+ web_ui()->CallJavascriptFunctionUnsafe(
+ "document.documentElement.toggleAttribute", base::Value("dark"),
+ base::Value(enabled && dark_mode_observer_.InDarkMode()));
+}
+
void NewTabUI::OnDefaultFontSizeChanged() {
web_ui()->CallJavascriptFunctionUnsafe("ntp.defaultFontSizeChanged");
}
diff --git a/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h b/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h
index e3bf3c65dd7..f5e776de279 100644
--- a/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h
+++ b/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.h
@@ -7,6 +7,7 @@
#include "base/macros.h"
#include "base/strings/string16.h"
+#include "chrome/browser/ui/dark_mode_observer.h"
#include "components/prefs/pref_change_registrar.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_ui_controller.h"
@@ -73,11 +74,14 @@ class NewTabUI : public content::WebUIController {
DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource);
};
- void OnShowBookmarkBarChanged();
+ void OnDarkModeChanged(bool dark_mode);
void OnDefaultFontSizeChanged();
+ void OnShowBookmarkBarChanged();
Profile* GetProfile() const;
+ DarkModeObserver dark_mode_observer_;
+
PrefChangeRegistrar pref_change_registrar_;
DISALLOW_COPY_AND_ASSIGN(NewTabUI);
diff --git a/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index 605023bcbf7..285c5318198 100644
--- a/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -16,7 +16,6 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/themes/theme_properties.h"
@@ -24,6 +23,7 @@
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/apps/app_info_dialog.h"
#include "chrome/browser/ui/layout_constants.h"
+#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/webui/app_launcher_login_handler.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/buildflags.h"
@@ -51,6 +51,7 @@
#include "ui/base/webui/web_ui_util.h"
#include "ui/gfx/animation/animation.h"
#include "ui/gfx/color_utils.h"
+#include "ui/native_theme/native_theme.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
@@ -134,7 +135,9 @@ std::string GetNewTabBackgroundTilingCSS(
} // namespace
NTPResourceCache::NTPResourceCache(Profile* profile)
- : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false) {
+ : profile_(profile),
+ is_swipe_tracking_from_scroll_events_enabled_(false),
+ theme_observer_(this) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(
ThemeServiceFactory::GetForProfile(profile)));
@@ -150,6 +153,8 @@ NTPResourceCache::NTPResourceCache(Profile* profile)
profile_pref_change_registrar_.Add(prefs::kSignInPromoShowNTPBubble,
callback);
profile_pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback);
+
+ theme_observer_.Add(ui::NativeTheme::GetInstanceForNativeUi());
}
NTPResourceCache::~NTPResourceCache() {}
@@ -230,6 +235,11 @@ void NTPResourceCache::Observe(int type,
Invalidate();
}
+void NTPResourceCache::OnNativeThemeUpdated(ui::NativeTheme* updated_theme) {
+ DCHECK_EQ(updated_theme, ui::NativeTheme::GetInstanceForNativeUi());
+ Invalidate();
+}
+
void NTPResourceCache::OnPreferenceChanged() {
// A change occurred to one of the preferences we care about, so flush the
// cache.
@@ -244,6 +254,7 @@ void NTPResourceCache::Invalidate() {
new_tab_html_ = nullptr;
new_tab_incognito_css_ = nullptr;
new_tab_css_ = nullptr;
+ new_tab_guest_html_ = nullptr;
}
void NTPResourceCache::CreateNewTabIncognitoHTML() {
@@ -338,6 +349,8 @@ void NTPResourceCache::CreateNewTabGuestHTML() {
l10n_util::GetStringUTF16(guest_tab_link_ids));
localized_strings.SetString("learnMoreLink", guest_tab_link);
+ SetDarkKey(&localized_strings);
+
const std::string& app_locale = g_browser_process->GetApplicationLocale();
webui::SetLoadTimeDataDefaults(app_locale, &localized_strings);
@@ -391,6 +404,8 @@ void NTPResourceCache::CreateNewTabHTML() {
GetLocalizedString(IDS_APP_CONTEXT_MENU_SHOW_INFO));
load_time_data.SetString("appcreateshortcut",
GetLocalizedString(IDS_NEW_TAB_APP_CREATE_SHORTCUT));
+ load_time_data.SetString("appinstalllocally",
+ GetLocalizedString(IDS_NEW_TAB_APP_INSTALL_LOCALLY));
load_time_data.SetString("appDefaultPageName",
GetLocalizedString(IDS_APP_DEFAULT_PAGE_NAME));
load_time_data.SetString(
@@ -439,12 +454,6 @@ void NTPResourceCache::CreateNewTabHTML() {
load_time_data.SetBoolean("showWebStoreIcon",
!prefs->GetBoolean(prefs::kHideWebStoreIcon));
- load_time_data.SetBoolean("enableNewBookmarkApps",
- extensions::util::IsNewBookmarkAppsEnabled());
-
- load_time_data.SetBoolean("canHostedAppsOpenInWindows",
- extensions::util::CanHostedAppsOpenInWindows());
-
load_time_data.SetBoolean("canShowAppInfoDialog",
CanShowAppInfoDialog());
@@ -461,6 +470,8 @@ void NTPResourceCache::CreateNewTabHTML() {
"isUserSignedIn",
IdentityManagerFactory::GetForProfile(profile_)->HasPrimaryAccount());
+ SetDarkKey(&load_time_data);
+
// Load the new tab page appropriate for this build.
base::StringPiece new_tab_html(
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
@@ -537,6 +548,8 @@ void NTPResourceCache::CreateNewTabCSS() {
// Colors.
substitutions["colorBackground"] =
color_utils::SkColorToRgbaString(color_background);
+ substitutions["colorLink"] = color_utils::SkColorToRgbString(
+ GetThemeColor(tp, ThemeProperties::COLOR_NTP_LINK));
substitutions["backgroundBarDetached"] = GetNewTabBackgroundCSS(tp, false);
substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true);
substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp);
@@ -574,3 +587,11 @@ void NTPResourceCache::CreateNewTabCSS() {
ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions);
new_tab_css_ = base::RefCountedString::TakeString(&css_string);
}
+
+void NTPResourceCache::SetDarkKey(base::Value* dict) {
+ DCHECK(dict && dict->is_dict());
+ bool use_dark =
+ base::FeatureList::IsEnabled(features::kWebUIDarkMode) &&
+ ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeEnabled();
+ dict->SetKey("dark", base::Value(use_dark ? "dark" : ""));
+}
diff --git a/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.h b/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
index 827b2eeacd3..354de3c3e10 100644
--- a/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
+++ b/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
@@ -8,27 +8,35 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/scoped_observer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_change_registrar.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "ui/native_theme/native_theme_observer.h"
class Profile;
namespace base {
class RefCountedMemory;
+class Value;
}
namespace content {
class RenderProcessHost;
}
+namespace ui {
+class NativeTheme;
+}
+
// This class keeps a cache of NTP resources (HTML and CSS) so we don't have to
// regenerate them all the time.
// Note: This is only used for incognito and guest mode NTPs (NewTabUI), as well
// as for (non-incognito) app launcher pages (AppLauncherPageUI).
class NTPResourceCache : public content::NotificationObserver,
- public KeyedService {
+ public KeyedService,
+ public ui::NativeThemeObserver {
public:
enum WindowType {
NORMAL,
@@ -42,7 +50,7 @@ class NTPResourceCache : public content::NotificationObserver,
base::RefCountedMemory* GetNewTabHTML(WindowType win_type);
base::RefCountedMemory* GetNewTabCSS(WindowType win_type);
- // content::NotificationObserver interface.
+ // content::NotificationObserver:
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
@@ -51,6 +59,9 @@ class NTPResourceCache : public content::NotificationObserver,
Profile* profile, content::RenderProcessHost* render_host);
private:
+ // ui::NativeThemeObserver:
+ void OnNativeThemeUpdated(ui::NativeTheme* updated_theme) override;
+
void OnPreferenceChanged();
// Invalidates the NTPResourceCache.
@@ -70,6 +81,8 @@ class NTPResourceCache : public content::NotificationObserver,
void CreateNewTabGuestHTML();
+ void SetDarkKey(base::Value* dict);
+
Profile* profile_;
scoped_refptr<base::RefCountedMemory> new_tab_html_;
@@ -84,6 +97,8 @@ class NTPResourceCache : public content::NotificationObserver,
// Set based on platform_util::IsSwipeTrackingFromScrollEventsEnabled.
bool is_swipe_tracking_from_scroll_events_enabled_;
+ ScopedObserver<ui::NativeTheme, NTPResourceCache> theme_observer_;
+
DISALLOW_COPY_AND_ASSIGN(NTPResourceCache);
};
diff --git a/chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc b/chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc
index 7ccfd40ed52..82ed17f9101 100644
--- a/chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/history/top_sites_factory.h"
#include "chrome/browser/ntp_tiles/chrome_most_visited_sites_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/search/suggestions/image_decoder_impl.h"
#include "chrome/browser/search/suggestions/suggestions_service_factory.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/url_constants.h"
diff --git a/chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc b/chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc
index e96e1e9a7cd..ce641d7f909 100644
--- a/chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc
@@ -34,6 +34,7 @@
#include "components/offline_pages/core/prefetch/prefetch_background_task_handler.h"
#include "components/offline_pages/core/prefetch/prefetch_dispatcher.h"
#include "components/offline_pages/core/prefetch/prefetch_downloader.h"
+#include "components/offline_pages/core/prefetch/prefetch_gcm_handler.h"
#include "components/offline_pages/core/prefetch/prefetch_prefs.h"
#include "components/offline_pages/core/prefetch/prefetch_service.h"
#include "components/offline_pages/core/prefetch/prefetch_types.h"
@@ -258,19 +259,27 @@ void OfflineInternalsUIMessageHandler::HandleGetNetworkStatus(
void OfflineInternalsUIMessageHandler::HandleScheduleNwake(
const base::ListValue* args) {
AllowJavascript();
- const base::Value* callback_id;
- CHECK(args->Get(0, &callback_id));
+ CHECK(!args->GetList().empty());
+ base::Value callback_id = args->GetList()[0].Clone();
if (prefetch_service_) {
- prefetch_service_->GetPrefetchBackgroundTaskHandler()
- ->EnsureTaskScheduled();
- ResolveJavascriptCallback(*callback_id, base::Value("Scheduled."));
+ prefetch_service_->GetGCMToken(base::BindOnce(
+ &OfflineInternalsUIMessageHandler::ScheduleNwakeWithGCMToken,
+ weak_ptr_factory_.GetWeakPtr(), std::move(callback_id)));
} else {
- RejectJavascriptCallback(*callback_id,
+ RejectJavascriptCallback(callback_id,
base::Value("No prefetch service available."));
}
}
+void OfflineInternalsUIMessageHandler::ScheduleNwakeWithGCMToken(
+ base::Value callback_id,
+ const std::string& gcm_token) {
+ prefetch_service_->GetPrefetchBackgroundTaskHandler()->EnsureTaskScheduled(
+ gcm_token);
+ ResolveJavascriptCallback(callback_id, base::Value("Scheduled."));
+}
+
void OfflineInternalsUIMessageHandler::HandleCancelNwake(
const base::ListValue* args) {
AllowJavascript();
@@ -445,6 +454,8 @@ void OfflineInternalsUIMessageHandler::HandleSetPrefetchTestingHeader(
offline_pages::prefetch_prefs::SetPrefetchTestingHeader(
prefs, args->GetList()[0].GetString());
+
+ offline_pages::prefetch_prefs::SetEnabledByServer(prefs, true);
}
void OfflineInternalsUIMessageHandler::HandleGetPrefetchTestingHeader(
diff --git a/chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.h b/chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.h
index 09a718680fa..61e06e47c1d 100644
--- a/chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.h
+++ b/chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.h
@@ -85,6 +85,8 @@ class OfflineInternalsUIMessageHandler : public content::WebUIMessageHandler {
// Schedules an NWake signal.
void HandleScheduleNwake(const base::ListValue* args);
+ void ScheduleNwakeWithGCMToken(base::Value callback_id,
+ const std::string& gcm_token);
// Cancels an NWake signal.
void HandleCancelNwake(const base::ListValue* args);
diff --git a/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom b/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
index 7e6f9f93ddb..f24279a4c32 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
@@ -43,6 +43,7 @@ struct AutocompleteMatch {
int32 duplicates;
bool from_previous;
array<AutocompleteAdditionalInfo> additional_info;
+ string document_type;
};
struct AutocompleteResultsForProvider {
diff --git a/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc b/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
index f9715b337e6..132a25c209d 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
@@ -198,6 +198,8 @@ struct TypeConverter<mojom::AutocompleteMatchPtr, AutocompleteMatch> {
result->additional_info =
mojo::ConvertTo<std::vector<mojom::AutocompleteAdditionalInfoPtr>>(
input.additional_info);
+ result->document_type =
+ AutocompleteMatch::DocumentTypeString(input.document_type);
return result;
}
};
diff --git a/chromium/chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.cc b/chromium/chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.cc
index 946af1c19f1..1cf3620d094 100644
--- a/chromium/chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.cc
+++ b/chromium/chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.cc
@@ -6,6 +6,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/dark_mode_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
@@ -27,7 +28,7 @@ content::WebUIDataSource* CreateHTMLSource(Profile* profile,
else if (host_name == chrome::kChromeUIHistoryHost)
page_title = l10n_util::GetStringUTF16(IDS_HISTORY_TITLE);
else if (host_name == chrome::kChromeUIExtensionsHost)
- page_title = l10n_util::GetStringUTF16(IDS_MD_EXTENSIONS_TOOLBAR_TITLE);
+ page_title = l10n_util::GetStringUTF16(IDS_EXTENSIONS_TOOLBAR_TITLE);
else
page_title = base::UTF8ToUTF16(host_name);
@@ -48,5 +49,7 @@ PageNotAvailableForGuestUI::PageNotAvailableForGuestUI(
const std::string& host_name)
: WebUIController(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
- content::WebUIDataSource::Add(profile, CreateHTMLSource(profile, host_name));
+ auto* source = CreateHTMLSource(profile, host_name);
+ DarkModeHandler::Initialize(web_ui, source);
+ content::WebUIDataSource::Add(profile, source);
}
diff --git a/chromium/chrome/browser/ui/webui/policy_indicator_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/policy_indicator_localized_strings_provider.cc
index e7e5f6e90f6..cc28e91c1c8 100644
--- a/chromium/chrome/browser/ui/webui/policy_indicator_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/policy_indicator_localized_strings_provider.cc
@@ -32,7 +32,9 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) {
IDS_CONTROLLED_SETTING_EXTENSION_WITHOUT_NAME},
#if defined(OS_CHROMEOS)
{"controlledSettingShared", IDS_CONTROLLED_SETTING_SHARED},
- {"controlledSettingOwner", IDS_CONTROLLED_SETTING_OWNER},
+ {"controlledSettingWithOwner", IDS_CONTROLLED_SETTING_WITH_OWNER},
+ {"controlledSettingNoOwner", IDS_CONTROLLED_SETTING_NO_OWNER},
+ {"controlledSettingParent", IDS_CONTROLLED_SETTING_PARENT},
#endif
};
AddLocalizedStringsBulk(html_source, localized_strings,
diff --git a/chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc
index 44939494b0e..93cec93e971 100644
--- a/chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc
@@ -21,7 +21,6 @@
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/policy/schema_registry_service.h"
-#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -59,8 +58,7 @@ class PolicySchemaAvailableWaiter : public policy::SchemaRegistry::Observer {
public:
PolicySchemaAvailableWaiter(Profile* profile,
const policy::PolicyNamespace& policy_namespace)
- : registry_(policy::SchemaRegistryServiceFactory::GetForContext(profile)
- ->registry()),
+ : registry_(profile->GetPolicySchemaRegistryService()->registry()),
policy_namespace_(policy_namespace) {}
~PolicySchemaAvailableWaiter() override { registry_->RemoveObserver(this); }
@@ -327,7 +325,7 @@ void PolicyUITest::VerifyExportingPolicies(
browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_TRUE(content::ExecuteScript(contents, javascript));
- base::TaskScheduler::GetInstance()->FlushForTesting();
+ base::ThreadPool::GetInstance()->FlushForTesting();
// Open the created file.
base::ScopedAllowBlockingForTesting allow_blocking;
std::string file_contents;
diff --git a/chromium/chrome/browser/ui/webui/policy_ui_handler.cc b/chromium/chrome/browser/ui/webui/policy_ui_handler.cc
index abe7222cdfe..aa706efd9ee 100644
--- a/chromium/chrome/browser/ui/webui/policy_ui_handler.cc
+++ b/chromium/chrome/browser/ui/webui/policy_ui_handler.cc
@@ -31,7 +31,6 @@
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/policy/schema_registry_service.h"
-#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/browser/cloud/message_util.h"
@@ -72,7 +71,6 @@
#include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h"
#include "components/user_manager/user_manager.h"
#else
-#include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#endif
@@ -603,9 +601,10 @@ PolicyUIHandler::PolicyUIHandler()
PolicyUIHandler::~PolicyUIHandler() {
GetPolicyService()->RemoveObserver(policy::POLICY_DOMAIN_CHROME, this);
GetPolicyService()->RemoveObserver(policy::POLICY_DOMAIN_EXTENSIONS, this);
- policy::SchemaRegistry* registry =
- policy::SchemaRegistryServiceFactory::GetForContext(
- Profile::FromWebUI(web_ui())->GetOriginalProfile())->registry();
+ policy::SchemaRegistry* registry = Profile::FromWebUI(web_ui())
+ ->GetOriginalProfile()
+ ->GetPolicySchemaRegistryService()
+ ->registry();
registry->RemoveObserver(this);
#if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -651,6 +650,7 @@ void PolicyUIHandler::AddCommonLocalizedStringsToSource(
}
void PolicyUIHandler::RegisterMessages() {
+ Profile* profile = Profile::FromWebUI(web_ui());
#if defined(OS_CHROMEOS)
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
@@ -668,7 +668,6 @@ void PolicyUIHandler::RegisterMessages() {
const user_manager::UserManager* user_manager =
user_manager::UserManager::Get();
- Profile* profile = Profile::FromWebUI(web_ui());
policy::DeviceLocalAccountPolicyService* local_account_service =
user_manager->IsLoggedInAsPublicAccount()
? connector->GetDeviceLocalAccountPolicyService()
@@ -694,8 +693,7 @@ void PolicyUIHandler::RegisterMessages() {
}
#else
policy::UserCloudPolicyManager* user_cloud_policy_manager =
- policy::UserCloudPolicyManagerFactory::GetForBrowserContext(
- web_ui()->GetWebContents()->GetBrowserContext());
+ profile->GetUserCloudPolicyManager();
if (user_cloud_policy_manager) {
user_status_provider_ = std::make_unique<UserCloudPolicyStatusProvider>(
user_cloud_policy_manager->core());
@@ -733,9 +731,10 @@ void PolicyUIHandler::RegisterMessages() {
extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))
->AddObserver(this);
#endif
- policy::SchemaRegistry* registry =
- policy::SchemaRegistryServiceFactory::GetForContext(
- Profile::FromWebUI(web_ui())->GetOriginalProfile())->registry();
+ policy::SchemaRegistry* registry = Profile::FromWebUI(web_ui())
+ ->GetOriginalProfile()
+ ->GetPolicySchemaRegistryService()
+ ->registry();
registry->AddObserver(this);
web_ui()->RegisterMessageCallback(
@@ -783,9 +782,9 @@ void PolicyUIHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns,
base::Value PolicyUIHandler::GetPolicyNames() const {
base::DictionaryValue names;
Profile* profile = Profile::FromWebUI(web_ui());
- policy::SchemaRegistry* registry =
- policy::SchemaRegistryServiceFactory::GetForContext(
- profile->GetOriginalProfile())->registry();
+ policy::SchemaRegistry* registry = profile->GetOriginalProfile()
+ ->GetPolicySchemaRegistryService()
+ ->registry();
scoped_refptr<policy::SchemaMap> schema_map = registry->schema_map();
// Add Chrome policy names.
diff --git a/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc b/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
index bbc9c6faee9..ccc6c46d291 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
@@ -20,15 +20,12 @@
#include "chrome/browser/ui/webui/print_preview/print_preview_utils.h"
#include "components/cloud_devices/common/cloud_device_description.h"
#include "components/cloud_devices/common/printer_description.h"
-#include "device/base/device_client.h"
-#include "device/usb/mojo/type_converters.h"
#include "device/usb/public/mojom/device.mojom.h"
-#include "device/usb/usb_device.h"
-#include "device/usb/usb_service.h"
#include "extensions/browser/api/device_permissions_manager.h"
#include "extensions/browser/api/printer_provider/printer_provider_api.h"
#include "extensions/browser/api/printer_provider/printer_provider_api_factory.h"
#include "extensions/browser/api/printer_provider/printer_provider_print_job.h"
+#include "extensions/browser/api/usb/usb_device_manager.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/api/printer_provider/usb_printer_manifest_data.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -38,12 +35,12 @@
#include "printing/print_job_constants.h"
#include "printing/pwg_raster_settings.h"
-using device::UsbDevice;
using extensions::DevicePermissionsManager;
using extensions::DictionaryBuilder;
using extensions::Extension;
using extensions::ExtensionRegistry;
using extensions::ListBuilder;
+using extensions::UsbDeviceManager;
using extensions::UsbPrinterManifestData;
namespace printing {
@@ -78,10 +75,11 @@ bool HasUsbPrinterProviderPermissions(const Extension* extension) {
extensions::APIPermission::kUsb);
}
-std::string GenerateProvisionalUsbPrinterId(const Extension* extension,
- const UsbDevice* device) {
+std::string GenerateProvisionalUsbPrinterId(
+ const Extension* extension,
+ const device::mojom::UsbDeviceInfo& device) {
return base::StringPrintf("%s:%s:%s", kProvisionalUsbLabel,
- extension->id().c_str(), device->guid().c_str());
+ extension->id().c_str(), device.guid.c_str());
}
bool ParseProvisionalUsbPrinterId(const std::string& printer_id,
@@ -140,9 +138,10 @@ void ExtensionPrinterHandler::StartGetPrinters(
}
if (extension_supports_usb_printers) {
- device::UsbService* service = device::DeviceClient::Get()->GetUsbService();
pending_enumeration_count_++;
- service->GetDevices(
+ UsbDeviceManager* usb_manager = UsbDeviceManager::Get(profile_);
+ DCHECK(usb_manager);
+ usb_manager->GetDevices(
base::Bind(&ExtensionPrinterHandler::OnUsbDevicesEnumerated,
weak_ptr_factory_.GetWeakPtr(), callback));
}
@@ -215,8 +214,11 @@ void ExtensionPrinterHandler::StartGrantPrinterAccess(
return;
}
- device::UsbService* service = device::DeviceClient::Get()->GetUsbService();
- scoped_refptr<UsbDevice> device = service->GetDevice(device_guid);
+ UsbDeviceManager* usb_manager = UsbDeviceManager::Get(profile_);
+ DCHECK(usb_manager);
+
+ const device::mojom::UsbDeviceInfo* device =
+ usb_manager->GetDeviceInfo(device_guid);
if (!device) {
std::move(callback).Run(base::DictionaryValue());
return;
@@ -224,12 +226,10 @@ void ExtensionPrinterHandler::StartGrantPrinterAccess(
DevicePermissionsManager* permissions_manager =
DevicePermissionsManager::Get(profile_);
- auto device_info = device::mojom::UsbDeviceInfo::From(*device);
- DCHECK(device_info);
- permissions_manager->AllowUsbDevice(extension_id, *device_info);
+ permissions_manager->AllowUsbDevice(extension_id, *device);
GetPrinterProviderAPI(profile_)->DispatchGetUsbPrinterInfoRequested(
- extension_id, *device_info,
+ extension_id, *device,
base::BindOnce(&ExtensionPrinterHandler::WrapGetPrinterInfoCallback,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
}
@@ -318,7 +318,7 @@ void ExtensionPrinterHandler::WrapGetPrinterInfoCallback(
void ExtensionPrinterHandler::OnUsbDevicesEnumerated(
const AddedPrintersCallback& callback,
- const std::vector<scoped_refptr<UsbDevice>>& devices) {
+ std::vector<device::mojom::UsbDeviceInfoPtr> devices) {
ExtensionRegistry* registry = ExtensionRegistry::Get(profile_);
DevicePermissionsManager* permissions_manager =
DevicePermissionsManager::Get(profile_);
@@ -337,8 +337,8 @@ void ExtensionPrinterHandler::OnUsbDevicesEnumerated(
if (manifest_data->SupportsDevice(*device)) {
std::unique_ptr<extensions::UsbDevicePermission::CheckParam> param =
extensions::UsbDevicePermission::CheckParam::ForUsbDevice(
- extension.get(), device.get());
- if (device_permissions->FindUsbDeviceEntry(device) ||
+ extension.get(), *device);
+ if (device_permissions->FindUsbDeviceEntry(*device) ||
extension->permissions_data()->CheckAPIPermissionWithParam(
extensions::APIPermission::kUsbDevice, param.get())) {
// Skip devices the extension already has permission to access.
@@ -347,13 +347,14 @@ void ExtensionPrinterHandler::OnUsbDevicesEnumerated(
printer_list.Append(
DictionaryBuilder()
- .Set("id", GenerateProvisionalUsbPrinterId(extension.get(),
- device.get()))
+ .Set("id",
+ GenerateProvisionalUsbPrinterId(extension.get(), *device))
.Set("name",
DevicePermissionsManager::GetPermissionMessage(
- device->vendor_id(), device->product_id(),
- device->manufacturer_string(),
- device->product_string(), base::string16(), false))
+ device->vendor_id, device->product_id,
+ device->manufacturer_name.value_or(base::string16()),
+ device->product_name.value_or(base::string16()),
+ base::string16(), false))
.Set("extensionId", extension->id())
.Set("extensionName", extension->name())
.Set("provisional", true)
diff --git a/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.h b/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.h
index 6cceb78a076..2dacc08b396 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.h
+++ b/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler.h
@@ -25,10 +25,6 @@ namespace cloud_devices {
class CloudDeviceDescription;
}
-namespace device {
-class UsbDevice;
-}
-
namespace gfx {
class Size;
}
@@ -98,7 +94,7 @@ class ExtensionPrinterHandler : public PrinterHandler {
void OnUsbDevicesEnumerated(
const AddedPrintersCallback& callback,
- const std::vector<scoped_refptr<device::UsbDevice>>& devices);
+ std::vector<device::mojom::UsbDeviceInfoPtr> devices);
Profile* const profile_;
GetPrintersDoneCallback done_callback_;
diff --git a/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc b/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
index af526b30c5f..ae0c9005f7c 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
@@ -28,15 +28,13 @@
#include "chrome/test/base/testing_profile.h"
#include "components/version_info/version_info.h"
#include "content/public/test/test_utils.h"
-#include "device/base/mock_device_client.h"
-#include "device/usb/mock_usb_device.h"
-#include "device/usb/mock_usb_service.h"
-#include "device/usb/mojo/type_converters.h"
+#include "device/usb/public/cpp/fake_usb_device_manager.h"
#include "device/usb/public/mojom/device.mojom.h"
#include "extensions/browser/api/device_permissions_manager.h"
#include "extensions/browser/api/printer_provider/printer_provider_api.h"
#include "extensions/browser/api/printer_provider/printer_provider_api_factory.h"
#include "extensions/browser/api/printer_provider/printer_provider_print_job.h"
+#include "extensions/browser/api/usb/usb_device_manager.h"
#include "extensions/common/extension.h"
#include "extensions/common/value_builder.h"
#include "printing/pdf_render_settings.h"
@@ -46,8 +44,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
-using device::MockUsbDevice;
-using device::MockUsbService;
+using device::mojom::UsbDeviceInfoPtr;
using extensions::DictionaryBuilder;
using extensions::Extension;
using extensions::PrinterProviderAPI;
@@ -508,6 +505,13 @@ class ExtensionPrinterHandlerTest : public testing::Test {
pwg_raster_converter_ = pwg_raster_converter.get();
extension_printer_handler_->SetPwgRasterConverterForTesting(
std::move(pwg_raster_converter));
+
+ // Set fake USB device manager for extensions::UsbDeviceManager.
+ device::mojom::UsbDeviceManagerPtr usb_manager_ptr;
+ fake_usb_manager_.AddBinding(mojo::MakeRequest(&usb_manager_ptr));
+ extensions::UsbDeviceManager::Get(env_.profile())
+ ->SetDeviceManagerForTesting(std::move(usb_manager_ptr));
+ base::RunLoop().RunUntilIdle();
}
protected:
@@ -517,11 +521,7 @@ class ExtensionPrinterHandlerTest : public testing::Test {
->GetForBrowserContext(env_.profile()));
}
- device::MockUsbService& usb_service() {
- return *device_client_.usb_service();
- }
-
- device::MockDeviceClient device_client_;
+ device::FakeUsbDeviceManager fake_usb_manager_;
TestExtensionEnvironment env_;
std::unique_ptr<ExtensionPrinterHandler> extension_printer_handler_;
@@ -587,12 +587,11 @@ TEST_F(ExtensionPrinterHandlerTest, GetPrinters_Reset) {
}
TEST_F(ExtensionPrinterHandlerTest, GetUsbPrinters) {
- scoped_refptr<device::UsbDevice> device0 =
- base::MakeRefCounted<MockUsbDevice>(0, 0, "Google", "USB Printer", "");
- usb_service().AddDevice(device0);
- scoped_refptr<device::UsbDevice> device1 =
- base::MakeRefCounted<MockUsbDevice>(0, 1, "Google", "USB Printer", "");
- usb_service().AddDevice(device1);
+ UsbDeviceInfoPtr device0 =
+ fake_usb_manager_.CreateAndAddDevice(0, 0, "Google", "USB Printer", "");
+ UsbDeviceInfoPtr device1 =
+ fake_usb_manager_.CreateAndAddDevice(0, 1, "Google", "USB Printer", "");
+ base::RunLoop().RunUntilIdle();
const Extension* extension_1 =
env_.MakeExtension(*base::test::ParseJsonDeprecated(kExtension1),
@@ -603,9 +602,7 @@ TEST_F(ExtensionPrinterHandlerTest, GetUsbPrinters) {
extensions::DevicePermissionsManager* permissions_manager =
extensions::DevicePermissionsManager::Get(env_.profile());
- auto device_info_0 = device::mojom::UsbDeviceInfo::From(*device0);
- DCHECK(device_info_0);
- permissions_manager->AllowUsbDevice(extension_2->id(), *device_info_0);
+ permissions_manager->AllowUsbDevice(extension_2->id(), *device0);
size_t call_count = 0;
std::unique_ptr<base::ListValue> printers;
@@ -628,7 +625,7 @@ TEST_F(ExtensionPrinterHandlerTest, GetUsbPrinters) {
DictionaryBuilder()
.Set("id", base::StringPrintf("provisional-usb:%s:%s",
extension_1->id().c_str(),
- device0->guid().c_str()))
+ device0->guid.c_str()))
.Set("name", "USB Printer")
.Set("extensionName", "Provider 1")
.Set("extensionId", extension_1->id())
@@ -638,7 +635,7 @@ TEST_F(ExtensionPrinterHandlerTest, GetUsbPrinters) {
DictionaryBuilder()
.Set("id", base::StringPrintf("provisional-usb:%s:%s",
extension_2->id().c_str(),
- device1->guid().c_str()))
+ device1->guid.c_str()))
.Set("name", "USB Printer")
.Set("extensionName", "Provider 2")
.Set("extensionId", extension_2->id())
@@ -980,15 +977,15 @@ TEST_F(ExtensionPrinterHandlerTest, Print_Pwg_FailedConversion) {
}
TEST_F(ExtensionPrinterHandlerTest, GrantUsbPrinterAccess) {
- auto device =
- base::MakeRefCounted<MockUsbDevice>(0, 0, "Google", "USB Printer", "");
- usb_service().AddDevice(device);
+ UsbDeviceInfoPtr device =
+ fake_usb_manager_.CreateAndAddDevice(0, 0, "Google", "USB Printer", "");
+ base::RunLoop().RunUntilIdle();
size_t call_count = 0;
std::unique_ptr<base::DictionaryValue> printer_info;
std::string printer_id = base::StringPrintf(
- "provisional-usb:fake extension id:%s", device->guid().c_str());
+ "provisional-usb:fake extension id:%s", device->guid.c_str());
extension_printer_handler_->StartGrantPrinterAccess(
printer_id, base::Bind(&RecordPrinterInfo, &call_count, &printer_info));
@@ -1012,16 +1009,16 @@ TEST_F(ExtensionPrinterHandlerTest, GrantUsbPrinterAccess) {
}
TEST_F(ExtensionPrinterHandlerTest, GrantUsbPrinterAccess_Reset) {
- auto device =
- base::MakeRefCounted<MockUsbDevice>(0, 0, "Google", "USB Printer", "");
- usb_service().AddDevice(device);
+ UsbDeviceInfoPtr device =
+ fake_usb_manager_.CreateAndAddDevice(0, 0, "Google", "USB Printer", "");
+ base::RunLoop().RunUntilIdle();
size_t call_count = 0;
std::unique_ptr<base::DictionaryValue> printer_info;
extension_printer_handler_->StartGrantPrinterAccess(
base::StringPrintf("provisional-usb:fake extension id:%s",
- device->guid().c_str()),
+ device->guid.c_str()),
base::Bind(&RecordPrinterInfo, &call_count, &printer_info));
EXPECT_FALSE(printer_info.get());
diff --git a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc
index c14ef978f64..0d407d495e7 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc
@@ -11,6 +11,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/post_task.h"
#include "base/values.h"
@@ -41,6 +42,9 @@ namespace {
using chromeos::CupsPrintersManager;
using chromeos::CupsPrintersManagerFactory;
+// We only support sending username for named users but just in case.
+const char kUsernamePlaceholder[] = "chronos";
+
// Store the name used in CUPS, Printer#id in |printer_name|, the description
// as the system_driverinfo option value, and the Printer#display_name in
// the |printer_description| field. This will match how Mac OS X presents
@@ -73,18 +77,21 @@ void CapabilitiesFetched(base::Value policies,
std::move(cb).Run(std::move(printer_info));
}
-void FetchCapabilities(std::unique_ptr<chromeos::Printer> printer,
+void FetchCapabilities(const chromeos::Printer& printer,
base::Value policies,
LocalPrinterHandlerChromeos::GetCapabilityCallback cb) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- PrinterBasicInfo basic_info = ToBasicInfo(*printer);
+ PrinterBasicInfo basic_info = ToBasicInfo(printer);
+ bool has_secure_protocol = !printer.HasNetworkProtocol() ||
+ printer.GetProtocol() == chromeos::Printer::kIpps;
// USER_VISIBLE because the result is displayed in the print preview dialog.
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
- base::BindOnce(&GetSettingsOnBlockingPool, printer->id(), basic_info,
- PrinterSemanticCapsAndDefaults::Papers(), nullptr),
+ base::BindOnce(&GetSettingsOnBlockingPool, printer.id(), basic_info,
+ PrinterSemanticCapsAndDefaults::Papers(),
+ has_secure_protocol, nullptr),
base::BindOnce(&CapabilitiesFetched, std::move(policies), std::move(cb)));
}
@@ -92,17 +99,46 @@ void FetchCapabilities(std::unique_ptr<chromeos::Printer> printer,
LocalPrinterHandlerChromeos::LocalPrinterHandlerChromeos(
Profile* profile,
- content::WebContents* preview_web_contents)
+ content::WebContents* preview_web_contents,
+ chromeos::CupsPrintersManager* printers_manager,
+ std::unique_ptr<chromeos::PrinterConfigurer> printer_configurer)
: profile_(profile),
preview_web_contents_(preview_web_contents),
- printers_manager_(
- CupsPrintersManagerFactory::GetForBrowserContext(profile)),
- printer_configurer_(chromeos::PrinterConfigurer::Create(profile)),
+ printers_manager_(printers_manager),
+ printer_configurer_(std::move(printer_configurer)),
weak_factory_(this) {
// Construct the CupsPrintJobManager to listen for printing events.
chromeos::CupsPrintJobManagerFactory::GetForBrowserContext(profile);
}
+// static
+std::unique_ptr<LocalPrinterHandlerChromeos>
+LocalPrinterHandlerChromeos::CreateDefault(
+ Profile* profile,
+ content::WebContents* preview_web_contents) {
+ chromeos::CupsPrintersManager* printers_manager(
+ CupsPrintersManagerFactory::GetForBrowserContext(profile));
+ std::unique_ptr<chromeos::PrinterConfigurer> printer_configurer(
+ chromeos::PrinterConfigurer::Create(profile));
+ // Using 'new' to access non-public constructor.
+ return base::WrapUnique(new LocalPrinterHandlerChromeos(
+ profile, preview_web_contents, printers_manager,
+ std::move(printer_configurer)));
+}
+
+// static
+std::unique_ptr<LocalPrinterHandlerChromeos>
+LocalPrinterHandlerChromeos::CreateForTesting(
+ Profile* profile,
+ content::WebContents* preview_web_contents,
+ chromeos::CupsPrintersManager* printers_manager,
+ std::unique_ptr<chromeos::PrinterConfigurer> printer_configurer) {
+ // Using 'new' to access non-public constructor.
+ return base::WrapUnique(new LocalPrinterHandlerChromeos(
+ profile, preview_web_contents, printers_manager,
+ std::move(printer_configurer)));
+}
+
LocalPrinterHandlerChromeos::~LocalPrinterHandlerChromeos() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}
@@ -127,9 +163,8 @@ void LocalPrinterHandlerChromeos::StartGetPrinters(
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
PrinterList printer_list;
- AddPrintersToList(
- printers_manager_->GetPrinters(CupsPrintersManager::kConfigured),
- &printer_list);
+ AddPrintersToList(printers_manager_->GetPrinters(CupsPrintersManager::kSaved),
+ &printer_list);
AddPrintersToList(
printers_manager_->GetPrinters(CupsPrintersManager::kEnterprise),
&printer_list);
@@ -146,7 +181,7 @@ void LocalPrinterHandlerChromeos::StartGetCapability(
GetCapabilityCallback cb) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- std::unique_ptr<chromeos::Printer> printer =
+ base::Optional<chromeos::Printer> printer =
printers_manager_->GetPrinter(printer_name);
if (!printer) {
// If the printer was removed, the lookup will fail.
@@ -161,46 +196,37 @@ void LocalPrinterHandlerChromeos::StartGetCapability(
chromeos::Printer::kProtocolMax);
if (printers_manager_->IsPrinterInstalled(*printer)) {
- // Skip setup if the printer is already installed.
- HandlePrinterSetup(std::move(printer), std::move(cb), chromeos::kSuccess);
+ // Skip setup if the printer does not need to be installed.
+ HandlePrinterSetup(*printer, std::move(cb),
+ /*record_usb_setup_source=*/false, chromeos::kSuccess);
return;
}
- const chromeos::Printer& printer_ref = *printer;
printer_configurer_->SetUpPrinter(
- printer_ref,
- base::BindOnce(&LocalPrinterHandlerChromeos::HandlePrinterSetup,
- weak_factory_.GetWeakPtr(), std::move(printer),
- std::move(cb)));
+ *printer, base::BindOnce(&LocalPrinterHandlerChromeos::HandlePrinterSetup,
+ weak_factory_.GetWeakPtr(), *printer,
+ std::move(cb), printer->IsUsbProtocol()));
}
void LocalPrinterHandlerChromeos::HandlePrinterSetup(
- std::unique_ptr<chromeos::Printer> printer,
+ const chromeos::Printer& printer,
GetCapabilityCallback cb,
+ bool record_usb_setup_source,
chromeos::PrinterSetupResult result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
switch (result) {
case chromeos::PrinterSetupResult::kSuccess: {
- VLOG(1) << "Printer setup successful for " << printer->id()
+ VLOG(1) << "Printer setup successful for " << printer.id()
<< " fetching properties";
- printers_manager_->PrinterInstalled(*printer, true /*is_automatic*/);
-
- // populate |policies| with policies for native printers.
- base::Value policies(base::Value::Type::DICTIONARY);
- const PrefService* prefs = profile_->GetPrefs();
- policies.SetKey(
- kAllowedColorModes,
- base::Value(prefs->GetInteger(prefs::kPrintingAllowedColorModes)));
- policies.SetKey(
- kAllowedDuplexModes,
- base::Value(prefs->GetInteger(prefs::kPrintingAllowedDuplexModes)));
- policies.SetKey(kDefaultColorMode,
- base::Value(prefs->Get(prefs::kPrintingColorDefault)));
- policies.SetKey(kDefaultDuplexMode,
- base::Value(prefs->Get(prefs::kPrintingDuplexDefault)));
+ if (record_usb_setup_source) {
+ // Record UMA for USB printer setup source.
+ chromeos::PrinterConfigurer::RecordUsbPrinterSetupSource(
+ chromeos::UsbPrinterSetupSource::kPrintPreview);
+ }
+ printers_manager_->PrinterInstalled(printer, true /*is_automatic*/);
// fetch settings on the blocking pool and invoke callback.
- FetchCapabilities(std::move(printer), std::move(policies), std::move(cb));
+ FetchCapabilities(printer, GetNativePrinterPolicies(), std::move(cb));
return;
}
case chromeos::PrinterSetupResult::kPpdNotFound:
@@ -223,6 +249,7 @@ void LocalPrinterHandlerChromeos::HandlePrinterSetup(
case chromeos::PrinterSetupResult::kInvalidPrinterUpdate:
case chromeos::PrinterSetupResult::kDbusNoReply:
case chromeos::PrinterSetupResult::kDbusTimeout:
+ case chromeos::PrinterSetupResult::kEditSuccess:
LOG(ERROR) << "Unexpected error in printer setup. " << result;
break;
case chromeos::PrinterSetupResult::kMaxValue:
@@ -243,14 +270,39 @@ void LocalPrinterHandlerChromeos::StartPrint(
UMA_HISTOGRAM_MEMORY_KB("Printing.CUPS.PrintDocumentSize", size_in_kb);
if (profile_->GetPrefs()->GetBoolean(
prefs::kPrintingSendUsernameAndFilenameEnabled)) {
- settings.SetKey(kSettingUsername,
- base::Value(chromeos::ProfileHelper::Get()
- ->GetUserByProfile(profile_)
- ->display_email()));
+ std::string username = chromeos::ProfileHelper::Get()
+ ->GetUserByProfile(profile_)
+ ->display_email();
+ settings.SetKey(
+ kSettingUsername,
+ base::Value(username.empty() ? kUsernamePlaceholder : username));
+ settings.SetKey(kSettingJobTitle, base::Value(job_title));
settings.SetKey(kSettingSendUserInfo, base::Value(true));
}
StartLocalPrint(std::move(settings), std::move(print_data),
preview_web_contents_, std::move(callback));
}
+base::Value LocalPrinterHandlerChromeos::GetNativePrinterPolicies() const {
+ base::Value policies(base::Value::Type::DICTIONARY);
+ const PrefService* prefs = profile_->GetPrefs();
+ policies.SetKey(
+ kAllowedColorModes,
+ base::Value(prefs->GetInteger(prefs::kPrintingAllowedColorModes)));
+ policies.SetKey(
+ kAllowedDuplexModes,
+ base::Value(prefs->GetInteger(prefs::kPrintingAllowedDuplexModes)));
+ policies.SetKey(
+ kAllowedPinModes,
+ base::Value(prefs->GetInteger(prefs::kPrintingAllowedPinModes)));
+ policies.SetKey(kDefaultColorMode,
+ base::Value(prefs->GetInteger(prefs::kPrintingColorDefault)));
+ policies.SetKey(
+ kDefaultDuplexMode,
+ base::Value(prefs->GetInteger(prefs::kPrintingDuplexDefault)));
+ policies.SetKey(kDefaultPinMode,
+ base::Value(prefs->GetInteger(prefs::kPrintingPinDefault)));
+ return policies;
+}
+
} // namespace printing
diff --git a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.h b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.h
index de085a0db32..edca6f79919 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.h
+++ b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.h
@@ -27,8 +27,16 @@ namespace printing {
class LocalPrinterHandlerChromeos : public PrinterHandler {
public:
- LocalPrinterHandlerChromeos(Profile* profile,
- content::WebContents* preview_web_contents);
+ static std::unique_ptr<LocalPrinterHandlerChromeos> CreateDefault(
+ Profile* profile,
+ content::WebContents* preview_web_contents);
+
+ static std::unique_ptr<LocalPrinterHandlerChromeos> CreateForTesting(
+ Profile* profile,
+ content::WebContents* preview_web_contents,
+ chromeos::CupsPrintersManager* printers_manager,
+ std::unique_ptr<chromeos::PrinterConfigurer> printer_configurer);
+
~LocalPrinterHandlerChromeos() override;
// PrinterHandler implementation
@@ -44,8 +52,22 @@ class LocalPrinterHandlerChromeos : public PrinterHandler {
PrintCallback callback) override;
private:
- void HandlePrinterSetup(std::unique_ptr<chromeos::Printer> printer,
+ FRIEND_TEST_ALL_PREFIXES(LocalPrinterHandlerChromeosTest,
+ GetNativePrinterPolicies);
+
+ explicit LocalPrinterHandlerChromeos(
+ Profile* profile,
+ content::WebContents* preview_web_contents,
+ chromeos::CupsPrintersManager* printers_manager,
+ std::unique_ptr<chromeos::PrinterConfigurer> printer_configurer);
+
+ // Creates a value dictionary containing the printing policies set by
+ // |profile_|.
+ base::Value GetNativePrinterPolicies() const;
+
+ void HandlePrinterSetup(const chromeos::Printer& printer,
GetCapabilityCallback cb,
+ bool record_usb_setup_source,
chromeos::PrinterSetupResult result);
Profile* const profile_;
diff --git a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos_unittest.cc b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos_unittest.cc
new file mode 100644
index 00000000000..a079503537a
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos_unittest.cc
@@ -0,0 +1,323 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc"
+
+#include <algorithm>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "base/bind.h"
+#include "base/containers/flat_set.h"
+#include "base/json/json_string_value_serializer.h"
+#include "base/memory/ref_counted.h"
+#include "base/values.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/test/base/testing_profile.h"
+#include "components/sync_preferences/testing_pref_service_syncable.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "printing/backend/print_backend.h"
+#include "printing/backend/test_print_backend.h"
+#include "printing/print_job_constants.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace printing {
+
+namespace {
+
+using chromeos::CupsPrintersManager;
+using chromeos::Printer;
+using chromeos::PrinterConfigurer;
+using chromeos::PrinterSetupCallback;
+using chromeos::PrinterSetupResult;
+
+// Used as a callback to StartGetPrinters in tests.
+// Increases |*call_count| and records values returned by StartGetPrinters.
+void RecordPrinterList(size_t* call_count,
+ std::unique_ptr<base::ListValue>* printers_out,
+ const base::ListValue& printers) {
+ ++(*call_count);
+ printers_out->reset(printers.DeepCopy());
+}
+
+// Used as a callback to StartGetPrinters in tests.
+// Records that the test is done.
+void RecordPrintersDone(bool* is_done_out) {
+ *is_done_out = true;
+}
+
+void RecordGetCapability(std::unique_ptr<base::Value>* capabilities_out,
+ base::Value capability) {
+ capabilities_out->reset(capability.DeepCopy());
+}
+
+Printer CreateTestPrinter(const std::string& id, const std::string& name) {
+ Printer printer;
+ printer.set_id(id);
+ printer.set_display_name(name);
+ return printer;
+}
+
+Printer CreateEnterprisePrinter(const std::string& id,
+ const std::string& name) {
+ Printer printer = CreateTestPrinter(id, name);
+ printer.set_source(Printer::SRC_POLICY);
+ return printer;
+}
+
+class FakeCupsPrintersManager : public CupsPrintersManager {
+ public:
+ FakeCupsPrintersManager() : printers_(kNumPrinterClasses) {}
+
+ std::vector<Printer> GetPrinters(PrinterClass printer_class) const override {
+ return printers_[printer_class];
+ }
+
+ void RemoveUnavailablePrinters(std::vector<Printer>*) const override {}
+ void UpdateSavedPrinter(const Printer& printer) override {}
+ void RemoveSavedPrinter(const std::string& printer_id) override {}
+ void AddObserver(CupsPrintersManager::Observer* observer) override {}
+ void RemoveObserver(CupsPrintersManager::Observer* observer) override {}
+ void PrinterInstalled(const Printer& printer, bool is_automatic) override {}
+ void RecordSetupAbandoned(const Printer& printer) override {}
+
+ bool IsPrinterInstalled(const Printer& printer) const override {
+ return installed_.contains(printer.id());
+ }
+
+ base::Optional<Printer> GetPrinter(const std::string& id) const override {
+ // Search through each class of printers and find a printer with a
+ // matching id.
+ for (const std::vector<Printer>& v : printers_) {
+ auto iter = std::find_if(
+ v.begin(), v.end(), [&id](const Printer& p) { return p.id() == id; });
+ if (iter != v.end()) {
+ return *iter;
+ }
+ }
+ return base::nullopt;
+ }
+
+ // Add |printer| to the corresponding list in |printers_| bases on the given
+ // |printer_class|.
+ void AddPrinter(const Printer& printer, PrinterClass printer_class) {
+ ASSERT_LT(printer_class, printers_.size());
+ printers_[printer_class].push_back(printer);
+ }
+
+ void InstallPrinter(const std::string& id) { installed_.insert(id); }
+
+ private:
+ std::vector<std::vector<Printer>> printers_;
+ base::flat_set<std::string> installed_;
+};
+
+class FakePrinterConfigurer : public PrinterConfigurer {
+ public:
+ void SetUpPrinter(const Printer& printer,
+ PrinterSetupCallback callback) override {
+ std::move(callback).Run(PrinterSetupResult::kSuccess);
+ }
+};
+
+// Converts JSON string to base::ListValue object.
+// On failure, returns NULL and fills |*error| string.
+std::unique_ptr<base::ListValue> GetJSONAsListValue(const std::string& json,
+ std::string* error) {
+ auto ret = base::ListValue::From(
+ JSONStringValueDeserializer(json).Deserialize(nullptr, error));
+ if (!ret)
+ *error = "Value is not a list.";
+ return ret;
+}
+
+} // namespace
+
+class LocalPrinterHandlerChromeosTest : public testing::Test {
+ public:
+ LocalPrinterHandlerChromeosTest() = default;
+ ~LocalPrinterHandlerChromeosTest() override = default;
+
+ void SetUp() override {
+ test_backend_ = base::MakeRefCounted<TestPrintBackend>();
+ PrintBackend::SetPrintBackendForTesting(test_backend_.get());
+ local_printer_handler_ = LocalPrinterHandlerChromeos::CreateForTesting(
+ &profile_, nullptr, &printers_manager_,
+ std::make_unique<FakePrinterConfigurer>());
+ }
+
+ protected:
+ // Must outlive |profile_|.
+ content::TestBrowserThreadBundle thread_bundle_;
+ // Must outlive |printers_manager_|.
+ TestingProfile profile_;
+ scoped_refptr<TestPrintBackend> test_backend_;
+ FakeCupsPrintersManager printers_manager_;
+ std::unique_ptr<LocalPrinterHandlerChromeos> local_printer_handler_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LocalPrinterHandlerChromeosTest);
+};
+
+TEST_F(LocalPrinterHandlerChromeosTest, GetPrinters) {
+ size_t call_count = 0;
+ std::unique_ptr<base::ListValue> printers;
+ bool is_done = false;
+
+ Printer saved_printer = CreateTestPrinter("printer1", "saved");
+ Printer enterprise_printer =
+ CreateEnterprisePrinter("printer2", "enterprise");
+ Printer automatic_printer = CreateTestPrinter("printer3", "automatic");
+
+ printers_manager_.AddPrinter(saved_printer, CupsPrintersManager::kSaved);
+ printers_manager_.AddPrinter(enterprise_printer,
+ CupsPrintersManager::kEnterprise);
+ printers_manager_.AddPrinter(automatic_printer,
+ CupsPrintersManager::kAutomatic);
+
+ local_printer_handler_->StartGetPrinters(
+ base::BindRepeating(&RecordPrinterList, &call_count, &printers),
+ base::BindOnce(&RecordPrintersDone, &is_done));
+
+ EXPECT_EQ(call_count, 1u);
+ EXPECT_TRUE(is_done);
+ ASSERT_TRUE(printers);
+
+ const std::string expected_list = R"(
+ [
+ {
+ "cupsEnterprisePrinter": false,
+ "deviceName": "printer1",
+ "printerDescription": "",
+ "printerName": "saved",
+ "printerOptions": {
+ "cupsEnterprisePrinter": "false",
+ "system_driverinfo": ""
+ }
+ },
+ {
+ "cupsEnterprisePrinter": true,
+ "deviceName": "printer2",
+ "printerDescription": "",
+ "printerName": "enterprise",
+ "printerOptions": {
+ "cupsEnterprisePrinter": "true",
+ "system_driverinfo": ""
+ }
+ },
+ {
+ "cupsEnterprisePrinter": false,
+ "deviceName": "printer3",
+ "printerDescription": "",
+ "printerName": "automatic",
+ "printerOptions": {
+ "cupsEnterprisePrinter": "false",
+ "system_driverinfo": ""
+ }
+ }
+ ]
+ )";
+ std::string error;
+ std::unique_ptr<base::ListValue> expected_printers(
+ GetJSONAsListValue(expected_list, &error));
+ ASSERT_TRUE(expected_printers) << "Error deserializing printers: " << error;
+ EXPECT_EQ(*printers, *expected_printers);
+}
+
+// Tests that fetching capabilities for an existing installed printer is
+// successful.
+TEST_F(LocalPrinterHandlerChromeosTest, StartGetCapabilityValidPrinter) {
+ Printer saved_printer = CreateTestPrinter("printer1", "saved");
+ printers_manager_.AddPrinter(saved_printer, CupsPrintersManager::kSaved);
+ printers_manager_.InstallPrinter("printer1");
+
+ // Add printer capabilities to |test_backend_|.
+ PrinterSemanticCapsAndDefaults caps;
+ test_backend_->AddValidPrinter(
+ "printer1", std::make_unique<PrinterSemanticCapsAndDefaults>(caps));
+
+ std::unique_ptr<base::Value> fetched_caps;
+ local_printer_handler_->StartGetCapability(
+ "printer1", base::BindOnce(&RecordGetCapability, &fetched_caps));
+
+ thread_bundle_.RunUntilIdle();
+
+ ASSERT_TRUE(fetched_caps);
+ base::DictionaryValue* dict;
+ ASSERT_TRUE(fetched_caps->GetAsDictionary(&dict));
+ ASSERT_TRUE(dict->HasKey(kSettingCapabilities));
+ ASSERT_TRUE(dict->HasKey(kPrinter));
+}
+
+// Test that printers which have not yet been installed are installed with
+// SetUpPrinter before their capabilities are fetched.
+TEST_F(LocalPrinterHandlerChromeosTest, StartGetCapabilityPrinterNotInstalled) {
+ Printer discovered_printer = CreateTestPrinter("printer1", "discovered");
+ // NOTE: The printer |discovered_printer| is not installed using
+ // InstallPrinter.
+ printers_manager_.AddPrinter(discovered_printer,
+ CupsPrintersManager::kDiscovered);
+
+ // Add printer capabilities to |test_backend_|.
+ PrinterSemanticCapsAndDefaults caps;
+ test_backend_->AddValidPrinter(
+ "printer1", std::make_unique<PrinterSemanticCapsAndDefaults>(caps));
+
+ std::unique_ptr<base::Value> fetched_caps;
+ local_printer_handler_->StartGetCapability(
+ "printer1", base::BindOnce(&RecordGetCapability, &fetched_caps));
+
+ thread_bundle_.RunUntilIdle();
+
+ ASSERT_TRUE(fetched_caps);
+ base::DictionaryValue* dict;
+ ASSERT_TRUE(fetched_caps->GetAsDictionary(&dict));
+ ASSERT_TRUE(dict->HasKey(kSettingCapabilities));
+ ASSERT_TRUE(dict->HasKey(kPrinter));
+}
+
+// In this test we expect the StartGetCapability to bail early because the
+// provided printer can't be found in the CupsPrintersManager.
+TEST_F(LocalPrinterHandlerChromeosTest, StartGetCapabilityInvalidPrinter) {
+ std::unique_ptr<base::Value> fetched_caps;
+ local_printer_handler_->StartGetCapability(
+ "invalid printer", base::BindOnce(&RecordGetCapability, &fetched_caps));
+
+ thread_bundle_.RunUntilIdle();
+
+ ASSERT_TRUE(fetched_caps);
+ EXPECT_TRUE(fetched_caps->is_none());
+}
+
+TEST_F(LocalPrinterHandlerChromeosTest, GetNativePrinterPolicies) {
+ sync_preferences::TestingPrefServiceSyncable* prefs =
+ profile_.GetTestingPrefService();
+
+ prefs->SetUserPref(prefs::kPrintingAllowedColorModes,
+ std::make_unique<base::Value>(1));
+ prefs->SetUserPref(prefs::kPrintingAllowedDuplexModes,
+ std::make_unique<base::Value>(0));
+ prefs->SetUserPref(prefs::kPrintingAllowedPinModes,
+ std::make_unique<base::Value>(1));
+ prefs->SetUserPref(prefs::kPrintingColorDefault,
+ std::make_unique<base::Value>(2));
+ prefs->SetUserPref(prefs::kPrintingDuplexDefault,
+ std::make_unique<base::Value>(4));
+ prefs->SetUserPref(prefs::kPrintingPinDefault,
+ std::make_unique<base::Value>(0));
+
+ base::Value expected_policies(base::Value::Type::DICTIONARY);
+ expected_policies.SetKey(kAllowedColorModes, base::Value(1));
+ expected_policies.SetKey(kAllowedDuplexModes, base::Value(0));
+ expected_policies.SetKey(kAllowedPinModes, base::Value(1));
+ expected_policies.SetKey(kDefaultColorMode, base::Value(2));
+ expected_policies.SetKey(kDefaultDuplexMode, base::Value(4));
+ expected_policies.SetKey(kDefaultPinMode, base::Value(0));
+
+ EXPECT_EQ(expected_policies,
+ local_printer_handler_->GetNativePrinterPolicies());
+}
+
+} // namespace printing
diff --git a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc
index 8ddb28eb3b0..03bd08a9b71 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc
@@ -28,6 +28,20 @@ namespace printing {
namespace {
+scoped_refptr<base::TaskRunner> CreatePrinterHandlerTaskRunner() {
+ // USER_VISIBLE because the result is displayed in the print preview dialog.
+ static constexpr base::TaskTraits kTraits = {
+ base::MayBlock(), base::TaskPriority::USER_VISIBLE};
+
+#if defined(OS_WIN)
+ // Windows drivers are likely not thread-safe.
+ return base::CreateSingleThreadTaskRunnerWithTraits(kTraits);
+#elif defined(USE_CUPS)
+ // CUPS is thread safe.
+ return base::CreateTaskRunnerWithTraits(kTraits);
+#endif
+}
+
PrinterList EnumeratePrintersAsync() {
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);
@@ -63,6 +77,7 @@ base::Value FetchCapabilitiesAsync(const std::string& device_name) {
return base::Value();
return GetSettingsOnBlockingPool(device_name, basic_info, additional_papers,
+ /* has_secure_protocol */ false,
print_backend);
}
@@ -81,7 +96,8 @@ std::string GetDefaultPrinterAsync() {
LocalPrinterHandlerDefault::LocalPrinterHandlerDefault(
content::WebContents* preview_web_contents)
- : preview_web_contents_(preview_web_contents) {}
+ : preview_web_contents_(preview_web_contents),
+ task_runner_(CreatePrinterHandlerTaskRunner()) {}
LocalPrinterHandlerDefault::~LocalPrinterHandlerDefault() {}
@@ -90,10 +106,9 @@ void LocalPrinterHandlerDefault::Reset() {}
void LocalPrinterHandlerDefault::GetDefaultPrinter(DefaultPrinterCallback cb) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- // USER_VISIBLE because the result is displayed in the print preview dialog.
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
- base::BindOnce(&GetDefaultPrinterAsync), std::move(cb));
+ base::PostTaskAndReplyWithResult(task_runner_.get(), FROM_HERE,
+ base::BindOnce(&GetDefaultPrinterAsync),
+ std::move(cb));
}
void LocalPrinterHandlerDefault::StartGetPrinters(
@@ -102,10 +117,8 @@ void LocalPrinterHandlerDefault::StartGetPrinters(
VLOG(1) << "Enumerate printers start";
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- // USER_VISIBLE because the result is displayed in the print preview dialog.
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
- base::BindOnce(&EnumeratePrintersAsync),
+ base::PostTaskAndReplyWithResult(
+ task_runner_.get(), FROM_HERE, base::BindOnce(&EnumeratePrintersAsync),
base::BindOnce(&ConvertPrinterListForCallback, callback,
std::move(done_callback)));
}
@@ -115,9 +128,8 @@ void LocalPrinterHandlerDefault::StartGetCapability(
GetCapabilityCallback cb) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- // USER_VISIBLE because the result is displayed in the print preview dialog.
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
+ base::PostTaskAndReplyWithResult(
+ task_runner_.get(), FROM_HERE,
base::BindOnce(&FetchCapabilitiesAsync, device_name), std::move(cb));
}
diff --git a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.h b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.h
index 085c5ad2f53..25659249abb 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.h
+++ b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_default.h
@@ -10,10 +10,15 @@
#include "base/callback_forward.h"
#include "base/macros.h"
+#include "base/memory/scoped_refptr.h"
#include "base/strings/string16.h"
#include "base/values.h"
#include "chrome/browser/ui/webui/print_preview/printer_handler.h"
+namespace base {
+class TaskRunner;
+}
+
namespace content {
class WebContents;
}
@@ -41,6 +46,9 @@ class LocalPrinterHandlerDefault : public PrinterHandler {
private:
content::WebContents* const preview_web_contents_;
+ // TaskRunner for blocking tasks. Threading behavior is platform-specific.
+ scoped_refptr<base::TaskRunner> const task_runner_;
+
DISALLOW_COPY_AND_ASSIGN(LocalPrinterHandlerDefault);
};
diff --git a/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index e3322a2b85c..ab1f3fe8db5 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -80,6 +80,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
#include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h"
+#include "chrome/browser/ui/settings_window_manager_chromeos.h"
#include "chromeos/printing/printer_configuration.h"
#include "services/identity/public/cpp/scope_set.h"
#endif
@@ -545,6 +546,12 @@ void PrintPreviewHandler::RegisterMessages() {
base::BindRepeating(
&PrintPreviewHandler::HandleGrantExtensionPrinterAccess,
base::Unretained(this)));
+#if defined(OS_CHROMEOS)
+ web_ui()->RegisterMessageCallback(
+ "openPrinterSettings",
+ base::BindRepeating(&PrintPreviewHandler::HandleOpenPrinterSettings,
+ base::Unretained(this)));
+#endif
}
void PrintPreviewHandler::OnJavascriptAllowed() {
@@ -906,6 +913,16 @@ void PrintPreviewHandler::HandleClosePreviewDialog(
regenerate_preview_request_count_);
}
+#if defined(OS_CHROMEOS)
+void PrintPreviewHandler::HandleOpenPrinterSettings(
+ const base::ListValue* args) {
+ auto* const settings_manager = chrome::SettingsWindowManager::GetInstance();
+ settings_manager->ShowChromePageForProfile(
+ Profile::FromWebUI(web_ui()),
+ chrome::GetSettingsUrl(chrome::kPrintingSettingsSubPage));
+}
+#endif
+
void PrintPreviewHandler::GetNumberFormatAndMeasurementSystem(
base::DictionaryValue* settings) {
diff --git a/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.h b/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.h
index d6efb6a5eb0..f48a7699b5a 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.h
+++ b/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.h
@@ -240,6 +240,11 @@ class PrintPreviewHandler : public content::WebUIMessageHandler,
// preview is displayed.
void HandleGetInitialSettings(const base::ListValue* args);
+#if defined(OS_CHROMEOS)
+ // Opens printer settings in the Chrome OS Settings App.
+ void HandleOpenPrinterSettings(const base::ListValue* args);
+#endif
+
void SendInitialSettings(const std::string& callback_id,
const std::string& default_printer);
diff --git a/chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
index 5248587fa68..3f7e7a601b3 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/printing/print_preview_data_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/webui/dark_mode_handler.h"
#include "chrome/browser/ui/webui/localized_string.h"
#include "chrome/browser/ui/webui/metrics_handler.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
@@ -79,7 +80,7 @@ const char kBasicPrintShortcut[] = "\x28\xE2\x8c\xA5\xE2\x8C\x98\x50\x29";
const char kBasicPrintShortcut[] = "(Ctrl+Shift+P)";
#endif
-PrintPreviewUI::TestingDelegate* g_testing_delegate = nullptr;
+PrintPreviewUI::TestDelegate* g_test_delegate = nullptr;
// Thread-safe wrapper around a std::map to keep track of mappings from
// PrintPreviewUI IDs to most recent print preview request IDs.
@@ -130,28 +131,32 @@ base::LazyInstance<PrintPreviewRequestIdMapWithLock>::DestructorAtExit
base::LazyInstance<base::IDMap<PrintPreviewUI*>>::DestructorAtExit
g_print_preview_ui_id_map = LAZY_INSTANCE_INITIALIZER;
+bool ShouldHandleRequestCallback(const std::string& path) {
+ // ChromeWebUIDataSource handles most requests except for the print preview
+ // data.
+ return PrintPreviewUI::ParseDataPath(path, nullptr, nullptr);
+}
+
// Get markup or other resources for the print preview page.
-bool HandleRequestCallback(
+void HandleRequestCallback(
const std::string& path,
const content::WebUIDataSource::GotDataCallback& callback) {
// ChromeWebUIDataSource handles most requests except for the print preview
// data.
int preview_ui_id;
int page_index;
- if (!PrintPreviewUI::ParseDataPath(path, &preview_ui_id, &page_index))
- return false;
+ CHECK(PrintPreviewUI::ParseDataPath(path, &preview_ui_id, &page_index));
scoped_refptr<base::RefCountedMemory> data;
PrintPreviewDataService::GetInstance()->GetDataEntry(preview_ui_id,
page_index, &data);
if (data.get()) {
callback.Run(data.get());
- return true;
+ return;
}
// Invalid request.
auto empty_bytes = base::MakeRefCounted<base::RefCountedBytes>();
callback.Run(empty_bytes.get());
- return true;
}
void AddPrintPreviewStrings(content::WebUIDataSource* source) {
@@ -221,9 +226,11 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
{"optionFitToPage", IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAGE},
{"optionHeaderFooter", IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER},
{"optionLandscape", IDS_PRINT_PREVIEW_OPTION_LANDSCAPE},
+ {"optionLongEdge", IDS_PRINT_PREVIEW_OPTION_LONG_EDGE},
{"optionPortrait", IDS_PRINT_PREVIEW_OPTION_PORTRAIT},
{"optionRasterize", IDS_PRINT_PREVIEW_OPTION_RASTERIZE},
{"optionSelectionOnly", IDS_PRINT_PREVIEW_OPTION_SELECTION_ONLY},
+ {"optionShortEdge", IDS_PRINT_PREVIEW_OPTION_SHORT_EDGE},
{"optionTwoSided", IDS_PRINT_PREVIEW_OPTION_TWO_SIDED},
{"optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL},
{"pageRangeLimitInstructionWithValue",
@@ -233,11 +240,14 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
{"pagesLabel", IDS_PRINT_PREVIEW_PAGES_LABEL},
{"pagesPerSheetLabel", IDS_PRINT_PREVIEW_PAGES_PER_SHEET_LABEL},
{"previewFailed", IDS_PRINT_PREVIEW_FAILED},
+ {"printOnBothSidesLabel", IDS_PRINT_PREVIEW_PRINT_ON_BOTH_SIDES_LABEL},
{"printButton", IDS_PRINT_PREVIEW_PRINT_BUTTON},
{"printDestinationsTitle", IDS_PRINT_PREVIEW_PRINT_DESTINATIONS_TITLE},
{"printPagesLabel", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL},
{"printPreviewPageLabelPlural", IDS_PRINT_PREVIEW_PAGE_LABEL_PLURAL},
{"printPreviewPageLabelSingular", IDS_PRINT_PREVIEW_PAGE_LABEL_SINGULAR},
+ {"printPreviewNewSummaryFormatShort",
+ IDS_PRINT_PREVIEW_NEW_SUMMARY_FORMAT_SHORT},
{"printPreviewSheetsLabelPlural", IDS_PRINT_PREVIEW_SHEETS_LABEL_PLURAL},
{"printPreviewSheetsLabelSingular",
IDS_PRINT_PREVIEW_SHEETS_LABEL_SINGULAR},
@@ -271,6 +281,9 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
#if defined(OS_CHROMEOS)
{"configuringFailedText", IDS_PRINT_CONFIGURING_FAILED_TEXT},
{"configuringInProgressText", IDS_PRINT_CONFIGURING_IN_PROGRESS_TEXT},
+ {"optionPin", IDS_PRINT_PREVIEW_OPTION_PIN},
+ {"pinErrorMessage", IDS_PRINT_PREVIEW_PIN_ERROR_MESSAGE},
+ {"pinPlaceholder", IDS_PRINT_PREVIEW_PIN_PLACEHOLDER},
#endif
#if defined(OS_MACOSX)
{"openPdfInPreviewOption", IDS_PRINT_PREVIEW_OPEN_PDF_IN_PREVIEW_APP},
@@ -317,6 +330,15 @@ void AddPrintPreviewFlags(content::WebUIDataSource* source, Profile* profile) {
base::FeatureList::IsEnabled(features::kCloudPrinterHandler);
source->AddBoolean("cloudPrinterHandlerEnabled",
cloud_printer_handler_enabled);
+ bool new_print_preview_layout_enabled =
+ base::FeatureList::IsEnabled(features::kNewPrintPreviewLayout);
+ source->AddBoolean("newPrintPreviewLayoutEnabled",
+ new_print_preview_layout_enabled);
+ // The key for the string below needs to be all lowercase, since it is used
+ // as an attribute and attributes are lowercased when the page is bundled.
+ source->AddString("newprintpreviewlayout", new_print_preview_layout_enabled
+ ? "new-print-preview-layout"
+ : "");
}
std::vector<std::string> SetupPrintPreviewPlugin(
@@ -406,7 +428,8 @@ std::vector<std::string> SetupPrintPreviewPlugin(
source->AddResourcePath(resource.path, resource.id);
}
- source->SetRequestFilter(base::BindRepeating(&HandleRequestCallback));
+ source->SetRequestFilter(base::BindRepeating(&ShouldHandleRequestCallback),
+ base::BindRepeating(&HandleRequestCallback));
source->OverrideContentSecurityPolicyChildSrc("child-src 'self';");
source->DisableDenyXFrameOptions();
source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';");
@@ -471,6 +494,7 @@ PrintPreviewUI::PrintPreviewUI(content::WebUI* web_ui)
// Set up the chrome://print/ data source.
Profile* profile = Profile::FromWebUI(web_ui);
content::WebUIDataSource* source = CreatePrintPreviewUISource(profile);
+ DarkModeHandler::Initialize(web_ui, source);
content::WebUIDataSource::Add(profile, source);
// Set up the chrome://theme/ source.
@@ -641,8 +665,8 @@ void PrintPreviewUI::OnDidStartPreview(
page_size_ = params.page_size;
ClearAllPreviewData();
- if (g_testing_delegate)
- g_testing_delegate->DidGetPreviewPageCount(params.page_count);
+ if (g_test_delegate)
+ g_test_delegate->DidGetPreviewPageCount(params.page_count);
handler_->SendPageCountReady(params.page_count, params.fit_to_page_scaling,
request_id);
}
@@ -693,8 +717,8 @@ void PrintPreviewUI::OnDidPreviewPage(
SetPrintPreviewDataForIndex(page_number, std::move(data));
- if (g_testing_delegate)
- g_testing_delegate->DidRenderPreviewPage(web_ui()->GetWebContents());
+ if (g_test_delegate)
+ g_test_delegate->DidRenderPreviewPage(web_ui()->GetWebContents());
handler_->SendPagePreviewReady(page_number, *id_, preview_request_id);
}
@@ -770,8 +794,8 @@ void PrintPreviewUI::OnSetOptionsFromDocument(
}
// static
-void PrintPreviewUI::SetDelegateForTesting(TestingDelegate* delegate) {
- g_testing_delegate = delegate;
+void PrintPreviewUI::SetDelegateForTesting(TestDelegate* delegate) {
+ g_test_delegate = delegate;
}
void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) {
diff --git a/chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.h b/chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.h
index 39b654aeb4a..2958b36ecef 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.h
+++ b/chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <string>
#include <vector>
#include "base/callback_forward.h"
@@ -185,13 +186,16 @@ class PrintPreviewUI : public ConstrainedWebDialogUI {
int request_id);
// Allows tests to wait until the print preview dialog is loaded.
- class TestingDelegate {
+ class TestDelegate {
public:
virtual void DidGetPreviewPageCount(int page_count) = 0;
virtual void DidRenderPreviewPage(content::WebContents* preview_dialog) = 0;
+
+ protected:
+ virtual ~TestDelegate() = default;
};
- static void SetDelegateForTesting(TestingDelegate* delegate);
+ static void SetDelegateForTesting(TestDelegate* delegate);
// Allows for tests to set a file path to print a PDF to. This also initiates
// the printing without having to click a button on the print preview dialog.
diff --git a/chromium/chrome/browser/ui/webui/print_preview/printer_handler.cc b/chromium/chrome/browser/ui/webui/print_preview/printer_handler.cc
index d5fcabdf66a..84afb6f3be9 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/printer_handler.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/printer_handler.cc
@@ -38,8 +38,8 @@ std::unique_ptr<PrinterHandler> PrinterHandler::CreateForLocalPrinters(
content::WebContents* preview_web_contents,
Profile* profile) {
#if defined(OS_CHROMEOS)
- return std::make_unique<LocalPrinterHandlerChromeos>(profile,
- preview_web_contents);
+ return LocalPrinterHandlerChromeos::CreateDefault(profile,
+ preview_web_contents);
#else
return std::make_unique<LocalPrinterHandlerDefault>(preview_web_contents);
#endif
diff --git a/chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.cc b/chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.cc
index e2acd7b8d41..69e40cd06f9 100644
--- a/chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.cc
+++ b/chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.cc
@@ -111,8 +111,8 @@ ResetPasswordUI::ResetPasswordUI(content::WebUI* web_ui)
std::unique_ptr<content::WebUIDataSource> html_source(
content::WebUIDataSource::Create(chrome::kChromeUIResetPasswordHost));
html_source->AddResourcePath("reset_password.js", IDR_RESET_PASSWORD_JS);
- html_source->AddResourcePath("reset_password.mojom.js",
- IDR_RESET_PASSWORD_MOJO_JS);
+ html_source->AddResourcePath("reset_password.mojom-lite.js",
+ IDR_RESET_PASSWORD_MOJOM_LITE_JS);
html_source->SetDefaultResource(IDR_RESET_PASSWORD_HTML);
html_source->AddLocalizedStrings(PopulateStrings());
html_source->UseGzip();
diff --git a/chromium/chrome/browser/ui/webui/settings/about_handler.cc b/chromium/chrome/browser/ui/webui/settings/about_handler.cc
index 3bb9116bb70..2ae0eb80edd 100644
--- a/chromium/chrome/browser/ui/webui/settings/about_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/about_handler.cc
@@ -64,7 +64,7 @@
#include "chrome/browser/ui/webui/help/help_utils_chromeos.h"
#include "chrome/browser/ui/webui/help/version_updater_chromeos.h"
#include "chromeos/constants/chromeos_switches.h"
-#include "chromeos/dbus/power_manager_client.h"
+#include "chromeos/dbus/power/power_manager_client.h"
#include "chromeos/dbus/util/version_loader.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
diff --git a/chromium/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc b/chromium/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc
index a3562e851d2..64e4f292e47 100644
--- a/chromium/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "build/build_config.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#if defined(OS_CHROMEOS)
@@ -18,6 +19,10 @@
#include "components/user_manager/user_manager.h"
#endif // defined(OS_CHROMEOS)
+#if defined(OS_MACOSX)
+#include "chrome/browser/first_run/upgrade_util_mac.h"
+#endif
+
namespace settings {
namespace {
@@ -81,6 +86,11 @@ void BrowserLifetimeHandler::HandleRestart(
void BrowserLifetimeHandler::HandleRelaunch(
const base::ListValue* args) {
+#if defined(OS_MACOSX)
+ if (!upgrade_util::ShouldContinueToRelaunchForUpgrade())
+ return;
+#endif // OS_MACOSX
+
chrome::AttemptRelaunch();
}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc
index caccda79fb5..adf3b5397e3 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc
@@ -12,12 +12,12 @@
#include "base/macros.h"
#include "base/values.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
+#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chromeos/account_manager_welcome_dialog.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h"
-#include "chromeos/account_manager/account_manager.h"
-#include "chromeos/account_manager/account_manager_factory.h"
+#include "chromeos/components/account_manager/account_manager_factory.h"
#include "components/user_manager/user.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -31,6 +31,19 @@ namespace settings {
namespace {
+constexpr char kFamilyLink[] = "Family Link";
+
+std::string GetEnterpriseDomainFromUsername(const std::string& username) {
+ size_t email_separator_pos = username.find('@');
+ bool is_email = email_separator_pos != std::string::npos &&
+ email_separator_pos < username.length() - 1;
+
+ if (!is_email)
+ return std::string();
+
+ return gaia::ExtractDomainName(username);
+}
+
AccountManager::AccountKey GetAccountKeyFromJsCallback(
const base::DictionaryValue* const dictionary) {
const base::Value* id_value = dictionary->FindKey("id");
@@ -150,7 +163,7 @@ void AccountManagerUIHandler::OnGetAccounts(
!identity_manager_->HasAccountWithRefreshTokenInPersistentErrorState(
maybe_account_info->account_id));
account.SetString("fullName", maybe_account_info->full_name);
- account.SetString("email", maybe_account_info->email);
+ account.SetString("email", stored_account.raw_email);
if (!maybe_account_info->account_image.IsEmpty()) {
account.SetString("pic",
webui::GetBitmapDataUrl(
@@ -174,6 +187,19 @@ void AccountManagerUIHandler::OnGetAccounts(
// Device account must show up at the top.
if (!device_account.empty()) {
device_account.SetBoolean("isDeviceAccount", true);
+
+ // Check if user is managed.
+ const Profile* const profile = Profile::FromWebUI(web_ui());
+ if (profile->IsChild()) {
+ device_account.SetString("organization", kFamilyLink);
+ } else if (policy::ProfilePolicyConnectorFactory::IsProfileManaged(
+ profile)) {
+ device_account.SetString(
+ "organization",
+ GetEnterpriseDomainFromUsername(
+ identity_manager_->GetPrimaryAccountInfo().email));
+ }
+
accounts.GetList().insert(accounts.GetList().begin(),
std::move(device_account));
}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h
index 029da8d3344..05462762595 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h
@@ -12,7 +12,7 @@
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
-#include "chromeos/account_manager/account_manager.h"
+#include "chromeos/components/account_manager/account_manager.h"
#include "services/identity/public/cpp/identity_manager.h"
namespace chromeos {
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc
index a9e5e26cfa4..2038031a39e 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc
@@ -41,8 +41,8 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/url_constants.h"
-#include "media/audio/sounds/sounds_manager.h"
#include "net/base/data_url.h"
+#include "services/audio/public/cpp/sounds/sounds_manager.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/web_ui_util.h"
@@ -88,7 +88,7 @@ ChangePictureHandler::ChangePictureHandler()
user_manager_observer_(this),
camera_observer_(this) {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- media::SoundsManager* manager = media::SoundsManager::Get();
+ audio::SoundsManager* manager = audio::SoundsManager::Get();
manager->Initialize(SOUND_OBJECT_DELETE,
bundle.GetRawDataResource(IDR_SOUND_OBJECT_DELETE_WAV));
manager->Initialize(SOUND_CAMERA_SNAP,
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
index d8f69e3f354..7559e034ef9 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/ui/webui/settings/chromeos/crostini_handler.h"
#include <string>
+#include <utility>
+#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -23,11 +25,7 @@ CrostiniHandler::CrostiniHandler(Profile* profile)
: profile_(profile), weak_ptr_factory_(this) {}
CrostiniHandler::~CrostiniHandler() {
- if (crostini::CrostiniManager::GetForProfile(profile_)
- ->HasInstallerViewStatusObserver(this)) {
- crostini::CrostiniManager::GetForProfile(profile_)
- ->RemoveInstallerViewStatusObserver(this);
- }
+ DisallowJavascript();
}
void CrostiniHandler::RegisterMessages() {
@@ -49,6 +47,14 @@ void CrostiniHandler::RegisterMessages() {
base::BindRepeating(&CrostiniHandler::HandleRemoveCrostiniSharedPath,
weak_ptr_factory_.GetWeakPtr()));
web_ui()->RegisterMessageCallback(
+ "getCrostiniSharedUsbDevices",
+ base::BindRepeating(&CrostiniHandler::HandleGetCrostiniSharedUsbDevices,
+ weak_ptr_factory_.GetWeakPtr()));
+ web_ui()->RegisterMessageCallback(
+ "setCrostiniUsbDeviceShared",
+ base::BindRepeating(&CrostiniHandler::HandleSetCrostiniUsbDeviceShared,
+ weak_ptr_factory_.GetWeakPtr()));
+ web_ui()->RegisterMessageCallback(
"exportCrostiniContainer",
base::BindRepeating(&CrostiniHandler::HandleExportCrostiniContainer,
weak_ptr_factory_.GetWeakPtr()));
@@ -61,8 +67,25 @@ void CrostiniHandler::RegisterMessages() {
base::BindRepeating(
&CrostiniHandler::HandleCrostiniInstallerStatusRequest,
weak_ptr_factory_.GetWeakPtr()));
+}
+
+void CrostiniHandler::OnJavascriptAllowed() {
crostini::CrostiniManager::GetForProfile(profile_)
->AddInstallerViewStatusObserver(this);
+ if (chromeos::CrosUsbDetector::Get()) {
+ chromeos::CrosUsbDetector::Get()->AddSharedUsbDeviceObserver(this);
+ }
+}
+
+void CrostiniHandler::OnJavascriptDisallowed() {
+ if (crostini::CrostiniManager::GetForProfile(profile_)
+ ->HasInstallerViewStatusObserver(this)) {
+ crostini::CrostiniManager::GetForProfile(profile_)
+ ->RemoveInstallerViewStatusObserver(this);
+ }
+ if (chromeos::CrosUsbDetector::Get()) {
+ chromeos::CrosUsbDetector::Get()->RemoveSharedUsbDeviceObserver(this);
+ }
}
void CrostiniHandler::HandleRequestCrostiniInstallerView(
@@ -97,12 +120,15 @@ void CrostiniHandler::HandleGetCrostiniSharedPathsDisplayText(
void CrostiniHandler::HandleRemoveCrostiniSharedPath(
const base::ListValue* args) {
- CHECK_EQ(1U, args->GetSize());
+ CHECK_EQ(2U, args->GetSize());
+ std::string vm_name;
+ CHECK(args->GetString(0, &vm_name));
std::string path;
- CHECK(args->GetString(0, &path));
+ CHECK(args->GetString(1, &path));
crostini::CrostiniSharePath::GetForProfile(profile_)->UnsharePath(
- crostini::kCrostiniDefaultVmName, base::FilePath(path),
+ vm_name, base::FilePath(path),
+ /*unpersist=*/true,
base::BindOnce(
[](const std::string& path, bool result, std::string failure_reason) {
if (!result) {
@@ -113,6 +139,65 @@ void CrostiniHandler::HandleRemoveCrostiniSharedPath(
path));
}
+namespace {
+base::ListValue UsbDevicesToListValue(
+ const std::vector<SharedUsbDeviceInfo> shared_usbs) {
+ base::ListValue usb_devices_list;
+ for (auto device : shared_usbs) {
+ base::Value device_info(base::Value::Type::DICTIONARY);
+ device_info.SetKey("guid", base::Value(device.guid));
+ device_info.SetKey("label", base::Value(device.label));
+ device_info.SetKey("shared", base::Value(device.shared));
+ usb_devices_list.GetList().push_back(std::move(device_info));
+ }
+ return usb_devices_list;
+}
+} // namespace
+
+void CrostiniHandler::HandleGetCrostiniSharedUsbDevices(
+ const base::ListValue* args) {
+ AllowJavascript();
+ CHECK_EQ(1U, args->GetSize());
+
+ std::string callback_id = args->GetList()[0].GetString();
+
+ chromeos::CrosUsbDetector* detector = chromeos::CrosUsbDetector::Get();
+ if (!detector) {
+ ResolveJavascriptCallback(base::Value(callback_id), base::ListValue());
+ return;
+ }
+
+ ResolveJavascriptCallback(
+ base::Value(callback_id),
+ UsbDevicesToListValue(detector->GetSharedUsbDevices()));
+}
+
+void CrostiniHandler::HandleSetCrostiniUsbDeviceShared(
+ const base::ListValue* args) {
+ CHECK_EQ(2U, args->GetSize());
+ const auto& args_list = args->GetList();
+ std::string guid = args_list[0].GetString();
+ bool shared = args_list[1].GetBool();
+
+ chromeos::CrosUsbDetector* detector = chromeos::CrosUsbDetector::Get();
+ if (!detector)
+ return;
+
+ if (shared) {
+ detector->AttachUsbDeviceToVm(crostini::kCrostiniDefaultVmName, guid,
+ base::DoNothing());
+ return;
+ }
+ detector->DetachUsbDeviceFromVm(crostini::kCrostiniDefaultVmName, guid,
+ base::DoNothing());
+}
+
+void CrostiniHandler::OnSharedUsbDevicesChanged(
+ const std::vector<SharedUsbDeviceInfo> shared_usbs) {
+ FireWebUIListener("crostini-shared-usb-devices-changed",
+ UsbDevicesToListValue(shared_usbs));
+}
+
void CrostiniHandler::HandleExportCrostiniContainer(
const base::ListValue* args) {
CHECK_EQ(0U, args->GetSize());
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
index 6358b30e17b..cda0346383e 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
@@ -5,8 +5,11 @@
#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CROSTINI_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CROSTINI_HANDLER_H_
+#include <vector>
+
#include "base/memory/weak_ptr.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
+#include "chrome/browser/chromeos/usb/cros_usb_detector.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
class Profile;
@@ -19,15 +22,16 @@ namespace chromeos {
namespace settings {
class CrostiniHandler : public ::settings::SettingsPageUIHandler,
- public crostini::InstallerViewStatusObserver {
+ public crostini::InstallerViewStatusObserver,
+ public chromeos::SharedUsbDeviceObserver {
public:
explicit CrostiniHandler(Profile* profile);
~CrostiniHandler() override;
// SettingsPageUIHandler
void RegisterMessages() override;
- void OnJavascriptAllowed() override {}
- void OnJavascriptDisallowed() override {}
+ void OnJavascriptAllowed() override;
+ void OnJavascriptDisallowed() override;
private:
void HandleRequestCrostiniInstallerView(const base::ListValue* args);
@@ -38,6 +42,13 @@ class CrostiniHandler : public ::settings::SettingsPageUIHandler,
void HandleGetCrostiniSharedPathsDisplayText(const base::ListValue* args);
// Remove a specified path from being shared.
void HandleRemoveCrostiniSharedPath(const base::ListValue* args);
+ // Returns a list of available USB devices.
+ void HandleGetCrostiniSharedUsbDevices(const base::ListValue* args);
+ // Set the share state of a USB device.
+ void HandleSetCrostiniUsbDeviceShared(const base::ListValue* args);
+ // chromeos::SharedUsbDeviceObserver.
+ void OnSharedUsbDevicesChanged(
+ const std::vector<SharedUsbDeviceInfo> shared_usbs) override;
// Export the crostini container.
void HandleExportCrostiniContainer(const base::ListValue* args);
// Import the crostini container.
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
index 28b9e86154d..d4c16b23d88 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
@@ -13,6 +13,7 @@
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
+#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -49,6 +50,7 @@
#include "content/public/browser/web_ui.h"
#include "google_apis/google_api_keys.h"
#include "net/base/filename_util.h"
+#include "net/base/ip_endpoint.h"
#include "net/url_request/url_request_context_getter.h"
#include "printing/backend/print_backend.h"
@@ -253,15 +255,43 @@ Printer::PpdReference GetPpdReference(const base::Value* info) {
} // namespace
-CupsPrintersHandler::CupsPrintersHandler(content::WebUI* webui)
- : profile_(Profile::FromWebUI(webui)),
- ppd_provider_(CreatePpdProvider(profile_)),
- printer_configurer_(PrinterConfigurer::Create(profile_)),
- printers_manager_(
- CupsPrintersManagerFactory::GetForBrowserContext(profile_)),
+CupsPrintersHandler::CupsPrintersHandler(
+ Profile* profile,
+ scoped_refptr<PpdProvider> ppd_provider,
+ std::unique_ptr<PrinterConfigurer> printer_configurer,
+ CupsPrintersManager* printers_manager)
+ : profile_(profile),
+ ppd_provider_(ppd_provider),
+ printer_configurer_(std::move(printer_configurer)),
+ printers_manager_(printers_manager),
+ endpoint_resolver_(std::make_unique<local_discovery::EndpointResolver>()),
printers_manager_observer_(this),
weak_factory_(this) {}
+// static
+std::unique_ptr<CupsPrintersHandler> CupsPrintersHandler::Create(
+ content::WebUI* webui) {
+ Profile* profile(Profile::FromWebUI(webui));
+ auto ppd_provider = CreatePpdProvider(profile);
+ auto printer_configurer = PrinterConfigurer::Create(profile);
+ CupsPrintersManager* printers_manager =
+ CupsPrintersManagerFactory::GetForBrowserContext(profile);
+ // Using 'new' to access non-public constructor.
+ return base::WrapUnique(new CupsPrintersHandler(
+ profile, ppd_provider, std::move(printer_configurer), printers_manager));
+}
+
+// static
+std::unique_ptr<CupsPrintersHandler> CupsPrintersHandler::CreateForTesting(
+ Profile* profile,
+ scoped_refptr<PpdProvider> ppd_provider,
+ std::unique_ptr<PrinterConfigurer> printer_configurer,
+ CupsPrintersManager* printers_manager) {
+ // Using 'new' to access non-public constructor.
+ return base::WrapUnique(new CupsPrintersHandler(
+ profile, ppd_provider, std::move(printer_configurer), printers_manager));
+}
+
CupsPrintersHandler::~CupsPrintersHandler() = default;
void CupsPrintersHandler::RegisterMessages() {
@@ -282,6 +312,10 @@ void CupsPrintersHandler::RegisterMessages() {
base::BindRepeating(&CupsPrintersHandler::HandleAddCupsPrinter,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
+ "reconfigureCupsPrinter",
+ base::BindRepeating(&CupsPrintersHandler::HandleReconfigureCupsPrinter,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
"getPrinterInfo",
base::BindRepeating(&CupsPrintersHandler::HandleGetPrinterInfo,
base::Unretained(this)));
@@ -331,6 +365,10 @@ void CupsPrintersHandler::OnJavascriptDisallowed() {
printers_manager_observer_.RemoveAll();
}
+void CupsPrintersHandler::SetWebUIForTest(content::WebUI* web_ui) {
+ set_web_ui(web_ui);
+}
+
void CupsPrintersHandler::HandleGetCupsPrintersList(
const base::ListValue* args) {
AllowJavascript();
@@ -340,7 +378,7 @@ void CupsPrintersHandler::HandleGetCupsPrintersList(
CHECK(args->GetString(0, &callback_id));
std::vector<Printer> printers =
- printers_manager_->GetPrinters(CupsPrintersManager::kConfigured);
+ printers_manager_->GetPrinters(CupsPrintersManager::kSaved);
auto response = BuildCupsPrintersList(printers);
ResolveJavascriptCallback(base::Value(callback_id), response);
@@ -356,25 +394,18 @@ void CupsPrintersHandler::HandleUpdateCupsPrinter(const base::ListValue* args) {
printer.set_display_name(printer_name);
if (!profile_->GetPrefs()->GetBoolean(prefs::kUserNativePrintersAllowed)) {
- PRINTER_LOG(DEBUG) << "HandleAddCupsPrinter() called when "
+ PRINTER_LOG(DEBUG) << "HandleUpdateCupsPrinter() called when "
"kUserNativePrintersAllowed is set to false";
- // Used to log UMA metrics.
- OnAddedPrinterCommon(printer,
- PrinterSetupResult::kNativePrintersNotAllowed,
- false);
+ OnAddedOrEditedPrinterCommon(printer,
+ PrinterSetupResult::kNativePrintersNotAllowed,
+ false /* is_automatic */);
// Used to fire the web UI listener.
- OnAddPrinterError(PrinterSetupResult::kNativePrintersNotAllowed);
+ OnAddOrEditPrinterError(PrinterSetupResult::kNativePrintersNotAllowed);
return;
}
- PRINTER_LOG(USER) << "Comitting printer update";
- printers_manager_->UpdateConfiguredPrinter(printer);
-
- // TODO(xdai): Replace "on-add-cups-printer" callback with Promise resolve
- // function.
- FireWebUIListener("on-add-cups-printer",
- base::Value(PrinterSetupResult::kSuccess),
- base::Value(printer_name));
+ OnAddedOrEditedSpecifiedPrinter(printer, true /* is_printer_edit */,
+ PrinterSetupResult::kEditSuccess);
}
void CupsPrintersHandler::HandleRemoveCupsPrinter(const base::ListValue* args) {
@@ -393,11 +424,12 @@ void CupsPrintersHandler::HandleRemoveCupsPrinter(const base::ListValue* args) {
Printer::PrinterProtocol protocol = printer->GetProtocol();
// Printer is deleted here. Do not access after this line.
- printers_manager_->RemoveConfiguredPrinter(printer_id);
+ printers_manager_->RemoveSavedPrinter(printer_id);
DebugDaemonClient* client = DBusThreadManager::Get()->GetDebugDaemonClient();
- client->CupsRemovePrinter(
- printer_name, base::Bind(&OnRemovedPrinter, protocol), base::DoNothing());
+ client->CupsRemovePrinter(printer_id,
+ base::BindOnce(&OnRemovedPrinter, protocol),
+ base::DoNothing());
}
void CupsPrintersHandler::HandleGetPrinterInfo(const base::ListValue* args) {
@@ -448,7 +480,7 @@ void CupsPrintersHandler::HandleGetPrinterInfo(const base::ListValue* args) {
}
void CupsPrintersHandler::OnAutoconfQueriedDiscovered(
- std::unique_ptr<Printer> printer,
+ Printer printer,
bool success,
const std::string& make,
const std::string& model,
@@ -465,9 +497,9 @@ void CupsPrintersHandler::OnAutoconfQueriedDiscovered(
// manufacturer and model are set with make_and_model because they are
// derived from make_and_model for compatability and are slated for
// removal.
- printer->set_manufacturer(make);
- printer->set_model(model);
- printer->set_make_and_model(make_and_model);
+ printer.set_manufacturer(make);
+ printer.set_model(model);
+ printer.set_make_and_model(make_and_model);
PRINTER_LOG(DEBUG) << "Printer queried for make and model "
<< make_and_model;
}
@@ -475,10 +507,11 @@ void CupsPrintersHandler::OnAutoconfQueriedDiscovered(
// Autoconfig available, use it.
if (ipp_everywhere) {
PRINTER_LOG(DEBUG) << "Performing autoconf setup";
- printer->mutable_ppd_reference()->autoconf = true;
+ printer.mutable_ppd_reference()->autoconf = true;
printer_configurer_->SetUpPrinter(
- *printer, base::Bind(&CupsPrintersHandler::OnAddedDiscoveredPrinter,
- weak_factory_.GetWeakPtr(), *printer));
+ printer,
+ base::BindOnce(&CupsPrintersHandler::OnAddedDiscoveredPrinter,
+ weak_factory_.GetWeakPtr(), printer));
return;
}
}
@@ -487,7 +520,7 @@ void CupsPrintersHandler::OnAutoconfQueriedDiscovered(
// much information as we can about the printer, and ask the user to supply
// the rest.
PRINTER_LOG(EVENT) << "Could not query printer. Fallback to asking the user";
- FireManuallyAddDiscoveredPrinter(*printer);
+ FireManuallyAddDiscoveredPrinter(printer);
}
void CupsPrintersHandler::OnAutoconfQueried(
@@ -555,26 +588,35 @@ void CupsPrintersHandler::OnPpdResolved(const std::string& callback_id,
void CupsPrintersHandler::HandleAddCupsPrinter(const base::ListValue* args) {
AllowJavascript();
+ AddOrReconfigurePrinter(args, false /* is_printer_edit */);
+}
+
+void CupsPrintersHandler::HandleReconfigureCupsPrinter(
+ const base::ListValue* args) {
+ AllowJavascript();
+ AddOrReconfigurePrinter(args, true /* is_printer_edit */);
+}
+void CupsPrintersHandler::AddOrReconfigurePrinter(const base::ListValue* args,
+ bool is_printer_edit) {
const base::DictionaryValue* printer_dict = nullptr;
CHECK(args->GetDictionary(0, &printer_dict));
std::unique_ptr<Printer> printer = DictToPrinter(*printer_dict);
if (!printer) {
PRINTER_LOG(ERROR) << "Failed to parse printer URI";
- OnAddPrinterError(PrinterSetupResult::kFatalError);
+ OnAddOrEditPrinterError(PrinterSetupResult::kFatalError);
return;
}
if (!profile_->GetPrefs()->GetBoolean(prefs::kUserNativePrintersAllowed)) {
- PRINTER_LOG(DEBUG) << "HandleAddCupsPrinter() called when "
+ PRINTER_LOG(DEBUG) << "AddOrReconfigurePrinter() called when "
"kUserNativePrintersAllowed is set to false";
- // Used to log UMA metrics.
- OnAddedPrinterCommon(*printer,
- PrinterSetupResult::kNativePrintersNotAllowed,
- false);
+ OnAddedOrEditedPrinterCommon(*printer,
+ PrinterSetupResult::kNativePrintersNotAllowed,
+ false /* is_automatic */);
// Used to fire the web UI listener.
- OnAddPrinterError(PrinterSetupResult::kNativePrintersNotAllowed);
+ OnAddOrEditPrinterError(PrinterSetupResult::kNativePrintersNotAllowed);
return;
}
@@ -582,21 +624,26 @@ void CupsPrintersHandler::HandleAddCupsPrinter(const base::ListValue* args) {
// If the returned optional does not contain a value then it means that the
// printer's uri was not able to be parsed successfully.
PRINTER_LOG(ERROR) << "Failed to parse printer URI";
- OnAddPrinterError(PrinterSetupResult::kFatalError);
+ OnAddOrEditPrinterError(PrinterSetupResult::kFatalError);
return;
}
- // If the provided printer already exists, grab the existing printer object
- // and check that we are not making any changes that will make the printer
- // unusable.
- if (!printer->id().empty()) {
- std::unique_ptr<Printer> existing_printer =
- printers_manager_->GetPrinter(printer->id());
- if (existing_printer) {
- if (!IsValidUriChange(*existing_printer, *printer)) {
- OnAddPrinterError(PrinterSetupResult::kInvalidPrinterUpdate);
- return;
- }
+ // Grab the existing printer object and check that we are not making any
+ // changes that will make |existing_printer_object| unusable.
+ if (printer->id().empty()) {
+ // If the printer object has not already been created, error out since this
+ // is not a valid case.
+ PRINTER_LOG(ERROR) << "Failed to parse printer ID";
+ OnAddOrEditPrinterError(PrinterSetupResult::kFatalError);
+ return;
+ }
+
+ base::Optional<Printer> existing_printer_object =
+ printers_manager_->GetPrinter(printer->id());
+ if (existing_printer_object) {
+ if (!IsValidUriChange(*existing_printer_object, *printer)) {
+ OnAddOrEditPrinterError(PrinterSetupResult::kInvalidPrinterUpdate);
+ return;
}
}
@@ -622,7 +669,7 @@ void CupsPrintersHandler::HandleAddCupsPrinter(const base::ListValue* args) {
GURL tmp = net::FilePathToFileURL(base::FilePath(printer_ppd_path));
if (!tmp.is_valid()) {
LOG(ERROR) << "Invalid ppd path: " << printer_ppd_path;
- OnAddPrinterError(PrinterSetupResult::kInvalidPpd);
+ OnAddOrEditPrinterError(PrinterSetupResult::kInvalidPpd);
return;
}
printer->mutable_ppd_reference()->user_supplied_ppd_url = tmp.spec();
@@ -640,7 +687,7 @@ void CupsPrintersHandler::HandleAddCupsPrinter(const base::ListValue* args) {
}
if (!found) {
LOG(ERROR) << "Failed to get ppd reference";
- OnAddPrinterError(PrinterSetupResult::kPpdNotFound);
+ OnAddOrEditPrinterError(PrinterSetupResult::kPpdNotFound);
return;
}
@@ -660,13 +707,15 @@ void CupsPrintersHandler::HandleAddCupsPrinter(const base::ListValue* args) {
}
printer_configurer_->SetUpPrinter(
- *printer, base::Bind(&CupsPrintersHandler::OnAddedSpecifiedPrinter,
- weak_factory_.GetWeakPtr(), *printer));
+ *printer,
+ base::BindOnce(&CupsPrintersHandler::OnAddedOrEditedSpecifiedPrinter,
+ weak_factory_.GetWeakPtr(), *printer, is_printer_edit));
}
-void CupsPrintersHandler::OnAddedPrinterCommon(const Printer& printer,
- PrinterSetupResult result_code,
- bool is_automatic) {
+void CupsPrintersHandler::OnAddedOrEditedPrinterCommon(
+ const Printer& printer,
+ PrinterSetupResult result_code,
+ bool is_automatic) {
UMA_HISTOGRAM_ENUMERATION("Printing.CUPS.PrinterSetupResult", result_code,
PrinterSetupResult::kMaxValue);
switch (result_code) {
@@ -675,7 +724,15 @@ void CupsPrintersHandler::OnAddedPrinterCommon(const Printer& printer,
printer.GetProtocol(), Printer::kProtocolMax);
PRINTER_LOG(USER) << "Performing printer setup";
printers_manager_->PrinterInstalled(printer, is_automatic);
- printers_manager_->UpdateConfiguredPrinter(printer);
+ if (printer.IsUsbProtocol()) {
+ // Record UMA for USB printer setup source.
+ PrinterConfigurer::RecordUsbPrinterSetupSource(
+ UsbPrinterSetupSource::kSettings);
+ }
+ return;
+ case PrinterSetupResult::kEditSuccess:
+ PRINTER_LOG(USER) << "Printer updated";
+ printers_manager_->UpdateSavedPrinter(printer);
return;
case PrinterSetupResult::kPpdNotFound:
PRINTER_LOG(ERROR) << "Could not locate requested PPD";
@@ -725,9 +782,9 @@ void CupsPrintersHandler::OnAddedPrinterCommon(const Printer& printer,
void CupsPrintersHandler::OnAddedDiscoveredPrinter(
const Printer& printer,
PrinterSetupResult result_code) {
- OnAddedPrinterCommon(printer, result_code, true);
+ OnAddedOrEditedPrinterCommon(printer, result_code, /*is_automatic=*/true);
if (result_code == PrinterSetupResult::kSuccess) {
- FireWebUIListener("on-add-cups-printer", base::Value(result_code),
+ FireWebUIListener("on-add-or-edit-cups-printer", base::Value(result_code),
base::Value(printer.display_name()));
} else {
PRINTER_LOG(EVENT) << "Automatic setup failed for discovered printer. "
@@ -737,18 +794,23 @@ void CupsPrintersHandler::OnAddedDiscoveredPrinter(
}
}
-void CupsPrintersHandler::OnAddedSpecifiedPrinter(
+void CupsPrintersHandler::OnAddedOrEditedSpecifiedPrinter(
const Printer& printer,
+ bool is_printer_edit,
PrinterSetupResult result_code) {
- PRINTER_LOG(EVENT) << "Add manual printer: " << result_code;
- OnAddedPrinterCommon(printer, result_code, false);
- FireWebUIListener("on-add-cups-printer", base::Value(result_code),
+ if (is_printer_edit && result_code == PrinterSetupResult::kSuccess) {
+ result_code = PrinterSetupResult::kEditSuccess;
+ }
+ PRINTER_LOG(EVENT) << "Add/Update manual printer: " << result_code;
+ OnAddedOrEditedPrinterCommon(printer, result_code, /*is_automatic=*/false);
+ FireWebUIListener("on-add-or-edit-cups-printer", base::Value(result_code),
base::Value(printer.display_name()));
}
-void CupsPrintersHandler::OnAddPrinterError(PrinterSetupResult result_code) {
+void CupsPrintersHandler::OnAddOrEditPrinterError(
+ PrinterSetupResult result_code) {
PRINTER_LOG(EVENT) << "Add printer error: " << result_code;
- FireWebUIListener("on-add-cups-printer", base::Value(result_code),
+ FireWebUIListener("on-add-or-edit-cups-printer", base::Value(result_code),
base::Value(""));
}
@@ -918,7 +980,7 @@ void CupsPrintersHandler::OnPrintersChanged(
discovered_printers_ = printers;
UpdateDiscoveredPrinters();
break;
- case CupsPrintersManager::kConfigured: {
+ case CupsPrintersManager::kSaved: {
auto printers_list = BuildCupsPrintersList(printers);
FireWebUIListener("on-printers-changed", printers_list);
break;
@@ -955,12 +1017,12 @@ void CupsPrintersHandler::HandleAddDiscoveredPrinter(
CHECK(args->GetString(0, &printer_id));
PRINTER_LOG(USER) << "Adding discovered printer";
- std::unique_ptr<Printer> printer = printers_manager_->GetPrinter(printer_id);
- if (printer == nullptr) {
+ base::Optional<Printer> printer = printers_manager_->GetPrinter(printer_id);
+ if (!printer) {
PRINTER_LOG(ERROR) << "Discovered printer disappeared";
// Printer disappeared, so we don't have information about it anymore and
// can't really do much. Fail the add.
- FireWebUIListener("on-add-cups-printer", base::Value(false),
+ FireWebUIListener("on-add-or-edit-cups-printer", base::Value(false),
base::Value(printer_id));
return;
}
@@ -968,7 +1030,7 @@ void CupsPrintersHandler::HandleAddDiscoveredPrinter(
if (!printer->GetUriComponents().has_value()) {
PRINTER_LOG(DEBUG) << "Could not parse uri";
// The printer uri was not parsed successfully. Fail the add.
- FireWebUIListener("on-add-cups-printer", base::Value(false),
+ FireWebUIListener("on-add-or-edit-cups-printer", base::Value(false),
base::Value(printer_id));
return;
}
@@ -987,18 +1049,15 @@ void CupsPrintersHandler::HandleAddDiscoveredPrinter(
// The mDNS record doesn't guarantee we can setup the printer. Query it to
// see if we want to try IPP.
- const std::string printer_uri = printer->effective_uri();
- if (IsIppUri(printer_uri)) {
- PRINTER_LOG(EVENT) << "Query printer for IPP attributes";
- QueryAutoconf(
- printer_uri,
- base::Bind(&CupsPrintersHandler::OnAutoconfQueriedDiscovered,
- weak_factory_.GetWeakPtr(), base::Passed(&printer)));
- } else {
- PRINTER_LOG(EVENT) << "Request make and model from user";
- // If it's not an IPP printer, the user must choose a PPD.
- FireManuallyAddDiscoveredPrinter(*printer);
+ auto address = printer->GetHostAndPort();
+ if (address.IsEmpty()) {
+ PRINTER_LOG(ERROR) << "Address is invalid";
+ OnAddedDiscoveredPrinter(*printer, PrinterSetupResult::kPrinterUnreachable);
+ return;
}
+ endpoint_resolver_->Start(
+ address, base::BindOnce(&CupsPrintersHandler::OnIpResolved,
+ weak_factory_.GetWeakPtr(), std::move(*printer)));
}
void CupsPrintersHandler::HandleGetPrinterPpdManufacturerAndModel(
@@ -1043,5 +1102,33 @@ void CupsPrintersHandler::FireManuallyAddDiscoveredPrinter(
*GetCupsPrinterInfo(printer));
}
+void CupsPrintersHandler::OnIpResolved(const Printer& printer,
+ const net::IPEndPoint& endpoint) {
+ bool address_resolved = endpoint.address().IsValid();
+ UMA_HISTOGRAM_BOOLEAN("Printing.CUPS.AddressResolutionResult",
+ address_resolved);
+ if (!address_resolved) {
+ PRINTER_LOG(ERROR) << printer.make_and_model() << " IP Resolution failed";
+ OnAddedDiscoveredPrinter(printer, PrinterSetupResult::kPrinterUnreachable);
+ return;
+ }
+
+ PRINTER_LOG(EVENT) << printer.make_and_model() << " IP Resolution succeeded";
+ std::string resolved_uri = printer.ReplaceHostAndPort(endpoint);
+
+ if (IsIppUri(resolved_uri)) {
+ PRINTER_LOG(EVENT) << "Query printer for IPP attributes";
+ QueryAutoconf(
+ resolved_uri,
+ base::BindRepeating(&CupsPrintersHandler::OnAutoconfQueriedDiscovered,
+ weak_factory_.GetWeakPtr(), printer));
+ return;
+ }
+
+ PRINTER_LOG(EVENT) << "Request make and model from user";
+ // If it's not an IPP printer, the user must choose a PPD.
+ FireManuallyAddDiscoveredPrinter(printer);
+}
+
} // namespace settings
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h
index 0362548c17a..7ab1f8e3ef1 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h
@@ -16,6 +16,7 @@
#include "chrome/browser/chromeos/printing/cups_printers_manager.h"
#include "chrome/browser/chromeos/printing/printer_configurer.h"
#include "chrome/browser/chromeos/printing/printer_event_tracker.h"
+#include "chrome/browser/local_discovery/endpoint_resolver.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "chromeos/printing/ppd_provider.h"
#include "chromeos/printing/printer_configuration.h"
@@ -38,7 +39,14 @@ class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
public ui::SelectFileDialog::Listener,
public CupsPrintersManager::Observer {
public:
- explicit CupsPrintersHandler(content::WebUI* webui);
+ static std::unique_ptr<CupsPrintersHandler> Create(content::WebUI* webui);
+
+ static std::unique_ptr<CupsPrintersHandler> CreateForTesting(
+ Profile* profile,
+ scoped_refptr<PpdProvider> ppd_provider,
+ std::unique_ptr<PrinterConfigurer> printer_configurer,
+ CupsPrintersManager* printers_manager);
+
~CupsPrintersHandler() override;
// SettingsPageUIHandler overrides:
@@ -46,7 +54,14 @@ class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
void OnJavascriptAllowed() override;
void OnJavascriptDisallowed() override;
+ void SetWebUIForTest(content::WebUI* web_ui);
+
private:
+ CupsPrintersHandler(Profile* profile,
+ scoped_refptr<PpdProvider> ppd_provider,
+ std::unique_ptr<PrinterConfigurer> printer_configurer,
+ CupsPrintersManager* printers_manager);
+
// Gets all CUPS printers and return it to WebUI.
void HandleGetCupsPrintersList(const base::ListValue* args);
void HandleUpdateCupsPrinter(const base::ListValue* args);
@@ -73,7 +88,7 @@ class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
// Handles the callback for HandleGetPrinterInfo for a discovered printer.
void OnAutoconfQueriedDiscovered(
- std::unique_ptr<Printer> printer,
+ Printer printer,
bool success,
const std::string& make,
const std::string& model,
@@ -89,14 +104,20 @@ class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
void HandleAddCupsPrinter(const base::ListValue* args);
+ void HandleReconfigureCupsPrinter(const base::ListValue* args);
+
+ void AddOrReconfigurePrinter(const base::ListValue* args,
+ bool is_printer_edit);
+
// Handles the result of adding a printer which the user specified the
// location of (i.e. a printer that was not 'discovered' automatically).
- void OnAddedSpecifiedPrinter(const Printer& printer,
- PrinterSetupResult result);
+ void OnAddedOrEditedSpecifiedPrinter(const Printer& printer,
+ bool is_printer_edit,
+ PrinterSetupResult result);
// Handles the result of failure to add a printer. |result_code| is used to
// determine the reason for the failure.
- void OnAddPrinterError(PrinterSetupResult result_code);
+ void OnAddOrEditPrinterError(PrinterSetupResult result_code);
// Get a list of all manufacturers for which we have at least one model of
// printer supported. Takes one argument, the callback id for the result.
@@ -146,9 +167,9 @@ class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
PrinterSetupResult result_code);
// Code common between the discovered and manual add printer code paths.
- void OnAddedPrinterCommon(const Printer& printer,
- PrinterSetupResult result_code,
- bool is_automatic);
+ void OnAddedOrEditedPrinterCommon(const Printer& printer,
+ PrinterSetupResult result_code,
+ bool is_automatic);
// CupsPrintersManager::Observer override:
void OnPrintersChanged(CupsPrintersManager::PrinterClass printer_class,
@@ -170,6 +191,8 @@ class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
// parameters. See https://crbug.com/835476
void FireManuallyAddDiscoveredPrinter(const Printer& printer);
+ void OnIpResolved(const Printer& printer, const net::IPEndPoint& endpoint);
+
Profile* profile_;
// Discovery support. discovery_active_ tracks whether or not the UI
@@ -193,6 +216,7 @@ class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
std::string webui_callback_id_;
CupsPrintersManager* printers_manager_;
+ std::unique_ptr<local_discovery::EndpointResolver> endpoint_resolver_;
ScopedObserver<CupsPrintersManager, CupsPrintersManager::Observer>
printers_manager_observer_;
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc
new file mode 100644
index 00000000000..1af82488177
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc
@@ -0,0 +1,156 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h"
+
+#include <memory>
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/json/json_string_value_serializer.h"
+#include "chrome/test/base/testing_profile.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/debug_daemon_client.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/test_web_ui.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace chromeos {
+namespace settings {
+
+class CupsPrintersHandlerTest;
+
+namespace {
+
+// Converts JSON string to base::ListValue object.
+// On failure, returns NULL and fills |*error| string.
+std::unique_ptr<base::ListValue> GetJSONAsListValue(const std::string& json,
+ std::string* error) {
+ auto ret = base::ListValue::From(
+ JSONStringValueDeserializer(json).Deserialize(nullptr, error));
+ if (!ret)
+ *error = "Value is not a list.";
+ return ret;
+}
+
+} // namespace
+
+// Callback used for testing CupsAddAutoConfiguredPrinter().
+void AddedPrinter(int32_t status) {
+ ASSERT_EQ(status, 0);
+}
+
+// Callback used for testing CupsRemovePrinter().
+void RemovedPrinter(base::OnceClosure quit_closure,
+ bool* expected,
+ bool result) {
+ *expected = result;
+ std::move(quit_closure).Run();
+}
+
+class FakePrinterConfigurer : public PrinterConfigurer {
+ public:
+ void SetUpPrinter(const Printer& printer,
+ PrinterSetupCallback callback) override {}
+};
+
+class FakeCupsPrintersManager : public CupsPrintersManager {
+ public:
+ FakeCupsPrintersManager() = default;
+
+ std::vector<Printer> GetPrinters(PrinterClass printer_class) const override {
+ return {};
+ }
+
+ void RemoveUnavailablePrinters(std::vector<Printer>*) const override {}
+ void UpdateSavedPrinter(const Printer& printer) override {}
+ void RemoveSavedPrinter(const std::string& printer_id) override {}
+ void AddObserver(CupsPrintersManager::Observer* observer) override {}
+ void RemoveObserver(CupsPrintersManager::Observer* observer) override {}
+ void PrinterInstalled(const Printer& printer, bool is_automatic) override {}
+ void RecordSetupAbandoned(const Printer& printer) override {}
+
+ bool IsPrinterInstalled(const Printer& printer) const override {
+ return false;
+ }
+
+ base::Optional<Printer> GetPrinter(const std::string& id) const override {
+ return Printer();
+ }
+};
+
+class FakePpdProvider : public PpdProvider {
+ public:
+ FakePpdProvider() = default;
+
+ void ResolveManufacturers(ResolveManufacturersCallback cb) override {}
+ void ResolvePrinters(const std::string& manufacturer,
+ ResolvePrintersCallback cb) override {}
+ void ResolvePpdReference(const PrinterSearchData& search_data,
+ ResolvePpdReferenceCallback cb) override {}
+ void ResolvePpd(const Printer::PpdReference& reference,
+ ResolvePpdCallback cb) override {}
+ void ReverseLookup(const std::string& effective_make_and_model,
+ ReverseLookupCallback cb) override {}
+
+ private:
+ ~FakePpdProvider() override {}
+};
+
+class CupsPrintersHandlerTest : public testing::Test {
+ public:
+ CupsPrintersHandlerTest()
+ : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD),
+ profile_(),
+ web_ui_(),
+ printers_handler_() {}
+ ~CupsPrintersHandlerTest() override = default;
+
+ void SetUp() override {
+ printers_handler_ = CupsPrintersHandler::CreateForTesting(
+ &profile_, base::MakeRefCounted<FakePpdProvider>(),
+ std::make_unique<FakePrinterConfigurer>(), &printers_manager_);
+ printers_handler_->SetWebUIForTest(&web_ui_);
+ printers_handler_->RegisterMessages();
+ }
+
+ protected:
+ // Must outlive |profile_|.
+ content::TestBrowserThreadBundle thread_bundle_;
+ TestingProfile profile_;
+ content::TestWebUI web_ui_;
+ std::unique_ptr<CupsPrintersHandler> printers_handler_;
+ FakeCupsPrintersManager printers_manager_;
+};
+
+TEST_F(CupsPrintersHandlerTest, RemoveCorrectPrinter) {
+ DBusThreadManager::Initialize();
+ DebugDaemonClient* client = DBusThreadManager::Get()->GetDebugDaemonClient();
+ client->CupsAddAutoConfiguredPrinter("testprinter1", "fakeuri",
+ base::BindOnce(&AddedPrinter));
+
+ const std::string remove_list = R"(
+ ["testprinter1", "Test Printer 1"]
+ )";
+ std::string error;
+ std::unique_ptr<base::ListValue> remove_printers(
+ GetJSONAsListValue(remove_list, &error));
+ ASSERT_TRUE(remove_printers) << "Error deserializing list: " << error;
+
+ web_ui_.HandleReceivedMessage("removeCupsPrinter", remove_printers.get());
+
+ // We expect this printer removal to fail since the printer should have
+ // already been removed by the previous call to 'removeCupsPrinter'.
+ base::RunLoop run_loop;
+ bool expected = true;
+ client->CupsRemovePrinter(
+ "testprinter1",
+ base::BindRepeating(&RemovedPrinter, run_loop.QuitClosure(), &expected),
+ base::DoNothing());
+ run_loop.Run();
+ EXPECT_FALSE(expected);
+}
+
+} // namespace settings.
+} // namespace chromeos.
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
index 2423ebcd3dc..c3a3202bb1d 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
@@ -26,19 +26,9 @@ namespace settings {
namespace {
-// Returns whether the system time zone automatic detection policy is disabled
-// by a flag.
-bool IsSystemTimezoneAutomaticDetectionPolicyFlagDisabled() {
- return base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableSystemTimezoneAutomaticDetectionPolicy);
-}
-
// Returns whether the system's automatic time zone detection setting is
// managed, which may override the user's setting.
bool IsSystemTimezoneAutomaticDetectionManaged() {
- if (IsSystemTimezoneAutomaticDetectionPolicyFlagDisabled())
- return false;
-
return g_browser_process->local_state()->IsManagedPreference(
prefs::kSystemTimezoneAutomaticDetectionPolicy);
}
@@ -112,9 +102,6 @@ void DateTimeHandler::OnJavascriptAllowed() {
base::Bind(&DateTimeHandler::NotifyTimezoneAutomaticDetectionPolicy,
weak_ptr_factory_.GetWeakPtr()));
- if (IsSystemTimezoneAutomaticDetectionPolicyFlagDisabled())
- return;
-
// The auto-detection policy can force auto-detection on or off.
local_state_pref_change_registrar_.Init(g_browser_process->local_state());
local_state_pref_change_registrar_.Add(
@@ -126,9 +113,7 @@ void DateTimeHandler::OnJavascriptAllowed() {
void DateTimeHandler::OnJavascriptDisallowed() {
scoped_observer_.RemoveAll();
system_timezone_policy_subscription_.reset();
-
- if (!IsSystemTimezoneAutomaticDetectionPolicyFlagDisabled())
- local_state_pref_change_registrar_.RemoveAll();
+ local_state_pref_change_registrar_.RemoveAll();
}
void DateTimeHandler::HandleDateTimePageReady(const base::ListValue* args) {
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
index 5344ee81b74..78869c7978e 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
@@ -13,8 +13,8 @@
#include "base/scoped_observer.h"
#include "base/strings/string16.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
-#include "chromeos/dbus/power_manager_client.h"
-#include "chromeos/dbus/power_policy_controller.h"
+#include "chromeos/dbus/power/power_manager_client.h"
+#include "chromeos/dbus/power/power_policy_controller.h"
class PrefChangeRegistrar;
class PrefService;
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler_browsertest.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler_browsertest.cc
index 9206cad0173..c27e55cb6d4 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler_browsertest.cc
@@ -14,8 +14,8 @@
#include "base/values.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/test/base/in_process_browser_test.h"
-#include "chromeos/dbus/fake_power_manager_client.h"
-#include "chromeos/dbus/power_policy_controller.h"
+#include "chromeos/dbus/power/fake_power_manager_client.h"
+#include "chromeos/dbus/power/power_policy_controller.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/policy_constants.h"
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc
index 5ef78d58cdf..b565a9071b5 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc
@@ -32,7 +32,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/cryptohome/cryptohome_util.h"
-#include "chromeos/dbus/cryptohome_client.h"
+#include "chromeos/dbus/cryptohome/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/arc/arc_util.h"
#include "components/browsing_data/content/conditional_cache_counting_helper.h"
@@ -249,7 +249,7 @@ void StorageHandler::UpdateBrowsingDataSize() {
new BrowsingDataCookieHelper(storage_partition),
new BrowsingDataDatabaseHelper(profile_),
new BrowsingDataLocalStorageHelper(profile_),
- new BrowsingDataAppCacheHelper(profile_),
+ new BrowsingDataAppCacheHelper(storage_partition->GetAppCacheService()),
new BrowsingDataIndexedDBHelper(
storage_partition->GetIndexedDBContext()),
BrowsingDataFileSystemHelper::Create(
@@ -363,7 +363,7 @@ void StorageHandler::UpdateOtherUsersSize() {
if (user->is_active())
continue;
other_users_.push_back(user);
- DBusThreadManager::Get()->GetCryptohomeClient()->GetAccountDiskUsage(
+ CryptohomeClient::Get()->GetAccountDiskUsage(
cryptohome::CreateAccountIdentifierFromAccountId(user->GetAccountId()),
base::BindOnce(&StorageHandler::OnGetOtherUserSize,
weak_ptr_factory_.GetWeakPtr()));
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc
index 9b7cf3f1d55..3a383f4c89c 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc
@@ -12,6 +12,9 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/chromeos/login/quick_unlock/auth_token.h"
+#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
+#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
@@ -228,6 +231,18 @@ void FingerprintHandler::HandleGetNumFingerprints(const base::ListValue* args) {
void FingerprintHandler::HandleStartEnroll(const base::ListValue* args) {
AllowJavascript();
+ std::string auth_token;
+ CHECK(args->GetString(0, &auth_token));
+
+ // Auth token expiration will trigger password prompt.
+ // Silently fail if auth token is incorrect.
+ quick_unlock::QuickUnlockStorage* quick_unlock_storage =
+ quick_unlock::QuickUnlockFactory::GetForProfile(profile_);
+ if (!quick_unlock_storage->GetAuthToken())
+ return;
+ if (auth_token != quick_unlock_storage->GetAuthToken()->Identifier())
+ return;
+
// Determines what the newly added fingerprint's name should be.
for (int i = 1; i <= kMaxAllowedFingerprints; ++i) {
std::string fingerprint_name = l10n_util::GetStringFUTF8(
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
index 4ea6720e436..f160f963bc3 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h"
#include "chromeos/constants/chromeos_switches.h"
+#include "chromeos/services/assistant/public/mojom/constants.mojom.h"
#include "components/arc/arc_prefs.h"
#include "components/arc/arc_service_manager.h"
#include "content/public/browser/browser_context.h"
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc
index 7b5b6b021fa..6d0b2214df2 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc
@@ -17,11 +17,11 @@
#include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
-#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_service_manager.h"
#include "components/arc/common/net.mojom.h"
-#include "components/arc/connection_holder.h"
#include "components/arc/metrics/arc_metrics_constants.h"
+#include "components/arc/session/arc_bridge_service.h"
+#include "components/arc/session/connection_holder.h"
#include "components/onc/onc_constants.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc
index 31a51283808..8d03f47642a 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc
@@ -10,6 +10,7 @@
#include "base/values.h"
#include "chrome/browser/chromeos/android_sms/android_sms_pairing_state_tracker_impl.h"
#include "chrome/browser/chromeos/android_sms/android_sms_urls.h"
+#include "chrome/browser/chromeos/login/quick_unlock/auth_token.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
#include "chrome/browser/profiles/profile.h"
@@ -410,8 +411,8 @@ bool MultideviceHandler::IsAuthTokenValid(const std::string& auth_token) {
Profile* profile = Profile::FromWebUI(web_ui());
quick_unlock::QuickUnlockStorage* quick_unlock_storage =
chromeos::quick_unlock::QuickUnlockFactory::GetForProfile(profile);
- return !quick_unlock_storage->GetAuthTokenExpired() &&
- auth_token == quick_unlock_storage->GetAuthToken();
+ return quick_unlock_storage->GetAuthToken() &&
+ auth_token == quick_unlock_storage->GetAuthToken()->Identifier();
}
multidevice_setup::MultiDeviceSetupClient::HostStatusWithDevice
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc
new file mode 100644
index 00000000000..f5ae7950e4f
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc
@@ -0,0 +1,245 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h"
+
+#include <stddef.h>
+
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
+#include "base/metrics/histogram_macros.h"
+#include "build/build_config.h"
+#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
+#include "chrome/browser/ui/webui/certificates_handler.h"
+#include "chrome/browser/ui/webui/dark_mode_handler.h"
+#include "chrome/browser/ui/webui/managed_ui_handler.h"
+#include "chrome/browser/ui/webui/metrics_handler.h"
+#include "chrome/browser/ui/webui/settings/about_handler.h"
+#include "chrome/browser/ui/webui/settings/accessibility_main_handler.h"
+#include "chrome/browser/ui/webui/settings/appearance_handler.h"
+#include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h"
+#include "chrome/browser/ui/webui/settings/downloads_handler.h"
+#include "chrome/browser/ui/webui/settings/extension_control_handler.h"
+#include "chrome/browser/ui/webui/settings/font_handler.h"
+#include "chrome/browser/ui/webui/settings/languages_handler.h"
+#include "chrome/browser/ui/webui/settings/on_startup_handler.h"
+#include "chrome/browser/ui/webui/settings/people_handler.h"
+#include "chrome/browser/ui/webui/settings/profile_info_handler.h"
+#include "chrome/browser/ui/webui/settings/protocol_handlers_handler.h"
+#include "chrome/browser/ui/webui/settings/reset_settings_handler.h"
+#include "chrome/browser/ui/webui/settings/search_engines_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_cookies_view_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_import_data_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_localized_strings_provider.h"
+#include "chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_security_key_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_startup_pages_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_ui.h"
+#include "chrome/browser/ui/webui/settings/site_settings_handler.h"
+#include "chrome/browser/web_applications/system_web_app_manager.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/webui_url_constants.h"
+#include "chrome/grit/browser_resources.h"
+#include "chrome/grit/os_settings_resources.h"
+#include "chrome/grit/os_settings_resources_map.h"
+#include "components/password_manager/core/common/password_manager_features.h"
+#include "components/pref_registry/pref_registry_syncable.h"
+#include "components/unified_consent/feature.h"
+#include "content/public/browser/navigation_handle.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "content/public/common/content_features.h"
+
+#if defined(FULL_SAFE_BROWSING)
+#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
+#include "chrome/browser/ui/webui/settings/change_password_handler.h"
+#endif
+
+namespace chromeos {
+namespace settings {
+
+// static
+void OSSettingsUI::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+ registry->RegisterBooleanPref(::prefs::kImportDialogAutofillFormData, true);
+ registry->RegisterBooleanPref(::prefs::kImportDialogBookmarks, true);
+ registry->RegisterBooleanPref(::prefs::kImportDialogHistory, true);
+ registry->RegisterBooleanPref(::prefs::kImportDialogSavedPasswords, true);
+ registry->RegisterBooleanPref(::prefs::kImportDialogSearchEngine, true);
+}
+
+OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
+ : content::WebUIController(web_ui),
+ WebContentsObserver(web_ui->GetWebContents()) {
+ Profile* profile = Profile::FromWebUI(web_ui);
+ content::WebUIDataSource* html_source =
+ content::WebUIDataSource::Create(chrome::kChromeUIOSSettingsHost);
+
+ ::settings::SettingsUI::InitOSWebUIHandlers(profile, web_ui, html_source);
+
+ // TODO(jamescook): Remove after basic_page.html is forked for OS settings.
+ html_source->AddBoolean("showOSSettings", true);
+
+#if BUILDFLAG(OPTIMIZE_WEBUI)
+ std::vector<std::string> exclude_from_gzip;
+#endif
+
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::AppearanceHandler>(web_ui));
+
+#if defined(USE_NSS_CERTS)
+ AddSettingsPageUIHandler(
+ std::make_unique<certificate_manager::CertificatesHandler>());
+#elif defined(OS_WIN) || defined(OS_MACOSX)
+ AddSettingsPageUIHandler(std::make_unique<NativeCertificatesHandler>());
+#endif // defined(USE_NSS_CERTS)
+
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::AccessibilityMainHandler>());
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::BrowserLifetimeHandler>());
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::ClearBrowsingDataHandler>(web_ui));
+ AddSettingsPageUIHandler(std::make_unique<::settings::CookiesViewHandler>());
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::DownloadsHandler>(profile));
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::ExtensionControlHandler>());
+ AddSettingsPageUIHandler(std::make_unique<::settings::FontHandler>(web_ui));
+ AddSettingsPageUIHandler(std::make_unique<::settings::ImportDataHandler>());
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::LanguagesHandler>(web_ui));
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::MediaDevicesSelectionHandler>(profile));
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::OnStartupHandler>(profile));
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::PeopleHandler>(profile));
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::ProfileInfoHandler>(profile));
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::ProtocolHandlersHandler>());
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::SearchEnginesHandler>(profile));
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::SiteSettingsHandler>(profile));
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::StartupPagesHandler>(web_ui));
+ AddSettingsPageUIHandler(std::make_unique<::settings::SecurityKeysHandler>());
+
+ bool password_protection_available = false;
+#if defined(FULL_SAFE_BROWSING)
+ safe_browsing::ChromePasswordProtectionService* password_protection =
+ safe_browsing::ChromePasswordProtectionService::
+ GetPasswordProtectionService(profile);
+ password_protection_available = !!password_protection;
+ if (password_protection) {
+ AddSettingsPageUIHandler(
+ std::make_unique<::settings::ChangePasswordHandler>(
+ profile, password_protection));
+ }
+#endif
+
+ html_source->AddBoolean("passwordProtectionAvailable",
+ password_protection_available);
+
+ html_source->AddBoolean("unifiedConsentEnabled",
+ unified_consent::IsUnifiedConsentFeatureEnabled());
+
+ html_source->AddBoolean(
+ "navigateToGooglePasswordManager",
+ ShouldManagePasswordsinGooglePasswordManager(profile));
+
+ html_source->AddBoolean("showImportPasswords",
+ base::FeatureList::IsEnabled(
+ password_manager::features::kPasswordImport));
+
+ AddSettingsPageUIHandler(
+ base::WrapUnique(::settings::AboutHandler::Create(html_source, profile)));
+ AddSettingsPageUIHandler(base::WrapUnique(
+ ::settings::ResetSettingsHandler::Create(html_source, profile)));
+
+ // Add the metrics handler to write uma stats.
+ web_ui->AddMessageHandler(std::make_unique<MetricsHandler>());
+
+ // Add the System Web App resources for Settings.
+ // TODO(jamescook|calamity): Migrate to chromeos::settings::OSSettingsUI.
+ if (web_app::SystemWebAppManager::IsEnabled()) {
+ html_source->AddResourcePath("icon-192.png", IDR_SETTINGS_LOGO_192);
+ html_source->AddResourcePath("pwa.html", IDR_PWA_HTML);
+#if BUILDFLAG(OPTIMIZE_WEBUI)
+ exclude_from_gzip.push_back("icon-192.png");
+ exclude_from_gzip.push_back("pwa.html");
+#endif // BUILDFLAG(OPTIMIZE_WEBUI)
+ }
+
+#if BUILDFLAG(OPTIMIZE_WEBUI)
+ const bool use_polymer_2 =
+ base::FeatureList::IsEnabled(::features::kWebUIPolymer2);
+ html_source->AddResourcePath("crisper.js", IDR_OS_SETTINGS_CRISPER_JS);
+ html_source->AddResourcePath("lazy_load.crisper.js",
+ IDR_OS_SETTINGS_LAZY_LOAD_CRISPER_JS);
+ html_source->AddResourcePath(
+ "lazy_load.html", use_polymer_2
+ ? IDR_OS_SETTINGS_LAZY_LOAD_VULCANIZED_P2_HTML
+ : IDR_OS_SETTINGS_LAZY_LOAD_VULCANIZED_HTML);
+ html_source->SetDefaultResource(use_polymer_2
+ ? IDR_OS_SETTINGS_VULCANIZED_P2_HTML
+ : IDR_OS_SETTINGS_VULCANIZED_HTML);
+ html_source->UseGzip(base::BindRepeating(
+ [](const std::vector<std::string>& excluded_paths,
+ const std::string& path) {
+ return !base::ContainsValue(excluded_paths, path);
+ },
+ std::move(exclude_from_gzip)));
+ html_source->AddResourcePath("manifest.json", IDR_OS_SETTINGS_MANIFEST);
+#else
+ // Add all settings resources.
+ for (size_t i = 0; i < kOsSettingsResourcesSize; ++i) {
+ html_source->AddResourcePath(kOsSettingsResources[i].name,
+ kOsSettingsResources[i].value);
+ }
+ html_source->SetDefaultResource(IDR_OS_SETTINGS_SETTINGS_HTML);
+#endif
+
+ ::settings::AddLocalizedStrings(html_source, profile);
+
+ DarkModeHandler::Initialize(web_ui, html_source);
+ ManagedUIHandler::Initialize(web_ui, html_source);
+
+ content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
+ html_source);
+}
+
+OSSettingsUI::~OSSettingsUI() {}
+
+void OSSettingsUI::AddSettingsPageUIHandler(
+ std::unique_ptr<content::WebUIMessageHandler> handler) {
+ DCHECK(handler);
+ web_ui()->AddMessageHandler(std::move(handler));
+}
+
+void OSSettingsUI::DidStartNavigation(
+ content::NavigationHandle* navigation_handle) {
+ if (navigation_handle->IsSameDocument())
+ return;
+
+ load_start_time_ = base::Time::Now();
+}
+
+void OSSettingsUI::DocumentLoadedInFrame(
+ content::RenderFrameHost* render_frame_host) {
+ // TODO(crbug/950007): Create new load histograms
+}
+
+void OSSettingsUI::DocumentOnLoadCompletedInMainFrame() {
+ // TODO(crbug/950007): Create new load histograms
+}
+
+} // namespace settings
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/settings/md_settings_ui.h b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h
index f9182a0af66..d62bbfaee26 100644
--- a/chromium/chrome/browser/ui/webui/settings/md_settings_ui.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h
@@ -2,10 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_UI_H_
-#define CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_UI_H_
-
-#include <unordered_set>
+#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_OS_SETTINGS_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_OS_SETTINGS_UI_H_
#include "base/macros.h"
#include "base/time/time.h"
@@ -20,22 +18,23 @@ namespace user_prefs {
class PrefRegistrySyncable;
}
+namespace chromeos {
namespace settings {
// The WebUI handler for chrome://settings.
-class MdSettingsUI : public content::WebUIController,
+class OSSettingsUI : public content::WebUIController,
public content::WebContentsObserver {
public:
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
- explicit MdSettingsUI(content::WebUI* web_ui);
- ~MdSettingsUI() override;
+ explicit OSSettingsUI(content::WebUI* web_ui);
+ ~OSSettingsUI() override;
// content::WebContentsObserver:
void DidStartNavigation(
content::NavigationHandle* navigation_handle) override;
void DocumentLoadedInFrame(
- content::RenderFrameHost *render_frame_host) override;
+ content::RenderFrameHost* render_frame_host) override;
void DocumentOnLoadCompletedInMainFrame() override;
private:
@@ -44,9 +43,10 @@ class MdSettingsUI : public content::WebUIController,
base::Time load_start_time_;
- DISALLOW_COPY_AND_ASSIGN(MdSettingsUI);
+ DISALLOW_COPY_AND_ASSIGN(OSSettingsUI);
};
} // namespace settings
+} // namespace chromeos
-#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_UI_H_
+#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_OS_SETTINGS_UI_H_
diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler.cc b/chromium/chrome/browser/ui/webui/settings/people_handler.cc
index eeeb1fa6ae0..4eada935afc 100644
--- a/chromium/chrome/browser/ui/webui/settings/people_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/people_handler.cc
@@ -42,6 +42,7 @@
#include "components/signin/core/browser/signin_pref_names.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync/base/passphrase_enums.h"
+#include "components/sync/base/user_selectable_type.h"
#include "components/sync/driver/sync_service.h"
#include "components/sync/driver/sync_service_utils.h"
#include "components/sync/driver/sync_user_settings.h"
@@ -84,7 +85,7 @@ struct SyncConfigInfo {
bool encrypt_all;
bool sync_everything;
- syncer::ModelTypeSet data_types;
+ syncer::UserSelectableTypeSet selected_types;
bool payments_integration_enabled;
std::string passphrase;
bool set_new_passphrase;
@@ -119,18 +120,16 @@ bool GetConfiguration(const std::string& json, SyncConfigInfo* config) {
return false;
}
- syncer::ModelTypeNameMap type_names = syncer::GetUserSelectableTypeNameMap();
-
- for (syncer::ModelTypeNameMap::const_iterator it = type_names.begin();
- it != type_names.end(); ++it) {
- std::string key_name = it->second + std::string("Synced");
+ for (syncer::UserSelectableType type : syncer::UserSelectableTypeSet::All()) {
+ std::string key_name =
+ syncer::GetUserSelectableTypeName(type) + std::string("Synced");
bool sync_value;
if (!result->GetBoolean(key_name, &sync_value)) {
DLOG(ERROR) << "GetConfiguration() not passed a value for " << key_name;
return false;
}
if (sync_value)
- config->data_types.Put(it->first);
+ config->selected_types.Put(type);
}
// Encryption settings.
@@ -195,6 +194,55 @@ base::Value GetAccountValue(const AccountInfo& account) {
}
#endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
+base::string16 GetEnterPassphraseBody(syncer::PassphraseType passphrase_type,
+ base::Time passphrase_time) {
+ DCHECK(syncer::IsExplicitPassphrase(passphrase_type));
+ switch (passphrase_type) {
+ case syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE:
+ if (passphrase_time.is_null()) {
+ return GetStringUTF16(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY);
+ }
+ return GetStringFUTF16(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE,
+ base::ASCIIToUTF16(chrome::kSyncErrorsHelpURL),
+ base::TimeFormatShortDate(passphrase_time));
+ case syncer::PassphraseType::CUSTOM_PASSPHRASE:
+ if (passphrase_time.is_null()) {
+ return GetStringUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY);
+ }
+ return GetStringFUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE,
+ base::ASCIIToUTF16(chrome::kSyncErrorsHelpURL),
+ base::TimeFormatShortDate(passphrase_time));
+ case syncer::PassphraseType::IMPLICIT_PASSPHRASE:
+ case syncer::PassphraseType::KEYSTORE_PASSPHRASE:
+ case syncer::PassphraseType::PASSPHRASE_TYPE_SIZE:
+ break;
+ }
+ NOTREACHED();
+ return base::string16();
+}
+
+base::string16 GetFullEncryptionBody(syncer::PassphraseType passphrase_type,
+ base::Time passphrase_time) {
+ DCHECK(syncer::IsExplicitPassphrase(passphrase_type));
+ if (passphrase_time.is_null()) {
+ return GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM);
+ }
+ switch (passphrase_type) {
+ case syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE:
+ return GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_GOOGLE_WITH_DATE,
+ base::TimeFormatShortDate(passphrase_time));
+ case syncer::PassphraseType::CUSTOM_PASSPHRASE:
+ return GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE,
+ base::TimeFormatShortDate(passphrase_time));
+ case syncer::PassphraseType::IMPLICIT_PASSPHRASE:
+ case syncer::PassphraseType::KEYSTORE_PASSPHRASE:
+ case syncer::PassphraseType::PASSPHRASE_TYPE_SIZE:
+ break;
+ }
+ NOTREACHED();
+ return base::string16();
+}
+
} // namespace
namespace settings {
@@ -448,8 +496,8 @@ void PeopleHandler::HandleSetDatatypes(const base::ListValue* args) {
return;
}
- service->GetUserSettings()->SetChosenDataTypes(configuration.sync_everything,
- configuration.data_types);
+ service->GetUserSettings()->SetSelectedTypes(configuration.sync_everything,
+ configuration.selected_types);
// Choosing data types to sync never fails.
ResolveJavascriptCallback(*callback_id, base::Value(kConfigurePageStatus));
@@ -620,8 +668,12 @@ void PeopleHandler::HandleShowSetupUI(const base::ListValue* args) {
if (service && !sync_blocker_)
sync_blocker_ = service->GetSetupInProgressHandle();
- // TODO(treib): Should we also call SetSyncRequested(true) here? That's what
- // happens in the non-Unity code path.
+ // Mark Sync as requested by the user. It might already be requested, but
+ // it's not if this is either the first time the user is setting up Sync, or
+ // Sync was set up but then was reset via the dashboard. This also pokes the
+ // SyncService to start up immediately, i.e. bypass deferred startup.
+ if (service)
+ service->GetUserSettings()->SetSyncRequested(true);
GetLoginUIService()->SetLoginUI(this);
@@ -629,6 +681,11 @@ void PeopleHandler::HandleShowSetupUI(const base::ListValue* args) {
Observe(web_ui()->GetWebContents());
PushSyncPrefs();
+
+ // Focus the web contents in case the location bar was focused before. This
+ // makes sure that page elements for resolving sync errors can be focused.
+ web_ui()->GetWebContents()->Focus();
+
// Always let the page open when unified consent is enabled.
return;
}
@@ -664,13 +721,10 @@ void PeopleHandler::HandleShowSetupUI(const base::ListValue* args) {
if (!service->IsEngineInitialized() ||
!service->GetUserSettings()->IsSyncRequested()) {
- // Requesting the sync service to start may trigger call to PushSyncPrefs.
- // Setting up the startup tracker beforehand correctly signals the
- // re-entrant call to early exit.
- sync_startup_tracker_ = std::make_unique<SyncStartupTracker>(service, this);
// SetSyncRequested(true) does two things:
- // 1) If DISABLE_REASON_USER_CHOICE is set (meaning that Sync was reset via
- // the dashboard), clears it.
+ // 1) As the name says, it marks Sync as requested by the user (it might not
+ // be requested yet because either this is the first time they're setting
+ // it up, or Sync was reset via the dashboard).
// 2) Pokes the sync service to start *immediately*, i.e. bypass deferred
// startup.
// It's possible that both of these are already the case, i.e. the engine is
@@ -689,6 +743,12 @@ void PeopleHandler::HandleShowSetupUI(const base::ListValue* args) {
SyncStartupTracker::SYNC_STARTUP_ERROR) {
DisplaySpinner();
}
+
+ // Finally, wait for the Sync engine to get initialized. Note that if it is
+ // already initialized (probably because Sync-the-transport was already
+ // running), then this will call us back immediately.
+ sync_startup_tracker_ = std::make_unique<SyncStartupTracker>(service, this);
+
return;
}
@@ -767,14 +827,9 @@ void PeopleHandler::HandlePauseSync(const base::ListValue* args) {
auto* identity_manager = IdentityManagerFactory::GetForProfile(profile_);
DCHECK(identity_manager->HasPrimaryAccount());
- CoreAccountInfo primary_account_info =
- identity_manager->GetPrimaryAccountInfo();
-
- identity_manager->GetAccountsMutator()->AddOrUpdateAccount(
- primary_account_info.gaia, primary_account_info.email,
- OAuth2TokenServiceDelegate::kInvalidRefreshToken,
- primary_account_info.is_under_advanced_protection,
- signin_metrics::SourceForRefreshTokenOperation::kSettings_PauseSync);
+ identity_manager->GetAccountsMutator()
+ ->InvalidateRefreshTokenForPrimaryAccount(
+ signin_metrics::SourceForRefreshTokenOperation::kSettings_PauseSync);
}
#endif
@@ -795,12 +850,12 @@ void PeopleHandler::CloseSyncSetup() {
// Clear the sync startup tracker, since the setup wizard is being closed.
sync_startup_tracker_.reset();
- syncer::SyncService* sync_service = GetSyncService();
-
// LoginUIService can be nullptr if page is brought up in incognito mode
// (i.e. if the user is running in guest mode in cros and brings up settings).
LoginUIService* service = GetLoginUIService();
if (service) {
+ syncer::SyncService* sync_service = GetSyncService();
+
// Don't log a cancel event if the sync setup dialog is being
// automatically closed due to an auth error.
if ((service->current_login_ui() == this) &&
@@ -823,7 +878,7 @@ void PeopleHandler::CloseSyncSetup() {
#if !defined(OS_CHROMEOS)
// Sign out the user on desktop Chrome if they click cancel during
// initial setup.
- if (sync_service->IsFirstSetupInProgress()) {
+ if (!sync_service->GetUserSettings()->IsFirstSetupComplete()) {
IdentityManagerFactory::GetForProfile(profile_)
->GetPrimaryAccountMutator()
->ClearPrimaryAccount(
@@ -852,8 +907,7 @@ void PeopleHandler::CloseSyncSetup() {
}
void PeopleHandler::InitializeSyncBlocker() {
- if (!web_ui())
- return;
+ DCHECK(web_ui());
WebContents* web_contents = web_ui()->GetWebContents();
if (web_contents) {
syncer::SyncService* service = GetSyncService();
@@ -877,11 +931,19 @@ void PeopleHandler::CloseUI() {
void PeopleHandler::OnPrimaryAccountSet(
const CoreAccountInfo& primary_account_info) {
+ // After a primary account was set, the Sync setup will start soon. Grab a
+ // SetupInProgressHandle right now to avoid a temporary "missing Sync
+ // confirmation" error in the avatar menu. See crbug.com/928696.
+ syncer::SyncService* service = GetSyncService();
+ if (service && !sync_blocker_)
+ sync_blocker_ = service->GetSetupInProgressHandle();
+
UpdateSyncStatus();
}
void PeopleHandler::OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) {
+ sync_blocker_.reset();
UpdateSyncStatus();
}
@@ -897,14 +959,15 @@ void PeopleHandler::BeforeUnloadDialogCancelled() {
// The before unload dialog is only shown during the first sync setup.
DCHECK(IdentityManagerFactory::GetForProfile(profile_)->HasPrimaryAccount());
syncer::SyncService* service = GetSyncService();
- DCHECK(service && service->IsFirstSetupInProgress());
+ DCHECK(service && service->IsSetupInProgress() &&
+ !service->GetUserSettings()->IsFirstSetupComplete());
base::RecordAction(
base::UserMetricsAction("Signin_Signin_CancelAbortAdvancedSyncSettings"));
}
-std::unique_ptr<base::DictionaryValue>
-PeopleHandler::GetSyncStatusDictionary() {
+std::unique_ptr<base::DictionaryValue> PeopleHandler::GetSyncStatusDictionary()
+ const {
std::unique_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue);
if (profile_->IsGuestSession()) {
// Cannot display signin status when running in guest mode on chromeos
@@ -942,10 +1005,12 @@ PeopleHandler::GetSyncStatusDictionary() {
sync_status->SetBoolean(
"signinAllowed", profile_->GetPrefs()->GetBoolean(prefs::kSigninAllowed));
sync_status->SetBoolean("syncSystemEnabled", (service != nullptr));
- sync_status->SetBoolean("setupInProgress",
- service && !disallowed_by_policy &&
- service->IsFirstSetupInProgress() &&
- identity_manager->HasPrimaryAccount());
+ // TODO(crbug.com/953641): Rename "setupInProgress" to "firstSetupInProgress".
+ sync_status->SetBoolean(
+ "setupInProgress",
+ service && !disallowed_by_policy && service->IsSetupInProgress() &&
+ !service->GetUserSettings()->IsFirstSetupComplete() &&
+ identity_manager->HasPrimaryAccount());
base::string16 status_label;
base::string16 link_label;
@@ -986,8 +1051,6 @@ void PeopleHandler::PushSyncPrefs() {
}
configuring_sync_ = true;
- DCHECK(service->IsEngineInitialized())
- << "Cannot configure sync until the sync engine is initialized";
// Setup args for the sync configure screen:
// syncAllDataTypes: true if the user wants to sync everything
@@ -998,86 +1061,48 @@ void PeopleHandler::PushSyncPrefs() {
// encryptAllData: true if user wants to encrypt all data (not just
// passwords)
// passphraseRequired: true if a passphrase is needed to start sync
- // passphraseTypeIsCustom: true if the passphrase type is custom
//
base::DictionaryValue args;
+ syncer::SyncUserSettings* sync_user_settings = service->GetUserSettings();
// Tell the UI layer which data types are registered/enabled by the user.
- const syncer::ModelTypeSet registered_types =
- service->GetRegisteredDataTypes();
- const syncer::ModelTypeSet preferred_types = service->GetPreferredDataTypes();
- const syncer::ModelTypeSet enforced_types = service->GetForcedDataTypes();
- syncer::ModelTypeNameMap type_names = syncer::GetUserSelectableTypeNameMap();
- for (syncer::ModelTypeNameMap::const_iterator it = type_names.begin();
- it != type_names.end(); ++it) {
- syncer::ModelType sync_type = it->first;
- const std::string key_name = it->second;
- args.SetBoolean(key_name + "Registered", registered_types.Has(sync_type));
- args.SetBoolean(key_name + "Synced", preferred_types.Has(sync_type));
- args.SetBoolean(key_name + "Enforced", enforced_types.Has(sync_type));
- // TODO(treib): How do we want to handle pref groups, i.e. when only some of
- // the sync types behind a checkbox are force-enabled? crbug.com/403326
+ const syncer::UserSelectableTypeSet registered_types =
+ sync_user_settings->GetRegisteredSelectableTypes();
+ const syncer::UserSelectableTypeSet selected_types =
+ sync_user_settings->GetSelectedTypes();
+ const syncer::UserSelectableTypeSet enforced_types =
+ sync_user_settings->GetForcedTypes();
+ for (syncer::UserSelectableType type : syncer::UserSelectableTypeSet::All()) {
+ const std::string type_name = syncer::GetUserSelectableTypeName(type);
+ args.SetBoolean(type_name + "Registered", registered_types.Has(type));
+ args.SetBoolean(type_name + "Synced", selected_types.Has(type));
+ args.SetBoolean(type_name + "Enforced", enforced_types.Has(type));
}
args.SetBoolean("syncAllDataTypes",
- service->GetUserSettings()->IsSyncEverythingEnabled());
+ sync_user_settings->IsSyncEverythingEnabled());
args.SetBoolean(
"paymentsIntegrationEnabled",
autofill::prefs::IsPaymentsIntegrationEnabled(profile_->GetPrefs()));
args.SetBoolean("encryptAllData",
- service->GetUserSettings()->IsEncryptEverythingEnabled());
+ sync_user_settings->IsEncryptEverythingEnabled());
args.SetBoolean("encryptAllDataAllowed",
- service->GetUserSettings()->IsEncryptEverythingAllowed());
+ sync_user_settings->IsEncryptEverythingAllowed());
// We call IsPassphraseRequired() here, instead of calling
// IsPassphraseRequiredForDecryption(), because we want to show the passphrase
// UI even if no encrypted data types are enabled.
args.SetBoolean("passphraseRequired",
- service->GetUserSettings()->IsPassphraseRequired());
-
- // To distinguish between PassphraseType::FROZEN_IMPLICIT_PASSPHRASE and
- // PassphraseType::CUSTOM_PASSPHRASE
- // we only set passphraseTypeIsCustom for PassphraseType::CUSTOM_PASSPHRASE.
- args.SetBoolean("passphraseTypeIsCustom",
- service->GetUserSettings()->GetPassphraseType() ==
- syncer::PassphraseType::CUSTOM_PASSPHRASE);
- base::Time passphrase_time =
- service->GetUserSettings()->GetExplicitPassphraseTime();
+ sync_user_settings->IsPassphraseRequired());
+
syncer::PassphraseType passphrase_type =
- service->GetUserSettings()->GetPassphraseType();
- if (!passphrase_time.is_null()) {
- base::string16 passphrase_time_str =
- base::TimeFormatShortDate(passphrase_time);
- args.SetString(
- "enterPassphraseBody",
- GetStringFUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE,
- base::ASCIIToUTF16(chrome::kSyncErrorsHelpURL),
- passphrase_time_str));
- args.SetString(
- "enterGooglePassphraseBody",
- GetStringFUTF16(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE,
- base::ASCIIToUTF16(chrome::kSyncErrorsHelpURL),
- passphrase_time_str));
- switch (passphrase_type) {
- case syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE:
- args.SetString(
- "fullEncryptionBody",
- GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_GOOGLE_WITH_DATE,
- passphrase_time_str));
- break;
- case syncer::PassphraseType::CUSTOM_PASSPHRASE:
- args.SetString(
- "fullEncryptionBody",
- GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE,
- passphrase_time_str));
- break;
- default:
- args.SetString("fullEncryptionBody",
- GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM));
- break;
- }
- } else if (passphrase_type == syncer::PassphraseType::CUSTOM_PASSPHRASE) {
+ sync_user_settings->GetPassphraseType();
+ if (syncer::IsExplicitPassphrase(passphrase_type)) {
+ base::Time passphrase_time =
+ sync_user_settings->GetExplicitPassphraseTime();
+ args.SetString("enterPassphraseBody",
+ GetEnterPassphraseBody(passphrase_type, passphrase_time));
args.SetString("fullEncryptionBody",
- GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM));
+ GetFullEncryptionBody(passphrase_type, passphrase_time));
}
FireWebUIListener("sync-prefs-changed", args);
@@ -1094,7 +1119,21 @@ void PeopleHandler::UpdateSyncStatus() {
void PeopleHandler::MarkFirstSetupComplete() {
syncer::SyncService* service = GetSyncService();
// The sync service may be nullptr if it has been just disabled by policy.
- if (!service || service->GetUserSettings()->IsFirstSetupComplete())
+ if (!service)
+ return;
+
+ // Sync is usually already requested at this point, but it might not be if
+ // Sync was reset from the dashboard while this page was open. (In most
+ // situations, resetting Sync also signs the user out of Chrome so this
+ // doesn't come up, but on ChromeOS or for managed (enterprise) accounts
+ // signout isn't possible.)
+ // Note that this has to happen *before* checking if first-time setup is
+ // already marked complete, because on some platforms (e.g. ChromeOS) that
+ // gets set automatically.
+ service->GetUserSettings()->SetSyncRequested(true);
+
+ // If the first-time setup is already complete, there's nothing else to do.
+ if (service->GetUserSettings()->IsFirstSetupComplete())
return;
unified_consent::metrics::RecordSyncSetupDataTypesHistrogam(
diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler.h b/chromium/chrome/browser/ui/webui/settings/people_handler.h
index 8c8774d54c3..010e9ed345f 100644
--- a/chromium/chrome/browser/ui/webui/settings/people_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/people_handler.h
@@ -60,25 +60,32 @@ class PeopleHandler : public SettingsPageUIHandler,
explicit PeopleHandler(Profile* profile);
~PeopleHandler() override;
+ protected:
// Terminates the sync setup flow.
void CloseSyncSetup();
- protected:
bool is_configuring_sync() const { return configuring_sync_; }
private:
friend class PeopleHandlerTest;
+ friend class PeopleHandlerTest_UnifiedConsentDisabled;
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest,
DisplayConfigureWithEngineDisabledAndCancel);
+ FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest_UnifiedConsentDisabled,
+ DisplayConfigureWithEngineDisabledAndCancel);
FRIEND_TEST_ALL_PREFIXES(
PeopleHandlerTest,
DisplayConfigureWithEngineDisabledAndCancelAfterSigninSuccess);
- FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest,
+ FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest_UnifiedConsentDisabled,
DisplayConfigureWithEngineDisabledAndSigninFailed);
FRIEND_TEST_ALL_PREFIXES(
PeopleHandlerTest,
DisplayConfigureWithEngineDisabledAndSyncStartupCompleted);
- FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, HandleSetupUIWhenSyncDisabled);
+ FRIEND_TEST_ALL_PREFIXES(
+ PeopleHandlerTest_UnifiedConsentDisabled,
+ DisplayConfigureWithEngineDisabledAndSyncStartupCompleted);
+ FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest_UnifiedConsentDisabled,
+ HandleSetupUIWhenSyncDisabled);
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest,
ShowSetupCustomPassphraseRequired);
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, ShowSetupEncryptAll);
@@ -89,9 +96,11 @@ class PeopleHandler : public SettingsPageUIHandler,
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, ShowSetupSyncEverything);
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest,
ShowSetupSyncForAllTypesIndividually);
- FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, ShowSigninOnAuthError);
+ FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest_UnifiedConsentDisabled,
+ ShowSigninOnAuthError);
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, ShowSyncSetup);
- FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, ShowSyncSetupWhenNotSignedIn);
+ FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest_UnifiedConsentDisabled,
+ DontShowSyncSetupWhenNotSignedIn);
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, TestSyncEverything);
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, TestSyncAllManually);
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, TestPassphraseStillRequired);
@@ -109,9 +118,15 @@ class PeopleHandler : public SettingsPageUIHandler,
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest,
AcquireSyncBlockerWhenLoadingSyncSettingsSubpage);
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, RestartSyncAfterDashboardClear);
+ FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest_UnifiedConsentDisabled,
+ RestartSyncAfterDashboardClear);
FRIEND_TEST_ALL_PREFIXES(
PeopleHandlerTest,
RestartSyncAfterDashboardClearWithStandaloneTransport);
+ FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest,
+ DashboardClearWhileSettingsOpen_ConfirmSoon);
+ FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest,
+ DashboardClearWhileSettingsOpen_ConfirmLater);
FRIEND_TEST_ALL_PREFIXES(PeopleHandlerDiceUnifiedConsentTest,
StoredAccountsList);
@@ -145,7 +160,7 @@ class PeopleHandler : public SettingsPageUIHandler,
// Returns a newly created dictionary with a number of properties that
// correspond to the status of sync.
- std::unique_ptr<base::DictionaryValue> GetSyncStatusDictionary();
+ std::unique_ptr<base::DictionaryValue> GetSyncStatusDictionary() const;
// Helper routine that gets the SyncService associated with the parent
// profile.
diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc
index e4b50c4ef5f..a14675b46be 100644
--- a/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc
@@ -15,11 +15,11 @@
#include "base/stl_util.h"
#include "base/values.h"
#include "build/build_config.h"
+#include "chrome/browser/defaults.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/browser/signin/scoped_account_consistency.h"
#include "chrome/browser/signin/signin_error_controller_factory.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
-#include "chrome/browser/sync/profile_sync_test_util.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
@@ -32,13 +32,15 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "components/prefs/pref_service.h"
-#include "components/sync_preferences/pref_service_syncable.h"
+#include "components/sync/base/passphrase_enums.h"
+#include "components/sync/driver/mock_sync_service.h"
+#include "components/sync/driver/sync_user_settings_impl.h"
+#include "components/sync/driver/sync_user_settings_mock.h"
#include "components/unified_consent/scoped_unified_consent.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/test/navigation_simulator.h"
-#include "content/public/test/test_browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_web_ui.h"
#include "content/public/test/web_contents_tester.h"
@@ -48,27 +50,25 @@
#include "testing/gtest/include/gtest/gtest.h"
using ::testing::_;
+using ::testing::ByMove;
+using ::testing::Const;
using ::testing::Invoke;
using ::testing::Mock;
using ::testing::Return;
using ::testing::Values;
-using browser_sync::ProfileSyncService;
-using browser_sync::ProfileSyncServiceMock;
-
-typedef GoogleServiceAuthError AuthError;
namespace {
-MATCHER_P(ModelTypeSetMatches, value, "") {
+MATCHER_P(UserSelectableTypeSetMatches, value, "") {
return arg == value;
}
const char kTestUser[] = "chrome.p13n.test@gmail.com";
const char kTestCallbackId[] = "test-callback-id";
-// Returns a ModelTypeSet with all user selectable types set.
-syncer::ModelTypeSet GetAllTypes() {
- return syncer::UserSelectableTypes();
+// Returns a UserSelectableTypeSet with all types set.
+syncer::UserSelectableTypeSet GetAllTypes() {
+ return syncer::UserSelectableTypeSet::All();
}
enum SyncAllDataConfig {
@@ -86,7 +86,7 @@ enum EncryptAllConfig {
// the passed dictionary are added to the json.
std::string GetConfiguration(const base::DictionaryValue* extra_values,
SyncAllDataConfig sync_all,
- syncer::ModelTypeSet types,
+ syncer::UserSelectableTypeSet types,
const std::string& passphrase,
EncryptAllConfig encrypt_all) {
base::DictionaryValue result;
@@ -97,15 +97,22 @@ std::string GetConfiguration(const base::DictionaryValue* extra_values,
if (!passphrase.empty())
result.SetString("passphrase", passphrase);
// Add all of our data types.
- result.SetBoolean("appsSynced", types.Has(syncer::APPS));
- result.SetBoolean("autofillSynced", types.Has(syncer::AUTOFILL));
- result.SetBoolean("bookmarksSynced", types.Has(syncer::BOOKMARKS));
- result.SetBoolean("extensionsSynced", types.Has(syncer::EXTENSIONS));
- result.SetBoolean("passwordsSynced", types.Has(syncer::PASSWORDS));
- result.SetBoolean("preferencesSynced", types.Has(syncer::PREFERENCES));
- result.SetBoolean("tabsSynced", types.Has(syncer::PROXY_TABS));
- result.SetBoolean("themesSynced", types.Has(syncer::THEMES));
- result.SetBoolean("typedUrlsSynced", types.Has(syncer::TYPED_URLS));
+ result.SetBoolean("appsSynced", types.Has(syncer::UserSelectableType::kApps));
+ result.SetBoolean("autofillSynced",
+ types.Has(syncer::UserSelectableType::kAutofill));
+ result.SetBoolean("bookmarksSynced",
+ types.Has(syncer::UserSelectableType::kBookmarks));
+ result.SetBoolean("extensionsSynced",
+ types.Has(syncer::UserSelectableType::kExtensions));
+ result.SetBoolean("passwordsSynced",
+ types.Has(syncer::UserSelectableType::kPasswords));
+ result.SetBoolean("preferencesSynced",
+ types.Has(syncer::UserSelectableType::kPreferences));
+ result.SetBoolean("tabsSynced", types.Has(syncer::UserSelectableType::kTabs));
+ result.SetBoolean("themesSynced",
+ types.Has(syncer::UserSelectableType::kThemes));
+ result.SetBoolean("typedUrlsSynced",
+ types.Has(syncer::UserSelectableType::kHistory));
result.SetBoolean("paymentsIntegrationEnabled", false);
std::string args;
base::JSONWriter::Write(result, &args);
@@ -142,17 +149,31 @@ void CheckBool(const base::DictionaryValue* dictionary,
// types.
void CheckConfigDataTypeArguments(const base::DictionaryValue* dictionary,
SyncAllDataConfig config,
- syncer::ModelTypeSet types) {
+ syncer::UserSelectableTypeSet types) {
CheckBool(dictionary, "syncAllDataTypes", config == SYNC_ALL_DATA);
- CheckBool(dictionary, "appsSynced", types.Has(syncer::APPS));
- CheckBool(dictionary, "autofillSynced", types.Has(syncer::AUTOFILL));
- CheckBool(dictionary, "bookmarksSynced", types.Has(syncer::BOOKMARKS));
- CheckBool(dictionary, "extensionsSynced", types.Has(syncer::EXTENSIONS));
- CheckBool(dictionary, "passwordsSynced", types.Has(syncer::PASSWORDS));
- CheckBool(dictionary, "preferencesSynced", types.Has(syncer::PREFERENCES));
- CheckBool(dictionary, "tabsSynced", types.Has(syncer::PROXY_TABS));
- CheckBool(dictionary, "themesSynced", types.Has(syncer::THEMES));
- CheckBool(dictionary, "typedUrlsSynced", types.Has(syncer::TYPED_URLS));
+ CheckBool(dictionary, "appsSynced",
+ types.Has(syncer::UserSelectableType::kApps));
+ CheckBool(dictionary, "autofillSynced",
+ types.Has(syncer::UserSelectableType::kAutofill));
+ CheckBool(dictionary, "bookmarksSynced",
+ types.Has(syncer::UserSelectableType::kBookmarks));
+ CheckBool(dictionary, "extensionsSynced",
+ types.Has(syncer::UserSelectableType::kExtensions));
+ CheckBool(dictionary, "passwordsSynced",
+ types.Has(syncer::UserSelectableType::kPasswords));
+ CheckBool(dictionary, "preferencesSynced",
+ types.Has(syncer::UserSelectableType::kPreferences));
+ CheckBool(dictionary, "tabsSynced",
+ types.Has(syncer::UserSelectableType::kTabs));
+ CheckBool(dictionary, "themesSynced",
+ types.Has(syncer::UserSelectableType::kThemes));
+ CheckBool(dictionary, "typedUrlsSynced",
+ types.Has(syncer::UserSelectableType::kHistory));
+}
+
+std::unique_ptr<KeyedService> BuildMockSyncService(
+ content::BrowserContext* context) {
+ return std::make_unique<testing::NiceMock<syncer::MockSyncService>>();
}
} // namespace
@@ -186,12 +207,12 @@ class TestWebUIProvider
}
};
-// The boolean parameter indicates whether the test is run with ClientOAuth
-// or not. The test parameter is a bool: whether or not to test with/
-// /ClientLogin enabled or not.
class PeopleHandlerTest : public ChromeRenderViewHostTestHarness {
public:
- PeopleHandlerTest() = default;
+ PeopleHandlerTest(
+ unified_consent::UnifiedConsentFeatureState unified_consent_state =
+ unified_consent::UnifiedConsentFeatureState::kEnabled)
+ : scoped_unified_consent_(unified_consent_state) {}
void SetUp() override {
ChromeRenderViewHostTestHarness::SetUp();
@@ -204,24 +225,30 @@ class PeopleHandlerTest : public ChromeRenderViewHostTestHarness {
if (!username.empty())
identity_test_env()->SetPrimaryAccount(username);
- mock_pss_ = static_cast<ProfileSyncServiceMock*>(
+ mock_sync_service_ = static_cast<syncer::MockSyncService*>(
ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
- profile(), base::BindRepeating(&BuildMockProfileSyncService)));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), GetPassphraseType())
+ profile(), base::BindRepeating(&BuildMockSyncService)));
+
+ ON_CALL(*mock_sync_service_, IsAuthenticatedAccountPrimary())
+ .WillByDefault(Return(true));
+
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), GetPassphraseType())
.WillByDefault(Return(syncer::PassphraseType::IMPLICIT_PASSPHRASE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), GetExplicitPassphraseTime())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ GetExplicitPassphraseTime())
.WillByDefault(Return(base::Time()));
- ON_CALL(*mock_pss_, GetRegisteredDataTypes())
+ ON_CALL(*mock_sync_service_, GetRegisteredDataTypes())
.WillByDefault(Return(syncer::ModelTypeSet()));
- ON_CALL(*mock_pss_, GetSetupInProgressHandle())
+ ON_CALL(*mock_sync_service_, GetSetupInProgressHandle())
.WillByDefault(
- Invoke(mock_pss_,
- &ProfileSyncServiceMock::GetSetupInProgressHandleConcrete));
-
- mock_pss_->Initialize();
+ Return(ByMove(std::make_unique<syncer::SyncSetupInProgressHandle>(
+ base::BindRepeating(
+ &PeopleHandlerTest::OnSetupInProgressHandleDestroyed,
+ base::Unretained(this))))));
handler_.reset(new TestingPeopleHandler(&web_ui_, profile()));
handler_->AllowJavascript();
+ web_ui_.set_web_contents(web_contents());
}
void TearDown() override {
@@ -242,28 +269,30 @@ class PeopleHandlerTest : public ChromeRenderViewHostTestHarness {
// Setup the expectations for calls made when displaying the config page.
void SetDefaultExpectationsForConfigPage() {
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncRequested())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_, GetRegisteredDataTypes())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ GetRegisteredSelectableTypes())
.WillByDefault(Return(GetAllTypes()));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncEverythingEnabled())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsSyncEverythingEnabled())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), GetChosenDataTypes())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), GetSelectedTypes())
.WillByDefault(Return(GetAllTypes()));
- ON_CALL(*mock_pss_, GetActiveDataTypes())
- .WillByDefault(Return(GetAllTypes()));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsEncryptEverythingAllowed())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsEncryptEverythingAllowed())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsEncryptEverythingEnabled())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsEncryptEverythingEnabled())
.WillByDefault(Return(false));
}
- void SetupInitializedProfileSyncService() {
- // An initialized ProfileSyncService will have already completed sync setup
- // and will have an initialized sync engine.
- ON_CALL(*mock_pss_, GetTransportState())
+ void SetupInitializedSyncService() {
+ // An initialized SyncService will have already completed sync setup and
+ // will have an initialized sync engine.
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(Return(syncer::SyncService::TransportState::ACTIVE));
}
@@ -315,15 +344,17 @@ class PeopleHandlerTest : public ChromeRenderViewHostTestHarness {
return dictionary;
}
- // It's difficult to notify sync listeners when using a ProfileSyncServiceMock
+ // It's difficult to notify sync listeners when using a MockSyncService
// so this helper routine dispatches an OnStateChanged() notification to the
// SyncStartupTracker.
void NotifySyncListeners() {
if (handler_->sync_startup_tracker_)
- handler_->sync_startup_tracker_->OnStateChanged(mock_pss_);
+ handler_->sync_startup_tracker_->OnStateChanged(mock_sync_service_);
}
- void NotifySyncStateChanged() { handler_->OnStateChanged(mock_pss_); }
+ void NotifySyncStateChanged() {
+ handler_->OnStateChanged(mock_sync_service_);
+ }
virtual std::string GetTestUser() {
return std::string(kTestUser);
@@ -333,27 +364,42 @@ class PeopleHandlerTest : public ChromeRenderViewHostTestHarness {
return identity_test_env_adaptor_->identity_test_env();
}
- ProfileSyncServiceMock* mock_pss_;
+ MOCK_METHOD0(OnSetupInProgressHandleDestroyed, void());
+
+ unified_consent::ScopedUnifiedConsent scoped_unified_consent_;
+
+ syncer::MockSyncService* mock_sync_service_;
std::unique_ptr<IdentityTestEnvironmentProfileAdaptor>
identity_test_env_adaptor_;
content::TestWebUI web_ui_;
TestWebUIProvider test_provider_;
std::unique_ptr<TestChromeWebUIControllerFactory> test_factory_;
std::unique_ptr<TestingPeopleHandler> handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(PeopleHandlerTest);
};
class PeopleHandlerFirstSigninTest : public PeopleHandlerTest {
std::string GetTestUser() override { return std::string(); }
};
+class PeopleHandlerTest_UnifiedConsentDisabled : public PeopleHandlerTest {
+ public:
+ PeopleHandlerTest_UnifiedConsentDisabled()
+ : PeopleHandlerTest(
+ unified_consent::UnifiedConsentFeatureState::kDisabled) {}
+
+ DISALLOW_COPY_AND_ASSIGN(PeopleHandlerTest_UnifiedConsentDisabled);
+};
+
#if !defined(OS_CHROMEOS)
TEST_F(PeopleHandlerFirstSigninTest, DisplayBasicLogin) {
// Test that the HandleStartSignin call enables JavaScript.
handler_->DisallowJavascript();
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NOT_SIGNED_IN));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
.WillByDefault(Return(false));
// Ensure that the user is not signed in before calling |HandleStartSignin()|.
identity_test_env()->ClearPrimaryAccount();
@@ -373,10 +419,11 @@ TEST_F(PeopleHandlerFirstSigninTest, DisplayBasicLogin) {
LoginUIServiceFactory::GetForProfile(profile())->current_login_ui());
}
-TEST_F(PeopleHandlerTest, ShowSyncSetupWhenNotSignedIn) {
- ON_CALL(*mock_pss_, GetDisableReasons())
+TEST_F(PeopleHandlerTest_UnifiedConsentDisabled,
+ DontShowSyncSetupWhenNotSignedIn) {
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NOT_SIGNED_IN));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
.WillByDefault(Return(false));
handler_->HandleShowSetupUI(nullptr);
@@ -391,8 +438,9 @@ TEST_F(PeopleHandlerTest, ShowSyncSetupWhenNotSignedIn) {
// Verifies that the sync setup is terminated correctly when the
// sync is disabled.
-TEST_F(PeopleHandlerTest, HandleSetupUIWhenSyncDisabled) {
- ON_CALL(*mock_pss_, GetDisableReasons())
+TEST_F(PeopleHandlerTest_UnifiedConsentDisabled,
+ HandleSetupUIWhenSyncDisabled) {
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(
Return(syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY));
handler_->HandleShowSetupUI(nullptr);
@@ -404,18 +452,51 @@ TEST_F(PeopleHandlerTest, HandleSetupUIWhenSyncDisabled) {
ASSERT_FALSE(handler_->is_configuring_sync());
}
+TEST_F(PeopleHandlerTest, DisplayConfigureWithEngineDisabledAndCancel) {
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
+ .WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(Return(syncer::SyncService::TransportState::INITIALIZING));
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true));
+
+ // We're simulating a user setting up sync, which would cause the engine to
+ // kick off initialization, but not download user data types. The sync
+ // engine will try to download control data types (e.g encryption info), but
+ // that won't finish for this test as we're simulating cancelling while the
+ // spinner is showing.
+ handler_->HandleShowSetupUI(nullptr);
+
+ EXPECT_EQ(
+ handler_.get(),
+ LoginUIServiceFactory::GetForProfile(profile())->current_login_ui());
+
+ EXPECT_EQ(0U, web_ui_.call_data().size());
+
+ handler_->CloseSyncSetup();
+ EXPECT_EQ(
+ NULL,
+ LoginUIServiceFactory::GetForProfile(profile())->current_login_ui());
+}
+
// Verifies that the handler correctly handles a cancellation when
// it is displaying the spinner to the user.
-TEST_F(PeopleHandlerTest, DisplayConfigureWithEngineDisabledAndCancel) {
- ON_CALL(*mock_pss_, GetDisableReasons())
+TEST_F(PeopleHandlerTest_UnifiedConsentDisabled,
+ DisplayConfigureWithEngineDisabledAndCancel) {
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncRequested())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(Return(syncer::SyncService::TransportState::INITIALIZING));
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetSyncRequested(true));
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true));
// We're simulating a user setting up sync, which would cause the engine to
// kick off initialization, but not download user data types. The sync
@@ -431,21 +512,62 @@ TEST_F(PeopleHandlerTest, DisplayConfigureWithEngineDisabledAndCancel) {
ExpectSpinnerAndClose();
}
+// Verifies that the handler only sends the sync pref updates once the engine is
+// initialized.
+TEST_F(PeopleHandlerTest,
+ DisplayConfigureWithEngineDisabledAndSyncStartupCompleted) {
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
+ .WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
+ .WillByDefault(Return(true));
+ // Sync engine is stopped initially, and will start up.
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(
+ Return(syncer::SyncService::TransportState::START_DEFERRED));
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true));
+ SetDefaultExpectationsForConfigPage();
+
+ handler_->HandleShowSetupUI(nullptr);
+
+ // No data is sent yet, because the engine is not initialized.
+ EXPECT_EQ(0U, web_ui_.call_data().size());
+
+ Mock::VerifyAndClearExpectations(mock_sync_service_);
+ // Now, act as if the SyncService has started up.
+ SetDefaultExpectationsForConfigPage();
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(Return(syncer::SyncService::TransportState::ACTIVE));
+ NotifySyncStateChanged();
+
+ // Updates for the sync status and the sync prefs are sent.
+ EXPECT_EQ(2U, web_ui_.call_data().size());
+
+ const base::DictionaryValue* dictionary = ExpectSyncPrefsChanged();
+ CheckBool(dictionary, "syncAllDataTypes", true);
+ CheckBool(dictionary, "encryptAllDataAllowed", true);
+ CheckBool(dictionary, "encryptAllData", false);
+ CheckBool(dictionary, "passphraseRequired", false);
+}
+
// Verifies that the handler correctly transitions from showing the spinner
// to showing a configuration page when sync setup completes successfully.
-TEST_F(PeopleHandlerTest,
+TEST_F(PeopleHandlerTest_UnifiedConsentDisabled,
DisplayConfigureWithEngineDisabledAndSyncStartupCompleted) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncRequested())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
.WillByDefault(Return(true));
// Sync engine is stopped initially, and will start up.
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(
Return(syncer::SyncService::TransportState::START_DEFERRED));
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetSyncRequested(true));
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true));
SetDefaultExpectationsForConfigPage();
handler_->HandleShowSetupUI(nullptr);
@@ -453,10 +575,10 @@ TEST_F(PeopleHandlerTest,
EXPECT_EQ(1U, web_ui_.call_data().size());
ExpectPageStatusChanged(PeopleHandler::kSpinnerPageStatus);
- Mock::VerifyAndClearExpectations(mock_pss_);
- // Now, act as if the ProfileSyncService has started up.
+ Mock::VerifyAndClearExpectations(mock_sync_service_);
+ // Now, act as if the SyncService has started up.
SetDefaultExpectationsForConfigPage();
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(Return(syncer::SyncService::TransportState::ACTIVE));
handler_->SyncStartupCompleted();
@@ -470,30 +592,31 @@ TEST_F(PeopleHandlerTest,
}
// Verifies the case where the user cancels after the sync engine has
-// initialized (meaning it already transitioned from the spinner to a proper
-// configuration page, tested by
-// DisplayConfigureWithEngineDisabledAndSyncStartupCompleted), but before the
-// user has continued on.
+// initialized.
TEST_F(PeopleHandlerTest,
DisplayConfigureWithEngineDisabledAndCancelAfterSigninSuccess) {
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncRequested())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
.WillByDefault(Return(false));
- EXPECT_CALL(*mock_pss_, GetTransportState())
+ EXPECT_CALL(*mock_sync_service_, GetTransportState())
.WillOnce(Return(syncer::SyncService::TransportState::INITIALIZING))
.WillRepeatedly(Return(syncer::SyncService::TransportState::ACTIVE));
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetSyncRequested(true));
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true));
SetDefaultExpectationsForConfigPage();
handler_->HandleShowSetupUI(nullptr);
+ // Sync engine becomes active, so |handler_| is notified.
+ NotifySyncStateChanged();
+
// It's important to tell sync the user cancelled the setup flow before we
// tell it we're through with the setup progress.
testing::InSequence seq;
- EXPECT_CALL(*mock_pss_, StopAndClear());
- EXPECT_CALL(*mock_pss_, OnSetupInProgressHandleDestroyed());
+ EXPECT_CALL(*mock_sync_service_, StopAndClear());
+ EXPECT_CALL(*this, OnSetupInProgressHandleDestroyed());
handler_->CloseSyncSetup();
EXPECT_EQ(
@@ -501,21 +624,23 @@ TEST_F(PeopleHandlerTest,
LoginUIServiceFactory::GetForProfile(profile())->current_login_ui());
}
-TEST_F(PeopleHandlerTest, DisplayConfigureWithEngineDisabledAndSigninFailed) {
- ON_CALL(*mock_pss_, GetDisableReasons())
+TEST_F(PeopleHandlerTest_UnifiedConsentDisabled,
+ DisplayConfigureWithEngineDisabledAndSigninFailed) {
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncRequested())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(Return(syncer::SyncService::TransportState::INITIALIZING));
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetSyncRequested(true));
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true));
handler_->HandleShowSetupUI(nullptr);
ExpectPageStatusChanged(PeopleHandler::kSpinnerPageStatus);
- Mock::VerifyAndClearExpectations(mock_pss_);
- ON_CALL(*mock_pss_, GetAuthError())
+ Mock::VerifyAndClearExpectations(mock_sync_service_);
+ ON_CALL(*mock_sync_service_, GetAuthError())
.WillByDefault(Return(GoogleServiceAuthError(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)));
NotifySyncListeners();
@@ -529,28 +654,58 @@ TEST_F(PeopleHandlerTest, DisplayConfigureWithEngineDisabledAndSigninFailed) {
TEST_F(PeopleHandlerTest, RestartSyncAfterDashboardClear) {
// Clearing sync from the dashboard results in DISABLE_REASON_USER_CHOICE
// being set.
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_USER_CHOICE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
- .WillByDefault(Return(true));
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(Return(syncer::SyncService::TransportState::DISABLED));
+
+ // Attempting to open the setup UI should restart sync.
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true))
+ .WillOnce([&](bool) {
+ // SetSyncRequested(true) clears DISABLE_REASON_USER_CHOICE, and
+ // immediately starts initializing the engine.
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
+ .WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(
+ Return(syncer::SyncService::TransportState::INITIALIZING));
+ });
+
+ handler_->HandleShowSetupUI(nullptr);
+
+ // Since the engine is not initialized yet, no data should be sent.
+ EXPECT_EQ(0U, web_ui_.call_data().size());
+}
+
+TEST_F(PeopleHandlerTest_UnifiedConsentDisabled,
+ RestartSyncAfterDashboardClear) {
+ // Clearing sync from the dashboard results in DISABLE_REASON_USER_CHOICE
+ // being set.
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
+ .WillByDefault(Return(syncer::SyncService::DISABLE_REASON_USER_CHOICE));
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(Return(syncer::SyncService::TransportState::DISABLED));
// Attempting to open the setup UI should restart sync.
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetSyncRequested(true))
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true))
.WillOnce([&](bool) {
// SetSyncRequested(true) clears DISABLE_REASON_USER_CHOICE, and
- // immediately starts initialzing the engine.
- ON_CALL(*mock_pss_, GetDisableReasons())
+ // immediately starts initializing the engine.
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncRequested())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(
Return(syncer::SyncService::TransportState::INITIALIZING));
});
handler_->HandleShowSetupUI(nullptr);
+ // Since the engine is not initialized yet, we should get a spinner.
ExpectPageStatusChanged(PeopleHandler::kSpinnerPageStatus);
}
@@ -559,45 +714,46 @@ TEST_F(PeopleHandlerTest,
// Clearing sync from the dashboard results in DISABLE_REASON_USER_CHOICE
// being set. However, the sync engine has restarted in standalone transport
// mode.
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_USER_CHOICE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
- .WillByDefault(Return(true));
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(Return(syncer::SyncService::TransportState::ACTIVE));
// Attempting to open the setup UI should re-enable sync-the-feature.
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetSyncRequested(true))
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true))
.WillOnce([&](bool) {
// SetSyncRequested(true) clears DISABLE_REASON_USER_CHOICE. Since the
// engine is already running, it just gets reconfigured.
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncRequested())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(
Return(syncer::SyncService::TransportState::CONFIGURING));
});
handler_->HandleShowSetupUI(nullptr);
- ExpectPageStatusChanged(PeopleHandler::kSpinnerPageStatus);
+ // Since the engine was already running, we should *not* get a spinner - all
+ // the necessary values are already available.
+ ExpectSyncPrefsChanged();
}
// Tests that signals not related to user intention to configure sync don't
// trigger sync engine start.
TEST_F(PeopleHandlerTest, OnlyStartEngineWhenConfiguringSync) {
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(Return(syncer::SyncService::TransportState::INITIALIZING));
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetSyncRequested(true))
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true))
.Times(0);
NotifySyncStateChanged();
}
TEST_F(PeopleHandlerTest, AcquireSyncBlockerWhenLoadingSyncSettingsSubpage) {
- /// We set up a factory override here to prevent a new web ui from being
- /// created when we navigate to a page that would normally create one.
- web_ui_.set_web_contents(web_contents());
+ // We set up a factory override here to prevent a new web ui from being
+ // created when we navigate to a page that would normally create one.
test_factory_ = std::make_unique<TestChromeWebUIControllerFactory>();
test_factory_->AddFactoryOverride(
chrome::GetSettingsUrl(chrome::kSyncSetupSubPage).host(),
@@ -625,10 +781,10 @@ class PeopleHandlerNonCrosTest : public PeopleHandlerTest {
// TODO(kochi): We need equivalent tests for ChromeOS.
TEST_F(PeopleHandlerNonCrosTest, UnrecoverableErrorInitializingSync) {
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(
Return(syncer::SyncService::DISABLE_REASON_UNRECOVERABLE_ERROR));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
.WillByDefault(Return(false));
// Open the web UI.
handler_->HandleShowSetupUI(nullptr);
@@ -637,9 +793,9 @@ TEST_F(PeopleHandlerNonCrosTest, UnrecoverableErrorInitializingSync) {
}
TEST_F(PeopleHandlerNonCrosTest, GaiaErrorInitializingSync) {
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NOT_SIGNED_IN));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsFirstSetupComplete())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
.WillByDefault(Return(false));
// Open the web UI.
handler_->HandleShowSetupUI(nullptr);
@@ -655,13 +811,14 @@ TEST_F(PeopleHandlerTest, TestSyncEverything) {
base::ListValue list_args;
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
- ON_CALL(*mock_pss_->GetUserSettingsMock(),
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsPassphraseRequiredForDecryption())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetChosenDataTypes(true, _));
+ SetupInitializedSyncService();
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSelectedTypes(true, _));
handler_->HandleSetDatatypes(&list_args);
ExpectPageStatusResponse(PeopleHandler::kConfigurePageStatus);
@@ -673,14 +830,15 @@ TEST_F(PeopleHandlerTest, TestPassphraseStillRequired) {
base::ListValue list_args;
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
- ON_CALL(*mock_pss_->GetUserSettingsMock(),
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsPassphraseRequiredForDecryption())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
handler_->HandleSetEncryption(&list_args);
@@ -698,15 +856,17 @@ TEST_F(PeopleHandlerTest, EnterExistingFrozenImplicitPassword) {
list_args.AppendString(args);
// Act as if an encryption passphrase is required the first time, then never
// again after that.
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsPassphraseRequired())
.WillOnce(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(),
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsPassphraseRequiredForDecryption())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(),
+ SetupInitializedSyncService();
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
SetDecryptionPassphrase("oldGaiaPassphrase"))
.WillOnce(Return(true));
@@ -722,17 +882,19 @@ TEST_F(PeopleHandlerTest, SetNewCustomPassphrase) {
base::ListValue list_args;
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsEncryptEverythingAllowed())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsEncryptEverythingAllowed())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(),
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsPassphraseRequiredForDecryption())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(),
+ SetupInitializedSyncService();
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
SetEncryptionPassphrase("custom_passphrase"));
handler_->HandleSetEncryption(&list_args);
@@ -747,15 +909,16 @@ TEST_F(PeopleHandlerTest, EnterWrongExistingPassphrase) {
base::ListValue list_args;
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
- ON_CALL(*mock_pss_->GetUserSettingsMock(),
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsPassphraseRequiredForDecryption())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(),
+ SetupInitializedSyncService();
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
SetDecryptionPassphrase("invalid_passphrase"))
.WillOnce(Return(false));
@@ -777,14 +940,15 @@ TEST_F(PeopleHandlerTest, EnterBlankExistingPassphrase) {
base::ListValue list_args;
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
- ON_CALL(*mock_pss_->GetUserSettingsMock(),
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsPassphraseRequiredForDecryption())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
@@ -796,9 +960,8 @@ TEST_F(PeopleHandlerTest, EnterBlankExistingPassphrase) {
// Walks through each user selectable type, and tries to sync just that single
// data type.
TEST_F(PeopleHandlerTest, TestSyncIndividualTypes) {
- syncer::ModelTypeSet user_selectable_types = GetAllTypes();
- for (syncer::ModelType type : user_selectable_types) {
- syncer::ModelTypeSet type_to_set;
+ for (syncer::UserSelectableType type : GetAllTypes()) {
+ syncer::UserSelectableTypeSet type_to_set;
type_to_set.Put(type);
std::string args = GetConfiguration(NULL,
CHOOSE_WHAT_TO_SYNC,
@@ -808,18 +971,19 @@ TEST_F(PeopleHandlerTest, TestSyncIndividualTypes) {
base::ListValue list_args;
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
- ON_CALL(*mock_pss_->GetUserSettingsMock(),
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsPassphraseRequiredForDecryption())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(),
- SetChosenDataTypes(false, ModelTypeSetMatches(type_to_set)));
+ SetupInitializedSyncService();
+ EXPECT_CALL(
+ *mock_sync_service_->GetMockUserSettings(),
+ SetSelectedTypes(false, UserSelectableTypeSetMatches(type_to_set)));
handler_->HandleSetDatatypes(&list_args);
ExpectPageStatusResponse(PeopleHandler::kConfigurePageStatus);
- Mock::VerifyAndClearExpectations(mock_pss_);
+ Mock::VerifyAndClearExpectations(mock_sync_service_);
}
}
@@ -832,25 +996,27 @@ TEST_F(PeopleHandlerTest, TestSyncAllManually) {
base::ListValue list_args;
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
- ON_CALL(*mock_pss_->GetUserSettingsMock(),
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsPassphraseRequiredForDecryption())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(),
- SetChosenDataTypes(false, ModelTypeSetMatches(GetAllTypes())));
+ SetupInitializedSyncService();
+ EXPECT_CALL(
+ *mock_sync_service_->GetMockUserSettings(),
+ SetSelectedTypes(false, UserSelectableTypeSetMatches(GetAllTypes())));
handler_->HandleSetDatatypes(&list_args);
ExpectPageStatusResponse(PeopleHandler::kConfigurePageStatus);
}
TEST_F(PeopleHandlerTest, ShowSyncSetup) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
// This should display the sync setup dialog (not login).
SetDefaultExpectationsForConfigPage();
handler_->HandleShowSetupUI(nullptr);
@@ -859,13 +1025,13 @@ TEST_F(PeopleHandlerTest, ShowSyncSetup) {
}
// We do not display signin on chromeos in the case of auth error.
-TEST_F(PeopleHandlerTest, ShowSigninOnAuthError) {
+TEST_F(PeopleHandlerTest_UnifiedConsentDisabled, ShowSigninOnAuthError) {
// Initialize the system to a signed in state, but with an auth error.
- ON_CALL(*mock_pss_, GetAuthError())
+ ON_CALL(*mock_sync_service_, GetAuthError())
.WillByDefault(Return(GoogleServiceAuthError(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
auto* identity_manager = identity_test_env()->identity_manager();
CoreAccountInfo primary_account_info =
@@ -884,15 +1050,16 @@ TEST_F(PeopleHandlerTest, ShowSigninOnAuthError) {
identity_manager, primary_account_info.account_id,
GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
- ON_CALL(*mock_pss_, GetDisableReasons())
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncRequested())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_, GetTransportState())
+ ON_CALL(*mock_sync_service_, GetTransportState())
.WillByDefault(Return(syncer::SyncService::TransportState::INITIALIZING));
#if defined(OS_CHROMEOS)
@@ -920,11 +1087,12 @@ TEST_F(PeopleHandlerTest, ShowSigninOnAuthError) {
}
TEST_F(PeopleHandlerTest, ShowSetupSyncEverything) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
// This should display the sync setup dialog (not login).
handler_->HandleShowSetupUI(nullptr);
@@ -942,19 +1110,19 @@ TEST_F(PeopleHandlerTest, ShowSetupSyncEverything) {
CheckBool(dictionary, "typedUrlsRegistered", true);
CheckBool(dictionary, "paymentsIntegrationEnabled", true);
CheckBool(dictionary, "passphraseRequired", false);
- CheckBool(dictionary, "passphraseTypeIsCustom", false);
CheckBool(dictionary, "encryptAllData", false);
CheckConfigDataTypeArguments(dictionary, SYNC_ALL_DATA, GetAllTypes());
}
TEST_F(PeopleHandlerTest, ShowSetupManuallySyncAll) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncEverythingEnabled())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncEverythingEnabled())
.WillByDefault(Return(false));
// This should display the sync setup dialog (not login).
handler_->HandleShowSetupUI(nullptr);
@@ -964,19 +1132,19 @@ TEST_F(PeopleHandlerTest, ShowSetupManuallySyncAll) {
}
TEST_F(PeopleHandlerTest, ShowSetupSyncForAllTypesIndividually) {
- syncer::ModelTypeSet user_selectable_types = GetAllTypes();
- for (syncer::ModelType type : user_selectable_types) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ for (syncer::UserSelectableType type : GetAllTypes()) {
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsSyncEverythingEnabled())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsSyncEverythingEnabled())
.WillByDefault(Return(false));
- syncer::ModelTypeSet types;
- types.Put(type);
- ON_CALL(*mock_pss_->GetUserSettingsMock(), GetChosenDataTypes())
+ syncer::UserSelectableTypeSet types(type);
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), GetSelectedTypes())
.WillByDefault(Return(types));
// This should display the sync setup dialog (not login).
@@ -988,19 +1156,19 @@ TEST_F(PeopleHandlerTest, ShowSetupSyncForAllTypesIndividually) {
const base::DictionaryValue* dictionary = ExpectSyncPrefsChanged();
CheckConfigDataTypeArguments(dictionary, CHOOSE_WHAT_TO_SYNC, types);
- Mock::VerifyAndClearExpectations(mock_pss_);
+ Mock::VerifyAndClearExpectations(mock_sync_service_);
// Clean up so we can loop back to display the dialog again.
web_ui_.ClearTrackedCalls();
}
}
TEST_F(PeopleHandlerTest, ShowSetupOldGaiaPassphraseRequired) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), GetPassphraseType())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), GetPassphraseType())
.WillByDefault(
Return(syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
// This should display the sync setup dialog (not login).
@@ -1008,15 +1176,15 @@ TEST_F(PeopleHandlerTest, ShowSetupOldGaiaPassphraseRequired) {
const base::DictionaryValue* dictionary = ExpectSyncPrefsChanged();
CheckBool(dictionary, "passphraseRequired", true);
- CheckBool(dictionary, "passphraseTypeIsCustom", false);
+ EXPECT_TRUE(dictionary->FindKey("enterPassphraseBody"));
}
TEST_F(PeopleHandlerTest, ShowSetupCustomPassphraseRequired) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), GetPassphraseType())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), GetPassphraseType())
.WillByDefault(Return(syncer::PassphraseType::CUSTOM_PASSPHRASE));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
// This should display the sync setup dialog (not login).
@@ -1024,17 +1192,19 @@ TEST_F(PeopleHandlerTest, ShowSetupCustomPassphraseRequired) {
const base::DictionaryValue* dictionary = ExpectSyncPrefsChanged();
CheckBool(dictionary, "passphraseRequired", true);
- CheckBool(dictionary, "passphraseTypeIsCustom", true);
+ EXPECT_TRUE(dictionary->FindKey("enterPassphraseBody"));
}
TEST_F(PeopleHandlerTest, ShowSetupEncryptAll) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsEncryptEverythingEnabled())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsEncryptEverythingEnabled())
.WillByDefault(Return(true));
// This should display the sync setup dialog (not login).
@@ -1045,13 +1215,15 @@ TEST_F(PeopleHandlerTest, ShowSetupEncryptAll) {
}
TEST_F(PeopleHandlerTest, ShowSetupEncryptAllDisallowed) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsUsingSecondaryPassphrase())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsUsingSecondaryPassphrase())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
+ SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsEncryptEverythingAllowed())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsEncryptEverythingAllowed())
.WillByDefault(Return(false));
// This should display the sync setup dialog (not login).
@@ -1063,13 +1235,14 @@ TEST_F(PeopleHandlerTest, ShowSetupEncryptAllDisallowed) {
}
TEST_F(PeopleHandlerTest, TurnOnEncryptAllDisallowed) {
- ON_CALL(*mock_pss_->GetUserSettingsMock(),
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsPassphraseRequiredForDecryption())
.WillByDefault(Return(false));
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequired())
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
- SetupInitializedProfileSyncService();
- ON_CALL(*mock_pss_->GetUserSettingsMock(), IsEncryptEverythingAllowed())
+ SetupInitializedSyncService();
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsEncryptEverythingAllowed())
.WillByDefault(Return(false));
base::DictionaryValue dict;
@@ -1080,9 +1253,11 @@ TEST_F(PeopleHandlerTest, TurnOnEncryptAllDisallowed) {
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), EnableEncryptEverything())
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ EnableEncryptEverything())
.Times(0);
- EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetEncryptionPassphrase(_))
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetEncryptionPassphrase(_))
.Times(0);
handler_->HandleSetEncryption(&list_args);
@@ -1090,6 +1265,125 @@ TEST_F(PeopleHandlerTest, TurnOnEncryptAllDisallowed) {
ExpectPageStatusResponse(PeopleHandler::kConfigurePageStatus);
}
+TEST_F(PeopleHandlerTest, DashboardClearWhileSettingsOpen_ConfirmSoon) {
+ // Sync starts out fully enabled.
+ SetDefaultExpectationsForConfigPage();
+
+ handler_->HandleShowSetupUI(nullptr);
+
+ // Now sync gets reset from the dashboard (the user clicked the "Manage synced
+ // data" link), which results in the sync-requested and first-setup-complete
+ // bits being cleared.
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
+ .WillByDefault(Return(syncer::SyncService::DISABLE_REASON_USER_CHOICE));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
+ .WillByDefault(Return(false));
+ // Sync will eventually start again in transport mode.
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(
+ Return(syncer::SyncService::TransportState::START_DEFERRED));
+
+ NotifySyncStateChanged();
+
+ // Now the user confirms sync again. This should set both the sync-requested
+ // and the first-setup-complete bits.
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true))
+ .WillOnce([&](bool) {
+ // SetSyncRequested(true) clears DISABLE_REASON_USER_CHOICE, and
+ // immediately starts initializing the engine.
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
+ .WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(
+ Return(syncer::SyncService::TransportState::INITIALIZING));
+ NotifySyncStateChanged();
+ });
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetFirstSetupComplete())
+ .WillOnce([&]() {
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsFirstSetupComplete())
+ .WillByDefault(Return(true));
+ NotifySyncStateChanged();
+ });
+
+ base::ListValue did_abort;
+ did_abort.GetList().push_back(base::Value(false));
+ handler_->OnDidClosePage(&did_abort);
+}
+
+TEST_F(PeopleHandlerTest, DashboardClearWhileSettingsOpen_ConfirmLater) {
+ // Sync starts out fully enabled.
+ SetDefaultExpectationsForConfigPage();
+
+ handler_->HandleShowSetupUI(nullptr);
+
+ // Now sync gets reset from the dashboard (the user clicked the "Manage synced
+ // data" link), which results in the sync-requested and first-setup-complete
+ // bits being cleared.
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
+ .WillByDefault(Return(syncer::SyncService::DISABLE_REASON_USER_CHOICE));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
+ .WillByDefault(Return(false));
+ // Sync will eventually start again in transport mode.
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(
+ Return(syncer::SyncService::TransportState::START_DEFERRED));
+
+ NotifySyncStateChanged();
+
+ // The user waits a while before doing anything, so sync starts up in
+ // transport mode.
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(Return(syncer::SyncService::TransportState::ACTIVE));
+ // On some platforms (e.g. ChromeOS), the first-setup-complete bit gets set
+ // automatically during engine startup.
+ if (browser_defaults::kSyncAutoStarts) {
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsFirstSetupComplete())
+ .WillByDefault(Return(true));
+ }
+ NotifySyncStateChanged();
+
+ // Now the user confirms sync again. This should set the sync-requested bit
+ // and (if it wasn't automatically set above already) also the
+ // first-setup-complete bit.
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetSyncRequested(true))
+ .WillOnce([&](bool) {
+ // SetSyncRequested(true) clears DISABLE_REASON_USER_CHOICE, and
+ // immediately starts initializing the engine.
+ ON_CALL(*mock_sync_service_, GetDisableReasons())
+ .WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsSyncRequested())
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_sync_service_, GetTransportState())
+ .WillByDefault(
+ Return(syncer::SyncService::TransportState::INITIALIZING));
+ NotifySyncStateChanged();
+ });
+ if (!browser_defaults::kSyncAutoStarts) {
+ EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
+ SetFirstSetupComplete())
+ .WillOnce([&]() {
+ ON_CALL(*mock_sync_service_->GetMockUserSettings(),
+ IsFirstSetupComplete())
+ .WillByDefault(Return(true));
+ NotifySyncStateChanged();
+ });
+ }
+
+ base::ListValue did_abort;
+ did_abort.GetList().push_back(base::Value(false));
+ handler_->OnDidClosePage(&did_abort);
+}
+
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
class PeopleHandlerDiceUnifiedConsentTest
: public ::testing::TestWithParam<std::tuple<bool, bool>> {};
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.cc b/chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.cc
index 8c34895872b..f46e5ef15f1 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.cc
@@ -64,9 +64,12 @@ void DefaultBrowserHandler::OnJavascriptDisallowed() {
}
void DefaultBrowserHandler::RequestDefaultBrowserState(
- const base::ListValue* /*args*/) {
+ const base::ListValue* args) {
AllowJavascript();
+ CHECK_EQ(args->GetSize(), 1U);
+ CHECK(args->GetString(0, &check_default_callback_id_));
+
default_browser_worker_->StartCheckIsDefault();
}
@@ -103,7 +106,12 @@ void DefaultBrowserHandler::OnDefaultBrowserWorkerFinished(
state == shell_integration::UNKNOWN_DEFAULT);
dict.SetBoolean("isDisabledByPolicy", DefaultBrowserIsDisabledByPolicy());
- FireWebUIListener("browser-default-state-changed", dict);
+ if (!check_default_callback_id_.empty()) {
+ ResolveJavascriptCallback(base::Value(check_default_callback_id_), dict);
+ check_default_callback_id_.clear();
+ } else {
+ FireWebUIListener("browser-default-state-changed", dict);
+ }
}
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.h b/chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.h
index 81337dc40df..fe71f6526bf 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/settings_default_browser_handler.h
@@ -40,6 +40,8 @@ class DefaultBrowserHandler : public SettingsPageUIHandler {
virtual void RecordSetAsDefaultUMA();
private:
+ std::string check_default_callback_id_;
+
// Called from WebUI to request the current state.
void RequestDefaultBrowserState(const base::ListValue* args);
diff --git a/chromium/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
index 7b0b41f9780..4349fe2ad14 100644
--- a/chromium/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.h"
+#include "chrome/browser/ui/webui/settings/settings_localized_strings_provider.h"
#include <string>
@@ -17,13 +17,13 @@
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
-#include "chrome/browser/plugins/plugin_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h"
#include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
#include "chrome/browser/ui/webui/localized_string.h"
+#include "chrome/browser/ui/webui/management_ui.h"
#include "chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
@@ -31,11 +31,14 @@
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/locale_settings.h"
+#include "components/autofill/core/browser/autofill_experiments.h"
#include "components/autofill/core/browser/payments/payments_service_url.h"
#include "components/autofill/core/browser/payments/payments_util.h"
#include "components/autofill/core/browser/personal_data_manager.h"
+#include "components/autofill/core/browser/sync_utils.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_features.h"
+#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/google/core/common/google_util.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/password_manager/core/browser/manage_passwords_referrer.h"
@@ -50,6 +53,8 @@
#include "components/unified_consent/feature.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/content_features.h"
+#include "content/public/common/content_switches.h"
+#include "device/fido/features.h"
#include "media/base/media_switches.h"
#include "services/device/public/cpp/device_features.h"
#include "ui/accessibility/accessibility_switches.h"
@@ -88,6 +93,7 @@
#if defined(OS_WIN)
#include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h"
+#include "device/fido/win/webauthn_api.h"
#if defined(GOOGLE_CHROME_BUILD)
#include "base/metrics/field_trial_params.h"
@@ -216,17 +222,9 @@ void AddA11yStrings(content::WebUIDataSource* html_source) {
{"delayBeforeClickShort", IDS_SETTINGS_DELAY_BEFORE_CLICK_SHORT},
{"delayBeforeClickLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_LONG},
{"delayBeforeClickVeryLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_VERY_LONG},
- {"autoclickEventTypeLabel", IDS_SETTINGS_AUTOCLICK_EVENT_TYPE_LABEL},
- {"autoclickEventTypeLeftClick",
- IDS_SETTINGS_AUTOCLICK_EVENT_TYPE_LEFT_CLICK},
- {"autoclickEventTypeRightClick",
- IDS_SETTINGS_AUTOCLICK_EVENT_TYPE_RIGHT_CLICK},
- {"autoclickEventTypeDragAndDrop",
- IDS_SETTINGS_AUTOCLICK_EVENT_TYPE_DRAG_AND_DROP},
- {"autoclickEventTypeDoubleClick",
- IDS_SETTINGS_AUTOCLICK_EVENT_TYPE_DOUBLE_CLICK},
- {"autoclickEventTypeNoAction", IDS_SETTINGS_AUTOCLICK_EVENT_TYPE_NO_ACTION},
{"autoclickRevertToLeftClick", IDS_SETTINGS_AUTOCLICK_REVERT_TO_LEFT_CLICK},
+ {"autoclickStabilizeCursorPosition",
+ IDS_SETTINGS_AUTOCLICK_STABILIZE_CURSOR_POSITION},
{"autoclickMovementThresholdLabel",
IDS_SETTINGS_AUTOCLICK_MOVEMENT_THRESHOLD_LABEL},
{"autoclickMovementThresholdExtraSmall",
@@ -461,12 +459,15 @@ void AddCrostiniStrings(content::WebUIDataSource* html_source,
{"crostiniExportLabel", IDS_SETTINGS_CROSTINI_EXPORT_LABEL},
{"crostiniImport", IDS_SETTINGS_CROSTINI_IMPORT},
{"crostiniImportLabel", IDS_SETTINGS_CROSTINI_IMPORT_LABEL},
+ {"crostiniRemoveButton", IDS_SETTINGS_CROSTINI_REMOVE_BUTTON},
{"crostiniSharedUsbDevicesLabel",
IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_LABEL},
{"crostiniSharedUsbDevicesDescription",
IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_DESCRIPTION},
- {"crostiniSharedUsbDevicesListHeading",
- IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_LIST_HEADING},
+ {"crostiniSharedUsbDevicesExtraDescription",
+ IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_EXTRA_DESCRIPTION},
+ {"crostiniSharedUsbDevicesListEmptyMessage",
+ IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_LIST_EMPTY_MESSAGE},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings,
base::size(kLocalizedStrings));
@@ -492,6 +493,21 @@ void AddCrostiniStrings(content::WebUIDataSource* html_source,
base::FeatureList::IsEnabled(chromeos::features::kCrostiniUsbSupport));
}
+void AddPluginVmStrings(content::WebUIDataSource* html_source,
+ Profile* profile) {
+ static constexpr LocalizedString kLocalizedStrings[] = {
+ {"pluginVmPageTitle", IDS_SETTINGS_PLUGIN_VM_PAGE_TITLE},
+ {"pluginVmPageLabel", IDS_SETTINGS_PLUGIN_VM_PAGE_LABEL},
+ {"pluginVmPrinterAccess", IDS_SETTINGS_PLUGIN_VM_PRINTER_ACCESS},
+ };
+ AddLocalizedStringsBulk(html_source, kLocalizedStrings,
+ base::size(kLocalizedStrings));
+ html_source->AddString(
+ "pluginVmPageSubtext",
+ l10n_util::GetStringFUTF16(IDS_SETTINGS_PLUGIN_VM_PAGE_SUBTEXT,
+ ui::GetChromeOSDeviceName()));
+}
+
void AddKioskNextShellStrings(content::WebUIDataSource* html_source) {
static constexpr LocalizedString kLocalizedStrings[] = {
{"kioskNextShellPageTitle", IDS_SETTINGS_KIOSK_NEXT_SHELL_TITLE},
@@ -1252,6 +1268,8 @@ void AddInternetStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_SETTINGS_NETWORK_ALLOW_DATA_ROAMING},
{"networkAlwaysOnVpn", IDS_SETTINGS_INTERNET_NETWORK_ALWAYS_ON_VPN},
{"networkAutoConnect", IDS_SETTINGS_INTERNET_NETWORK_AUTO_CONNECT},
+ {"networkAutoConnectCellular",
+ IDS_SETTINGS_INTERNET_NETWORK_AUTO_CONNECT_CELLULAR},
{"networkButtonActivate", IDS_SETTINGS_INTERNET_BUTTON_ACTIVATE},
{"networkButtonConfigure", IDS_SETTINGS_INTERNET_BUTTON_CONFIGURE},
{"networkButtonConnect", IDS_SETTINGS_INTERNET_BUTTON_CONNECT},
@@ -1370,18 +1388,15 @@ void AddLanguagesStrings(content::WebUIDataSource* html_source) {
{"offerToEnableTranslate",
IDS_SETTINGS_LANGUAGES_OFFER_TO_ENABLE_TRANSLATE},
{"translateTargetLabel", IDS_SETTINGS_LANGUAGES_TRANSLATE_TARGET},
+ {"spellCheckTitle", IDS_SETTINGS_LANGUAGES_SPELL_CHECK_TITLE},
+ {"spellCheckBasicLabel", IDS_SETTINGS_LANGUAGES_SPELL_CHECK_BASIC_LABEL},
+ {"spellCheckEnhancedLabel",
+ IDS_SETTINGS_LANGUAGES_SPELL_CHECK_ENHANCED_LABEL},
+ {"spellCheckEnhancedDescription",
+ IDS_SETTINGS_LANGUAGES_SPELL_CHECK_ENHANCED_DESCRIPTION},
#if !defined(OS_MACOSX)
- {"spellCheckListTitle", IDS_SETTINGS_LANGUAGES_SPELL_CHECK_LIST_TITLE},
- {"spellCheckExpandA11yLabel",
- IDS_SETTINGS_LANGUAGES_SPELL_CHECK_EXPAND_ACCESSIBILITY_LABEL},
- {"spellCheckSummaryTwoLanguages",
- IDS_SETTINGS_LANGUAGES_SPELL_CHECK_SUMMARY_TWO_LANGUAGES},
- // TODO(michaelpg): Use ICU plural format when available to properly
- // translate "and [n] other(s)".
- {"spellCheckSummaryThreeLanguages",
- IDS_SETTINGS_LANGUAGES_SPELL_CHECK_SUMMARY_THREE_LANGUAGES},
- {"spellCheckSummaryMultipleLanguages",
- IDS_SETTINGS_LANGUAGES_SPELL_CHECK_SUMMARY_MULTIPLE_LANGUAGES},
+ {"spellCheckLanguagesListTitle",
+ IDS_SETTINGS_LANGUAGES_SPELL_CHECK_LANGUAGES_LIST_TITLE},
{"manageSpellCheck", IDS_SETTINGS_LANGUAGES_SPELL_CHECK_MANAGE},
{"editDictionaryPageTitle", IDS_SETTINGS_LANGUAGES_EDIT_DICTIONARY_TITLE},
{"addDictionaryWordLabel", IDS_SETTINGS_LANGUAGES_ADD_DICTIONARY_WORD},
@@ -1394,7 +1409,6 @@ void AddLanguagesStrings(content::WebUIDataSource* html_source) {
{"customDictionaryWords", IDS_SETTINGS_LANGUAGES_DICTIONARY_WORDS},
{"noCustomDictionaryWordsFound",
IDS_SETTINGS_LANGUAGES_DICTIONARY_WORDS_NONE},
- {"spellCheckDisabled", IDS_SETTINGS_LANGUAGES_SPELL_CHECK_DISABLED},
{"languagesDictionaryDownloadError",
IDS_SETTINGS_LANGUAGES_DICTIONARY_DOWNLOAD_FAILED},
{"languagesDictionaryDownloadErrorHelp",
@@ -1557,47 +1571,15 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
html_source->AddString("passwordManagerLearnMoreURL",
chrome::kPasswordManagerLearnMoreURL);
html_source->AddString("manageAddressesUrl",
- autofill::payments::GetManageAddressesUrl(0).spec());
+ autofill::payments::GetManageAddressesUrl().spec());
html_source->AddString("manageCreditCardsLabel",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_PAYMENTS_MANAGE_CREDIT_CARDS,
base::UTF8ToUTF16(chrome::kPaymentMethodsURL)));
html_source->AddString("manageCreditCardsUrl",
- autofill::payments::GetManageInstrumentsUrl(0).spec());
+ autofill::payments::GetManageInstrumentsUrl().spec());
html_source->AddString("paymentMethodsLearnMoreURL",
chrome::kPaymentMethodsLearnMoreURL);
- html_source->AddBoolean(
- "migrationEnabled",
- autofill::features::GetLocalCardMigrationExperimentalFlag() ==
- autofill::features::LocalCardMigrationExperimentalFlag::
- kMigrationIncludeSettingsPage);
- html_source->AddBoolean(
- "upstreamEnabled",
- base::FeatureList::IsEnabled(autofill::features::kAutofillUpstream));
-
- autofill::PersonalDataManager* personal_data_manager_ =
- autofill::PersonalDataManagerFactory::GetForProfile(profile);
- html_source->AddBoolean(
- "hasGooglePaymentsAccount",
- autofill::payments::GetBillingCustomerId(personal_data_manager_,
- profile->GetPrefs()) != 0);
-
- syncer::SyncService* sync_service =
- ProfileSyncServiceFactory::GetForProfile(profile);
- if (sync_service && sync_service->CanSyncFeatureStart() &&
- sync_service->GetPreferredDataTypes().Has(syncer::AUTOFILL_PROFILE)) {
- html_source->AddBoolean(
- "isUsingSecondaryPassphrase",
- sync_service->GetUserSettings()->IsUsingSecondaryPassphrase());
- html_source->AddBoolean(
- "uploadToGoogleActive",
- syncer::GetUploadToGoogleState(
- sync_service, syncer::ModelType::AUTOFILL_WALLET_DATA) ==
- syncer::UploadState::ACTIVE);
- } else {
- html_source->AddBoolean("isUsingSecondaryPassphrase", false);
- html_source->AddBoolean("uploadToGoogleActive", false);
- }
bool is_guest_mode = false;
#if defined(OS_CHROMEOS)
@@ -1606,24 +1588,14 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
#else // !defined(OS_CHROMEOS)
is_guest_mode = profile->IsOffTheRecord();
#endif // defined(OS_CHROMEOS)
-
- if (is_guest_mode) {
- html_source->AddBoolean("userEmailDomainAllowed", false);
- } else {
- const std::string& user_email =
- personal_data_manager_->GetAccountInfoForPaymentsServer().email;
- if (user_email.empty()) {
- html_source->AddBoolean("userEmailDomainAllowed", false);
- } else {
- std::string domain = gaia::ExtractDomainName(user_email);
- html_source->AddBoolean(
- "userEmailDomainAllowed",
- base::FeatureList::IsEnabled(
- autofill::features::kAutofillUpstreamAllowAllEmailDomains) ||
- (domain == "googlemail.com" || domain == "gmail.com" ||
- domain == "google.com" || domain == "chromium.org"));
- }
- }
+ html_source->AddBoolean(
+ "migrationEnabled",
+ !is_guest_mode &&
+ autofill::IsCreditCardMigrationEnabled(
+ autofill::PersonalDataManagerFactory::GetForProfile(profile),
+ profile->GetPrefs(),
+ ProfileSyncServiceFactory::GetForProfile(profile),
+ /*is_test_mode=*/false));
AddLocalizedStringsBulk(html_source, kLocalizedStrings,
base::size(kLocalizedStrings));
@@ -1646,6 +1618,10 @@ void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) {
IDS_SETTINGS_ACCOUNT_MANAGER_SIGNED_OUT_ACCOUNT_PLACEHOLDER},
{"accountManagerReauthenticationLabel",
IDS_SETTINGS_ACCOUNT_MANAGER_REAUTHENTICATION_LABEL},
+ {"accountManagerManagedLabel",
+ IDS_SETTINGS_ACCOUNT_MANAGER_MANAGEMENT_STATUS_MANAGED_ACCOUNT},
+ {"accountManagerUnmanagedLabel",
+ IDS_SETTINGS_ACCOUNT_MANAGER_MANAGEMENT_STATUS_UNMANAGED_ACCOUNT},
{"configureFingerprintTitle", IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_TITLE},
{"configureFingerprintInstructionLocateScannerStep",
IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER},
@@ -1843,6 +1819,8 @@ void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) {
};
AddLocalizedStringsBulk(html_source, localized_strings,
base::size(localized_strings));
+ html_source->AddString("managementPage",
+ ManagementUI::GetManagementPageSubtitle(profile));
// Format numbers to be used on the pin keyboard.
for (int j = 0; j <= 9; j++) {
@@ -2011,6 +1989,8 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_PRINTING_CUPS_PRINTER_INVALID_DRIVER},
{"printerAddedSuccessfulMessage",
IDS_SETTINGS_PRINTING_CUPS_PRINTER_ADDED_PRINTER_DONE_MESSAGE},
+ {"printerEditedSuccessfulMessage",
+ IDS_SETTINGS_PRINTING_CUPS_PRINTER_EDITED_PRINTER_DONE_MESSAGE},
{"noPrinterNearbyMessage",
IDS_SETTINGS_PRINTING_CUPS_PRINTER_NO_PRINTER_NEARBY},
{"searchingNearbyPrinters",
@@ -2253,7 +2233,8 @@ void AddSearchEnginesStrings(content::WebUIDataSource* html_source) {
}
#if defined(OS_CHROMEOS)
-void AddGoogleAssistantStrings(content::WebUIDataSource* html_source) {
+void AddGoogleAssistantStrings(content::WebUIDataSource* html_source,
+ Profile* profile) {
static constexpr LocalizedString kLocalizedStrings[] = {
{"googleAssistantPageTitle", IDS_SETTINGS_GOOGLE_ASSISTANT},
{"googleAssistantEnableContext",
@@ -2311,6 +2292,7 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
#if defined(OS_CHROMEOS)
{"androidSmsNote", IDS_SETTINGS_ANDROID_SMS_NOTE},
#endif
+ {"appCacheOrigin", IDS_SETTINGS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL},
{"cookieAppCache", IDS_SETTINGS_COOKIES_APPLICATION_CACHE},
{"cookieCacheStorage", IDS_SETTINGS_COOKIES_CACHE_STORAGE},
{"cookieChannelId", IDS_SETTINGS_COOKIES_CHANNEL_ID},
@@ -2335,7 +2317,6 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
{"channelIdExpires", IDS_SETTINGS_COOKIES_CHANNEL_ID_EXPIRES_LABEL},
{"cookieAccessibleToScript",
IDS_SETTINGS_COOKIES_COOKIE_ACCESSIBLE_TO_SCRIPT_LABEL},
- {"cookieLastAccessed", IDS_SETTINGS_COOKIES_LAST_ACCESSED_LABEL},
{"cookieContent", IDS_SETTINGS_COOKIES_COOKIE_CONTENT_LABEL},
{"cookieCreated", IDS_SETTINGS_COOKIES_COOKIE_CREATED_LABEL},
{"cookieDomain", IDS_SETTINGS_COOKIES_COOKIE_DOMAIN_LABEL},
@@ -2361,6 +2342,7 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
{"mediaLicenseSize", IDS_SETTINGS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL},
{"mediaLicenseLastModified",
IDS_SETTINGS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL},
+ {"noSerialPortsFound", IDS_SETTINGS_NO_SERIAL_PORTS_FOUND},
{"noUsbDevicesFound", IDS_SETTINGS_NO_USB_DEVICES_FOUND},
{"serviceWorkerOrigin", IDS_SETTINGS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL},
{"serviceWorkerSize",
@@ -2415,10 +2397,12 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
{"siteSettingsSoundAllowRecommended",
IDS_SETTINGS_SITE_SETTINGS_SOUND_ALLOW_RECOMMENDED},
{"siteSettingsSoundBlock", IDS_SETTINGS_SITE_SETTINGS_SOUND_BLOCK},
- {"siteSettingsSensors", IDS_SETTINGS_SITE_SETTINGS_SENSORS},
- {"siteSettingsSensorsAllow", IDS_SETTINGS_SITE_SETTINGS_SENSORS_ALLOW},
- {"siteSettingsSensorsBlock", IDS_SETTINGS_SITE_SETTINGS_SENSORS_BLOCK},
{"siteSettingsFlash", IDS_SETTINGS_SITE_SETTINGS_FLASH},
+ {"siteSettingsFlashAskFirst", IDS_SETTINGS_SITE_SETTINGS_ASK_FIRST},
+ {"siteSettingsFlashAskFirstRecommended",
+ IDS_SETTINGS_SITE_SETTINGS_ASK_FIRST_RECOMMENDED},
+ {"siteSettingsFlashPermissionsEphemeral",
+ IDS_SETTINGS_SITE_SETTINGS_FLASH_PERMISSIONS_ARE_EPHEMERAL},
{"siteSettingsPdfDocuments", IDS_SETTINGS_SITE_SETTINGS_PDF_DOCUMENTS},
{"siteSettingsPdfDownloadPdfs",
IDS_SETTINGS_SITE_SETTINGS_PDF_DOWNLOAD_PDFS},
@@ -2443,6 +2427,12 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_SITE_SETTINGS_MIDI_DEVICES_ASK_RECOMMENDED},
{"siteSettingsMidiDevicesBlock",
IDS_SETTINGS_SITE_SETTINGS_MIDI_DEVICES_BLOCK},
+ {"siteSettingsSerialPorts", IDS_SETTINGS_SITE_SETTINGS_SERIAL_PORTS},
+ {"siteSettingsSerialPortsAsk", IDS_SETTINGS_SITE_SETTINGS_SERIAL_PORTS_ASK},
+ {"siteSettingsSerialPortsAskRecommended",
+ IDS_SETTINGS_SITE_SETTINGS_SERIAL_PORTS_ASK_RECOMMENDED},
+ {"siteSettingsSerialPortsBlock",
+ IDS_SETTINGS_SITE_SETTINGS_SERIAL_PORTS_BLOCK},
{"siteSettingsUsbDevices", IDS_SETTINGS_SITE_SETTINGS_USB_DEVICES},
{"siteSettingsUsbDevicesAsk", IDS_SETTINGS_SITE_SETTINGS_USB_DEVICES_ASK},
{"siteSettingsUsbDevicesAskRecommended",
@@ -2622,6 +2612,24 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
AddLocalizedStringsBulk(html_source, kLocalizedStrings,
base::size(kLocalizedStrings));
+ // These ones cannot be constexpr because we need to check base::FeatureList.
+ static LocalizedString kSensorsLocalizedStrings[] = {
+ {"siteSettingsSensors",
+ base::FeatureList::IsEnabled(features::kGenericSensorExtraClasses)
+ ? IDS_SETTINGS_SITE_SETTINGS_SENSORS
+ : IDS_SETTINGS_SITE_SETTINGS_MOTION_SENSORS},
+ {"siteSettingsSensorsAllow",
+ base::FeatureList::IsEnabled(features::kGenericSensorExtraClasses)
+ ? IDS_SETTINGS_SITE_SETTINGS_SENSORS_ALLOW
+ : IDS_SETTINGS_SITE_SETTINGS_MOTION_SENSORS_ALLOW},
+ {"siteSettingsSensorsBlock",
+ base::FeatureList::IsEnabled(features::kGenericSensorExtraClasses)
+ ? IDS_SETTINGS_SITE_SETTINGS_SENSORS_BLOCK
+ : IDS_SETTINGS_SITE_SETTINGS_MOTION_SENSORS_BLOCK},
+ };
+ AddLocalizedStringsBulk(html_source, kSensorsLocalizedStrings,
+ base::size(kSensorsLocalizedStrings));
+
html_source->AddBoolean("enableSiteSettings", base::FeatureList::IsEnabled(
features::kSiteSettings));
html_source->AddBoolean(
@@ -2638,40 +2646,17 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
base::FeatureList::IsEnabled(media::kAutoplayWhitelistSettings));
html_source->AddBoolean(
- "enableClipboardContentSetting",
- base::FeatureList::IsEnabled(features::kClipboardContentSetting));
-
- html_source->AddBoolean(
"enableSensorsContentSetting",
- base::FeatureList::IsEnabled(features::kGenericSensorExtraClasses));
+ base::FeatureList::IsEnabled(features::kSensorContentSetting));
html_source->AddBoolean(
"enablePaymentHandlerContentSetting",
base::FeatureList::IsEnabled(features::kServiceWorkerPaymentApps));
- if (PluginUtils::ShouldPreferHtmlOverPlugins(
- HostContentSettingsMapFactory::GetForProfile(profile))) {
- static constexpr LocalizedString kFlashStrings[] = {
- {"siteSettingsFlashAskFirst", IDS_SETTINGS_SITE_SETTINGS_ASK_FIRST},
- {"siteSettingsFlashAskFirstRecommended",
- IDS_SETTINGS_SITE_SETTINGS_ASK_FIRST_RECOMMENDED},
- {"siteSettingsFlashPermissionsEphemeral",
- IDS_SETTINGS_SITE_SETTINGS_FLASH_PERMISSIONS_ARE_EPHEMERAL},
- };
- AddLocalizedStringsBulk(html_source, kFlashStrings,
- base::size(kFlashStrings));
- } else {
- static constexpr LocalizedString kFlashStrings[] = {
- {"siteSettingsFlashAskFirst",
- IDS_SETTINGS_SITE_SETTINGS_FLASH_DETECT_IMPORTANT},
- {"siteSettingsFlashAskFirstRecommended",
- IDS_SETTINGS_SITE_SETTINGS_FLASH_DETECT_IMPORTANT_RECOMMENDED},
- {"siteSettingsFlashPermissionsEphemeral",
- IDS_SETTINGS_SITE_SETTINGS_FLASH_PERMISSIONS_ARE_EPHEMERAL},
- };
- AddLocalizedStringsBulk(html_source, kFlashStrings,
- base::size(kFlashStrings));
- }
+ base::CommandLine& cmd = *base::CommandLine::ForCurrentProcess();
+ html_source->AddBoolean(
+ "enableExperimentalWebPlatformFeatures",
+ cmd.HasSwitch(::switches::kEnableExperimentalWebPlatformFeatures));
}
#if defined(OS_CHROMEOS)
@@ -2683,6 +2668,7 @@ void AddUsersStrings(content::WebUIDataSource* html_source) {
{"showOnSigninLabel", IDS_SETTINGS_USERS_SHOW_ON_SIGNIN_LABEL},
{"restrictSigninLabel", IDS_SETTINGS_USERS_RESTRICT_SIGNIN_LABEL},
{"deviceOwnerLabel", IDS_SETTINGS_USERS_DEVICE_OWNER_LABEL},
+ {"removeUserTooltip", IDS_SETTINGS_USERS_REMOVE_USER_TOOLTIP},
{"addUsers", IDS_SETTINGS_USERS_ADD_USERS},
{"addUsersEmail", IDS_SETTINGS_USERS_ADD_USERS_EMAIL},
};
@@ -2814,6 +2800,62 @@ void AddExtensionsStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_EXTENSIONS_CHECKBOX_LABEL);
}
+void AddSecurityKeysStrings(content::WebUIDataSource* html_source) {
+ static constexpr LocalizedString kSecurityKeysStrings[] = {
+ {"securityKeysConfirmPIN", IDS_SETTINGS_SECURITY_KEYS_CONFIRM_PIN},
+ {"securityKeysCurrentPIN", IDS_SETTINGS_SECURITY_KEYS_CURRENT_PIN},
+ {"securityKeysCurrentPINIntro",
+ IDS_SETTINGS_SECURITY_KEYS_CURRENT_PIN_INTRO},
+ {"securityKeysDesc", IDS_SETTINGS_SECURITY_KEYS_DESC},
+ {"securityKeysNewPIN", IDS_SETTINGS_SECURITY_KEYS_NEW_PIN},
+ {"securityKeysNoPIN", IDS_SETTINGS_SECURITY_KEYS_NO_PIN},
+ {"securityKeysNoReset", IDS_SETTINGS_SECURITY_KEYS_NO_RESET},
+ {"securityKeysPIN", IDS_SETTINGS_SECURITY_KEYS_PIN},
+ {"securityKeysPINError", IDS_SETTINGS_SECURITY_KEYS_PIN_ERROR},
+ {"securityKeysPINHardLock", IDS_SETTINGS_SECURITY_KEYS_PIN_HARD_LOCK},
+ {"securityKeysPINIncorrect", IDS_SETTINGS_SECURITY_KEYS_PIN_INCORRECT},
+ {"securityKeysPINIncorrectRetriesSin",
+ IDS_SETTINGS_SECURITY_KEYS_PIN_INCORRECT_RETRIES_SIN},
+ {"securityKeysPINIncorrectRetriesPl",
+ IDS_SETTINGS_SECURITY_KEYS_PIN_INCORRECT_RETRIES_PL},
+ {"securityKeysPINSoftLock", IDS_SETTINGS_SECURITY_KEYS_PIN_SOFT_LOCK},
+ {"securityKeysPINSuccess", IDS_SETTINGS_SECURITY_KEYS_PIN_SUCCESS},
+ {"securityKeysPINTouch", IDS_SETTINGS_SECURITY_KEYS_PIN_TOUCH},
+ {"securityKeysReset", IDS_SETTINGS_SECURITY_KEYS_RESET},
+ {"securityKeysResetConfirmTitle",
+ IDS_SETTINGS_SECURITY_KEYS_RESET_CONFIRM_TITLE},
+ {"securityKeysResetDesc", IDS_SETTINGS_SECURITY_KEYS_RESET_DESC},
+ {"securityKeysResetError", IDS_SETTINGS_SECURITY_KEYS_RESET_ERROR},
+ {"securityKeysResetNotAllowed",
+ IDS_SETTINGS_SECURITY_KEYS_RESET_NOTALLOWED},
+ {"securityKeysResetStep1", IDS_SETTINGS_SECURITY_KEYS_RESET_STEP1},
+ {"securityKeysResetStep2", IDS_SETTINGS_SECURITY_KEYS_RESET_STEP2},
+ {"securityKeysResetSuccess", IDS_SETTINGS_SECURITY_KEYS_RESET_SUCCESS},
+ {"securityKeysResetTitle", IDS_SETTINGS_SECURITY_KEYS_RESET_TITLE},
+ {"securityKeysSetPIN", IDS_SETTINGS_SECURITY_KEYS_SET_PIN},
+ {"securityKeysSetPINChangeTitle",
+ IDS_SETTINGS_SECURITY_KEYS_SET_PIN_CHANGE_TITLE},
+ {"securityKeysSetPINConfirm", IDS_SETTINGS_SECURITY_KEYS_SET_PIN_CONFIRM},
+ {"securityKeysSetPINCreateTitle",
+ IDS_SETTINGS_SECURITY_KEYS_SET_PIN_CREATE_TITLE},
+ {"securityKeysSetPINDesc", IDS_SETTINGS_SECURITY_KEYS_SET_PIN_DESC},
+ {"securityKeysSetPINInitialTitle",
+ IDS_SETTINGS_SECURITY_KEYS_SET_PIN_INITIAL_TITLE},
+ {"securityKeysTitle", IDS_SETTINGS_SECURITY_KEYS_TITLE},
+ };
+ AddLocalizedStringsBulk(html_source, kSecurityKeysStrings,
+ base::size(kSecurityKeysStrings));
+
+ html_source->AddBoolean(
+ "enableSecurityKeysSubpage",
+ base::FeatureList::IsEnabled(device::kWebAuthPINSupport)
+#if defined(OS_WIN)
+ && (!base::FeatureList::IsEnabled(device::kWebAuthUseNativeWinApi) ||
+ !device::WinWebAuthnApi::GetDefault()->IsAvailable())
+#endif
+ );
+}
+
} // namespace
void AddLocalizedStrings(content::WebUIDataSource* html_source,
@@ -2840,7 +2882,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
AddResetStrings(html_source);
AddSearchEnginesStrings(html_source);
#if defined(OS_CHROMEOS)
- AddGoogleAssistantStrings(html_source);
+ AddGoogleAssistantStrings(html_source, profile);
#endif
AddSearchInSettingsStrings(html_source);
AddSearchStrings(html_source, profile);
@@ -2849,6 +2891,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
#if defined(OS_CHROMEOS)
AddCrostiniStrings(html_source, profile);
+ AddPluginVmStrings(html_source, profile);
AddKioskNextShellStrings(html_source);
AddAndroidAppStrings(html_source);
AddBluetoothStrings(html_source);
@@ -2878,6 +2921,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
chromeos::network_element::AddErrorLocalizedStrings(html_source);
#endif
policy_indicator::AddLocalizedStrings(html_source);
+ AddSecurityKeysStrings(html_source);
html_source->SetJsonPath(kLocalizedStringsFile);
}
diff --git a/chromium/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.h b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h
index cfa37864dc0..1642eb7503a 100644
--- a/chromium/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.h
+++ b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_LOCALIZED_STRINGS_PROVIDER_H_
-#define CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_LOCALIZED_STRINGS_PROVIDER_H_
+#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_LOCALIZED_STRINGS_PROVIDER_H_
+#define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_LOCALIZED_STRINGS_PROVIDER_H_
class Profile;
@@ -21,4 +21,4 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
} // namespace settings
-#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_LOCALIZED_STRINGS_PROVIDER_H_
+#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_LOCALIZED_STRINGS_PROVIDER_H_
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
new file mode 100644
index 00000000000..834603aa371
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
@@ -0,0 +1,251 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <utility>
+
+#include "base/callback.h"
+#include "base/optional.h"
+#include "base/values.h"
+#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_security_key_handler.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/web_ui.h"
+#include "content/public/common/service_manager_connection.h"
+#include "device/fido/pin.h"
+#include "device/fido/reset_request_handler.h"
+#include "device/fido/set_pin_request_handler.h"
+
+using content::BrowserThread;
+
+namespace {
+
+constexpr char kStartSetPIN[] = "securityKeyStartSetPIN";
+constexpr char kSetPIN[] = "securityKeySetPIN";
+constexpr char kClose[] = "securityKeyClose";
+constexpr char kReset[] = "securityKeyReset";
+constexpr char kCompleteReset[] = "securityKeyCompleteReset";
+
+base::flat_set<device::FidoTransportProtocol> supported_transports() {
+ // If we ever support BLE devices then additional thought will be required
+ // in the UI; therefore don't enable them here. NFC is not supported on
+ // desktop thus only USB devices remain to be enabled.
+ return {device::FidoTransportProtocol::kUsbHumanInterfaceDevice};
+}
+
+} // namespace
+
+namespace settings {
+
+SecurityKeysHandler::SecurityKeysHandler()
+ : state_(State::kNone),
+ weak_factory_(new base::WeakPtrFactory<SecurityKeysHandler>(this)) {}
+
+SecurityKeysHandler::~SecurityKeysHandler() = default;
+
+void SecurityKeysHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ kStartSetPIN, base::BindRepeating(&SecurityKeysHandler::HandleStartSetPIN,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ kSetPIN, base::BindRepeating(&SecurityKeysHandler::HandleSetPIN,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ kClose, base::BindRepeating(&SecurityKeysHandler::HandleClose,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ kReset, base::BindRepeating(&SecurityKeysHandler::HandleReset,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ kCompleteReset,
+ base::BindRepeating(&SecurityKeysHandler::HandleCompleteReset,
+ base::Unretained(this)));
+}
+
+void SecurityKeysHandler::OnJavascriptAllowed() {}
+void SecurityKeysHandler::OnJavascriptDisallowed() {
+ // If Javascript is disallowed, |Close| will invalidate all current WeakPtrs
+ // and thus drop all pending callbacks. This means that
+ // |IsJavascriptAllowed| doesn't need to be tested before each callback
+ // because, if the callback into this object happened, then Javascript is
+ // allowed.
+ Close();
+}
+
+void SecurityKeysHandler::Close() {
+ // Invalidate all existing WeakPtrs so that no stale callbacks occur.
+ weak_factory_ =
+ std::make_unique<base::WeakPtrFactory<SecurityKeysHandler>>(this);
+ state_ = State::kNone;
+ set_pin_.reset();
+ reset_.reset();
+ callback_id_.clear();
+}
+
+void SecurityKeysHandler::HandleStartSetPIN(const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(State::kNone, state_);
+ DCHECK_EQ(1u, args->GetSize());
+
+ AllowJavascript();
+ DCHECK(callback_id_.empty());
+ callback_id_ = args->GetList()[0].GetString();
+ state_ = State::kStartSetPIN;
+ set_pin_ = std::make_unique<device::SetPINRequestHandler>(
+ content::ServiceManagerConnection::GetForProcess()->GetConnector(),
+ supported_transports(),
+ base::BindOnce(&SecurityKeysHandler::OnGatherPIN,
+ weak_factory_->GetWeakPtr()),
+ base::BindRepeating(&SecurityKeysHandler::OnSetPINComplete,
+ weak_factory_->GetWeakPtr()));
+}
+
+void SecurityKeysHandler::OnGatherPIN(base::Optional<int64_t> num_retries) {
+ DCHECK_EQ(State::kStartSetPIN, state_);
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ base::Value::ListStorage list;
+ list.emplace_back(0 /* process not complete */);
+ if (num_retries) {
+ state_ = State::kGatherChangePIN;
+ list.emplace_back(static_cast<int>(*num_retries));
+ } else {
+ state_ = State::kGatherNewPIN;
+ list.emplace_back(base::Value::Type::NONE);
+ }
+
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::Value(std::move(list)));
+}
+
+void SecurityKeysHandler::OnSetPINComplete(
+ device::CtapDeviceResponseCode code) {
+ DCHECK(state_ == State::kStartSetPIN || state_ == State::kSettingPIN);
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ if (code == device::CtapDeviceResponseCode::kCtap2ErrPinInvalid) {
+ // In the event that the old PIN was incorrect, the UI may prompt again.
+ state_ = State::kGatherChangePIN;
+ } else {
+ state_ = State::kNone;
+ set_pin_.reset();
+ }
+
+ base::Value::ListStorage list;
+ list.emplace_back(1 /* process complete */);
+ list.emplace_back(static_cast<int>(code));
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::Value(std::move(list)));
+}
+
+void SecurityKeysHandler::HandleSetPIN(const base::ListValue* args) {
+ DCHECK(state_ == State::kGatherNewPIN || state_ == State::kGatherChangePIN);
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(3u, args->GetSize());
+
+ DCHECK(callback_id_.empty());
+ callback_id_ = args->GetList()[0].GetString();
+ const std::string old_pin = args->GetList()[1].GetString();
+ const std::string new_pin = args->GetList()[2].GetString();
+
+ DCHECK((state_ == State::kGatherNewPIN) == old_pin.empty());
+
+ CHECK(device::pin::IsValid(new_pin));
+ state_ = State::kSettingPIN;
+ set_pin_->ProvidePIN(old_pin, new_pin);
+}
+
+void SecurityKeysHandler::HandleReset(const base::ListValue* args) {
+ DCHECK_EQ(State::kNone, state_);
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(1u, args->GetSize());
+
+ AllowJavascript();
+ DCHECK(callback_id_.empty());
+ callback_id_ = args->GetList()[0].GetString();
+
+ state_ = State::kStartReset;
+ reset_ = std::make_unique<device::ResetRequestHandler>(
+ content::ServiceManagerConnection::GetForProcess()->GetConnector(),
+ supported_transports(),
+ base::BindOnce(&SecurityKeysHandler::OnResetSent,
+ weak_factory_->GetWeakPtr()),
+ base::BindOnce(&SecurityKeysHandler::OnResetFinished,
+ weak_factory_->GetWeakPtr()));
+}
+
+void SecurityKeysHandler::OnResetSent() {
+ DCHECK_EQ(State::kStartReset, state_);
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ // A reset message has been sent to a security key and it may complete
+ // before Javascript asks for the result. Therefore |HandleCompleteReset|
+ // and |OnResetFinished| may be called in either order.
+ state_ = State::kWaitingForResetNoCallbackYet;
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::Value(0 /* success */));
+}
+
+void SecurityKeysHandler::HandleCompleteReset(const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(1u, args->GetSize());
+
+ DCHECK(callback_id_.empty());
+ callback_id_ = args->GetList()[0].GetString();
+
+ switch (state_) {
+ case State::kWaitingForResetNoCallbackYet:
+ // The reset operation hasn't completed. |callback_id_| will be used in
+ // |OnResetFinished| when it does.
+ state_ = State::kWaitingForResetHaveCallback;
+ break;
+
+ case State::kWaitingForCompleteReset:
+ // The reset operation has completed and we were waiting for this
+ // call from Javascript in order to provide the result.
+ state_ = State::kNone;
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::Value(static_cast<int>(*reset_result_)));
+ reset_.reset();
+ break;
+
+ default:
+ NOTREACHED();
+ }
+}
+
+void SecurityKeysHandler::OnResetFinished(
+ device::CtapDeviceResponseCode result) {
+ switch (state_) {
+ case State::kWaitingForResetNoCallbackYet:
+ // The reset operation has completed, but Javascript hasn't called
+ // |CompleteReset| so we cannot make the callback yet.
+ state_ = State::kWaitingForCompleteReset;
+ reset_result_ = result;
+ break;
+
+ case State::kStartReset:
+ // The reset operation failed immediately, probably because the user
+ // selected a U2F device. |callback_id_| has been set by |Reset|.
+ [[fallthrough]];
+
+ case State::kWaitingForResetHaveCallback:
+ // The |CompleteReset| call has already provided |callback_id_| so the
+ // reset can be completed immediately.
+ state_ = State::kNone;
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ base::Value(static_cast<int>(result)));
+ reset_.reset();
+ break;
+
+ default:
+ NOTREACHED();
+ }
+}
+
+void SecurityKeysHandler::HandleClose(const base::ListValue* args) {
+ DCHECK_EQ(0u, args->GetSize());
+ Close();
+}
+
+} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h
new file mode 100644
index 00000000000..353d85c6002
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h
@@ -0,0 +1,78 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_SECURITY_KEY_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_SECURITY_KEY_HANDLER_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/optional.h"
+#include "device/fido/fido_constants.h"
+
+namespace base {
+class ListValue;
+}
+
+namespace device {
+class SetPINRequestHandler;
+class ResetRequestHandler;
+} // namespace device
+
+namespace settings {
+
+// SecurityKeysHandler processes messages from the "Security Keys" section of a
+// settings page. An instance of this class is created for each settings tab and
+// is destroyed when the tab is closed. See the comments in
+// security_keys_browser_proxy.js about the interface.
+class SecurityKeysHandler : public SettingsPageUIHandler {
+ public:
+ SecurityKeysHandler();
+ ~SecurityKeysHandler() override;
+
+ void RegisterMessages() override;
+ void OnJavascriptAllowed() override;
+ void OnJavascriptDisallowed() override;
+
+ private:
+ enum class State {
+ kNone,
+
+ kStartSetPIN,
+ kGatherNewPIN,
+ kGatherChangePIN,
+ kSettingPIN,
+
+ kStartReset,
+ kWaitingForResetNoCallbackYet,
+ kWaitingForResetHaveCallback,
+ kWaitingForCompleteReset,
+ };
+
+ void Close();
+ void HandleStartSetPIN(const base::ListValue* args);
+ void OnGatherPIN(base::Optional<int64_t> num_retries);
+ void OnSetPINComplete(device::CtapDeviceResponseCode code);
+ void HandleSetPIN(const base::ListValue* args);
+ void HandleReset(const base::ListValue* args);
+ void OnResetSent();
+ void HandleCompleteReset(const base::ListValue* args);
+ void OnResetFinished(device::CtapDeviceResponseCode result);
+ void HandleClose(const base::ListValue* args);
+
+ State state_;
+ std::unique_ptr<device::SetPINRequestHandler> set_pin_;
+ std::unique_ptr<device::ResetRequestHandler> reset_;
+ base::Optional<device::CtapDeviceResponseCode> reset_result_;
+ std::string callback_id_;
+ std::unique_ptr<base::WeakPtrFactory<SecurityKeysHandler>> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(SecurityKeysHandler);
+};
+
+} // namespace settings
+
+#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_SECURITY_KEY_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/settings/md_settings_ui.cc b/chromium/chrome/browser/ui/webui/settings/settings_ui.cc
index 291fbdf27b6..3d8d9047c13 100644
--- a/chromium/chrome/browser/ui/webui/settings/md_settings_ui.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_ui.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/settings/md_settings_ui.h"
+#include "chrome/browser/ui/webui/settings/settings_ui.h"
#include <stddef.h>
@@ -13,6 +13,7 @@
#include "ash/public/cpp/ash_features.h"
#include "base/bind.h"
+#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
@@ -30,7 +31,6 @@
#include "chrome/browser/ui/webui/settings/downloads_handler.h"
#include "chrome/browser/ui/webui/settings/extension_control_handler.h"
#include "chrome/browser/ui/webui/settings/font_handler.h"
-#include "chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.h"
#include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h"
#include "chrome/browser/ui/webui/settings/on_startup_handler.h"
#include "chrome/browser/ui/webui/settings/people_handler.h"
@@ -41,8 +41,10 @@
#include "chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h"
#include "chrome/browser/ui/webui/settings/settings_cookies_view_handler.h"
#include "chrome/browser/ui/webui/settings/settings_import_data_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_localized_strings_provider.h"
#include "chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
+#include "chrome/browser/ui/webui/settings/settings_security_key_handler.h"
#include "chrome/browser/ui/webui/settings/settings_startup_pages_handler.h"
#include "chrome/browser/ui/webui/settings/site_settings_handler.h"
#include "chrome/common/pref_names.h"
@@ -79,6 +81,7 @@
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
#include "ash/public/cpp/stylus_utils.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/account_manager/account_manager_util.h"
#include "chrome/browser/chromeos/android_sms/android_sms_app_manager.h"
#include "chrome/browser/chromeos/android_sms/android_sms_service_factory.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
@@ -86,6 +89,7 @@
#include "chrome/browser/chromeos/login/demo_mode/demo_session.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h"
#include "chrome/browser/chromeos/multidevice_setup/multidevice_setup_client_factory.h"
+#include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h"
#include "chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h"
@@ -106,12 +110,14 @@
#include "chrome/browser/web_applications/system_web_app_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/browser_resources.h"
-#include "chromeos/account_manager/account_manager.h"
-#include "chromeos/account_manager/account_manager_factory.h"
+#include "chromeos/components/account_manager/account_manager.h"
+#include "chromeos/components/account_manager/account_manager_factory.h"
#include "chromeos/constants/chromeos_features.h"
+#include "chromeos/constants/chromeos_pref_names.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
#include "components/arc/arc_util.h"
+#include "components/prefs/pref_service.h"
#include "ui/base/ui_base_features.h"
#include "ui/chromeos/resources/grit/ui_chromeos_resources.h"
#else // !defined(OS_CHROMEOS)
@@ -131,7 +137,7 @@
#include "chrome/browser/ui/webui/settings/printing_handler.h"
#endif
-#if defined(SAFE_BROWSING_DB_LOCAL)
+#if defined(FULL_SAFE_BROWSING)
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
#include "chrome/browser/ui/webui/settings/change_password_handler.h"
#endif
@@ -139,7 +145,7 @@
namespace settings {
// static
-void MdSettingsUI::RegisterProfilePrefs(
+void SettingsUI::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(prefs::kImportDialogAutofillFormData, true);
registry->RegisterBooleanPref(prefs::kImportDialogBookmarks, true);
@@ -148,7 +154,7 @@ void MdSettingsUI::RegisterProfilePrefs(
registry->RegisterBooleanPref(prefs::kImportDialogSearchEngine, true);
}
-MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
+SettingsUI::SettingsUI(content::WebUI* web_ui)
: content::WebUIController(web_ui),
WebContentsObserver(web_ui->GetWebContents()) {
#if BUILDFLAG(OPTIMIZE_WEBUI)
@@ -156,6 +162,9 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
#endif
Profile* profile = Profile::FromWebUI(web_ui);
+ content::WebUIDataSource* html_source =
+ content::WebUIDataSource::Create(chrome::kChromeUISettingsHost);
+
AddSettingsPageUIHandler(std::make_unique<AppearanceHandler>(web_ui));
#if defined(USE_NSS_CERTS)
@@ -175,6 +184,8 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
AddSettingsPageUIHandler(std::make_unique<ImportDataHandler>());
#if defined(OS_WIN) || defined(OS_CHROMEOS)
+ // TODO(jamescook): Sort out how language is split between Chrome OS and
+ // and browser settings.
AddSettingsPageUIHandler(std::make_unique<LanguagesHandler>(web_ui));
#endif // defined(OS_WIN) || defined(OS_CHROMEOS)
@@ -190,14 +201,16 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
AddSettingsPageUIHandler(std::make_unique<SearchEnginesHandler>(profile));
AddSettingsPageUIHandler(std::make_unique<SiteSettingsHandler>(profile));
AddSettingsPageUIHandler(std::make_unique<StartupPagesHandler>(web_ui));
+ AddSettingsPageUIHandler(std::make_unique<SecurityKeysHandler>());
#if defined(OS_CHROMEOS)
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::AccessibilityHandler>(web_ui));
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::AndroidAppsHandler>(profile));
+ // TODO(950007): Remove this when SplitSettings is the default and there are
+ // no Chrome OS settings in the browser settings page.
+ InitOSWebUIHandlers(profile, web_ui, html_source);
- if (!profile->IsGuestSession()) {
+ // TODO(jamescook): Sort out how account management is split between Chrome OS
+ // and browser settings.
+ if (chromeos::IsAccountManagerAvailable(profile)) {
chromeos::AccountManagerFactory* factory =
g_browser_process->platform_part()->GetAccountManagerFactory();
chromeos::AccountManager* account_manager =
@@ -206,37 +219,14 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::AccountManagerUIHandler>(
- account_manager,
- IdentityManagerFactory::GetForProfile(profile)));
+ account_manager, IdentityManagerFactory::GetForProfile(profile)));
+ html_source->AddBoolean(
+ "secondaryGoogleAccountSigninAllowed",
+ profile->GetPrefs()->GetBoolean(
+ chromeos::prefs::kSecondaryGoogleAccountSigninAllowed));
}
AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::ChangePictureHandler>());
- if (crostini::IsCrostiniUIAllowedForProfile(profile,
- false /* check_policy */)) {
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::CrostiniHandler>(profile));
- }
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::CupsPrintersHandler>(web_ui));
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::FingerprintHandler>(profile));
- if (chromeos::switches::IsAssistantEnabled()) {
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::GoogleAssistantHandler>(profile));
- }
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::KeyboardHandler>());
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::PointerHandler>());
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::StorageHandler>(profile));
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::StylusHandler>());
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::InternetHandler>(profile));
- AddSettingsPageUIHandler(std::make_unique<TtsHandler>());
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::smb_dialog::SmbHandler>(profile));
#else
AddSettingsPageUIHandler(std::make_unique<DefaultBrowserHandler>());
AddSettingsPageUIHandler(std::make_unique<ManageProfileHandler>(profile));
@@ -247,16 +237,12 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
AddSettingsPageUIHandler(std::make_unique<PrintingHandler>());
#endif
- content::WebUIDataSource* html_source =
- content::WebUIDataSource::Create(chrome::kChromeUISettingsHost);
-
#if defined(OS_WIN)
AddSettingsPageUIHandler(std::make_unique<ChromeCleanupHandler>(profile));
#endif // defined(OS_WIN)
#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
bool has_incompatible_applications =
- IncompatibleApplicationsUpdater::IsWarningEnabled() &&
IncompatibleApplicationsUpdater::HasCachedApplications();
html_source->AddBoolean("showIncompatibleApplications",
has_incompatible_applications);
@@ -268,7 +254,7 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
#endif // OS_WIN && defined(GOOGLE_CHROME_BUILD)
bool password_protection_available = false;
-#if defined(SAFE_BROWSING_DB_LOCAL)
+#if defined(FULL_SAFE_BROWSING)
safe_browsing::ChromePasswordProtectionService* password_protection =
safe_browsing::ChromePasswordProtectionService::
GetPasswordProtectionService(profile);
@@ -281,97 +267,11 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
html_source->AddBoolean("passwordProtectionAvailable",
password_protection_available);
-#if defined(OS_CHROMEOS)
- if (!profile->IsGuestSession()) {
- chromeos::android_sms::AndroidSmsService* android_sms_service =
- chromeos::android_sms::AndroidSmsServiceFactory::GetForBrowserContext(
- profile);
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::MultideviceHandler>(
- profile->GetPrefs(),
- chromeos::multidevice_setup::MultiDeviceSetupClientFactory::
- GetForProfile(profile),
- android_sms_service
- ? android_sms_service->android_sms_pairing_state_tracker()
- : nullptr,
- android_sms_service ? android_sms_service->android_sms_app_manager()
- : nullptr));
- }
- html_source->AddBoolean(
- "multideviceAllowedByPolicy",
- chromeos::multidevice_setup::AreAnyMultiDeviceFeaturesAllowed(
- profile->GetPrefs()));
-
- AddSettingsPageUIHandler(base::WrapUnique(
- chromeos::settings::DateTimeHandler::Create(html_source)));
-
- AddSettingsPageUIHandler(
- std::make_unique<chromeos::settings::StylusHandler>());
- html_source->AddBoolean(
- "quickUnlockEnabled",
- chromeos::quick_unlock::IsPinEnabled(profile->GetPrefs()));
- html_source->AddBoolean(
- "quickUnlockDisabledByPolicy",
- chromeos::quick_unlock::IsPinDisabledByPolicy(profile->GetPrefs()));
- const bool fingerprint_unlock_enabled =
- chromeos::quick_unlock::IsFingerprintEnabled(profile);
- html_source->AddBoolean("fingerprintUnlockEnabled",
- fingerprint_unlock_enabled);
- if (fingerprint_unlock_enabled) {
- html_source->AddBoolean(
- "isFingerprintReaderOnKeyboard",
- chromeos::quick_unlock::IsFingerprintReaderOnKeyboard());
- }
- html_source->AddBoolean("lockScreenNotificationsEnabled",
- ash::features::IsLockScreenNotificationsEnabled());
- html_source->AddBoolean(
- "lockScreenHideSensitiveNotificationsSupported",
- ash::features::IsLockScreenHideSensitiveNotificationsSupported());
- html_source->AddBoolean("showTechnologyBadge",
- !ash::features::IsSeparateNetworkIconsEnabled());
- html_source->AddBoolean("hasInternalStylus",
- ash::stylus_utils::HasInternalStylus());
-
- html_source->AddBoolean(
- "showKioskNextShell",
- base::FeatureList::IsEnabled(ash::features::kKioskNextShell));
-
- html_source->AddBoolean("showCrostini",
- crostini::IsCrostiniUIAllowedForProfile(
- profile, false /* check_policy */));
-
- html_source->AddBoolean("allowCrostini",
- crostini::IsCrostiniUIAllowedForProfile(profile));
-
- html_source->AddBoolean("isDemoSession",
- chromeos::DemoSession::IsDeviceInDemoMode());
-
- html_source->AddBoolean("assistantEnabled",
- chromeos::switches::IsAssistantEnabled());
-
- // We have 2 variants of Android apps settings. Default case, when the Play
- // Store app exists we show expandable section that allows as to
- // enable/disable the Play Store and link to Android settings which is
- // available once settings app is registered in the system.
- // For AOSP images we don't have the Play Store app. In last case we Android
- // apps settings consists only from root link to Android settings and only
- // visible once settings app is registered.
- html_source->AddBoolean("androidAppsVisible",
- arc::IsArcAllowedForProfile(profile));
- html_source->AddBoolean("havePlayStoreApp", arc::IsPlayStoreAvailable());
-
- // TODO(mash): Support Chrome power settings in Mash. https://crbug.com/644348
- bool enable_power_settings = !features::IsMultiProcessMash();
- html_source->AddBoolean("enablePowerSettings", enable_power_settings);
- if (enable_power_settings) {
- AddSettingsPageUIHandler(std::make_unique<chromeos::settings::PowerHandler>(
- profile->GetPrefs()));
- }
-#else // !defined(OS_CHROMEOS)
+#if !defined(OS_CHROMEOS)
html_source->AddBoolean(
"diceEnabled",
AccountConsistencyModeManager::IsDiceEnabledForProfile(profile));
-#endif // defined(OS_CHROMEOS)
+#endif // !defined(OS_CHROMEOS)
html_source->AddBoolean("unifiedConsentEnabled",
unified_consent::IsUnifiedConsentFeatureEnabled());
@@ -383,6 +283,13 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
html_source->AddBoolean("showImportPasswords",
base::FeatureList::IsEnabled(
password_manager::features::kPasswordImport));
+#if defined(OS_CHROMEOS)
+ html_source->AddBoolean(
+ "showOSSettings",
+ !base::FeatureList::IsEnabled(chromeos::features::kSplitSettings));
+#else
+ html_source->AddBoolean("showOSSettings", false);
+#endif
AddSettingsPageUIHandler(
base::WrapUnique(AboutHandler::Create(html_source, profile)));
@@ -394,6 +301,7 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
#if defined(OS_CHROMEOS)
// Add the System Web App resources for Settings.
+ // TODO(jamescook|calamity): Migrate to chromeos::settings::OSSettingsUI.
if (web_app::SystemWebAppManager::IsEnabled()) {
html_source->AddResourcePath("icon-192.png", IDR_SETTINGS_LOGO_192);
html_source->AddResourcePath("pwa.html", IDR_PWA_HTML);
@@ -407,16 +315,16 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
#if BUILDFLAG(OPTIMIZE_WEBUI)
const bool use_polymer_2 =
base::FeatureList::IsEnabled(features::kWebUIPolymer2);
- html_source->AddResourcePath("crisper.js", IDR_MD_SETTINGS_CRISPER_JS);
+ html_source->AddResourcePath("crisper.js", IDR_SETTINGS_CRISPER_JS);
html_source->AddResourcePath("lazy_load.crisper.js",
- IDR_MD_SETTINGS_LAZY_LOAD_CRISPER_JS);
- html_source->AddResourcePath(
- "lazy_load.html", use_polymer_2
- ? IDR_MD_SETTINGS_LAZY_LOAD_VULCANIZED_P2_HTML
- : IDR_MD_SETTINGS_LAZY_LOAD_VULCANIZED_HTML);
+ IDR_SETTINGS_LAZY_LOAD_CRISPER_JS);
+ html_source->AddResourcePath("lazy_load.html",
+ use_polymer_2
+ ? IDR_SETTINGS_LAZY_LOAD_VULCANIZED_P2_HTML
+ : IDR_SETTINGS_LAZY_LOAD_VULCANIZED_HTML);
html_source->SetDefaultResource(use_polymer_2
- ? IDR_MD_SETTINGS_VULCANIZED_P2_HTML
- : IDR_MD_SETTINGS_VULCANIZED_HTML);
+ ? IDR_SETTINGS_VULCANIZED_P2_HTML
+ : IDR_SETTINGS_VULCANIZED_HTML);
html_source->UseGzip(base::BindRepeating(
[](const std::vector<std::string>& excluded_paths,
const std::string& path) {
@@ -424,7 +332,7 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
},
std::move(exclude_from_gzip)));
#if defined(OS_CHROMEOS)
- html_source->AddResourcePath("manifest.json", IDR_MD_SETTINGS_MANIFEST);
+ html_source->AddResourcePath("manifest.json", IDR_SETTINGS_MANIFEST);
#endif // defined (OS_CHROMEOS)
#else
// Add all settings resources.
@@ -444,15 +352,15 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
html_source);
}
-MdSettingsUI::~MdSettingsUI() {}
+SettingsUI::~SettingsUI() {}
-void MdSettingsUI::AddSettingsPageUIHandler(
+void SettingsUI::AddSettingsPageUIHandler(
std::unique_ptr<content::WebUIMessageHandler> handler) {
DCHECK(handler);
web_ui()->AddMessageHandler(std::move(handler));
}
-void MdSettingsUI::DidStartNavigation(
+void SettingsUI::DidStartNavigation(
content::NavigationHandle* navigation_handle) {
if (navigation_handle->IsSameDocument())
return;
@@ -460,15 +368,140 @@ void MdSettingsUI::DidStartNavigation(
load_start_time_ = base::Time::Now();
}
-void MdSettingsUI::DocumentLoadedInFrame(
+void SettingsUI::DocumentLoadedInFrame(
content::RenderFrameHost* render_frame_host) {
UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD",
base::Time::Now() - load_start_time_);
}
-void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() {
+void SettingsUI::DocumentOnLoadCompletedInMainFrame() {
UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD",
base::Time::Now() - load_start_time_);
}
+#if defined(OS_CHROMEOS)
+// static
+void SettingsUI::InitOSWebUIHandlers(Profile* profile,
+ content::WebUI* web_ui,
+ content::WebUIDataSource* html_source) {
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::AccessibilityHandler>(web_ui));
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::AndroidAppsHandler>(profile));
+ if (crostini::IsCrostiniUIAllowedForProfile(profile,
+ false /* check_policy */)) {
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::CrostiniHandler>(profile));
+ }
+ web_ui->AddMessageHandler(
+ chromeos::settings::CupsPrintersHandler::Create(web_ui));
+ web_ui->AddMessageHandler(base::WrapUnique(
+ chromeos::settings::DateTimeHandler::Create(html_source)));
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::FingerprintHandler>(profile));
+ if (chromeos::switches::IsAssistantEnabled()) {
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::GoogleAssistantHandler>(profile));
+ }
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::KeyboardHandler>());
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::PointerHandler>());
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::StorageHandler>(profile));
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::StylusHandler>());
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::InternetHandler>(profile));
+ web_ui->AddMessageHandler(std::make_unique<TtsHandler>());
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::smb_dialog::SmbHandler>(profile));
+
+ if (!profile->IsGuestSession()) {
+ chromeos::android_sms::AndroidSmsService* android_sms_service =
+ chromeos::android_sms::AndroidSmsServiceFactory::GetForBrowserContext(
+ profile);
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::MultideviceHandler>(
+ profile->GetPrefs(),
+ chromeos::multidevice_setup::MultiDeviceSetupClientFactory::
+ GetForProfile(profile),
+ android_sms_service
+ ? android_sms_service->android_sms_pairing_state_tracker()
+ : nullptr,
+ android_sms_service ? android_sms_service->android_sms_app_manager()
+ : nullptr));
+ }
+
+ html_source->AddBoolean(
+ "multideviceAllowedByPolicy",
+ chromeos::multidevice_setup::AreAnyMultiDeviceFeaturesAllowed(
+ profile->GetPrefs()));
+ html_source->AddBoolean(
+ "quickUnlockEnabled",
+ chromeos::quick_unlock::IsPinEnabled(profile->GetPrefs()));
+ html_source->AddBoolean(
+ "quickUnlockDisabledByPolicy",
+ chromeos::quick_unlock::IsPinDisabledByPolicy(profile->GetPrefs()));
+ const bool fingerprint_unlock_enabled =
+ chromeos::quick_unlock::IsFingerprintEnabled(profile);
+ html_source->AddBoolean("fingerprintUnlockEnabled",
+ fingerprint_unlock_enabled);
+ if (fingerprint_unlock_enabled) {
+ html_source->AddBoolean(
+ "isFingerprintReaderOnKeyboard",
+ chromeos::quick_unlock::IsFingerprintReaderOnKeyboard());
+ }
+ html_source->AddBoolean("lockScreenNotificationsEnabled",
+ ash::features::IsLockScreenNotificationsEnabled());
+ html_source->AddBoolean(
+ "lockScreenHideSensitiveNotificationsSupported",
+ ash::features::IsLockScreenHideSensitiveNotificationsSupported());
+ html_source->AddBoolean("showTechnologyBadge",
+ !ash::features::IsSeparateNetworkIconsEnabled());
+ html_source->AddBoolean("hasInternalStylus",
+ ash::stylus_utils::HasInternalStylus());
+
+ html_source->AddBoolean(
+ "showKioskNextShell",
+ base::FeatureList::IsEnabled(ash::features::kKioskNextShell));
+
+ html_source->AddBoolean("showCrostini",
+ crostini::IsCrostiniUIAllowedForProfile(
+ profile, false /* check_policy */));
+
+ html_source->AddBoolean("allowCrostini",
+ crostini::IsCrostiniUIAllowedForProfile(profile));
+
+ html_source->AddBoolean("showPluginVm",
+ plugin_vm::IsPluginVmEnabled(profile));
+
+ html_source->AddBoolean("isDemoSession",
+ chromeos::DemoSession::IsDeviceInDemoMode());
+
+ html_source->AddBoolean("assistantEnabled",
+ chromeos::switches::IsAssistantEnabled());
+
+ // We have 2 variants of Android apps settings. Default case, when the Play
+ // Store app exists we show expandable section that allows as to
+ // enable/disable the Play Store and link to Android settings which is
+ // available once settings app is registered in the system.
+ // For AOSP images we don't have the Play Store app. In last case we Android
+ // apps settings consists only from root link to Android settings and only
+ // visible once settings app is registered.
+ html_source->AddBoolean("androidAppsVisible",
+ arc::IsArcAllowedForProfile(profile));
+ html_source->AddBoolean("havePlayStoreApp", arc::IsPlayStoreAvailable());
+
+ // TODO(mash): Support Chrome power settings in Mash. https://crbug.com/644348
+ bool enable_power_settings = !::features::IsMultiProcessMash();
+ html_source->AddBoolean("enablePowerSettings", enable_power_settings);
+ if (enable_power_settings) {
+ web_ui->AddMessageHandler(
+ std::make_unique<chromeos::settings::PowerHandler>(
+ profile->GetPrefs()));
+ }
+}
+#endif // defined(OS_CHROMEOS)
+
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_ui.h b/chromium/chrome/browser/ui/webui/settings/settings_ui.h
new file mode 100644
index 00000000000..c5c2fc9fa46
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/settings_ui.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_UI_H_
+
+#include "base/macros.h"
+#include "base/time/time.h"
+#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_ui_controller.h"
+
+class Profile;
+
+namespace content {
+class WebUIDataSource;
+class WebUIMessageHandler;
+} // namespace content
+
+namespace user_prefs {
+class PrefRegistrySyncable;
+}
+
+namespace settings {
+
+// The WebUI handler for chrome://settings.
+class SettingsUI : public content::WebUIController,
+ public content::WebContentsObserver {
+ public:
+ static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
+
+ explicit SettingsUI(content::WebUI* web_ui);
+ ~SettingsUI() override;
+
+#if defined(OS_CHROMEOS)
+ // Initializes the WebUI message handlers for OS-specific settings.
+ static void InitOSWebUIHandlers(Profile* profile,
+ content::WebUI* web_ui,
+ content::WebUIDataSource* html_source);
+#endif // defined(OS_CHROMEOS)
+
+ // content::WebContentsObserver:
+ void DidStartNavigation(
+ content::NavigationHandle* navigation_handle) override;
+ void DocumentLoadedInFrame(
+ content::RenderFrameHost* render_frame_host) override;
+ void DocumentOnLoadCompletedInMainFrame() override;
+
+ private:
+ void AddSettingsPageUIHandler(
+ std::unique_ptr<content::WebUIMessageHandler> handler);
+
+ base::Time load_start_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(SettingsUI);
+};
+
+} // namespace settings
+
+#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_UI_H_
diff --git a/chromium/chrome/browser/ui/webui/settings/md_settings_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/settings/settings_ui_browsertest.cc
index da53ce1b369..459f2165900 100644
--- a/chromium/chrome/browser/ui/webui/settings/md_settings_ui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_ui_browsertest.cc
@@ -15,11 +15,11 @@
#include "content/public/common/url_constants.h"
#include "url/gurl.h"
-typedef InProcessBrowserTest MdSettingsUITest;
+typedef InProcessBrowserTest SettingsUITest;
using ui_test_utils::NavigateToURL;
-IN_PROC_BROWSER_TEST_F(MdSettingsUITest, ViewSourceDoesntCrash) {
+IN_PROC_BROWSER_TEST_F(SettingsUITest, ViewSourceDoesntCrash) {
NavigateToURL(browser(),
GURL(content::kViewSourceScheme + std::string(":") +
chrome::kChromeUISettingsURL + std::string("strings.js")));
@@ -27,7 +27,7 @@ IN_PROC_BROWSER_TEST_F(MdSettingsUITest, ViewSourceDoesntCrash) {
// Catch lifetime issues in message handlers. There was previously a problem
// with PrefMember calling Init again after Destroy.
-IN_PROC_BROWSER_TEST_F(MdSettingsUITest, ToggleJavaScript) {
+IN_PROC_BROWSER_TEST_F(SettingsUITest, ToggleJavaScript) {
NavigateToURL(browser(), GURL(chrome::kChromeUISettingsURL));
const auto& handlers = *browser()
diff --git a/chromium/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chromium/chrome/browser/ui/webui/settings/site_settings_handler.cc
index 3a6264360ce..ada32f07db7 100644
--- a/chromium/chrome/browser/ui/webui/settings/site_settings_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -29,6 +29,8 @@
#include "chrome/browser/permissions/permission_uma_util.h"
#include "chrome/browser/permissions/permission_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/serial/serial_chooser_context.h"
+#include "chrome/browser/serial/serial_chooser_context_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/page_info/page_info_infobar_delegate.h"
@@ -207,8 +209,8 @@ void CreateOrAppendSiteGroupEntry(
// Update the storage data in |origin_size_map|.
void UpdateDataForOrigin(const GURL& url,
- const int size,
- std::map<std::string, int>* origin_size_map) {
+ const int64_t size,
+ std::map<std::string, int64_t>* origin_size_map) {
if (size > 0)
(*origin_size_map)[url.spec()] += size;
}
@@ -293,7 +295,7 @@ bool IsPatternValidForType(const std::string& pattern_string,
void UpdateDataFromCookiesTree(
std::map<std::string, std::set<std::string>>* all_sites_map,
- std::map<std::string, int>* origin_size_map,
+ std::map<std::string, int64_t>* origin_size_map,
const GURL& origin,
int64_t size) {
UpdateDataForOrigin(origin, size, origin_size_map);
@@ -762,7 +764,7 @@ void SiteSettingsHandler::HandleGetAllSites(const base::ListValue* args) {
}
base::Value SiteSettingsHandler::PopulateCookiesAndUsageData(Profile* profile) {
- std::map<std::string, int> origin_size_map;
+ std::map<std::string, int64_t> origin_size_map;
std::map<std::string, int> origin_cookie_map;
base::Value list_value(base::Value::Type::LIST);
@@ -787,7 +789,7 @@ base::Value SiteSettingsHandler::PopulateCookiesAndUsageData(Profile* profile) {
const std::string& origin = origin_info.FindKey("origin")->GetString();
const auto& size_info_it = origin_size_map.find(origin);
if (size_info_it != origin_size_map.end())
- origin_info.SetKey("usage", base::Value(size_info_it->second));
+ origin_info.SetKey("usage", base::Value(double(size_info_it->second)));
const auto& origin_cookie_num_it =
origin_cookie_map.find(GURL(origin).host());
if (origin_cookie_num_it != origin_cookie_map.end()) {
@@ -815,10 +817,10 @@ void SiteSettingsHandler::HandleGetFormattedBytes(const base::ListValue* args) {
CHECK_EQ(2U, args->GetSize());
const base::Value* callback_id;
CHECK(args->Get(0, &callback_id));
- int num_bytes;
- CHECK(args->GetInteger(1, &num_bytes));
+ double num_bytes;
+ CHECK(args->GetDouble(1, &num_bytes));
- const base::string16 string = ui::FormatBytes(num_bytes);
+ const base::string16 string = ui::FormatBytes(int64_t(num_bytes));
ResolveJavascriptCallback(*callback_id, base::Value(string));
}
@@ -1370,6 +1372,10 @@ void SiteSettingsHandler::ObserveSourcesForProfile(Profile* profile) {
auto* usb_context = UsbChooserContextFactory::GetForProfile(profile);
if (!chooser_observer_.IsObserving(usb_context))
chooser_observer_.Add(usb_context);
+
+ auto* serial_context = SerialChooserContextFactory::GetForProfile(profile);
+ if (!chooser_observer_.IsObserving(serial_context))
+ chooser_observer_.Add(serial_context);
}
void SiteSettingsHandler::StopObservingSourcesForProfile(Profile* profile) {
@@ -1380,6 +1386,10 @@ void SiteSettingsHandler::StopObservingSourcesForProfile(Profile* profile) {
auto* usb_context = UsbChooserContextFactory::GetForProfile(profile);
if (chooser_observer_.IsObserving(usb_context))
chooser_observer_.Remove(usb_context);
+
+ auto* serial_context = SerialChooserContextFactory::GetForProfile(profile);
+ if (chooser_observer_.IsObserving(serial_context))
+ chooser_observer_.Remove(serial_context);
}
void SiteSettingsHandler::TreeNodesAdded(ui::TreeModel* model,
@@ -1409,7 +1419,7 @@ void SiteSettingsHandler::TreeModelEndBatch(CookiesTreeModel* model) {
void SiteSettingsHandler::GetOriginStorage(
std::map<std::string, std::set<std::string>>* all_sites_map,
- std::map<std::string, int>* origin_size_map) {
+ std::map<std::string, int64_t>* origin_size_map) {
CHECK(cookies_tree_model_.get());
const CookieTreeNode* root = cookies_tree_model_->GetRoot();
diff --git a/chromium/chrome/browser/ui/webui/settings/site_settings_handler.h b/chromium/chrome/browser/ui/webui/settings/site_settings_handler.h
index 3bcce17eb02..862145c4de7 100644
--- a/chromium/chrome/browser/ui/webui/settings/site_settings_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/site_settings_handler.h
@@ -121,6 +121,7 @@ class SiteSettingsHandler : public SettingsPageUIHandler,
FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, ZoomLevels);
FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest,
HandleClearEtldPlus1DataAndCookies);
+ FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, HandleGetFormattedBytes);
// Creates the CookiesTreeModel if necessary.
void EnsureCookiesTreeModelCreated();
@@ -134,7 +135,7 @@ class SiteSettingsHandler : public SettingsPageUIHandler,
// stores the information in the |all_sites_map| and |origin_size_map|.
void GetOriginStorage(
std::map<std::string, std::set<std::string>>* all_sites_map,
- std::map<std::string, int>* origin_size_map);
+ std::map<std::string, int64_t>* origin_size_map);
// Calculates the number of cookies for each etld+1 and each origin, and
// stores the information in the |all_sites_map| and |origin_cookie_map|.
diff --git a/chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
index 9f481b1a55b..f728d26b1ec 100644
--- a/chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
@@ -11,6 +11,7 @@
#include "base/bind_helpers.h"
#include "base/json/json_reader.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_clock.h"
#include "base/values.h"
@@ -50,6 +51,7 @@
#include "extensions/common/extension_builder.h"
#include "ppapi/buildflags/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/text/bytes_formatting.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/mock_user_manager.h"
@@ -423,7 +425,7 @@ class SiteSettingsHandlerTest : public testing::Test {
url::Origin::Create(GURL("https://www.example.com/")), 2);
mock_browsing_data_local_storage_helper->AddLocalStorageForOrigin(
- url::Origin::Create(GURL("https://www.google.com/")), 5);
+ url::Origin::Create(GURL("https://www.google.com/")), 50000000000);
mock_browsing_data_local_storage_helper->Notify();
mock_browsing_data_cookie_helper->AddCookieSamples(
@@ -760,7 +762,7 @@ TEST_F(SiteSettingsHandlerTest, OnStorageFetched) {
EXPECT_EQ("https://www.google.com/",
origin_info->FindKey("origin")->GetString());
EXPECT_EQ(0, origin_info->FindKey("engagement")->GetDouble());
- EXPECT_EQ(5, origin_info->FindKey("usage")->GetDouble());
+ EXPECT_EQ(50000000000, origin_info->FindKey("usage")->GetDouble());
EXPECT_EQ(0, origin_info->FindKey("numCookies")->GetDouble());
ASSERT_TRUE(storage_and_cookie_list->GetDictionary(2, &site_group));
@@ -1177,7 +1179,7 @@ class SiteSettingsHandlerInfobarTest : public BrowserWithTestWindowTest {
handler()->AllowJavascript();
web_ui()->ClearTrackedCalls();
- window2_ = base::WrapUnique(CreateBrowserWindow());
+ window2_ = CreateBrowserWindow();
browser2_ = base::WrapUnique(
CreateBrowser(profile(), browser()->type(), false, window2_.get()));
@@ -1868,4 +1870,20 @@ TEST_F(SiteSettingsHandlerTest, HandleClearEtldPlus1DataAndCookies) {
storage_and_cookie_list = GetOnStorageFetchedSentListValue();
EXPECT_EQ(0U, storage_and_cookie_list->GetSize());
}
+
+TEST_F(SiteSettingsHandlerTest, HandleGetFormattedBytes) {
+ const double size = 120000000000;
+ base::ListValue get_args;
+ get_args.AppendString(kCallbackId);
+ get_args.AppendDouble(size);
+ handler()->HandleGetFormattedBytes(&get_args);
+
+ // Validate that this method can handle large data.
+ const content::TestWebUI::CallData& data = *web_ui()->call_data().back();
+ EXPECT_EQ("cr.webUIResponse", data.function_name());
+ EXPECT_EQ(kCallbackId, data.arg1()->GetString());
+ ASSERT_TRUE(data.arg2()->GetBool());
+ EXPECT_EQ(base::UTF16ToUTF8(ui::FormatBytes(int64_t(size))),
+ data.arg3()->GetString());
+}
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
index 79535bb4a5f..8d4e51f12bd 100644
--- a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
+++ b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
@@ -35,7 +35,6 @@
#include "components/signin/core/browser/account_info.h"
#include "components/signin/core/browser/signin_metrics.h"
#include "components/signin/core/browser/signin_pref_names.h"
-#include "components/sync/base/sync_prefs.h"
#include "components/sync/driver/sync_service.h"
#include "components/sync/driver/sync_user_settings.h"
#include "components/unified_consent/feature.h"
@@ -281,11 +280,6 @@ void DiceTurnSyncOnHelper::OnEnterpriseAccountConfirmation(
}
void DiceTurnSyncOnHelper::TurnSyncOnWithProfileMode(ProfileMode profile_mode) {
- // Make sure the syncing is requested, otherwise the IdentityManager
- // will not be able to complete successfully.
- syncer::SyncPrefs sync_prefs(profile_->GetPrefs());
- sync_prefs.SetSyncRequested(true);
-
switch (profile_mode) {
case ProfileMode::CURRENT_PROFILE: {
// If this is a new signin (no account authenticated yet) try loading
@@ -443,6 +437,7 @@ void DiceTurnSyncOnHelper::SigninAndShowSyncConfirmationUI() {
// progress.
// TODO(https://crbug.com/811211): Remove this handle.
sync_blocker_ = sync_service->GetSetupInProgressHandle();
+ sync_service->GetUserSettings()->SetSyncRequested(true);
bool is_enterprise_user =
!policy::BrowserPolicyConnector::IsNonEnterpriseUser(
account_info_.email);
diff --git a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc
index 5c5288eb666..6450d648e88 100644
--- a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc
@@ -10,7 +10,6 @@
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/run_loop.h"
-#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
@@ -23,15 +22,15 @@
#include "chrome/browser/signin/scoped_account_consistency.h"
#include "chrome/browser/signin/test_signin_client_builder.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
-#include "chrome/browser/sync/profile_sync_test_util.h"
#include "chrome/test/base/scoped_testing_local_state.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "components/account_id/account_id.h"
-#include "components/browser_sync/profile_sync_service_mock.h"
#include "components/prefs/pref_service.h"
#include "components/signin/core/browser/signin_metrics.h"
#include "components/signin/core/browser/signin_pref_names.h"
+#include "components/sync/driver/mock_sync_service.h"
+#include "components/sync/driver/sync_user_settings_mock.h"
#include "components/unified_consent/feature.h"
#include "components/unified_consent/scoped_unified_consent.h"
#include "components/unified_consent/url_keyed_data_collection_consent_helper.h"
@@ -44,6 +43,7 @@
using ::testing::AtLeast;
using ::testing::Return;
+
using namespace unified_consent;
class DiceTurnSyncOnHelperTestBase;
@@ -169,6 +169,14 @@ class FakeUserPolicySigninService : public policy::UserPolicySigninService {
std::string email_;
};
+std::unique_ptr<KeyedService> BuildMockSyncService(
+ content::BrowserContext* context) {
+ auto service = std::make_unique<testing::NiceMock<syncer::MockSyncService>>();
+ ON_CALL(*service, IsAuthenticatedAccountPrimary())
+ .WillByDefault(Return(true));
+ return service;
+}
+
std::unique_ptr<TestingProfile> BuildTestingProfile(
const base::FilePath& path,
Profile::Delegate* delegate) {
@@ -176,9 +184,8 @@ std::unique_ptr<TestingProfile> BuildTestingProfile(
profile_builder.AddTestingFactory(
ChromeSigninClientFactory::GetInstance(),
base::BindRepeating(&signin::BuildTestSigninClient));
- profile_builder.AddTestingFactory(
- ProfileSyncServiceFactory::GetInstance(),
- base::BindRepeating(&BuildMockProfileSyncService));
+ profile_builder.AddTestingFactory(ProfileSyncServiceFactory::GetInstance(),
+ base::BindRepeating(&BuildMockSyncService));
profile_builder.AddTestingFactory(
policy::UserPolicySigninServiceFactory::GetInstance(),
base::BindRepeating(&FakeUserPolicySigninService::Build));
@@ -243,9 +250,8 @@ class DiceTurnSyncOnHelperTestBase : public testing::Test {
user_policy_signin_service_ = nullptr;
}
- // Gets the ProfileSyncServiceMock.
- browser_sync::ProfileSyncServiceMock* GetProfileSyncServiceMock() {
- return static_cast<browser_sync::ProfileSyncServiceMock*>(
+ syncer::MockSyncService* GetMockSyncService() {
+ return static_cast<syncer::MockSyncService*>(
ProfileSyncServiceFactory::GetForProfile(profile()));
}
@@ -266,22 +272,20 @@ class DiceTurnSyncOnHelperTestBase : public testing::Test {
void UseInvalidAccount() { account_id_ = "invalid_account"; }
void SetExpectationsForSyncStartupCompleted() {
- browser_sync::ProfileSyncServiceMock* sync_service_mock =
- GetProfileSyncServiceMock();
- EXPECT_CALL(*sync_service_mock, GetSetupInProgressHandle()).Times(1);
- ON_CALL(*sync_service_mock, GetDisableReasons())
+ syncer::MockSyncService* mock_sync_service = GetMockSyncService();
+ EXPECT_CALL(*mock_sync_service, GetSetupInProgressHandle()).Times(1);
+ ON_CALL(*mock_sync_service, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*sync_service_mock, GetTransportState())
+ ON_CALL(*mock_sync_service, GetTransportState())
.WillByDefault(Return(syncer::SyncService::TransportState::ACTIVE));
}
void SetExpectationsForSyncStartupPending() {
- browser_sync::ProfileSyncServiceMock* sync_service_mock =
- GetProfileSyncServiceMock();
- EXPECT_CALL(*sync_service_mock, GetSetupInProgressHandle()).Times(1);
- ON_CALL(*sync_service_mock, GetDisableReasons())
+ syncer::MockSyncService* mock_sync_service = GetMockSyncService();
+ EXPECT_CALL(*mock_sync_service, GetSetupInProgressHandle()).Times(1);
+ ON_CALL(*mock_sync_service, GetDisableReasons())
.WillByDefault(Return(syncer::SyncService::DISABLE_REASON_NONE));
- ON_CALL(*sync_service_mock, GetTransportState())
+ ON_CALL(*mock_sync_service, GetTransportState())
.WillByDefault(
Return(syncer::SyncService::TransportState::INITIALIZING));
}
@@ -407,6 +411,7 @@ class DiceTurnSyncOnHelperTestBase : public testing::Test {
identity_test_env_profile_adaptor_;
FakeUserPolicySigninService* user_policy_signin_service_ = nullptr;
std::string initial_device_id_;
+ testing::NiceMock<syncer::SyncUserSettingsMock> mock_sync_settings_;
// State of the delegate calls.
bool delegate_destroyed_ = false;
@@ -646,7 +651,7 @@ TEST_F(DiceTurnSyncOnHelperTest, UndoSync) {
// Set expectations.
expected_sync_confirmation_shown_ = true;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetProfileSyncServiceMock()->GetUserSettingsMock(),
+ EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
SetFirstSetupComplete())
.Times(0);
@@ -666,7 +671,7 @@ TEST_F(DiceTurnSyncOnHelperTest, ConfigureSync) {
expected_sync_confirmation_shown_ = true;
expected_sync_settings_shown_ = true;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetProfileSyncServiceMock()->GetUserSettingsMock(),
+ EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
SetFirstSetupComplete())
.Times(0);
@@ -688,7 +693,7 @@ TEST_F(DiceTurnSyncOnHelperTest, StartSync) {
// Set expectations.
expected_sync_confirmation_shown_ = true;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetProfileSyncServiceMock()->GetUserSettingsMock(),
+ EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
SetFirstSetupComplete())
.Times(1);
// Configure the test.
@@ -712,7 +717,7 @@ TEST_F(DiceTurnSyncOnHelperTest, ShowSyncDialogForEndConsumerAccount) {
sync_confirmation_result_ = LoginUIService::SyncConfirmationUIClosedResult::
SYNC_WITH_DEFAULT_SETTINGS;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetProfileSyncServiceMock()->GetUserSettingsMock(),
+ EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
SetFirstSetupComplete())
.Times(1);
@@ -736,7 +741,7 @@ TEST_F(DiceTurnSyncOnHelperTestWithUnifiedConsent,
sync_confirmation_result_ = LoginUIService::SyncConfirmationUIClosedResult::
SYNC_WITH_DEFAULT_SETTINGS;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetProfileSyncServiceMock()->GetUserSettingsMock(),
+ EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
SetFirstSetupComplete())
.Times(1);
PrefService* pref_service = profile()->GetPrefs();
@@ -784,7 +789,7 @@ TEST_F(DiceTurnSyncOnHelperTest,
// Simulate that sync startup has completed.
expected_sync_confirmation_shown_ = true;
- EXPECT_CALL(*GetProfileSyncServiceMock()->GetUserSettingsMock(),
+ EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
SetFirstSetupComplete())
.Times(1);
sync_confirmation_result_ = LoginUIService::SyncConfirmationUIClosedResult::
@@ -818,7 +823,7 @@ TEST_F(DiceTurnSyncOnHelperTest,
// Simulate that sync startup has failed.
expected_sync_confirmation_shown_ = true;
- EXPECT_CALL(*GetProfileSyncServiceMock()->GetUserSettingsMock(),
+ EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
SetFirstSetupComplete())
.Times(1);
sync_confirmation_result_ = LoginUIService::SyncConfirmationUIClosedResult::
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_handler.cc b/chromium/chrome/browser/ui/webui/signin/inline_login_handler.cc
index d3bb605869e..b21e56639e3 100644
--- a/chromium/chrome/browser/ui/webui/signin/inline_login_handler.cc
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler.cc
@@ -6,6 +6,7 @@
#include <limits.h>
#include <string>
+#include <vector>
#include "base/bind.h"
#include "base/metrics/user_metrics.h"
@@ -172,7 +173,8 @@ void InlineLoginHandler::HandleCompleteLoginMessage(
void InlineLoginHandler::HandleCompleteLoginMessageWithCookies(
const base::ListValue& args,
- const std::vector<net::CanonicalCookie>& cookies) {
+ const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& excluded_cookies) {
const base::DictionaryValue* dict = nullptr;
args.GetDictionary(0, &dict);
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_handler.h b/chromium/chrome/browser/ui/webui/signin/inline_login_handler.h
index 053825a7427..4977139f011 100644
--- a/chromium/chrome/browser/ui/webui/signin/inline_login_handler.h
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler.h
@@ -5,9 +5,12 @@
#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_H_
+#include <vector>
+
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "net/cookies/canonical_cookie.h"
namespace base {
class DictionaryValue;
@@ -62,7 +65,8 @@ class InlineLoginHandler : public content::WebUIMessageHandler {
// from the CookieManager.
void HandleCompleteLoginMessageWithCookies(
const base::ListValue& args,
- const std::vector<net::CanonicalCookie>& cookies);
+ const std::vector<net::CanonicalCookie>& cookies,
+ const net::CookieStatusList& excluded_cookies);
// JS callback to switch the UI from a constrainted dialog to a full tab.
void HandleSwitchToFullTabMessage(const base::ListValue* args);
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.cc b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.cc
index 8b85f1083f1..f5f0fe7ff8b 100644
--- a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.cc
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.cc
@@ -12,9 +12,10 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/webui/signin/inline_login_handler.h"
-#include "chromeos/account_manager/account_manager.h"
-#include "chromeos/account_manager/account_manager_factory.h"
+#include "chromeos/components/account_manager/account_manager.h"
+#include "chromeos/components/account_manager/account_manager_factory.h"
#include "components/signin/core/browser/account_info.h"
#include "google_apis/gaia/gaia_urls.h"
#include "services/identity/public/cpp/identity_manager.h"
@@ -56,10 +57,11 @@ class SigninHelper : public GaiaAuthConsumer {
void OnClientOAuthSuccess(const ClientOAuthResult& result) override {
// Flow of control after this call:
// |AccountManager::UpsertAccount| updates / inserts the account and calls
- // its |Observer|s, one of which is |ChromeOSOAuth2TokenServiceDelegate|.
- // |ChromeOSOAuth2TokenServiceDelegate::OnTokenUpserted| seeds the Gaia id
- // and email id for this account in |AccountTrackerService| and invokes
- // |FireRefreshTokenAvailable|. This causes the account to propagate
+ // its |Observer|s, one of which is
+ // |ProfileOAuth2TokenServiceDelegateChromeOS|.
+ // |ProfileOAuth2TokenServiceDelegateChromeOS::OnTokenUpserted| seeds the
+ // Gaia id and email id for this account in |AccountTrackerService| and
+ // invokes |FireRefreshTokenAvailable|. This causes the account to propagate
// throughout the Identity Service chain, including in
// |AccountFetcherService|. |AccountFetcherService::OnRefreshTokenAvailable|
// invokes |AccountTrackerService::StartTrackingAccount|, triggers a fetch
@@ -101,6 +103,16 @@ InlineLoginHandlerChromeOS::InlineLoginHandlerChromeOS(
InlineLoginHandlerChromeOS::~InlineLoginHandlerChromeOS() = default;
+void InlineLoginHandlerChromeOS::RegisterMessages() {
+ InlineLoginHandler::RegisterMessages();
+
+ web_ui()->RegisterMessageCallback(
+ "showIncognito",
+ base::BindRepeating(
+ &InlineLoginHandlerChromeOS::ShowIncognitoAndCloseDialog,
+ base::Unretained(this)));
+}
+
void InlineLoginHandlerChromeOS::SetExtraInitParams(
base::DictionaryValue& params) {
const GaiaUrls* const gaia_urls = GaiaUrls::GetInstance();
@@ -143,4 +155,10 @@ void InlineLoginHandlerChromeOS::CompleteLogin(const std::string& email,
auth_code);
}
+void InlineLoginHandlerChromeOS::ShowIncognitoAndCloseDialog(
+ const base::ListValue* args) {
+ chrome::NewIncognitoWindow(Profile::FromWebUI(web_ui()));
+ close_dialog_closure_.Run();
+}
+
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.h b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.h
index 70739fbeb89..415bf57ea09 100644
--- a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.h
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.h
@@ -5,9 +5,10 @@
#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_CHROMEOS_H_
#define CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_CHROMEOS_H_
+#include <string>
+
#include "base/macros.h"
#include "chrome/browser/ui/webui/signin/inline_login_handler.h"
-#include "chromeos/account_manager/account_manager.h"
#include "google_apis/gaia/gaia_auth_consumer.h"
#include "google_apis/gaia/gaia_auth_fetcher.h"
@@ -20,6 +21,7 @@ class InlineLoginHandlerChromeOS : public InlineLoginHandler {
~InlineLoginHandlerChromeOS() override;
// InlineLoginHandler overrides.
+ void RegisterMessages() override;
void SetExtraInitParams(base::DictionaryValue& params) override;
void CompleteLogin(const std::string& email,
const std::string& password,
@@ -31,6 +33,8 @@ class InlineLoginHandlerChromeOS : public InlineLoginHandler {
bool choose_what_to_sync) override;
private:
+ void ShowIncognitoAndCloseDialog(const base::ListValue* args);
+
base::RepeatingClosure close_dialog_closure_;
DISALLOW_COPY_AND_ASSIGN(InlineLoginHandlerChromeOS);
};
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.cc b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.cc
index a6dbae9d3f4..aaab6f09281 100644
--- a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.cc
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.cc
@@ -4,14 +4,18 @@
#include "chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h"
+#include <algorithm>
#include <string>
#include "base/logging.h"
#include "base/macros.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
#include "chrome/common/webui_url_constants.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "net/base/url_util.h"
#include "ui/aura/window.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
#include "url/gurl.h"
namespace chromeos {
@@ -19,6 +23,8 @@ namespace chromeos {
namespace {
InlineLoginHandlerDialogChromeOS* dialog = nullptr;
+constexpr int kSigninDialogWidth = 768;
+constexpr int kSigninDialogHeight = 640;
} // namespace
@@ -40,15 +46,47 @@ void InlineLoginHandlerDialogChromeOS::Show(const std::string& email) {
dialog->ShowSystemDialog();
}
+gfx::Size InlineLoginHandlerDialogChromeOS::GetMaximumDialogSize() {
+ gfx::Size size;
+ GetDialogSize(&size);
+ return size;
+}
+
+gfx::NativeView InlineLoginHandlerDialogChromeOS::GetHostView() const {
+ return dialog_window();
+}
+
+gfx::Point InlineLoginHandlerDialogChromeOS::GetDialogPosition(
+ const gfx::Size& size) {
+ gfx::Size host_size = GetHostView()->bounds().size();
+
+ // Show all sub-dialogs at center-top.
+ return gfx::Point(std::max(0, (host_size.width() - size.width()) / 2), 0);
+}
+
+void InlineLoginHandlerDialogChromeOS::AddObserver(
+ web_modal::ModalDialogHostObserver* observer) {}
+
+void InlineLoginHandlerDialogChromeOS::RemoveObserver(
+ web_modal::ModalDialogHostObserver* observer) {}
+
InlineLoginHandlerDialogChromeOS::InlineLoginHandlerDialogChromeOS(
const GURL& url)
- : SystemWebDialogDelegate(url, base::string16() /* title */) {}
+ : SystemWebDialogDelegate(url, base::string16() /* title */),
+ delegate_(this) {}
InlineLoginHandlerDialogChromeOS::~InlineLoginHandlerDialogChromeOS() {
DCHECK_EQ(this, dialog);
dialog = nullptr;
}
+void InlineLoginHandlerDialogChromeOS::GetDialogSize(gfx::Size* size) const {
+ const display::Display display =
+ display::Screen::GetScreen()->GetDisplayNearestWindow(dialog_window());
+ size->SetSize(std::min(kSigninDialogWidth, display.work_area().width()),
+ std::min(kSigninDialogHeight, display.work_area().height()));
+}
+
std::string InlineLoginHandlerDialogChromeOS::GetDialogArgs() const {
return std::string();
}
@@ -57,10 +95,15 @@ bool InlineLoginHandlerDialogChromeOS::ShouldShowDialogTitle() const {
return false;
}
-void InlineLoginHandlerDialogChromeOS::GetDialogSize(gfx::Size* size) const {
- constexpr int kSigninDialogWidth = 800;
- constexpr int kSigninDialogHeight = 700;
- size->SetSize(kSigninDialogWidth, kSigninDialogHeight);
+void InlineLoginHandlerDialogChromeOS::OnDialogShown(
+ content::WebUI* webui,
+ content::RenderViewHost* render_view_host) {
+ SystemWebDialogDelegate::OnDialogShown(webui, render_view_host);
+ web_modal::WebContentsModalDialogManager::CreateForWebContents(
+ webui->GetWebContents());
+ web_modal::WebContentsModalDialogManager::FromWebContents(
+ webui->GetWebContents())
+ ->SetDelegate(&delegate_);
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h
index 192f1bea66f..703e4a2f9f4 100644
--- a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h
@@ -9,6 +9,8 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
+#include "chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.h"
+#include "components/web_modal/web_contents_modal_dialog_host.h"
class GURL;
@@ -17,13 +19,22 @@ namespace chromeos {
// Extends from |SystemWebDialogDelegate| to create an always-on-top but movable
// dialog. It is intentionally made movable so that users can copy-paste account
// passwords from password managers.
-class InlineLoginHandlerDialogChromeOS : public SystemWebDialogDelegate {
+class InlineLoginHandlerDialogChromeOS
+ : public SystemWebDialogDelegate,
+ public web_modal::WebContentsModalDialogHost {
public:
// Displays the dialog. |email| is an optional parameter that if provided,
// pre-fills the account email field in the sign-in dialog - useful for
// account re-authentication.
static void Show(const std::string& email = std::string());
+ // web_modal::WebContentsModalDialogHost overrides.
+ gfx::Size GetMaximumDialogSize() override;
+ gfx::NativeView GetHostView() const override;
+ gfx::Point GetDialogPosition(const gfx::Size& size) override;
+ void AddObserver(web_modal::ModalDialogHostObserver* observer) override;
+ void RemoveObserver(web_modal::ModalDialogHostObserver* observer) override;
+
protected:
explicit InlineLoginHandlerDialogChromeOS(const GURL& url);
~InlineLoginHandlerDialogChromeOS() override;
@@ -32,8 +43,12 @@ class InlineLoginHandlerDialogChromeOS : public SystemWebDialogDelegate {
void GetDialogSize(gfx::Size* size) const override;
std::string GetDialogArgs() const override;
bool ShouldShowDialogTitle() const override;
+ void OnDialogShown(content::WebUI* webui,
+ content::RenderViewHost* render_view_host) override;
private:
+ InlineLoginHandlerModalDelegate delegate_;
+
DISALLOW_COPY_AND_ASSIGN(InlineLoginHandlerDialogChromeOS);
};
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
index b7f731e557f..d1badaaf985 100644
--- a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
@@ -360,12 +360,6 @@ void InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened(
identity::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile_);
- // Seed the account with this combination of gaia id/display email.
- AccountInfo account_info;
- account_info.gaia = gaia_id_;
- account_info.email = email_;
- identity_manager->LegacySeedAccountInfo(account_info);
-
std::string primary_email = identity_manager->GetPrimaryAccountInfo().email;
if (gaia::AreEmailsSame(email_, primary_email) &&
reason == HandlerSigninReason::UNLOCK && !password_.empty() &&
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.cc b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.cc
new file mode 100644
index 00000000000..c231c7b408f
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.cc
@@ -0,0 +1,23 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.h"
+
+#include "base/logging.h"
+#include "content/public/browser/web_contents.h"
+
+namespace chromeos {
+
+InlineLoginHandlerModalDelegate::InlineLoginHandlerModalDelegate(
+ web_modal::WebContentsModalDialogHost* host)
+ : host_(host) {}
+
+InlineLoginHandlerModalDelegate::~InlineLoginHandlerModalDelegate() = default;
+
+web_modal::WebContentsModalDialogHost*
+InlineLoginHandlerModalDelegate::GetWebContentsModalDialogHost() {
+ return host_;
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.h b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.h
new file mode 100644
index 00000000000..8ca37afab8a
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.h
@@ -0,0 +1,38 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_MODAL_DELEGATE_H_
+#define CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_MODAL_DELEGATE_H_
+
+#include "base/macros.h"
+#include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h"
+
+namespace chromeos {
+
+// Used to display sub-modals inside |InlineLoginHandlerDialogChromeOS| modal
+// dialog, e.g. displaying a dialog for accounts using 2FA with WebAuthn,
+// where users can select alternate 2FAs.
+class InlineLoginHandlerModalDelegate
+ : public ChromeWebModalDialogManagerDelegate {
+ public:
+ // |host| is a non owning pointer to the host dialog of this delegate
+ // (|InlineLoginHandlerDialogChromeOS|).
+ explicit InlineLoginHandlerModalDelegate(
+ web_modal::WebContentsModalDialogHost* host);
+ ~InlineLoginHandlerModalDelegate() override;
+
+ // web_modal::WebContentsModalDialogManagerDelegate overrides.
+ web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
+ override;
+
+ private:
+ // Non-owning pointer.
+ web_modal::WebContentsModalDialogHost* host_;
+
+ DISALLOW_COPY_AND_ASSIGN(InlineLoginHandlerModalDelegate);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_MODAL_DELEGATE_H_
diff --git a/chromium/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chromium/chrome/browser/ui/webui/signin/inline_login_ui.cc
index 6891b2cbe55..db04d07091f 100644
--- a/chromium/chrome/browser/ui/webui/signin/inline_login_ui.cc
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_ui.cc
@@ -46,8 +46,10 @@ content::WebUIDataSource* CreateWebUIDataSource() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
const bool is_running_test = command_line->HasSwitch(::switches::kTestName) ||
command_line->HasSwitch(::switches::kTestType);
- if (is_running_test)
- source->SetRequestFilter(test::GetTestFilesRequestFilter());
+ if (is_running_test) {
+ source->SetRequestFilter(test::GetTestShouldHandleRequest(),
+ test::GetTestFilesRequestFilter());
+ }
source->AddResourcePath("inline_login.css", IDR_INLINE_LOGIN_CSS);
source->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS);
diff --git a/chromium/chrome/browser/ui/webui/signin/login_ui_test_utils.cc b/chromium/chrome/browser/ui/webui/signin/login_ui_test_utils.cc
index 71a622f4256..9913b9afa6d 100644
--- a/chromium/chrome/browser/ui/webui/signin/login_ui_test_utils.cc
+++ b/chromium/chrome/browser/ui/webui/signin/login_ui_test_utils.cc
@@ -54,7 +54,7 @@ class SignInObserver : public identity::IdentityManager::Observer {
}
// Blocks and waits until the user signs in. Wait() does not block if a
- // GoogleSigninSucceeded or a GoogleSigninFailed has already occurred.
+ // GoogleSigninSucceeded has already occurred.
void Wait() {
if (seen_)
return;
@@ -65,12 +65,6 @@ class SignInObserver : public identity::IdentityManager::Observer {
EXPECT_TRUE(seen_);
}
- void OnPrimaryAccountSigninFailed(
- const GoogleServiceAuthError& error) override {
- DVLOG(1) << "Google signin failed.";
- QuitLoopRunner();
- }
-
void OnPrimaryAccountSet(
const CoreAccountInfo& primary_account_info) override {
DVLOG(1) << "Google signin succeeded.";
@@ -199,11 +193,16 @@ class SigninViewControllerTestUtil {
content::WebContents* dialog_web_contents =
signin_view_controller->GetModalDialogWebContentsForTesting();
DCHECK_NE(dialog_web_contents, nullptr);
+ std::string confirm_button_selector =
+ "document.querySelector('sync-confirmation-app').shadowRoot."
+ "querySelector('#confirmButton')";
std::string message;
std::string find_button_js =
"if (document.readyState != 'complete') {"
" window.domAutomationController.send('DocumentNotReady');"
- "} else if (document.getElementById('confirmButton') == null) {"
+ "} else if (" +
+ confirm_button_selector +
+ " == null) {"
" window.domAutomationController.send('NotFound');"
"} else {"
" window.domAutomationController.send('Ok');"
@@ -215,9 +214,8 @@ class SigninViewControllerTestUtil {
// This cannot be a synchronous call, because it closes the window as a side
// effect, which may cause the javascript execution to never finish.
- content::ExecuteScriptAsync(
- dialog_web_contents,
- "document.getElementById('confirmButton').click();");
+ content::ExecuteScriptAsync(dialog_web_contents,
+ confirm_button_selector + ".click();");
return true;
#endif
}
diff --git a/chromium/chrome/browser/ui/webui/signin/signin_error_handler_unittest.cc b/chromium/chrome/browser/ui/webui/signin/signin_error_handler_unittest.cc
index 051b16da16b..1f5e003de36 100644
--- a/chromium/chrome/browser/ui/webui/signin/signin_error_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/signin/signin_error_handler_unittest.cc
@@ -102,8 +102,8 @@ class SigninErrorHandlerTest : public BrowserWithTestWindowTest {
content::TestWebUI* web_ui() { return web_ui_.get(); }
// BrowserWithTestWindowTest
- BrowserWindow* CreateBrowserWindow() override {
- return new DialogTestBrowserWindow;
+ std::unique_ptr<BrowserWindow> CreateBrowserWindow() override {
+ return std::make_unique<DialogTestBrowserWindow>();
}
private:
diff --git a/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc b/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
index a72cddaef77..e1d569f56f3 100644
--- a/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
+++ b/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
@@ -102,13 +102,16 @@ void SyncConfirmationHandler::HandleUndo(const base::ListValue* args) {
void SyncConfirmationHandler::HandleAccountImageRequest(
const base::ListValue* args) {
- AccountInfo account_info = identity_manager_->GetPrimaryAccountInfo();
+ base::Optional<AccountInfo> primary_account_info =
+ identity_manager_->FindExtendedAccountInfoForAccount(
+ identity_manager_->GetPrimaryAccountInfo());
// Fire the "account-image-changed" listener from |SetUserImageURL()|.
// Note: If the account info is not available yet in the
// IdentityManager, i.e. account_info is empty, the listener will be
// fired again through |OnAccountUpdated()|.
- SetUserImageURL(account_info.picture_url);
+ if (primary_account_info)
+ SetUserImageURL(primary_account_info->picture_url);
}
void SyncConfirmationHandler::RecordConsent(const base::ListValue* args) {
@@ -222,18 +225,20 @@ void SyncConfirmationHandler::HandleInitializedWithSize(
if (!browser_)
return;
- if (!identity_manager_->HasPrimaryAccount()) {
+ base::Optional<AccountInfo> primary_account_info =
+ identity_manager_->FindExtendedAccountInfoForAccount(
+ identity_manager_->GetPrimaryAccountInfo());
+ if (!primary_account_info) {
// No account is signed in, so there is nothing to be displayed in the sync
// confirmation dialog.
return;
}
- AccountInfo account_info = identity_manager_->GetPrimaryAccountInfo();
- if (!account_info.IsValid()) {
+ if (!primary_account_info->IsValid()) {
SetUserImageURL(kNoPictureURLFound);
identity_manager_->AddObserver(this);
} else {
- SetUserImageURL(account_info.picture_url);
+ SetUserImageURL(primary_account_info->picture_url);
}
signin::SetInitializedModalHeight(browser_, web_ui(), args);
diff --git a/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc b/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
index 3b94cf31075..4e4a3a9bb6c 100644
--- a/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
@@ -129,8 +129,8 @@ class SyncConfirmationHandlerTest : public BrowserWithTestWindowTest,
return identity_test_env_adaptor_->identity_test_env();
}
- BrowserWindow* CreateBrowserWindow() override {
- return new DialogTestBrowserWindow;
+ std::unique_ptr<BrowserWindow> CreateBrowserWindow() override {
+ return std::make_unique<DialogTestBrowserWindow>();
}
TestingProfile::TestingFactories GetTestingFactories() override {
@@ -167,10 +167,14 @@ class SyncConfirmationHandlerTest : public BrowserWithTestWindowTest,
ASSERT_TRUE(call_data.arg1()->GetAsString(&event));
EXPECT_EQ("account-image-changed", event);
+ identity::IdentityManager* identity_manager =
+ IdentityManagerFactory::GetForProfile(profile());
+ base::Optional<AccountInfo> primary_account =
+ identity_manager->FindExtendedAccountInfoForAccount(
+ identity_manager->GetPrimaryAccountInfo());
+
std::string original_picture_url =
- IdentityManagerFactory::GetForProfile(profile())
- ->GetPrimaryAccountInfo()
- .picture_url;
+ primary_account ? primary_account->picture_url : std::string();
std::string expected_picture_url =
original_picture_url.empty()
? profiles::GetPlaceholderAvatarIconUrl()
@@ -206,13 +210,27 @@ class SyncConfirmationHandlerTest : public BrowserWithTestWindowTest,
DISALLOW_COPY_AND_ASSIGN(SyncConfirmationHandlerTest);
};
+class SyncConfirmationHandlerTest_UnifiedConsentDisabled
+ : public SyncConfirmationHandlerTest {
+ public:
+ SyncConfirmationHandlerTest_UnifiedConsentDisabled()
+ : scoped_unified_consent_(
+ unified_consent::UnifiedConsentFeatureState::kDisabled) {}
+
+ private:
+ unified_consent::ScopedUnifiedConsent scoped_unified_consent_;
+
+ DISALLOW_COPY_AND_ASSIGN(SyncConfirmationHandlerTest_UnifiedConsentDisabled);
+};
+
const char SyncConfirmationHandlerTest::kConsentText1[] = "consentText1";
const char SyncConfirmationHandlerTest::kConsentText2[] = "consentText2";
const char SyncConfirmationHandlerTest::kConsentText3[] = "consentText3";
const char SyncConfirmationHandlerTest::kConsentText4[] = "consentText4";
const char SyncConfirmationHandlerTest::kConsentText5[] = "consentText5";
-TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReady) {
+TEST_F(SyncConfirmationHandlerTest_UnifiedConsentDisabled,
+ TestSetImageIfPrimaryAccountReady) {
identity_test_env()->SimulateSuccessfulFetchOfAccountInfo(
account_info_.account_id, account_info_.email, account_info_.gaia, "",
"full_name", "given_name", "locale",
@@ -235,21 +253,20 @@ TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReady) {
EXPECT_EQ("sync.confirmation.clearFocus",
web_ui()->call_data()[1]->function_name());
+ identity::IdentityManager* identity_manager =
+ IdentityManagerFactory::GetForProfile(profile());
+ base::Optional<AccountInfo> primary_account_info =
+ identity_manager->FindExtendedAccountInfoForAccount(
+ identity_manager->GetPrimaryAccountInfo());
std::string original_picture_url =
- IdentityManagerFactory::GetForProfile(profile())
- ->GetPrimaryAccountInfo()
- .picture_url;
+ primary_account_info ? primary_account_info->picture_url : std::string();
GURL picture_url_with_size = signin::GetAvatarImageURLWithOptions(
GURL(original_picture_url), kExpectedProfileImageSize,
false /* no_silhouette */);
EXPECT_EQ(picture_url_with_size.spec(), passed_picture_url);
}
-TEST_F(SyncConfirmationHandlerTest,
- TestSetImageIfPrimaryAccountReady_UnifiedConsent) {
- unified_consent::ScopedUnifiedConsent scoped_unified_consent(
- unified_consent::UnifiedConsentFeatureState::kEnabled);
-
+TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReady) {
identity_test_env()->SimulateSuccessfulFetchOfAccountInfo(
account_info_.account_id, account_info_.email, account_info_.gaia, "",
"full_name", "given_name", "locale",
@@ -264,7 +281,8 @@ TEST_F(SyncConfirmationHandlerTest,
web_ui()->call_data()[1]->function_name());
}
-TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReadyLater) {
+TEST_F(SyncConfirmationHandlerTest_UnifiedConsentDisabled,
+ TestSetImageIfPrimaryAccountReadyLater) {
base::ListValue args;
args.Set(0, std::make_unique<base::Value>(kDefaultDialogHeight));
handler()->HandleInitializedWithSize(&args);
@@ -298,21 +316,21 @@ TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReadyLater) {
EXPECT_TRUE(
web_ui()->call_data()[2]->arg1()->GetAsString(&passed_picture_url));
+ identity::IdentityManager* identity_manager =
+ IdentityManagerFactory::GetForProfile(profile());
+ base::Optional<AccountInfo> primary_account_info =
+ identity_manager->FindExtendedAccountInfoForAccount(
+ identity_manager->GetPrimaryAccountInfo());
+
std::string original_picture_url =
- IdentityManagerFactory::GetForProfile(profile())
- ->GetPrimaryAccountInfo()
- .picture_url;
+ primary_account_info ? primary_account_info->picture_url : std::string();
GURL picture_url_with_size = signin::GetAvatarImageURLWithOptions(
GURL(original_picture_url), kExpectedProfileImageSize,
false /* no_silhouette */);
EXPECT_EQ(picture_url_with_size.spec(), passed_picture_url);
}
-TEST_F(SyncConfirmationHandlerTest,
- TestSetImageIfPrimaryAccountReadyLater_UnifiedConsent) {
- unified_consent::ScopedUnifiedConsent scoped_unified_consent(
- unified_consent::UnifiedConsentFeatureState::kEnabled);
-
+TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReadyLater) {
base::ListValue args;
args.Set(0, std::make_unique<base::Value>(kDefaultDialogHeight));
handler()->HandleInitializedWithSize(&args);
@@ -331,7 +349,7 @@ TEST_F(SyncConfirmationHandlerTest,
ExpectAccountImageChanged(*web_ui()->call_data()[2]);
}
-TEST_F(SyncConfirmationHandlerTest,
+TEST_F(SyncConfirmationHandlerTest_UnifiedConsentDisabled,
TestSetImageIgnoredIfSecondaryAccountUpdated) {
base::ListValue args;
args.Set(0, std::make_unique<base::Value>(kDefaultDialogHeight));
@@ -361,6 +379,35 @@ TEST_F(SyncConfirmationHandlerTest,
web_ui()->call_data()[2]->function_name());
}
+TEST_F(SyncConfirmationHandlerTest,
+ TestSetImageIgnoredIfSecondaryAccountUpdated) {
+ base::ListValue args;
+ args.Set(0, std::make_unique<base::Value>(kDefaultDialogHeight));
+ handler()->HandleInitializedWithSize(&args);
+ EXPECT_EQ(2U, web_ui()->call_data().size());
+
+ AccountInfo account_info =
+ identity_test_env()->MakeAccountAvailable("bar@example.com");
+ identity_test_env()->SimulateSuccessfulFetchOfAccountInfo(
+ account_info.account_id, account_info.email, account_info.gaia, "",
+ "bar_full_name", "bar_given_name", "bar_locale",
+ "http://picture.example.com/bar_picture.jpg");
+
+ // Updating the account info of a secondary account should not update the
+ // image of the sync confirmation dialog.
+ EXPECT_EQ(2U, web_ui()->call_data().size());
+
+ identity_test_env()->SimulateSuccessfulFetchOfAccountInfo(
+ account_info_.account_id, account_info_.email, account_info_.gaia, "",
+ "full_name", "given_name", "locale",
+ "http://picture.example.com/picture.jpg");
+
+ // Updating the account info of the primary account should update the
+ // image of the sync confirmation dialog.
+ EXPECT_EQ(3U, web_ui()->call_data().size());
+ ExpectAccountImageChanged(*web_ui()->call_data()[2]);
+}
+
TEST_F(SyncConfirmationHandlerTest, TestHandleUndo) {
handler()->HandleUndo(nullptr);
did_user_explicitly_interact = true;
diff --git a/chromium/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc b/chromium/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
index 572e5cf4b78..81e3ec8ec9f 100644
--- a/chromium/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
+++ b/chromium/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/ui/webui/dark_mode_handler.h"
#include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
@@ -66,9 +67,14 @@ SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
constexpr int kAccountPictureSize = 68;
std::string custom_picture_url = profiles::GetPlaceholderAvatarIconUrl();
- GURL account_picture_url(IdentityManagerFactory::GetForProfile(profile)
- ->GetPrimaryAccountInfo()
- .picture_url);
+ identity::IdentityManager* identity_manager =
+ IdentityManagerFactory::GetForProfile(profile);
+ base::Optional<AccountInfo> primary_account_info =
+ identity_manager->FindExtendedAccountInfoForAccount(
+ identity_manager->GetPrimaryAccountInfo());
+ GURL account_picture_url(primary_account_info
+ ? primary_account_info->picture_url
+ : std::string());
if (account_picture_url.is_valid()) {
custom_picture_url = signin::GetAvatarImageURLWithOptions(
account_picture_url, kAccountPictureSize,
@@ -83,7 +89,6 @@ SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
consent_feature_ = consent_auditor::Feature::CHROME_UNIFIED_CONSENT;
} else {
source->SetDefaultResource(IDR_SYNC_CONFIRMATION_HTML);
- source->AddResourcePath("sync_confirmation.css", IDR_SYNC_CONFIRMATION_CSS);
source->AddResourcePath("sync_confirmation.js", IDR_SYNC_CONFIRMATION_JS);
source->AddBoolean("isSyncAllowed", is_sync_allowed);
@@ -127,6 +132,7 @@ SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
g_browser_process->GetApplicationLocale(), &strings);
source->AddLocalizedStrings(strings);
+ DarkModeHandler::Initialize(web_ui, source);
content::WebUIDataSource::Add(profile, source);
}
diff --git a/chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
index b32dc6c2f64..91ffa6957bc 100644
--- a/chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
+++ b/chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
@@ -631,8 +631,6 @@ void UserManagerScreenHandler::GetLocalizedValues(
localized_strings->SetString("cancel", l10n_util::GetStringUTF16(IDS_CANCEL));
localized_strings->SetString(
"browseAsGuest", l10n_util::GetStringUTF16(IDS_BROWSE_AS_GUEST_BUTTON));
- localized_strings->SetString("signOutUser",
- l10n_util::GetStringUTF16(IDS_SCREEN_LOCK_SIGN_OUT));
localized_strings->SetString("addSupervisedUser",
l10n_util::GetStringUTF16(IDS_CREATE_LEGACY_SUPERVISED_USER_MENU_LABEL));
@@ -733,7 +731,6 @@ void UserManagerScreenHandler::GetLocalizedValues(
localized_strings->SetString("publicSessionSelectLanguage", "");
localized_strings->SetString("publicSessionSelectKeyboard", "");
localized_strings->SetString("signinBannerText", "");
- localized_strings->SetString("launchAppButton", "");
localized_strings->SetString("multiProfilesRestrictedPolicyTitle", "");
localized_strings->SetString("multiProfilesNotAllowedPolicyMsg", "");
localized_strings->SetString("multiProfilesPrimaryOnlyPolicyMsg", "");
diff --git a/chromium/chrome/browser/ui/webui/signin/md_user_manager_ui.cc b/chromium/chrome/browser/ui/webui/signin/user_manager_ui.cc
index 7c65f834aaa..5b44baeee16 100644
--- a/chromium/chrome/browser/ui/webui/signin/md_user_manager_ui.cc
+++ b/chromium/chrome/browser/ui/webui/signin/user_manager_ui.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/signin/md_user_manager_ui.h"
+#include "chrome/browser/ui/webui/signin/user_manager_ui.h"
#include <memory>
#include <string>
@@ -27,8 +27,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/web_ui_util.h"
-MDUserManagerUI::MDUserManagerUI(content::WebUI* web_ui)
- : WebUIController(web_ui) {
+UserManagerUI::UserManagerUI(content::WebUI* web_ui) : WebUIController(web_ui) {
auto signin_create_profile_handler =
std::make_unique<SigninCreateProfileHandler>();
signin_create_profile_handler_ = signin_create_profile_handler.get();
@@ -44,17 +43,17 @@ MDUserManagerUI::MDUserManagerUI(content::WebUI* web_ui)
Profile* profile = Profile::FromWebUI(web_ui);
// Set up the chrome://md-user-manager/ source.
- auto* md_user_source = CreateUIDataSource(localized_strings);
- DarkModeHandler::Initialize(web_ui, md_user_source);
- content::WebUIDataSource::Add(profile, md_user_source);
+ auto* user_source = CreateUIDataSource(localized_strings);
+ DarkModeHandler::Initialize(web_ui, user_source);
+ content::WebUIDataSource::Add(profile, user_source);
// Set up the chrome://theme/ source
content::URLDataSource::Add(profile, std::make_unique<ThemeSource>(profile));
}
-MDUserManagerUI::~MDUserManagerUI() {}
+UserManagerUI::~UserManagerUI() {}
-content::WebUIDataSource* MDUserManagerUI::CreateUIDataSource(
+content::WebUIDataSource* UserManagerUI::CreateUIDataSource(
const base::DictionaryValue& localized_strings) {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIMdUserManagerHost);
@@ -66,35 +65,34 @@ content::WebUIDataSource* MDUserManagerUI::CreateUIDataSource(
source->SetJsonPath("strings.js");
- source->AddResourcePath("control_bar.html", IDR_MD_CONTROL_BAR_HTML);
- source->AddResourcePath("control_bar.js", IDR_MD_CONTROL_BAR_JS);
- source->AddResourcePath("create_profile.html", IDR_MD_CREATE_PROFILE_HTML);
- source->AddResourcePath("create_profile.js", IDR_MD_CREATE_PROFILE_JS);
- source->AddResourcePath("error_dialog.html", IDR_MD_ERROR_DIALOG_HTML);
- source->AddResourcePath("error_dialog.js", IDR_MD_ERROR_DIALOG_JS);
+ source->AddResourcePath("control_bar.html", IDR_CONTROL_BAR_HTML);
+ source->AddResourcePath("control_bar.js", IDR_CONTROL_BAR_JS);
+ source->AddResourcePath("create_profile.html", IDR_CREATE_PROFILE_HTML);
+ source->AddResourcePath("create_profile.js", IDR_CREATE_PROFILE_JS);
+ source->AddResourcePath("error_dialog.html", IDR_ERROR_DIALOG_HTML);
+ source->AddResourcePath("error_dialog.js", IDR_ERROR_DIALOG_JS);
source->AddResourcePath("profile_browser_proxy.html",
- IDR_MD_PROFILE_BROWSER_PROXY_HTML);
+ IDR_PROFILE_BROWSER_PROXY_HTML);
source->AddResourcePath("profile_browser_proxy.js",
- IDR_MD_PROFILE_BROWSER_PROXY_JS);
+ IDR_PROFILE_BROWSER_PROXY_JS);
source->AddResourcePath("shared_styles.html",
- IDR_MD_USER_MANAGER_SHARED_STYLES_HTML);
- source->AddResourcePath("strings.html", IDR_MD_USER_MANAGER_STRINGS_HTML);
- source->AddResourcePath("user_manager.js", IDR_MD_USER_MANAGER_JS);
+ IDR_USER_MANAGER_SHARED_STYLES_HTML);
+ source->AddResourcePath("strings.html", IDR_USER_MANAGER_STRINGS_HTML);
+ source->AddResourcePath("user_manager.js", IDR_USER_MANAGER_JS);
source->AddResourcePath("user_manager_pages.html",
- IDR_MD_USER_MANAGER_PAGES_HTML);
- source->AddResourcePath("user_manager_pages.js",
- IDR_MD_USER_MANAGER_PAGES_JS);
+ IDR_USER_MANAGER_PAGES_HTML);
+ source->AddResourcePath("user_manager_pages.js", IDR_USER_MANAGER_PAGES_JS);
source->AddResourcePath("user_manager_tutorial.html",
- IDR_MD_USER_MANAGER_TUTORIAL_HTML);
+ IDR_USER_MANAGER_TUTORIAL_HTML);
source->AddResourcePath("user_manager_tutorial.js",
- IDR_MD_USER_MANAGER_TUTORIAL_JS);
+ IDR_USER_MANAGER_TUTORIAL_JS);
- source->SetDefaultResource(IDR_MD_USER_MANAGER_HTML);
+ source->SetDefaultResource(IDR_USER_MANAGER_HTML);
return source;
}
-void MDUserManagerUI::GetLocalizedStrings(
+void UserManagerUI::GetLocalizedStrings(
base::DictionaryValue* localized_strings) {
user_manager_screen_handler_->GetLocalizedValues(localized_strings);
signin_create_profile_handler_->GetLocalizedValues(localized_strings);
diff --git a/chromium/chrome/browser/ui/webui/signin/md_user_manager_ui.h b/chromium/chrome/browser/ui/webui/signin/user_manager_ui.h
index 14c875d1cd0..3a346cfd302 100644
--- a/chromium/chrome/browser/ui/webui/signin/md_user_manager_ui.h
+++ b/chromium/chrome/browser/ui/webui/signin/user_manager_ui.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_MD_USER_MANAGER_UI_H_
-#define CHROME_BROWSER_UI_WEBUI_SIGNIN_MD_USER_MANAGER_UI_H_
+#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_UI_H_
#include "base/macros.h"
#include "content/public/browser/web_ui_controller.h"
@@ -19,10 +19,10 @@ class WebUIDataSource;
}
// A WebUI dialog to display available users.
-class MDUserManagerUI : public content::WebUIController {
+class UserManagerUI : public content::WebUIController {
public:
- explicit MDUserManagerUI(content::WebUI* web_ui);
- ~MDUserManagerUI() override;
+ explicit UserManagerUI(content::WebUI* web_ui);
+ ~UserManagerUI() override;
private:
content::WebUIDataSource* CreateUIDataSource(
@@ -32,7 +32,7 @@ class MDUserManagerUI : public content::WebUIController {
SigninCreateProfileHandler* signin_create_profile_handler_ = nullptr;
UserManagerScreenHandler* user_manager_screen_handler_ = nullptr;
- DISALLOW_COPY_AND_ASSIGN(MDUserManagerUI);
+ DISALLOW_COPY_AND_ASSIGN(UserManagerUI);
};
-#endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_MD_USER_MANAGER_UI_H_
+#endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_UI_H_
diff --git a/chromium/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc
index d151d564554..decbaaf0e62 100644
--- a/chromium/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc
@@ -86,7 +86,9 @@ IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageLoads) {
EXPECT_EQ(num_pods, static_cast<int>(profile_manager->GetNumberOfProfiles()));
}
-IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageRedirectsToAboutChrome) {
+// https://crbug.com/945795
+IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest,
+ DISABLED_PageRedirectsToAboutChrome) {
std::string user_manager_url = chrome::kChromeUIMdUserManagerUrl;
user_manager_url += profiles::kUserManagerSelectProfileAboutChrome;
diff --git a/chromium/chrome/browser/ui/webui/signin_internals_ui.cc b/chromium/chrome/browser/ui/webui/signin_internals_ui.cc
index 3ff768b7187..97820239ac8 100644
--- a/chromium/chrome/browser/ui/webui/signin_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/signin_internals_ui.cc
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "base/hash.h"
+#include "base/hash/hash.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/about_signin_internals_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
diff --git a/chromium/chrome/browser/ui/webui/site_settings_helper.cc b/chromium/chrome/browser/ui/webui/site_settings_helper.cc
index 13ae60fb8b7..c0be6a6970d 100644
--- a/chromium/chrome/browser/ui/webui/site_settings_helper.cc
+++ b/chromium/chrome/browser/ui/webui/site_settings_helper.cc
@@ -17,6 +17,8 @@
#include "chrome/browser/permissions/permission_manager.h"
#include "chrome/browser/permissions/permission_result.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/serial/serial_chooser_context.h"
+#include "chrome/browser/serial/serial_chooser_context_factory.h"
#include "chrome/browser/usb/usb_chooser_context.h"
#include "chrome/browser/usb/usb_chooser_context_factory.h"
#include "chrome/common/pref_names.h"
@@ -50,6 +52,7 @@ typedef std::map<std::pair<GURL, std::string>, OneOriginObjects>
// Chooser data group names.
const char kUsbChooserDataGroupType[] = "usb-devices-data";
+const char kSerialChooserDataGroupType[] = "serial-ports-data";
const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
// The following ContentSettingsTypes have UI in Content Settings
@@ -79,6 +82,8 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
{CONTENT_SETTINGS_TYPE_USB_GUARD, "usb-devices"},
{CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, kUsbChooserDataGroupType},
{CONTENT_SETTINGS_TYPE_IDLE_DETECTION, "idle-detection"},
+ {CONTENT_SETTINGS_TYPE_SERIAL_GUARD, "serial-ports"},
+ {CONTENT_SETTINGS_TYPE_SERIAL_CHOOSER_DATA, kSerialChooserDataGroupType},
// Add new content settings here if a corresponding Javascript string
// representation for it is not required. Note some exceptions do have UI in
@@ -104,9 +109,6 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
{CONTENT_SETTINGS_TYPE_PLUGINS_DATA, nullptr},
{CONTENT_SETTINGS_TYPE_BACKGROUND_FETCH, nullptr},
{CONTENT_SETTINGS_TYPE_INTENT_PICKER_DISPLAY, nullptr},
- // TODO(crbug.com/908836): Add UI for setting this permission.
- {CONTENT_SETTINGS_TYPE_SERIAL_GUARD, nullptr},
- {CONTENT_SETTINGS_TYPE_SERIAL_CHOOSER_DATA, nullptr},
};
static_assert(base::size(kContentSettingsTypeGroupNames) ==
// ContentSettingsType starts at -1, so add 1 here.
@@ -240,8 +242,13 @@ ChooserContextBase* GetUsbChooserContext(Profile* profile) {
return UsbChooserContextFactory::GetForProfile(profile);
}
+ChooserContextBase* GetSerialChooserContext(Profile* profile) {
+ return SerialChooserContextFactory::GetForProfile(profile);
+}
+
const ChooserTypeNameEntry kChooserTypeGroupNames[] = {
{&GetUsbChooserContext, kUsbChooserDataGroupType},
+ {&GetSerialChooserContext, kSerialChooserDataGroupType},
};
} // namespace
diff --git a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom
index d7793d4a040..fc2b659f93f 100644
--- a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom
+++ b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom
@@ -58,12 +58,6 @@ interface PageHandler {
// Fetch suggestions in background after the given delay.
FetchSuggestionsInBackground(int64 delaySeconds) => ();
- // Returns if it's possible to push a dummy suggestion.
- IsPushingDummySuggestionPossible() => (bool result);
-
- // Push dummy suggestion in background after the given delay.
- PushDummySuggestionInBackground(int64 delaySeconds) => ();
-
// Download the last suggestions in json form.
GetLastJson() => (string json);
@@ -80,4 +74,4 @@ interface PageHandler {
// Frontend interface.
interface Page {
OnSuggestionsChanged();
-}; \ No newline at end of file
+};
diff --git a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.cc b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.cc
index 79ae30bb0b0..9102e5dd8d0 100644
--- a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.cc
+++ b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.cc
@@ -11,9 +11,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/time/time_to_iso8601.h"
#include "chrome/browser/android/ntp/android_content_suggestions_notifier.h"
-#include "chrome/browser/ntp_snippets/dependent_features.h"
#include "chrome/common/pref_names.h"
#include "components/ntp_snippets/category_info.h"
#include "components/ntp_snippets/features.h"
@@ -25,13 +23,10 @@
#include "components/offline_pages/core/offline_page_feature.h"
#include "components/variations/variations_associated_data.h"
-using ntp_snippets::AreAssetDownloadsEnabled;
-using ntp_snippets::AreOfflinePageDownloadsEnabled;
using ntp_snippets::Category;
using ntp_snippets::CategoryInfo;
using ntp_snippets::CategoryStatus;
using ntp_snippets::ContentSuggestion;
-using ntp_snippets::IsBookmarkProviderEnabled;
using ntp_snippets::RemoteSuggestionsProvider;
using ntp_snippets::RemoteSuggestionsFetcher;
using ntp_snippets::UserClassifier;
@@ -66,16 +61,6 @@ std::string BooleanToString(bool value) {
return value ? "True" : "False";
}
-ntp_snippets::BreakingNewsListener* GetBreakingNewsListener(
- ntp_snippets::ContentSuggestionsService* service) {
- DCHECK(service);
- RemoteSuggestionsProvider* provider =
- service->remote_suggestions_provider_for_debugging();
- DCHECK(provider);
- return static_cast<ntp_snippets::RemoteSuggestionsProviderImpl*>(provider)
- ->breaking_news_listener_for_debugging();
-}
-
std::string GetCategoryStatusName(CategoryStatus status) {
switch (status) {
case CategoryStatus::INITIALIZING:
@@ -171,12 +156,6 @@ void SnippetsInternalsPageHandler::GetGeneralProperties(
properties["flag-offlining-recent-pages-feature"] =
BooleanToString(base::FeatureList::IsEnabled(
offline_pages::kOffliningRecentPagesFeature));
- properties["flag-asset-download-suggestions"] =
- BooleanToString(AreAssetDownloadsEnabled());
- properties["flag-offline-page-download-suggestions"] =
- BooleanToString(AreOfflinePageDownloadsEnabled());
- properties["flag-bookmark-suggestions"] =
- BooleanToString(IsBookmarkProviderEnabled());
if (remote_suggestions_provider_) {
const ntp_snippets::RemoteSuggestionsFetcher* fetcher =
@@ -288,67 +267,6 @@ void SnippetsInternalsPageHandler::FetchSuggestionsInBackgroundImpl(
std::move(callback).Run();
}
-void SnippetsInternalsPageHandler::IsPushingDummySuggestionPossible(
- IsPushingDummySuggestionPossibleCallback callback) {
- ntp_snippets::BreakingNewsListener* listener =
- GetBreakingNewsListener(content_suggestions_service_);
-
- std::move(callback).Run(listener != nullptr && listener->IsListening());
-}
-
-void SnippetsInternalsPageHandler::PushDummySuggestionInBackground(
- int64_t delaySeconds,
- PushDummySuggestionInBackgroundCallback callback) {
- DCHECK(delaySeconds >= 0);
- suggestion_push_timer_.Start(
- FROM_HERE, base::TimeDelta::FromSeconds(delaySeconds),
- base::BindRepeating(
- &SnippetsInternalsPageHandler::PushDummySuggestionInBackgroundImpl,
- weak_ptr_factory_.GetWeakPtr(), base::Passed(std::move(callback))));
-}
-
-void SnippetsInternalsPageHandler::PushDummySuggestionInBackgroundImpl(
- PushDummySuggestionInBackgroundCallback callback) {
- std::string json = R"(
- {"categories" : [{
- "id": 1,
- "localizedTitle": "section title",
- "suggestions" : [{
- "ids" : ["http://url.com"],
- "title" : "Pushed Dummy Title %s",
- "snippet" : "Pushed Dummy Snippet",
- "fullPageUrl" : "http://url.com",
- "creationTime" : "%s",
- "expirationTime" : "%s",
- "attribution" : "Pushed Dummy Publisher",
- "imageUrl" : "https://www.google.com/favicon.ico",
- "notificationInfo": {
- "shouldNotify": true,
- "deadline": "2100-01-01T00:00:01.000Z"
- }
- }]
- }]}
- )";
-
- const base::Time now = base::Time::Now();
- json = base::StringPrintf(
- json.c_str(), base::UTF16ToUTF8(base::TimeFormatTimeOfDay(now)).c_str(),
- base::TimeToISO8601(now).c_str(),
- base::TimeToISO8601(now + base::TimeDelta::FromMinutes(60)).c_str());
-
- gcm::IncomingMessage message;
- message.data["payload"] = json;
-
- ntp_snippets::BreakingNewsListener* listener =
- GetBreakingNewsListener(content_suggestions_service_);
- DCHECK(listener);
- DCHECK(listener->IsListening());
- static_cast<ntp_snippets::BreakingNewsGCMAppHandler*>(listener)->OnMessage(
- "com.google.breakingnews.gcm", message);
-
- std::move(callback).Run();
-}
-
void SnippetsInternalsPageHandler::GetLastJson(GetLastJsonCallback callback) {
std::string json = "";
if (remote_suggestions_provider_) {
diff --git a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.h b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.h
index b134684f11b..ae81aa26980 100644
--- a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.h
+++ b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.h
@@ -41,11 +41,6 @@ class SnippetsInternalsPageHandler
void FetchSuggestionsInBackground(
int64_t,
FetchSuggestionsInBackgroundCallback) override;
- void IsPushingDummySuggestionPossible(
- IsPushingDummySuggestionPossibleCallback) override;
- void PushDummySuggestionInBackground(
- int64_t,
- PushDummySuggestionInBackgroundCallback) override;
void GetLastJson(GetLastJsonCallback) override;
void ResetNotificationState() override;
void GetSuggestionsByCategory(GetSuggestionsByCategoryCallback) override;
@@ -64,8 +59,6 @@ class SnippetsInternalsPageHandler
void FetchSuggestionsInBackgroundImpl(FetchSuggestionsInBackgroundCallback);
void GetSuggestionsByCategoryImpl(GetSuggestionsByCategoryCallback);
- void PushDummySuggestionInBackgroundImpl(
- PushDummySuggestionInBackgroundCallback);
// Misc. methods.
void CollectDismissedSuggestions(
@@ -94,7 +87,6 @@ class SnippetsInternalsPageHandler
// Timers to delay actions.
base::OneShotTimer suggestion_fetch_timer_;
- base::OneShotTimer suggestion_push_timer_;
// Handle back to the page by which we can update.
snippets_internals::mojom::PagePtr page_;
diff --git a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.cc b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.cc
index 30018dba934..84543434b39 100644
--- a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.cc
@@ -24,8 +24,8 @@ SnippetsInternalsUI::SnippetsInternalsUI(content::WebUI* web_ui)
"script-src chrome://resources 'self' 'unsafe-eval';");
source->AddResourcePath("snippets_internals.css", IDR_SNIPPETS_INTERNALS_CSS);
source->AddResourcePath("snippets_internals.js", IDR_SNIPPETS_INTERNALS_JS);
- source->AddResourcePath("snippets_internals.mojom.js",
- IDR_SNIPPETS_INTERNALS_MOJO_JS);
+ source->AddResourcePath("snippets_internals.mojom-lite.js",
+ IDR_SNIPPETS_INTERNALS_MOJOM_LITE_JS);
source->SetDefaultResource(IDR_SNIPPETS_INTERNALS_HTML);
source->UseGzip();
diff --git a/chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.cc b/chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.cc
index 005362663de..6416cb4247e 100644
--- a/chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.cc
@@ -242,10 +242,11 @@ void SupervisedUserInternalsMessageHandler::SendBasicInfo() {
// Trigger retrieval of the user settings
SupervisedUserSettingsService* settings_service =
- SupervisedUserSettingsServiceFactory::GetForProfile(profile);
- user_settings_subscription_ = settings_service->Subscribe(base::Bind(
- &SupervisedUserInternalsMessageHandler::SendSupervisedUserSettings,
- weak_factory_.GetWeakPtr()));
+ SupervisedUserSettingsServiceFactory::GetForKey(profile->GetProfileKey());
+ user_settings_subscription_ =
+ settings_service->SubscribeForSettingsChange(base::Bind(
+ &SupervisedUserInternalsMessageHandler::SendSupervisedUserSettings,
+ weak_factory_.GetWeakPtr()));
}
void SupervisedUserInternalsMessageHandler::SendSupervisedUserSettings(
diff --git a/chromium/chrome/browser/ui/webui/sync_internals_browsertest.js b/chromium/chrome/browser/ui/webui/sync_internals_browsertest.js
index 11b09eaecf9..ede567340a8 100644
--- a/chromium/chrome/browser/ui/webui/sync_internals_browsertest.js
+++ b/chromium/chrome/browser/ui/webui/sync_internals_browsertest.js
@@ -242,16 +242,31 @@ TEST_F('SyncInternalsWebUITest', 'Uninitialized', function() {
assertNotEquals(null, chrome.sync.aboutInfo);
});
-// TODO(crbug.com/814787): On ChromeOS, browser tests are signed in by default,
-// so the test expectations below should be different. However, the way the
-// account is set up for tests is broken (it happens much later than in real
-// life), so it doesn't make it to sync-internals.
-TEST_F('SyncInternalsWebUITest', 'SignedOut', function() {
+GEN('#if defined(OS_CHROMEOS)');
+
+// On ChromeOS, browser tests are signed in by default to mimic production,
+// so the sync transport layer should be enabled. Note that the sync *feature*
+// might still be disabled depending on how the test infrastructure is
+// configured.
+TEST_F('SyncInternalsWebUITest', 'SyncTransportEnabledByDefault', function() {
+ // The specific transport state is dependent on the timing of startup, but it
+ // should not be disabled.
+ expectFalse(this.hasInDetails(true, 'Transport State', 'Disabled'));
+});
+
+GEN('#else');
+
+// On non-ChromeOS, sync should be disabled if there was no primary account
+// set.
+TEST_F('SyncInternalsWebUITest', 'SyncDisabledByDefault', function() {
expectTrue(this.hasInDetails(true, 'Transport State', 'Disabled'));
- expectTrue(this.hasInDetails(true, 'Disable Reasons', 'Not signed in'));
+ expectTrue(
+ this.hasInDetails(true, 'Disable Reasons', 'Not signed in, User choice'));
expectTrue(this.hasInDetails(true, 'Username', ''));
});
+GEN('#endif // defined(OS_CHROMEOS)');
+
TEST_F('SyncInternalsWebUITest', 'LoadPastedAboutInfo', function() {
// Expose the text field.
$('import-status').click();
diff --git a/chromium/chrome/browser/ui/webui/sync_internals_message_handler.cc b/chromium/chrome/browser/ui/webui/sync_internals_message_handler.cc
index b7e652cf428..dbcae7e4057 100644
--- a/chromium/chrome/browser/ui/webui/sync_internals_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/sync_internals_message_handler.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/feature_list.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/profiles/profile.h"
@@ -253,7 +252,7 @@ void SyncInternalsMessageHandler::HandleGetAllNodes(const ListValue* args) {
// asynchronously, and potentially at times we're not allowed to call into
// the javascript side. We guard against this by invalidating this weak ptr
// should javascript become disallowed.
- service->GetAllNodes(
+ service->GetAllNodesForDebugging(
base::Bind(&SyncInternalsMessageHandler::OnReceivedAllNodes,
weak_ptr_factory_.GetWeakPtr(), request_id));
}
@@ -263,9 +262,10 @@ void SyncInternalsMessageHandler::HandleRequestUserEventsVisibility(
const base::ListValue* args) {
DCHECK(args->empty());
AllowJavascript();
- CallJavascriptFunction(
- syncer::sync_ui_util::kUserEventsVisibilityCallback,
- Value(base::FeatureList::IsEnabled(switches::kSyncUserEvents)));
+ // TODO(crbug.com/934333): Get rid of this callback now that user events are
+ // always enabled.
+ CallJavascriptFunction(syncer::sync_ui_util::kUserEventsVisibilityCallback,
+ Value(true));
}
void SyncInternalsMessageHandler::HandleSetIncludeSpecifics(
diff --git a/chromium/chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc b/chromium/chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc
index 3b37b29bc14..86df2a387b3 100644
--- a/chromium/chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/sync/user_event_service_factory.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
-#include "components/browser_sync/browser_sync_switches.h"
#include "components/sync/driver/about_sync_util.h"
#include "components/sync/driver/fake_sync_service.h"
#include "components/sync/driver/sync_service.h"
@@ -66,8 +65,9 @@ class TestSyncService : public syncer::FakeSyncService {
return js_controller_.AsWeakPtr();
}
- void GetAllNodes(const base::Callback<void(std::unique_ptr<base::ListValue>)>&
- callback) override {
+ void GetAllNodesForDebugging(
+ const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback)
+ override {
get_all_nodes_callback_ = std::move(callback);
}
diff --git a/chromium/chrome/browser/ui/webui/test_files_request_filter.cc b/chromium/chrome/browser/ui/webui/test_files_request_filter.cc
index e4cdc784e20..8255db505db 100644
--- a/chromium/chrome/browser/ui/webui/test_files_request_filter.cc
+++ b/chromium/chrome/browser/ui/webui/test_files_request_filter.cc
@@ -14,27 +14,37 @@
namespace {
-bool HandleTestFileRequestCallback(
- const std::string& path,
- const content::WebUIDataSource::GotDataCallback& callback) {
- base::ScopedAllowBlockingForTesting allow_blocking;
+bool ShouldHandleTestFileRequestCallback(const std::string& path) {
std::vector<std::string> url_substr =
base::SplitString(path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (url_substr.size() != 2 || url_substr[0] != "test")
return false;
+ base::ScopedAllowBlockingForTesting allow_blocking;
+ base::FilePath test_data_dir;
+ base::PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
+ return base::PathExists(
+ test_data_dir.AppendASCII("webui").AppendASCII(url_substr[1]));
+}
+
+void HandleTestFileRequestCallback(
+ const std::string& path,
+ const content::WebUIDataSource::GotDataCallback& callback) {
+ DCHECK(ShouldHandleTestFileRequestCallback(path));
+ base::ScopedAllowBlockingForTesting allow_blocking;
+
+ std::vector<std::string> url_substr =
+ base::SplitString(path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
std::string contents;
base::FilePath test_data_dir;
base::PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
- if (!base::ReadFileToString(
- test_data_dir.AppendASCII("webui").AppendASCII(url_substr[1]),
- &contents))
- return false;
+ CHECK(base::ReadFileToString(
+ test_data_dir.AppendASCII("webui").AppendASCII(url_substr[1]),
+ &contents));
base::RefCountedString* ref_contents = new base::RefCountedString();
ref_contents->data() = contents;
callback.Run(ref_contents);
- return true;
}
} // namespace
@@ -45,4 +55,9 @@ content::WebUIDataSource::HandleRequestCallback GetTestFilesRequestFilter() {
return base::Bind(&HandleTestFileRequestCallback);
}
+content::WebUIDataSource::ShouldHandleRequestCallback
+GetTestShouldHandleRequest() {
+ return base::BindRepeating(&ShouldHandleTestFileRequestCallback);
+}
+
} // namespace test
diff --git a/chromium/chrome/browser/ui/webui/test_files_request_filter.h b/chromium/chrome/browser/ui/webui/test_files_request_filter.h
index e6e49bd7e6c..b17b09a678f 100644
--- a/chromium/chrome/browser/ui/webui/test_files_request_filter.h
+++ b/chromium/chrome/browser/ui/webui/test_files_request_filter.h
@@ -14,6 +14,10 @@ namespace test {
// request path has "/test/<filename>" format.
content::WebUIDataSource::HandleRequestCallback GetTestFilesRequestFilter();
+// Returns a callback indicating which requests should be handled by the filter.
+content::WebUIDataSource::ShouldHandleRequestCallback
+GetTestShouldHandleRequest();
+
} // namespace test
#endif // CHROME_BROWSER_UI_WEBUI_TEST_FILES_REQUEST_FILTER_H_
diff --git a/chromium/chrome/browser/ui/webui/theme_handler.cc b/chromium/chrome/browser/ui/webui/theme_handler.cc
index d0696a73f7b..033a87dbafe 100644
--- a/chromium/chrome/browser/ui/webui/theme_handler.cc
+++ b/chromium/chrome/browser/ui/webui/theme_handler.cc
@@ -6,6 +6,7 @@
#include <memory>
+#include "base/bind.h"
#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
@@ -15,38 +16,64 @@
#include "chrome/grit/theme_resources.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_ui.h"
+#include "ui/native_theme/native_theme.h"
///////////////////////////////////////////////////////////////////////////////
// ThemeHandler
-ThemeHandler::ThemeHandler() {
-}
+ThemeHandler::ThemeHandler() : theme_observer_(this) {}
-ThemeHandler::~ThemeHandler() {
-}
+ThemeHandler::~ThemeHandler() {}
void ThemeHandler::RegisterMessages() {
// These are not actual message registrations, but can't be done in the
// constructor since they need the web_ui value to be set, which is done
// post-construction, but before registering messages.
InitializeCSSCaches();
+ web_ui()->RegisterMessageCallback(
+ "observeThemeChanges",
+ base::BindRepeating(&ThemeHandler::HandleObserveThemeChanges,
+ base::Unretained(this)));
+}
+
+void ThemeHandler::OnJavascriptAllowed() {
// Listen for theme installation.
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(
ThemeServiceFactory::GetForProfile(GetProfile())));
+ // Or native theme change.
+ theme_observer_.Add(ui::NativeTheme::GetInstanceForNativeUi());
+}
+
+void ThemeHandler::OnJavascriptDisallowed() {
+ registrar_.RemoveAll();
+ theme_observer_.RemoveAll();
}
void ThemeHandler::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type);
+ SendThemeChanged();
+}
+
+void ThemeHandler::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) {
+ DCHECK_EQ(observed_theme, ui::NativeTheme::GetInstanceForNativeUi());
+ SendThemeChanged();
+}
+
+void ThemeHandler::HandleObserveThemeChanges(const base::ListValue* /*args*/) {
+ AllowJavascript();
+}
+
+void ThemeHandler::SendThemeChanged() {
InitializeCSSCaches();
bool has_custom_bg = ThemeService::GetThemeProviderForProfile(GetProfile())
.HasCustomImage(IDR_THEME_NTP_BACKGROUND);
// TODO(dbeam): why does this need to be a dictionary?
base::DictionaryValue dictionary;
dictionary.SetBoolean("hasCustomBackground", has_custom_bg);
- web_ui()->CallJavascriptFunctionUnsafe("ntp.themeChanged", dictionary);
+ CallJavascriptFunction("ntp.themeChanged", dictionary);
}
void ThemeHandler::InitializeCSSCaches() {
diff --git a/chromium/chrome/browser/ui/webui/theme_handler.h b/chromium/chrome/browser/ui/webui/theme_handler.h
index 7c2b88b2514..5e52e81d1cd 100644
--- a/chromium/chrome/browser/ui/webui/theme_handler.h
+++ b/chromium/chrome/browser/ui/webui/theme_handler.h
@@ -6,22 +6,31 @@
#define CHROME_BROWSER_UI_WEBUI_THEME_HANDLER_H_
#include "base/macros.h"
+#include "base/scoped_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "ui/native_theme/native_theme_observer.h"
class Profile;
+namespace ui {
+class NativeTheme;
+}
+
// A class to keep the ThemeSource up to date when theme changes.
class ThemeHandler : public content::WebUIMessageHandler,
- public content::NotificationObserver {
+ public content::NotificationObserver,
+ public ui::NativeThemeObserver {
public:
- explicit ThemeHandler();
+ ThemeHandler();
~ThemeHandler() override;
private:
- // content::WebUIMessageHandler implementation.
+ // content::WebUIMessageHandler:
void RegisterMessages() override;
+ void OnJavascriptAllowed() override;
+ void OnJavascriptDisallowed() override;
// Re/set the CSS caches.
void InitializeCSSCaches();
@@ -31,10 +40,21 @@ class ThemeHandler : public content::WebUIMessageHandler,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
+ // ui::NativeThemeObserver:
+ void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
+
+ // Handler for "observeThemeChanges" chrome.send() message. No arguments.
+ void HandleObserveThemeChanges(const base::ListValue* args);
+
+ // Notify the page (if allowed) that the theme has changed.
+ void SendThemeChanged();
+
Profile* GetProfile() const;
content::NotificationRegistrar registrar_;
+ ScopedObserver<ui::NativeTheme, ThemeHandler> theme_observer_;
+
DISALLOW_COPY_AND_ASSIGN(ThemeHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.cc b/chromium/chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.cc
new file mode 100644
index 00000000000..79aa2f83dfa
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.cc
@@ -0,0 +1,88 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.h"
+
+#include <map>
+#include <utility>
+#include <vector>
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/values.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/translate/chrome_translate_client.h"
+#include "chrome/browser/translate/translate_service.h"
+#include "chrome/common/pref_names.h"
+#include "components/language/core/browser/pref_names.h"
+#include "components/prefs/pref_service.h"
+#include "components/translate/core/browser/translate_download_manager.h"
+#include "components/translate/core/browser/translate_error_details.h"
+#include "components/translate/core/browser/translate_event_details.h"
+#include "components/translate/core/browser/translate_pref_names.h"
+#include "components/translate/core/browser/translate_prefs.h"
+#include "components/translate/core/common/language_detection_details.h"
+#include "components/variations/service/variations_service.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_types.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_ui.h"
+
+ChromeTranslateInternalsHandler::ChromeTranslateInternalsHandler() {
+ notification_registrar_.Add(this,
+ chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
+ content::NotificationService::AllSources());
+}
+
+ChromeTranslateInternalsHandler::~ChromeTranslateInternalsHandler() {}
+
+translate::TranslateClient*
+ChromeTranslateInternalsHandler::GetTranslateClient() {
+ return ChromeTranslateClient::FromWebContents(web_ui()->GetWebContents());
+}
+
+variations::VariationsService*
+ChromeTranslateInternalsHandler::GetVariationsService() {
+ return g_browser_process->variations_service();
+}
+
+void ChromeTranslateInternalsHandler::RegisterMessageCallback(
+ const std::string& message,
+ const MessageCallback& callback) {
+ web_ui()->RegisterMessageCallback(message, callback);
+}
+
+void ChromeTranslateInternalsHandler::CallJavascriptFunction(
+ const std::string& function_name,
+ const std::vector<const base::Value*>& args) {
+ web_ui()->CallJavascriptFunctionUnsafe(function_name, args);
+}
+
+void ChromeTranslateInternalsHandler::RegisterMessages() {
+ RegisterMessageCallbacks();
+}
+
+void ChromeTranslateInternalsHandler::Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ DCHECK_EQ(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, type);
+
+ content::WebContents* web_contents =
+ content::Source<content::WebContents>(source).ptr();
+ const translate::LanguageDetectionDetails* language_detection_details =
+ content::Details<const translate::LanguageDetectionDetails>(details)
+ .ptr();
+ if (web_contents->GetBrowserContext()->IsOffTheRecord() ||
+ !GetTranslateClient()->IsTranslatableURL(
+ language_detection_details->url)) {
+ return;
+ }
+
+ AddLanguageDetectionDetails(*language_detection_details);
+}
diff --git a/chromium/chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.h b/chromium/chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.h
new file mode 100644
index 00000000000..0b5ea14feaf
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.h
@@ -0,0 +1,48 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_CHROME_TRANSLATE_INTERNALS_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_CHROME_TRANSLATE_INTERNALS_HANDLER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "components/translate/translate_internals/translate_internals_handler.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/web_ui_message_handler.h"
+
+// The handler for JavaScript messages for chrome://translate-internals.
+class ChromeTranslateInternalsHandler
+ : public translate::TranslateInternalsHandler,
+ public content::WebUIMessageHandler,
+ public content::NotificationObserver {
+ public:
+ ChromeTranslateInternalsHandler();
+ ~ChromeTranslateInternalsHandler() override;
+
+ // translate::TranslateInternalsHandler.
+ translate::TranslateClient* GetTranslateClient() override;
+ variations::VariationsService* GetVariationsService() override;
+ void RegisterMessageCallback(const std::string& message,
+ const MessageCallback& callback) override;
+ void CallJavascriptFunction(
+ const std::string& function_name,
+ const std::vector<const base::Value*>& args) override;
+
+ // content::WebUIMessageHandler methods:
+ void RegisterMessages() override;
+
+ // content::NotificationObserver implementation:
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) override;
+
+ private:
+ content::NotificationRegistrar notification_registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeTranslateInternalsHandler);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_CHROME_TRANSLATE_INTERNALS_HANDLER_H_ \ No newline at end of file
diff --git a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc b/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc
deleted file mode 100644
index a6b217624a4..00000000000
--- a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc
+++ /dev/null
@@ -1,277 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/translate_internals/translate_internals_handler.h"
-
-#include <map>
-#include <utility>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/values.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/translate/chrome_translate_client.h"
-#include "chrome/browser/translate/translate_service.h"
-#include "chrome/common/pref_names.h"
-#include "components/language/core/browser/pref_names.h"
-#include "components/prefs/pref_service.h"
-#include "components/translate/core/browser/translate_download_manager.h"
-#include "components/translate/core/browser/translate_error_details.h"
-#include "components/translate/core/browser/translate_event_details.h"
-#include "components/translate/core/browser/translate_pref_names.h"
-#include "components/translate/core/browser/translate_prefs.h"
-#include "components/translate/core/common/language_detection_details.h"
-#include "components/variations/service/variations_service.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_source.h"
-#include "content/public/browser/notification_types.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_ui.h"
-
-TranslateInternalsHandler::TranslateInternalsHandler() {
- notification_registrar_.Add(this,
- chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
- content::NotificationService::AllSources());
-
- error_subscription_ =
- translate::TranslateManager::RegisterTranslateErrorCallback(
- base::Bind(&TranslateInternalsHandler::OnTranslateError,
- base::Unretained(this)));
-
- translate::TranslateLanguageList* language_list =
- translate::TranslateDownloadManager::GetInstance()->language_list();
- if (!language_list) {
- NOTREACHED();
- return;
- }
-
- event_subscription_ = language_list->RegisterEventCallback(base::Bind(
- &TranslateInternalsHandler::OnTranslateEvent, base::Unretained(this)));
-}
-
-TranslateInternalsHandler::~TranslateInternalsHandler() {
- // |event_subscription_| and |error_subscription_| are deleted automatically
- // and un-register the callbacks automatically.
-}
-
-void TranslateInternalsHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "removePrefItem",
- base::BindRepeating(&TranslateInternalsHandler::OnRemovePrefItem,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "setRecentTargetLanguage",
- base::BindRepeating(&TranslateInternalsHandler::OnSetRecentTargetLanguage,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "requestInfo",
- base::BindRepeating(&TranslateInternalsHandler::OnRequestInfo,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "overrideCountry",
- base::BindRepeating(&TranslateInternalsHandler::OnOverrideCountry,
- base::Unretained(this)));
-}
-
-void TranslateInternalsHandler::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, type);
- const translate::LanguageDetectionDetails* language_detection_details =
- content::Details<const translate::LanguageDetectionDetails>(details)
- .ptr();
- content::WebContents* web_contents =
- content::Source<content::WebContents>(source).ptr();
-
- if (web_contents->GetBrowserContext()->IsOffTheRecord() ||
- !TranslateService::IsTranslatableURL(language_detection_details->url)) {
- return;
- }
-
- base::DictionaryValue dict;
- dict.SetDouble("time", language_detection_details->time.ToJsTime());
- dict.SetString("url", language_detection_details->url.spec());
- dict.SetString("content_language",
- language_detection_details->content_language);
- dict.SetString("cld_language", language_detection_details->cld_language);
- dict.SetBoolean("is_cld_reliable",
- language_detection_details->is_cld_reliable);
- dict.SetBoolean("has_notranslate",
- language_detection_details->has_notranslate);
- dict.SetString("html_root_language",
- language_detection_details->html_root_language);
- dict.SetString("adopted_language",
- language_detection_details->adopted_language);
- dict.SetString("content", language_detection_details->contents);
- SendMessageToJs("languageDetectionInfoAdded", dict);
-}
-
-void TranslateInternalsHandler::OnTranslateError(
- const translate::TranslateErrorDetails& details) {
- base::DictionaryValue dict;
- dict.SetDouble("time", details.time.ToJsTime());
- dict.SetString("url", details.url.spec());
- dict.SetInteger("error", details.error);
- SendMessageToJs("translateErrorDetailsAdded", dict);
-}
-
-void TranslateInternalsHandler::OnTranslateEvent(
- const translate::TranslateEventDetails& details) {
- base::DictionaryValue dict;
- dict.SetDouble("time", details.time.ToJsTime());
- dict.SetString("filename", details.filename);
- dict.SetInteger("line", details.line);
- dict.SetString("message", details.message);
- SendMessageToJs("translateEventDetailsAdded", dict);
-}
-
-void TranslateInternalsHandler::OnRemovePrefItem(const base::ListValue* args) {
- Profile* profile = Profile::FromWebUI(web_ui());
- PrefService* prefs = profile->GetOriginalProfile()->GetPrefs();
- std::unique_ptr<translate::TranslatePrefs> translate_prefs(
- ChromeTranslateClient::CreateTranslatePrefs(prefs));
-
- std::string pref_name;
- if (!args->GetString(0, &pref_name))
- return;
-
- if (pref_name == "blocked_languages") {
- std::string language;
- if (!args->GetString(1, &language))
- return;
- translate_prefs->UnblockLanguage(language);
- } else if (pref_name == "site_blacklist") {
- std::string site;
- if (!args->GetString(1, &site))
- return;
- translate_prefs->RemoveSiteFromBlacklist(site);
- } else if (pref_name == "whitelists") {
- std::string from, to;
- if (!args->GetString(1, &from))
- return;
- if (!args->GetString(2, &to))
- return;
- translate_prefs->RemoveLanguagePairFromWhitelist(from, to);
- } else if (pref_name == "too_often_denied") {
- translate_prefs->ResetDenialState();
- } else {
- return;
- }
-
- SendPrefsToJs();
-}
-
-void TranslateInternalsHandler::OnSetRecentTargetLanguage(
- const base::ListValue* args) {
- Profile* profile = Profile::FromWebUI(web_ui());
- PrefService* prefs = profile->GetOriginalProfile()->GetPrefs();
- std::unique_ptr<translate::TranslatePrefs> translate_prefs(
- ChromeTranslateClient::CreateTranslatePrefs(prefs));
-
- std::string new_value;
- if (!args->GetString(0, &new_value))
- return;
-
- translate_prefs->SetRecentTargetLanguage(new_value);
-
- SendPrefsToJs();
-}
-
-void TranslateInternalsHandler::OnOverrideCountry(const base::ListValue* args) {
- std::string country;
- if (args->GetString(0, &country)) {
- variations::VariationsService* variations_service =
- g_browser_process->variations_service();
- if (variations_service) {
- SendCountryToJs(
- variations_service->OverrideStoredPermanentCountry(country));
- }
- }
-}
-
-void TranslateInternalsHandler::OnRequestInfo(const base::ListValue* /*args*/) {
- SendPrefsToJs();
- SendSupportedLanguagesToJs();
- SendCountryToJs(false);
-}
-
-void TranslateInternalsHandler::SendMessageToJs(const std::string& message,
- const base::Value& value) {
- const char func[] = "cr.translateInternals.messageHandler";
- base::Value message_data(message);
- web_ui()->CallJavascriptFunctionUnsafe(func, message_data, value);
-}
-
-void TranslateInternalsHandler::SendPrefsToJs() {
- Profile* profile = Profile::FromWebUI(web_ui());
- PrefService* prefs = profile->GetOriginalProfile()->GetPrefs();
-
- base::DictionaryValue dict;
-
- static const char* const keys[] = {
- prefs::kOfferTranslateEnabled,
- translate::TranslatePrefs::kPrefTranslateRecentTarget,
- translate::TranslatePrefs::kPrefTranslateBlockedLanguages,
- translate::TranslatePrefs::kPrefTranslateSiteBlacklistDeprecated,
- translate::TranslatePrefs::kPrefTranslateSiteBlacklistWithTime,
- translate::TranslatePrefs::kPrefTranslateWhitelists,
- translate::TranslatePrefs::kPrefTranslateDeniedCount,
- translate::TranslatePrefs::kPrefTranslateIgnoredCount,
- translate::TranslatePrefs::kPrefTranslateAcceptedCount,
- translate::TranslatePrefs::kPrefTranslateLastDeniedTimeForLanguage,
- translate::TranslatePrefs::kPrefTranslateTooOftenDeniedForLanguage,
- language::prefs::kAcceptLanguages,
- };
- for (const char* key : keys) {
- const PrefService::Preference* pref = prefs->FindPreference(key);
- if (pref)
- dict.SetKey(key, pref->GetValue()->Clone());
- }
-
- SendMessageToJs("prefsUpdated", dict);
-}
-
-void TranslateInternalsHandler::SendSupportedLanguagesToJs() {
- // Create translate prefs.
- Profile* profile = Profile::FromWebUI(web_ui());
- PrefService* prefs = profile->GetOriginalProfile()->GetPrefs();
- std::unique_ptr<translate::TranslatePrefs> translate_prefs(
- ChromeTranslateClient::CreateTranslatePrefs(prefs));
-
- // Fetch supported language information.
- std::vector<std::string> languages;
- translate::TranslateDownloadManager::GetSupportedLanguages(
- translate_prefs->IsTranslateAllowedByPolicy(), &languages);
- base::Time last_updated =
- translate::TranslateDownloadManager::GetSupportedLanguagesLastUpdated();
-
- auto languages_list = std::make_unique<base::ListValue>();
- for (const std::string& lang : languages)
- languages_list->AppendString(lang);
-
- base::DictionaryValue dict;
- dict.Set("languages", std::move(languages_list));
- dict.SetDouble("last_updated", last_updated.ToJsTime());
- SendMessageToJs("supportedLanguagesUpdated", dict);
-}
-
-void TranslateInternalsHandler::SendCountryToJs(bool was_updated) {
- std::string country;
- variations::VariationsService* variations_service =
- g_browser_process->variations_service();
- if (variations_service)
- country = variations_service->GetStoredPermanentCountry();
-
- base::DictionaryValue dict;
- if (!country.empty()) {
- dict.SetString("country", country);
- dict.SetBoolean("update", was_updated);
- }
- SendMessageToJs("countryUpdated", dict);
-}
diff --git a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.h b/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.h
deleted file mode 100644
index 5affaa27251..00000000000
--- a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_H_
-#define CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_H_
-
-#include <memory>
-#include <string>
-
-#include "base/callback_list.h"
-#include "base/macros.h"
-#include "components/translate/core/browser/translate_language_list.h"
-#include "components/translate/core/browser/translate_manager.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/web_ui_message_handler.h"
-#include "content/public/common/webplugininfo.h"
-
-namespace translate {
-struct TranslateErrorDetails;
-struct TranslateEventDetails;
-}
-
-namespace base {
-class ListValue;
-class Value;
-}
-
-namespace content {
-class NotificationDetails;
-class NotificationSource;
-}
-
-// The handler class for TranslateInternals page operations.
-class TranslateInternalsHandler : public content::WebUIMessageHandler,
- public content::NotificationObserver {
- public:
- TranslateInternalsHandler();
- ~TranslateInternalsHandler() override;
-
- // content::WebUIMessageHandler methods:
- void RegisterMessages() override;
-
- private:
- // content::NotificationObserver implementation:
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
-
- // Callback for translate errors.
- void OnTranslateError(const translate::TranslateErrorDetails& details);
-
- // Callback for translate events.
- virtual void OnTranslateEvent(
- const translate::TranslateEventDetails& details);
-
- // Handles the Javascript message 'removePrefItem'. This message is sent
- // when UI requests to remove an item in the preference.
- void OnRemovePrefItem(const base::ListValue* args);
-
- // Handles the JavaScript message 'setRecentTargetLanguage'. This message is
- // sent when the UI requests to change the 'translate_recent_target'
- // preference.
- void OnSetRecentTargetLanguage(const base::ListValue* args);
-
- // Handles the Javascript message 'overrideCountry'. This message is sent
- // when UI requests to override the stored country.
- void OnOverrideCountry(const base::ListValue* country);
-
- // Handles the Javascript message 'requestInfo'. This message is sent
- // when UI needs to show information concerned with the translation.
- // For now, this returns only prefs to Javascript.
- // |args| is not used.
- void OnRequestInfo(const base::ListValue* args);
-
- // Sends a messsage to Javascript.
- void SendMessageToJs(const std::string& message, const base::Value& value);
-
- // Sends the current preference to Javascript.
- void SendPrefsToJs();
-
- // Sends the languages currently supported by the server to JavaScript.
- void SendSupportedLanguagesToJs();
-
- // Sends the stored permanent country to Javascript.
- // |was_updated| tells Javascript if the country has been updated or not.
- void SendCountryToJs(bool was_updated);
-
- // Subscription for translate events coming from the translate language list.
- std::unique_ptr<
- translate::TranslateLanguageList::EventCallbackList::Subscription>
- event_subscription_;
-
- // Subscription for translate errors coming from the translate manager.
- std::unique_ptr<
- translate::TranslateManager::TranslateErrorCallbackList::Subscription>
- error_subscription_;
-
- content::NotificationRegistrar notification_registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(TranslateInternalsHandler);
-};
-
-#endif // CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc b/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc
index 7bacde2c268..34a98f03c31 100644
--- a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc
@@ -12,10 +12,11 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/translate_internals/translate_internals_handler.h"
+#include "chrome/browser/ui/webui/translate_internals/chrome_translate_internals_handler.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
-#include "chrome/grit/translate_internals_resources.h"
+#include "chrome/grit/browser_resources.h"
+#include "components/translate/translate_internals/translate_internals_handler.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
@@ -23,35 +24,17 @@
namespace {
-// Sets the languages to |dict|. Each key is a language code and each value is
-// a language name in the locale.
-void GetLanguages(base::DictionaryValue* dict) {
- DCHECK(dict);
-
- const std::string app_locale = g_browser_process->GetApplicationLocale();
- std::vector<std::string> language_codes;
- l10n_util::GetAcceptLanguagesForLocale(app_locale, &language_codes);
-
- for (auto it = language_codes.begin(); it != language_codes.end(); ++it) {
- const std::string& lang_code = *it;
- base::string16 lang_name =
- l10n_util::GetDisplayNameForLocale(lang_code, app_locale, false);
- dict->SetString(lang_code, lang_name);
- }
-}
-
content::WebUIDataSource* CreateTranslateInternalsHTMLSource() {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUITranslateInternalsHost);
- source->SetDefaultResource(IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HTML);
+ source->SetDefaultResource(IDR_TRANSLATE_INTERNALS_HTML);
source->SetJsonPath("strings.js");
- source->AddResourcePath("translate_internals.js",
- IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_JS);
+ source->AddResourcePath("translate_internals.js", IDR_TRANSLATE_INTERNALS_JS);
source->UseGzip();
base::DictionaryValue langs;
- GetLanguages(&langs);
+ translate::TranslateInternalsHandler::GetLanguages(&langs);
for (base::DictionaryValue::Iterator it(langs); !it.IsAtEnd(); it.Advance()) {
std::string key = "language-" + it.key();
std::string value;
@@ -69,7 +52,8 @@ content::WebUIDataSource* CreateTranslateInternalsHTMLSource() {
TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui)
: WebUIController(web_ui) {
- web_ui->AddMessageHandler(std::make_unique<TranslateInternalsHandler>());
+ web_ui->AddMessageHandler(
+ std::make_unique<ChromeTranslateInternalsHandler>());
Profile* profile = Profile::FromWebUI(web_ui);
content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource());
diff --git a/chromium/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc b/chromium/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc
index efc72f63cc2..5f4916c4611 100644
--- a/chromium/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc
@@ -21,6 +21,8 @@ UsbInternalsUI::UsbInternalsUI(content::WebUI* web_ui)
source->AddResourcePath("usb_internals.js", IDR_USB_INTERNALS_JS);
source->AddResourcePath("usb_internals.mojom-lite.js",
IDR_USB_INTERNALS_MOJOM_LITE_JS);
+ source->AddResourcePath("descriptor_panel.js",
+ IDR_USB_INTERNALS_DESCRIPTOR_PANEL_JS);
source->AddResourcePath("devices_page.js", IDR_USB_INTERNALS_DEVICES_PAGE_JS);
source->AddResourcePath("device.mojom-lite.js", IDR_USB_DEVICE_MOJOM_LITE_JS);
source->AddResourcePath("device_enumeration_options.mojom-lite.js",
diff --git a/chromium/chrome/browser/ui/webui/version_handler_win.cc b/chromium/chrome/browser/ui/webui/version_handler_win.cc
index 777c4ce2d9e..7f431234f23 100644
--- a/chromium/chrome/browser/ui/webui/version_handler_win.cc
+++ b/chromium/chrome/browser/ui/webui/version_handler_win.cc
@@ -61,10 +61,16 @@ std::string FullWindowsVersion() {
// unknown version
return base::StringPrintf("unknown version %d.%d", major, minor);
}
+
+ const std::string release_id = gi->release_id();
+
+ if (!release_id.empty())
+ version += " Version " + release_id;
+
if (patch > 0)
- version += base::StringPrintf(" Build %d.%d", build, patch);
+ version += base::StringPrintf(" (Build %d.%d)", build, patch);
else
- version += base::StringPrintf(" Build %d", build);
+ version += base::StringPrintf(" (Build %d)", build);
return version;
}
diff --git a/chromium/chrome/browser/ui/webui/version_handler_win_unittest.cc b/chromium/chrome/browser/ui/webui/version_handler_win_unittest.cc
index b054b576c44..9345bb0a240 100644
--- a/chromium/chrome/browser/ui/webui/version_handler_win_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/version_handler_win_unittest.cc
@@ -34,41 +34,54 @@ class WebUIWindowsVersion : public testing::Test {
TEST_F(WebUIWindowsVersion, Win10Pro) {
// set Windows Registry Key UBR
ubr_key.WriteValue(L"UBR", 555);
+ ubr_key.WriteValue(L"ReleaseId", L"1000");
// override base::win::OSInfo
base::test::ScopedOSInfoOverride os(
base::test::ScopedOSInfoOverride::Type::kWin10Pro);
EXPECT_EQ(VersionHandlerWindows::GetFullWindowsVersionForTesting(),
- "10 OS Build 15063.555");
+ "10 OS Version 1000 (Build 15063.555)");
}
TEST_F(WebUIWindowsVersion, WinServer2016) {
ubr_key.WriteValue(L"UBR", 1555);
+ ubr_key.WriteValue(L"ReleaseId", L"1001");
base::test::ScopedOSInfoOverride os(
base::test::ScopedOSInfoOverride::Type::kWinServer2016);
EXPECT_EQ(VersionHandlerWindows::GetFullWindowsVersionForTesting(),
- "Server OS Build 17134.1555");
+ "Server OS Version 1001 (Build 17134.1555)");
}
TEST_F(WebUIWindowsVersion, Win81Pro) {
ubr_key.WriteValue(L"UBR", 0UL);
+ ubr_key.WriteValue(L"ReleaseId", L"1001");
base::test::ScopedOSInfoOverride os(
base::test::ScopedOSInfoOverride::Type::kWin81Pro);
EXPECT_EQ(VersionHandlerWindows::GetFullWindowsVersionForTesting(),
- "8.1 Build 9600");
+ "8.1 Version 1001 (Build 9600)");
}
TEST_F(WebUIWindowsVersion, WinServer2012R2) {
ubr_key.WriteValue(L"UBR", 0UL);
+ ubr_key.WriteValue(L"ReleaseId", L"1001");
base::test::ScopedOSInfoOverride os(
base::test::ScopedOSInfoOverride::Type::kWinServer2012R2);
EXPECT_EQ(VersionHandlerWindows::GetFullWindowsVersionForTesting(),
- "Server 2012 R2 Build 9600");
+ "Server 2012 R2 Version 1001 (Build 9600)");
}
TEST_F(WebUIWindowsVersion, Win7ProSP1) {
ubr_key.WriteValue(L"UBR", 0UL);
+ ubr_key.WriteValue(L"ReleaseId", L"1001");
base::test::ScopedOSInfoOverride os(
base::test::ScopedOSInfoOverride::Type::kWin7ProSP1);
EXPECT_EQ(VersionHandlerWindows::GetFullWindowsVersionForTesting(),
- "7 Service Pack 1 Build 7601");
+ "7 Service Pack 1 Version 1001 (Build 7601)");
+}
+
+TEST_F(WebUIWindowsVersion, Win7ProSP1NoReleaseId) {
+ ubr_key.WriteValue(L"UBR", 0UL);
+ base::test::ScopedOSInfoOverride os(
+ base::test::ScopedOSInfoOverride::Type::kWin7ProSP1);
+ EXPECT_EQ(VersionHandlerWindows::GetFullWindowsVersionForTesting(),
+ "7 Service Pack 1 (Build 7601)");
}
diff --git a/chromium/chrome/browser/ui/webui/web_ui_test_handler.cc b/chromium/chrome/browser/ui/webui/web_ui_test_handler.cc
index 41b659d1125..24e7b897e06 100644
--- a/chromium/chrome/browser/ui/webui/web_ui_test_handler.cc
+++ b/chromium/chrome/browser/ui/webui/web_ui_test_handler.cc
@@ -43,7 +43,7 @@ void WebUITestHandler::PreloadJavaScript(const base::string16& js_text,
void WebUITestHandler::RunJavaScript(const base::string16& js_text) {
GetWebUI()->GetWebContents()->GetMainFrame()->ExecuteJavaScriptForTests(
- js_text);
+ js_text, base::NullCallback());
}
bool WebUITestHandler::RunJavaScriptTestWithResult(
@@ -53,8 +53,8 @@ bool WebUITestHandler::RunJavaScriptTestWithResult(
content::RenderFrameHost* frame =
GetWebUI()->GetWebContents()->GetMainFrame();
frame->ExecuteJavaScriptForTests(
- js_text, base::Bind(&WebUITestHandler::JavaScriptComplete,
- base::Unretained(this)));
+ js_text, base::BindOnce(&WebUITestHandler::JavaScriptComplete,
+ base::Unretained(this)));
return WaitForResult();
}
@@ -76,7 +76,7 @@ void WebUITestHandler::RunQuitClosure() {
quit_closure_.Run();
}
-void WebUITestHandler::JavaScriptComplete(const base::Value* result) {
+void WebUITestHandler::JavaScriptComplete(base::Value result) {
// To ensure this gets done, do this before ASSERT* calls.
RunQuitClosure();
@@ -86,7 +86,7 @@ void WebUITestHandler::JavaScriptComplete(const base::Value* result) {
run_test_done_ = true;
run_test_succeeded_ = false;
- ASSERT_TRUE(result->GetAsBoolean(&run_test_succeeded_));
+ ASSERT_TRUE(result.GetAsBoolean(&run_test_succeeded_));
}
bool WebUITestHandler::WaitForResult() {
diff --git a/chromium/chrome/browser/ui/webui/web_ui_test_handler.h b/chromium/chrome/browser/ui/webui/web_ui_test_handler.h
index 6a00d8c0b50..c91a2e6a456 100644
--- a/chromium/chrome/browser/ui/webui/web_ui_test_handler.h
+++ b/chromium/chrome/browser/ui/webui/web_ui_test_handler.h
@@ -50,7 +50,7 @@ class WebUITestHandler {
private:
// Gets the callback that Javascript execution is complete.
- void JavaScriptComplete(const base::Value* result);
+ void JavaScriptComplete(base::Value result);
// Runs a message loop until test finishes. Returns the result of the
// test.
diff --git a/chromium/chrome/browser/ui/webui/webapks_handler.cc b/chromium/chrome/browser/ui/webui/webapks_handler.cc
index f7f529ae6fc..73e48fff39a 100644
--- a/chromium/chrome/browser/ui/webui/webapks_handler.cc
+++ b/chromium/chrome/browser/ui/webui/webapks_handler.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/android/color_helpers.h"
#include "chrome/browser/android/shortcut_helper.h"
#include "content/public/browser/web_ui.h"
-#include "content/public/common/manifest_util.h"
+#include "third_party/blink/public/common/manifest/manifest_util.h"
#include "ui/gfx/color_utils.h"
WebApksHandler::WebApksHandler() : weak_ptr_factory_(this) {}
@@ -50,10 +50,10 @@ void WebApksHandler::OnWebApkInfoRetrieved(
result->SetString("manifestUrl", webapk_info.manifest_url);
result->SetString("manifestStartUrl", webapk_info.manifest_start_url);
result->SetString("displayMode",
- content::WebDisplayModeToString(webapk_info.display));
+ blink::WebDisplayModeToString(webapk_info.display));
result->SetString(
"orientation",
- content::WebScreenOrientationLockTypeToString(webapk_info.orientation));
+ blink::WebScreenOrientationLockTypeToString(webapk_info.orientation));
result->SetString("themeColor",
OptionalSkColorToString(webapk_info.theme_color));
result->SetString("backgroundColor",
diff --git a/chromium/chrome/browser/ui/webui/webui_browsertest.cc b/chromium/chrome/browser/ui/webui/webui_browsertest.cc
index 969ce238930..a48e98c93e6 100644
--- a/chromium/chrome/browser/ui/webui/webui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/webui_browsertest.cc
@@ -5,6 +5,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
@@ -94,7 +95,8 @@ class WebUIRequiringGestureBrowserTest : public InProcessBrowserTest {
void SendMessageAndWaitForFinish() {
main_rfh()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("chrome.send('messageRequiringGesture');"
- "chrome.send('notifyFinish');"));
+ "chrome.send('notifyFinish');"),
+ base::NullCallback());
base::RunLoop run_loop;
test_handler()->set_finish_closure(run_loop.QuitClosure());
run_loop.Run();
diff --git a/chromium/chrome/browser/ui/webui/welcome/OWNERS b/chromium/chrome/browser/ui/webui/welcome/OWNERS
index c497ef23d4a..a0bd3ec218b 100644
--- a/chromium/chrome/browser/ui/webui/welcome/OWNERS
+++ b/chromium/chrome/browser/ui/webui/welcome/OWNERS
@@ -1,4 +1,3 @@
hcarmona@chromium.org
-scottchen@chromium.org
# COMPONENT: UI>Browser>FirstRun
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux/constants.cc b/chromium/chrome/browser/ui/webui/welcome/nux/constants.cc
index afb0fb82ff3..27d8dfcd186 100644
--- a/chromium/chrome/browser/ui/webui/welcome/nux/constants.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/nux/constants.cc
@@ -14,7 +14,7 @@ const base::Feature kNuxOnboardingFeature{"NuxOnboarding",
// nux-ntp-background should not be added here until we can guarantee that
// kUseGoogleLocalNtp is enabled
const char kDefaultNewUserModules[] =
- "nux-google-apps,nux-email,nux-set-as-default,signin-view";
+ "nux-google-apps,nux-set-as-default,signin-view";
const char kDefaultReturningUserModules[] = "nux-set-as-default";
// The value of these FeatureParam values should be a comma-delimited list
@@ -25,7 +25,8 @@ const base::FeatureParam<std::string> kNuxOnboardingNewUserModules{
const base::FeatureParam<std::string> kNuxOnboardingReturningUserModules{
&kNuxOnboardingFeature, "returning-user-modules",
kDefaultReturningUserModules};
-const base::FeatureParam<bool> kNuxOnboardingShowEmailInterstitial{
- &kNuxOnboardingFeature, "show-email-interstitial", false};
+
+const base::FeatureParam<bool> kNuxOnboardingShowGoogleApp{
+ &kNuxOnboardingFeature, "app-variation-enabled", false};
} // namespace nux
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux/constants.h b/chromium/chrome/browser/ui/webui/welcome/nux/constants.h
index e79cd970cf3..de397b2f0d6 100644
--- a/chromium/chrome/browser/ui/webui/welcome/nux/constants.h
+++ b/chromium/chrome/browser/ui/webui/welcome/nux/constants.h
@@ -21,7 +21,7 @@ extern const char kDefaultReturningUserModules[];
extern const base::FeatureParam<std::string> kNuxOnboardingNewUserModules;
extern const base::FeatureParam<std::string> kNuxOnboardingReturningUserModules;
-extern const base::FeatureParam<bool> kNuxOnboardingShowEmailInterstitial;
+extern const base::FeatureParam<bool> kNuxOnboardingShowGoogleApp;
} // namespace nux
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux/email_handler.cc b/chromium/chrome/browser/ui/webui/welcome/nux/email_handler.cc
deleted file mode 100644
index b88bcb954d4..00000000000
--- a/chromium/chrome/browser/ui/webui/welcome/nux/email_handler.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/welcome/nux/email_handler.h"
-
-#include "base/bind.h"
-#include "base/metrics/field_trial_params.h"
-#include "base/metrics/histogram_macros.h"
-#include "base/stl_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/favicon/favicon_service_factory.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/welcome/nux/bookmark_item.h"
-#include "chrome/browser/ui/webui/welcome/nux/email_providers_list.h"
-#include "chrome/grit/generated_resources.h"
-#include "chrome/grit/onboarding_welcome_resources.h"
-#include "components/country_codes/country_codes.h"
-#include "components/favicon/core/favicon_service.h"
-#include "components/grit/components_resources.h"
-#include "components/grit/components_scaled_resources.h"
-#include "components/strings/grit/components_strings.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_ui.h"
-#include "content/public/browser/web_ui_data_source.h"
-#include "ui/base/resource/resource_bundle.h"
-
-namespace nux {
-
-const char* kEmailInteractionHistogram =
- "FirstRun.NewUserExperience.EmailInteraction";
-
-constexpr const int kEmailIconSize = 48; // Pixels.
-
-EmailHandler::EmailHandler()
- : email_providers_(GetCurrentCountryEmailProviders()) {}
-
-EmailHandler::~EmailHandler() {}
-
-void EmailHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "cacheEmailIcon", base::BindRepeating(&EmailHandler::HandleCacheEmailIcon,
- base::Unretained(this)));
-
- web_ui()->RegisterMessageCallback(
- "getEmailList", base::BindRepeating(&EmailHandler::HandleGetEmailList,
- base::Unretained(this)));
-}
-
-void EmailHandler::HandleCacheEmailIcon(const base::ListValue* args) {
- int emailId;
- args->GetInteger(0, &emailId);
-
- const BookmarkItem* selectedEmail = NULL;
- for (const auto& provider : email_providers_) {
- if (provider.id == emailId) {
- selectedEmail = &provider;
- break;
- }
- }
- CHECK(selectedEmail); // WebUI should not be able to pass non-existent ID.
-
- // Preload the favicon cache with Chrome-bundled images. Otherwise, the
- // pre-populated bookmarks don't have favicons and look bad. Favicons are
- // updated automatically when a user visits a site.
- GURL app_url = GURL(selectedEmail->url);
- FaviconServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()),
- ServiceAccessType::EXPLICIT_ACCESS)
- ->MergeFavicon(
- app_url, app_url, favicon_base::IconType::kFavicon,
- ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
- selectedEmail->icon),
- gfx::Size(kEmailIconSize, kEmailIconSize));
-}
-
-void EmailHandler::HandleGetEmailList(const base::ListValue* args) {
- AllowJavascript();
- CHECK_EQ(1U, args->GetSize());
- const base::Value* callback_id;
- CHECK(args->Get(0, &callback_id));
- ResolveJavascriptCallback(*callback_id,
- BookmarkItemsToListValue(email_providers_));
-}
-
-void EmailHandler::AddSources(content::WebUIDataSource* html_source) {
- // Add constants to loadtime data
- html_source->AddInteger("email_providers_enum_count",
- GetNumberOfEmailProviders());
- html_source->SetJsonPath("strings.js");
-}
-
-} // namespace nux
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux/email_handler.h b/chromium/chrome/browser/ui/webui/welcome/nux/email_handler.h
deleted file mode 100644
index 926790dd8e0..00000000000
--- a/chromium/chrome/browser/ui/webui/welcome/nux/email_handler.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_EMAIL_HANDLER_H_
-#define CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_EMAIL_HANDLER_H_
-
-#include <vector>
-
-#include "base/macros.h"
-#include "base/values.h"
-#include "content/public/browser/web_ui_message_handler.h"
-
-namespace content {
-class WebUIDataSource;
-} // namespace content
-
-namespace nux {
-
-struct BookmarkItem;
-
-extern const char* kEmailInteractionHistogram;
-
-// These values are persisted to logs. Entries should not be renumbered and
-// numeric values should never be reused.
-enum class EmailInteraction {
- kPromptShown = 0,
- kNoThanks = 1,
- kGetStarted = 2,
- kCount,
-};
-
-class EmailHandler : public content::WebUIMessageHandler {
- public:
- EmailHandler();
- ~EmailHandler() override;
-
- // WebUIMessageHandler:
- void RegisterMessages() override;
-
- // Callbacks for JS APIs.
- void HandleCacheEmailIcon(const base::ListValue* args);
- void HandleGetEmailList(const base::ListValue* args);
-
- // Adds webui sources.
- static void AddSources(content::WebUIDataSource* html_source);
-
- private:
- const std::vector<BookmarkItem> email_providers_;
-
- DISALLOW_COPY_AND_ASSIGN(EmailHandler);
-};
-
-} // namespace nux
-
-#endif // CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_EMAIL_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux/email_providers_list.cc b/chromium/chrome/browser/ui/webui/welcome/nux/email_providers_list.cc
deleted file mode 100644
index 329f878727d..00000000000
--- a/chromium/chrome/browser/ui/webui/welcome/nux/email_providers_list.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/welcome/nux/email_providers_list.h"
-
-#include "chrome/browser/ui/webui/welcome/nux/bookmark_item.h"
-#include "chrome/grit/onboarding_welcome_resources.h"
-#include "components/country_codes/country_codes.h"
-
-namespace nux {
-
-// These values are persisted to logs. Entries should not be renumbered and
-// numeric values should never be reused.
-enum class EmailProviders {
- kGmail = 0,
- kYahoo = 1,
- kOutlook = 2,
- kAol = 3,
- kiCloud = 4,
- kCount,
-};
-
-std::vector<BookmarkItem> GetCurrentCountryEmailProviders() {
- switch (country_codes::GetCurrentCountryID()) {
- case country_codes::CountryCharsToCountryID('U', 'S'): {
- return {
- {static_cast<int>(EmailProviders::kGmail), "Gmail", "gmail",
- "https://accounts.google.com/b/0/AddMailService",
- IDR_NUX_EMAIL_GMAIL_1X},
- {static_cast<int>(EmailProviders::kYahoo), "Yahoo", "yahoo",
- "https://mail.yahoo.com", IDR_NUX_EMAIL_YAHOO_1X},
- {static_cast<int>(EmailProviders::kOutlook), "Outlook", "outlook",
- "https://login.live.com/login.srf?", IDR_NUX_EMAIL_OUTLOOK_1X},
- {static_cast<int>(EmailProviders::kAol), "AOL", "aol",
- "https://mail.aol.com", IDR_NUX_EMAIL_AOL_1X},
- {static_cast<int>(EmailProviders::kiCloud), "iCloud", "icloud",
- "https://www.icloud.com/mail", IDR_NUX_EMAIL_ICLOUD_1X},
- };
- }
-
- // TODO(scottchen): define all supported countries here.
-
- default: {
- // TODO(scottchen): examine if we want these US providers as default.
- return {
- {static_cast<int>(EmailProviders::kGmail), "Gmail", "gmail",
- "https://accounts.google.com/b/0/AddMailService",
- IDR_NUX_EMAIL_GMAIL_1X},
- {static_cast<int>(EmailProviders::kYahoo), "Yahoo", "yahoo",
- "https://mail.yahoo.com", IDR_NUX_EMAIL_YAHOO_1X},
- {static_cast<int>(EmailProviders::kOutlook), "Outlook", "outlook",
- "https://login.live.com/login.srf?", IDR_NUX_EMAIL_OUTLOOK_1X},
- {static_cast<int>(EmailProviders::kAol), "AOL", "aol",
- "https://mail.aol.com", IDR_NUX_EMAIL_AOL_1X},
- {static_cast<int>(EmailProviders::kiCloud), "iCloud", "icloud",
- "https://www.icloud.com/mail", IDR_NUX_EMAIL_ICLOUD_1X},
- };
- }
- }
-}
-
-int GetNumberOfEmailProviders() {
- return static_cast<int>(EmailProviders::kCount);
-}
-
-} // namespace nux
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux/email_providers_list.h b/chromium/chrome/browser/ui/webui/welcome/nux/email_providers_list.h
deleted file mode 100644
index e50eed8dcd1..00000000000
--- a/chromium/chrome/browser/ui/webui/welcome/nux/email_providers_list.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_EMAIL_PROVIDERS_LIST_H_
-#define CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_EMAIL_PROVIDERS_LIST_H_
-
-#include <vector>
-
-#include "chrome/browser/ui/webui/welcome/nux/bookmark_item.h"
-
-namespace nux {
-
-std::vector<BookmarkItem> GetCurrentCountryEmailProviders();
-
-// Function to avoid exposing enum only for count.
-int GetNumberOfEmailProviders();
-
-} // namespace nux
-
-#endif // CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_EMAIL_PROVIDERS_LIST_H_
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.cc b/chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.cc
index e8e17c049af..3669d984942 100644
--- a/chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.cc
@@ -11,6 +11,8 @@
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/welcome/nux/bookmark_item.h"
+#include "chrome/browser/ui/webui/welcome/nux_helper.h"
+#include "chrome/grit/chrome_unscaled_resources.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/onboarding_welcome_resources.h"
#include "components/favicon/core/favicon_service.h"
@@ -27,12 +29,13 @@ namespace nux {
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class GoogleApps {
- kGmailDoNotUse = 0, // Deprecated.
+ kGmail = 0,
kYouTube = 1,
kMaps = 2,
kTranslate = 3,
kNews = 4,
- kChromeWebStore = 5,
+ kChromeWebStoreDoNotUse = 5, // Deprecated.
+ kSearch = 6,
kCount,
};
@@ -41,33 +44,52 @@ const char* kGoogleAppsInteractionHistogram =
constexpr const int kGoogleAppIconSize = 48; // Pixels.
-GoogleAppsHandler::GoogleAppsHandler()
- : // Do not translate icon name as it is not human visible and needs to
- // match CSS.
- google_apps_{{
- {static_cast<int>(GoogleApps::kYouTube),
- l10n_util::GetStringUTF8(
- IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_YOUTUBE),
- "youtube", "https://youtube.com", IDR_NUX_GOOGLE_APPS_YOUTUBE_1X},
- {static_cast<int>(GoogleApps::kMaps),
- l10n_util::GetStringUTF8(
- IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_MAPS),
- "maps", "https://maps.google.com", IDR_NUX_GOOGLE_APPS_MAPS_1X},
- {static_cast<int>(GoogleApps::kNews),
- l10n_util::GetStringUTF8(
- IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_NEWS),
- "news", "https://news.google.com", IDR_NUX_GOOGLE_APPS_NEWS_1X},
- {static_cast<int>(GoogleApps::kTranslate),
- l10n_util::GetStringUTF8(
- IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_TRANSLATE),
- "translate", "https://translate.google.com",
- IDR_NUX_GOOGLE_APPS_TRANSLATE_1X},
- {static_cast<int>(GoogleApps::kChromeWebStore),
- l10n_util::GetStringUTF8(
- IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_WEB_STORE),
- "web-store", "https://chrome.google.com/webstore",
- IDR_NUX_GOOGLE_APPS_CHROME_STORE_1X},
- }} {}
+GoogleAppsHandler::GoogleAppsHandler() {
+ // Do not translate icon name as it is not human visible and needs to
+ // match CSS.
+
+ BookmarkItem gmail = {
+ static_cast<int>(GoogleApps::kGmail),
+ l10n_util::GetStringUTF8(IDS_ONBOARDING_WELCOME_NUX_GOOGLE_GMAIL),
+ "gmail", "https://accounts.google.com/b/0/AddMailService",
+ IDR_NUX_GOOGLE_APPS_GMAIL_1X};
+
+ if (IsAppVariationEnabled()) {
+#if defined(GOOGLE_CHROME_BUILD)
+ google_apps_.push_back(
+ {static_cast<int>(GoogleApps::kSearch),
+ l10n_util::GetStringUTF8(IDS_ONBOARDING_WELCOME_NUX_GOOGLE_SEARCH),
+ "search", "https://google.com", IDS_ONBOARDING_WELCOME_SEARCH});
+#endif // GOOGLE_CHROME_BUILD
+ } else {
+ google_apps_.push_back(gmail);
+ }
+
+ google_apps_.push_back(
+ {static_cast<int>(GoogleApps::kYouTube),
+ l10n_util::GetStringUTF8(IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_YOUTUBE),
+ "youtube", "https://youtube.com", IDR_NUX_GOOGLE_APPS_YOUTUBE_1X});
+
+ google_apps_.push_back(
+ {static_cast<int>(GoogleApps::kMaps),
+ l10n_util::GetStringUTF8(IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_MAPS),
+ "maps", "https://maps.google.com", IDR_NUX_GOOGLE_APPS_MAPS_1X});
+
+ if (IsAppVariationEnabled()) {
+ google_apps_.push_back(gmail);
+ } else {
+ google_apps_.push_back(
+ {static_cast<int>(GoogleApps::kNews),
+ l10n_util::GetStringUTF8(IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_NEWS),
+ "news", "https://news.google.com", IDR_NUX_GOOGLE_APPS_NEWS_1X});
+ }
+
+ google_apps_.push_back({static_cast<int>(GoogleApps::kTranslate),
+ l10n_util::GetStringUTF8(
+ IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_TRANSLATE),
+ "translate", "https://translate.google.com",
+ IDR_NUX_GOOGLE_APPS_TRANSLATE_1X});
+}
GoogleAppsHandler::~GoogleAppsHandler() {}
@@ -88,9 +110,9 @@ void GoogleAppsHandler::HandleCacheGoogleAppIcon(const base::ListValue* args) {
args->GetInteger(0, &appId);
const BookmarkItem* selectedApp = NULL;
- for (size_t i = 0; i < kGoogleAppCount; i++) {
- if (google_apps_[i].id == appId) {
- selectedApp = &google_apps_[i];
+ for (const auto& google_app : google_apps_) {
+ if (google_app.id == appId) {
+ selectedApp = &google_app;
break;
}
}
@@ -116,7 +138,7 @@ void GoogleAppsHandler::HandleGetGoogleAppsList(const base::ListValue* args) {
CHECK(args->Get(0, &callback_id));
ResolveJavascriptCallback(
*callback_id,
- BookmarkItemsToListValue(google_apps_.data(), kGoogleAppCount));
+ BookmarkItemsToListValue(google_apps_.data(), google_apps_.size()));
}
} // namespace nux
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.h b/chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.h
index a3db5324e3e..f35e22d4cb3 100644
--- a/chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.h
+++ b/chromium/chrome/browser/ui/webui/welcome/nux/google_apps_handler.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_GOOGLE_APPS_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_GOOGLE_APPS_HANDLER_H_
-#include <array>
+#include <vector>
#include "base/macros.h"
#include "base/values.h"
@@ -25,8 +25,6 @@ enum class GoogleAppsInteraction {
kCount,
};
-const size_t kGoogleAppCount = 5;
-
class GoogleAppsHandler : public content::WebUIMessageHandler {
public:
GoogleAppsHandler();
@@ -40,7 +38,7 @@ class GoogleAppsHandler : public content::WebUIMessageHandler {
void HandleGetGoogleAppsList(const base::ListValue* args);
private:
- std::array<BookmarkItem, kGoogleAppCount> google_apps_;
+ std::vector<BookmarkItem> google_apps_;
DISALLOW_COPY_AND_ASSIGN(GoogleAppsHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux/set_as_default_handler.cc b/chromium/chrome/browser/ui/webui/welcome/nux/set_as_default_handler.cc
index 0bd0c361198..3d4f3387ec8 100644
--- a/chromium/chrome/browser/ui/webui/welcome/nux/set_as_default_handler.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/nux/set_as_default_handler.cc
@@ -12,7 +12,7 @@ SetAsDefaultHandler::SetAsDefaultHandler()
SetAsDefaultHandler::~SetAsDefaultHandler() {}
void SetAsDefaultHandler::RecordSetAsDefaultUMA() {
- // TODO(scottchen): Add UMA tracking.
+ // TODO(hcarmona): Add UMA tracking.
}
} // namespace nux
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc b/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc
index 0a0adc7958b..a79c297bd7c 100644
--- a/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc
@@ -5,19 +5,28 @@
#include "chrome/browser/ui/webui/welcome/nux_helper.h"
#include <string>
+#include <vector>
#include "base/feature_list.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
+#include "base/strings/string_split.h"
+#include "base/strings/string_tokenizer.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
+#include "chrome/browser/policy/browser_signin_policy_handler.h"
+#include "chrome/browser/policy/profile_policy_connector.h"
+#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/ntp_features.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/ui/webui/welcome/nux/constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
+#include "components/policy/core/common/policy_map.h"
+#include "components/policy/core/common/policy_service.h"
+#include "components/policy/policy_constants.h"
#include "components/prefs/pref_service.h"
#if defined(OS_MACOSX)
@@ -25,6 +34,52 @@
#endif // defined(OS_MACOSX)
namespace nux {
+
+bool CanShowGoogleAppModule(const policy::PolicyMap& policies) {
+ const base::Value* bookmark_bar_enabled_value =
+ policies.GetValue(policy::key::kBookmarkBarEnabled);
+
+ if (bookmark_bar_enabled_value && !bookmark_bar_enabled_value->GetBool()) {
+ return false;
+ }
+
+ const base::Value* edit_bookmarks_value =
+ policies.GetValue(policy::key::kEditBookmarksEnabled);
+
+ if (edit_bookmarks_value && !edit_bookmarks_value->GetBool()) {
+ return false;
+ }
+
+ return true;
+}
+
+bool CanShowNTPBackgroundModule(const policy::PolicyMap& policies) {
+ // We shouldn't show this module if any policy is set that overrides the NTP.
+ return !policies.GetValue(policy::key::kNewTabPageLocation);
+}
+
+bool CanShowSetDefaultModule(const policy::PolicyMap& policies) {
+ const base::Value* set_default_value =
+ policies.GetValue(policy::key::kDefaultBrowserSettingEnabled);
+
+ return !set_default_value || set_default_value->GetBool();
+}
+
+bool CanShowSigninModule(const policy::PolicyMap& policies) {
+ const base::Value* browser_signin_value =
+ policies.GetValue(policy::key::kBrowserSignin);
+
+ if (!browser_signin_value)
+ return true;
+
+ int int_browser_signin_value;
+ bool success = browser_signin_value->GetAsInteger(&int_browser_signin_value);
+ DCHECK(success);
+
+ return static_cast<policy::BrowserSigninMode>(int_browser_signin_value) !=
+ policy::BrowserSigninMode::kDisabled;
+}
+
// This feature flag is used to force the feature to be turned on for non-win
// and non-branded builds, like with tests or development on other platforms.
const base::Feature kNuxOnboardingForceEnabled = {
@@ -35,15 +90,14 @@ const base::Feature kNuxOnboardingForceEnabled = {
// chrome/browser/resources/welcome/onboarding_welcome/welcome_app.js
const base::FeatureParam<std::string> kNuxOnboardingForceEnabledNewUserModules =
{&kNuxOnboardingForceEnabled, "new-user-modules",
- "nux-google-apps,nux-email,nux-ntp-background,nux-set-as-default,"
+ "nux-google-apps,nux-ntp-background,nux-set-as-default,"
"signin-view"};
const base::FeatureParam<std::string>
kNuxOnboardingForceEnabledReturningUserModules = {
&kNuxOnboardingForceEnabled, "returning-user-modules",
"nux-set-as-default"};
-// TODO(hcarmona): remove this flag and all code behind it.
-const base::FeatureParam<bool> kNuxOnboardingForceEnabledShowEmailInterstitial =
- {&kNuxOnboardingForceEnabled, "show-email-interstitial", true};
+const base::FeatureParam<bool> kNuxOnboardingForceEnabledShowGoogleApp = {
+ &kNuxOnboardingForceEnabled, "app-variation-enabled", false};
// Our current running experiment of testing the nux-ntp-background module
// depends on the Local NTP feature/experiment being enabled. To avoid polluting
@@ -120,32 +174,75 @@ bool IsNuxOnboardingEnabled(Profile* profile) {
return false;
}
+bool IsAppVariationEnabled() {
+ return kNuxOnboardingForceEnabledShowGoogleApp.Get() ||
+ kNuxOnboardingShowGoogleApp.Get();
+}
+
+const policy::PolicyMap& GetPoliciesFromProfile(Profile* profile) {
+ policy::ProfilePolicyConnector* profile_connector =
+ policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile);
+ DCHECK(profile_connector);
+ return profile_connector->policy_service()->GetPolicies(
+ policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string()));
+}
+
+std::vector<std::string> GetAvailableModules(
+ const policy::PolicyMap& policies) {
+ std::vector<std::string> available_modules;
+
+ if (CanShowGoogleAppModule(policies))
+ available_modules.push_back("nux-google-apps");
+ if (CanShowNTPBackgroundModule(policies))
+ available_modules.push_back("nux-ntp-background");
+ if (CanShowSetDefaultModule(policies))
+ available_modules.push_back("nux-set-as-default");
+ if (CanShowSigninModule(policies))
+ available_modules.push_back("signin-view");
+
+ return available_modules;
+}
+
+std::string FilterModules(const std::string& requested_modules,
+ const std::vector<std::string>& available_modules) {
+ std::vector<std::string> requested_list = base::SplitString(
+ requested_modules, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+ std::vector<std::string> filtered_modules;
+
+ std::copy_if(requested_list.begin(), requested_list.end(),
+ std::back_inserter(filtered_modules),
+ [available_modules](std::string module) {
+ return !module.empty() &&
+ base::ContainsValue(available_modules, module);
+ });
+
+ return base::JoinString(filtered_modules, ",");
+}
+
base::DictionaryValue GetNuxOnboardingModules(Profile* profile) {
// This function should not be called when nux onboarding feature is not on.
DCHECK(nux::IsNuxOnboardingEnabled(profile));
- base::DictionaryValue modules;
+ std::string new_user_modules = kDefaultNewUserModules;
+ std::string returning_user_modules = kDefaultReturningUserModules;
if (base::FeatureList::IsEnabled(nux::kNuxOnboardingForceEnabled)) {
- modules.SetString("new-user",
- kNuxOnboardingForceEnabledNewUserModules.Get());
- modules.SetString("returning-user",
- kNuxOnboardingForceEnabledReturningUserModules.Get());
- modules.SetBoolean("show-email-interstitial",
- kNuxOnboardingForceEnabledShowEmailInterstitial.Get());
+ new_user_modules = kNuxOnboardingForceEnabledNewUserModules.Get();
+ returning_user_modules =
+ kNuxOnboardingForceEnabledReturningUserModules.Get();
} else if (CanExperimentWithVariations(profile)) {
- modules.SetString("new-user", kNuxOnboardingNewUserModules.Get());
- modules.SetString("returning-user",
- kNuxOnboardingReturningUserModules.Get());
- modules.SetBoolean("show-email-interstitial",
- kNuxOnboardingShowEmailInterstitial.Get());
- } else {
- // Default behavior w/o checking feature flag.
- modules.SetString("new-user", kDefaultNewUserModules);
- modules.SetString("returning-user", kDefaultReturningUserModules);
- modules.SetBoolean("show-email-interstitial", false);
+ new_user_modules = kNuxOnboardingNewUserModules.Get();
+ returning_user_modules = kNuxOnboardingReturningUserModules.Get();
}
+ const policy::PolicyMap& policies = GetPoliciesFromProfile(profile);
+ std::vector<std::string> available_modules = GetAvailableModules(policies);
+
+ base::DictionaryValue modules;
+ modules.SetString("new-user",
+ FilterModules(new_user_modules, available_modules));
+ modules.SetString("returning-user",
+ FilterModules(returning_user_modules, available_modules));
return modules;
}
} // namespace nux
diff --git a/chromium/chrome/browser/ui/webui/welcome/nux_helper.h b/chromium/chrome/browser/ui/webui/welcome/nux_helper.h
index a56ae37d041..b11d2b3c257 100644
--- a/chromium/chrome/browser/ui/webui/welcome/nux_helper.h
+++ b/chromium/chrome/browser/ui/webui/welcome/nux_helper.h
@@ -24,8 +24,6 @@ extern const base::FeatureParam<std::string>
kNuxOnboardingForceEnabledNewUserModules;
extern const base::FeatureParam<std::string>
kNuxOnboardingForceEnabledReturningUserModules;
-extern const base::FeatureParam<bool>
- kNuxOnboardingForceEnabledShowEmailInterstitial;
// Get the group for users who onboard in this experiment.
// Groups are:
@@ -38,6 +36,8 @@ std::string GetOnboardingGroup(Profile* profile);
bool IsNuxOnboardingEnabled(Profile* profile);
+bool IsAppVariationEnabled();
+
base::DictionaryValue GetNuxOnboardingModules(Profile* profile);
} // namespace nux
diff --git a/chromium/chrome/browser/ui/webui/welcome/welcome_handler.cc b/chromium/chrome/browser/ui/webui/welcome/welcome_handler.cc
index 6a20288420f..e0d62ec0848 100644
--- a/chromium/chrome/browser/ui/webui/welcome/welcome_handler.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/welcome_handler.cc
@@ -20,7 +20,6 @@
#include "ui/base/page_transition_types.h"
const char kWelcomeReturningUserUrl[] = "chrome://welcome/returning-user";
-const char kWelcomeEmailInterstitial[] = "chrome://welcome/email-interstitial";
WelcomeHandler::WelcomeHandler(content::WebUI* web_ui)
: profile_(Profile::FromWebUI(web_ui)),
@@ -53,9 +52,7 @@ WelcomeHandler::~WelcomeHandler() {
bool WelcomeHandler::isValidRedirectUrl() {
GURL current_url = web_ui()->GetWebContents()->GetVisibleURL();
- return current_url == kWelcomeReturningUserUrl ||
- current_url.spec().find(kWelcomeEmailInterstitial) !=
- std::string::npos;
+ return current_url == kWelcomeReturningUserUrl;
}
// Override from LoginUIService::Observer.
@@ -108,16 +105,7 @@ void WelcomeHandler::HandleUserDecline(const base::ListValue* args) {
? WelcomeResult::ATTEMPTED_DECLINED
: WelcomeResult::DECLINED;
- if (args->GetSize() == 1U) {
- std::string url_string;
- CHECK(args->GetString(0, &url_string));
- GURL redirect_url = GURL(url_string);
- DCHECK(redirect_url.is_valid());
-
- GoToURL(redirect_url);
- } else {
- GoToNewTabPage();
- }
+ GoToNewTabPage();
}
// Override from WebUIMessageHandler.
diff --git a/chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc b/chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc
index 83251fbb5d6..8238a6c003c 100644
--- a/chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc
@@ -4,14 +4,17 @@
#include "chrome/browser/ui/webui/welcome/welcome_ui.h"
+#include <map>
+
+#include "base/bind.h"
#include "base/metrics/histogram_macros.h"
+#include "base/stl_util.h"
#include "build/build_config.h"
#include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/ui/webui/dark_mode_handler.h"
#include "chrome/browser/ui/webui/localized_string.h"
#include "chrome/browser/ui/webui/welcome/nux/bookmark_handler.h"
#include "chrome/browser/ui/webui/welcome/nux/constants.h"
-#include "chrome/browser/ui/webui/welcome/nux/email_handler.h"
#include "chrome/browser/ui/webui/welcome/nux/google_apps_handler.h"
#include "chrome/browser/ui/webui/welcome/nux/ntp_background_handler.h"
#include "chrome/browser/ui/webui/welcome/nux/set_as_default_handler.h"
@@ -25,6 +28,7 @@
#include "chrome/grit/onboarding_welcome_resources.h"
#include "chrome/grit/onboarding_welcome_resources_map.h"
#include "components/prefs/pref_service.h"
+#include "components/signin/core/browser/signin_pref_names.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "net/base/url_util.h"
@@ -35,19 +39,19 @@
#endif
namespace {
+
const bool kIsBranded =
#if defined(GOOGLE_CHROME_BUILD)
true;
#else
false;
#endif
-} // namespace
-bool HandleRequestCallback(
- base::WeakPtr<WelcomeUI> weak_ptr,
- const std::string& path,
- const content::WebUIDataSource::GotDataCallback& callback) {
- if (!base::StartsWith(path, "preview-background.jpg",
+const char kPreviewBackgroundPath[] = "preview-background.jpg";
+
+bool ShouldHandleRequestCallback(base::WeakPtr<WelcomeUI> weak_ptr,
+ const std::string& path) {
+ if (!base::StartsWith(path, kPreviewBackgroundPath,
base::CompareCase::SENSITIVE)) {
return false;
}
@@ -59,12 +63,22 @@ bool HandleRequestCallback(
return false;
}
- if (weak_ptr) {
- weak_ptr->CreateBackgroundFetcher(background_index, callback);
- return true;
- }
+ return !weak_ptr ? false : true;
+}
+
+void HandleRequestCallback(
+ base::WeakPtr<WelcomeUI> weak_ptr,
+ const std::string& path,
+ const content::WebUIDataSource::GotDataCallback& callback) {
+ DCHECK(ShouldHandleRequestCallback(weak_ptr, path));
+
+ std::string index_param = path.substr(path.find_first_of("?") + 1);
+ int background_index = -1;
+ CHECK(base::StringToInt(index_param, &background_index) ||
+ background_index < 0);
- return false;
+ DCHECK(weak_ptr);
+ weak_ptr->CreateBackgroundFetcher(background_index, callback);
}
void AddOnboardingStrings(content::WebUIDataSource* html_source) {
@@ -76,6 +90,7 @@ void AddOnboardingStrings(content::WebUIDataSource* html_source) {
{"bookmarkRemoved", IDS_ONBOARDING_WELCOME_BOOKMARK_REMOVED},
{"bookmarksRemoved", IDS_ONBOARDING_WELCOME_BOOKMARKS_REMOVED},
{"bookmarkReplaced", IDS_ONBOARDING_WELCOME_BOOKMARK_REPLACED},
+ {"defaultBrowserChanged", IDS_ONBOARDING_DEFAULT_BROWSER_CHANGED},
{"getStarted", IDS_ONBOARDING_WELCOME_GET_STARTED},
{"headerText", IDS_WELCOME_HEADER},
{"next", IDS_ONBOARDING_WELCOME_NEXT},
@@ -87,9 +102,6 @@ void AddOnboardingStrings(content::WebUIDataSource* html_source) {
{"signInSubHeader", IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_SUB_HEADER},
{"signIn", IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_SIGNIN},
- // Email provider module strings.
- {"emailProviderTitle", IDS_ONBOARDING_WELCOME_NUX_EMAIL_TITLE},
-
// Google apps module strings.
{"googleAppsDescription",
IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_DESCRIPTION},
@@ -116,17 +128,26 @@ void AddOnboardingStrings(content::WebUIDataSource* html_source) {
{"landingDescription", IDS_ONBOARDING_WELCOME_LANDING_DESCRIPTION},
{"landingNewUser", IDS_ONBOARDING_WELCOME_LANDING_NEW_USER},
{"landingExistingUser", IDS_ONBOARDING_WELCOME_LANDING_EXISTING_USER},
-
- // Email interstitial strings.
- {"emailInterstitialTitle",
- IDS_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_TITLE},
- {"emailInterstitialContinue",
- IDS_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_CONTINUE},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings,
base::size(kLocalizedStrings));
}
+const std::map<std::string, bool>& GetGzipMap() {
+ static std::map<std::string, bool>* gzip_map = nullptr;
+ if (!gzip_map) {
+ gzip_map = new std::map<std::string, bool>();
+ for (size_t i = 0; i < kOnboardingWelcomeResourcesSize; ++i) {
+ (*gzip_map)[kOnboardingWelcomeResources[i].name] =
+ kOnboardingWelcomeResources[i].gzipped;
+ }
+ (*gzip_map)[kPreviewBackgroundPath] = false;
+ }
+ return *gzip_map;
+}
+
+} // namespace
+
WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
: content::WebUIController(web_ui), weak_ptr_factory_(this) {
Profile* profile = Profile::FromWebUI(web_ui);
@@ -147,9 +168,6 @@ WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
DarkModeHandler::Initialize(web_ui, html_source);
- bool is_dice =
- AccountConsistencyModeManager::IsDiceEnabledForProfile(profile);
-
// There are multiple possible configurations that affects the layout, but
// first add resources that are shared across all layouts.
html_source->AddResourcePath("logo.png", IDR_PRODUCT_LOGO_128);
@@ -169,11 +187,6 @@ WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
html_source->SetDefaultResource(
IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_HTML);
- // chrome://welcome/email-interstitial
- html_source->AddResourcePath(
- "email-interstitial",
- IDR_WELCOME_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_HTML);
-
#if defined(OS_WIN)
html_source->AddBoolean(
"is_win10", base::win::GetVersion() >= base::win::VERSION_WIN10);
@@ -183,10 +196,6 @@ WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
web_ui->AddMessageHandler(
std::make_unique<nux::BookmarkHandler>(profile->GetPrefs()));
- // Add email provider bookmarking onboarding module.
- web_ui->AddMessageHandler(std::make_unique<nux::EmailHandler>());
- nux::EmailHandler::AddSources(html_source);
-
// Add google apps bookmarking onboarding module.
web_ui->AddMessageHandler(std::make_unique<nux::GoogleAppsHandler>());
@@ -203,13 +212,17 @@ WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
nux::GetNuxOnboardingModules(profile)
.FindKey("returning-user")
->GetString());
- html_source->AddBoolean("showEmailInterstitial",
- nux::GetNuxOnboardingModules(profile)
- .FindKey("show-email-interstitial")
- ->GetBool());
- html_source->SetRequestFilter(base::BindRepeating(
- &HandleRequestCallback, weak_ptr_factory_.GetWeakPtr()));
- } else if (kIsBranded && is_dice) {
+ html_source->AddBoolean("signinAllowed", profile->GetPrefs()->GetBoolean(
+ prefs::kSigninAllowed));
+ html_source->SetRequestFilter(
+ base::BindRepeating(&ShouldHandleRequestCallback,
+ weak_ptr_factory_.GetWeakPtr()),
+ base::BindRepeating(&HandleRequestCallback,
+ weak_ptr_factory_.GetWeakPtr()));
+ html_source->UseGzip(base::BindRepeating(&WelcomeUI::IsGzipped));
+ html_source->SetJsonPath("strings.js");
+ } else if (kIsBranded &&
+ AccountConsistencyModeManager::IsDiceEnabledForProfile(profile)) {
// Use special layout if the application is branded and DICE is enabled.
html_source->AddLocalizedString("headerText", IDS_WELCOME_HEADER);
html_source->AddLocalizedString("acceptText",
@@ -270,3 +283,9 @@ void WelcomeUI::StorePageSeen(Profile* profile) {
// Store that this profile has been shown the Welcome page.
profile->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, true);
}
+
+bool WelcomeUI::IsGzipped(const std::string& path) {
+ const std::map<std::string, bool>& gzip_map = GetGzipMap();
+ const auto it = gzip_map.find(path);
+ return it == gzip_map.end() || it->second;
+}
diff --git a/chromium/chrome/browser/ui/webui/welcome/welcome_ui.h b/chromium/chrome/browser/ui/webui/welcome/welcome_ui.h
index e74a6f92dfe..55896debd39 100644
--- a/chromium/chrome/browser/ui/webui/welcome/welcome_ui.h
+++ b/chromium/chrome/browser/ui/webui/welcome/welcome_ui.h
@@ -28,6 +28,10 @@ class WelcomeUI : public content::WebUIController {
size_t background_index,
const content::WebUIDataSource::GotDataCallback& callback);
+ protected:
+ // Visible for testing.
+ static bool IsGzipped(const std::string& path);
+
private:
void StorePageSeen(Profile* profile);
std::unique_ptr<nux::NtpBackgroundFetcher> background_fetcher_;
diff --git a/chromium/chrome/browser/ui/webui/welcome/welcome_ui_unittest.cc b/chromium/chrome/browser/ui/webui/welcome/welcome_ui_unittest.cc
new file mode 100644
index 00000000000..9f8592ed129
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/welcome/welcome_ui_unittest.cc
@@ -0,0 +1,27 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/welcome/welcome_ui.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+class TestWelcomeUI : public WelcomeUI {
+ public:
+ using WelcomeUI::IsGzipped;
+};
+
+TEST(WelcomeUITest, IsGzipped) {
+ // Default resource.
+ EXPECT_TRUE(TestWelcomeUI::IsGzipped(""));
+ EXPECT_TRUE(TestWelcomeUI::IsGzipped("welcome.html"));
+ EXPECT_TRUE(TestWelcomeUI::IsGzipped("new-user"));
+ EXPECT_TRUE(TestWelcomeUI::IsGzipped("returning-user"));
+
+ // Images are intentionally not gzipped.
+ EXPECT_FALSE(TestWelcomeUI::IsGzipped("images/youtube_1x.png"));
+
+ // This is a dynamic path that fetches from the network and should not be
+ // considered gzipped.
+ EXPECT_FALSE(TestWelcomeUI::IsGzipped("preview-background.jpg"));
+}
diff --git a/chromium/chrome/browser/ui/webui/welcome/welcome_win10_handler.cc b/chromium/chrome/browser/ui/webui/welcome/welcome_win10_handler.cc
index f629bf36c28..954431fb0d8 100644
--- a/chromium/chrome/browser/ui/webui/welcome/welcome_win10_handler.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/welcome_win10_handler.cc
@@ -12,6 +12,9 @@
#include "base/values.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/shell_integration_win.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
@@ -140,9 +143,12 @@ void WelcomeWin10Handler::HandleSetDefaultBrowser(const base::ListValue* args) {
}
void WelcomeWin10Handler::HandleContinue(const base::ListValue* args) {
- web_ui()->GetWebContents()->GetController().LoadURL(
- GURL(chrome::kChromeUINewTabURL), content::Referrer(),
- ui::PageTransition::PAGE_TRANSITION_LINK, std::string());
+ content::WebContents* contents = web_ui()->GetWebContents();
+ Browser* browser = chrome::FindBrowserWithWebContents(contents);
+ NavigateParams params(browser, GURL(chrome::kChromeUINewTabURL),
+ ui::PageTransition::PAGE_TRANSITION_LINK);
+ params.source_contents = web_ui()->GetWebContents();
+ Navigate(&params);
}
void WelcomeWin10Handler::StartIsPinnedToTaskbarCheck() {
diff --git a/chromium/chrome/browser/vr/BUILD.gn b/chromium/chrome/browser/vr/BUILD.gn
index f4e68e20917..c382d5063a6 100644
--- a/chromium/chrome/browser/vr/BUILD.gn
+++ b/chromium/chrome/browser/vr/BUILD.gn
@@ -188,6 +188,7 @@ component("vr_ui") {
"//chrome/app:generated_resources",
"//chrome/common:constants",
"//components/url_formatter",
+ "//device/vr/buildflags:buildflags",
"//media",
"//net",
"//skia",
@@ -274,6 +275,7 @@ component("vr_common") {
"//device/vr/public/mojom",
"//media",
"//net",
+ "//services/audio/public/cpp",
"//services/metrics/public/cpp:ukm_builders",
"//skia",
"//ui/base",
@@ -647,7 +649,24 @@ repack("vr_test_pak") {
# the equivalent to Android's @Restriction annotation that allows you to
# easily skip tests at runtime).
if (!is_android) {
- test("xr_browser_tests") {
+ group("xr_browser_tests") {
+ testonly = true
+ data_deps = [
+ ":xr_browser_tests_binary",
+ ":xr_browser_tests_runner",
+ ]
+
+ if (is_win) {
+ # The .exe is necessary even though the target isn't an actual executable
+ # since mb.py automatically appends .exe when looking for runtime deps
+ # on Windows.
+ write_runtime_deps = "$root_out_dir/$target_name.exe.runtime_deps"
+ } else {
+ write_runtime_deps = "$root_out_dir/$target_name.runtime_deps"
+ }
+ }
+
+ test("xr_browser_tests_binary") {
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
# Common infrastructure.
@@ -678,9 +697,12 @@ if (!is_android) {
"//chrome/test:browser_tests_runner",
"//chrome/test:test_support",
"//chrome/test:test_support_ui",
+ "//device/base",
"//device/vr:vr",
+ "//device/vr/buildflags:buildflags",
"//device/vr/public/mojom:mojom",
"//device/vr/public/mojom:test_mojom",
+ "//services/service_manager/sandbox",
]
data_deps = []
@@ -707,15 +729,32 @@ if (!is_android) {
# Tests.
sources += [
"webxr_vr_frame_pose_browser_test.cc",
+ "webxr_vr_indicators_browser_test.cc",
"webxr_vr_input_browser_test.cc",
+ "webxr_vr_isolated_device_service_test.cc",
"webxr_vr_permission_request_browser_test.cc",
"webxr_vr_pixel_browser_test.cc",
"webxr_vr_tab_browser_test.cc",
]
- deps += [ "//third_party/openvr:openvr" ]
+ deps += [
+ "//components/content_settings/core/browser:browser",
+ "//third_party/openvr:openvr",
+ ]
data_deps += [ "//device/vr:openvr_mock" ]
}
}
+
+ # TODO(https://crbug.com/816629): Migrate this to a generic wrapper script
+ # once the functionality is available on all platforms.
+ copy("xr_browser_tests_runner") {
+ testonly = true
+ sources = [
+ "test/run_xr_browser_tests.py",
+ ]
+ outputs = [
+ "$root_out_dir/run_xr_browser_tests.py",
+ ]
+ }
}
diff --git a/chromium/chrome/browser/web_applications/BUILD.gn b/chromium/chrome/browser/web_applications/BUILD.gn
index 0dd334a8bfc..fe468bf1c5b 100644
--- a/chromium/chrome/browser/web_applications/BUILD.gn
+++ b/chromium/chrome/browser/web_applications/BUILD.gn
@@ -13,10 +13,6 @@ source_set("web_applications") {
"external_web_apps.h",
"file_utils_wrapper.cc",
"file_utils_wrapper.h",
- "policy/web_app_policy_constants.cc",
- "policy/web_app_policy_constants.h",
- "policy/web_app_policy_manager.cc",
- "policy/web_app_policy_manager.h",
"system_web_app_manager.cc",
"system_web_app_manager.h",
"web_app.cc",
@@ -31,12 +27,12 @@ source_set("web_applications") {
"web_app_install_finalizer.h",
"web_app_install_manager.cc",
"web_app_install_manager.h",
+ "web_app_install_task.cc",
+ "web_app_install_task.h",
"web_app_registrar.cc",
"web_app_registrar.h",
"web_app_tab_helper.cc",
"web_app_tab_helper.h",
- "web_app_utils.cc",
- "web_app_utils.h",
]
deps = [
@@ -72,6 +68,10 @@ source_set("web_applications_test_support") {
"test/test_web_app_database.h",
"test/test_web_app_database_factory.cc",
"test/test_web_app_database_factory.h",
+ "test/test_web_app_ui_delegate.cc",
+ "test/test_web_app_ui_delegate.h",
+ "test/test_web_app_url_loader.cc",
+ "test/test_web_app_url_loader.h",
"test/web_app_test.cc",
"test/web_app_test.h",
]
@@ -92,7 +92,7 @@ source_set("web_applications_unit_tests") {
sources = [
"web_app_database_unittest.cc",
"web_app_icon_manager_unittest.cc",
- "web_app_install_manager_unittest.cc",
+ "web_app_install_task_unittest.cc",
"web_app_registrar_unittest.cc",
"web_app_utils_unittest.cc",
]
@@ -156,6 +156,7 @@ source_set("browser_tests") {
deps = [
":web_app_group",
"//chrome/browser/web_applications/bookmark_apps:browser_tests",
+ "//chrome/browser/web_applications/components:browser_tests",
"//chrome/browser/web_applications/extensions:browser_tests",
]
}
diff --git a/chromium/chrome/browser/web_applications/bookmark_apps/BUILD.gn b/chromium/chrome/browser/web_applications/bookmark_apps/BUILD.gn
index b8cfbab62b9..10403c29f31 100644
--- a/chromium/chrome/browser/web_applications/bookmark_apps/BUILD.gn
+++ b/chromium/chrome/browser/web_applications/bookmark_apps/BUILD.gn
@@ -20,6 +20,7 @@ source_set("bookmark_apps") {
"//chrome/common",
"//components/favicon/content",
"//components/pref_registry",
+ "//extensions/browser",
"//skia",
]
}
@@ -48,6 +49,7 @@ source_set("unit_tests") {
testonly = true
sources = [
+ "bookmark_app_install_manager_unittest.cc",
"external_web_apps_unittest.cc",
"policy/web_app_policy_manager_unittest.cc",
"system_web_app_manager_unittest.cc",
diff --git a/chromium/chrome/browser/web_applications/components/BUILD.gn b/chromium/chrome/browser/web_applications/components/BUILD.gn
index e04a00747ab..8d139563596 100644
--- a/chromium/chrome/browser/web_applications/components/BUILD.gn
+++ b/chromium/chrome/browser/web_applications/components/BUILD.gn
@@ -6,9 +6,17 @@ source_set("components") {
sources = [
"app_registrar.h",
"install_finalizer.h",
+ "install_manager.cc",
"install_manager.h",
+ "install_manager_observer.h",
+ "install_options.cc",
+ "install_options.h",
"pending_app_manager.cc",
"pending_app_manager.h",
+ "policy/web_app_policy_constants.cc",
+ "policy/web_app_policy_constants.h",
+ "policy/web_app_policy_manager.cc",
+ "policy/web_app_policy_manager.h",
"web_app_audio_focus_id_map.cc",
"web_app_audio_focus_id_map.h",
"web_app_constants.h",
@@ -20,6 +28,10 @@ source_set("components") {
"web_app_icon_generator.h",
"web_app_install_utils.cc",
"web_app_install_utils.h",
+ "web_app_provider_base.cc",
+ "web_app_provider_base.h",
+ "web_app_provider_base_factory.cc",
+ "web_app_provider_base_factory.h",
"web_app_shortcut.cc",
"web_app_shortcut.h",
"web_app_shortcut_chromeos.cc",
@@ -29,6 +41,11 @@ source_set("components") {
"web_app_shortcut_win.h",
"web_app_tab_helper_base.cc",
"web_app_tab_helper_base.h",
+ "web_app_ui_delegate.h",
+ "web_app_url_loader.cc",
+ "web_app_url_loader.h",
+ "web_app_utils.cc",
+ "web_app_utils.h",
# TODO(nigeltao): move these two files from
# //chrome/browser/web_applications/components to a stand-alone
@@ -57,6 +74,8 @@ source_set("components") {
"//chrome/common",
"//components/crx_file",
"//components/favicon/content",
+ "//components/keyed_service/content",
+ "//components/pref_registry",
"//content/public/browser",
"//skia",
]
@@ -73,6 +92,8 @@ source_set("test_support") {
deps = [
":components",
"//base",
+ "//base/test:test_support",
+ "//content/public/browser",
"//url",
]
}
@@ -109,3 +130,20 @@ source_set("unit_tests") {
"//testing/gtest",
]
}
+
+source_set("browser_tests") {
+ testonly = true
+
+ sources = [
+ "web_app_url_loader_browsertest.cc",
+ ]
+
+ defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
+
+ deps = [
+ "//chrome/browser/web_applications/components",
+ "//chrome/test:test_support",
+ "//chrome/test:test_support_ui",
+ "//net:test_support",
+ ]
+}
diff --git a/chromium/chrome/browser/web_applications/extensions/BUILD.gn b/chromium/chrome/browser/web_applications/extensions/BUILD.gn
index 994684d6b31..887a579cde8 100644
--- a/chromium/chrome/browser/web_applications/extensions/BUILD.gn
+++ b/chromium/chrome/browser/web_applications/extensions/BUILD.gn
@@ -16,6 +16,8 @@ source_set("extensions") {
"bookmark_app_registrar.h",
"bookmark_app_tab_helper.cc",
"bookmark_app_tab_helper.h",
+ "bookmark_app_uninstaller.cc",
+ "bookmark_app_uninstaller.h",
"bookmark_app_util.cc",
"bookmark_app_util.h",
"pending_bookmark_app_manager.cc",
@@ -46,6 +48,7 @@ source_set("unit_tests") {
sources = [
"bookmark_app_install_finalizer_unittest.cc",
"bookmark_app_installation_task_unittest.cc",
+ "bookmark_app_uninstaller_unittest.cc",
"bookmark_app_util_unittest.cc",
"pending_bookmark_app_manager_unittest.cc",
"web_app_extension_ids_map_unittest.cc",
@@ -55,7 +58,9 @@ source_set("unit_tests") {
":extensions",
"//chrome/browser",
"//chrome/browser/web_applications:web_app_group",
+ "//chrome/browser/web_applications:web_applications_on_extensions",
"//chrome/browser/web_applications:web_applications_test_support",
+ "//chrome/browser/web_applications/bookmark_apps",
"//chrome/browser/web_applications/components",
"//chrome/common",
"//chrome/test:test_support",