summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser')
-rw-r--r--chromium/chrome/browser/BUILD.gn387
-rw-r--r--chromium/chrome/browser/accessibility/accessibility_extension_api.h5
-rw-r--r--chromium/chrome/browser/accessibility/accessibility_labels_service.cc1
-rw-r--r--chromium/chrome/browser/accessibility/accessibility_ui.cc256
-rw-r--r--chromium/chrome/browser/accessibility/image_annotation_browsertest.cc24
-rw-r--r--chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc1
-rw-r--r--chromium/chrome/browser/android/metrics/BUILD.gn1
-rw-r--r--chromium/chrome/browser/android/thin_webview/internal/BUILD.gn2
-rw-r--r--chromium/chrome/browser/android/vr/BUILD.gn12
-rw-r--r--chromium/chrome/browser/browser_resources.grd88
-rw-r--r--chromium/chrome/browser/browser_switcher/bho/BUILD.gn1
-rw-r--r--chromium/chrome/browser/chrome_notification_types.h4
-rw-r--r--chromium/chrome/browser/chromeos/BUILD.gn218
-rw-r--r--chromium/chrome/browser/chromeos/crostini/BUILD.gn (renamed from chromium/chrome/browser/ui/app_list/search/logging/BUILD.gn)6
-rw-r--r--chromium/chrome/browser/chromeos/crostini/crostini_installer_types.mojom32
-rw-r--r--chromium/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc39
-rw-r--r--chromium/chrome/browser/devtools/BUILD.gn10
-rw-r--r--chromium/chrome/browser/devtools/OWNERS1
-rw-r--r--chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.cc5
-rw-r--r--chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.h1
-rw-r--r--chromium/chrome/browser/devtools/chrome_devtools_session.cc3
-rw-r--r--chromium/chrome/browser/devtools/chrome_devtools_session.h2
-rw-r--r--chromium/chrome/browser/devtools/device/android_device_manager.cc1
-rw-r--r--chromium/chrome/browser/devtools/device/devtools_android_bridge.cc4
-rw-r--r--chromium/chrome/browser/devtools/device/devtools_device_discovery.h1
-rw-r--r--chromium/chrome/browser/devtools/device/port_forwarding_controller.cc20
-rw-r--r--chromium/chrome/browser/devtools/device/tcp_device_provider.cc35
-rw-r--r--chromium/chrome/browser/devtools/device/tcp_device_provider.h8
-rw-r--r--chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc22
-rw-r--r--chromium/chrome/browser/devtools/devtools_ui_bindings.cc146
-rw-r--r--chromium/chrome/browser/devtools/devtools_window.cc25
-rw-r--r--chromium/chrome/browser/devtools/devtools_window.h8
-rw-r--r--chromium/chrome/browser/devtools/frontend/devtools_discovery_page.html28
-rw-r--r--chromium/chrome/browser/devtools/inspector_protocol_config.json5
-rw-r--r--chromium/chrome/browser/devtools/protocol/devtools_protocol_browsertest.cc336
-rw-r--r--chromium/chrome/browser/devtools/protocol/security_handler.cc246
-rw-r--r--chromium/chrome/browser/devtools/protocol/security_handler.h37
-rw-r--r--chromium/chrome/browser/devtools/serialize_host_descriptions.cc6
-rw-r--r--chromium/chrome/browser/extensions/BUILD.gn7
-rw-r--r--chromium/chrome/browser/extensions/api/OWNERS2
-rw-r--r--chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc59
-rw-r--r--chromium/chrome/browser/extensions/api/autofill_private/autofill_private_api.h21
-rw-r--r--chromium/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc23
-rw-r--r--chromium/chrome/browser/extensions/api/automation/automation_apitest.cc8
-rw-r--r--chromium/chrome/browser/extensions/api/automation_internal/chrome_automation_internal_api_delegate.cc1
-rw-r--r--chromium/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc15
-rw-r--r--chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc35
-rw-r--r--chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h13
-rw-r--r--chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api_unittest.cc22
-rw-r--r--chromium/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc5
-rw-r--r--chromium/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc16
-rw-r--r--chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc70
-rw-r--r--chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.h7
-rw-r--r--chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc85
-rw-r--r--chromium/chrome/browser/extensions/api/chrome_extensions_api_client.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/commands/command_service.cc5
-rw-r--r--chromium/chrome/browser/extensions/api/commands/command_service.h4
-rw-r--r--chromium/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc35
-rw-r--r--chromium/chrome/browser/extensions/api/content_settings/content_settings_service.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/content_settings/content_settings_service.h4
-rw-r--r--chromium/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/context_menus/context_menus_api.cc7
-rw-r--r--chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.cc13
-rw-r--r--chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h4
-rw-r--r--chromium/chrome/browser/extensions/api/cookies/cookies_api.cc33
-rw-r--r--chromium/chrome/browser/extensions/api/cookies/cookies_api.h8
-rw-r--r--chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc3
-rw-r--r--chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc21
-rw-r--r--chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc16
-rw-r--r--chromium/chrome/browser/extensions/api/debugger/debugger_api.cc5
-rw-r--r--chromium/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc11
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h3
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc214
-rw-r--r--chromium/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc284
-rw-r--r--chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc78
-rw-r--r--chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h32
-rw-r--r--chromium/chrome/browser/extensions/api/developer_private/developer_private_api.cc20
-rw-r--r--chromium/chrome/browser/extensions/api/developer_private/developer_private_api.h26
-rw-r--r--chromium/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/device_permissions_manager_unittest.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/downloads/downloads_api.cc38
-rw-r--r--chromium/chrome/browser/extensions/api/downloads/downloads_api.h7
-rw-r--r--chromium/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc52
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_api.cc1
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc70
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc96
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h28
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc498
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc65
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc702
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h262
-rw-r--r--chromium/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc585
-rw-r--r--chromium/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc1
-rw-r--r--chromium/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/file_system/file_system_apitest.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc18
-rw-r--r--chromium/chrome/browser/extensions/api/history/history_api.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/history/history_api.h7
-rw-r--r--chromium/chrome/browser/extensions/api/identity/extension_token_key.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/identity/extension_token_key.h6
-rw-r--r--chromium/chrome/browser/extensions/api/identity/extension_token_key_unittest.cc8
-rw-r--r--chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h2
-rw-r--r--chromium/chrome/browser/extensions/api/identity/identity_apitest.cc50
-rw-r--r--chromium/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc8
-rw-r--r--chromium/chrome/browser/extensions/api/identity/identity_mint_queue_unittest.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.cc3
-rw-r--r--chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.h4
-rw-r--r--chromium/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_chromeos_unittest.cc31
-rw-r--r--chromium/chrome/browser/extensions/api/image_writer_private/test_utils.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h4
-rw-r--r--chromium/chrome/browser/extensions/api/input_ime/input_ime_api.cc47
-rw-r--r--chromium/chrome/browser/extensions/api/input_ime/input_ime_api.h21
-rw-r--r--chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc70
-rw-r--r--chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.h25
-rw-r--r--chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h10
-rw-r--r--chromium/chrome/browser/extensions/api/input_ime/input_ime_event_router_base.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/management/management_api_browsertest.cc13
-rw-r--r--chromium/chrome/browser/extensions/api/management/management_api_non_persistent_apitest.cc7
-rw-r--r--chromium/chrome/browser/extensions/api/management/management_api_unittest.cc47
-rw-r--r--chromium/chrome/browser/extensions/api/management/management_apitest.cc20
-rw-r--r--chromium/chrome/browser/extensions/api/management/management_browsertest.cc45
-rw-r--r--chromium/chrome/browser/extensions/api/media_perception_private/media_perception_api_delegate_chromeos.cc1
-rw-r--r--chromium/chrome/browser/extensions/api/messaging/chrome_messaging_delegate.cc9
-rw-r--r--chromium/chrome/browser/extensions/api/messaging/native_messaging_apitest.cc23
-rw-r--r--chromium/chrome/browser/extensions/api/messaging/native_process_launcher.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc25
-rw-r--r--chromium/chrome/browser/extensions/api/notifications/notifications_apitest.cc9
-rw-r--r--chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/omnibox/omnibox_api.h4
-rw-r--r--chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc21
-rw-r--r--chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.h2
-rw-r--r--chromium/chrome/browser/extensions/api/preference/preference_api.cc55
-rw-r--r--chromium/chrome/browser/extensions/api/preference/preference_api.h19
-rw-r--r--chromium/chrome/browser/extensions/api/preference/preference_apitest.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/processes/processes_api.cc5
-rw-r--r--chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc14
-rw-r--r--chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h4
-rw-r--r--chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate_unittest.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api_unittest.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc150
-rw-r--r--chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h52
-rw-r--r--chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_unittest.cc174
-rw-r--r--chromium/chrome/browser/extensions/api/sessions/sessions_api.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc4
-rw-r--r--chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h4
-rw-r--r--chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_method_short.cc1
-rw-r--r--chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_on_off.cc1
-rw-r--r--chromium/chrome/browser/extensions/api/settings_private/generated_time_zone_pref_base.cc1
-rw-r--r--chromium/chrome/browser/extensions/api/settings_private/prefs_util.cc15
-rw-r--r--chromium/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc6
-rw-r--r--chromium/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc18
-rw-r--r--chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc62
-rw-r--r--chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc9
-rw-r--r--chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h8
-rw-r--r--chromium/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc16
-rw-r--r--chromium/chrome/browser/extensions/api/socket/tls_socket_unittest.cc26
-rw-r--r--chromium/chrome/browser/extensions/api/socket/udp_socket_unittest.cc19
-rw-r--r--chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc7
-rw-r--r--chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.h4
-rw-r--r--chromium/chrome/browser/extensions/api/storage/managed_value_store_cache.cc3
-rw-r--r--chromium/chrome/browser/extensions/api/storage/settings_sync_unittest.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc5
-rw-r--r--chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.h4
-rw-r--r--chromium/chrome/browser/extensions/api/system_private/system_private_api.cc35
-rw-r--r--chromium/chrome/browser/extensions/api/system_private/system_private_apitest.cc16
-rw-r--r--chromium/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc39
-rw-r--r--chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc36
-rw-r--r--chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h5
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_api.cc31
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_constants.cc1
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_constants.h1
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_event_router.cc10
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_event_router.h14
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_test.cc77
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc7
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/windows_event_router.cc5
-rw-r--r--chromium/chrome/browser/extensions/api/tabs/windows_event_router.h6
-rw-r--r--chromium/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc13
-rw-r--r--chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc2
-rw-r--r--chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.h3
-rw-r--r--chromium/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc123
-rw-r--r--chromium/chrome/browser/extensions/api/web_request/web_request_apitest.cc96
-rw-r--r--chromium/chrome/browser/extensions/api/webrtc_logging_private/OWNERS2
-rw-r--r--chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc1
-rw-r--r--chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.h1
-rw-r--r--chromium/chrome/browser/flag-metadata.json550
-rw-r--r--chromium/chrome/browser/flag-never-expire-list.json1
-rw-r--r--chromium/chrome/browser/image_fetcher/BUILD.gn33
-rw-r--r--chromium/chrome/browser/media/webrtc/desktop_media_list.h14
-rw-r--r--chromium/chrome/browser/metrics/perf/BUILD.gn20
-rw-r--r--chromium/chrome/browser/notifications/scheduler/internal/BUILD.gn2
-rw-r--r--chromium/chrome/browser/notifications/scheduler/test/BUILD.gn29
-rw-r--r--chromium/chrome/browser/performance_manager/BUILD.gn11
-rw-r--r--chromium/chrome/browser/performance_manager/webui_graph_dump.mojom69
-rw-r--r--chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc5
-rw-r--r--chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h3
-rw-r--r--chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc20
-rw-r--r--chromium/chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc3
-rw-r--r--chromium/chrome/browser/printing/cloud_print/privet_http_unittest.cc2
-rw-r--r--chromium/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc4
-rw-r--r--chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.cc26
-rw-r--r--chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.h7
-rw-r--r--chromium/chrome/browser/printing/cloud_print/privet_url_loader.cc3
-rw-r--r--chromium/chrome/browser/printing/cloud_print/privet_url_loader.h3
-rw-r--r--chromium/chrome/browser/printing/pdf_nup_converter_client.cc22
-rw-r--r--chromium/chrome/browser/printing/pdf_nup_converter_client.h15
-rw-r--r--chromium/chrome/browser/printing/pdf_nup_converter_client_browsertest.cc191
-rw-r--r--chromium/chrome/browser/printing/pdf_to_emf_converter.cc38
-rw-r--r--chromium/chrome/browser/printing/pdf_to_emf_converter_browsertest.cc28
-rw-r--r--chromium/chrome/browser/printing/print_browsertest.cc57
-rw-r--r--chromium/chrome/browser/printing/print_dialog_cloud_win.cc3
-rw-r--r--chromium/chrome/browser/printing/print_job.cc4
-rw-r--r--chromium/chrome/browser/printing/print_job_worker.cc18
-rw-r--r--chromium/chrome/browser/printing/print_preview_message_handler.cc56
-rw-r--r--chromium/chrome/browser/printing/print_test_utils.cc74
-rw-r--r--chromium/chrome/browser/printing/print_test_utils.h2
-rw-r--r--chromium/chrome/browser/printing/print_view_manager.cc86
-rw-r--r--chromium/chrome/browser/printing/print_view_manager.h38
-rw-r--r--chromium/chrome/browser/printing/print_view_manager_base.cc7
-rw-r--r--chromium/chrome/browser/printing/print_view_manager_base.h4
-rw-r--r--chromium/chrome/browser/printing/print_view_manager_basic_unittest.cc4
-rw-r--r--chromium/chrome/browser/printing/print_view_manager_common.cc8
-rw-r--r--chromium/chrome/browser/printing/print_view_manager_common.h4
-rw-r--r--chromium/chrome/browser/printing/print_view_manager_unittest.cc17
-rw-r--r--chromium/chrome/browser/resource_coordinator/BUILD.gn6
-rw-r--r--chromium/chrome/browser/resources/BUILD.gn79
-rw-r--r--chromium/chrome/browser/resources/accessibility/accessibility.html94
-rw-r--r--chromium/chrome/browser/resources/accessibility/accessibility.js74
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/BUILD.gn24
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/adapter_broker.js7
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.html13
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.js8
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/debug_log_page.js68
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/page.html1
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/page.js314
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/page_manager.html1
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/page_manager.js800
-rw-r--r--chromium/chrome/browser/resources/bluetooth_internals/resources.grd21
-rw-r--r--chromium/chrome/browser/resources/bookmarks/README.md6
-rw-r--r--chromium/chrome/browser/resources/bookmarks/command_manager.html2
-rw-r--r--chromium/chrome/browser/resources/bookmarks/command_manager.js28
-rw-r--r--chromium/chrome/browser/resources/bookmarks/shared_style.html4
-rw-r--r--chromium/chrome/browser/resources/browser_switch/BUILD.gn15
-rw-r--r--chromium/chrome/browser/resources/browser_switch/app.html68
-rw-r--r--chromium/chrome/browser/resources/browser_switch/app.js14
-rw-r--r--chromium/chrome/browser/resources/browser_switch/browser_switch.html5
-rw-r--r--chromium/chrome/browser/resources/browser_switch/browser_switch_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/browser_switch/browser_switch_proxy.js49
-rw-r--r--chromium/chrome/browser/resources/chromeos/BUILD.gn1
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/BUILD.gn23
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/camera_resources.grd19
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/_locales/en/messages.json30
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn22
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/js/device/BUILD.gn5
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/js/externs/BUILD.gn (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/BUILD.gn)9
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn8
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn9
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/js/views/BUILD.gn1
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/js/views/camera/BUILD.gn (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-form-warning/BUILD.gn)16
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/manifest.json9
-rw-r--r--chromium/chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd21
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json32
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd43
-rw-r--r--chromium/chrome/browser/resources/chromeos/crostini_installer/BUILD.gn44
-rw-r--r--chromium/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json5
-rw-r--r--chromium/chrome/browser/resources/chromeos/input_method/xkb_manifest.json5
-rw-r--r--chromium/chrome/browser/resources/chromeos/internet_config_dialog/BUILD.gn3
-rw-r--r--chromium/chrome/browser/resources/chromeos/internet_detail_dialog/BUILD.gn8
-rw-r--r--chromium/chrome/browser/resources/chromeos/login/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/chromeos/network_ui/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn26
-rw-r--r--chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn13
-rw-r--r--chromium/chrome/browser/resources/component_extension_resources.grd52
-rw-r--r--chromium/chrome/browser/resources/conflicts/about_conflicts.html26
-rw-r--r--chromium/chrome/browser/resources/conflicts/about_conflicts.js20
-rw-r--r--chromium/chrome/browser/resources/cryptotoken/enroller.js53
-rw-r--r--chromium/chrome/browser/resources/dev_ui/dev_ui_loader_error.html (renamed from chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.css)29
-rw-r--r--chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.grdp6
-rw-r--r--chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.html22
-rw-r--r--chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.js51
-rw-r--r--chromium/chrome/browser/resources/discards/BUILD.gn3
-rw-r--r--chromium/chrome/browser/resources/discards/database_tab.js60
-rw-r--r--chromium/chrome/browser/resources/discards/discards.js4
-rw-r--r--chromium/chrome/browser/resources/discards/discards_tab.js48
-rw-r--r--chromium/chrome/browser/resources/discards/graph_doc.js28
-rw-r--r--chromium/chrome/browser/resources/discards/graph_tab.js20
-rw-r--r--chromium/chrome/browser/resources/discards/mojo_api.html1
-rw-r--r--chromium/chrome/browser/resources/download_internals/BUILD.gn1
-rw-r--r--chromium/chrome/browser/resources/download_internals/download_internals.html8
-rw-r--r--chromium/chrome/browser/resources/downloads/BUILD.gn1
-rw-r--r--chromium/chrome/browser/resources/downloads/item.html2
-rw-r--r--chromium/chrome/browser/resources/extensions/BUILD.gn93
-rw-r--r--chromium/chrome/browser/resources/extensions/detail_view.html40
-rw-r--r--chromium/chrome/browser/resources/extensions/extensions.html2
-rw-r--r--chromium/chrome/browser/resources/extensions/extensions_resources.grd6
-rw-r--r--chromium/chrome/browser/resources/extensions/keyboard_shortcut_delegate.html1
-rw-r--r--chromium/chrome/browser/resources/extensions/keyboard_shortcut_delegate.js41
-rw-r--r--chromium/chrome/browser/resources/extensions/keyboard_shortcuts.html1
-rw-r--r--chromium/chrome/browser/resources/extensions/keyboard_shortcuts.js31
-rw-r--r--chromium/chrome/browser/resources/extensions/toolbar.html9
-rw-r--r--chromium/chrome/browser/resources/extensions/toolbar.js18
-rw-r--r--chromium/chrome/browser/resources/feedback/html/default.html5
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/authenticator.js12
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/okta_detect_success_injected.js58
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js159
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator_test.unitjs76
-rw-r--r--chromium/chrome/browser/resources/hangout_services/OWNERS2
-rw-r--r--chromium/chrome/browser/resources/hats/hats.html7
-rw-r--r--chromium/chrome/browser/resources/history/BUILD.gn1
-rw-r--r--chromium/chrome/browser/resources/history/history_list.html1
-rw-r--r--chromium/chrome/browser/resources/history/history_list.js7
-rw-r--r--chromium/chrome/browser/resources/identity_internals/identity_internals.js2
-rw-r--r--chromium/chrome/browser/resources/inline_login/inline_login.html1
-rw-r--r--chromium/chrome/browser/resources/local_ntp/customize.css26
-rw-r--r--chromium/chrome/browser/resources/local_ntp/customize.js121
-rw-r--r--chromium/chrome/browser/resources/local_ntp/doodles.css30
-rw-r--r--chromium/chrome/browser/resources/local_ntp/externs.js70
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/clock.svg1
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/close.svg1
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/dont_show.pngbin0 -> 101 bytes
-rw-r--r--chromium/chrome/browser/resources/local_ntp/icons/dont_show_2x.pngbin0 -> 133 bytes
-rw-r--r--chromium/chrome/browser/resources/local_ntp/local_ntp.css315
-rw-r--r--chromium/chrome/browser/resources/local_ntp/local_ntp.html22
-rw-r--r--chromium/chrome/browser/resources/local_ntp/local_ntp.js903
-rw-r--r--chromium/chrome/browser/resources/local_ntp/local_ntp_common.css2
-rw-r--r--chromium/chrome/browser/resources/local_ntp/local_ntp_resources.grd2
-rw-r--r--chromium/chrome/browser/resources/local_ntp/most_visited_single.css71
-rw-r--r--chromium/chrome/browser/resources/local_ntp/most_visited_single.html2
-rw-r--r--chromium/chrome/browser/resources/local_ntp/most_visited_single.js274
-rw-r--r--chromium/chrome/browser/resources/management/BUILD.gn31
-rw-r--r--chromium/chrome/browser/resources/management/icons.html5
-rw-r--r--chromium/chrome/browser/resources/management/icons.js10
-rw-r--r--chromium/chrome/browser/resources/management/management.html4
-rw-r--r--chromium/chrome/browser/resources/management/management_browser_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/management/management_browser_proxy.js278
-rw-r--r--chromium/chrome/browser/resources/management/management_ui.html19
-rw-r--r--chromium/chrome/browser/resources/management/management_ui.js539
-rw-r--r--chromium/chrome/browser/resources/media_router/BUILD.gn (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/BUILD.gn)9
-rw-r--r--chromium/chrome/browser/resources/media_router/media_router_internals.html4
-rw-r--r--chromium/chrome/browser/resources/media_router/media_router_internals.js28
-rw-r--r--chromium/chrome/browser/resources/ntp4/apps_page.js4
-rw-r--r--chromium/chrome/browser/resources/ntp4/incognito_and_guest_tab.css2
-rw-r--r--chromium/chrome/browser/resources/ntp4/incognito_tab.css46
-rw-r--r--chromium/chrome/browser/resources/ntp4/incognito_tab.html11
-rw-r--r--chromium/chrome/browser/resources/ntp4/incognito_tab.js26
-rw-r--r--chromium/chrome/browser/resources/ntp4/nav_dot.js2
-rw-r--r--chromium/chrome/browser/resources/ntp4/new_tab.css11
-rw-r--r--chromium/chrome/browser/resources/ntp4/new_tab.html2
-rw-r--r--chromium/chrome/browser/resources/ntp4/new_tab.js14
-rw-r--r--chromium/chrome/browser/resources/ntp4/tile_page.js4
-rw-r--r--chromium/chrome/browser/resources/offline_pages/BUILD.gn8
-rw-r--r--chromium/chrome/browser/resources/offline_pages/offline_internals.html7
-rw-r--r--chromium/chrome/browser/resources/offline_pages/offline_internals.js685
-rw-r--r--chromium/chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js531
-rw-r--r--chromium/chrome/browser/resources/omnibox/BUILD.gn21
-rw-r--r--chromium/chrome/browser/resources/omnibox/omnibox.html5
-rw-r--r--chromium/chrome/browser/resources/omnibox/omnibox.js2
-rw-r--r--chromium/chrome/browser/resources/omnibox/omnibox_output.js29
-rw-r--r--chromium/chrome/browser/resources/omnibox/resources.grd58
-rw-r--r--chromium/chrome/browser/resources/pdf/BUILD.gn57
-rw-r--r--chromium/chrome/browser/resources/pdf/annotation_tool.js15
-rw-r--r--chromium/chrome/browser/resources/pdf/controller.js494
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/BUILD.gn118
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-bookmark.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-bookmark.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js)19
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/BUILD.gn17
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-error-screen.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-error-screen.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.js)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/BUILD.gn17
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-form-warning.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-form-warning/viewer-form-warning.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-form-warning.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-form-warning/viewer-form-warning.js)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-ink-host.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/viewer-ink-host.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-ink-host.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/viewer-ink-host.js)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/BUILD.gn19
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.js)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/BUILD.gn18
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-page-selector.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/viewer-page-selector.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-page-selector.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/viewer-page-selector.js)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/BUILD.gn17
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.js)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/BUILD.gn17
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html)10
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js)3
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/BUILD.gn20
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pen-options.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/viewer-pen-options.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pen-options.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/viewer-pen-options.js)5
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.js)1
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-zoom-button.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.html)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-zoom-button.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js)0
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar.html (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.html)2
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar.js (renamed from chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js)8
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/BUILD.gn25
-rw-r--r--chromium/chrome/browser/resources/pdf/index.html17
-rw-r--r--chromium/chrome/browser/resources/pdf/ink/BUILD.gn3
-rw-r--r--chromium/chrome/browser/resources/pdf/ink/ink_api.js11
-rw-r--r--chromium/chrome/browser/resources/pdf/open_pdf_params_parser.js13
-rw-r--r--chromium/chrome/browser/resources/pdf/pdf_scripting_api.js185
-rw-r--r--chromium/chrome/browser/resources/pdf/pdf_viewer.js1482
-rw-r--r--chromium/chrome/browser/resources/pdf/toolbar_manager.js147
-rw-r--r--chromium/chrome/browser/resources/pdf/viewport.js22
-rw-r--r--chromium/chrome/browser/resources/pdf/viewport_scroller.js83
-rw-r--r--chromium/chrome/browser/resources/print_preview/BUILD.gn3
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/BUILD.gn11
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/destination.js49
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/destination_match.html1
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/destination_match.js33
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/document_info.js9
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/local_parsers.html1
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/margins.js41
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/model.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/model.js185
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/scaling.html (renamed from chromium/chrome/browser/resources/welcome/shared/bookmark_proxy.html)3
-rw-r--r--chromium/chrome/browser/resources/print_preview/data/scaling.js24
-rw-r--r--chromium/chrome/browser/resources/print_preview/native_layer.js15
-rw-r--r--chromium/chrome/browser/resources/print_preview/polymer3/demo.js116
-rw-r--r--chromium/chrome/browser/resources/print_preview/print_preview_resources.grd10
-rw-r--r--chromium/chrome/browser/resources/print_preview/print_preview_utils.js2
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/BUILD.gn7
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/advanced_options_settings.html1
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.html8
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.js35
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/app.html3
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/app.js4
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/destination_dialog.html5
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/destination_dialog.js6
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/destination_list_item.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/destination_select.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/destination_select.js2
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/duplex_settings.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/duplex_settings.js2
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/header.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/header_new.html2
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/icons.html (renamed from chromium/chrome/browser/resources/print_preview/icons.html)13
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/margin_control.js4
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/margin_control_container.js61
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/margins_settings.html15
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/margins_settings.js7
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/pages_per_sheet_settings.js3
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/pin_settings.js2
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/preview_area.html1
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/preview_area.js89
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/scaling_settings.html7
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/scaling_settings.js126
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/sidebar.html7
-rw-r--r--chromium/chrome/browser/resources/print_preview/ui/sidebar.js2
-rw-r--r--chromium/chrome/browser/resources/quota_internals/OWNERS5
-rw-r--r--chromium/chrome/browser/resources/quota_internals/event_handler.js6
-rw-r--r--chromium/chrome/browser/resources/quota_internals/message_dispatcher.js2
-rw-r--r--chromium/chrome/browser/resources/reset_password/BUILD.gn3
-rw-r--r--chromium/chrome/browser/resources/reset_password/reset_password.html9
-rw-r--r--chromium/chrome/browser/resources/reset_password/reset_password.js21
-rw-r--r--chromium/chrome/browser/resources/safety_tips/PRESUBMIT.py11
-rwxr-xr-xchromium/chrome/browser/resources/safety_tips/gen_safety_tips_proto.py10
-rw-r--r--chromium/chrome/browser/resources/safety_tips/safety_tips.asciipb17
-rw-r--r--chromium/chrome/browser/resources/sandbox_internals/BUILD.gn38
-rw-r--r--chromium/chrome/browser/resources/sandbox_internals/OWNERS3
-rw-r--r--chromium/chrome/browser/resources/sandbox_internals/sandbox_android_externs.js9
-rw-r--r--chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.html11
-rw-r--r--chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.js20
-rw-r--r--chromium/chrome/browser/resources/sandbox_internals/sandbox_internals_win.js108
-rw-r--r--chromium/chrome/browser/resources/settings/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/settings/a11y_page/a11y_page.html29
-rw-r--r--chromium/chrome/browser/resources/settings/a11y_page/a11y_page.js30
-rw-r--r--chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html48
-rw-r--r--chromium/chrome/browser/resources/settings/a11y_page/manage_a11y_page.js16
-rw-r--r--chromium/chrome/browser/resources/settings/about_page/about_page.js4
-rw-r--r--chromium/chrome/browser/resources/settings/about_page/about_page_browser_proxy.js29
-rw-r--r--chromium/chrome/browser/resources/settings/about_page/channel_switcher_dialog.html2
-rw-r--r--chromium/chrome/browser/resources/settings/about_page/detailed_build_info.html39
-rw-r--r--chromium/chrome/browser/resources/settings/about_page/detailed_build_info.js31
-rw-r--r--chromium/chrome/browser/resources/settings/android_apps_page/android_apps_page.html5
-rw-r--r--chromium/chrome/browser/resources/settings/android_apps_page/android_apps_subpage.html16
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/appearance_page.js2
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js53
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html10
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html17
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js62
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/payments_section.html14
-rw-r--r--chromium/chrome/browser/resources/settings/autofill_page/payments_section.js104
-rw-r--r--chromium/chrome/browser/resources/settings/basic_page/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/settings/basic_page/basic_page.html3
-rw-r--r--chromium/chrome/browser/resources/settings/basic_page/basic_page.js5
-rw-r--r--chromium/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn5
-rw-r--r--chromium/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn21
-rw-r--r--chromium/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/settings/controls/controlled_button.html2
-rw-r--r--chromium/chrome/browser/resources/settings/controls/controlled_button.js32
-rw-r--r--chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.html7
-rw-r--r--chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.js1
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/BUILD.gn8
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/display.html8
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/drive_cache_dialog.html31
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/drive_cache_dialog.js31
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/keyboard.js2
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/pointers.html4
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/storage.html19
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/storage.js56
-rw-r--r--chromium/chrome/browser/resources/settings/device_page/storage_external.html2
-rw-r--r--chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html7
-rw-r--r--chromium/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js17
-rw-r--r--chromium/chrome/browser/resources/settings/icons.html1
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/BUILD.gn7
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_config.html7
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_config.js47
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.html20
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_detail_page.js266
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_known_networks_page.js39
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_page.html21
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_page.js173
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/internet_subpage.js20
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.html1
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.js6
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/network_summary.js2
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/network_summary_item.html2
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/network_summary_item.js25
-rw-r--r--chromium/chrome/browser/resources/settings/internet_page/tether_connection_dialog.js15
-rw-r--r--chromium/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html7
-rw-r--r--chromium/chrome/browser/resources/settings/manifest.json2
-rw-r--r--chromium/chrome/browser/resources/settings/multidevice_page/BUILD.gn1
-rw-r--r--chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.html22
-rw-r--r--chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.html1
-rw-r--r--chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.js2
-rw-r--r--chromium/chrome/browser/resources/settings/os_settings_manifest.json2
-rw-r--r--chromium/chrome/browser/resources/settings/os_settings_resources.grd44
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/account_manager.html42
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/account_manager.js11
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/setup_pin_dialog.html7
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/sync_page.js5
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/user_list.html6
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/user_list.js10
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html10
-rw-r--r--chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js58
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/BUILD.gn24
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html4
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.js2
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.html35
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.js137
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.js37
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printer_shared_css.html8
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers.html4
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers.js17
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.html2
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.js5
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list.html42
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list.js110
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list_behavior.html2
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list_behavior.js98
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_manager.html5
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_manager.js182
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.html70
-rw-r--r--chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.js225
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/personalization_options.html17
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/personalization_options.js102
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/privacy_page.html19
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/privacy_page.js4
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.html94
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.js128
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_browser_proxy.js45
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.html9
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.js4
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.html1
-rw-r--r--chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.js16
-rw-r--r--chromium/chrome/browser/resources/settings/route.js45
-rw-r--r--chromium/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html5
-rw-r--r--chromium/chrome/browser/resources/settings/search_settings.js12
-rw-r--r--chromium/chrome/browser/resources/settings/settings_menu/settings_menu.html3
-rw-r--r--chromium/chrome/browser/resources/settings/settings_menu/settings_menu.js15
-rw-r--r--chromium/chrome/browser/resources/settings/settings_page/BUILD.gn2
-rw-r--r--chromium/chrome/browser/resources/settings/settings_page/settings_subpage.html2
-rw-r--r--chromium/chrome/browser/resources/settings/settings_resources.grd20
-rw-r--r--chromium/chrome/browser/resources/settings/settings_ui/BUILD.gn2
-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.js4
-rw-r--r--chromium/chrome/browser/resources/settings/site_favicon.js2
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.html4
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.js20
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/category_default_setting.js21
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.html8
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.js42
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/constants.js8
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_data.html2
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_data.js18
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_details.html9
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_details.js14
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_list_entry.html7
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_list_entry.js51
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_settings_behavior.js9
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js13
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.html11
-rw-r--r--chromium/chrome/browser/resources/settings/site_settings_page/site_settings_page.js10
-rw-r--r--chromium/chrome/browser/resources/signin/BUILD.gn18
-rw-r--r--chromium/chrome/browser/resources/signin/signin_email_confirmation/signin_email_confirmation.html2
-rw-r--r--chromium/chrome/browser/resources/signin/signin_error/signin_error.html7
-rw-r--r--chromium/chrome/browser/resources/signin/signin_shared_css.html70
-rw-r--r--chromium/chrome/browser/resources/signin/signin_shared_css.js11
-rw-r--r--chromium/chrome/browser/resources/signin/signin_shared_old_css.html45
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/BUILD.gn48
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.html6
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.js44
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.html311
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.js18
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_browser_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_browser_proxy.js114
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.html3
-rw-r--r--chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.js7
-rw-r--r--chromium/chrome/browser/resources/supervised_user_error_page_resources.grdp2
-rw-r--r--chromium/chrome/browser/resources/tab_strip/BUILD.gn22
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicator.html77
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicator.js19
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicators/picture_in_picture_alt.svg1
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicators/serial_port.svg1
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_audio_muting_rounded.svg1
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_audio_rounded.svg1
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_bluetooth_connected.svg1
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_media_capturing_with_arrow.svg1
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_media_recording.svg1
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_usb_connected.svg1
-rw-r--r--chromium/chrome/browser/resources/tab_strip/alert_indicators/vr_headset.svg1
-rw-r--r--chromium/chrome/browser/resources/tab_strip/tab.html248
-rw-r--r--chromium/chrome/browser/resources/tab_strip/tab.js80
-rw-r--r--chromium/chrome/browser/resources/tab_strip/tab_list.html38
-rw-r--r--chromium/chrome/browser/resources/tab_strip/tab_list.js307
-rw-r--r--chromium/chrome/browser/resources/tab_strip/tab_strip.html25
-rw-r--r--chromium/chrome/browser/resources/tab_strip/tab_strip_embedder_proxy.js39
-rw-r--r--chromium/chrome/browser/resources/tab_strip/tab_strip_resources.grd60
-rw-r--r--chromium/chrome/browser/resources/tab_strip/tabs_api_proxy.js72
-rw-r--r--chromium/chrome/browser/resources/tab_strip/types.js32
-rw-r--r--chromium/chrome/browser/resources/usb_internals/BUILD.gn21
-rw-r--r--chromium/chrome/browser/resources/usb_internals/resources.grd42
-rw-r--r--chromium/chrome/browser/resources/user_manager/shared_styles.html4
-rw-r--r--chromium/chrome/browser/resources/vr/OWNERS2
-rw-r--r--chromium/chrome/browser/resources/webapks/BUILD.gn5
-rw-r--r--chromium/chrome/browser/resources/webapks/about_webapks.html6
-rw-r--r--chromium/chrome/browser/resources/webapks/about_webapks.js21
-rw-r--r--chromium/chrome/browser/resources/welcome/BUILD.gn54
-rw-r--r--chromium/chrome/browser/resources/welcome/google_apps/BUILD.gn23
-rw-r--r--chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js108
-rw-r--r--chromium/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.html3
-rw-r--r--chromium/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.js23
-rw-r--r--chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.html402
-rw-r--r--chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.js72
-rw-r--r--chromium/chrome/browser/resources/welcome/landing_view.html65
-rw-r--r--chromium/chrome/browser/resources/welcome/landing_view.js28
-rw-r--r--chromium/chrome/browser/resources/welcome/landing_view_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/welcome/landing_view_proxy.js109
-rw-r--r--chromium/chrome/browser/resources/welcome/navigation_behavior.html6
-rw-r--r--chromium/chrome/browser/resources/welcome/navigation_behavior.js316
-rw-r--r--chromium/chrome/browser/resources/welcome/ntp_background/BUILD.gn40
-rw-r--r--chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.html3
-rw-r--r--chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.js27
-rw-r--r--chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.js162
-rw-r--r--chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.html403
-rw-r--r--chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.js49
-rw-r--r--chromium/chrome/browser/resources/welcome/set_as_default/BUILD.gn25
-rw-r--r--chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.html164
-rw-r--r--chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.js37
-rw-r--r--chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.js159
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/BUILD.gn70
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/action_link_style.js9
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/action_link_style_css.html54
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/action_link_style_css.js17
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/animations_css.html66
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/animations_css.js9
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/bookmark_proxy.js144
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/chooser_shared_css.html68
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/chooser_shared_css.js13
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/i18n_setup.html2
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/module_metrics_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/module_metrics_proxy.js413
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/navi_colors_css.html89
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/navi_colors_css.js12
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/nux_types.js8
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/onboarding_background.html367
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/onboarding_background.js7
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/splash_pages_shared_css.html95
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/splash_pages_shared_css.js12
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/step_indicator.html50
-rw-r--r--chromium/chrome/browser/resources/welcome/shared/step_indicator.js11
-rw-r--r--chromium/chrome/browser/resources/welcome/signin_view.html56
-rw-r--r--chromium/chrome/browser/resources/welcome/signin_view.js26
-rw-r--r--chromium/chrome/browser/resources/welcome/signin_view_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/welcome/signin_view_proxy.js123
-rw-r--r--chromium/chrome/browser/resources/welcome/welcome.html4
-rw-r--r--chromium/chrome/browser/resources/welcome/welcome.js7
-rw-r--r--chromium/chrome/browser/resources/welcome/welcome_app.html75
-rw-r--r--chromium/chrome/browser/resources/welcome/welcome_app.js37
-rw-r--r--chromium/chrome/browser/resources/welcome/welcome_browser_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/welcome/welcome_browser_proxy.js73
-rw-r--r--chromium/chrome/browser/resources/welcome/welcome_resources.grd197
-rw-r--r--chromium/chrome/browser/safe_browsing/BUILD.gn16
-rw-r--r--chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_mac_browsertest.cc7
-rw-r--r--chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc18
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc2
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc2
-rw-r--r--chromium/chrome/browser/spellchecker/spellcheck_service_browsertest.cc12
-rw-r--r--chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc14
-rw-r--r--chromium/chrome/browser/ssl/BUILD.gn1
-rw-r--r--chromium/chrome/browser/subresource_filter/BUILD.gn64
-rw-r--r--chromium/chrome/browser/supervised_user/supervised_user_error_page/BUILD.gn2
-rw-r--r--chromium/chrome/browser/touch_to_fill/BUILD.gn37
-rw-r--r--chromium/chrome/browser/touch_to_fill/android/BUILD.gn87
-rw-r--r--chromium/chrome/browser/touch_to_fill/android/internal/BUILD.gn93
-rw-r--r--chromium/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd136
-rw-r--r--chromium/chrome/browser/ui/BUILD.gn192
-rw-r--r--chromium/chrome/browser/ui/android/widget/BUILD.gn95
-rw-r--r--chromium/chrome/browser/ui/app_list/search/cros_action_history/BUILD.gn11
-rw-r--r--chromium/chrome/browser/ui/app_list/search/search_result_ranker/BUILD.gn6
-rw-r--r--chromium/chrome/browser/ui/libgtkui/BUILD.gn54
-rw-r--r--chromium/chrome/browser/ui/webui/about_ui.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.cc85
-rw-r--r--chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.h65
-rw-r--r--chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.cc30
-rw-r--r--chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.h32
-rw-r--r--chromium/chrome/browser/ui/webui/app_management/app_management.mojom3
-rw-r--r--chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.cc66
-rw-r--r--chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.h28
-rw-r--r--chromium/chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.cc94
-rw-r--r--chromium/chrome/browser/ui/webui/app_management/app_management_ui.cc140
-rw-r--r--chromium/chrome/browser/ui/webui/app_management/app_management_ui.h41
-rw-r--r--chromium/chrome/browser/ui/webui/bluetooth_internals/BUILD.gn4
-rw-r--r--chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom19
-rw-r--r--chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.cc55
-rw-r--r--chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.h32
-rw-r--r--chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc13
-rw-r--r--chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h3
-rw-r--r--chromium/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/certificate_viewer_webui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/certificates_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chrome_web_contents_handler.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc80
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_manager_error_ui.cc54
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/account_manager_error_ui.h27
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.h9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder_browsertest.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc91
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h12
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui_browsertest.cc242
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc35
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.h7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc18
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc20
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/crostini_installer/BUILD.gn11
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/crostini_installer/OWNERS2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom34
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc44
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.h27
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc64
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.h60
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc78
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.h51
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc381
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.h9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.h6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/OWNERS10
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc51
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc33
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h18
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/error_screen_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.h48
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc139
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h25
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h14
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc25
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc22
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h14
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc9
-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/update_required_screen_handler.cc65
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h33
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.cc16
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.h13
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.mojom7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.h3
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc13
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.h6
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/network_ui.cc41
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/network_ui.h5
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_shares_localized_strings_provider.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_browsertest.cc28
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc17
-rw-r--r--chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h7
-rw-r--r--chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/crashes_ui.cc33
-rw-r--r--chromium/chrome/browser/ui/webui/devtools_ui_data_source.cc101
-rw-r--r--chromium/chrome/browser/ui/webui/devtools_ui_data_source.h13
-rw-r--r--chromium/chrome/browser/ui/webui/devtools_ui_data_source_unittest.cc45
-rw-r--r--chromium/chrome/browser/ui/webui/discards/BUILD.gn3
-rw-r--r--chromium/chrome/browser/ui/webui/discards/DEPS10
-rw-r--r--chromium/chrome/browser/ui/webui/discards/discards.mojom81
-rw-r--r--chromium/chrome/browser/ui/webui/discards/discards_ui.cc87
-rw-r--r--chromium/chrome/browser/ui/webui/discards/discards_ui.h10
-rw-r--r--chromium/chrome/browser/ui/webui/discards/graph_dump_impl.cc396
-rw-r--r--chromium/chrome/browser/ui/webui/discards/graph_dump_impl.h187
-rw-r--r--chromium/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc224
-rw-r--r--chromium/chrome/browser/ui/webui/domain_reliability_internals_ui.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/OWNERS1
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads.mojom3
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.h17
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler_unittest.cc22
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc18
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.h8
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc9
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc19
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/downloads_ui.h14
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.cc15
-rw-r--r--chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.h8
-rw-r--r--chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.cc15
-rw-r--r--chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.h3
-rw-r--r--chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.h8
-rw-r--r--chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.h4
-rw-r--r--chromium/chrome/browser/ui/webui/extensions/extension_icon_source.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/extensions/extensions_internals_source.cc38
-rw-r--r--chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.h13
-rw-r--r--chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.h4
-rw-r--r--chromium/chrome/browser/ui/webui/fileicon_source_unittest.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/flags_ui.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/flags_ui_unittest.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/help/version_updater.h8
-rw-r--r--chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc70
-rw-r--r--chromium/chrome/browser/ui/webui/help/version_updater_chromeos.h16
-rw-r--r--chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc19
-rw-r--r--chromium/chrome/browser/ui/webui/history_ui.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/inspect_ui.cc19
-rw-r--r--chromium/chrome/browser/ui/webui/inspect_ui.h3
-rw-r--r--chromium/chrome/browser/ui/webui/interstitials/interstitial_ui.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals.mojom2
-rw-r--r--chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.cc13
-rw-r--r--chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.h14
-rw-r--r--chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler_unittest.cc30
-rw-r--r--chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h3
-rw-r--r--chromium/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_browsertest.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_handler.cc48
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc50
-rw-r--r--chromium/chrome/browser/ui/webui/media/media_engagement_ui.cc18
-rw-r--r--chromium/chrome/browser/ui/webui/media/media_engagement_ui.h6
-rw-r--r--chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.cc10
-rw-r--r--chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/memory_internals_ui.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/net_export_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc21
-rw-r--r--chromium/chrome/browser/ui/webui/notifications_internals/notifications_internals_ui_message_handler.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc51
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler.cc117
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler.h65
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler_unittest.cc51
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc5
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc19
-rw-r--r--chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.h8
-rw-r--r--chromium/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom5
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc44
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.h15
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.h4
-rw-r--r--chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/policy_ui_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos_unittest.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc29
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/policy_settings.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.cc56
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_handler.h10
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc140
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.cc80
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_ui.h5
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_utils.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/print_preview/print_preview_utils_unittest.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/profile_helper_browsertest.cc39
-rw-r--r--chromium/chrome/browser/ui/webui/quota_internals/OWNERS4
-rw-r--r--chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.cc17
-rw-r--r--chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.h4
-rw-r--r--chromium/chrome/browser/ui/webui/sandbox/OWNERS3
-rw-r--r--chromium/chrome/browser/ui/webui/sandbox/sandbox_handler.cc134
-rw-r--r--chromium/chrome/browser/ui/webui/sandbox/sandbox_handler.h52
-rw-r--r--chromium/chrome/browser/ui/webui/sandbox/sandbox_internals_ui.cc (renamed from chromium/chrome/browser/ui/webui/sandbox_internals_ui.cc)12
-rw-r--r--chromium/chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h (renamed from chromium/chrome/browser/ui/webui/sandbox_internals_ui.h)6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/about_handler.cc90
-rw-r--r--chromium/chrome/browser/ui/webui/settings/about_handler.h23
-rw-r--r--chromium/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.cc29
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h19
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_uma.h31
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc31
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h15
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc22
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h8
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc3
-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_storage_handler.cc48
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h13
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.h10
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc14
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h14
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc22
-rw-r--r--chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/font_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/settings/font_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/incompatible_applications_handler_win.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/people_handler.cc42
-rw-r--r--chromium/chrome/browser/ui/webui/settings/people_handler.h9
-rw-r--r--chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc44
-rw-r--r--chromium/chrome/browser/ui/webui/settings/profile_info_handler.cc12
-rw-r--r--chromium/chrome/browser/ui/webui/settings/profile_info_handler.h8
-rw-r--r--chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc13
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc64
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler_unittest.cc65
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc193
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h4
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.h3
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc94
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h13
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_ui.cc45
-rw-r--r--chromium/chrome/browser/ui/webui/settings/settings_ui.h6
-rw-r--r--chromium/chrome/browser/ui/webui/settings/site_settings_handler.cc12
-rw-r--r--chromium/chrome/browser/ui/webui/settings/site_settings_handler.h7
-rw-r--r--chromium/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc24
-rw-r--r--chromium/chrome/browser/ui/webui/settings/tts_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc49
-rw-r--r--chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h13
-rw-r--r--chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.h5
-rw-r--r--chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc74
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_chromeos.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.cc29
-rw-r--r--chromium/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/signin/login_ui_test_utils.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/signin/signin_email_confirmation_ui.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/signin/signin_error_ui.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/signin/signin_utils_desktop.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc26
-rw-r--r--chromium/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc22
-rw-r--r--chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.h1
-rw-r--r--chromium/chrome/browser/ui/webui/site_settings_helper.cc6
-rw-r--r--chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom3
-rw-r--r--chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.cc7
-rw-r--r--chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.h15
-rw-r--r--chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.cc21
-rw-r--r--chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.h16
-rw-r--r--chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.cc11
-rw-r--r--chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.h5
-rw-r--r--chromium/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/sync_internals_message_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/sync_internals_ui.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.cc334
-rw-r--r--chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.h33
-rw-r--r--chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui_browsertest.cc118
-rw-r--r--chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.cc17
-rw-r--r--chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.h11
-rw-r--r--chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker_unittest.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/test_data_source.cc42
-rw-r--r--chromium/chrome/browser/ui/webui/test_data_source.h4
-rw-r--r--chromium/chrome/browser/ui/webui/theme_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/theme_handler.h4
-rw-r--r--chromium/chrome/browser/ui/webui/theme_source.cc15
-rw-r--r--chromium/chrome/browser/ui/webui/theme_source.h2
-rw-r--r--chromium/chrome/browser/ui/webui/theme_source_unittest.cc12
-rw-r--r--chromium/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/web_ui_test_handler.cc3
-rw-r--r--chromium/chrome/browser/ui/webui/webapks_handler.cc4
-rw-r--r--chromium/chrome/browser/ui/webui/webui_load_timer.cc2
-rw-r--r--chromium/chrome/browser/ui/webui/webui_load_timer.h5
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/helpers.cc24
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/helpers.h3
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/ntp_background_fetcher.cc1
-rw-r--r--chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc17
-rw-r--r--chromium/chrome/browser/util/android/BUILD.gn42
-rw-r--r--chromium/chrome/browser/vr/BUILD.gn16
-rw-r--r--chromium/chrome/browser/web_applications/BUILD.gn14
-rw-r--r--chromium/chrome/browser/web_applications/components/BUILD.gn9
-rw-r--r--chromium/chrome/browser/web_applications/extensions/BUILD.gn13
-rw-r--r--chromium/chrome/browser/web_applications/proto/BUILD.gn2
-rw-r--r--chromium/chrome/browser/win/conflicts/BUILD.gn2
1043 files changed, 24142 insertions, 14834 deletions
diff --git a/chromium/chrome/browser/BUILD.gn b/chromium/chrome/browser/BUILD.gn
index d730660c086..d3c01828732 100644
--- a/chromium/chrome/browser/BUILD.gn
+++ b/chromium/chrome/browser/BUILD.gn
@@ -9,7 +9,6 @@ import("//build/config/features.gni")
import("//build/config/jumbo.gni")
import("//build/config/linux/gtk/gtk.gni")
import("//build/config/ui.gni")
-import("//build/split_static_library.gni")
import("//chrome/common/features.gni")
import("//components/feature_engagement/features.gni")
import("//components/feed/features.gni")
@@ -73,17 +72,7 @@ proto_library("ntp_background_proto") {
# Use a static library here because many test binaries depend on this but don't
# require many files from it. This makes linking more efficient.
-jumbo_split_static_library("browser") {
- # Split into multiple static libraries on Windows builds. We have hit size
- # limits on Windows official builds and on goma builds when symbol_level = 2
- # is selected. Always splitting on Windows builds is simpler than trying to
- # perfectly calculate the scenarios where it is required.
- if (is_win) {
- split_count = 5
- } else {
- split_count = 1
- }
-
+jumbo_static_library("browser") {
sources = [
"about_flags.cc",
"about_flags.h",
@@ -285,6 +274,7 @@ jumbo_split_static_library("browser") {
"chrome_content_browser_client.cc",
"chrome_content_browser_client.h",
"chrome_content_browser_client_parts.h",
+ "chrome_content_browser_client_receiver_bindings.cc",
"chrome_notification_types.h",
"chrome_quota_permission_context.cc",
"chrome_quota_permission_context.h",
@@ -321,8 +311,6 @@ jumbo_split_static_library("browser") {
"component_updater/file_type_policies_component_installer.h",
"component_updater/mei_preload_component_installer.cc",
"component_updater/mei_preload_component_installer.h",
- "component_updater/on_device_head_suggest_component_installer.cc",
- "component_updater/on_device_head_suggest_component_installer.h",
"component_updater/optimization_hints_component_installer.cc",
"component_updater/optimization_hints_component_installer.h",
"component_updater/origin_trials_component_installer.cc",
@@ -381,8 +369,6 @@ jumbo_split_static_library("browser") {
"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_saver/data_saver_top_host_provider.cc",
- "data_saver/data_saver_top_host_provider.h",
"data_use_measurement/chrome_data_use_measurement.cc",
"data_use_measurement/chrome_data_use_measurement.h",
"defaults.cc",
@@ -524,6 +510,8 @@ jumbo_split_static_library("browser") {
"font_pref_change_notifier_factory.h",
"fullscreen_mac.mm",
"fullscreen_win.cc",
+ "games/games_service_factory.cc",
+ "games/games_service_factory.h",
"gcm/gcm_product_util.cc",
"gcm/gcm_product_util.h",
"gcm/gcm_profile_service_factory.cc",
@@ -555,6 +543,8 @@ jumbo_split_static_library("browser") {
"hang_monitor/hang_crash_dump_win.cc",
"heavy_ad_intervention/heavy_ad_blocklist.cc",
"heavy_ad_intervention/heavy_ad_blocklist.h",
+ "heavy_ad_intervention/heavy_ad_features.cc",
+ "heavy_ad_intervention/heavy_ad_features.h",
"heavy_ad_intervention/heavy_ad_helper.cc",
"heavy_ad_intervention/heavy_ad_helper.h",
"heavy_ad_intervention/heavy_ad_service.cc",
@@ -647,6 +637,8 @@ jumbo_split_static_library("browser") {
"lookalikes/lookalike_url_service.h",
"lookalikes/lookalike_url_tab_storage.cc",
"lookalikes/lookalike_url_tab_storage.h",
+ "lookalikes/safety_tips/local_heuristics.cc",
+ "lookalikes/safety_tips/local_heuristics.h",
"lookalikes/safety_tips/reputation_service.cc",
"lookalikes/safety_tips/reputation_service.h",
"lookalikes/safety_tips/reputation_web_contents_observer.cc",
@@ -767,6 +759,12 @@ jumbo_split_static_library("browser") {
"media/webrtc/window_icon_util_chromeos.cc",
"media/webrtc/window_icon_util_mac.mm",
"media/webrtc/window_icon_util_win.cc",
+ "memory/chrome_browser_main_extra_parts_memory.cc",
+ "memory/chrome_browser_main_extra_parts_memory.h",
+ "memory/enterprise_memory_limit_evaluator.cc",
+ "memory/enterprise_memory_limit_evaluator.h",
+ "memory/enterprise_memory_limit_pref_observer.cc",
+ "memory/enterprise_memory_limit_pref_observer.h",
"memory_details.cc",
"memory_details.h",
"memory_details_android.cc",
@@ -847,6 +845,10 @@ jumbo_split_static_library("browser") {
"native_window_notification_source.h",
"navigation_predictor/navigation_predictor.cc",
"navigation_predictor/navigation_predictor.h",
+ "navigation_predictor/navigation_predictor_keyed_service.cc",
+ "navigation_predictor/navigation_predictor_keyed_service.h",
+ "navigation_predictor/navigation_predictor_keyed_service_factory.cc",
+ "navigation_predictor/navigation_predictor_keyed_service_factory.h",
"net/chrome_cookie_notification_details.h",
"net/chrome_mojo_proxy_resolver_factory.cc",
"net/chrome_mojo_proxy_resolver_factory.h",
@@ -956,12 +958,22 @@ jumbo_split_static_library("browser") {
"optimization_guide/optimization_guide_keyed_service_factory.h",
"optimization_guide/optimization_guide_navigation_data.cc",
"optimization_guide/optimization_guide_navigation_data.h",
+ "optimization_guide/optimization_guide_permissions_util.cc",
+ "optimization_guide/optimization_guide_permissions_util.h",
+ "optimization_guide/optimization_guide_session_statistic.cc",
+ "optimization_guide/optimization_guide_session_statistic.h",
+ "optimization_guide/optimization_guide_top_host_provider.cc",
+ "optimization_guide/optimization_guide_top_host_provider.h",
"optimization_guide/optimization_guide_web_contents_observer.cc",
"optimization_guide/optimization_guide_web_contents_observer.h",
- "page_load_metrics/metrics_navigation_throttle.cc",
- "page_load_metrics/metrics_navigation_throttle.h",
- "page_load_metrics/metrics_web_contents_observer.cc",
- "page_load_metrics/metrics_web_contents_observer.h",
+ "optimization_guide/prediction/decision_tree_prediction_model.cc",
+ "optimization_guide/prediction/decision_tree_prediction_model.h",
+ "optimization_guide/prediction/prediction_manager.cc",
+ "optimization_guide/prediction/prediction_manager.h",
+ "optimization_guide/prediction/prediction_model.cc",
+ "optimization_guide/prediction/prediction_model.h",
+ "optimization_guide/prediction/prediction_model_fetcher.cc",
+ "optimization_guide/prediction/prediction_model_fetcher.h",
"page_load_metrics/observers/aborts_page_load_metrics_observer.cc",
"page_load_metrics/observers/aborts_page_load_metrics_observer.h",
"page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer.cc",
@@ -970,8 +982,6 @@ jumbo_split_static_library("browser") {
"page_load_metrics/observers/ad_metrics/frame_data.h",
"page_load_metrics/observers/amp_page_load_metrics_observer.cc",
"page_load_metrics/observers/amp_page_load_metrics_observer.h",
- "page_load_metrics/observers/core_page_load_metrics_observer.cc",
- "page_load_metrics/observers/core_page_load_metrics_observer.h",
"page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc",
"page_load_metrics/observers/data_reduction_proxy_metrics_observer.h",
"page_load_metrics/observers/data_reduction_proxy_metrics_observer_base.cc",
@@ -994,8 +1004,6 @@ jumbo_split_static_library("browser") {
"page_load_metrics/observers/https_engagement_metrics/https_engagement_service.h",
"page_load_metrics/observers/https_engagement_metrics/https_engagement_service_factory.cc",
"page_load_metrics/observers/https_engagement_metrics/https_engagement_service_factory.h",
- "page_load_metrics/observers/largest_contentful_paint_handler.cc",
- "page_load_metrics/observers/largest_contentful_paint_handler.h",
"page_load_metrics/observers/live_tab_count_page_load_metrics_observer.cc",
"page_load_metrics/observers/live_tab_count_page_load_metrics_observer.h",
"page_load_metrics/observers/loading_predictor_page_load_metrics_observer.cc",
@@ -1012,6 +1020,8 @@ 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/optimization_guide_page_load_metrics_observer.cc",
+ "page_load_metrics/observers/optimization_guide_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",
@@ -1030,31 +1040,16 @@ 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/subresource_loading_page_load_metrics_observer.cc",
+ "page_load_metrics/observers/subresource_loading_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/third_party_metrics_observer.cc",
"page_load_metrics/observers/third_party_metrics_observer.h",
"page_load_metrics/observers/ukm_page_load_metrics_observer.cc",
"page_load_metrics/observers/ukm_page_load_metrics_observer.h",
- "page_load_metrics/observers/use_counter/ukm_features.cc",
- "page_load_metrics/observers/use_counter_page_load_metrics_observer.cc",
- "page_load_metrics/observers/use_counter_page_load_metrics_observer.h",
- "page_load_metrics/page_load_metrics_embedder_interface.h",
"page_load_metrics/page_load_metrics_initialize.cc",
"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/protocol_util.cc",
- "page_load_metrics/protocol_util.h",
- "page_load_metrics/resource_tracker.cc",
- "page_load_metrics/resource_tracker.h",
"password_manager/account_storage/account_password_store_factory.cc",
"password_manager/account_storage/account_password_store_factory.h",
"password_manager/chrome_password_manager_client.cc",
@@ -1065,6 +1060,8 @@ jumbo_split_static_library("browser") {
"password_manager/password_manager_util_win.h",
"password_manager/password_store_factory.cc",
"password_manager/password_store_factory.h",
+ "password_manager/password_store_utils.cc",
+ "password_manager/password_store_utils.h",
"password_manager/reauth_purpose.h",
"payments/payment_handler_permission_context.cc",
"payments/payment_handler_permission_context.h",
@@ -1075,36 +1072,16 @@ jumbo_split_static_library("browser") {
"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/decorators/freeze_origin_trial_policy_aggregator.cc",
- "performance_manager/decorators/freeze_origin_trial_policy_aggregator.h",
+ "performance_manager/decorators/frame_priority_decorator.cc",
+ "performance_manager/decorators/frame_priority_decorator.h",
"performance_manager/decorators/frozen_frame_aggregator.cc",
"performance_manager/decorators/frozen_frame_aggregator.h",
+ "performance_manager/decorators/page_aggregator.cc",
+ "performance_manager/decorators/page_aggregator.h",
"performance_manager/decorators/page_almost_idle_decorator.cc",
"performance_manager/decorators/page_almost_idle_decorator.h",
"performance_manager/decorators/process_metrics_decorator.cc",
"performance_manager/decorators/process_metrics_decorator.h",
- "performance_manager/frame_priority/frame_priority.cc",
- "performance_manager/frame_priority/max_vote_aggregator.cc",
- "performance_manager/frame_priority/override_vote_aggregator.cc",
- "performance_manager/graph/frame_node.cc",
- "performance_manager/graph/frame_node_impl.cc",
- "performance_manager/graph/frame_node_impl.h",
- "performance_manager/graph/graph.cc",
- "performance_manager/graph/graph_impl.cc",
- "performance_manager/graph/graph_impl.h",
- "performance_manager/graph/graph_impl_operations.cc",
- "performance_manager/graph/graph_impl_operations.h",
- "performance_manager/graph/graph_operations.cc",
- "performance_manager/graph/node.cc",
- "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/node_type.h",
- "performance_manager/graph/page_node.cc",
- "performance_manager/graph/page_node_impl.cc",
- "performance_manager/graph/page_node_impl.h",
"performance_manager/graph/policies/policy_features.cc",
"performance_manager/graph/policies/policy_features.h",
"performance_manager/graph/policies/working_set_trimmer_policy.cc",
@@ -1113,16 +1090,6 @@ jumbo_split_static_library("browser") {
"performance_manager/graph/policies/working_set_trimmer_policy_chromeos.h",
"performance_manager/graph/policies/working_set_trimmer_policy_win.cc",
"performance_manager/graph/policies/working_set_trimmer_policy_win.h",
- "performance_manager/graph/process_node.cc",
- "performance_manager/graph/process_node_impl.cc",
- "performance_manager/graph/process_node_impl.h",
- "performance_manager/graph/properties.h",
- "performance_manager/graph/system_node.cc",
- "performance_manager/graph/system_node_impl.cc",
- "performance_manager/graph/system_node_impl.h",
- "performance_manager/graph/worker_node.cc",
- "performance_manager/graph/worker_node_impl.cc",
- "performance_manager/graph/worker_node_impl.h",
"performance_manager/mechanisms/working_set_trimmer.cc",
"performance_manager/mechanisms/working_set_trimmer.h",
"performance_manager/mechanisms/working_set_trimmer_chromeos.cc",
@@ -1134,12 +1101,6 @@ jumbo_split_static_library("browser") {
"performance_manager/observers/isolation_context_metrics.h",
"performance_manager/observers/metrics_collector.cc",
"performance_manager/observers/metrics_collector.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/persistence/site_data/exponential_moving_average.cc",
"performance_manager/persistence/site_data/exponential_moving_average.h",
"performance_manager/persistence/site_data/feature_usage.h",
@@ -1167,28 +1128,6 @@ jumbo_split_static_library("browser") {
"performance_manager/persistence/site_data/site_data_writer.cc",
"performance_manager/persistence/site_data/site_data_writer.h",
"performance_manager/persistence/site_data/tab_visibility.h",
- "performance_manager/public/frame_priority/frame_priority.h",
- "performance_manager/public/frame_priority/max_vote_aggregator.h",
- "performance_manager/public/frame_priority/override_vote_aggregator.h",
- "performance_manager/public/graph/frame_node.h",
- "performance_manager/public/graph/graph.h",
- "performance_manager/public/graph/graph_operations.h",
- "performance_manager/public/graph/node.h",
- "performance_manager/public/graph/node_attached_data.h",
- "performance_manager/public/graph/page_node.h",
- "performance_manager/public/graph/process_node.h",
- "performance_manager/public/graph/system_node.h",
- "performance_manager/public/graph/worker_node.h",
- "performance_manager/public/render_process_host_proxy.h",
- "performance_manager/public/web_contents_proxy.h",
- "performance_manager/render_process_host_proxy.cc",
- "performance_manager/render_process_user_data.cc",
- "performance_manager/render_process_user_data.h",
- "performance_manager/web_contents_proxy.cc",
- "performance_manager/web_contents_proxy_impl.cc",
- "performance_manager/web_contents_proxy_impl.h",
- "performance_manager/webui_graph_dump_impl.cc",
- "performance_manager/webui_graph_dump_impl.h",
"performance_monitor/metric_evaluator_helper_win.cc",
"performance_monitor/metric_evaluator_helper_win.h",
"performance_monitor/process_metrics_history.cc",
@@ -1386,21 +1325,18 @@ jumbo_split_static_library("browser") {
"previews/previews_content_util.cc",
"previews/previews_content_util.h",
"previews/previews_https_notification_infobar_decider.h",
- "previews/previews_lite_page_decider.cc",
- "previews/previews_lite_page_decider.h",
"previews/previews_lite_page_infobar_delegate.cc",
"previews/previews_lite_page_infobar_delegate.h",
- "previews/previews_lite_page_navigation_throttle.cc",
- "previews/previews_lite_page_navigation_throttle.h",
- "previews/previews_lite_page_navigation_throttle_manager.h",
- "previews/previews_lite_page_predictor.cc",
- "previews/previews_lite_page_predictor.h",
+ "previews/previews_lite_page_redirect_decider.cc",
+ "previews/previews_lite_page_redirect_decider.h",
+ "previews/previews_lite_page_redirect_predictor.cc",
+ "previews/previews_lite_page_redirect_predictor.h",
+ "previews/previews_lite_page_redirect_serving_url_loader.cc",
+ "previews/previews_lite_page_redirect_serving_url_loader.h",
"previews/previews_lite_page_redirect_url_loader.cc",
"previews/previews_lite_page_redirect_url_loader.h",
- "previews/previews_lite_page_serving_url_loader.cc",
- "previews/previews_lite_page_serving_url_loader.h",
- "previews/previews_lite_page_url_loader_interceptor.cc",
- "previews/previews_lite_page_url_loader_interceptor.h",
+ "previews/previews_lite_page_redirect_url_loader_interceptor.cc",
+ "previews/previews_lite_page_redirect_url_loader_interceptor.h",
"previews/previews_offline_helper.cc",
"previews/previews_offline_helper.h",
"previews/previews_service.cc",
@@ -1475,6 +1411,7 @@ jumbo_split_static_library("browser") {
"profiles/profile_manager_observer.h",
"profiles/profile_metrics.cc",
"profiles/profile_metrics.h",
+ "profiles/profile_observer.h",
"profiles/profile_shortcut_manager_win.cc",
"profiles/profile_shortcut_manager_win.h",
"profiles/profiles_state.cc",
@@ -1483,6 +1420,8 @@ jumbo_split_static_library("browser") {
"profiles/renderer_updater.h",
"profiles/renderer_updater_factory.cc",
"profiles/renderer_updater_factory.h",
+ "profiles/reporting_util.cc",
+ "profiles/reporting_util.h",
"profiles/sql_init_error_message_ids.cc",
"profiles/sql_init_error_message_ids.h",
"profiles/storage_partition_descriptor.h",
@@ -1596,7 +1535,6 @@ jumbo_split_static_library("browser") {
"sharing/shared_clipboard/shared_clipboard_message_handler.h",
"sharing/sharing_constants.cc",
"sharing/sharing_constants.h",
- "sharing/sharing_device_capability.h",
"sharing/sharing_device_registration.cc",
"sharing/sharing_device_registration.h",
"sharing/sharing_device_registration_result.h",
@@ -1650,8 +1588,8 @@ jumbo_split_static_library("browser") {
"signin/chrome_signin_url_loader_throttle.cc",
"signin/chrome_signin_url_loader_throttle.h",
"signin/header_modification_delegate.h",
- "signin/header_modification_delegate_on_ui_thread_impl.cc",
- "signin/header_modification_delegate_on_ui_thread_impl.h",
+ "signin/header_modification_delegate_impl.cc",
+ "signin/header_modification_delegate_impl.h",
"signin/identity_manager_factory.cc",
"signin/identity_manager_factory.h",
"signin/investigator_dependency_provider.cc",
@@ -1721,7 +1659,6 @@ jumbo_split_static_library("browser") {
"ssl/ssl_blocking_page.h",
"ssl/ssl_blocking_page_base.cc",
"ssl/ssl_blocking_page_base.h",
- "ssl/ssl_cert_reporter.h",
"ssl/ssl_client_auth_metrics.cc",
"ssl/ssl_client_auth_metrics.h",
"ssl/ssl_client_certificate_selector.h",
@@ -1733,8 +1670,8 @@ jumbo_split_static_library("browser") {
"ssl/ssl_error_controller_client.h",
"ssl/ssl_error_handler.cc",
"ssl/ssl_error_handler.h",
- "ssl/ssl_error_navigation_throttle.cc",
- "ssl/ssl_error_navigation_throttle.h",
+ "ssl/tls_deprecation_config.cc",
+ "ssl/tls_deprecation_config.h",
"ssl/typed_navigation_timing_throttle.cc",
"ssl/typed_navigation_timing_throttle.h",
"startup_data.cc",
@@ -1750,6 +1687,10 @@ jumbo_split_static_library("browser") {
"storage/durable_storage_permission_context.h",
"storage/storage_info_fetcher.cc",
"storage/storage_info_fetcher.h",
+ "storage/storage_notification_service_factory.cc",
+ "storage/storage_notification_service_factory.h",
+ "storage/storage_notification_service_impl.cc",
+ "storage/storage_notification_service_impl.h",
"subresource_filter/chrome_subresource_filter_client.cc",
"subresource_filter/chrome_subresource_filter_client.h",
"subresource_filter/subresource_filter_content_settings_manager.cc",
@@ -1935,6 +1876,7 @@ jumbo_split_static_library("browser") {
":resource_prefetch_predictor_proto",
"//base:i18n",
"//base/allocator:buildflags",
+ "//base/util/memory_pressure:memory_pressure",
"//base/util/values:values_util",
"//build:branding_buildflags",
"//cc",
@@ -1953,7 +1895,6 @@ jumbo_split_static_library("browser") {
"//chrome/browser/metrics/variations:chrome_ui_string_overrider_factory",
"//chrome/browser/net:probe_message_proto",
"//chrome/browser/notifications",
- "//chrome/browser/performance_manager:mojo_bindings",
"//chrome/browser/performance_manager:site_data_proto",
"//chrome/browser/profiling_host",
"//chrome/browser/push_messaging:budget_proto",
@@ -1962,6 +1903,7 @@ jumbo_split_static_library("browser") {
"//chrome/browser/safe_browsing",
"//chrome/browser/sharing/proto",
"//chrome/browser/ssl:proto",
+ "//chrome/browser/touch_to_fill",
"//chrome/browser/ui",
"//chrome/browser/ui/webui/bluetooth_internals",
"//chrome/common:channel_info",
@@ -1984,6 +1926,7 @@ jumbo_split_static_library("browser") {
"//components/cloud_devices/common",
"//components/component_updater",
"//components/component_updater:crl_set_remover",
+ "//components/component_updater/installer_policies",
"//components/consent_auditor",
"//components/content_capture/browser",
"//components/content_settings/core/browser",
@@ -1992,7 +1935,6 @@ jumbo_split_static_library("browser") {
"//components/contextual_search/core:browser",
"//components/cookie_config",
"//components/crx_file",
- "//components/data_reduction_proxy/content/browser",
"//components/data_reduction_proxy/content/common",
"//components/data_reduction_proxy/core/browser",
"//components/data_use_measurement/core:ascriber",
@@ -2010,6 +1952,7 @@ jumbo_split_static_library("browser") {
"//components/feature_engagement",
"//components/filename_generation",
"//components/flags_ui",
+ "//components/games/core",
"//components/gcm_driver",
"//components/handoff",
"//components/history/content/browser",
@@ -2049,6 +1992,7 @@ jumbo_split_static_library("browser") {
"//components/password_manager/core/browser",
"//components/password_manager/core/common",
"//components/payments/core",
+ "//components/performance_manager",
"//components/policy:generated",
"//components/policy/content/",
"//components/policy/core/browser",
@@ -2334,6 +2278,8 @@ jumbo_split_static_library("browser") {
"android/compositor/scene_layer/scrolling_bottom_view_scene_layer.h",
"android/compositor/scene_layer/static_tab_scene_layer.cc",
"android/compositor/scene_layer/static_tab_scene_layer.h",
+ "android/compositor/scene_layer/status_indicator_scene_layer.cc",
+ "android/compositor/scene_layer/status_indicator_scene_layer.h",
"android/compositor/scene_layer/tab_list_scene_layer.cc",
"android/compositor/scene_layer/tab_list_scene_layer.h",
"android/compositor/scene_layer/tab_strip_scene_layer.cc",
@@ -2352,8 +2298,6 @@ jumbo_split_static_library("browser") {
"android/contextualsearch/contextual_search_field_trial.h",
"android/contextualsearch/contextual_search_manager.cc",
"android/contextualsearch/contextual_search_manager.h",
- "android/contextualsearch/contextual_search_preference_helper.cc",
- "android/contextualsearch/contextual_search_preference_helper.h",
"android/contextualsearch/contextual_search_ranker_logger_impl.cc",
"android/contextualsearch/contextual_search_ranker_logger_impl.h",
"android/contextualsearch/contextual_search_tab_helper.cc",
@@ -2374,59 +2318,18 @@ jumbo_split_static_library("browser") {
"android/customtabs/detached_resource_request.cc",
"android/customtabs/detached_resource_request.h",
"android/customtabs/detached_resource_request_android.cc",
- "android/customtabs/dynamicmodule/module_metrics.cc",
- "android/customtabs/dynamicmodule/module_metrics.h",
"android/customtabs/origin_verifier.cc",
"android/customtabs/origin_verifier.h",
"android/devtools_manager_delegate_android.cc",
"android/devtools_manager_delegate_android.h",
"android/devtools_server.cc",
"android/devtools_server.h",
- "android/dfm_resource_bundle_helper.cc",
- "android/dfm_resource_bundle_helper.h",
"android/digital_asset_links/digital_asset_links_handler.cc",
"android/digital_asset_links/digital_asset_links_handler.h",
"android/document/document_web_contents_delegate.cc",
"android/document/document_web_contents_delegate.h",
"android/dom_distiller/distiller_ui_handle_android.cc",
"android/dom_distiller/distiller_ui_handle_android.h",
- "android/download/available_offline_content_provider.cc",
- "android/download/available_offline_content_provider.h",
- "android/download/chrome_duplicate_download_infobar_delegate.cc",
- "android/download/chrome_duplicate_download_infobar_delegate.h",
- "android/download/dangerous_download_infobar_delegate.cc",
- "android/download/dangerous_download_infobar_delegate.h",
- "android/download/download_controller.cc",
- "android/download/download_controller.h",
- "android/download/download_controller_base.cc",
- "android/download/download_controller_base.h",
- "android/download/download_location_dialog_bridge.h",
- "android/download/download_location_dialog_bridge_impl.cc",
- "android/download/download_location_dialog_bridge_impl.h",
- "android/download/download_manager_bridge.cc",
- "android/download/download_manager_bridge.h",
- "android/download/download_manager_service.cc",
- "android/download/download_manager_service.h",
- "android/download/download_media_parser.cc",
- "android/download/download_media_parser.h",
- "android/download/download_media_parser_bridge.cc",
- "android/download/download_media_parser_bridge.h",
- "android/download/download_open_source.h",
- "android/download/download_startup_utils.cc",
- "android/download/download_startup_utils.h",
- "android/download/download_utils.cc",
- "android/download/download_utils.h",
- "android/download/duplicate_download_infobar_delegate.cc",
- "android/download/duplicate_download_infobar_delegate.h",
- "android/download/intercept_oma_download_navigation_throttle.cc",
- "android/download/intercept_oma_download_navigation_throttle.h",
- "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",
"android/explore_sites/blacklist_site_task.cc",
"android/explore_sites/blacklist_site_task.h",
"android/explore_sites/catalog.cc",
@@ -2585,7 +2488,7 @@ 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_change_delegate.h",
+ "android/password_edit_delegate.h",
"android/password_editing_bridge.cc",
"android/password_editing_bridge.h",
"android/password_ui_view_android.cc",
@@ -2665,7 +2568,6 @@ jumbo_split_static_library("browser") {
"android/signin/unified_consent_service_bridge.cc",
"android/startup_bridge.cc",
"android/startup_bridge.h",
- "android/subresource_filter/test_subresource_filter_publisher.cc",
"android/tab_android.cc",
"android/tab_android.h",
"android/tab_browser_controls_state.cc",
@@ -2714,6 +2616,8 @@ jumbo_split_static_library("browser") {
"android/webapk/webapk_post_share_target_navigator.cc",
"android/webapk/webapk_post_share_target_navigator.h",
"android/webapk/webapk_types.h",
+ "android/webapk/webapk_ukm_recorder.cc",
+ "android/webapk/webapk_ukm_recorder.h",
"android/webapk/webapk_update_data_fetcher.cc",
"android/webapk/webapk_update_data_fetcher.h",
"android/webapk/webapk_update_manager.cc",
@@ -2723,8 +2627,6 @@ jumbo_split_static_library("browser") {
"android/webapps/add_to_homescreen_data_fetcher.h",
"android/webapps/add_to_homescreen_manager.cc",
"android/webapps/add_to_homescreen_manager.h",
- "android/webapps/webapk_ukm_recorder.cc",
- "android/webapps/webapk_ukm_recorder.h",
"android/webapps/webapp_registry.cc",
"android/webapps/webapp_registry.h",
"android/widget/thumbnail_generator.cc",
@@ -2760,6 +2662,43 @@ jumbo_split_static_library("browser") {
"dom_distiller/dom_distiller_service_factory_android.cc",
"dom_distiller/dom_distiller_service_factory_android.h",
"dom_distiller/tab_utils_android.cc",
+ "download/android/available_offline_content_provider.cc",
+ "download/android/available_offline_content_provider.h",
+ "download/android/chrome_duplicate_download_infobar_delegate.cc",
+ "download/android/chrome_duplicate_download_infobar_delegate.h",
+ "download/android/dangerous_download_infobar_delegate.cc",
+ "download/android/dangerous_download_infobar_delegate.h",
+ "download/android/download_controller.cc",
+ "download/android/download_controller.h",
+ "download/android/download_controller_base.cc",
+ "download/android/download_controller_base.h",
+ "download/android/download_location_dialog_bridge.h",
+ "download/android/download_location_dialog_bridge_impl.cc",
+ "download/android/download_location_dialog_bridge_impl.h",
+ "download/android/download_manager_bridge.cc",
+ "download/android/download_manager_bridge.h",
+ "download/android/download_manager_service.cc",
+ "download/android/download_manager_service.h",
+ "download/android/download_media_parser.cc",
+ "download/android/download_media_parser.h",
+ "download/android/download_media_parser_bridge.cc",
+ "download/android/download_media_parser_bridge.h",
+ "download/android/download_open_source.h",
+ "download/android/download_startup_utils.cc",
+ "download/android/download_startup_utils.h",
+ "download/android/download_utils.cc",
+ "download/android/download_utils.h",
+ "download/android/duplicate_download_infobar_delegate.cc",
+ "download/android/duplicate_download_infobar_delegate.h",
+ "download/android/intercept_oma_download_navigation_throttle.cc",
+ "download/android/intercept_oma_download_navigation_throttle.h",
+ "download/android/items/offline_content_aggregator_factory_android.cc",
+ "download/android/local_media_data_source_factory.cc",
+ "download/android/local_media_data_source_factory.h",
+ "download/android/rename_utils.cc",
+ "download/android/service/download_background_task.cc",
+ "download/android/service/download_task_scheduler.cc",
+ "download/android/service/download_task_scheduler.h",
"engagement/site_engagement_service_android.cc",
"engagement/site_engagement_service_android.h",
"history/android/android_history_provider_service.cc",
@@ -2775,8 +2714,6 @@ jumbo_split_static_library("browser") {
"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",
"lifetime/application_lifetime_android.h",
"lookalikes/safety_tips/safety_tip_infobar.cc",
@@ -2843,6 +2780,7 @@ jumbo_split_static_library("browser") {
"password_manager/save_password_infobar_delegate_android.h",
"password_manager/touch_to_fill_controller.cc",
"password_manager/touch_to_fill_controller.h",
+ "password_manager/touch_to_fill_view.h",
"password_manager/update_password_infobar_delegate_android.cc",
"password_manager/update_password_infobar_delegate_android.h",
"payments/android/can_make_payment_query_android.cc",
@@ -2874,6 +2812,8 @@ jumbo_split_static_library("browser") {
"profiles/profile_android.h",
"profiles/profile_key_android.cc",
"profiles/profile_key_android.h",
+ "profiles/profile_manager_android.cc",
+ "profiles/profile_manager_android.h",
"search/contextual_search_policy_handler_android.cc",
"search/contextual_search_policy_handler_android.h",
"search_engines/template_url_service_factory_android.cc",
@@ -2893,6 +2833,8 @@ jumbo_split_static_library("browser") {
"sync/profile_sync_service_android.cc",
"sync/profile_sync_service_android.h",
"translate/android/translate_bridge.cc",
+ "updates/update_notification_client.cc",
+ "updates/update_notification_client.h",
]
public_deps += [
"//chrome/android/features/dev_ui:buildflags",
@@ -2905,8 +2847,10 @@ jumbo_split_static_library("browser") {
":explore_sites_proto",
":usage_stats_proto",
"//chrome/android:jni_headers",
+ "//chrome/android/modules/extra_icu/provider:native",
"//chrome/browser/android/thin_webview/internal",
"//chrome/browser/android/webapk:proto",
+ "//chrome/browser/notifications/scheduler/public",
"//chrome/services/media_gallery_util/public/cpp",
"//components/autofill_assistant/browser",
"//components/cdm/browser",
@@ -2917,7 +2861,9 @@ jumbo_split_static_library("browser") {
"//components/feed:feature_list",
"//components/invalidation/impl:feature_list",
"//components/language/android:language_bridge",
+ "//components/module_installer/android:native",
"//components/omnibox/browser",
+ "//components/page_load_metrics/browser",
"//components/payments/content/android",
"//components/resources:components_resources",
"//components/send_tab_to_self",
@@ -2949,17 +2895,14 @@ jumbo_split_static_library("browser") {
}
if (dfmify_dev_ui) {
+ # TODO(huangs): Extracting this to a separate target.
sources += [
- "android/dev_ui/dev_ui_module_provider.cc",
- "android/dev_ui/dev_ui_module_provider.h",
- "android/dev_ui/dev_ui_url_handler.cc",
- "android/dev_ui/dev_ui_url_handler.h",
- "ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.cc",
- "ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.h",
- "ui/webui/android/dev_ui_loader/dev_ui_loader_ui.cc",
- "ui/webui/android/dev_ui_loader/dev_ui_loader_ui.h",
+ "dev_ui/android/dev_ui_loader_error_page.cc",
+ "dev_ui/android/dev_ui_loader_error_page.h",
+ "dev_ui/android/dev_ui_loader_throttle.cc",
+ "dev_ui/android/dev_ui_loader_throttle.h",
]
- deps += [ "//chrome/android/modules/dev_ui/provider:jni_headers" ]
+ deps += [ "//chrome/android/modules/dev_ui/provider:native" ]
}
} else { # !is_android
sources += [
@@ -2971,12 +2914,16 @@ jumbo_split_static_library("browser") {
"apps/app_service/app_icon_source.h",
"apps/app_service/app_launch_params.cc",
"apps/app_service/app_launch_params.h",
+ "apps/app_service/app_service_metrics.cc",
+ "apps/app_service/app_service_metrics.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/dip_px_util.cc",
"apps/app_service/dip_px_util.h",
+ "apps/app_service/uninstall_dialog.cc",
+ "apps/app_service/uninstall_dialog.h",
"apps/intent_helper/apps_navigation_throttle.cc",
"apps/intent_helper/apps_navigation_throttle.h",
"apps/intent_helper/apps_navigation_types.cc",
@@ -3002,7 +2949,6 @@ jumbo_split_static_library("browser") {
"background/background_contents_service_observer.h",
"badging/badge_manager.cc",
"badging/badge_manager.h",
- "badging/badge_manager_delegate.cc",
"badging/badge_manager_delegate.h",
"badging/badge_manager_factory.cc",
"badging/badge_manager_factory.h",
@@ -3015,8 +2961,8 @@ jumbo_split_static_library("browser") {
"chrome_browser_field_trials_desktop.h",
"chrome_process_singleton.cc",
"chrome_process_singleton.h",
- "component_updater/intervention_policy_database_component_installer.cc",
- "component_updater/intervention_policy_database_component_installer.h",
+ "component_updater/tls_deprecation_config_component_installer.cc",
+ "component_updater/tls_deprecation_config_component_installer.h",
"custom_handlers/register_protocol_handler_permission_request.cc",
"custom_handlers/register_protocol_handler_permission_request.h",
"diagnostics/diagnostics_controller.cc",
@@ -3071,8 +3017,6 @@ jumbo_split_static_library("browser") {
"enterprise_reporting/request_timer.h",
"feedback/feedback_dialog_utils.cc",
"feedback/feedback_dialog_utils.h",
- "feedback/feedback_profile_observer.cc",
- "feedback/feedback_profile_observer.h",
"feedback/feedback_uploader_chrome.cc",
"feedback/feedback_uploader_chrome.h",
"feedback/feedback_uploader_factory_chrome.cc",
@@ -3130,6 +3074,8 @@ jumbo_split_static_library("browser") {
"media/unified_autoplay_config.h",
"media/webrtc/desktop_capture_devices_util.cc",
"media/webrtc/desktop_capture_devices_util.h",
+ "media/webrtc/desktop_media_picker_controller.cc",
+ "media/webrtc/desktop_media_picker_controller.h",
"media/webrtc/desktop_media_picker_factory_impl.cc",
"media/webrtc/desktop_media_picker_factory_impl.h",
"media/webrtc/display_media_access_handler.cc",
@@ -3298,8 +3244,6 @@ jumbo_split_static_library("browser") {
"resource_coordinator/decision_details.h",
"resource_coordinator/discard_metrics_lifecycle_unit_observer.cc",
"resource_coordinator/discard_metrics_lifecycle_unit_observer.h",
- "resource_coordinator/intervention_policy_database.cc",
- "resource_coordinator/intervention_policy_database.h",
"resource_coordinator/leveldb_site_characteristics_database.cc",
"resource_coordinator/leveldb_site_characteristics_database.h",
"resource_coordinator/lifecycle_unit.cc",
@@ -3439,7 +3383,11 @@ jumbo_split_static_library("browser") {
"sharing/shared_clipboard/shared_clipboard_ui_controller.h",
"sharing/shared_clipboard/shared_clipboard_utils.cc",
"sharing/shared_clipboard/shared_clipboard_utils.h",
+ "sharing/sharing_app.cc",
+ "sharing/sharing_app.h",
"sharing/sharing_dialog.h",
+ "sharing/sharing_dialog_data.cc",
+ "sharing/sharing_dialog_data.h",
"sharing/sharing_notification_handler.cc",
"sharing/sharing_notification_handler.h",
"sharing/sharing_ui_controller.cc",
@@ -3575,7 +3523,6 @@ jumbo_split_static_library("browser") {
"//chrome/app/vector_icons",
"//chrome/browser/policy:path_parser",
"//chrome/browser/profile_resetter:profile_reset_report_proto",
- "//chrome/browser/resource_coordinator:intervention_policy_database_proto",
"//chrome/browser/resource_coordinator:tab_metrics_event_proto",
"//chrome/browser/resource_coordinator/tab_ranker",
"//chrome/browser/resources:component_extension_resources",
@@ -3586,6 +3533,7 @@ jumbo_split_static_library("browser") {
"//chrome/services/app_service:lib",
"//chrome/services/app_service/public/cpp:app_update",
"//chrome/services/app_service/public/cpp:icon_loader",
+ "//chrome/services/app_service/public/cpp:intents",
"//components/feedback",
"//components/image_fetcher/core",
"//components/keep_alive_registry",
@@ -3625,8 +3573,6 @@ jumbo_split_static_library("browser") {
"apps/app_service/extension_apps.h",
"apps/app_service/icon_key_util.cc",
"apps/app_service/icon_key_util.h",
- "apps/app_service/launch_util.cc",
- "apps/app_service/launch_util.h",
"ash_service_registry.cc",
"ash_service_registry.h",
"component_updater/cros_component_installer_chromeos.cc",
@@ -3720,8 +3666,6 @@ jumbo_split_static_library("browser") {
deps += [
"//ash/public/cpp",
"//chrome/browser/chromeos",
- "//chrome/services/cups_proxy",
- "//chrome/services/cups_proxy/public/mojom",
"//chromeos/components/account_manager",
"//chromeos/components/sync_wifi",
"//chromeos/services/assistant/public:feature_flags",
@@ -3955,6 +3899,7 @@ jumbo_split_static_library("browser") {
if (is_desktop_linux) {
# Desktop linux, doesn't count ChromeOS.
sources += [
+ "download/download_status_updater_linux.cc",
"first_run/upgrade_util_linux.cc",
"first_run/upgrade_util_linux.h",
"icon_loader_auralinux.cc",
@@ -4003,8 +3948,6 @@ jumbo_split_static_library("browser") {
if (is_win || is_mac) {
# Sources (generally "desktop OS importers") used only on Mac & Windows.
sources += [
- "crash_upload_list/crash_upload_list_crashpad.cc",
- "crash_upload_list/crash_upload_list_crashpad.h",
"recovery/recovery_install_global_error.cc",
"recovery/recovery_install_global_error.h",
"recovery/recovery_install_global_error_factory.cc",
@@ -4085,15 +4028,15 @@ jumbo_split_static_library("browser") {
"notifications/screen_lock_notification_blocker.cc",
"notifications/screen_lock_notification_blocker.h",
"platform_util.cc",
- "policy/cloud/machine_level_user_cloud_policy_helper.cc",
- "policy/cloud/machine_level_user_cloud_policy_helper.h",
+ "policy/chrome_browser_cloud_management_register_watcher.cc",
+ "policy/chrome_browser_cloud_management_register_watcher.h",
+ "policy/cloud/chrome_browser_cloud_management_helper.cc",
+ "policy/cloud/chrome_browser_cloud_management_helper.h",
"policy/cloud/user_policy_signin_service.cc",
"policy/cloud/user_policy_signin_service.h",
"policy/cloud/user_policy_signin_service_internal.h",
"policy/machine_level_user_cloud_policy_controller.cc",
"policy/machine_level_user_cloud_policy_controller.h",
- "policy/machine_level_user_cloud_policy_register_watcher.cc",
- "policy/machine_level_user_cloud_policy_register_watcher.h",
"profiles/avatar_menu.cc",
"profiles/avatar_menu.h",
"profiles/avatar_menu_actions_desktop.cc",
@@ -4151,6 +4094,8 @@ jumbo_split_static_library("browser") {
if (is_win || is_mac || is_linux) {
sources += [
+ "crash_upload_list/crash_upload_list_crashpad.cc",
+ "crash_upload_list/crash_upload_list_crashpad.h",
"payments/chrome_payment_request_delegate.cc",
"payments/chrome_payment_request_delegate.h",
"payments/payment_request_display_manager_factory.cc",
@@ -4313,6 +4258,8 @@ jumbo_split_static_library("browser") {
"printing/pwg_raster_converter.h",
]
+ deps += [ "//components/printing/common:mojo_interfaces" ]
+
if (is_posix || is_fuchsia) {
sources += [ "printing/print_dialog_cloud_posix.cc" ]
}
@@ -4726,6 +4673,8 @@ jumbo_split_static_library("browser") {
"offline_pages/offliner_helper.h",
"offline_pages/offliner_user_data.cc",
"offline_pages/offliner_user_data.h",
+ "offline_pages/prefetch/gcm_token.cc",
+ "offline_pages/prefetch/gcm_token.h",
"offline_pages/prefetch/offline_metrics_collector_impl.cc",
"offline_pages/prefetch/offline_metrics_collector_impl.h",
"offline_pages/prefetch/offline_prefetch_download_client.cc",
@@ -4733,8 +4682,6 @@ jumbo_split_static_library("browser") {
"offline_pages/prefetch/prefetch_background_task_handler_impl.cc",
"offline_pages/prefetch/prefetch_background_task_handler_impl.h",
"offline_pages/prefetch/prefetch_background_task_scheduler.h",
- "offline_pages/prefetch/prefetch_instance_id_proxy.cc",
- "offline_pages/prefetch/prefetch_instance_id_proxy.h",
"offline_pages/prefetch/prefetch_service_factory.cc",
"offline_pages/prefetch/prefetch_service_factory.h",
"offline_pages/prefetch/prefetched_pages_notifier.cc",
@@ -5171,6 +5118,12 @@ jumbo_split_static_library("browser") {
if (use_cups) {
configs += [ "//printing:cups" ]
+ if (is_chromeos) {
+ deps += [
+ "//chrome/services/cups_proxy",
+ "//chrome/services/cups_proxy/public/mojom",
+ ]
+ }
}
if (use_nss_certs) {
@@ -5205,11 +5158,7 @@ jumbo_split_static_library("browser") {
}
config("notouch_config") {
- defines = [
- "BROWSER_MEDIA_CONTROLS_MENU",
- "ENABLE_SPATIAL_NAVIGATION_HOST",
- "INCOGNITO_DEFAULT_DISABLED",
- ]
+ defines = [ "ENABLE_SPATIAL_NAVIGATION_HOST" ]
}
if (is_android) {
@@ -5293,6 +5242,8 @@ grit("resources") {
# The .grd contains references to generated files.
source_is_generated = true
+ use_brotli = true
+
defines = chrome_grit_defines
if (enable_hangout_services_extension) {
defines += [ "enable_hangout_services_extension" ]
@@ -5316,7 +5267,7 @@ grit("resources") {
":chrome_internal_resources_gen",
"//chrome/browser/engagement:mojo_bindings_js",
"//chrome/browser/media:mojo_bindings_js",
- "//chrome/browser/performance_manager:mojo_bindings_js",
+ "//chrome/browser/resources/browser_switch:app_module",
"//chrome/browser/resources/safety_tips:make_safety_tips_protobuf",
"//chrome/browser/resources/ssl/ssl_error_assistant:make_ssl_error_assistant_protobuf",
"//chrome/browser/ui/webui/bluetooth_internals:mojo_bindings_js",
@@ -5354,9 +5305,14 @@ grit("resources") {
}
}
+ if (is_win || is_mac || is_desktop_linux) {
+ deps += [ "//chrome/browser/resources/signin:polymer3_elements" ]
+ }
+
if (is_win || is_mac || is_desktop_linux || is_chromeos) {
deps += [
"//chrome/browser/resources/discards:discards_resources_gen",
+ "//chrome/browser/resources/management:polymer3_elements",
"//chrome/browser/ui/webui/discards:mojo_bindings_js",
"//services/resource_coordinator/public/mojom:mojom_js",
]
@@ -5374,7 +5330,10 @@ grit("resources") {
if (is_chromeos) {
deps += [
+ "//chrome/browser/resources/chromeos/crostini_installer:polymer3_elements",
+ "//chrome/browser/resources/chromeos/set_time_dialog:polymer3_elements",
"//chrome/browser/ui/webui/chromeos/add_supervision:mojo_bindings_js",
+ "//chrome/browser/ui/webui/chromeos/crostini_installer:mojo_bindings_js",
"//chrome/browser/ui/webui/chromeos/machine_learning:mojo_bindings_js",
]
}
@@ -5527,8 +5486,8 @@ static_library("test_support") {
"signin/scoped_account_consistency.h",
"ssl/ssl_client_auth_requestor_mock.cc",
"ssl/ssl_client_auth_requestor_mock.h",
- "subresource_filter/test_ruleset_publisher.cc",
- "subresource_filter/test_ruleset_publisher.h",
+ "ssl/tls_deprecation_test_utils.cc",
+ "ssl/tls_deprecation_test_utils.h",
"translate/translate_test_utils.cc",
"translate/translate_test_utils.h",
]
@@ -5543,6 +5502,7 @@ static_library("test_support") {
deps = [
"//chrome/app/theme:theme_resources",
"//chrome/browser",
+ "//chrome/browser/subresource_filter:test_support",
"//chrome/common",
"//chrome/common/safe_browsing:proto",
"//components/browser_sync:test_support",
@@ -5576,8 +5536,6 @@ static_library("test_support") {
if (is_android) {
sources += [
- "android/download/mock_download_controller.cc",
- "android/download/mock_download_controller.h",
"autofill/mock_address_accessory_controller.cc",
"autofill/mock_address_accessory_controller.h",
"autofill/mock_credit_card_accessory_controller.cc",
@@ -5586,6 +5544,8 @@ static_library("test_support") {
"autofill/mock_manual_filling_view.h",
"autofill/mock_password_accessory_controller.cc",
"autofill/mock_password_accessory_controller.h",
+ "download/android/mock_download_controller.cc",
+ "download/android/mock_download_controller.h",
]
deps += [ "//chrome/android:test_support_jni_headers" ]
} else {
@@ -5753,6 +5713,8 @@ static_library("test_support") {
sources += [
"extensions/fake_safe_browsing_database_manager.cc",
"extensions/fake_safe_browsing_database_manager.h",
+ "safe_browsing/cloud_content_scanning/fake_deep_scanning_dialog_delegate.cc",
+ "safe_browsing/cloud_content_scanning/fake_deep_scanning_dialog_delegate.h",
]
}
@@ -5804,11 +5766,6 @@ if (!is_android) {
}
if (is_android) {
- java_cpp_enum("sharing_device_capability_generated_enum") {
- sources = [
- "sharing/sharing_device_capability.h",
- ]
- }
java_cpp_enum("sharing_send_message_result_generated_enum") {
sources = [
"sharing/sharing_send_message_result.h",
diff --git a/chromium/chrome/browser/accessibility/accessibility_extension_api.h b/chromium/chrome/browser/accessibility/accessibility_extension_api.h
index 4f195349f66..dd8e9d611b2 100644
--- a/chromium/chrome/browser/accessibility/accessibility_extension_api.h
+++ b/chromium/chrome/browser/accessibility/accessibility_extension_api.h
@@ -6,11 +6,8 @@
#define CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_API_H_
#include <string>
-#include "base/compiler_specific.h"
-#include "base/memory/singleton.h"
-#include "base/values.h"
+
#include "extensions/browser/extension_function.h"
-#include "ui/accessibility/ax_enums.mojom.h"
// API function that enables or disables web content accessibility support.
class AccessibilityPrivateSetNativeAccessibilityEnabledFunction
diff --git a/chromium/chrome/browser/accessibility/accessibility_labels_service.cc b/chromium/chrome/browser/accessibility/accessibility_labels_service.cc
index 87859f2f990..4a820e711b4 100644
--- a/chromium/chrome/browser/accessibility/accessibility_labels_service.cc
+++ b/chromium/chrome/browser/accessibility/accessibility_labels_service.cc
@@ -16,6 +16,7 @@
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/common/content_features.h"
#include "ui/accessibility/ax_action_data.h"
+#include "ui/accessibility/ax_enums.mojom.h"
#if !defined(OS_ANDROID)
#include "chrome/browser/ui/browser.h"
diff --git a/chromium/chrome/browser/accessibility/accessibility_ui.cc b/chromium/chrome/browser/accessibility/accessibility_ui.cc
index efa616a3309..6bdee078155 100644
--- a/chromium/chrome/browser/accessibility/accessibility_ui.cc
+++ b/chromium/chrome/browser/accessibility/accessibility_ui.cc
@@ -5,22 +5,27 @@
#include "chrome/browser/accessibility/accessibility_ui.h"
#include <memory>
+#include <string>
#include <utility>
+#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/json/json_writer.h"
+#include "base/strings/pattern.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
+#include "content/public/browser/accessibility_tree_formatter.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/favicon_status.h"
@@ -45,29 +50,42 @@
static const char kTargetsDataFile[] = "targets-data.json";
+static const char kAccessibilityModeField[] = "a11yMode";
+static const char kBrowsersField[] = "browsers";
+static const char kEnabledField[] = "enabled";
+static const char kErrorField[] = "error";
+static const char kFaviconUrlField[] = "faviconUrl";
+static const char kFlagNameField[] = "flagName";
+static const char kModeIdField[] = "modeId";
+static const char kNameField[] = "name";
+static const char kPagesField[] = "pages";
+static const char kPidField[] = "pid";
static const char kProcessIdField[] = "processId";
+static const char kRequestTypeField[] = "requestType";
static const char kRouteIdField[] = "routeId";
static const char kSessionIdField[] = "sessionId";
-static const char kUrlField[] = "url";
-static const char kNameField[] = "name";
-static const char kFaviconUrlField[] = "favicon_url";
-static const char kPidField[] = "pid";
-static const char kAccessibilityModeField[] = "a11y_mode";
+static const char kShouldRequestTreeField[] = "shouldRequestTree";
+static const char kTreeField[] = "tree";
static const char kTypeField[] = "type";
+static const char kUrlField[] = "url";
// Global flags
+static const char kBrowser[] = "browser";
+static const char kCopyTree[] = "copyTree";
+static const char kHTML[] = "html";
static const char kInternal[] = "internal";
+static const char kLabelImages[] = "labelImages";
static const char kNative[] = "native";
-static const char kWeb[] = "web";
-static const char kText[] = "text";
+static const char kPage[] = "page";
static const char kScreenReader[] = "screenreader";
-static const char kHTML[] = "html";
-static const char kLabelImages[] = "label_images";
+static const char kShowOrRefreshTree[] = "showOrRefreshTree";
+static const char kText[] = "text";
+static const char kWeb[] = "web";
// Possible global flag values
+static const char kDisabled[] = "disabled";
static const char kOff[] = "off";
static const char kOn[] = "on";
-static const char kDisabled[] = "disabled";
namespace {
@@ -88,7 +106,7 @@ std::unique_ptr<base::DictionaryValue> BuildTargetDescriptor(
target_data->SetInteger(kPidField, base::GetProcId(handle));
target_data->SetString(kFaviconUrlField, favicon_url.spec());
target_data->SetInteger(kAccessibilityModeField, accessibility_mode.mode());
- target_data->SetString(kTypeField, "page");
+ target_data->SetString(kTypeField, kPage);
return target_data;
}
@@ -130,7 +148,7 @@ std::unique_ptr<base::DictionaryValue> BuildTargetDescriptor(Browser* browser) {
target_data->SetInteger(kSessionIdField, browser->session_id().id());
target_data->SetString(kNameField,
browser->GetWindowTitleForCurrentTab(false));
- target_data->SetString(kTypeField, "browser");
+ target_data->SetString(kTypeField, kBrowser);
return target_data;
}
#endif // !defined(OS_ANDROID)
@@ -171,7 +189,7 @@ void HandleAccessibilityRequestCallback(
is_web_enabled ? (screenreader ? kOn : kOff) : kDisabled);
data.SetString(kHTML, is_web_enabled ? (html ? kOn : kOff) : kDisabled);
- // The "label_images" flag works only if "web" is enabled, the current profile
+ // The "labelImages" flag works only if "web" is enabled, the current profile
// has the kAccessibilityImageLabelsEnabled preference set and the appropriate
// command line switch has been used.
bool are_accessibility_image_labels_enabled =
@@ -216,7 +234,7 @@ void HandleAccessibilityRequestCallback(
are_accessibility_image_labels_enabled);
rvh_list->Append(std::move(descriptor));
}
- data.Set("pages", std::move(rvh_list));
+ data.Set(kPagesField, std::move(rvh_list));
std::unique_ptr<base::ListValue> browser_list(new base::ListValue());
#if !defined(OS_ANDROID)
@@ -224,7 +242,7 @@ void HandleAccessibilityRequestCallback(
browser_list->Append(BuildTargetDescriptor(browser));
}
#endif // !defined(OS_ANDROID)
- data.Set("browsers", std::move(browser_list));
+ data.Set(kBrowsersField, std::move(browser_list));
std::string json_string;
base::JSONWriter::Write(data, &json_string);
@@ -232,21 +250,77 @@ void HandleAccessibilityRequestCallback(
callback.Run(base::RefCountedString::TakeString(&json_string));
}
-std::string RecursiveDumpAXPlatformNodeAsString(ui::AXPlatformNode* node,
- int indent) {
+bool MatchesPropertyFilters(
+ const std::vector<content::AccessibilityTreeFormatter::PropertyFilter>&
+ property_filters,
+ const base::string16& text) {
+ bool allow = false;
+ for (const auto& filter : property_filters) {
+ if (base::MatchPattern(text, filter.match_str)) {
+ switch (filter.type) {
+ case content::AccessibilityTreeFormatter::PropertyFilter::ALLOW_EMPTY:
+ allow = true;
+ break;
+ case content::AccessibilityTreeFormatter::PropertyFilter::ALLOW:
+ allow = (!base::MatchPattern(text, base::UTF8ToUTF16("*=''")));
+ break;
+ case content::AccessibilityTreeFormatter::PropertyFilter::DENY:
+ allow = false;
+ break;
+ }
+ }
+ }
+ return allow;
+}
+
+std::string RecursiveDumpAXPlatformNodeAsString(
+ ui::AXPlatformNode* node,
+ int indent,
+ const std::vector<content::AccessibilityTreeFormatter::PropertyFilter>&
+ property_filters) {
if (!node)
return "";
std::string str(2 * indent, '+');
- str += node->GetDelegate()->GetData().ToString() + "\n";
+ std::string line = node->GetDelegate()->GetData().ToString();
+ std::vector<std::string> attributes = base::SplitString(
+ line, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+ for (std::string attribute : attributes) {
+ if (MatchesPropertyFilters(property_filters,
+ base::UTF8ToUTF16(attribute))) {
+ str += attribute + " ";
+ }
+ }
+ str += "\n";
for (int i = 0; i < node->GetDelegate()->GetChildCount(); i++) {
gfx::NativeViewAccessible child = node->GetDelegate()->ChildAtIndex(i);
ui::AXPlatformNode* child_node =
ui::AXPlatformNode::FromNativeViewAccessible(child);
- str += RecursiveDumpAXPlatformNodeAsString(child_node, indent + 1);
+ str += RecursiveDumpAXPlatformNodeAsString(child_node, indent + 1,
+ property_filters);
}
return str;
}
+// Add property filters to the property_filters vector for the given property
+// filter type. The attributes are passed in as a string with each attribute
+// separated by a space.
+void AddPropertyFilters(
+ std::vector<content::AccessibilityTreeFormatter::PropertyFilter>&
+ property_filters,
+ const std::string& attributes,
+ content::AccessibilityTreeFormatter::PropertyFilter::Type type) {
+ for (const std::string& attribute : base::SplitString(
+ attributes, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
+ property_filters.push_back(
+ content::AccessibilityTreeFormatter::PropertyFilter(
+ base::ASCIIToUTF16(attribute), type));
+ }
+}
+
+bool IsValidJSValue(const std::string* str) {
+ return str && str->length() < 5000U;
+}
+
} // namespace
AccessibilityUI::AccessibilityUI(content::WebUI* web_ui)
@@ -302,22 +376,13 @@ void AccessibilityUIMessageHandler::RegisterMessages() {
void AccessibilityUIMessageHandler::ToggleAccessibility(
const base::ListValue* args) {
- std::string process_id_str;
- std::string route_id_str;
- std::string should_request_tree_str;
- int process_id;
- int route_id;
- int mode;
- bool should_request_tree;
- CHECK_EQ(4U, args->GetSize());
- CHECK(args->GetString(0, &process_id_str));
- CHECK(args->GetString(1, &route_id_str));
- // TODO(695247): We should pass each ax flag seperately
- CHECK(args->GetInteger(2, &mode));
- CHECK(args->GetString(3, &should_request_tree_str));
- CHECK(base::StringToInt(process_id_str, &process_id));
- CHECK(base::StringToInt(route_id_str, &route_id));
- should_request_tree = (should_request_tree_str == "true");
+ const base::DictionaryValue* data;
+ CHECK(args->GetDictionary(0, &data));
+
+ int process_id = *data->FindIntPath(kProcessIdField);
+ int route_id = *data->FindIntPath(kRouteIdField);
+ int mode = *data->FindIntPath(kModeIdField);
+ bool should_request_tree = *data->FindBoolPath(kShouldRequestTreeField);
AllowJavascript();
content::RenderViewHost* rvh =
@@ -349,26 +414,31 @@ void AccessibilityUIMessageHandler::ToggleAccessibility(
web_contents->SetAccessibilityMode(current_mode);
if (should_request_tree) {
+ base::DictionaryValue request_data;
+ request_data.SetIntPath(kProcessIdField, process_id);
+ request_data.SetIntPath(kRouteIdField, route_id);
+ request_data.SetStringPath(kRequestTypeField, kShowOrRefreshTree);
base::ListValue request_args;
- request_args.Append(std::make_unique<base::Value>(process_id_str));
- request_args.Append(std::make_unique<base::Value>(route_id_str));
- request_args.Append(std::make_unique<base::Value>("showTree"));
+ request_args.Append(std::move(request_data));
RequestWebContentsTree(&request_args);
} else {
- // Call accessibility.showTree without a 'tree' field so the row's
+ // Call accessibility.showOrRefreshTree without a 'tree' field so the row's
// accessibility mode buttons are updated.
AllowJavascript();
std::unique_ptr<base::DictionaryValue> new_mode(BuildTargetDescriptor(rvh));
- CallJavascriptFunction("accessibility.showTree", *(new_mode.get()));
+ CallJavascriptFunction("accessibility.showOrRefreshTree",
+ *(new_mode.get()));
}
}
void AccessibilityUIMessageHandler::SetGlobalFlag(const base::ListValue* args) {
- std::string flag_name_str;
- bool enabled;
- CHECK_EQ(2U, args->GetSize());
- CHECK(args->GetString(0, &flag_name_str));
- CHECK(args->GetBoolean(1, &enabled));
+ const base::DictionaryValue* data;
+ CHECK(args->GetDictionary(0, &data));
+
+ const std::string* flag_name_str_p = data->FindStringPath(kFlagNameField);
+ CHECK(IsValidJSValue(flag_name_str_p));
+ std::string flag_name_str = *flag_name_str_p;
+ bool enabled = *data->FindBoolPath(kEnabledField);
AllowJavascript();
if (flag_name_str == kInternal) {
@@ -422,20 +492,28 @@ void AccessibilityUIMessageHandler::SetGlobalFlag(const base::ListValue* args) {
void AccessibilityUIMessageHandler::RequestWebContentsTree(
const base::ListValue* args) {
- std::string process_id_str;
- std::string route_id_str;
- int process_id;
- int route_id;
- std::string request_type;
- CHECK_EQ(3U, args->GetSize());
- CHECK(args->GetString(0, &process_id_str));
- CHECK(args->GetString(1, &route_id_str));
- CHECK(base::StringToInt(process_id_str, &process_id));
- CHECK(base::StringToInt(route_id_str, &route_id));
- CHECK(args->GetString(2, &request_type));
- CHECK(request_type == "showTree" || request_type == "copyTree");
+ const base::DictionaryValue* data;
+ CHECK(args->GetDictionary(0, &data));
+
+ int process_id = *data->FindIntPath(kProcessIdField);
+ int route_id = *data->FindIntPath(kRouteIdField);
+
+ const std::string* request_type_p = data->FindStringPath(kRequestTypeField);
+ CHECK(IsValidJSValue(request_type_p));
+ std::string request_type = *request_type_p;
+ CHECK(request_type == kShowOrRefreshTree || request_type == kCopyTree);
request_type = "accessibility." + request_type;
+ const std::string* allow_p = data->FindStringPath("filters.allow");
+ CHECK(IsValidJSValue(allow_p));
+ std::string allow = *allow_p;
+ const std::string* allow_empty_p = data->FindStringPath("filters.allowEmpty");
+ CHECK(IsValidJSValue(allow_empty_p));
+ std::string allow_empty = *allow_empty_p;
+ const std::string* deny_p = data->FindStringPath("filters.deny");
+ CHECK(IsValidJSValue(deny_p));
+ std::string deny = *deny_p;
+
AllowJavascript();
content::RenderViewHost* rvh =
content::RenderViewHost::FromID(process_id, route_id);
@@ -443,7 +521,7 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree(
std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
result->SetInteger(kProcessIdField, process_id);
result->SetInteger(kRouteIdField, route_id);
- result->SetString("error", "Renderer no longer exists.");
+ result->SetString(kErrorField, "Renderer no longer exists.");
CallJavascriptFunction(request_type, *(result.get()));
return;
}
@@ -456,29 +534,62 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree(
web_contents->SetAccessibilityMode(
ui::AXMode(ui::AXMode::kNativeAPIs | ui::AXMode::kWebContents));
+ std::vector<content::AccessibilityTreeFormatter::PropertyFilter>
+ property_filters;
+ AddPropertyFilters(
+ property_filters, allow,
+ content::AccessibilityTreeFormatter::PropertyFilter::ALLOW);
+ AddPropertyFilters(
+ property_filters, allow_empty,
+ content::AccessibilityTreeFormatter::PropertyFilter::ALLOW_EMPTY);
+ AddPropertyFilters(property_filters, deny,
+ content::AccessibilityTreeFormatter::PropertyFilter::DENY);
+
PrefService* pref = Profile::FromWebUI(web_ui())->GetPrefs();
bool internal = pref->GetBoolean(prefs::kShowInternalAccessibilityTree);
base::string16 accessibility_contents_utf16 =
- web_contents->DumpAccessibilityTree(internal);
- result->SetString("tree", base::UTF16ToUTF8(accessibility_contents_utf16));
+ web_contents->DumpAccessibilityTree(internal, property_filters);
+ result->SetString(kTreeField,
+ base::UTF16ToUTF8(accessibility_contents_utf16));
CallJavascriptFunction(request_type, *(result.get()));
}
void AccessibilityUIMessageHandler::RequestNativeUITree(
const base::ListValue* args) {
- std::string session_id_str;
- int session_id;
- std::string request_type;
- CHECK_EQ(2U, args->GetSize());
- CHECK(args->GetString(0, &session_id_str));
- CHECK(base::StringToInt(session_id_str, &session_id));
- CHECK(args->GetString(1, &request_type));
- CHECK(request_type == "showTree" || request_type == "copyTree");
+ const base::DictionaryValue* data;
+ CHECK(args->GetDictionary(0, &data));
+
+ int session_id = *data->FindIntPath(kSessionIdField);
+ const std::string* request_type_p = data->FindStringPath(kRequestTypeField);
+ CHECK(IsValidJSValue(request_type_p));
+ std::string request_type = *request_type_p;
+ CHECK(request_type == kShowOrRefreshTree || request_type == kCopyTree);
request_type = "accessibility." + request_type;
+ const std::string* allow_p = data->FindStringPath("filters.allow");
+ CHECK(IsValidJSValue(allow_p));
+ std::string allow = *allow_p;
+ const std::string* allow_empty_p = data->FindStringPath("filters.allowEmpty");
+ CHECK(IsValidJSValue(allow_empty_p));
+ std::string allow_empty = *allow_empty_p;
+ const std::string* deny_p = data->FindStringPath("filters.deny");
+ CHECK(IsValidJSValue(deny_p));
+ std::string deny = *deny_p;
+
AllowJavascript();
#if !defined(OS_ANDROID)
+ std::vector<content::AccessibilityTreeFormatter::PropertyFilter>
+ property_filters;
+ AddPropertyFilters(
+ property_filters, allow,
+ content::AccessibilityTreeFormatter::PropertyFilter::ALLOW);
+ AddPropertyFilters(
+ property_filters, allow_empty,
+ content::AccessibilityTreeFormatter::PropertyFilter::ALLOW_EMPTY);
+ AddPropertyFilters(property_filters, deny,
+ content::AccessibilityTreeFormatter::PropertyFilter::DENY);
+
for (Browser* browser : *BrowserList::GetInstance()) {
if (browser->session_id().id() == session_id) {
std::unique_ptr<base::DictionaryValue> result(
@@ -486,8 +597,9 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
gfx::NativeWindow native_window = browser->window()->GetNativeWindow();
ui::AXPlatformNode* node =
ui::AXPlatformNode::FromNativeWindow(native_window);
- result->SetKey("tree",
- base::Value(RecursiveDumpAXPlatformNodeAsString(node, 0)));
+ result->SetKey(kTreeField,
+ base::Value(RecursiveDumpAXPlatformNodeAsString(
+ node, 0, property_filters)));
CallJavascriptFunction(request_type, *(result.get()));
return;
}
@@ -496,8 +608,8 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
// No browser with the specified |session_id| was found.
std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
result->SetInteger(kSessionIdField, session_id);
- result->SetString(kTypeField, "browser");
- result->SetString("error", "Browser no longer exists.");
+ result->SetString(kTypeField, kBrowser);
+ result->SetString(kErrorField, "Browser no longer exists.");
CallJavascriptFunction(request_type, *(result.get()));
}
diff --git a/chromium/chrome/browser/accessibility/image_annotation_browsertest.cc b/chromium/chrome/browser/accessibility/image_annotation_browsertest.cc
index c150bc9728a..d3860e222e3 100644
--- a/chromium/chrome/browser/accessibility/image_annotation_browsertest.cc
+++ b/chromium/chrome/browser/accessibility/image_annotation_browsertest.cc
@@ -21,17 +21,22 @@
#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 "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver_set.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/binder_registry.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_enums.mojom.h"
#include "ui/accessibility/ax_tree.h"
#include "url/gurl.h"
@@ -91,14 +96,17 @@ class FakeAnnotator : public image_annotation::mojom::Annotator {
FakeAnnotator() = default;
~FakeAnnotator() override = default;
- void BindRequest(image_annotation::mojom::AnnotatorRequest request) {
- bindings_.AddBinding(this, std::move(request));
+ void BindReceiver(
+ mojo::PendingReceiver<image_annotation::mojom::Annotator> receiver) {
+ receivers_.Add(this, std::move(receiver));
}
- void AnnotateImage(const std::string& image_id,
- const std::string& description_language_tag,
- image_annotation::mojom::ImageProcessorPtr image_processor,
- AnnotateImageCallback callback) override {
+ void AnnotateImage(
+ const std::string& image_id,
+ const std::string& description_language_tag,
+ mojo::PendingRemote<image_annotation::mojom::ImageProcessor>
+ image_processor,
+ AnnotateImageCallback callback) override {
if (return_error_code_) {
image_annotation::mojom::AnnotateImageResultPtr result =
image_annotation::mojom::AnnotateImageResult::NewErrorCode(
@@ -135,7 +143,7 @@ class FakeAnnotator : public image_annotation::mojom::Annotator {
}
private:
- mojo::BindingSet<image_annotation::mojom::Annotator> bindings_;
+ mojo::ReceiverSet<image_annotation::mojom::Annotator> receivers_;
static bool return_ocr_results_;
static bool return_label_results_;
static base::Optional<image_annotation::mojom::AnnotateImageError>
@@ -172,7 +180,7 @@ class FakeImageAnnotationService : public service_manager::Service {
void OnStart() override {
registry_.AddInterface<image_annotation::mojom::Annotator>(
- base::BindRepeating(&FakeAnnotator::BindRequest,
+ base::BindRepeating(&FakeAnnotator::BindReceiver,
base::Unretained(&annotator_)));
}
diff --git a/chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc b/chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc
index bd453ac2df2..ef7bf9f34b7 100644
--- a/chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc
+++ b/chromium/chrome/browser/accessibility/interstitial_accessibility_browsertest.cc
@@ -15,6 +15,7 @@
#include "content/public/test/test_navigation_observer.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/request_handler_util.h"
+#include "ui/accessibility/ax_enums.mojom.h"
class InterstitialAccessibilityBrowserTest : public InProcessBrowserTest {
public:
diff --git a/chromium/chrome/browser/android/metrics/BUILD.gn b/chromium/chrome/browser/android/metrics/BUILD.gn
index cdb8fca1868..97f500d4037 100644
--- a/chromium/chrome/browser/android/metrics/BUILD.gn
+++ b/chromium/chrome/browser/android/metrics/BUILD.gn
@@ -19,6 +19,7 @@ if (is_android) {
}
generate_jni("jni_headers") {
+ testonly = true
sources = [
"../../../android/java/src/org/chromium/chrome/browser/metrics/UkmUtilsForTest.java",
]
diff --git a/chromium/chrome/browser/android/thin_webview/internal/BUILD.gn b/chromium/chrome/browser/android/thin_webview/internal/BUILD.gn
index e4257ce9521..220ecc9d9f5 100644
--- a/chromium/chrome/browser/android/thin_webview/internal/BUILD.gn
+++ b/chromium/chrome/browser/android/thin_webview/internal/BUILD.gn
@@ -35,10 +35,12 @@ android_library("internal_java") {
deps = [
"//base:base_java",
+ "//base:jni_java",
"//chrome/browser/android/thin_webview:java",
"//content/public/android:content_java",
"//ui/android:ui_java",
]
+ annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
}
generate_jni("jni_headers") {
diff --git a/chromium/chrome/browser/android/vr/BUILD.gn b/chromium/chrome/browser/android/vr/BUILD.gn
index 03fba1b35e0..aab2e058d3e 100644
--- a/chromium/chrome/browser/android/vr/BUILD.gn
+++ b/chromium/chrome/browser/android/vr/BUILD.gn
@@ -188,7 +188,7 @@ source_set("ui_module_factory") {
# dependency on chrome/browser precludes the use of an intermediate target (eg.
# vr_android_with_factory).
group("module_factory") {
- if (use_native_modules && modularize_vr_native) {
+ if (use_native_partitions) {
deps = [
":ui_module_factory",
]
@@ -207,14 +207,6 @@ android_library("ar_java") {
]
java_files = [ "//chrome/android/java/src/org/chromium/chrome/browser/vr/ArCoreShimImpl.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) {
@@ -228,7 +220,7 @@ if (enable_arcore) {
if (current_toolchain == default_toolchain) {
generate_jni_registration("jni_registration") {
- target = "//chrome/android:chrome_modern_public_bundle_vr_bundle_module"
+ target = "//chrome/android:chrome_modern_public_bundle__vr_bundle_module"
header_output = "$target_gen_dir/${target_name}.h"
namespace = "vr"
}
diff --git a/chromium/chrome/browser/browser_resources.grd b/chromium/chrome/browser/browser_resources.grd
index 87c529bf393..0c1c6cad580 100644
--- a/chromium/chrome/browser/browser_resources.grd
+++ b/chromium/chrome/browser/browser_resources.grd
@@ -8,7 +8,10 @@
</outputs>
<release seq="1">
<structures>
- <structure name="IDR_SIGNIN_SHARED_CSS_HTML" file="resources\signin\signin_shared_css.html" preprocess="true" allowexternalscript="true" type="chrome_html" />
+ <if expr="is_win or is_macosx or desktop_linux">
+ <structure name="IDR_SIGNIN_SHARED_CSS_JS" file="${root_gen_dir}\chrome\browser\resources\signin\signin_shared_css.js" use_base_dir="false" preprocess="true" type="chrome_html" />
+ <structure name="IDR_SIGNIN_SHARED_OLD_CSS_HTML" file="resources\signin\signin_shared_old_css.html" preprocess="true" allowexternalscript="true" type="chrome_html" />
+ </if>
<if expr="not is_android">
<structure name="IDR_INCOGNITO_TAB_HTML" file="resources\ntp4\incognito_tab.html" flattenhtml="true" type="chrome_html" />
<structure name="IDR_GUEST_TAB_HTML" file="resources\ntp4\guest_tab.html" flattenhtml="true" type="chrome_html" />
@@ -74,7 +77,7 @@
<structure name="IDR_MD_LOGIN_JS" file="resources\chromeos\login\md_login.js" flattenhtml="true" type="chrome_html" />
<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_KEYBOARD_UTILS_JS" file="resources\chromeos\keyboard\keyboard_utils.js" flattenhtml="true" type="chrome_html" />
+ <structure name="IDR_KEYBOARD_UTILS_JS" file="resources\chromeos\keyboard\keyboard_utils.js" flattenhtml="true" type="chrome_html" compress="gzip"/>
<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"/>
@@ -104,12 +107,9 @@
<include name="IDR_DISCARDS_MOJO_PUBLIC_BASE_PROCESS_ID_MOJOM_LITE_JS" file="${root_gen_dir}\mojo\public\mojom\base\process_id.mojom-lite.js" compress="gzip" use_base_dir="false" type="BINDATA" />
<include name="IDR_DISCARDS_SORTED_TABLE_BEHAVIOR_HTML" file="resources\discards\sorted_table_behavior.html" compress="gzip" allowexternalscript="true" type="BINDATA" />
<include name="IDR_DISCARDS_SORTED_TABLE_BEHAVIOR_JS" file="resources\discards\sorted_table_behavior.js" compress="gzip" type="BINDATA" />
- <include name="IDR_DISCARDS_WEBUI_GRAPH_DUMP_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\performance_manager\webui_graph_dump.mojom-lite.js" compress="gzip" use_base_dir="false" type="BINDATA" />
</if>
<if expr="is_win or is_macosx or (is_linux and not is_chromeos)">
- <include name="IDR_BROWSER_SWITCH_APP_HTML" file="resources\browser_switch\app.html" compress="gzip" allowexternalscript="true" type="BINDATA" />
- <include name="IDR_BROWSER_SWITCH_APP_JS" file="resources\browser_switch\app.js" compress="gzip" type="BINDATA" />
- <include name="IDR_BROWSER_SWITCH_PROXY_HTML" file="resources\browser_switch\browser_switch_proxy.html" compress="gzip" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_BROWSER_SWITCH_APP_JS" file="${root_gen_dir}\chrome\browser\resources\browser_switch\app.js" compress="gzip" use_base_dir="false" type="BINDATA" />
<include name="IDR_BROWSER_SWITCH_PROXY_JS" file="resources\browser_switch\browser_switch_proxy.js" compress="gzip" type="BINDATA" />
<include name="IDR_BROWSER_SWITCH_HTML" file="resources\browser_switch\browser_switch.html" compress="gzip" allowexternalscript="true" type="BINDATA" />
<include name="IDR_BROWSER_SWITCH_INTERNALS_HTML" file="resources\browser_switch\internals\browser_switch_internals.html" compress="gzip" allowexternalscript="true" type="BINDATA" />
@@ -148,7 +148,7 @@
<if expr="enable_printing">
<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_DEVTOOLS_DISCOVERY_PAGE_HTML" file="devtools\frontend\devtools_discovery_page.html" type="BINDATA" compress="gzip"/>
<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" />
@@ -171,6 +171,7 @@
<include name="IDR_TRANSLATE_INTERNALS_JS" file="../../components/translate/translate_internals/translate_internals.js" flattenhtml="true" compress="gzip" type="BINDATA" />
<include name="IDR_FEEDBACK_MANIFEST" file="resources\feedback\manifest.json" type="BINDATA" />
<if expr="is_android">
+ <include name="IDR_DEV_UI_LOADER_ERROR_HTML" file="resources/dev_ui/dev_ui_loader_error.html" compress="gzip" type="BINDATA" />
<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" />
@@ -187,7 +188,6 @@
<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_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" />
- <part file="resources/dev_ui_loader/dev_ui_loader.grdp" />
</if>
<if expr="enable_supervised_users">
@@ -291,16 +291,6 @@
<include name="IDR_LOCAL_STATE_HTML" file="resources\local_state\local_state.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_LOCAL_STATE_JS" file="resources\local_state\local_state.js" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_DESKTOP_HATS_HTML" file="resources\hats\hats.html" type="BINDATA" />
- <include name="IDR_OMNIBOX_HTML" file="resources\omnibox\omnibox.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
- <include name="IDR_OMNIBOX_CSS" file="resources\omnibox\omnibox.css" type="BINDATA" compress="gzip" />
- <include name="IDR_OMNIBOX_INPUT_CSS" file="resources\omnibox\omnibox_input.css" type="BINDATA" compress="gzip" />
- <include name="IDR_OUTPUT_RESULTS_GROUP_CSS" file="resources\omnibox\output_results_group.css" type="BINDATA" compress="gzip" />
- <include name="IDR_OMNIBOX_OUTPUT_COLUMN_WIDTHS_CSS" file="resources\omnibox\omnibox_output_column_widths.css" type="BINDATA" compress="gzip" />
- <include name="IDR_OMNIBOX_ELEMENT_JS" file="resources\omnibox\omnibox_element.js" type="BINDATA" compress="gzip" />
- <include name="IDR_OMNIBOX_INPUT_JS" file="resources\omnibox\omnibox_input.js" type="BINDATA" compress="gzip" />
- <include name="IDR_OMNIBOX_OUTPUT_JS" file="resources\omnibox\omnibox_output.js" type="BINDATA" compress="gzip" />
- <include name="IDR_OMNIBOX_JS" file="resources\omnibox\omnibox.js" type="BINDATA" compress="gzip" />
- <include name="IDR_OMNIBOX_MOJO_JS" file="${root_gen_dir}\chrome\browser\ui\webui\omnibox\omnibox.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<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" />
@@ -327,42 +317,36 @@
<include name="IDR_POLICY_JS" file="resources\policy\policy.js" type="BINDATA" compress="gzip" />
<if expr="not is_android">
<include name="IDR_MANAGEMENT_HTML" file="resources\management\management.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MANAGEMENT_UI_HTML" file="resources\management\management_ui.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
- <include name="IDR_MANAGEMENT_UI_JS" file="resources\management\management_ui.js" type="BINDATA" compress="gzip" preprocess="true" />
- <include name="IDR_MANAGEMENT_BROWSER_PROXY_HTML" file="resources\management\management_browser_proxy.html" allowexternalscript="true" type="BINDATA" compress="gzip" />
+ <include name="IDR_MANAGEMENT_UI_JS" file="${root_gen_dir}/chrome/browser/resources/management/management_ui.js" use_base_dir="false" type="BINDATA" compress="gzip" preprocess="true" />
<include name="IDR_MANAGEMENT_BROWSER_PROXY_JS" file="resources\management\management_browser_proxy.js" type="BINDATA" compress="gzip" preprocess="true" />
- <include name="IDR_MANAGEMENT_ICONS_HTML" file="resources\management\icons.html" type="BINDATA" compress="gzip" preprocess="true" />
+ <include name="IDR_MANAGEMENT_ICONS_JS" file="${root_gen_dir}/chrome/browser/resources/management/icons.js" use_base_dir="false" type="BINDATA" compress="gzip" preprocess="true" />
</if>
<include name="IDR_SITE_ENGAGEMENT_HTML" file="resources\engagement\site_engagement.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<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_DISABLED_CONFIRMATION_HTML" file="resources\signin\sync_confirmation\sync_disabled_confirmation.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
- <include name="IDR_SYNC_DISABLED_CONFIRMATION_JS" file="resources\signin\sync_confirmation\sync_disabled_confirmation.js" 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_SYNC_CONFIRMATION_BROWSER_PROXY_HTML" file="resources\signin\sync_confirmation\sync_confirmation_browser_proxy.html" type="BINDATA" />
- <include name="IDR_SYNC_CONFIRMATION_BROWSER_PROXY_JS" file="resources\signin\sync_confirmation\sync_confirmation_browser_proxy.js" type="BINDATA" />
- <include name="IDR_SYNC_CONFIRMATION_APP_HTML" file="resources\signin\sync_confirmation\sync_confirmation_app.html" type="BINDATA" flattenhtml="true" allowexternalscript="true" />
- <include name="IDR_SYNC_CONFIRMATION_APP_JS" file="resources\signin\sync_confirmation\sync_confirmation_app.js" type="BINDATA" />
- <include name="IDR_SIGNIN_EMAIL_CONFIRMATION_HTML" file="resources\signin\signin_email_confirmation\signin_email_confirmation.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
- <include name="IDR_SIGNIN_EMAIL_CONFIRMATION_JS" file="resources\signin\signin_email_confirmation\signin_email_confirmation.js" type="BINDATA" />
- <include name="IDR_SIGNIN_ERROR_HTML" file="resources\signin\signin_error\signin_error.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
- <include name="IDR_SIGNIN_ERROR_JS" file="resources\signin\signin_error\signin_error.js" type="BINDATA" />
+ <if expr="is_win or is_macosx or desktop_linux">
+ <include name="IDR_SYNC_DISABLED_CONFIRMATION_HTML" file="resources\signin\sync_confirmation\sync_disabled_confirmation.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_SYNC_DISABLED_CONFIRMATION_JS" file="resources\signin\sync_confirmation\sync_disabled_confirmation.js" 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_SYNC_CONFIRMATION_BROWSER_PROXY_JS" file="resources\signin\sync_confirmation\sync_confirmation_browser_proxy.js" type="BINDATA" />
+ <include name="IDR_SYNC_CONFIRMATION_APP_JS" file="${root_gen_dir}\chrome\browser\resources\signin\sync_confirmation\sync_confirmation_app.js" use_base_dir="false" preprocess="true" type="BINDATA" />
+ <include name="IDR_SYNC_CONFIRMATION_IMAGES_SYNC_CONFIRMATION_ILLUSTRATION_SVG" file="resources\signin\sync_confirmation\images\sync_confirmation_illustration.svg" type="BINDATA" compress="gzip" />
+ <include name="IDR_SYNC_CONFIRMATION_IMAGES_SYNC_CONFIRMATION_ILLUSTRATION_DARK_SVG" file="resources\signin\sync_confirmation\images\sync_confirmation_illustration_dark.svg" type="BINDATA" compress="gzip" />
+ <include name="IDR_SIGNIN_EMAIL_CONFIRMATION_HTML" file="resources\signin\signin_email_confirmation\signin_email_confirmation.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_SIGNIN_EMAIL_CONFIRMATION_JS" file="resources\signin\signin_email_confirmation\signin_email_confirmation.js" type="BINDATA" />
+ <include name="IDR_SIGNIN_ERROR_HTML" file="resources\signin\signin_error\signin_error.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_SIGNIN_ERROR_JS" file="resources\signin\signin_error\signin_error.js" type="BINDATA" />
+ </if>
<include name="IDR_USB_ENUMERATION_OPTIONS_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_enumeration_options.mojom-lite.js" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_USB_DEVICE_MANAGER_CLIENT_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_manager_client.mojom-lite.js" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_USB_DEVICE_MANAGER_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_manager.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_USB_DEVICE_MANAGER_TEST_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_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}\services\device\public\mojom\usb_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" />
- <include name="IDR_USB_INTERNALS_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\usb_internals\usb_internals.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_WEB_FOOTER_EXPERIMENT_HTML" file="resources\web_footer_experiment\index.html" type="BINDATA" />
- <include name="IDR_WEBRTC_LOGS_HTML" file="resources\media\webrtc_logs.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
- <include name="IDR_WEBRTC_LOGS_JS" file="resources\media\webrtc_logs.js" type="BINDATA" />
+ <include name="IDR_WEBRTC_LOGS_HTML" file="resources\media\webrtc_logs.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="brotli" />
+ <include name="IDR_WEBRTC_LOGS_JS" file="resources\media\webrtc_logs.js" type="BINDATA" compress="brotli" />
<include name="IDR_WEBSTORE_MANIFEST" file="resources\webstore_app\manifest.json" type="BINDATA" />
<include name="IDR_CRYPTOTOKEN_MANIFEST" file="resources\cryptotoken\manifest.json" type="BINDATA" />
<if expr="chromeos">
@@ -384,6 +368,8 @@
<include name="IDR_ACCOUNT_MIGRATION_WELCOME_JS" file="resources\chromeos\account_migration_welcome.js" flattenhtml="true" type="BINDATA" compress="gzip" />
<include name="IDR_ACCOUNT_MIGRATION_BROWSER_PROXY_HTML" file="resources\chromeos\account_migration_browser_proxy.html" type="BINDATA" />
<include name="IDR_ACCOUNT_MIGRATION_BROWSER_PROXY_JS" file="resources\chromeos\account_migration_browser_proxy.js" type="BINDATA" />
+ <include name="IDR_ACCOUNT_MANAGER_ERROR_HTML" file="resources\chromeos\account_manager_error.html" allowexternalscript="true" type="BINDATA" compress="gzip" preprocess="true"/>
+ <include name="IDR_ACCOUNT_MANAGER_ERROR_JS" file="resources\chromeos\account_manager_error.js" type="BINDATA" compress="gzip" />
<if expr="_google_chrome">
<include name="IDR_ACCOUNT_MANAGER_WELCOME_1X_PNG" file="resources\chromeos\account_manager_welcome_1x.png" type="BINDATA" compress="gzip" />
<include name="IDR_ACCOUNT_MANAGER_WELCOME_2X_PNG" file="resources\chromeos\account_manager_welcome_2x.png" type="BINDATA" compress="gzip" />
@@ -399,6 +385,10 @@
<include name="IDR_URGENT_PASSWORD_EXPIRY_NOTIFICATION_JS" file="resources\chromeos\password_change\urgent_password_expiry_notification.js" type="chrome_html" />
<include name="IDR_CROSH_BUILTIN_MANIFEST" file="resources\chromeos\crosh_builtin\manifest.json" type="BINDATA" />
+ <include name="IDR_CROSTINI_INSTALLER_INDEX_HTML" file="resources\chromeos\crostini_installer\index.html" type="BINDATA" />
+ <include name="IDR_CROSTINI_INSTALLER_APP_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\crostini_installer\app.js" type="BINDATA" use_base_dir="false" />
+ <include name="IDR_CROSTINI_INSTALLER_BROWSER_PROXY_JS" file="resources\chromeos\crostini_installer\browser_proxy.js" type="BINDATA" />
+ <include name="IDR_CROSTINI_INSTALLER_MOJO_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\chromeos\crostini_installer\crostini_installer.mojom-lite.js" use_base_dir="false" 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" />
<!-- manifest file of Connectivity Diagnostics app -->
@@ -524,9 +514,8 @@
<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_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_HTML" file="resources\chromeos\set_time_dialog\set_time.html" type="BINDATA" compress="gzip" />
+ <include name="IDR_SET_TIME_DIALOG_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\set_time_dialog\set_time_dialog.js" use_base_dir="false" 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">
@@ -560,11 +549,15 @@
<include name="IDR_IME_WINDOW_CLOSE_C" file="resources\input_ime\ime_window_close_click.png" type="BINDATA" />
<include name="IDR_IME_WINDOW_CLOSE_H" file="resources\input_ime\ime_window_close_hover.png" type="BINDATA" />
</if>
- <include name="IDR_SSL_ERROR_ASSISTANT_PB" file="${root_gen_dir}/chrome/browser/resources/ssl/ssl_error_assistant/ssl_error_assistant.pb" use_base_dir="false" type="BINDATA" />
+ <include name="IDR_SSL_ERROR_ASSISTANT_PB" file="${root_gen_dir}/chrome/browser/resources/ssl/ssl_error_assistant/ssl_error_assistant.pb" use_base_dir="false" type="BINDATA" compress="gzip" />
<if expr="is_android or is_linux">
<include name="IDR_SANDBOX_INTERNALS_HTML" file="resources\sandbox_internals\sandbox_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_SANDBOX_INTERNALS_JS" file="resources\sandbox_internals\sandbox_internals.js" type="BINDATA" compress="gzip" />
</if>
+ <if expr="is_win">
+ <include name="IDR_SANDBOX_INTERNALS_HTML" file="resources\sandbox_internals\sandbox_internals.html" preprocess="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
+ <include name="IDR_SANDBOX_INTERNALS_JS" file="resources\sandbox_internals\sandbox_internals_win.js" type="BINDATA" compress="gzip" />
+ </if>
<include name="IDR_MEDIA_ENGAGEMENT_HTML" file="resources\media\media_engagement.html" flattenhtml="true" type="BINDATA" compress="gzip" allowexternalscript="true" />
<include name="IDR_MEDIA_ENGAGEMENT_JS" file="resources\media\media_engagement.js" flattenhtml="true" type="BINDATA" compress="gzip" />
<include name="IDR_MEDIA_ENGAGEMENT_SCORE_DETAILS_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\media\media_engagement_score_details.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
@@ -609,8 +602,9 @@
</if>
<if expr="chromeos">
<include name="IDR_SMART_DIM_20181115_EXAMPLE_PREPROCESSOR_CONFIG_PB" file="chromeos\power\ml\smart_dim\20181115_example_preprocessor_config.pb" type="BINDATA" />
- <include name="IDR_SMART_DIM_20190221_EXAMPLE_PREPROCESSOR_CONFIG_PB" file="chromeos\power\ml\smart_dim\20190221_example_preprocessor_config.pb" type="BINDATA" />
+ <include name="IDR_SMART_DIM_20190521_EXAMPLE_PREPROCESSOR_CONFIG_PB" file="chromeos\power\ml\smart_dim\20190521_example_preprocessor_config.pb" type="BINDATA" />
<include name="IDR_TOP_CAT_20190722_EXAMPLE_PREPROCESSOR_CONFIG_PB" file="ui\app_list\search\search_result_ranker\20190722_example_preprocessor_config.pb" type="BINDATA" />
+ <include name="IDR_SEARCH_RANKER_20190923_EXAMPLE_PREPROCESSOR_CONFIG_PB" file="ui\app_list\search\search_result_ranker\search_ranker_assets\20190923_example_preprocessor_config.pb" type="BINDATA" />
</if>
<if expr="chromeos">
<include name="IDR_ARC_GRAPHICS_TRACING_HTML" file="resources\chromeos\arc_graphics_tracing\arc_graphics_tracing.html" compress="gzip" type="BINDATA"/>
diff --git a/chromium/chrome/browser/browser_switcher/bho/BUILD.gn b/chromium/chrome/browser/browser_switcher/bho/BUILD.gn
index 05568aea2cd..66a05b4e65c 100644
--- a/chromium/chrome/browser/browser_switcher/bho/BUILD.gn
+++ b/chromium/chrome/browser/browser_switcher/bho/BUILD.gn
@@ -83,6 +83,7 @@ test("browser_switcher_bho_unittests") {
]
deps = [
"//base",
+ "//base/test:test_support",
"//testing/gtest",
]
}
diff --git a/chromium/chrome/browser/chrome_notification_types.h b/chromium/chrome/browser/chrome_notification_types.h
index fa06a890677..e768221fa2c 100644
--- a/chromium/chrome/browser/chrome_notification_types.h
+++ b/chromium/chrome/browser/chrome_notification_types.h
@@ -198,10 +198,6 @@ enum NotificationType {
#endif
#if defined(TOOLKIT_VIEWS)
- // Sent when a bookmark's context menu is shown. Used to notify
- // tests that the context menu has been created and shown.
- NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN,
-
// Notification that the nested loop using during tab dragging has returned.
// Used for testing.
NOTIFICATION_TAB_DRAG_LOOP_DONE,
diff --git a/chromium/chrome/browser/chromeos/BUILD.gn b/chromium/chrome/browser/chromeos/BUILD.gn
index 01b806ae0db..de048af49af 100644
--- a/chromium/chrome/browser/chromeos/BUILD.gn
+++ b/chromium/chrome/browser/chromeos/BUILD.gn
@@ -8,6 +8,7 @@ import("//extensions/buildflags/buildflags.gni")
import("//media/media_options.gni")
import("//printing/buildflags/buildflags.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
+import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni")
import("//third_party/protobuf/proto_library.gni")
import("//ui/ozone/ozone.gni")
@@ -39,6 +40,7 @@ source_set("chromeos") {
"//components/policy/proto",
"//components/signin/core/browser",
"//content/app/resources",
+ "//mojo/public/cpp/bindings",
"//ui/accessibility/mojom",
"//ui/chromeos/resources",
"//ui/chromeos/strings",
@@ -51,12 +53,15 @@ source_set("chromeos") {
":backdrop_wallpaper_proto",
":device_configuration_proto",
":device_policy_remover_generated",
+ ":print_job_info_proto",
":screen_brightness_event_proto",
":user_activity_event_proto",
+ "crostini:crostini_installer_types_mojom",
"//apps",
"//ash",
"//ash/public/cpp",
"//ash/system/message_center/arc",
+ "//build:branding_buildflags",
"//chrome/app:command_ids",
"//chrome/app/vector_icons",
"//chrome/browser/apps/platform_apps",
@@ -66,6 +71,7 @@ source_set("chromeos") {
"//chrome/browser/extensions",
"//chrome/browser/resource_coordinator:tab_metrics_event_proto",
"//chrome/browser/ssl:proto",
+ "//chrome/browser/ui/webui/bluetooth_internals:mojo_bindings",
"//chrome/browser/web_applications",
"//chrome/browser/web_applications:web_applications_on_extensions",
"//chrome/browser/web_applications/components",
@@ -74,8 +80,6 @@ source_set("chromeos") {
"//chrome/common/extensions/api",
"//chrome/services/app_service:lib",
"//chrome/services/app_service/public/cpp:app_update",
- "//chrome/services/cups_proxy",
- "//chrome/services/cups_proxy/public/mojom",
"//chrome/services/file_util/public/cpp",
"//chrome/services/wilco_dtc_supportd/public/mojom",
"//chromeos",
@@ -95,6 +99,7 @@ source_set("chromeos") {
"//chromeos/dbus:metrics_event_proto",
"//chromeos/dbus:oobe_config_proto",
"//chromeos/dbus:plugin_vm_service_proto",
+ "//chromeos/dbus:update_engine_proto",
"//chromeos/dbus:vm_plugin_dispatcher_proto",
"//chromeos/dbus/audio",
"//chromeos/dbus/auth_policy",
@@ -107,6 +112,8 @@ source_set("chromeos") {
"//chromeos/dbus/cryptohome:cryptohome_proto",
"//chromeos/dbus/cryptohome:cryptohome_signkey_proto",
"//chromeos/dbus/cups_proxy",
+ "//chromeos/dbus/dlcservice",
+ "//chromeos/dbus/dlcservice:dlcservice_proto",
"//chromeos/dbus/kerberos",
"//chromeos/dbus/kerberos:kerberos_proto",
"//chromeos/dbus/machine_learning",
@@ -203,6 +210,7 @@ source_set("chromeos") {
"//components/storage_monitor",
"//components/strings",
"//components/sync",
+ "//components/sync_device_info",
"//components/sync_preferences",
"//components/tracing:startup_tracing",
"//components/translate/core/browser",
@@ -258,6 +266,7 @@ source_set("chromeos") {
"//third_party/blink/public/common",
"//third_party/cacheinvalidation",
"//third_party/icu",
+ "//third_party/libipp",
"//third_party/metrics_proto",
"//third_party/protobuf:protobuf_lite",
"//third_party/protobuf:protoc($host_toolchain)",
@@ -364,8 +373,6 @@ source_set("chromeos") {
"android_sms/fcm_connection_establisher.h",
"android_sms/pairing_lost_notifier.cc",
"android_sms/pairing_lost_notifier.h",
- "android_sms/streaming_connection_establisher.cc",
- "android_sms/streaming_connection_establisher.h",
"app_mode/app_launch_utils.cc",
"app_mode/app_launch_utils.h",
"app_mode/app_session.cc",
@@ -400,6 +407,8 @@ source_set("chromeos") {
"app_mode/kiosk_app_update_install_gate.h",
"app_mode/kiosk_app_update_service.cc",
"app_mode/kiosk_app_update_service.h",
+ "app_mode/kiosk_cryptohome_remover.cc",
+ "app_mode/kiosk_cryptohome_remover.h",
"app_mode/kiosk_diagnosis_runner.cc",
"app_mode/kiosk_diagnosis_runner.h",
"app_mode/kiosk_external_update_validator.cc",
@@ -413,6 +422,8 @@ source_set("chromeos") {
"app_mode/kiosk_session_plugin_handler.cc",
"app_mode/kiosk_session_plugin_handler.h",
"app_mode/kiosk_session_plugin_handler_delegate.h",
+ "app_mode/pref_names.cc",
+ "app_mode/pref_names.h",
"app_mode/startup_app_launcher.cc",
"app_mode/startup_app_launcher.h",
"app_mode/startup_app_launcher_update_checker.cc",
@@ -425,6 +436,8 @@ source_set("chromeos") {
"apps/apk_web_app_service_factory.h",
"apps/intent_helper/chromeos_apps_navigation_throttle.cc",
"apps/intent_helper/chromeos_apps_navigation_throttle.h",
+ "apps/intent_helper/common_apps_navigation_throttle.cc",
+ "apps/intent_helper/common_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",
@@ -449,12 +462,6 @@ source_set("chromeos") {
"arc/arc_migration_guide_notification.h",
"arc/arc_optin_uma.cc",
"arc/arc_optin_uma.h",
- "arc/arc_play_store_enabled_preference_handler.cc",
- "arc/arc_play_store_enabled_preference_handler.h",
- "arc/arc_service_launcher.cc",
- "arc/arc_service_launcher.h",
- "arc/arc_session_manager.cc",
- "arc/arc_session_manager.h",
"arc/arc_support_host.cc",
"arc/arc_support_host.h",
"arc/arc_util.cc",
@@ -490,6 +497,8 @@ source_set("chromeos") {
"arc/enterprise/cert_store/arc_cert_installer_utils.h",
"arc/enterprise/cert_store/arc_cert_store_bridge.cc",
"arc/enterprise/cert_store/arc_cert_store_bridge.h",
+ "arc/enterprise/cert_store/arc_smart_card_manager_bridge.cc",
+ "arc/enterprise/cert_store/arc_smart_card_manager_bridge.h",
"arc/extensions/arc_support_message_host.cc",
"arc/extensions/arc_support_message_host.h",
"arc/file_system_watcher/arc_file_system_watcher_service.cc",
@@ -551,14 +560,12 @@ source_set("chromeos") {
"arc/input_method_manager/input_connection_impl.h",
"arc/instance_throttle/arc_active_window_throttle_observer.cc",
"arc/instance_throttle/arc_active_window_throttle_observer.h",
+ "arc/instance_throttle/arc_app_launch_throttle_observer.cc",
+ "arc/instance_throttle/arc_app_launch_throttle_observer.h",
"arc/instance_throttle/arc_boot_phase_throttle_observer.cc",
"arc/instance_throttle/arc_boot_phase_throttle_observer.h",
"arc/instance_throttle/arc_instance_throttle.cc",
"arc/instance_throttle/arc_instance_throttle.h",
- "arc/instance_throttle/arc_throttle_observer.cc",
- "arc/instance_throttle/arc_throttle_observer.h",
- "arc/instance_throttle/window_throttle_observer_base.cc",
- "arc/instance_throttle/window_throttle_observer_base.h",
"arc/intent_helper/arc_external_protocol_dialog.cc",
"arc/intent_helper/arc_external_protocol_dialog.h",
"arc/intent_helper/arc_intent_picker_app_fetcher.cc",
@@ -618,10 +625,20 @@ 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/session/arc_play_store_enabled_preference_handler.cc",
+ "arc/session/arc_play_store_enabled_preference_handler.h",
+ "arc/session/arc_service_launcher.cc",
+ "arc/session/arc_service_launcher.h",
+ "arc/session/arc_session_manager.cc",
+ "arc/session/arc_session_manager.h",
"arc/tracing/arc_app_performance_tracing.cc",
"arc/tracing/arc_app_performance_tracing.h",
+ "arc/tracing/arc_app_performance_tracing_custom_session.cc",
+ "arc/tracing/arc_app_performance_tracing_custom_session.h",
"arc/tracing/arc_app_performance_tracing_session.cc",
"arc/tracing/arc_app_performance_tracing_session.h",
+ "arc/tracing/arc_app_performance_tracing_uma_session.cc",
+ "arc/tracing/arc_app_performance_tracing_uma_session.h",
"arc/tracing/arc_cpu_event.cc",
"arc/tracing/arc_cpu_event.h",
"arc/tracing/arc_graphics_jank_detector.cc",
@@ -652,8 +669,6 @@ source_set("chromeos") {
"arc/user_session/arc_user_session_service.h",
"arc/video/gpu_arc_video_service_host.cc",
"arc/video/gpu_arc_video_service_host.h",
- "arc/voice_interaction/voice_interaction_controller_client.cc",
- "arc/voice_interaction/voice_interaction_controller_client.h",
"arc/wallpaper/arc_wallpaper_service.cc",
"arc/wallpaper/arc_wallpaper_service.h",
"assistant/assistant_util.cc",
@@ -674,6 +689,8 @@ source_set("chromeos") {
"attestation/platform_verification_dialog.h",
"attestation/platform_verification_flow.cc",
"attestation/platform_verification_flow.h",
+ "attestation/tpm_challenge_key.cc",
+ "attestation/tpm_challenge_key.h",
"authpolicy/auth_policy_credentials_manager.cc",
"authpolicy/auth_policy_credentials_manager.h",
"authpolicy/authpolicy_helper.cc",
@@ -688,6 +705,10 @@ source_set("chromeos") {
"base/file_flusher.h",
"base/locale_util.cc",
"base/locale_util.h",
+ "bluetooth/debug_logs_manager.cc",
+ "bluetooth/debug_logs_manager.h",
+ "bluetooth/debug_logs_manager_factory.cc",
+ "bluetooth/debug_logs_manager_factory.h",
"boot_times_recorder.cc",
"boot_times_recorder.h",
"camera_detector.cc",
@@ -744,6 +765,8 @@ source_set("chromeos") {
"chrome_browser_main_chromeos.h",
"chrome_content_browser_client_chromeos_part.cc",
"chrome_content_browser_client_chromeos_part.h",
+ "concierge_helper_service.cc",
+ "concierge_helper_service.h",
"crostini/ansible/ansible_management_service.cc",
"crostini/ansible/ansible_management_service.h",
"crostini/ansible/ansible_management_util.cc",
@@ -756,6 +779,10 @@ source_set("chromeos") {
"crostini/crostini_export_import.h",
"crostini/crostini_export_import_notification.cc",
"crostini/crostini_export_import_notification.h",
+ "crostini/crostini_features.cc",
+ "crostini/crostini_features.h",
+ "crostini/crostini_force_close_watcher.cc",
+ "crostini/crostini_force_close_watcher.h",
"crostini/crostini_installer.cc",
"crostini/crostini_installer.h",
"crostini/crostini_installer_ui_delegate.h",
@@ -795,6 +822,10 @@ source_set("chromeos") {
"crostini/crosvm_process_list.h",
"crostini/fake_crostini_installer_ui_delegate.cc",
"crostini/fake_crostini_installer_ui_delegate.h",
+ "crostini/throttle/crostini_active_window_throttle_observer.cc",
+ "crostini/throttle/crostini_active_window_throttle_observer.h",
+ "crostini/throttle/crostini_throttle.cc",
+ "crostini/throttle/crostini_throttle.h",
"cryptauth/client_app_metadata_provider_service.cc",
"cryptauth/client_app_metadata_provider_service.h",
"cryptauth/client_app_metadata_provider_service_factory.cc",
@@ -845,26 +876,14 @@ source_set("chromeos") {
"drive/debug_info_collector.h",
"drive/download_handler.cc",
"drive/download_handler.h",
- "drive/drive_file_stream_reader.cc",
- "drive/drive_file_stream_reader.h",
"drive/drive_integration_service.cc",
"drive/drive_integration_service.h",
"drive/file_system_util.cc",
"drive/file_system_util.h",
- "drive/fileapi/async_file_util.cc",
- "drive/fileapi/async_file_util.h",
"drive/fileapi/drivefs_async_file_util.cc",
"drive/fileapi/drivefs_async_file_util.h",
"drive/fileapi/drivefs_file_system_backend_delegate.cc",
"drive/fileapi/drivefs_file_system_backend_delegate.h",
- "drive/fileapi/file_system_backend_delegate.cc",
- "drive/fileapi/file_system_backend_delegate.h",
- "drive/fileapi/fileapi_worker.cc",
- "drive/fileapi/fileapi_worker.h",
- "drive/fileapi/webkit_file_stream_reader_impl.cc",
- "drive/fileapi/webkit_file_stream_reader_impl.h",
- "drive/fileapi/webkit_file_stream_writer_impl.cc",
- "drive/fileapi/webkit_file_stream_writer_impl.h",
"drive/write_on_cache_file.cc",
"drive/write_on_cache_file.h",
"eol_notification.cc",
@@ -1052,14 +1071,10 @@ source_set("chromeos") {
"file_system_provider/throttled_file_system.h",
"file_system_provider/watcher.cc",
"file_system_provider/watcher.h",
- "fileapi/external_file_protocol_handler.cc",
- "fileapi/external_file_protocol_handler.h",
"fileapi/external_file_resolver.cc",
"fileapi/external_file_resolver.h",
"fileapi/external_file_url_loader_factory.cc",
"fileapi/external_file_url_loader_factory.h",
- "fileapi/external_file_url_request_job.cc",
- "fileapi/external_file_url_request_job.h",
"fileapi/external_file_url_util.cc",
"fileapi/external_file_url_util.h",
"fileapi/file_access_permissions.cc",
@@ -1317,6 +1332,8 @@ source_set("chromeos") {
"login/saml/in_session_password_change_manager.h",
"login/saml/password_expiry_notification.cc",
"login/saml/password_expiry_notification.h",
+ "login/saml/public_saml_url_fetcher.cc",
+ "login/saml/public_saml_url_fetcher.h",
"login/saml/saml_offline_signin_limiter.cc",
"login/saml/saml_offline_signin_limiter.h",
"login/saml/saml_offline_signin_limiter_factory.cc",
@@ -1469,6 +1486,8 @@ source_set("chromeos") {
"login/ui/login_screen_extension_ui/login_screen_extension_ui_window.h",
"login/ui/login_web_dialog.cc",
"login/ui/login_web_dialog.h",
+ "login/ui/oobe_dialog_size_utils.cc",
+ "login/ui/oobe_dialog_size_utils.h",
"login/ui/oobe_ui_dialog_delegate.cc",
"login/ui/oobe_ui_dialog_delegate.h",
"login/ui/simple_web_view_dialog.cc",
@@ -1617,6 +1636,8 @@ source_set("chromeos") {
"policy/app_install_event_log_manager_wrapper.h",
"policy/app_install_event_log_uploader.cc",
"policy/app_install_event_log_uploader.h",
+ "policy/app_install_event_log_util.cc",
+ "policy/app_install_event_log_util.h",
"policy/app_install_event_logger.cc",
"policy/app_install_event_logger.h",
"policy/auto_enrollment_client.h",
@@ -1656,6 +1677,8 @@ source_set("chromeos") {
"policy/device_cloud_policy_store_chromeos.h",
"policy/device_cloud_policy_validator.cc",
"policy/device_cloud_policy_validator.h",
+ "policy/device_dock_mac_address_source_handler.cc",
+ "policy/device_dock_mac_address_source_handler.h",
"policy/device_local_account.cc",
"policy/device_local_account.h",
"policy/device_local_account_extension_tracker.cc",
@@ -1926,14 +1949,21 @@ source_set("chromeos") {
"printing/cups_printers_manager.h",
"printing/cups_printers_manager_factory.cc",
"printing/cups_printers_manager_factory.h",
- "printing/cups_proxy_service_delegate_impl.cc",
- "printing/cups_proxy_service_delegate_impl.h",
- "printing/cups_proxy_service_manager.cc",
- "printing/cups_proxy_service_manager.h",
- "printing/cups_proxy_service_manager_factory.cc",
- "printing/cups_proxy_service_manager_factory.h",
"printing/enterprise_printers_provider.cc",
"printing/enterprise_printers_provider.h",
+ "printing/history/print_job_database.h",
+ "printing/history/print_job_database_impl.cc",
+ "printing/history/print_job_database_impl.h",
+ "printing/history/print_job_history_cleaner.cc",
+ "printing/history/print_job_history_cleaner.h",
+ "printing/history/print_job_history_service.cc",
+ "printing/history/print_job_history_service.h",
+ "printing/history/print_job_history_service_factory.cc",
+ "printing/history/print_job_history_service_factory.h",
+ "printing/history/print_job_history_service_impl.cc",
+ "printing/history/print_job_history_service_impl.h",
+ "printing/history/print_job_info_proto_conversions.cc",
+ "printing/history/print_job_info_proto_conversions.h",
"printing/ppd_provider_factory.cc",
"printing/ppd_provider_factory.h",
"printing/ppd_resolution_state.cc",
@@ -1961,6 +1991,10 @@ source_set("chromeos") {
"printing/printers_map.h",
"printing/printers_sync_bridge.cc",
"printing/printers_sync_bridge.h",
+ "printing/server_printers_fetcher.cc",
+ "printing/server_printers_fetcher.h",
+ "printing/server_printers_provider.cc",
+ "printing/server_printers_provider.h",
"printing/specifics_translation.cc",
"printing/specifics_translation.h",
"printing/synced_printers_manager.cc",
@@ -2108,12 +2142,18 @@ source_set("chromeos") {
"system_logs/single_log_file_log_source.h",
"system_logs/touch_log_source.cc",
"system_logs/touch_log_source.h",
+ "system_token_cert_db_initializer.cc",
+ "system_token_cert_db_initializer.h",
"tether/fake_tether_service.cc",
"tether/fake_tether_service.h",
"tether/tether_service.cc",
"tether/tether_service.h",
"tether/tether_service_factory.cc",
"tether/tether_service_factory.h",
+ "throttle_observer.cc",
+ "throttle_observer.h",
+ "throttle_service.cc",
+ "throttle_service.h",
"tpm_firmware_update.cc",
"tpm_firmware_update.h",
"tpm_firmware_update_notification.cc",
@@ -2155,6 +2195,8 @@ source_set("chromeos") {
"wilco_dtc_supportd/wilco_dtc_supportd_notification_controller.h",
"wilco_dtc_supportd/wilco_dtc_supportd_web_request_service.cc",
"wilco_dtc_supportd/wilco_dtc_supportd_web_request_service.h",
+ "window_throttle_observer_base.cc",
+ "window_throttle_observer_base.h",
# Extension API implementations.
"extensions/autotest_private/autotest_private_api.cc",
@@ -2174,8 +2216,6 @@ source_set("chromeos") {
"extensions/file_manager/file_manager_private_api_functions.h",
"extensions/file_manager/file_stream_md5_digester.cc",
"extensions/file_manager/file_stream_md5_digester.h",
- "extensions/file_manager/job_event_router.cc",
- "extensions/file_manager/job_event_router.h",
"extensions/file_manager/private_api_base.cc",
"extensions/file_manager/private_api_base.h",
"extensions/file_manager/private_api_dialog.cc",
@@ -2216,6 +2256,12 @@ source_set("chromeos") {
"extensions/login_screen/login_state/session_state_changed_event_dispatcher.h",
"extensions/media_player_api.cc",
"extensions/media_player_api.h",
+ "extensions/printing_metrics/print_job_finished_event_dispatcher.cc",
+ "extensions/printing_metrics/print_job_finished_event_dispatcher.h",
+ "extensions/printing_metrics/print_job_info_idl_conversions.cc",
+ "extensions/printing_metrics/print_job_info_idl_conversions.h",
+ "extensions/printing_metrics/printing_metrics_api.cc",
+ "extensions/printing_metrics/printing_metrics_api.h",
"extensions/quick_unlock_private/quick_unlock_private_api.cc",
"extensions/quick_unlock_private/quick_unlock_private_api.h",
"extensions/users_private/users_private_api.cc",
@@ -2233,8 +2279,18 @@ source_set("chromeos") {
]
if (use_cups) {
+ deps += [
+ "//chrome/services/cups_proxy",
+ "//chrome/services/cups_proxy/public/mojom",
+ ]
sources += [
"printing/cups_print_job_manager_impl.cc",
+ "printing/cups_proxy_service_delegate_impl.cc",
+ "printing/cups_proxy_service_delegate_impl.h",
+ "printing/cups_proxy_service_manager.cc",
+ "printing/cups_proxy_service_manager.h",
+ "printing/cups_proxy_service_manager_factory.cc",
+ "printing/cups_proxy_service_manager_factory.h",
"printing/printer_info_cups.cc",
]
} else {
@@ -2306,6 +2362,8 @@ static_library("test_support") {
"certificate_provider/test_certificate_provider_extension.h",
"crostini/crostini_test_helper.cc",
"crostini/crostini_test_helper.h",
+ "crostini/fake_crostini_features.cc",
+ "crostini/fake_crostini_features.h",
"drive/drivefs_test_support.cc",
"drive/drivefs_test_support.h",
"extensions/test_external_cache.cc",
@@ -2395,7 +2453,6 @@ source_set("unit_tests") {
"android_sms/connection_manager_unittest.cc",
"android_sms/fcm_connection_establisher_unittest.cc",
"android_sms/pairing_lost_notifier_unittest.cc",
- "android_sms/streaming_connection_establisher_unittest.cc",
"app_mode/startup_app_launcher_unittest.cc",
"apps/apk_web_app_installer_unittest.cc",
"apps/intent_helper/chromeos_apps_navigation_throttle_unittest.cc",
@@ -2404,8 +2461,6 @@ source_set("unit_tests") {
"arc/app_shortcuts/arc_app_shortcuts_menu_builder_unittest.cc",
"arc/app_shortcuts/arc_app_shortcuts_request_unittest.cc",
"arc/arc_migration_guide_notification_unittest.cc",
- "arc/arc_play_store_enabled_preference_handler_unittest.cc",
- "arc/arc_session_manager_unittest.cc",
"arc/arc_support_host_unittest.cc",
"arc/arc_util_unittest.cc",
"arc/bluetooth/arc_bluetooth_bridge_unittest.cc",
@@ -2413,6 +2468,7 @@ source_set("unit_tests") {
"arc/boot_phase_monitor/arc_boot_phase_monitor_bridge_unittest.cc",
"arc/enterprise/cert_store/arc_cert_installer_unittest.cc",
"arc/enterprise/cert_store/arc_cert_installer_utils_unittest.cc",
+ "arc/enterprise/cert_store/arc_smart_card_manager_bridge_unittest.cc",
"arc/extensions/arc_support_message_host_unittest.cc",
"arc/file_system_watcher/arc_file_system_watcher_service_unittest.cc",
"arc/fileapi/arc_content_file_system_async_file_util_unittest.cc",
@@ -2432,9 +2488,9 @@ source_set("unit_tests") {
"arc/input_method_manager/test_input_method_manager_bridge.cc",
"arc/input_method_manager/test_input_method_manager_bridge.h",
"arc/instance_throttle/arc_active_window_throttle_observer_unittest.cc",
+ "arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc",
"arc/instance_throttle/arc_boot_phase_throttle_observer_unittest.cc",
"arc/instance_throttle/arc_instance_throttle_unittest.cc",
- "arc/instance_throttle/arc_throttle_observer_unittest.cc",
"arc/intent_helper/arc_external_protocol_dialog_unittest.cc",
"arc/intent_helper/arc_intent_picker_app_fetcher_unittest.cc",
"arc/intent_helper/arc_settings_service_unittest.cc",
@@ -2446,15 +2502,17 @@ 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/session/arc_play_store_enabled_preference_handler_unittest.cc",
+ "arc/session/arc_session_manager_unittest.cc",
"arc/tracing/arc_app_performance_tracing_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_event_matcher_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/voice_interaction_controller_client_unittest.cc",
"arc/wallpaper/arc_wallpaper_service_unittest.cc",
"assistant/assistant_util_unittest.cc",
"attestation/attestation_ca_client_unittest.cc",
@@ -2464,7 +2522,10 @@ source_set("unit_tests") {
"attestation/fake_certificate.cc",
"attestation/fake_certificate.h",
"attestation/machine_certificate_uploader_impl_unittest.cc",
+ "attestation/mock_tpm_challenge_key.cc",
+ "attestation/mock_tpm_challenge_key.h",
"attestation/platform_verification_flow_unittest.cc",
+ "attestation/tpm_challenge_key_unittest.cc",
"authpolicy/auth_policy_credentials_manager_unittest.cc",
"authpolicy/authpolicy_helper.unittest.cc",
"base/file_flusher_unittest.cc",
@@ -2478,10 +2539,13 @@ source_set("unit_tests") {
"child_accounts/usage_time_limit_processor_unittest.cc",
"child_accounts/usage_time_state_notifier_unittest.cc",
"chrome_content_browser_client_chromeos_part_unittest.cc",
+ "concierge_helper_service_unittest.cc",
"crostini/ansible/ansible_management_service_unittest.cc",
"crostini/ansible/pending_software_changes_unittest.cc",
"crostini/ansible/software_config_unittest.cc",
"crostini/crostini_export_import_unittest.cc",
+ "crostini/crostini_features_unittest.cc",
+ "crostini/crostini_force_close_watcher_unittest.cc",
"crostini/crostini_installer_unittest.cc",
"crostini/crostini_manager_unittest.cc",
"crostini/crostini_mime_types_service_unittest.cc",
@@ -2492,16 +2556,16 @@ source_set("unit_tests") {
"crostini/crostini_unsupported_action_notifier_unittest.cc",
"crostini/crosvm_metrics_unittest.cc",
"crostini/crosvm_process_list_unittest.cc",
+ "crostini/throttle/crostini_active_window_throttle_observer_unittest.cc",
+ "crostini/throttle/crostini_throttle_unittest.cc",
"cryptauth/client_app_metadata_provider_service_unittest.cc",
"customization/customization_document_unittest.cc",
"dbus/proxy_resolution_service_provider_unittest.cc",
"drive/download_handler_unittest.cc",
- "drive/drive_file_stream_reader_unittest.cc",
"drive/drive_integration_service_unittest.cc",
"drive/file_system_util_unittest.cc",
- "drive/fileapi/fileapi_worker_unittest.cc",
- "drive/fileapi/webkit_file_stream_reader_impl_unittest.cc",
"drive/write_on_cache_file_unittest.cc",
+ "eol_notification_unittest.cc",
"events/event_rewriter_unittest.cc",
"extensions/active_tab_permission_granter_delegate_chromeos_unittest.cc",
"extensions/default_app_order_unittest.cc",
@@ -2512,7 +2576,6 @@ source_set("unit_tests") {
"extensions/file_manager/device_event_router_unittest.cc",
"extensions/file_manager/drivefs_event_router_unittest.cc",
"extensions/file_manager/event_router_unittest.cc",
- "extensions/file_manager/job_event_router_unittest.cc",
"extensions/gfx_utils_unittest.cc",
"extensions/install_limiter_unittest.cc",
"extensions/login_screen/login/login_api_unittest.cc",
@@ -2520,6 +2583,9 @@ source_set("unit_tests") {
"extensions/login_screen/login_state/login_state_api_unittest.cc",
"extensions/login_screen/login_state/session_state_changed_event_dispatcher_unittest.cc",
"extensions/permissions_updater_delegate_chromeos_unittest.cc",
+ "extensions/printing_metrics/print_job_finished_event_dispatcher_unittest.cc",
+ "extensions/printing_metrics/print_job_info_idl_conversions_unittest.cc",
+ "extensions/printing_metrics/printing_metrics_api_unittest.cc",
"extensions/public_session_permission_helper_unittest.cc",
"extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc",
"extensions/signin_screen_policy_provider_unittest.cc",
@@ -2577,7 +2643,6 @@ source_set("unit_tests") {
"file_system_provider/service_unittest.cc",
"file_system_provider/throttled_file_system_unittest.cc",
"fileapi/external_file_url_loader_factory_unittest.cc",
- "fileapi/external_file_url_request_job_unittest.cc",
"fileapi/external_file_url_util_unittest.cc",
"fileapi/file_access_permissions_unittest.cc",
"fileapi/file_system_backend_unittest.cc",
@@ -2625,12 +2690,14 @@ source_set("unit_tests") {
"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_required_screen_unittest.cc",
"login/screens/update_screen_unittest.cc",
"login/session/user_session_manager_test.cc",
"login/signin_partition_manager_unittest.cc",
"login/supervised/supervised_user_authentication_unittest.cc",
"login/ui/login_screen_extension_ui/login_screen_extension_ui_dialog_delegate_unittest.cc",
"login/ui/login_screen_extension_ui/login_screen_extension_ui_web_dialog_view_unittest.cc",
+ "login/ui/oobe_dialog_size_utils_unittest.cc",
"login/users/affiliation_unittest.cc",
"login/users/multi_profile_user_controller_unittest.cc",
"login/users/user_manager_unittest.cc",
@@ -2675,6 +2742,7 @@ source_set("unit_tests") {
"policy/device_cloud_policy_initializer_unittest.cc",
"policy/device_cloud_policy_manager_chromeos_unittest.cc",
"policy/device_cloud_policy_store_chromeos_unittest.cc",
+ "policy/device_dock_mac_address_source_handler_unittest.cc",
"policy/device_local_account_policy_service_unittest.cc",
"policy/device_policy_decoder_chromeos_unittest.cc",
"policy/dm_token_storage_unittest.cc",
@@ -2736,6 +2804,16 @@ source_set("unit_tests") {
"printing/automatic_usb_printer_configurer_unittest.cc",
"printing/bulk_printers_calculator_unittest.cc",
"printing/cups_printers_manager_unittest.cc",
+ "printing/history/mock_print_job_history_service.cc",
+ "printing/history/mock_print_job_history_service.h",
+ "printing/history/print_job_database_impl_unittest.cc",
+ "printing/history/print_job_history_cleaner_unittest.cc",
+ "printing/history/print_job_history_service_impl_unittest.cc",
+ "printing/history/print_job_info_proto_conversions_unittest.cc",
+ "printing/history/test_print_job_database.cc",
+ "printing/history/test_print_job_database.h",
+ "printing/history/test_print_job_history_service_observer.cc",
+ "printing/history/test_print_job_history_service_observer.h",
"printing/ppd_resolution_state_unittest.cc",
"printing/ppd_resolution_tracker_unittest.cc",
"printing/print_servers_provider_unittest.cc",
@@ -2745,6 +2823,8 @@ source_set("unit_tests") {
"printing/printers_sync_bridge_unittest.cc",
"printing/specifics_translation_unittest.cc",
"printing/synced_printers_manager_unittest.cc",
+ "printing/test_cups_print_job_manager.cc",
+ "printing/test_cups_print_job_manager.h",
"printing/usb_printer_detector_unittest.cc",
"printing/zeroconf_printer_detector_unittest.cc",
"proxy_config_service_impl_unittest.cc",
@@ -2770,6 +2850,7 @@ source_set("unit_tests") {
"smb_client/discovery/network_scanner_unittest.cc",
"smb_client/smb_errors_unittest.cc",
"smb_client/smb_file_system_id_test.cc",
+ "smb_client/smb_file_system_unittest.cc",
"smb_client/smb_service_helper_unittest.cc",
"smb_client/smb_service_unittest.cc",
"smb_client/smb_share_finder_unittest.cc",
@@ -2784,6 +2865,8 @@ source_set("unit_tests") {
"system_logs/single_debug_daemon_log_source_unittest.cc",
"system_logs/single_log_file_log_source_unittest.cc",
"tether/tether_service_unittest.cc",
+ "throttle_observer_unittest.cc",
+ "throttle_service_unittest.cc",
"tpm_firmware_update_unittest.cc",
"ui/gnubby_notification_unittest.cc",
"ui/idle_app_name_notification_view_unittest.cc",
@@ -2885,6 +2968,7 @@ source_set("unit_tests") {
"//chromeos/audio",
"//chromeos/components/multidevice:test_support",
"//chromeos/components/proximity_auth",
+ "//chromeos/components/proximity_auth:test_support",
"//chromeos/components/tether:test_support",
"//chromeos/constants",
"//chromeos/cryptohome:test_support",
@@ -2892,6 +2976,7 @@ source_set("unit_tests") {
"//chromeos/dbus/auth_policy",
"//chromeos/dbus/cryptohome",
"//chromeos/dbus/cryptohome:attestation_proto",
+ "//chromeos/dbus/dlcservice:test_support",
"//chromeos/dbus/power",
"//chromeos/dbus/services:test_support",
"//chromeos/dbus/session_manager",
@@ -2950,6 +3035,7 @@ source_set("unit_tests") {
"//device/bluetooth",
"//google_apis:test_support",
"//google_apis/drive:test_support",
+ "//mojo/public/cpp/bindings",
"//mojo/public/cpp/system:system",
"//services/data_decoder/public/cpp:test_support",
"//services/device/public/cpp:test_support",
@@ -3007,6 +3093,12 @@ proto_library("device_configuration_proto") {
generate_python = false
}
+proto_library("print_job_info_proto") {
+ sources = [
+ "printing/history/print_job_info.proto",
+ ]
+}
+
device_policy_remover_path = "$target_gen_dir/device_policy_remover.cc"
action("device_policy_remover_generate") {
@@ -3090,3 +3182,29 @@ fuzzer_test("zeroconf_printer_detector_fuzzer") {
"//chrome/browser/chromeos",
]
}
+
+if (use_libfuzzer) {
+ fuzzer_test("policy_fuzzer") {
+ sources = [
+ "policy/fuzzer/policy_fuzzer.cc",
+ ]
+
+ deps = [
+ ":policy_fuzzer_proto",
+ "//chrome/browser",
+ "//chrome/browser/chromeos",
+ "//third_party/libprotobuf-mutator",
+ ]
+ }
+
+ fuzzable_proto_library("policy_fuzzer_proto") {
+ sources = [
+ "policy/fuzzer/policy_fuzzer.proto",
+ ]
+
+ import_dirs = [ "//components/policy/proto" ]
+
+ link_deps =
+ [ "//components/policy/proto:chrome_device_policy_full_runtime_proto" ]
+ }
+}
diff --git a/chromium/chrome/browser/ui/app_list/search/logging/BUILD.gn b/chromium/chrome/browser/chromeos/crostini/BUILD.gn
index d2fbed1f694..b83dad29d49 100644
--- a/chromium/chrome/browser/ui/app_list/search/logging/BUILD.gn
+++ b/chromium/chrome/browser/chromeos/crostini/BUILD.gn
@@ -2,10 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import("//third_party/protobuf/proto_library.gni")
+import("//mojo/public/tools/bindings/mojom.gni")
-proto_library("search_ranking_event_proto") {
+mojom("crostini_installer_types_mojom") {
sources = [
- "search_ranking_event.proto",
+ "crostini_installer_types.mojom",
]
}
diff --git a/chromium/chrome/browser/chromeos/crostini/crostini_installer_types.mojom b/chromium/chrome/browser/chromeos/crostini/crostini_installer_types.mojom
new file mode 100644
index 00000000000..d24a8877ce5
--- /dev/null
+++ b/chromium/chrome/browser/chromeos/crostini/crostini_installer_types.mojom
@@ -0,0 +1,32 @@
+// 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 crostini.mojom;
+
+enum InstallerState {
+ kStart, // Just started installation
+ kInstallImageLoader, // Loading the Termina VM component.
+ kStartConcierge, // Starting the Concierge D-Bus client.
+ kCreateDiskImage, // Creating the image for the Termina VM.
+ kStartTerminaVm, // Starting the Termina VM.
+ kCreateContainer, // Creating the container inside the Termina VM.
+ kSetupContainer, // Setting up the container inside the Termina VM.
+ kStartContainer, // Starting the container inside the Termina VM.
+ kFetchSshKeys, // Fetch ssh keys from concierge.
+ kMountContainer, // Do sshfs mount of container.
+};
+
+enum InstallerError {
+ kNone,
+ kErrorLoadingTermina,
+ kErrorStartingConcierge,
+ kErrorCreatingDiskImage,
+ kErrorStartingTermina,
+ kErrorStartingContainer,
+ kErrorOffline,
+ kErrorFetchingSshKeys,
+ kErrorMountingContainer,
+ kErrorSettingUpContainer,
+ kErrorInsufficientDiskSpace,
+};
diff --git a/chromium/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chromium/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index 5a4de3ea15a..87c13bfd522 100644
--- a/chromium/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chromium/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -25,51 +25,12 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_renderer_host.h"
-#include "net/base/request_priority.h"
-#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
-#include "net/url_request/url_request.h"
-#include "net/url_request/url_request_context.h"
#include "testing/gtest/include/gtest/gtest.h"
using content::BrowserThread;
namespace {
-// FakeURLRequestJobFactory returns NULL for all job creation requests and false
-// for all IsHandledProtocol() requests. FakeURLRequestJobFactory can be chained
-// to ProtocolHandlerRegistry::JobInterceptorFactory so the result of
-// MaybeCreateJobWithProtocolHandler() indicates whether the
-// ProtocolHandlerRegistry properly handled a job creation request.
-class FakeURLRequestJobFactory : public net::URLRequestJobFactory {
- // net::URLRequestJobFactory implementation:
- net::URLRequestJob* MaybeCreateJobWithProtocolHandler(
- const std::string& scheme,
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const override {
- return NULL;
- }
-
- net::URLRequestJob* MaybeInterceptRedirect(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate,
- const GURL& location) const override {
- return nullptr;
- }
-
- net::URLRequestJob* MaybeInterceptResponse(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const override {
- return nullptr;
- }
-
- bool IsHandledProtocol(const std::string& scheme) const override {
- return false;
- }
- bool IsSafeRedirectTarget(const GURL& location) const override {
- return true;
- }
-};
-
std::unique_ptr<base::DictionaryValue> GetProtocolHandlerValue(
const std::string& protocol,
const std::string& url) {
diff --git a/chromium/chrome/browser/devtools/BUILD.gn b/chromium/chrome/browser/devtools/BUILD.gn
index 36b76413f8e..e89c23aab2d 100644
--- a/chromium/chrome/browser/devtools/BUILD.gn
+++ b/chromium/chrome/browser/devtools/BUILD.gn
@@ -26,6 +26,8 @@ if (!is_android) {
"protocol/page.h",
"protocol/protocol.cc",
"protocol/protocol.h",
+ "protocol/security.cc",
+ "protocol/security.h",
"protocol/target.cc",
"protocol/target.h",
]
@@ -198,8 +200,10 @@ static_library("devtools") {
sources += [ "devtools_dock_tile.cc" ]
}
if (!is_android) {
- deps += [ ":protocol_generated_sources",
- "//third_party/inspector_protocol:encoding" ]
+ deps += [
+ ":protocol_generated_sources",
+ "//third_party/inspector_protocol:encoding",
+ ]
sources += [
"protocol/browser_handler.cc",
"protocol/browser_handler.h",
@@ -207,6 +211,8 @@ static_library("devtools") {
"protocol/cast_handler.h",
"protocol/page_handler.cc",
"protocol/page_handler.h",
+ "protocol/security_handler.cc",
+ "protocol/security_handler.h",
"protocol/target_handler.cc",
"protocol/target_handler.h",
]
diff --git a/chromium/chrome/browser/devtools/OWNERS b/chromium/chrome/browser/devtools/OWNERS
index 1329473478e..e1277e85c22 100644
--- a/chromium/chrome/browser/devtools/OWNERS
+++ b/chromium/chrome/browser/devtools/OWNERS
@@ -1,6 +1,7 @@
dgozman@chromium.org
pfeldman@chromium.org
caseq@chromium.org
+yangguo@chromium.org
per-file devtools_embedder_message_dispatcher.*=set noparent
per-file devtools_embedder_message_dispatcher.*=file://ipc/SECURITY_OWNERS
diff --git a/chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.cc b/chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.cc
index d34abfa43f3..3564def60ef 100644
--- a/chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.cc
+++ b/chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.cc
@@ -227,9 +227,8 @@ ChromeDevToolsManagerDelegate::CreateNewTarget(const GURL& url) {
}
std::string ChromeDevToolsManagerDelegate::GetDiscoveryPageHTML() {
- return ui::ResourceBundle::GetSharedInstance()
- .GetRawDataResource(IDR_DEVTOOLS_DISCOVERY_PAGE_HTML)
- .as_string();
+ return ui::ResourceBundle::GetSharedInstance().DecompressDataResource(
+ IDR_DEVTOOLS_DISCOVERY_PAGE_HTML);
}
std::vector<content::BrowserContext*>
diff --git a/chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.h b/chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.h
index 27a2dd29112..0e7bdc0eb74 100644
--- a/chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.h
+++ b/chromium/chrome/browser/devtools/chrome_devtools_manager_delegate.h
@@ -17,6 +17,7 @@
#include "chrome/browser/devtools/protocol/protocol.h"
#include "content/public/browser/devtools_agent_host_observer.h"
#include "content/public/browser/devtools_manager_delegate.h"
+#include "net/base/host_port_pair.h"
class ChromeDevToolsSession;
using RemoteLocations = std::set<net::HostPortPair>;
diff --git a/chromium/chrome/browser/devtools/chrome_devtools_session.cc b/chromium/chrome/browser/devtools/chrome_devtools_session.cc
index 4b75e59539e..846cdec8776 100644
--- a/chromium/chrome/browser/devtools/chrome_devtools_session.cc
+++ b/chromium/chrome/browser/devtools/chrome_devtools_session.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/devtools/protocol/browser_handler.h"
#include "chrome/browser/devtools/protocol/cast_handler.h"
#include "chrome/browser/devtools/protocol/page_handler.h"
+#include "chrome/browser/devtools/protocol/security_handler.h"
#include "chrome/browser/devtools/protocol/target_handler.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_agent_host_client.h"
@@ -64,6 +65,8 @@ ChromeDevToolsSession::ChromeDevToolsSession(
agent_host->GetType() == content::DevToolsAgentHost::kTypePage) {
page_handler_ = std::make_unique<PageHandler>(agent_host->GetWebContents(),
dispatcher_.get());
+ security_handler_ = std::make_unique<SecurityHandler>(
+ agent_host->GetWebContents(), dispatcher_.get());
if (client->MayAttachToBrowser()) {
cast_handler_ = std::make_unique<CastHandler>(
agent_host->GetWebContents(), dispatcher_.get());
diff --git a/chromium/chrome/browser/devtools/chrome_devtools_session.h b/chromium/chrome/browser/devtools/chrome_devtools_session.h
index 2665df6eb43..4a181761533 100644
--- a/chromium/chrome/browser/devtools/chrome_devtools_session.h
+++ b/chromium/chrome/browser/devtools/chrome_devtools_session.h
@@ -22,6 +22,7 @@ class DevToolsAgentHostClient;
class BrowserHandler;
class CastHandler;
class PageHandler;
+class SecurityHandler;
class TargetHandler;
class WindowManagerHandler;
@@ -61,6 +62,7 @@ class ChromeDevToolsSession : public protocol::FrontendChannel {
std::unique_ptr<BrowserHandler> browser_handler_;
std::unique_ptr<CastHandler> cast_handler_;
std::unique_ptr<PageHandler> page_handler_;
+ std::unique_ptr<SecurityHandler> security_handler_;
std::unique_ptr<TargetHandler> target_handler_;
#if defined(OS_CHROMEOS)
std::unique_ptr<WindowManagerHandler> window_manager_protocl_handler_;
diff --git a/chromium/chrome/browser/devtools/device/android_device_manager.cc b/chromium/chrome/browser/devtools/device/android_device_manager.cc
index a59205407f5..4c4cf0b8584 100644
--- a/chromium/chrome/browser/devtools/device/android_device_manager.cc
+++ b/chromium/chrome/browser/devtools/device/android_device_manager.cc
@@ -18,6 +18,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
+#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/devtools/device/usb/usb_device_manager_helper.h"
#include "chrome/browser/devtools/device/usb/usb_device_provider.h"
diff --git a/chromium/chrome/browser/devtools/device/devtools_android_bridge.cc b/chromium/chrome/browser/devtools/device/devtools_android_bridge.cc
index ec895142198..f799123063b 100644
--- a/chromium/chrome/browser/devtools/device/devtools_android_bridge.cc
+++ b/chromium/chrome/browser/devtools/device/devtools_android_bridge.cc
@@ -166,8 +166,8 @@ DevToolsAndroidBridge::DevToolsAndroidBridge(Profile* profile)
base::Bind(&DevToolsAndroidBridge::CreateDeviceProviders,
base::Unretained(this)));
base::Value target_discovery(base::Value::Type::LIST);
- target_discovery.GetList().emplace_back(kChromeDiscoveryURL);
- target_discovery.GetList().emplace_back(kNodeDiscoveryURL);
+ target_discovery.Append(kChromeDiscoveryURL);
+ target_discovery.Append(kNodeDiscoveryURL);
profile->GetPrefs()->SetDefaultPrefValue(prefs::kDevToolsTCPDiscoveryConfig,
std::move(target_discovery));
CreateDeviceProviders();
diff --git a/chromium/chrome/browser/devtools/device/devtools_device_discovery.h b/chromium/chrome/browser/devtools/device/devtools_device_discovery.h
index 7b97e2f90e5..a83ad1f91b4 100644
--- a/chromium/chrome/browser/devtools/device/devtools_device_discovery.h
+++ b/chromium/chrome/browser/devtools/device/devtools_device_discovery.h
@@ -13,6 +13,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/values.h"
#include "chrome/browser/devtools/device/android_device_manager.h"
#include "content/public/browser/devtools_agent_host.h"
diff --git a/chromium/chrome/browser/devtools/device/port_forwarding_controller.cc b/chromium/chrome/browser/devtools/device/port_forwarding_controller.cc
index 99fe24c6d13..2fbd2e47362 100644
--- a/chromium/chrome/browser/devtools/device/port_forwarding_controller.cc
+++ b/chromium/chrome/browser/devtools/device/port_forwarding_controller.cc
@@ -28,7 +28,7 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -153,20 +153,18 @@ class PortForwardingHostResolver : public network::ResolveHostClientBase {
const std::string& host,
int port,
ResolveHostCallback resolve_host_callback)
- : binding_(this),
- resolve_host_callback_(std::move(resolve_host_callback)) {
+ : resolve_host_callback_(std::move(resolve_host_callback)) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- DCHECK(!binding_);
+ DCHECK(!receiver_.is_bound());
- network::mojom::ResolveHostClientPtr client_ptr;
- binding_.Bind(mojo::MakeRequest(&client_ptr));
- binding_.set_connection_error_handler(
- base::BindOnce(&PortForwardingHostResolver::OnComplete,
- base::Unretained(this), net::ERR_FAILED, base::nullopt));
net::HostPortPair host_port_pair(host, port);
content::BrowserContext::GetDefaultStoragePartition(profile)
->GetNetworkContext()
- ->ResolveHost(host_port_pair, nullptr, std::move(client_ptr));
+ ->ResolveHost(host_port_pair, nullptr,
+ receiver_.BindNewPipeAndPassRemote());
+ receiver_.set_disconnect_handler(
+ base::BindOnce(&PortForwardingHostResolver::OnComplete,
+ base::Unretained(this), net::ERR_FAILED, base::nullopt));
}
private:
@@ -190,7 +188,7 @@ class PortForwardingHostResolver : public network::ResolveHostClientBase {
delete this;
}
- mojo::Binding<network::mojom::ResolveHostClient> binding_;
+ mojo::Receiver<network::mojom::ResolveHostClient> receiver_{this};
ResolveHostCallback resolve_host_callback_;
DISALLOW_COPY_AND_ASSIGN(PortForwardingHostResolver);
diff --git a/chromium/chrome/browser/devtools/device/tcp_device_provider.cc b/chromium/chrome/browser/devtools/device/tcp_device_provider.cc
index 49f340aae90..394538ff6cc 100644
--- a/chromium/chrome/browser/devtools/device/tcp_device_provider.cc
+++ b/chromium/chrome/browser/devtools/device/tcp_device_provider.cc
@@ -18,7 +18,7 @@
#include "chrome/browser/devtools/device/adb/adb_client_socket.h"
#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 "mojo/public/cpp/bindings/receiver.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/net_errors.h"
#include "net/log/net_log_source.h"
@@ -41,17 +41,16 @@ static void RunSocketCallback(
class ResolveHostAndOpenSocket final : public network::ResolveHostClientBase {
public:
- ResolveHostAndOpenSocket(const net::HostPortPair& address,
- const AdbClientSocket::SocketCallback& callback,
- network::mojom::HostResolverPtr* host_resolver)
- : callback_(callback), binding_(this) {
- network::mojom::ResolveHostClientPtr client_ptr;
- binding_.Bind(mojo::MakeRequest(&client_ptr));
- binding_.set_connection_error_handler(
+ ResolveHostAndOpenSocket(
+ const net::HostPortPair& address,
+ const AdbClientSocket::SocketCallback& callback,
+ mojo::Remote<network::mojom::HostResolver>* host_resolver)
+ : callback_(callback) {
+ (*host_resolver)
+ ->ResolveHost(address, nullptr, receiver_.BindNewPipeAndPassRemote());
+ receiver_.set_disconnect_handler(
base::BindOnce(&ResolveHostAndOpenSocket::OnComplete,
base::Unretained(this), net::ERR_FAILED, base::nullopt));
-
- (*host_resolver)->ResolveHost(address, nullptr, std::move(client_ptr));
}
private:
@@ -77,7 +76,7 @@ class ResolveHostAndOpenSocket final : public network::ResolveHostClientBase {
}
AdbClientSocket::SocketCallback callback_;
- mojo::Binding<network::mojom::ResolveHostClient> binding_;
+ mojo::Receiver<network::mojom::ResolveHostClient> receiver_{this};
};
} // namespace
@@ -157,16 +156,18 @@ TCPDeviceProvider::~TCPDeviceProvider() {
}
void TCPDeviceProvider::InitializeHostResolver() {
- base::PostTask(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(&TCPDeviceProvider::InitializeHostResolverOnUI,
- this, mojo::MakeRequest(&host_resolver_)));
- host_resolver_.set_connection_error_handler(base::BindOnce(
+ host_resolver_.reset();
+ base::PostTask(
+ FROM_HERE, {content::BrowserThread::UI},
+ base::BindOnce(&TCPDeviceProvider::InitializeHostResolverOnUI, this,
+ host_resolver_.BindNewPipeAndPassReceiver()));
+ host_resolver_.set_disconnect_handler(base::BindOnce(
&TCPDeviceProvider::InitializeHostResolver, base::Unretained(this)));
}
void TCPDeviceProvider::InitializeHostResolverOnUI(
- network::mojom::HostResolverRequest request) {
+ mojo::PendingReceiver<network::mojom::HostResolver> receiver) {
g_browser_process->system_network_context_manager()
->GetContext()
- ->CreateHostResolver(base::nullopt, std::move(request));
+ ->CreateHostResolver(base::nullopt, std::move(receiver));
}
diff --git a/chromium/chrome/browser/devtools/device/tcp_device_provider.h b/chromium/chrome/browser/devtools/device/tcp_device_provider.h
index 5f1dae62d0b..17dea4f6d02 100644
--- a/chromium/chrome/browser/devtools/device/tcp_device_provider.h
+++ b/chromium/chrome/browser/devtools/device/tcp_device_provider.h
@@ -10,7 +10,10 @@
#include <set>
#include "chrome/browser/devtools/device/android_device_manager.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/host_port_pair.h"
+#include "services/network/public/mojom/host_resolver.mojom.h"
// Instantiate this class only in a test and/or when the DEBUG_DEVTOOLS
// BUILDFLAG is set.
@@ -40,11 +43,12 @@ class TCPDeviceProvider : public AndroidDeviceManager::DeviceProvider {
~TCPDeviceProvider() override;
void InitializeHostResolver();
- void InitializeHostResolverOnUI(network::mojom::HostResolverRequest request);
+ void InitializeHostResolverOnUI(
+ mojo::PendingReceiver<network::mojom::HostResolver> receiver);
HostPortSet targets_;
base::Closure release_callback_;
- network::mojom::HostResolverPtr host_resolver_;
+ mojo::Remote<network::mojom::HostResolver> host_resolver_;
};
#endif // CHROME_BROWSER_DEVTOOLS_DEVICE_TCP_DEVICE_PROVIDER_H_
diff --git a/chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc
index ad76170f21e..c290c153251 100644
--- a/chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc
+++ b/chromium/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -99,6 +99,7 @@
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "services/network/public/cpp/features.h"
+#include "services/network/public/cpp/resource_response.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "ui/compositor/compositor_switches.h"
#include "ui/gl/gl_switches.h"
@@ -762,13 +763,9 @@ IN_PROC_BROWSER_TEST_F(DevToolsBeforeUnloadTest,
// Tests that BeforeUnload event gets called on devtools that are opened
// on another devtools.
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
// TODO(https://crbug.com/1000654): Re-enable this test.
-#define MAYBE_TestDevToolsOnDevTools DISABLED_TestDevToolsOnDevTools
-#else
-#define MAYBE_TestDevToolsOnDevTools TestDevToolsOnDevTools
-#endif
-IN_PROC_BROWSER_TEST_F(DevToolsBeforeUnloadTest, MAYBE_TestDevToolsOnDevTools) {
+IN_PROC_BROWSER_TEST_F(DevToolsBeforeUnloadTest,
+ DISABLED_TestDevToolsOnDevTools) {
ASSERT_TRUE(spawned_test_server()->Start());
LoadTestPage(kDebuggerTestPage);
@@ -831,9 +828,16 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestShowScriptsTab) {
// Tests that scripts tab is populated with inspected scripts even if it
// hadn't been shown by the moment inspected paged refreshed.
// @see http://crbug.com/26312
-IN_PROC_BROWSER_TEST_F(
- DevToolsSanityTest,
- TestScriptsTabIsPopulatedOnInspectedPageRefresh) {
+// This test is flaky on windows and linux asan. See https://crbug.com/1013003
+#if defined(OS_WIN) || defined(OS_MACOSX)
+#define MAYBE_TestScriptsTabIsPopulatedOnInspectedPageRefresh \
+ DISABLED_TestScriptsTabIsPopulatedOnInspectedPageRefresh
+#else
+#define MAYBE_TestScriptsTabIsPopulatedOnInspectedPageRefresh \
+ TestScriptsTabIsPopulatedOnInspectedPageRefresh
+#endif
+IN_PROC_BROWSER_TEST_F(DevToolsSanityTest,
+ MAYBE_TestScriptsTabIsPopulatedOnInspectedPageRefresh) {
RunTest("testScriptsTabIsPopulatedOnInspectedPageRefresh",
kDebuggerTestPage);
}
diff --git a/chromium/chrome/browser/devtools/devtools_ui_bindings.cc b/chromium/chrome/browser/devtools/devtools_ui_bindings.cc
index 1acc82d6f38..b43e8b7f7fc 100644
--- a/chromium/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chromium/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -77,6 +77,7 @@
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
+#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
#include "third_party/blink/public/public_buildflags.h"
#include "ui/base/page_transition_types.h"
@@ -199,9 +200,17 @@ InfoBarService* DefaultBindingsDelegate::GetInfoBarService() {
}
std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
- const net::HttpResponseHeaders* rh) {
+ const net::HttpResponseHeaders* rh,
+ bool success) {
auto response = std::make_unique<base::DictionaryValue>();
- response->SetInteger("statusCode", rh ? rh->response_code() : 200);
+ int responseCode = 200;
+ if (rh) {
+ responseCode = rh->response_code();
+ } else if (!success) {
+ // In case of no headers, assume file:// URL and failed to load
+ responseCode = 404;
+ }
+ response->SetInteger("statusCode", responseCode);
auto headers = std::make_unique<base::DictionaryValue>();
size_t iterator = 0;
@@ -312,7 +321,7 @@ std::string SanitizeFrontendQueryParam(
// Convert boolean flags to true.
if (key == "can_dock" || key == "debugFrontend" || key == "experiments" ||
key == "isSharedWorker" || key == "v8only" || key == "remoteFrontend" ||
- key == "nodeFrontend" || key == "hasOtherClients")
+ key == "nodeFrontend" || key == "hasOtherClients" || key == "uiDevTools")
return "true";
// Pass connection endpoints as is.
@@ -372,28 +381,86 @@ GURL SanitizeFrontendURL(const GURL& url,
return result;
}
+constexpr base::TimeDelta kInitialBackoffDelay =
+ base::TimeDelta::FromMilliseconds(250);
+constexpr base::TimeDelta kMaxBackoffDelay = base::TimeDelta::FromSeconds(10);
+
} // namespace
class DevToolsUIBindings::NetworkResourceLoader
: public network::SimpleURLLoaderStreamConsumer {
public:
- NetworkResourceLoader(int stream_id,
- DevToolsUIBindings* bindings,
- std::unique_ptr<network::SimpleURLLoader> loader,
- network::mojom::URLLoaderFactory* url_loader_factory,
- const DispatchCallback& callback)
+ class URLLoaderFactoryHolder {
+ public:
+ network::mojom::URLLoaderFactory* get() {
+ return ptr_.get() ? ptr_.get() : refptr_.get();
+ }
+ void operator=(std::unique_ptr<network::mojom::URLLoaderFactory>&& ptr) {
+ ptr_ = std::move(ptr);
+ }
+ void operator=(scoped_refptr<network::SharedURLLoaderFactory>&& refptr) {
+ refptr_ = std::move(refptr);
+ }
+
+ private:
+ std::unique_ptr<network::mojom::URLLoaderFactory> ptr_;
+ scoped_refptr<network::SharedURLLoaderFactory> refptr_;
+ };
+
+ static void Create(int stream_id,
+ DevToolsUIBindings* bindings,
+ const network::ResourceRequest& resource_request,
+ const net::NetworkTrafficAnnotationTag& traffic_annotation,
+ URLLoaderFactoryHolder url_loader_factory,
+ const DevToolsUIBindings::DispatchCallback& callback,
+ base::TimeDelta retry_delay = base::TimeDelta()) {
+ auto resource_loader =
+ std::make_unique<DevToolsUIBindings::NetworkResourceLoader>(
+ stream_id, bindings, resource_request, traffic_annotation,
+ std::move(url_loader_factory), callback, retry_delay);
+ bindings->loaders_.insert(std::move(resource_loader));
+ }
+
+ NetworkResourceLoader(
+ int stream_id,
+ DevToolsUIBindings* bindings,
+ const network::ResourceRequest& resource_request,
+ const net::NetworkTrafficAnnotationTag& traffic_annotation,
+ URLLoaderFactoryHolder url_loader_factory,
+ const DispatchCallback& callback,
+ base::TimeDelta delay)
: stream_id_(stream_id),
bindings_(bindings),
- loader_(std::move(loader)),
- callback_(callback) {
+ resource_request_(resource_request),
+ traffic_annotation_(traffic_annotation),
+ loader_(network::SimpleURLLoader::Create(
+ std::make_unique<network::ResourceRequest>(resource_request),
+ traffic_annotation)),
+ url_loader_factory_(std::move(url_loader_factory)),
+ callback_(callback),
+ retry_delay_(delay) {
loader_->SetOnResponseStartedCallback(base::BindOnce(
&NetworkResourceLoader::OnResponseStarted, base::Unretained(this)));
- loader_->DownloadAsStream(url_loader_factory, this);
+ timer_.Start(FROM_HERE, delay,
+ base::BindRepeating(&NetworkResourceLoader::DownloadAsStream,
+ base::Unretained(this)));
}
private:
+ void DownloadAsStream() {
+ loader_->DownloadAsStream(url_loader_factory_.get(), this);
+ }
+
+ base::TimeDelta GetNextExponentialBackoffDelay(const base::TimeDelta& delta) {
+ if (delta.is_zero()) {
+ return kInitialBackoffDelay;
+ } else {
+ return delta * 1.3;
+ }
+ }
+
void OnResponseStarted(const GURL& final_url,
- const network::ResourceResponseHead& response_head) {
+ const network::mojom::URLResponseHead& response_head) {
response_headers_ = response_head.headers;
}
@@ -418,9 +485,21 @@ class DevToolsUIBindings::NetworkResourceLoader
}
void OnComplete(bool success) override {
- auto response = BuildObjectForResponse(response_headers_.get());
- callback_.Run(response.get());
-
+ if (!success && loader_->NetError() == net::ERR_INSUFFICIENT_RESOURCES &&
+ retry_delay_ < kMaxBackoffDelay) {
+ const base::TimeDelta delay =
+ GetNextExponentialBackoffDelay(retry_delay_);
+ LOG(WARNING) << "DevToolsUIBindings::NetworkResourceLoader id = "
+ << stream_id_
+ << " failed with insufficient resources, retrying in "
+ << delay << "." << std::endl;
+ NetworkResourceLoader::Create(
+ stream_id_, bindings_, resource_request_, traffic_annotation_,
+ std::move(url_loader_factory_), callback_, delay);
+ } else {
+ auto response = BuildObjectForResponse(response_headers_.get(), success);
+ callback_.Run(response.get());
+ }
bindings_->loaders_.erase(bindings_->loaders_.find(this));
}
@@ -428,9 +507,14 @@ class DevToolsUIBindings::NetworkResourceLoader
const int stream_id_;
DevToolsUIBindings* const bindings_;
+ const network::ResourceRequest resource_request_;
+ const net::NetworkTrafficAnnotationTag traffic_annotation_;
std::unique_ptr<network::SimpleURLLoader> loader_;
+ URLLoaderFactoryHolder url_loader_factory_;
DispatchCallback callback_;
scoped_refptr<net::HttpResponseHeaders> response_headers_;
+ base::OneShotTimer timer_;
+ base::TimeDelta retry_delay_;
DISALLOW_COPY_AND_ASSIGN(NetworkResourceLoader);
};
@@ -738,22 +822,18 @@ void DevToolsUIBindings::LoadNetworkResource(const DispatchCallback& callback,
}
})");
- auto resource_request = std::make_unique<network::ResourceRequest>();
- resource_request->url = gurl;
+ network::ResourceRequest resource_request;
+ resource_request.url = gurl;
// TODO(caseq): this preserves behavior of URLFetcher-based implementation.
// We really need to pass proper first party origin from the front-end.
- resource_request->site_for_cookies = gurl;
- resource_request->headers.AddHeadersFromString(headers);
+ resource_request.site_for_cookies = gurl;
+ resource_request.headers.AddHeadersFromString(headers);
- 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;
+ NetworkResourceLoader::URLLoaderFactoryHolder url_loader_factory;
if (gurl.SchemeIsFile()) {
- file_url_loader_factory = content::CreateFileURLLoaderFactory(
+ 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)) {
content::WebContents* target_tab;
#ifndef NDEBUG
@@ -769,10 +849,9 @@ void DevToolsUIBindings::LoadNetworkResource(const DispatchCallback& callback,
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(
+ url_loader_factory = content::CreateWebUIURLLoader(
frame_host, target_tab->GetURL().scheme(),
std::move(allowed_webui_hosts));
- url_loader_factory = webui_url_loader_factory.get();
} else {
base::DictionaryValue response;
response.SetInteger("statusCode", 403);
@@ -782,17 +861,12 @@ void DevToolsUIBindings::LoadNetworkResource(const DispatchCallback& callback,
} else {
auto* partition = content::BrowserContext::GetStoragePartitionForSite(
web_contents_->GetBrowserContext(), gurl);
- network_url_loader_factory =
- partition->GetURLLoaderFactoryForBrowserProcess();
- url_loader_factory = network_url_loader_factory.get();
+ url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
}
- auto simple_url_loader = network::SimpleURLLoader::Create(
- std::move(resource_request), traffic_annotation);
- auto resource_loader = std::make_unique<NetworkResourceLoader>(
- stream_id, this, std::move(simple_url_loader), url_loader_factory,
- callback);
- loaders_.insert(std::move(resource_loader));
+ NetworkResourceLoader::Create(stream_id, this, resource_request,
+ traffic_annotation,
+ std::move(url_loader_factory), callback);
}
void DevToolsUIBindings::OpenInNewTab(const std::string& url) {
diff --git a/chromium/chrome/browser/devtools/devtools_window.cc b/chromium/chrome/browser/devtools/devtools_window.cc
index 14bc702c89f..f0e249161a7 100644
--- a/chromium/chrome/browser/devtools/devtools_window.cc
+++ b/chromium/chrome/browser/devtools/devtools_window.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/devtools/devtools_window.h"
#include <algorithm>
+#include <set>
#include <utility>
#include "base/base64.h"
@@ -21,7 +22,6 @@
#include "chrome/browser/devtools/devtools_eye_dropper.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/browser/performance_manager/performance_manager_tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/task_manager/web_contents_tags.h"
@@ -38,6 +38,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/app_modal/javascript_dialog_manager.h"
+#include "components/performance_manager/performance_manager_tab_helper.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/sync_preferences/pref_service_syncable.h"
@@ -170,8 +171,8 @@ content::WebContents* DevToolsToolboxDelegate::OpenURLFromTab(
DCHECK(source == web_contents());
if (!params.url.SchemeIs(content::kChromeDevToolsScheme))
return NULL;
- content::NavigationController::LoadURLParams load_url_params(params.url);
- source->GetController().LoadURLWithParams(load_url_params);
+ source->GetController().LoadURLWithParams(
+ content::NavigationController::LoadURLParams(params));
return source;
}
@@ -218,7 +219,7 @@ GURL DecorateFrontendURL(const GURL& base_url) {
std::string url_string(
frontend_url +
((frontend_url.find("?") == std::string::npos) ? "?" : "&") +
- "dockSide=undocked"); // TODO(dgozman): remove this support in M38.
+ "dockSide=undocked"); // TODO(dgozman): remove this support in M38.
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kEnableDevToolsExperiments))
url_string += "&experiments=true";
@@ -770,6 +771,16 @@ DevToolsWindow::MaybeCreateNavigationThrottle(
return std::make_unique<Throttle>(handle, window);
}
+void DevToolsWindow::UpdateInspectedWebContents(
+ content::WebContents* new_web_contents) {
+ inspected_contents_observer_ =
+ std::make_unique<ObserverWithAccessor>(new_web_contents);
+ bindings_->AttachTo(
+ content::DevToolsAgentHost::GetOrCreateFor(new_web_contents));
+ bindings_->CallClientFunction("DevToolsAPI.reattachMainTarget", nullptr,
+ nullptr, nullptr);
+}
+
void DevToolsWindow::ScheduleShow(const DevToolsToggleAction& action) {
if (life_stage_ == kLoadCompleted) {
Show(action);
@@ -800,7 +811,7 @@ void DevToolsWindow::Show(const DevToolsToggleAction& action) {
&inspected_browser,
&inspected_tab_index);
DCHECK(inspected_browser);
- DCHECK(inspected_tab_index != -1);
+ DCHECK_NE(-1, inspected_tab_index);
RegisterModalDialogManager(inspected_browser);
@@ -821,7 +832,7 @@ void DevToolsWindow::Show(const DevToolsToggleAction& action) {
main_web_contents_->SetInitialFocus();
PrefsTabHelper::CreateForWebContents(main_web_contents_);
- main_web_contents_->GetRenderViewHost()->SyncRendererPrefs();
+ main_web_contents_->SyncRendererPrefs();
DoAction(action);
return;
@@ -1545,7 +1556,7 @@ void DevToolsWindow::CreateDevToolsBrowser() {
browser_->tab_strip_model()->AddWebContents(
std::move(owned_main_web_contents_), -1,
ui::PAGE_TRANSITION_AUTO_TOPLEVEL, TabStripModel::ADD_ACTIVE);
- main_web_contents_->GetRenderViewHost()->SyncRendererPrefs();
+ main_web_contents_->SyncRendererPrefs();
}
BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() {
diff --git a/chromium/chrome/browser/devtools/devtools_window.h b/chromium/chrome/browser/devtools/devtools_window.h
index b47e506fff9..0a14822e2c4 100644
--- a/chromium/chrome/browser/devtools/devtools_window.h
+++ b/chromium/chrome/browser/devtools/devtools_window.h
@@ -5,6 +5,9 @@
#ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_
#define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_
+#include <memory>
+#include <string>
+
#include "base/macros.h"
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
#include "chrome/browser/devtools/devtools_toggle_action.h"
@@ -122,6 +125,11 @@ class DevToolsWindow : public DevToolsUIBindings::Delegate,
static std::unique_ptr<content::NavigationThrottle>
MaybeCreateNavigationThrottle(content::NavigationHandle* handle);
+ // Updates the WebContents inspected by the DevToolsWindow by reattaching
+ // the binding to |new_web_contents|. Called when swapping an outer
+ // WebContents with its inner WebContents.
+ void UpdateInspectedWebContents(content::WebContents* new_web_contents);
+
// Sets closure to be called after load is done. If already loaded, calls
// closure immediately.
void SetLoadCompletedCallback(const base::Closure& closure);
diff --git a/chromium/chrome/browser/devtools/frontend/devtools_discovery_page.html b/chromium/chrome/browser/devtools/frontend/devtools_discovery_page.html
index 88291aa4d80..52880365af5 100644
--- a/chromium/chrome/browser/devtools/frontend/devtools_discovery_page.html
+++ b/chromium/chrome/browser/devtools/frontend/devtools_discovery_page.html
@@ -1,5 +1,5 @@
-<html>
-<head>
+<!doctype html>
+<html lang="en">
<title>Inspectable pages</title>
<meta name="referrer" content="no-referrer">
<style>
@@ -102,6 +102,19 @@ function onReady() {
}
}
+function onBlur(event) {
+ const selection = window.getSelection();
+ selection.removeAllRanges();
+ event.stopPropagation();
+ event.preventDefault();
+}
+
+function onFocus(selectElement, event) {
+ selectNodeText(selectElement, event);
+ event.stopPropagation();
+ event.preventDefault();
+}
+
function customFrontendURL(url) {
if (!url || !window.location.hash)
return null;
@@ -164,6 +177,9 @@ function appendItem(item_object) {
var urlValue = document.createElement('div');
urlValue.classList.add("custom-url-value");
urlValue.textContent = customURL;
+ urlValue.tabIndex = 0;
+ urlValue.addEventListener('blur', onBlur);
+ urlValue.addEventListener('focus', event => onFocus(urlValue, event));
urlContainer.appendChild(urlValue);
description.appendChild(urlContainer);
item_element.addEventListener('click', selectNodeText.bind(null, urlValue));
@@ -189,9 +205,11 @@ function selectNodeText(selectElement, event)
</script>
</head>
<body onload='onLoad()'>
- <div id='caption'>Inspectable pages</div>
- <hr>
- <div id='items'>
+ <div role='main'>
+ <div id='caption' role='heading' aria-level='1'>Inspectable pages</div>
+ <hr>
+ <div id='items'>
+ </div>
</div>
</body>
</html>
diff --git a/chromium/chrome/browser/devtools/inspector_protocol_config.json b/chromium/chrome/browser/devtools/inspector_protocol_config.json
index 53897298398..431eaa6b34a 100644
--- a/chromium/chrome/browser/devtools/inspector_protocol_config.json
+++ b/chromium/chrome/browser/devtools/inspector_protocol_config.json
@@ -28,6 +28,11 @@
},
{
"domain": "WindowManager"
+ },
+ {
+ "domain": "Security",
+ "include": [ "enable", "disable" ],
+ "include_events": [ "visibleSecurityStateChanged" ]
}
]
},
diff --git a/chromium/chrome/browser/devtools/protocol/devtools_protocol_browsertest.cc b/chromium/chrome/browser/devtools/protocol/devtools_protocol_browsertest.cc
new file mode 100644
index 00000000000..cebdc256278
--- /dev/null
+++ b/chromium/chrome/browser/devtools/protocol/devtools_protocol_browsertest.cc
@@ -0,0 +1,336 @@
+// 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 <memory>
+#include <string>
+
+#include "base/base64.h"
+#include "base/callback.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
+#include "base/values.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/browser/devtools_agent_host.h"
+#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/ssl_status.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/test/browser_test_utils.h"
+#include "net/dns/mock_host_resolver.h"
+#include "net/ssl/ssl_cipher_suite_names.h"
+#include "net/ssl/ssl_connection_status_flags.h"
+#include "third_party/boringssl/src/include/openssl/ssl.h"
+
+namespace {
+
+const char kIdParam[] = "id";
+const char kMethodParam[] = "method";
+
+} // namespace
+
+class DevToolsProtocolTest : public InProcessBrowserTest,
+ public content::DevToolsAgentHostClient {
+ public:
+ DevToolsProtocolTest() : last_sent_id_(0) {}
+
+ protected:
+ typedef base::RepeatingCallback<bool(const base::Value&)> NotificationMatcher;
+
+ // InProcessBrowserTest interface
+ void TearDownOnMainThread() override { Detach(); }
+
+ // DevToolsAgentHostClient interface
+ void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
+ const std::string& message) override {
+ auto parsed_message = base::JSONReader::Read(message);
+ auto id = parsed_message->FindIntPath("id");
+ if (id) {
+ // TODO: implement handling of results from method calls (when needed).
+ } else {
+ std::string* notification = parsed_message->FindStringPath("method");
+ EXPECT_TRUE(notification);
+ notifications_.push_back(*notification);
+ base::Value* params = parsed_message->FindPath("params");
+ notification_params_.push_back(params ? params->Clone() : base::Value());
+ if (waiting_for_notification_ == *notification &&
+ (waiting_for_notification_matcher_.is_null() ||
+ waiting_for_notification_matcher_.Run(
+ notification_params_.back()))) {
+ waiting_for_notification_ = std::string();
+ waiting_for_notification_matcher_ = NotificationMatcher();
+ waiting_for_notification_params_ = notification_params_.back().Clone();
+ std::move(run_loop_quit_closure_).Run();
+ }
+ }
+ }
+
+ void SendCommand(const std::string& method) {
+ base::Value command(base::Value::Type::DICTIONARY);
+ command.SetKey(kIdParam, base::Value(++last_sent_id_));
+ command.SetKey(kMethodParam, base::Value(method));
+ std::string json_command;
+ base::JSONWriter::Write(command, &json_command);
+ agent_host_->DispatchProtocolMessage(this, json_command);
+ }
+
+ void RunLoopUpdatingQuitClosure() {
+ base::RunLoop run_loop;
+ CHECK(!run_loop_quit_closure_);
+ run_loop_quit_closure_ = run_loop.QuitClosure();
+ run_loop.Run();
+ }
+
+ void Attach() {
+ agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents());
+ agent_host_->AttachClient(this);
+ }
+
+ void Detach() {
+ if (agent_host_) {
+ agent_host_->DetachClient(this);
+ agent_host_ = nullptr;
+ }
+ }
+
+ content::WebContents* web_contents() {
+ return browser()->tab_strip_model()->GetWebContentsAt(0);
+ }
+
+ base::Value WaitForNotification(const std::string& notification) {
+ auto always_match = base::Bind([](const base::Value&) { return true; });
+ return WaitForMatchingNotification(notification, always_match);
+ }
+
+ base::Value WaitForMatchingNotification(const std::string& notification,
+ const NotificationMatcher& matcher) {
+ for (size_t i = 0; i < notifications_.size(); ++i) {
+ if (notifications_[i] == notification &&
+ matcher.Run(notification_params_[i])) {
+ base::Value result = std::move(notification_params_[i]);
+ notifications_.erase(notifications_.begin() + i);
+ notification_params_.erase(notification_params_.begin() + i);
+ return result;
+ }
+ }
+ waiting_for_notification_ = notification;
+ waiting_for_notification_matcher_ = matcher;
+ RunLoopUpdatingQuitClosure();
+ return std::move(waiting_for_notification_params_);
+ }
+
+ private:
+ // DevToolsAgentHostClient interface
+ void AgentHostClosed(content::DevToolsAgentHost* agent_host) override {}
+
+ scoped_refptr<content::DevToolsAgentHost> agent_host_;
+ int last_sent_id_;
+ base::OnceClosure run_loop_quit_closure_;
+ std::vector<std::string> notifications_;
+ std::vector<base::Value> notification_params_;
+ std::string waiting_for_notification_;
+ NotificationMatcher waiting_for_notification_matcher_;
+ base::Value waiting_for_notification_params_;
+};
+
+IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest,
+ VisibleSecurityStateChangedNeutralState) {
+ ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
+ content::WaitForLoadStop(web_contents());
+
+ Attach();
+ SendCommand("Security.enable");
+ base::Value params =
+ WaitForNotification("Security.visibleSecurityStateChanged");
+
+ std::string* security_state =
+ params.FindStringPath("visibleSecurityState.securityState");
+ ASSERT_TRUE(security_state);
+ ASSERT_EQ(std::string("neutral"), *security_state);
+ ASSERT_FALSE(
+ params.FindPath("visibleSecurityState.certificateSecurityState"));
+ const base::Value* security_state_issue_ids =
+ params.FindListPath("visibleSecurityState.securityStateIssueIds");
+ ASSERT_TRUE(std::find(security_state_issue_ids->GetList().begin(),
+ security_state_issue_ids->GetList().end(),
+ base::Value("scheme-is-not-cryptographic")) !=
+ security_state_issue_ids->GetList().end());
+}
+
+IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VisibleSecurityStateSecureState) {
+ net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+ https_server.ServeFilesFromSourceDirectory(GetChromeTestDataDir());
+ ASSERT_TRUE(https_server.Start());
+
+ ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
+ browser(), https_server.GetURL("/title1.html"), 1);
+ content::NavigationEntry* entry =
+ web_contents()->GetController().GetLastCommittedEntry();
+ ASSERT_TRUE(entry);
+
+ // Extract SSL status data from the navigation entry.
+ scoped_refptr<net::X509Certificate> page_cert = entry->GetSSL().certificate;
+ ASSERT_TRUE(page_cert);
+
+ int ssl_version =
+ net::SSLConnectionStatusToVersion(entry->GetSSL().connection_status);
+ const char* page_protocol;
+ net::SSLVersionToString(&page_protocol, ssl_version);
+
+ const char* page_key_exchange_str;
+ const char* page_cipher;
+ const char* page_mac;
+ bool is_aead;
+ bool is_tls13;
+ uint16_t page_cipher_suite =
+ net::SSLConnectionStatusToCipherSuite(entry->GetSSL().connection_status);
+ net::SSLCipherSuiteToStrings(&page_key_exchange_str, &page_cipher, &page_mac,
+ &is_aead, &is_tls13, page_cipher_suite);
+ std::string page_key_exchange;
+ if (page_key_exchange_str)
+ page_key_exchange = page_key_exchange_str;
+
+ const char* page_key_exchange_group =
+ SSL_get_curve_name(entry->GetSSL().key_exchange_group);
+
+ std::string page_subject_name;
+ std::string page_issuer_name;
+ double page_valid_from = 0.0;
+ double page_valid_to = 0.0;
+ if (entry->GetSSL().certificate) {
+ page_subject_name = entry->GetSSL().certificate->subject().common_name;
+ page_issuer_name = entry->GetSSL().certificate->issuer().common_name;
+ page_valid_from = entry->GetSSL().certificate->valid_start().ToDoubleT();
+ page_valid_to = entry->GetSSL().certificate->valid_expiry().ToDoubleT();
+ }
+
+ bool page_certificate_has_weak_signature =
+ (entry->GetSSL().cert_status & net::CERT_STATUS_WEAK_SIGNATURE_ALGORITHM);
+
+ int status = net::ObsoleteSSLStatus(entry->GetSSL().connection_status,
+ entry->GetSSL().peer_signature_algorithm);
+ bool page_modern_ssl = status == net::OBSOLETE_SSL_NONE;
+ bool page_obsolete_ssl_protocol = status & net::OBSOLETE_SSL_MASK_PROTOCOL;
+ bool page_obsolete_ssl_key_exchange =
+ status & net::OBSOLETE_SSL_MASK_KEY_EXCHANGE;
+ bool page_obsolete_ssl_cipher = status & net::OBSOLETE_SSL_MASK_CIPHER;
+ bool page_obsolete_ssl_signature = status & net::OBSOLETE_SSL_MASK_SIGNATURE;
+
+ Attach();
+ SendCommand("Security.enable");
+ auto has_certificate = [](const base::Value& params) {
+ return params.FindListPath(
+ "visibleSecurityState.certificateSecurityState.certificate") !=
+ nullptr;
+ };
+ base::Value params = WaitForMatchingNotification(
+ "Security.visibleSecurityStateChanged", base::Bind(has_certificate));
+
+ // Verify that the visibleSecurityState payload matches the SSL status data.
+ std::string* security_state =
+ params.FindStringPath("visibleSecurityState.securityState");
+ ASSERT_TRUE(security_state);
+ ASSERT_EQ(std::string("secure"), *security_state);
+
+ base::Value* certificate_security_state =
+ params.FindPath("visibleSecurityState.certificateSecurityState");
+ ASSERT_TRUE(certificate_security_state);
+
+ std::string* protocol =
+ certificate_security_state->FindStringPath("protocol");
+ ASSERT_TRUE(protocol);
+ ASSERT_EQ(*protocol, page_protocol);
+
+ std::string* key_exchange =
+ certificate_security_state->FindStringPath("keyExchange");
+ ASSERT_TRUE(key_exchange);
+ ASSERT_EQ(*key_exchange, page_key_exchange);
+
+ std::string* key_exchange_group =
+ certificate_security_state->FindStringPath("keyExchangeGroup");
+ if (key_exchange_group) {
+ ASSERT_EQ(*key_exchange_group, page_key_exchange_group);
+ }
+
+ std::string* mac = certificate_security_state->FindStringPath("mac");
+ if (mac) {
+ ASSERT_EQ(*mac, page_mac);
+ }
+
+ std::string* cipher = certificate_security_state->FindStringPath("cipher");
+ ASSERT_TRUE(cipher);
+ ASSERT_EQ(*cipher, page_cipher);
+
+ std::string* subject_name =
+ certificate_security_state->FindStringPath("subjectName");
+ ASSERT_TRUE(subject_name);
+ ASSERT_EQ(*subject_name, page_subject_name);
+
+ std::string* issuer = certificate_security_state->FindStringPath("issuer");
+ ASSERT_TRUE(issuer);
+ ASSERT_EQ(*issuer, page_issuer_name);
+
+ auto valid_from = certificate_security_state->FindDoublePath("validFrom");
+ ASSERT_TRUE(valid_from);
+ ASSERT_EQ(*valid_from, page_valid_from);
+
+ auto valid_to = certificate_security_state->FindDoublePath("validTo");
+ ASSERT_TRUE(valid_to);
+ ASSERT_EQ(*valid_to, page_valid_to);
+
+ auto certificate_has_weak_signature =
+ certificate_security_state->FindBoolPath("certifcateHasWeakSignature");
+ ASSERT_TRUE(certificate_has_weak_signature);
+ ASSERT_EQ(*certificate_has_weak_signature,
+ page_certificate_has_weak_signature);
+
+ auto modern_ssl = certificate_security_state->FindBoolPath("modernSSL");
+ ASSERT_TRUE(modern_ssl);
+ ASSERT_EQ(*modern_ssl, page_modern_ssl);
+
+ auto obsolete_ssl_protocol =
+ certificate_security_state->FindBoolPath("obsoleteSslProtocol");
+ ASSERT_TRUE(obsolete_ssl_protocol);
+ ASSERT_EQ(*obsolete_ssl_protocol, page_obsolete_ssl_protocol);
+
+ auto obsolete_ssl_key_exchange =
+ certificate_security_state->FindBoolPath("obsoleteSslKeyExchange");
+ ASSERT_TRUE(obsolete_ssl_key_exchange);
+ ASSERT_EQ(*obsolete_ssl_key_exchange, page_obsolete_ssl_key_exchange);
+
+ auto obsolete_ssl_cipher =
+ certificate_security_state->FindBoolPath("obsoleteSslCipher");
+ ASSERT_TRUE(obsolete_ssl_cipher);
+ ASSERT_EQ(*obsolete_ssl_cipher, page_obsolete_ssl_cipher);
+
+ auto obsolete_ssl_signature =
+ certificate_security_state->FindBoolPath("obsoleteSslSignature");
+ ASSERT_TRUE(obsolete_ssl_signature);
+ ASSERT_EQ(*obsolete_ssl_signature, page_obsolete_ssl_signature);
+
+ const base::Value* certificate_value =
+ certificate_security_state->FindListPath("certificate");
+ std::vector<std::string> der_certs;
+ for (const auto& cert : certificate_value->GetList()) {
+ std::string decoded;
+ ASSERT_TRUE(base::Base64Decode(cert.GetString(), &decoded));
+ der_certs.push_back(decoded);
+ }
+ std::vector<base::StringPiece> cert_string_piece;
+ for (const auto& str : der_certs) {
+ cert_string_piece.push_back(str);
+ }
+
+ // Check that the certificateSecurityState.certificate matches.
+ net::SHA256HashValue page_cert_chain_fingerprint =
+ page_cert->CalculateChainFingerprint256();
+ scoped_refptr<net::X509Certificate> certificate =
+ net::X509Certificate::CreateFromDERCertChain(cert_string_piece);
+ ASSERT_TRUE(certificate);
+ EXPECT_EQ(page_cert_chain_fingerprint,
+ certificate->CalculateChainFingerprint256());
+ const base::Value* security_state_issue_ids =
+ params.FindListPath("visibleSecurityState.securityStateIssueIds");
+ EXPECT_EQ(security_state_issue_ids->GetList().size(), 0u);
+}
diff --git a/chromium/chrome/browser/devtools/protocol/security_handler.cc b/chromium/chrome/browser/devtools/protocol/security_handler.cc
new file mode 100644
index 00000000000..a9db9463a58
--- /dev/null
+++ b/chromium/chrome/browser/devtools/protocol/security_handler.cc
@@ -0,0 +1,246 @@
+// 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/devtools/protocol/security_handler.h"
+
+#include <string>
+#include <vector>
+
+#include "base/base64.h"
+#include "chrome/browser/ssl/security_state_tab_helper.h"
+#include "components/security_state/content/content_utils.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/common/origin_util.h"
+#include "net/cert/x509_certificate.h"
+#include "net/cert/x509_util.h"
+#include "net/ssl/ssl_cipher_suite_names.h"
+#include "net/ssl/ssl_connection_status_flags.h"
+#include "third_party/boringssl/src/include/openssl/ssl.h"
+
+namespace {
+
+const char kInsecureOriginSecurityStateIssueId[] = "insecure-origin";
+const char kSchemeIsNotCryptographicSecurityStateIssueId[] =
+ "scheme-is-not-cryptographic";
+const char kMalicousContentSecurityStateIssueId[] = "malicious-content";
+const char kDisplayedMixedContentSecurityStateIssueId[] =
+ "displayed-mixed-content";
+const char kContainedMixedFormSecurityStateIssueId[] = "contained-mixed-form";
+const char kRanMixedContentSecurityStateIssueId[] = "ran-mixed-content";
+const char kDisplayedContentWithCertErrorsSecurityStateIssueId[] =
+ "displayed-content-with-cert-errors";
+const char kRanContentWithCertErrorSecurityStateIssueId[] =
+ "ran-content-with-cert-error";
+const char kPkpBypassedSecurityStateIssueId[] = "pkp-bypassed";
+const char kIsErrorPageSecurityStateIssueId[] = "is-error-page";
+const char kInsecureInputEventsSecurityStateIssueId[] = "insecure-input-events";
+
+std::string SecurityLevelToProtocolSecurityState(
+ security_state::SecurityLevel security_level) {
+ switch (security_level) {
+ case security_state::NONE:
+ case security_state::WARNING:
+ return protocol::Security::SecurityStateEnum::Neutral;
+ case security_state::SECURE_WITH_POLICY_INSTALLED_CERT:
+ case security_state::EV_SECURE:
+ case security_state::SECURE:
+ return protocol::Security::SecurityStateEnum::Secure;
+ case security_state::DANGEROUS:
+ return protocol::Security::SecurityStateEnum::Insecure;
+ case security_state::SECURITY_LEVEL_COUNT:
+ NOTREACHED();
+ return protocol::Security::SecurityStateEnum::Neutral;
+ }
+
+ NOTREACHED();
+ return protocol::Security::SecurityStateEnum::Neutral;
+}
+
+std::unique_ptr<protocol::Security::CertificateSecurityState>
+CreateCertificateSecurityState(
+ const security_state::VisibleSecurityState& state) {
+ auto certificate = std::make_unique<protocol::Array<protocol::String>>();
+ if (state.certificate) {
+ certificate->emplace_back();
+ base::Base64Encode(net::x509_util::CryptoBufferAsStringPiece(
+ state.certificate->cert_buffer()),
+ &certificate->back());
+ for (const auto& cert : state.certificate->intermediate_buffers()) {
+ certificate->emplace_back();
+ base::Base64Encode(net::x509_util::CryptoBufferAsStringPiece(cert.get()),
+ &certificate->back());
+ }
+ }
+
+ int ssl_version = net::SSLConnectionStatusToVersion(state.connection_status);
+ const char* protocol;
+ net::SSLVersionToString(&protocol, ssl_version);
+
+ const char* key_exchange_str;
+ const char* cipher;
+ const char* mac;
+ bool is_aead;
+ bool is_tls13;
+ uint16_t cipher_suite =
+ net::SSLConnectionStatusToCipherSuite(state.connection_status);
+ net::SSLCipherSuiteToStrings(&key_exchange_str, &cipher, &mac, &is_aead,
+ &is_tls13, cipher_suite);
+ std::string key_exchange;
+ if (key_exchange_str)
+ key_exchange = key_exchange_str;
+
+ const char* key_exchange_group = SSL_get_curve_name(state.key_exchange_group);
+
+ std::string subject_name;
+ std::string issuer_name;
+ double valid_from = 0.0;
+ double valid_to = 0.0;
+ if (state.certificate) {
+ subject_name = state.certificate->subject().common_name;
+ issuer_name = state.certificate->issuer().common_name;
+ valid_from = state.certificate->valid_start().ToDoubleT();
+ valid_to = state.certificate->valid_expiry().ToDoubleT();
+ }
+
+ bool certificate_has_weak_signature =
+ (state.cert_status & net::CERT_STATUS_WEAK_SIGNATURE_ALGORITHM);
+
+ int status = net::ObsoleteSSLStatus(state.connection_status,
+ state.peer_signature_algorithm);
+ bool modern_ssl = status == net::OBSOLETE_SSL_NONE;
+ bool obsolete_ssl_protocol = status & net::OBSOLETE_SSL_MASK_PROTOCOL;
+ bool obsolete_ssl_key_exchange = status & net::OBSOLETE_SSL_MASK_KEY_EXCHANGE;
+ bool obsolete_ssl_cipher = status & net::OBSOLETE_SSL_MASK_CIPHER;
+ bool obsolete_ssl_signature = status & net::OBSOLETE_SSL_MASK_SIGNATURE;
+
+ auto certificate_security_state =
+ protocol::Security::CertificateSecurityState::Create()
+ .SetProtocol(protocol)
+ .SetKeyExchange(key_exchange)
+ .SetCipher(cipher)
+ .SetCertificate(std::move(certificate))
+ .SetSubjectName(subject_name)
+ .SetIssuer(issuer_name)
+ .SetValidFrom(valid_from)
+ .SetValidTo(valid_to)
+ .SetCertifcateHasWeakSignature(certificate_has_weak_signature)
+ .SetModernSSL(modern_ssl)
+ .SetObsoleteSslProtocol(obsolete_ssl_protocol)
+ .SetObsoleteSslKeyExchange(obsolete_ssl_key_exchange)
+ .SetObsoleteSslCipher(obsolete_ssl_cipher)
+ .SetObsoleteSslSignature(obsolete_ssl_signature)
+ .Build();
+
+ if (key_exchange_group)
+ certificate_security_state->SetKeyExchangeGroup(key_exchange_group);
+ if (mac)
+ certificate_security_state->SetMac(mac);
+
+ return certificate_security_state;
+}
+
+std::unique_ptr<protocol::Security::VisibleSecurityState>
+CreateVisibleSecurityState(const security_state::VisibleSecurityState& state,
+ content::WebContents* web_contents) {
+ SecurityStateTabHelper* helper =
+ SecurityStateTabHelper::FromWebContents(web_contents);
+ DCHECK(helper);
+ std::string security_state =
+ SecurityLevelToProtocolSecurityState(helper->GetSecurityLevel());
+
+ bool scheme_is_cryptographic =
+ security_state::IsSchemeCryptographic(state.url);
+ bool malicious_content = state.malicious_content_status !=
+ security_state::MALICIOUS_CONTENT_STATUS_NONE;
+ bool insecure_input_events =
+ state.insecure_input_events.insecure_field_edited;
+
+ bool secure_origin = scheme_is_cryptographic;
+ if (!scheme_is_cryptographic)
+ secure_origin = content::IsOriginSecure(state.url);
+
+ std::vector<std::string> security_state_issue_ids;
+ if (!secure_origin)
+ security_state_issue_ids.push_back(kInsecureOriginSecurityStateIssueId);
+ if (!scheme_is_cryptographic)
+ security_state_issue_ids.push_back(
+ kSchemeIsNotCryptographicSecurityStateIssueId);
+ if (malicious_content)
+ security_state_issue_ids.push_back(kMalicousContentSecurityStateIssueId);
+ if (state.displayed_mixed_content)
+ security_state_issue_ids.push_back(
+ kDisplayedMixedContentSecurityStateIssueId);
+ if (state.contained_mixed_form)
+ security_state_issue_ids.push_back(kContainedMixedFormSecurityStateIssueId);
+ if (state.ran_mixed_content)
+ security_state_issue_ids.push_back(kRanMixedContentSecurityStateIssueId);
+ if (state.displayed_content_with_cert_errors)
+ security_state_issue_ids.push_back(
+ kDisplayedContentWithCertErrorsSecurityStateIssueId);
+ if (state.ran_content_with_cert_errors)
+ security_state_issue_ids.push_back(
+ kRanContentWithCertErrorSecurityStateIssueId);
+ if (state.pkp_bypassed)
+ security_state_issue_ids.push_back(kPkpBypassedSecurityStateIssueId);
+ if (state.is_error_page)
+ security_state_issue_ids.push_back(kIsErrorPageSecurityStateIssueId);
+ if (insecure_input_events)
+ security_state_issue_ids.push_back(
+ kInsecureInputEventsSecurityStateIssueId);
+
+ auto visible_security_state =
+ protocol::Security::VisibleSecurityState::Create()
+ .SetSecurityState(security_state)
+ .SetSecurityStateIssueIds(
+ std::make_unique<protocol::Array<std::string>>(
+ security_state_issue_ids))
+ .Build();
+
+ if (state.connection_status != 0) {
+ auto certificate_security_state = CreateCertificateSecurityState(state);
+ visible_security_state->SetCertificateSecurityState(
+ std::move(certificate_security_state));
+ }
+ return visible_security_state;
+}
+
+} // namespace
+
+SecurityHandler::SecurityHandler(content::WebContents* web_contents,
+ protocol::UberDispatcher* dispatcher)
+ : content::WebContentsObserver(web_contents) {
+ DCHECK(web_contents);
+ frontend_ =
+ std::make_unique<protocol::Security::Frontend>(dispatcher->channel());
+ protocol::Security::Dispatcher::wire(dispatcher, this);
+}
+
+SecurityHandler::~SecurityHandler() {}
+
+protocol::Response SecurityHandler::Enable() {
+ if (enabled_)
+ return protocol::Response::FallThrough();
+ enabled_ = true;
+ DidChangeVisibleSecurityState();
+ // Do not mark the command as handled. Let it fall through instead, so that
+ // the handler in content gets a chance to process the command.
+ return protocol::Response::FallThrough();
+}
+
+protocol::Response SecurityHandler::Disable() {
+ enabled_ = false;
+ // Do not mark the command as handled. Let it fall through instead, so that
+ // the handler in content gets a chance to process the command.
+ return protocol::Response::FallThrough();
+}
+
+void SecurityHandler::DidChangeVisibleSecurityState() {
+ if (!enabled_)
+ return;
+
+ auto state = security_state::GetVisibleSecurityState(web_contents());
+ auto visible_security_state =
+ CreateVisibleSecurityState(*state.get(), web_contents());
+ frontend_->VisibleSecurityStateChanged(std::move(visible_security_state));
+}
diff --git a/chromium/chrome/browser/devtools/protocol/security_handler.h b/chromium/chrome/browser/devtools/protocol/security_handler.h
new file mode 100644
index 00000000000..e4f3c880dac
--- /dev/null
+++ b/chromium/chrome/browser/devtools/protocol/security_handler.h
@@ -0,0 +1,37 @@
+// 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_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_
+#define CHROME_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_
+
+#include "chrome/browser/devtools/protocol/forward.h"
+#include "chrome/browser/devtools/protocol/security.h"
+#include "content/public/browser/web_contents_observer.h"
+
+namespace content {
+class WebContents;
+} // namespace content
+
+class SecurityHandler : public protocol::Security::Backend,
+ public content::WebContentsObserver {
+ public:
+ SecurityHandler(content::WebContents* web_contents,
+ protocol::UberDispatcher* dispatcher);
+ ~SecurityHandler() override;
+
+ // Security::Backend:
+ protocol::Response Enable() override;
+ protocol::Response Disable() override;
+
+ private:
+ // WebContentsObserver overrides
+ void DidChangeVisibleSecurityState() override;
+
+ bool enabled_ = false;
+ std::unique_ptr<protocol::Security::Frontend> frontend_;
+
+ DISALLOW_COPY_AND_ASSIGN(SecurityHandler);
+};
+
+#endif // CHROME_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_
diff --git a/chromium/chrome/browser/devtools/serialize_host_descriptions.cc b/chromium/chrome/browser/devtools/serialize_host_descriptions.cc
index d1bdc912536..054acd9be6b 100644
--- a/chromium/chrome/browser/devtools/serialize_host_descriptions.cc
+++ b/chromium/chrome/browser/devtools/serialize_host_descriptions.cc
@@ -27,8 +27,7 @@ base::DictionaryValue Serialize(
auto child_it = children.find(root);
if (child_it != children.end()) {
for (base::DictionaryValue* child : child_it->second) {
- children_list->base::Value::GetList().push_back(
- Serialize(child_key, child, children));
+ children_list->base::Value::Append(Serialize(child_key, child, children));
}
}
@@ -98,8 +97,7 @@ base::ListValue SerializeHostDescriptions(
base::ListValue list_value;
for (auto* root : roots) {
- list_value.base::Value::GetList().push_back(
- Serialize(child_key, root, children));
+ list_value.base::Value::Append(Serialize(child_key, root, children));
}
return list_value;
}
diff --git a/chromium/chrome/browser/extensions/BUILD.gn b/chromium/chrome/browser/extensions/BUILD.gn
index 000374bc06a..4bb05288acf 100644
--- a/chromium/chrome/browser/extensions/BUILD.gn
+++ b/chromium/chrome/browser/extensions/BUILD.gn
@@ -608,6 +608,8 @@ jumbo_static_library("extensions") {
"external_registry_loader_win.h",
"forced_extensions/installation_reporter.cc",
"forced_extensions/installation_reporter.h",
+ "forced_extensions/installation_reporter_factory.cc",
+ "forced_extensions/installation_reporter_factory.h",
"forced_extensions/installation_tracker.cc",
"forced_extensions/installation_tracker.h",
"global_shortcut_listener.cc",
@@ -661,6 +663,8 @@ jumbo_static_library("extensions") {
"policy_handlers.h",
"proxy_overridden_bubble_delegate.cc",
"proxy_overridden_bubble_delegate.h",
+ "scoped_active_install.cc",
+ "scoped_active_install.h",
"scripting_permissions_modifier.cc",
"scripting_permissions_modifier.h",
"settings_api_bubble_delegate.cc",
@@ -762,6 +766,7 @@ jumbo_static_library("extensions") {
"//components/safe_browsing/db:util",
"//components/signin/core/browser",
"//content/public/browser",
+ "//mojo/public/cpp/bindings",
]
deps = [
"//apps",
@@ -819,6 +824,7 @@ jumbo_static_library("extensions") {
"//components/password_manager/core/browser:affiliation",
"//components/payments/core",
"//components/pdf/browser",
+ "//components/performance_manager",
"//components/policy:generated",
"//components/policy/core/browser",
"//components/pref_registry",
@@ -991,6 +997,7 @@ jumbo_static_library("extensions") {
"//chromeos/system",
"//chromeos/tpm",
"//components/arc",
+ "//components/chromeos_camera:camera_app_helper",
"//components/constrained_window",
"//components/drive",
"//components/user_manager",
diff --git a/chromium/chrome/browser/extensions/api/OWNERS b/chromium/chrome/browser/extensions/api/OWNERS
deleted file mode 100644
index 7eafe922486..00000000000
--- a/chromium/chrome/browser/extensions/api/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# For Chrome OS apps APIs.
-tbarzic@chromium.org
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 2b44f3e0e6f..49b4da3c607 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
@@ -71,6 +71,19 @@ void RemoveDuplicatePhoneNumberAtIndex(
list->Remove(index, nullptr);
}
+autofill::AutofillManager* GetAutofillManager(
+ content::WebContents* web_contents) {
+ if (!web_contents) {
+ return nullptr;
+ }
+ autofill::ContentAutofillDriver* autofill_driver =
+ autofill::ContentAutofillDriverFactory::FromWebContents(web_contents)
+ ->DriverForFrame(web_contents->GetMainFrame());
+ if (!autofill_driver)
+ return nullptr;
+ return autofill_driver->autofill_manager();
+}
+
} // namespace
namespace extensions {
@@ -111,10 +124,6 @@ ExtensionFunction::ResponseAction AutofillPrivateSaveAddressFunction::Run() {
? *existing_profile
: autofill::AutofillProfile(base::GenerateGUID(), kSettingsOrigin);
- // Strings from JavaScript use UTF-8 encoding. This container is used as an
- // intermediate container for functions which require UTF-16 strings.
- std::vector<base::string16> string16Container;
-
if (address->full_names) {
std::string full_name;
if (!address->full_names->empty())
@@ -255,7 +264,7 @@ ExtensionFunction::ResponseAction
for (auto& component : components->GetList()) {
base::Value row(base::Value::Type::DICTIONARY);
row.SetKey("row", std::move(component));
- rows.GetList().emplace_back(std::move(row));
+ rows.Append(std::move(row));
}
address_components.SetKey("components", std::move(rows));
@@ -471,17 +480,13 @@ AutofillPrivateMigrateCreditCardsFunction::Run() {
autofill::PersonalDataManager* personal_data =
autofill::PersonalDataManagerFactory::GetForProfile(
chrome_details_.GetProfile());
- // Get the web contents to get autofill manager.
- content::WebContents* web_contents = GetSenderWebContents();
- if (!personal_data || !personal_data->IsDataLoaded() || !web_contents)
+ if (!personal_data || !personal_data->IsDataLoaded())
return RespondNow(Error(kErrorDataUnavailable));
// Get the AutofillManager from the web contents. AutofillManager has a
// pointer to its AutofillClient which owns FormDataImporter.
autofill::AutofillManager* autofill_manager =
- autofill::ContentAutofillDriverFactory::FromWebContents(web_contents)
- ->DriverForFrame(web_contents->GetMainFrame())
- ->autofill_manager();
+ GetAutofillManager(GetSenderWebContents());
if (!autofill_manager || !autofill_manager->client())
return RespondNow(Error(kErrorDataUnavailable));
@@ -529,4 +534,36 @@ AutofillPrivateLogServerCardLinkClickedFunction::Run() {
return RespondNow(NoArguments());
}
+////////////////////////////////////////////////////////////////////////////////
+// AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction
+
+AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction::
+ AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction()
+ : chrome_details_(this) {}
+
+AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction::
+ ~AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction() {}
+
+ExtensionFunction::ResponseAction
+AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction::Run() {
+ // Getting CreditCardAccessManager from WebContents.
+ autofill::AutofillManager* autofill_manager =
+ GetAutofillManager(GetSenderWebContents());
+ if (!autofill_manager)
+ return RespondNow(Error(kErrorDataUnavailable));
+ autofill::CreditCardAccessManager* credit_card_access_manager =
+ autofill_manager->credit_card_access_manager();
+ if (!credit_card_access_manager)
+ return RespondNow(Error(kErrorDataUnavailable));
+
+ std::unique_ptr<
+ api::autofill_private::SetCreditCardFIDOAuthEnabledState::Params>
+ parameters = api::autofill_private::SetCreditCardFIDOAuthEnabledState::
+ Params::Create(*args_);
+ EXTENSION_FUNCTION_VALIDATE(parameters.get());
+
+ credit_card_access_manager->OnSettingsPageFIDOAuthToggled(
+ parameters->enabled);
+ return RespondNow(NoArguments());
+}
} // namespace extensions
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 5b42cd41d7a..0594f1421d6 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
@@ -208,6 +208,27 @@ class AutofillPrivateLogServerCardLinkClickedFunction
DISALLOW_COPY_AND_ASSIGN(AutofillPrivateLogServerCardLinkClickedFunction);
};
+class AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction
+ : public ExtensionFunction {
+ public:
+ AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction();
+ DECLARE_EXTENSION_FUNCTION(
+ "autofillPrivate.setCreditCardFIDOAuthEnabledState",
+ AUTOFILLPRIVATE_SETCREDITCARDFIDOAUTHENABLEDSTATE)
+
+ protected:
+ ~AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction() override;
+
+ // ExtensionFunction overrides.
+ ResponseAction Run() override;
+
+ private:
+ ChromeExtensionFunctionDetails chrome_details_;
+
+ DISALLOW_COPY_AND_ASSIGN(
+ AutofillPrivateSetCreditCardFIDOAuthEnabledStateFunction);
+};
+
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_AUTOFILL_PRIVATE_AUTOFILL_PRIVATE_API_H_
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 c90d6a5f45a..dc419d22ac6 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,6 @@ void AutofillPrivateEventRouter::Shutdown() {
personal_data_->RemoveObserver(this);
}
-// 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()))
@@ -58,24 +57,20 @@ void AutofillPrivateEventRouter::OnPersonalDataChanged() {
autofill_util::AddressEntryList addressList =
extensions::autofill_util::GenerateAddressList(*personal_data_);
- std::unique_ptr<base::ListValue> args(
- api::autofill_private::OnAddressListChanged::Create(addressList)
- .release());
- std::unique_ptr<Event> extension_event(
- new Event(events::AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED,
- api::autofill_private::OnAddressListChanged::kEventName,
- std::move(args)));
- event_router_->BroadcastEvent(std::move(extension_event));
autofill_util::CreditCardEntryList creditCardList =
extensions::autofill_util::GenerateCreditCardList(*personal_data_);
- args.reset(
- api::autofill_private::OnCreditCardListChanged::Create(creditCardList)
+
+ std::unique_ptr<base::ListValue> args(
+ api::autofill_private::OnPersonalDataChanged::Create(addressList,
+ creditCardList)
.release());
- extension_event.reset(
- new Event(events::AUTOFILL_PRIVATE_ON_CREDIT_CARD_LIST_CHANGED,
- api::autofill_private::OnCreditCardListChanged::kEventName,
+
+ std::unique_ptr<Event> extension_event(
+ new Event(events::AUTOFILL_PRIVATE_ON_PERSONAL_DATA_CHANGED,
+ api::autofill_private::OnPersonalDataChanged::kEventName,
std::move(args)));
+
event_router_->BroadcastEvent(std::move(extension_event));
}
diff --git a/chromium/chrome/browser/extensions/api/automation/automation_apitest.cc b/chromium/chrome/browser/extensions/api/automation/automation_apitest.cc
index bca9fda86c7..fbea761097b 100644
--- a/chromium/chrome/browser/extensions/api/automation/automation_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/automation/automation_apitest.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/chrome_extension_messages.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/prefs/pref_service.h"
@@ -414,6 +413,13 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTestWithLanguageDetection,
<< message_;
}
+IN_PROC_BROWSER_TEST_F(AutomationApiTest, IgnoredNodesNotReturned) {
+ StartEmbeddedTestServer();
+ ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs",
+ "ignored_nodes_not_returned.html"))
+ << message_;
+}
+
#if defined(OS_CHROMEOS)
class AutomationApiTestWithDeviceScaleFactor : public AutomationApiTest {
diff --git a/chromium/chrome/browser/extensions/api/automation_internal/chrome_automation_internal_api_delegate.cc b/chromium/chrome/browser/extensions/api/automation_internal/chrome_automation_internal_api_delegate.cc
index f2333134976..ceb98f41dde 100644
--- a/chromium/chrome/browser/extensions/api/automation_internal/chrome_automation_internal_api_delegate.cc
+++ b/chromium/chrome/browser/extensions/api/automation_internal/chrome_automation_internal_api_delegate.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/common/extensions/chrome_extension_messages.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/api/automation.h"
#include "extensions/common/api/automation_internal.h"
diff --git a/chromium/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc b/chromium/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc
index 97b4ffd67fa..13886741894 100644
--- a/chromium/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc
+++ b/chromium/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc
@@ -39,19 +39,14 @@ class BluetoothLowEnergyApiTestChromeOs : public PlatformAppBrowserTest {
}
void TearDownOnMainThread() override {
- PlatformAppBrowserTest::TearDownOnMainThread();
+ owner_settings_service_.reset();
settings_helper_.RestoreRealDeviceSettingsProvider();
+ PlatformAppBrowserTest::TearDownOnMainThread();
user_manager_enabler_.reset();
fake_user_manager_ = nullptr;
}
protected:
- chromeos::FakeChromeUserManager* fake_user_manager_;
- std::unique_ptr<user_manager::ScopedUserManager> user_manager_enabler_;
-
- chromeos::ScopedCrosSettingsTestHelper settings_helper_;
- std::unique_ptr<chromeos::FakeOwnerSettingsService> owner_settings_service_;
-
void EnterKioskSession() {
fake_user_manager_ = new chromeos::FakeChromeUserManager();
user_manager_enabler_ = std::make_unique<user_manager::ScopedUserManager>(
@@ -72,6 +67,12 @@ class BluetoothLowEnergyApiTestChromeOs : public PlatformAppBrowserTest {
chromeos::KioskAppManager* manager() const {
return chromeos::KioskAppManager::Get();
}
+
+ chromeos::FakeChromeUserManager* fake_user_manager_;
+ std::unique_ptr<user_manager::ScopedUserManager> user_manager_enabler_;
+
+ chromeos::ScopedCrosSettingsTestHelper settings_helper_;
+ std::unique_ptr<chromeos::FakeOwnerSettingsService> owner_settings_service_;
};
IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs,
diff --git a/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc b/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
index 42aa452c796..d0c59bb4cc4 100644
--- a/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
@@ -55,6 +55,7 @@ namespace extensions {
namespace bookmark_keys = bookmark_api_constants;
namespace bookmark_manager_private = api::bookmark_manager_private;
+namespace CanPaste = api::bookmark_manager_private::CanPaste;
namespace Copy = api::bookmark_manager_private::Copy;
namespace Cut = api::bookmark_manager_private::Cut;
namespace Drop = api::bookmark_manager_private::Drop;
@@ -161,6 +162,14 @@ bookmark_manager_private::BookmarkNodeData CreateApiBookmarkNodeData(
return node_data;
}
+bool HasPermanentNodes(const std::vector<const BookmarkNode*>& list) {
+ for (const BookmarkNode* node : list) {
+ if (node->is_permanent_node())
+ return true;
+ }
+ return false;
+}
+
} // namespace
BookmarkManagerPrivateEventRouter::BookmarkManagerPrivateEventRouter(
@@ -315,6 +324,10 @@ bool ClipboardBookmarkManagerFunction::CopyOrCut(bool cut,
error_ = bookmark_keys::kModifyManagedError;
return false;
}
+ if (cut && HasPermanentNodes(nodes)) {
+ error_ = bookmark_keys::kModifySpecialError;
+ return false;
+ }
bookmarks::CopyToClipboard(model, nodes, cut);
return true;
}
@@ -369,6 +382,28 @@ bool BookmarkManagerPrivatePasteFunction::RunOnReady() {
return true;
}
+bool BookmarkManagerPrivateCanPasteFunction::RunOnReady() {
+ std::unique_ptr<CanPaste::Params> params(CanPaste::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params);
+
+ PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile());
+ if (!prefs->GetBoolean(bookmarks::prefs::kEditBookmarksEnabled)) {
+ SetResult(std::make_unique<base::Value>(false));
+ return true;
+ }
+
+ BookmarkModel* model =
+ BookmarkModelFactory::GetForBrowserContext(GetProfile());
+ const BookmarkNode* parent_node = GetNodeFromString(model, params->parent_id);
+ if (!parent_node) {
+ error_ = bookmark_keys::kNoParentError;
+ return false;
+ }
+ bool can_paste = bookmarks::CanPasteFromClipboard(model, parent_node);
+ SetResult(std::make_unique<base::Value>(can_paste));
+ return true;
+}
+
bool BookmarkManagerPrivateSortChildrenFunction::RunOnReady() {
if (!EditBookmarksEnabled())
return false;
diff --git a/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h b/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
index b73ca175c0d..c85dd537d4c 100644
--- a/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
+++ b/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
@@ -173,6 +173,19 @@ class BookmarkManagerPrivatePasteFunction
bool RunOnReady() override;
};
+class BookmarkManagerPrivateCanPasteFunction
+ : public extensions::BookmarksFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION("bookmarkManagerPrivate.canPaste",
+ BOOKMARKMANAGERPRIVATE_CANPASTE)
+
+ protected:
+ ~BookmarkManagerPrivateCanPasteFunction() override {}
+
+ // ExtensionFunction:
+ bool RunOnReady() override;
+};
+
class BookmarkManagerPrivateSortChildrenFunction
: public extensions::BookmarksFunction {
public:
diff --git a/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api_unittest.cc b/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api_unittest.cc
index b5099b06a09..199416715d5 100644
--- a/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api_unittest.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h"
+#include "base/memory/scoped_refptr.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
@@ -33,6 +34,7 @@ class BookmarkManagerPrivateApiUnitTest : public ExtensionServiceTestBase {
node_id_ = base::NumberToString(node->id());
}
+ const bookmarks::BookmarkModel* model() const { return model_; }
std::string node_id() const { return node_id_; }
private:
@@ -47,15 +49,14 @@ class BookmarkManagerPrivateApiUnitTest : public ExtensionServiceTestBase {
// Regression test for https://crbug.com/739260.
TEST_F(BookmarkManagerPrivateApiUnitTest, RunOnDeletedNode) {
// Remove our only bookmark node.
- scoped_refptr<BookmarksRemoveFunction> remove_function(
- new BookmarksRemoveFunction());
+ auto remove_function = base::MakeRefCounted<BookmarksRemoveFunction>();
api_test_utils::RunFunction(remove_function.get(),
base::StringPrintf("[\"%s\"]", node_id().c_str()),
profile());
// Call bookmarkManagerPrivate.copy() with the removed bookmark node's id.
- scoped_refptr<BookmarkManagerPrivateCopyFunction> copy_function(
- new BookmarkManagerPrivateCopyFunction());
+ auto copy_function =
+ base::MakeRefCounted<BookmarkManagerPrivateCopyFunction>();
EXPECT_EQ(
"Could not find bookmark nodes with given ids.",
api_test_utils::RunFunctionAndReturnError(
@@ -63,4 +64,17 @@ TEST_F(BookmarkManagerPrivateApiUnitTest, RunOnDeletedNode) {
base::StringPrintf("[[\"%s\"]]", node_id().c_str()), profile()));
}
+// Tests that calling bookmarkManagerPrivate.cut() to cut a permanent bookmark
+// node into the clipboard gracefully fails.
+// Regression test for https://crbug.com/1021829.
+TEST_F(BookmarkManagerPrivateApiUnitTest, RunCutOnPermanentNode) {
+ auto cut_function = base::MakeRefCounted<BookmarkManagerPrivateCutFunction>();
+ std::string node_id =
+ base::NumberToString(model()->bookmark_bar_node()->id());
+ EXPECT_EQ("Can't modify the root bookmark folders.",
+ api_test_utils::RunFunctionAndReturnError(
+ cut_function.get(),
+ base::StringPrintf("[[\"%s\"]]", node_id.c_str()), profile()));
+}
+
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chromium/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
index 12113c4f5d4..e3cebde37c3 100644
--- a/chromium/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
+++ b/chromium/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
@@ -182,10 +182,9 @@ const BookmarkNode* BookmarksFunction::CreateBookmarkNode(
const BookmarkNode* node;
if (url_string.length()) {
- node = model->AddURLWithCreationTimeAndMetaInfo(
- parent, index, title, url, base::Time::Now(), meta_info);
+ node = model->AddURL(parent, index, title, url, meta_info);
} else {
- node = model->AddFolderWithMetaInfo(parent, index, title, meta_info);
+ node = model->AddFolder(parent, index, title, meta_info);
model->SetDateFolderModified(parent, base::Time::Now());
}
diff --git a/chromium/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc b/chromium/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc
index 09b44ef1f9a..f21ccfe51bc 100644
--- a/chromium/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc
+++ b/chromium/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc
@@ -78,9 +78,7 @@ void BrailleControllerImpl::TryLoadLibBrlApi() {
// These versions of libbrlapi work the same for the functions we
// are using. (0.6.0 adds brlapi_writeWText).
static const char* const kSupportedVersions[] = {
- "libbrlapi.so.0.5",
- "libbrlapi.so.0.6"
- };
+ "libbrlapi.so.0.5", "libbrlapi.so.0.6", "libbrlapi.so.0.7"};
for (size_t i = 0; i < base::size(kSupportedVersions); ++i) {
if (libbrlapi_loader_.Load(kSupportedVersions[i]))
return;
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 b2e4c22d486..04622a3e005 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
@@ -49,12 +49,13 @@ const char kRemoveEverythingArguments[] =
"webSQL": true
}])";
-// Sets the APISID Gaia cookie, which is monitored by the AccountReconcilor.
+// Sets the SAPISID Gaia cookie, which is monitored by the AccountReconcilor.
bool SetGaiaCookieForProfile(Profile* profile) {
- GURL google_url = GaiaUrls::GetInstance()->google_url();
- net::CanonicalCookie cookie("APISID", std::string(), "." + google_url.host(),
+ GURL google_url = GaiaUrls::GetInstance()->secure_google_url();
+ net::CanonicalCookie cookie("SAPISID", std::string(), "." + google_url.host(),
"/", base::Time(), base::Time(), base::Time(),
- false, false, net::CookieSameSite::NO_RESTRICTION,
+ /*secure=*/true, false,
+ net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT);
bool success = false;
@@ -70,10 +71,8 @@ bool SetGaiaCookieForProfile(Profile* profile) {
network::mojom::CookieManager* cookie_manager =
content::BrowserContext::GetDefaultStoragePartition(profile)
->GetCookieManagerForBrowserProcess();
- net::CookieOptions options;
- options.set_include_httponly();
cookie_manager->SetCanonicalCookie(
- cookie, google_url.scheme(), options,
+ cookie, google_url.scheme(), net::CookieOptions::MakeAllInclusive(),
mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(callback), net::CanonicalCookie::CookieInclusionStatus(
net::CanonicalCookie::CookieInclusionStatus::
@@ -106,7 +105,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, Syncing) {
syncer::SyncService* sync_service =
ProfileSyncServiceFactory::GetForProfile(profile);
sync_service->GetUserSettings()->SetSyncRequested(true);
- sync_service->GetUserSettings()->SetFirstSetupComplete();
+ sync_service->GetUserSettings()->SetFirstSetupComplete(
+ syncer::SyncFirstSetupCompleteSource::BASIC_FLOW);
ASSERT_EQ(sync_ui_util::SYNCED, sync_ui_util::GetStatus(profile));
// Clear browsing data.
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 533bdee1e87..4530f54ea05 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
@@ -12,6 +12,8 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "base/macros.h"
+#include "base/values.h"
#include "chrome/browser/chromeos/certificate_provider/certificate_provider_service.h"
#include "chrome/browser/chromeos/certificate_provider/certificate_provider_service_factory.h"
#include "chrome/browser/chromeos/certificate_provider/pin_dialog_manager.h"
@@ -19,6 +21,7 @@
#include "chrome/common/extensions/api/certificate_provider.h"
#include "chrome/common/extensions/api/certificate_provider_internal.h"
#include "chromeos/constants/security_token_pin_types.h"
+#include "extensions/browser/quota_service.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"
@@ -75,9 +78,55 @@ const char kCertificateProviderPreviousDialogActive[] =
"Previous request not finished";
const char kCertificateProviderNoUserInput[] = "No user input received";
+// The BucketMapper implementation for the requestPin API that avoids using the
+// quota when the current request uses the requestId that is strictly greater
+// than all previous ones.
+class RequestPinExceptFirstQuotaBucketMapper final
+ : public QuotaLimitHeuristic::BucketMapper {
+ public:
+ RequestPinExceptFirstQuotaBucketMapper() = default;
+ ~RequestPinExceptFirstQuotaBucketMapper() override = default;
+
+ void GetBucketsForArgs(const base::ListValue* args,
+ QuotaLimitHeuristic::BucketList* buckets) override {
+ if (args->GetList().empty())
+ return;
+ const base::Value& details = args->GetList()[0];
+ if (!details.is_dict())
+ return;
+ const base::Value* sign_request_id =
+ details.FindKeyOfType("signRequestId", base::Value::Type::INTEGER);
+ if (!sign_request_id)
+ return;
+ if (sign_request_id->GetInt() > biggest_request_id_) {
+ // Either it's the first request with the newly issued requestId, or it's
+ // an invalid requestId (bigger than the real one). Return a new bucket in
+ // order to apply no quota for the former case; for the latter case the
+ // quota doesn't matter much, except that we're maybe making it stricter
+ // for future requests (which is bearable).
+ biggest_request_id_ = sign_request_id->GetInt();
+ new_request_bucket_ = std::make_unique<QuotaLimitHeuristic::Bucket>();
+ buckets->push_back(new_request_bucket_.get());
+ return;
+ }
+ // Either it's a repeatitive request for the given requestId, or the
+ // extension reordered the requests. Fall back to the default bucket (shared
+ // between all requests) in that case.
+ buckets->push_back(&default_bucket_);
+ }
+
+ private:
+ int biggest_request_id_ = -1;
+ QuotaLimitHeuristic::Bucket default_bucket_;
+ std::unique_ptr<QuotaLimitHeuristic::Bucket> new_request_bucket_;
+
+ DISALLOW_COPY_AND_ASSIGN(RequestPinExceptFirstQuotaBucketMapper);
+};
+
} // namespace
-const int api::certificate_provider::kMaxClosedDialogsPer10Mins = 2;
+const int api::certificate_provider::kMaxClosedDialogsPerMinute = 10;
+const int api::certificate_provider::kMaxClosedDialogsPer10Minutes = 30;
CertificateProviderInternalReportCertificatesFunction::
~CertificateProviderInternalReportCertificatesFunction() {}
@@ -256,12 +305,25 @@ bool CertificateProviderRequestPinFunction::ShouldSkipQuotaLimiting() const {
}
void CertificateProviderRequestPinFunction::GetQuotaLimitHeuristics(
- extensions::QuotaLimitHeuristics* heuristics) const {
+ QuotaLimitHeuristics* heuristics) const {
+ // Apply a 1-minute and a 10-minute quotas. A special bucket mapper is used in
+ // order to, approximately, skip applying quotas to the first request for each
+ // requestId (such logic cannot be done in ShouldSkipQuotaLimiting(), since
+ // it's not called with the request's parameters). The limitation constants
+ // are decremented below to account the first request.
+
QuotaLimitHeuristic::Config short_limit_config = {
- api::certificate_provider::kMaxClosedDialogsPer10Mins,
+ api::certificate_provider::kMaxClosedDialogsPerMinute - 1,
+ base::TimeDelta::FromMinutes(1)};
+ heuristics->push_back(std::make_unique<QuotaService::TimedLimit>(
+ short_limit_config, new RequestPinExceptFirstQuotaBucketMapper,
+ "MAX_PIN_DIALOGS_CLOSED_PER_MINUTE"));
+
+ QuotaLimitHeuristic::Config long_limit_config = {
+ api::certificate_provider::kMaxClosedDialogsPer10Minutes - 1,
base::TimeDelta::FromMinutes(10)};
heuristics->push_back(std::make_unique<QuotaService::TimedLimit>(
- short_limit_config, new QuotaLimitHeuristic::SingletonBucketMapper(),
+ long_limit_config, new RequestPinExceptFirstQuotaBucketMapper,
"MAX_PIN_DIALOGS_CLOSED_PER_10_MINUTES"));
}
diff --git a/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.h b/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.h
index b61e947336d..623b666b35d 100644
--- a/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.h
+++ b/chromium/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.h
@@ -19,9 +19,10 @@ namespace extensions {
namespace api {
namespace certificate_provider {
-// The maximum number of times per 10 minutes, extension is allowed to show PIN
-// dialog again after user closed the previous one.
-extern const int kMaxClosedDialogsPer10Mins;
+// The maximum number of times in the given interval the extension is allowed to
+// show the PIN dialog again after user closed the previous one.
+extern const int kMaxClosedDialogsPerMinute;
+extern const int kMaxClosedDialogsPer10Minutes;
struct CertificateInfo;
}
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 1611eb4a730..1de2320a536 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
@@ -171,9 +171,9 @@ class CertificateProviderRequestPinTest : public CertificateProviderApiTest {
CertificateProviderApiTest::TearDownOnMainThread();
}
- void AddFakeSignRequest() {
+ void AddFakeSignRequest(int sign_request_id) {
cert_provider_service_->pin_dialog_manager()->AddSignRequestId(
- extension_->id(), kFakeSignRequestId, {});
+ extension_->id(), sign_request_id, {});
}
void NavigateTo(const std::string& test_page_file_name) {
@@ -372,7 +372,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, Basic) {
// User enters the correct PIN.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, ShowPinDialogAccept) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("basic.html");
// Enter the valid PIN.
@@ -382,14 +382,14 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, ShowPinDialogAccept) {
EXPECT_FALSE(GetActivePinDialogView());
}
-// User closes the dialog kMaxClosedDialogsPer10Mins times, and the extension
+// User closes the dialog kMaxClosedDialogsPerMinute times, and the extension
// should be blocked from showing it again.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, ShowPinDialogClose) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("basic.html");
for (int i = 0;
- i < extensions::api::certificate_provider::kMaxClosedDialogsPer10Mins;
+ i < extensions::api::certificate_provider::kMaxClosedDialogsPerMinute;
i++) {
ExtensionTestMessageListener listener("User closed the dialog", false);
GetActivePinDialogWindow()->Close();
@@ -401,7 +401,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, ShowPinDialogClose) {
ASSERT_TRUE(close_listener.WaitUntilSatisfied());
close_listener.Reply("GetLastError");
ExtensionTestMessageListener last_error_listener(
- "This request exceeds the MAX_PIN_DIALOGS_CLOSED_PER_10_MINUTES quota.",
+ "This request exceeds the MAX_PIN_DIALOGS_CLOSED_PER_MINUTE quota.",
false);
ASSERT_TRUE(last_error_listener.WaitUntilSatisfied());
EXPECT_FALSE(GetActivePinDialogView());
@@ -410,7 +410,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, ShowPinDialogClose) {
// User enters a wrong PIN first and a correct PIN on the second try.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
ShowPinDialogWrongPin) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("basic.html");
EnterWrongPinAndWaitForMessage();
@@ -428,7 +428,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
// User enters wrong PIN three times.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
ShowPinDialogWrongPinThreeTimes) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("basic.html");
for (int i = 0; i < kWrongPinAttemptsLimit; i++)
EnterWrongPinAndWaitForMessage();
@@ -446,7 +446,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
// User closes the dialog while the extension is processing the request.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
ShowPinDialogCloseWhileProcessing) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("operated.html");
EXPECT_TRUE(SendCommandAndWaitForMessage("Request", "request1:begun"));
@@ -462,7 +462,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
EXPECT_FALSE(GetActivePinDialogView());
}
-// Extension closes the dialog kMaxClosedDialogsPer10Mins times after the user
+// Extension closes the dialog kMaxClosedDialogsPerMinute times after the user
// inputs some value, and it should be blocked from showing it again.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
RepeatedProgrammaticCloseAfterInput) {
@@ -470,9 +470,9 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
for (int i = 0;
i <
- extensions::api::certificate_provider::kMaxClosedDialogsPer10Mins + 1;
+ extensions::api::certificate_provider::kMaxClosedDialogsPerMinute + 1;
i++) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
EXPECT_TRUE(SendCommandAndWaitForMessage(
"Request", base::StringPrintf("request%d:begun", i + 1)));
@@ -482,20 +482,20 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
EXPECT_FALSE(GetActivePinDialogView());
}
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
EXPECT_TRUE(SendCommandAndWaitForMessage(
"Request",
base::StringPrintf(
"request%d:error:This request exceeds the "
- "MAX_PIN_DIALOGS_CLOSED_PER_10_MINUTES quota.",
- extensions::api::certificate_provider::kMaxClosedDialogsPer10Mins +
+ "MAX_PIN_DIALOGS_CLOSED_PER_MINUTE quota.",
+ extensions::api::certificate_provider::kMaxClosedDialogsPerMinute +
2)));
EXPECT_FALSE(GetActivePinDialogView());
}
// Extension erroneously attempts to close the PIN dialog twice.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, DoubleClose) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("operated.html");
EXPECT_TRUE(SendCommand("Request"));
@@ -505,7 +505,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, DoubleClose) {
EXPECT_FALSE(GetActivePinDialogView());
}
-// Extension closes the dialog kMaxClosedDialogsPer10Mins times before the user
+// Extension closes the dialog kMaxClosedDialogsPerMinute times before the user
// inputs anything, and it should be blocked from showing it again.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
RepeatedProgrammaticCloseBeforeInput) {
@@ -513,22 +513,22 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
for (int i = 0;
i <
- extensions::api::certificate_provider::kMaxClosedDialogsPer10Mins + 1;
+ extensions::api::certificate_provider::kMaxClosedDialogsPerMinute + 1;
i++) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
EXPECT_TRUE(SendCommand("Request"));
EXPECT_TRUE(SendCommandAndWaitForMessage(
"Stop", base::StringPrintf("stop%d:success", i + 1)));
EXPECT_FALSE(GetActivePinDialogView());
}
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
EXPECT_TRUE(SendCommandAndWaitForMessage(
"Request",
base::StringPrintf(
"request%d:error:This request exceeds the "
- "MAX_PIN_DIALOGS_CLOSED_PER_10_MINUTES quota.",
- extensions::api::certificate_provider::kMaxClosedDialogsPer10Mins +
+ "MAX_PIN_DIALOGS_CLOSED_PER_MINUTE quota.",
+ extensions::api::certificate_provider::kMaxClosedDialogsPerMinute +
2)));
EXPECT_FALSE(GetActivePinDialogView());
}
@@ -537,7 +537,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
// the user provided any input.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
StopWithErrorBeforeInput) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("operated.html");
EXPECT_TRUE(SendCommand("Request"));
@@ -557,7 +557,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, InvalidRequestId) {
// Extension specifies zero left attempts in the very first PIN request.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, ZeroAttemptsAtStart) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("operated.html");
EXPECT_TRUE(SendCommandAndWaitForMessage("RequestWithZeroAttempts",
@@ -573,7 +573,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, ZeroAttemptsAtStart) {
// Extension erroneously passes a negative attempts left count.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, NegativeAttempts) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("operated.html");
EXPECT_TRUE(SendCommandAndWaitForMessage(
@@ -583,7 +583,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, NegativeAttempts) {
// Extension erroneously attempts to close a non-existing dialog.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, CloseNonExisting) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("operated.html");
EXPECT_TRUE(SendCommandAndWaitForMessage(
@@ -593,7 +593,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, CloseNonExisting) {
// Extension erroneously attempts to stop a non-existing dialog with an error.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, StopNonExisting) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("operated.html");
EXPECT_TRUE(SendCommandAndWaitForMessage(
@@ -605,7 +605,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, StopNonExisting) {
// user closed the previously stopped with an error PIN request.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
UpdateAlreadyStopped) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("operated.html");
EXPECT_TRUE(SendCommandAndWaitForMessage("Request", "request1:begun"));
@@ -622,7 +622,7 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
// Extension starts a new PIN request after it stopped the previous one with an
// error.
IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, StartAfterStop) {
- AddFakeSignRequest();
+ AddFakeSignRequest(kFakeSignRequestId);
NavigateTo("operated.html");
EXPECT_TRUE(SendCommandAndWaitForMessage("Request", "request1:begun"));
@@ -637,3 +637,28 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest, StartAfterStop) {
EXPECT_TRUE(listener.WaitUntilSatisfied());
EXPECT_FALSE(GetActivePinDialogView()->textfield_for_testing()->GetEnabled());
}
+
+// Test that no quota is applied to the first PIN requests for each requestId.
+IN_PROC_BROWSER_TEST_F(CertificateProviderRequestPinTest,
+ RepeatedCloseWithDifferentIds) {
+ NavigateTo("operated.html");
+
+ for (int i = 0;
+ i <
+ extensions::api::certificate_provider::kMaxClosedDialogsPer10Minutes + 2;
+ i++) {
+ AddFakeSignRequest(kFakeSignRequestId + i);
+ EXPECT_TRUE(SendCommandAndWaitForMessage(
+ "Request", base::StringPrintf("request%d:begun", i + 1)));
+
+ ExtensionTestMessageListener listener(
+ base::StringPrintf("request%d:empty", i + 1), false);
+ ASSERT_TRUE(GetActivePinDialogView());
+ GetActivePinDialogView()->GetWidget()->CloseWithReason(
+ views::Widget::ClosedReason::kCloseButtonClicked);
+ EXPECT_TRUE(listener.WaitUntilSatisfied());
+ EXPECT_FALSE(GetActivePinDialogView());
+
+ EXPECT_TRUE(SendCommand("IncrementRequestId"));
+ }
+}
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 4772d8e3c12..10b8986f9d6 100644
--- a/chromium/chrome/browser/extensions/api/chrome_extensions_api_client.cc
+++ b/chromium/chrome/browser/extensions/api/chrome_extensions_api_client.cc
@@ -39,8 +39,6 @@
#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_service.h"
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
@@ -48,6 +46,8 @@
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "components/pdf/browser/pdf_web_contents_helper.h"
+#include "components/performance_manager/performance_manager_tab_helper.h"
+#include "components/performance_manager/public/performance_manager.h"
#include "components/signin/core/browser/signin_header_helper.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
diff --git a/chromium/chrome/browser/extensions/api/commands/command_service.cc b/chromium/chrome/browser/extensions/api/commands/command_service.cc
index 6f1e04fcaf5..67601761cf7 100644
--- a/chromium/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chromium/chrome/browser/extensions/api/commands/command_service.cc
@@ -27,7 +27,6 @@
#include "content/public/browser/notification_service.h"
#include "extensions/browser/extension_function_registry.h"
#include "extensions/browser/extension_prefs.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/notification_types.h"
#include "extensions/common/feature_switch.h"
@@ -109,8 +108,7 @@ void CommandService::RegisterProfilePrefs(
}
CommandService::CommandService(content::BrowserContext* context)
- : profile_(Profile::FromBrowserContext(context)),
- extension_registry_observer_(this) {
+ : profile_(Profile::FromBrowserContext(context)) {
ExtensionFunctionRegistry::GetInstance()
.RegisterFunction<GetAllCommandsFunction>();
@@ -554,7 +552,6 @@ bool CommandService::CanAutoAssign(const Command &command,
return true;
if (command.global()) {
- using namespace extensions;
if (command.command_name() == manifest_values::kBrowserActionCommandEvent ||
command.command_name() == manifest_values::kPageActionCommandEvent)
return false; // Browser and page actions are not global in nature.
diff --git a/chromium/chrome/browser/extensions/api/commands/command_service.h b/chromium/chrome/browser/extensions/api/commands/command_service.h
index 6f3e1e89a9c..73251ed8ebc 100644
--- a/chromium/chrome/browser/extensions/api/commands/command_service.h
+++ b/chromium/chrome/browser/extensions/api/commands/command_service.h
@@ -12,6 +12,7 @@
#include "base/scoped_observer.h"
#include "chrome/common/extensions/command.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/extension.h"
@@ -30,7 +31,6 @@ class PrefRegistrySyncable;
}
namespace extensions {
-class ExtensionRegistry;
// This service keeps track of preferences related to extension commands
// (assigning initial keybindings on install and removing them on deletion
@@ -263,7 +263,7 @@ class CommandService : public BrowserContextKeyedAPI,
Profile* profile_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
base::ObserverList<Observer>::Unchecked observers_;
diff --git a/chromium/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc b/chromium/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc
index ede8794e010..a2fabc3ef4e 100644
--- a/chromium/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc
@@ -400,17 +400,38 @@ IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest,
"ContentSettings.ExtensionNonEmbeddedSettingSet", 2);
}
-IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest, EmbeddedSettings) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndDisableFeature(features::kPermissionDelegation);
+class ExtensionContentSettingsApiTestWithPermissionDelegationDisabled
+ : public ExtensionContentSettingsApiTest {
+ public:
+ ExtensionContentSettingsApiTestWithPermissionDelegationDisabled() {
+ feature_list_.InitAndDisableFeature(features::kPermissionDelegation);
+ }
+
+ private:
+ base::test::ScopedFeatureList feature_list_;
+};
+
+class ExtensionContentSettingsApiTestWithPermissionDelegationEnabled
+ : public ExtensionContentSettingsApiTest {
+ public:
+ ExtensionContentSettingsApiTestWithPermissionDelegationEnabled() {
+ feature_list_.InitAndEnableFeature(features::kPermissionDelegation);
+ }
+
+ private:
+ base::test::ScopedFeatureList feature_list_;
+};
+
+IN_PROC_BROWSER_TEST_F(
+ ExtensionContentSettingsApiTestWithPermissionDelegationDisabled,
+ EmbeddedSettings) {
const char kExtensionPath[] = "content_settings/embeddedsettings";
EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_;
}
-IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest,
- EmbeddedSettingsPermissionDelegation) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitAndEnableFeature(features::kPermissionDelegation);
+IN_PROC_BROWSER_TEST_F(
+ ExtensionContentSettingsApiTestWithPermissionDelegationEnabled,
+ EmbeddedSettings) {
const char kExtensionPath[] = "content_settings/embeddedsettings";
EXPECT_TRUE(
RunExtensionSubtest(kExtensionPath, "test.html?permission_delegation"))
diff --git a/chromium/chrome/browser/extensions/api/content_settings/content_settings_service.cc b/chromium/chrome/browser/extensions/api/content_settings/content_settings_service.cc
index 47757999355..5ef415d0622 100644
--- a/chromium/chrome/browser/extensions/api/content_settings/content_settings_service.cc
+++ b/chromium/chrome/browser/extensions/api/content_settings/content_settings_service.cc
@@ -6,15 +6,13 @@
#include "base/lazy_instance.h"
#include "base/memory/scoped_refptr.h"
-#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_prefs_scope.h"
#include "extensions/browser/pref_names.h"
namespace extensions {
ContentSettingsService::ContentSettingsService(content::BrowserContext* context)
- : content_settings_store_(base::MakeRefCounted<ContentSettingsStore>()),
- scoped_observer_(this) {}
+ : content_settings_store_(base::MakeRefCounted<ContentSettingsStore>()) {}
ContentSettingsService::~ContentSettingsService() {}
diff --git a/chromium/chrome/browser/extensions/api/content_settings/content_settings_service.h b/chromium/chrome/browser/extensions/api/content_settings/content_settings_service.h
index 4887f5ee2cd..c5a86f87f42 100644
--- a/chromium/chrome/browser/extensions/api/content_settings/content_settings_service.h
+++ b/chromium/chrome/browser/extensions/api/content_settings/content_settings_service.h
@@ -10,12 +10,12 @@
#include "base/scoped_observer.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_store.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_prefs_observer.h"
namespace extensions {
class ContentSettingsStore;
-class ExtensionPrefs;
// This service hosts a single ContentSettingsStore for the
// chrome.contentSettings API.
@@ -59,7 +59,7 @@ class ContentSettingsService : public BrowserContextKeyedAPI,
static const char* service_name() { return "ContentSettingsService"; }
scoped_refptr<ContentSettingsStore> content_settings_store_;
- ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> scoped_observer_;
+ ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> scoped_observer_{this};
DISALLOW_COPY_AND_ASSIGN(ContentSettingsService);
};
diff --git a/chromium/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc b/chromium/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc
index 856b74eb55e..64694816f81 100644
--- a/chromium/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc
@@ -15,9 +15,11 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/extensions/api/context_menus.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "components/version_info/channel.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/context_menu_params.h"
#include "content/public/test/browser_test_utils.h"
+#include "extensions/common/features/feature_channel.h"
#include "extensions/test/result_catcher.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/base/models/menu_model.h"
@@ -131,6 +133,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContextMenus) {
ASSERT_TRUE(RunExtensionTest("context_menus/event_page")) << message_;
}
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ServiceWorkerContextMenus) {
+ // Service Workers are currently available only in Canary or trunk.
+ ScopedCurrentChannel current_channel_override(version_info::Channel::UNKNOWN);
+ ASSERT_TRUE(RunExtensionTestWithFlags("context_menus/event_page",
+ kFlagRunAsServiceWorkerBasedExtension))
+ << message_;
+}
+
// crbug.com/51436 -- creating context menus from multiple script contexts
// should work.
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContextMenusFromMultipleContexts) {
diff --git a/chromium/chrome/browser/extensions/api/context_menus/context_menus_api.cc b/chromium/chrome/browser/extensions/api/context_menus/context_menus_api.cc
index 7dcb4268162..4f86af25919 100644
--- a/chromium/chrome/browser/extensions/api/context_menus/context_menus_api.cc
+++ b/chromium/chrome/browser/extensions/api/context_menus/context_menus_api.cc
@@ -20,8 +20,9 @@ using extensions::ErrorUtils;
namespace {
-const char kIdRequiredError[] = "Extensions using event pages must pass an "
- "id parameter to chrome.contextMenus.create";
+const char kIdRequiredError[] =
+ "Extensions using event pages or Service "
+ "Workers must pass an id parameter to chrome.contextMenus.create";
} // namespace
@@ -37,7 +38,7 @@ ExtensionFunction::ResponseAction ContextMenusCreateFunction::Run() {
if (params->create_properties.id.get()) {
id.string_uid = *params->create_properties.id;
} else {
- if (BackgroundInfo::HasLazyBackgroundPage(extension()))
+ if (context_menus_api_helpers::HasLazyContext(extension()))
return RespondNow(Error(kIdRequiredError));
// The Generated Id is added by context_menus_custom_bindings.js.
diff --git a/chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.cc b/chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.cc
index f1111052bc0..a4f8124fa44 100644
--- a/chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.cc
+++ b/chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.cc
@@ -21,9 +21,11 @@ const char kDuplicateIDError[] =
const char kGeneratedIdKey[] = "generatedId";
const char kLauncherNotAllowedError[] =
"Only packaged apps are allowed to use 'launcher' context";
-const char kOnclickDisallowedError[] = "Extensions using event pages cannot "
- "pass an onclick parameter to chrome.contextMenus.create. Instead, use "
- "the chrome.contextMenus.onClicked event.";
+const char kOnclickDisallowedError[] =
+ "Extensions using event pages or "
+ "Service Workers cannot pass an onclick parameter to "
+ "chrome.contextMenus.create. Instead, use the "
+ "chrome.contextMenus.onClicked event.";
const char kParentsMustBeNormalError[] =
"Parent items must have type \"normal\"";
const char kTitleNeededError[] =
@@ -121,5 +123,10 @@ MenuItem::Type GetType(extensions::api::context_menus::ItemType type,
return extensions::MenuItem::NORMAL;
}
+bool HasLazyContext(const Extension* extension) {
+ return BackgroundInfo::HasLazyBackgroundPage(extension) ||
+ BackgroundInfo::IsServiceWorkerBased(extension);
+}
+
} // namespace context_menus_api_helpers
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h b/chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h
index 7dc82e0fd1a..28335e39113 100644
--- a/chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h
+++ b/chromium/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h
@@ -61,6 +61,8 @@ MenuItem::ContextList GetContexts(const std::vector<
MenuItem::Type GetType(extensions::api::context_menus::ItemType type,
MenuItem::Type default_type);
+bool HasLazyContext(const Extension* extension);
+
// Creates and adds a menu item from |create_properties|.
template <typename PropertyWithEnumT>
bool CreateMenuItem(const PropertyWithEnumT& create_properties,
@@ -77,7 +79,7 @@ bool CreateMenuItem(const PropertyWithEnumT& create_properties,
return false;
}
- if (!is_webview && BackgroundInfo::HasLazyBackgroundPage(extension) &&
+ if (!is_webview && HasLazyContext(extension) &&
create_properties.onclick.get()) {
*error = kOnclickDisallowedError;
return false;
diff --git a/chromium/chrome/browser/extensions/api/cookies/cookies_api.cc b/chromium/chrome/browser/extensions/api/cookies/cookies_api.cc
index aca854a958e..e30f454b5b3 100644
--- a/chromium/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chromium/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -95,9 +95,8 @@ CookiesEventRouter::CookieChangeListener::CookieChangeListener(
CookiesEventRouter::CookieChangeListener::~CookieChangeListener() = default;
void CookiesEventRouter::CookieChangeListener::OnCookieChange(
- const net::CanonicalCookie& canonical_cookie,
- network::mojom::CookieChangeCause cause) {
- router_->OnCookieChange(otr_, canonical_cookie, cause);
+ const net::CookieChangeInfo& change) {
+ router_->OnCookieChange(otr_, change);
}
CookiesEventRouter::CookiesEventRouter(content::BrowserContext* context)
@@ -110,50 +109,48 @@ CookiesEventRouter::~CookiesEventRouter() {
BrowserList::RemoveObserver(this);
}
-void CookiesEventRouter::OnCookieChange(
- bool otr,
- const net::CanonicalCookie& canonical_cookie,
- network::mojom::CookieChangeCause cause) {
+void CookiesEventRouter::OnCookieChange(bool otr,
+ const net::CookieChangeInfo& change) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::unique_ptr<base::ListValue> args(new base::ListValue());
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetBoolean(cookies_api_constants::kRemovedKey,
- cause != network::mojom::CookieChangeCause::INSERTED);
+ change.cause != net::CookieChangeCause::INSERTED);
Profile* profile =
otr ? profile_->GetOffTheRecordProfile() : profile_->GetOriginalProfile();
api::cookies::Cookie cookie = cookies_helpers::CreateCookie(
- canonical_cookie, cookies_helpers::GetStoreIdFromProfile(profile));
+ change.cookie, cookies_helpers::GetStoreIdFromProfile(profile));
dict->Set(cookies_api_constants::kCookieKey, cookie.ToValue());
// Map the internal cause to an external string.
std::string cause_dict_entry;
- switch (cause) {
+ switch (change.cause) {
// Report an inserted cookie as an "explicit" change cause. All other causes
// only make sense for deletions.
- case network::mojom::CookieChangeCause::INSERTED:
- case network::mojom::CookieChangeCause::EXPLICIT:
+ case net::CookieChangeCause::INSERTED:
+ case net::CookieChangeCause::EXPLICIT:
cause_dict_entry = cookies_api_constants::kExplicitChangeCause;
break;
- case network::mojom::CookieChangeCause::OVERWRITE:
+ case net::CookieChangeCause::OVERWRITE:
cause_dict_entry = cookies_api_constants::kOverwriteChangeCause;
break;
- case network::mojom::CookieChangeCause::EXPIRED:
+ case net::CookieChangeCause::EXPIRED:
cause_dict_entry = cookies_api_constants::kExpiredChangeCause;
break;
- case network::mojom::CookieChangeCause::EVICTED:
+ case net::CookieChangeCause::EVICTED:
cause_dict_entry = cookies_api_constants::kEvictedChangeCause;
break;
- case network::mojom::CookieChangeCause::EXPIRED_OVERWRITE:
+ case net::CookieChangeCause::EXPIRED_OVERWRITE:
cause_dict_entry = cookies_api_constants::kExpiredOverwriteChangeCause;
break;
- case network::mojom::CookieChangeCause::UNKNOWN_DELETION:
+ case net::CookieChangeCause::UNKNOWN_DELETION:
NOTREACHED();
}
dict->SetString(cookies_api_constants::kCauseKey, cause_dict_entry);
@@ -162,7 +159,7 @@ void CookiesEventRouter::OnCookieChange(
DispatchEvent(profile, events::COOKIES_ON_CHANGED,
api::cookies::OnChanged::kEventName, std::move(args),
- cookies_helpers::GetURLFromCanonicalCookie(canonical_cookie));
+ cookies_helpers::GetURLFromCanonicalCookie(change.cookie));
}
void CookiesEventRouter::OnBrowserAdded(Browser* browser) {
diff --git a/chromium/chrome/browser/extensions/api/cookies/cookies_api.h b/chromium/chrome/browser/extensions/api/cookies/cookies_api.h
index ac95fc35736..0761d5333fb 100644
--- a/chromium/chrome/browser/extensions/api/cookies/cookies_api.h
+++ b/chromium/chrome/browser/extensions/api/cookies/cookies_api.h
@@ -22,6 +22,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/cookies/canonical_cookie.h"
+#include "net/cookies/cookie_change_dispatcher.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
#include "url/gurl.h"
@@ -49,8 +50,7 @@ class CookiesEventRouter : public BrowserListObserver {
~CookieChangeListener() override;
// network::mojom::CookieChangeListener:
- void OnCookieChange(const net::CanonicalCookie& canonical_cookie,
- network::mojom::CookieChangeCause cause) override;
+ void OnCookieChange(const net::CookieChangeInfo& change) override;
private:
CookiesEventRouter* router_;
@@ -65,9 +65,7 @@ class CookiesEventRouter : public BrowserListObserver {
Profile* profile);
void OnConnectionError(
mojo::Receiver<network::mojom::CookieChangeListener>* receiver);
- void OnCookieChange(bool otr,
- const net::CanonicalCookie& canonical_cookie,
- network::mojom::CookieChangeCause cause);
+ void OnCookieChange(bool otr, const net::CookieChangeInfo& change);
// This method dispatches events to the extension message service.
void DispatchEvent(content::BrowserContext* context,
diff --git a/chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc b/chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc
index f4dfc24b93c..386592c8654 100644
--- a/chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc
+++ b/chromium/chrome/browser/extensions/api/cookies/cookies_helpers.cc
@@ -103,7 +103,6 @@ Cookie CreateCookie(const net::CanonicalCookie& canonical_cookie,
cookie.secure = canonical_cookie.IsSecure();
cookie.http_only = canonical_cookie.IsHttpOnly();
- DCHECK(net::IsValidSameSiteValue(canonical_cookie.SameSite()));
switch (canonical_cookie.SameSite()) {
case net::CookieSameSite::NO_RESTRICTION:
cookie.same_site = api::cookies::SAME_SITE_STATUS_NO_RESTRICTION;
@@ -118,8 +117,6 @@ Cookie CreateCookie(const net::CanonicalCookie& canonical_cookie,
case net::CookieSameSite::UNSPECIFIED:
cookie.same_site = api::cookies::SAME_SITE_STATUS_UNSPECIFIED;
break;
- default:
- NOTREACHED();
}
cookie.session = !canonical_cookie.IsPersistent();
diff --git a/chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc b/chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
index da020fe3416..0a4dc66eb5e 100644
--- a/chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
@@ -25,6 +25,10 @@
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "url/origin.h"
+#if defined(OS_WIN)
+#include "device/fido/win/webauthn_api.h"
+#endif // defined(OS_WIN)
+
namespace {
// U2FAttestationPromptResult enumerates events related to attestation prompts.
@@ -209,6 +213,23 @@ CryptotokenPrivateCanAppIdGetAttestationFunction::Run() {
return RespondNow(OneArgument(std::make_unique<base::Value>(true)));
}
+#if defined(OS_WIN)
+ // If the request was handled by the Windows WebAuthn API on a version of
+ // Windows that shows an attestation permission prompt, don't show another
+ // one.
+ //
+ // Note that this does not account for the possibility of the
+ // WinWebAuthnApi having been disabled by a FidoDiscoveryFactory override,
+ // which may be done in tests or via the Virtual Authenticator WebDriver
+ // API.
+ if (base::FeatureList::IsEnabled(device::kWebAuthUseNativeWinApi) &&
+ device::WinWebAuthnApi::GetDefault()->IsAvailable() &&
+ device::WinWebAuthnApi::GetDefault()->Version() >=
+ WEBAUTHN_API_VERSION_2) {
+ return RespondNow(OneArgument(std::make_unique<base::Value>(true)));
+ }
+#endif // defined(OS_WIN)
+
// Otherwise, show a permission prompt and pass the user's decision back.
const GURL app_id_url(app_id);
EXTENSION_FUNCTION_VALIDATE(app_id_url.is_valid());
diff --git a/chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc b/chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc
index 4ed224a3259..092a999f02e 100644
--- a/chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc
@@ -23,14 +23,10 @@
#include "extensions/browser/extension_function_dispatcher.h"
#include "testing/gtest/include/gtest/gtest.h"
-using crypto::SHA256HashString;
-
namespace extensions {
namespace {
-using namespace api::cryptotoken_private;
-
bool GetSingleBooleanResult(ExtensionFunction* function, bool* result) {
const base::ListValue* result_list = function->GetResultList();
if (!result_list) {
@@ -83,8 +79,8 @@ class CryptoTokenPrivateApiTest : public extensions::ExtensionApiUnittest {
function->set_has_callback(true);
auto args = std::make_unique<base::Value>(base::Value::Type::LIST);
- args->GetList().emplace_back(
- base::Value::BlobStorage(app_id.begin(), app_id.end()));
+ args->Append(
+ base::Value(base::Value::BlobStorage(app_id.begin(), app_id.end())));
if (!extension_function_test_utils::RunFunction(
function.get(), base::ListValue::From(std::move(args)), browser(),
@@ -133,9 +129,9 @@ TEST_F(CryptoTokenPrivateApiTest, CanOriginAssertAppId) {
TEST_F(CryptoTokenPrivateApiTest, IsAppIdHashInEnterpriseContext) {
const std::string example_com("https://example.com/");
- const std::string example_com_hash(SHA256HashString(example_com));
- const std::string rp_id_hash(SHA256HashString("example.com"));
- const std::string foo_com_hash(SHA256HashString("https://foo.com/"));
+ const std::string example_com_hash(crypto::SHA256HashString(example_com));
+ const std::string rp_id_hash(crypto::SHA256HashString("example.com"));
+ const std::string foo_com_hash(crypto::SHA256HashString("https://foo.com/"));
bool result;
ASSERT_TRUE(GetAppIdHashInEnterpriseContext(example_com_hash, &result));
@@ -210,7 +206,7 @@ class CryptoTokenPermissionTest : public ExtensionApiUnittest {
dict.emplace("tabId", std::make_unique<base::Value>(tab_id_));
dict.emplace("origin", std::make_unique<base::Value>(app_id));
auto args = std::make_unique<base::Value>(base::Value::Type::LIST);
- args->GetList().emplace_back(std::move(dict));
+ args->Append(base::Value(std::move(dict)));
auto args_list = base::ListValue::From(std::move(args));
extension_function_test_utils::RunFunction(
diff --git a/chromium/chrome/browser/extensions/api/debugger/debugger_api.cc b/chromium/chrome/browser/extensions/api/debugger/debugger_api.cc
index 6c79f07702a..9e2cb329d88 100644
--- a/chromium/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chromium/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -180,7 +180,7 @@ class ExtensionDevToolsClientHost : public content::DevToolsAgentHostClient,
// Listen to extension unloaded notification.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsClientHost);
};
@@ -195,8 +195,7 @@ ExtensionDevToolsClientHost::ExtensionDevToolsClientHost(
extension_(std::move(extension)),
last_request_id_(0),
infobar_(nullptr),
- detach_reason_(api::debugger::DETACH_REASON_TARGET_CLOSED),
- extension_registry_observer_(this) {
+ detach_reason_(api::debugger::DETACH_REASON_TARGET_CLOSED) {
CopyDebuggee(&debuggee_, debuggee);
g_attached_client_hosts.Get().insert(this);
diff --git a/chromium/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc b/chromium/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc
index 6d91223e12d..997fed5c4e1 100644
--- a/chromium/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc
@@ -255,7 +255,7 @@ TEST_F(RulesRegistryWithCacheTest, DeclarativeRulesStored) {
// 2. Test writing behavior.
{
base::Value value(base::Value::Type::LIST);
- value.GetList().push_back(base::Value(true));
+ value.Append(base::Value(true));
cache_delegate->UpdateRules(extension1_->id(), std::move(value));
}
EXPECT_TRUE(cache_delegate->GetDeclarativeRulesStored(extension1_->id()));
@@ -302,7 +302,7 @@ TEST_F(RulesRegistryWithCacheTest, EphemeralCacheIsEphemeral) {
auto cache_delegate = std::make_unique<RulesCacheDelegate>(
RulesCacheDelegate::Type::kEphemeral, false);
base::Value value(base::Value::Type::LIST);
- value.GetList().push_back(base::Value(true));
+ value.Append(base::Value(true));
cache_delegate->UpdateRules(extension1_->id(), std::move(value));
content::RunAllTasksUntilIdle();
TestingValueStore* store = env_.GetExtensionSystem()->value_store();
diff --git a/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc b/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
index c75ebb8b91f..778095d72b1 100644
--- a/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
@@ -967,16 +967,10 @@ IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest,
}
// https://crbug.com/517492
-#if defined(OS_WIN)
// Fails on XP: http://crbug.com/515717
-#define MAYBE_RemoveAllRulesAfterExtensionUninstall \
- DISABLED_RemoveAllRulesAfterExtensionUninstall
-#else
-#define MAYBE_RemoveAllRulesAfterExtensionUninstall \
- RemoveAllRulesAfterExtensionUninstall
-#endif
+// Fails on other platfomrs: http://crbug.com/1013457
IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest,
- MAYBE_RemoveAllRulesAfterExtensionUninstall) {
+ DISABLED_RemoveAllRulesAfterExtensionUninstall) {
ext_dir_.WriteManifest(kDeclarativeContentManifest);
ext_dir_.WriteFile(FILE_PATH_LITERAL("background.js"), kBackgroundHelpers);
@@ -1015,7 +1009,6 @@ IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest,
ExecuteScriptInBackgroundPage(extension->id(), kRemoveTestRule1));
}
-
// TODO(wittman): Once ChromeContentRulesRegistry operates on condition and
// action interfaces, add a test that checks that a navigation always evaluates
// consistent URL state for all conditions. i.e.: if condition1 evaluates to
diff --git a/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc b/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc
index 5d8e60d10c6..a63a5d95fc3 100644
--- a/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc
+++ b/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc
@@ -10,7 +10,6 @@
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
-#include "components/bookmarks/browser/bookmark_model.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/api/declarative/declarative_constants.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -147,11 +146,10 @@ WebContentsDestroyed() {
//
DeclarativeContentIsBookmarkedConditionTracker::
-DeclarativeContentIsBookmarkedConditionTracker(content::BrowserContext* context,
- Delegate* delegate)
- : delegate_(delegate),
- extensive_bookmark_changes_in_progress_(0),
- scoped_bookmarks_observer_(this) {
+ DeclarativeContentIsBookmarkedConditionTracker(
+ content::BrowserContext* context,
+ Delegate* delegate)
+ : delegate_(delegate), extensive_bookmark_changes_in_progress_(0) {
bookmarks::BookmarkModel* bookmark_model =
BookmarkModelFactory::GetForBrowserContext(context);
// Can be null during unit test execution.
diff --git a/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h b/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h
index 7cbc0b2fa56..76b38a7ad9d 100644
--- a/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h
+++ b/chromium/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h
@@ -14,6 +14,7 @@
#include "base/scoped_observer.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
#include "components/bookmarks/browser/base_bookmark_model_observer.h"
+#include "components/bookmarks/browser/bookmark_model.h"
#include "content/public/browser/web_contents_observer.h"
#include "extensions/common/extension.h"
@@ -158,7 +159,7 @@ class DeclarativeContentIsBookmarkedConditionTracker
int extensive_bookmark_changes_in_progress_;
ScopedObserver<bookmarks::BookmarkModel, bookmarks::BookmarkModelObserver>
- scoped_bookmarks_observer_;
+ scoped_bookmarks_observer_{this};
DISALLOW_COPY_AND_ASSIGN(DeclarativeContentIsBookmarkedConditionTracker);
};
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 e704227958c..7ebbb0567b3 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
@@ -2798,6 +2798,110 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
EXPECT_EQ(first_tab_badge_text, action->GetDisplayBadgeText(first_tab_id));
}
+// Ensure web request events are still dispatched even if DNR blocks/redirects
+// the request. (Regression test for crbug.com/999744).
+IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest, WebRequestEvents) {
+ // Load the extension with a background script so scripts can be run from its
+ // generated background page.
+ set_has_background_script(true);
+
+ TestRule rule = CreateGenericRule();
+ rule.condition->url_filter = "||example.com";
+ rule.condition->resource_types = std::vector<std::string>({"main_frame"});
+ ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules(
+ {rule}, "test_extension", {URLPattern::kAllUrlsPattern}));
+
+ GURL url = embedded_test_server()->GetURL("example.com",
+ "/pages_with_script/index.html");
+
+ // Set up web request listeners listening to request to |url|.
+ const char kWebRequestListenerScript[] = R"(
+ let filter = {'urls' : ['%s'], 'types' : ['main_frame']};
+
+ let onBeforeRequestSeen = false;
+ chrome.webRequest.onBeforeRequest.addListener(() => {
+ onBeforeRequestSeen = true;
+ }, filter);
+
+ // The request will fail since it will be blocked by DNR.
+ chrome.webRequest.onErrorOccurred.addListener(() => {
+ if (onBeforeRequestSeen)
+ chrome.test.sendMessage('PASS');
+ }, filter);
+
+ chrome.test.sendMessage('INSTALLED');
+ )";
+
+ ExtensionTestMessageListener pass_listener("PASS", false /* will_reply */);
+ ExtensionTestMessageListener installed_listener("INSTALLED",
+ false /* will_reply */);
+ ExecuteScriptInBackgroundPageNoWait(
+ last_loaded_extension_id(),
+ base::StringPrintf(kWebRequestListenerScript, url.spec().c_str()));
+
+ // Wait for the web request listeners to be installed before navigating.
+ ASSERT_TRUE(installed_listener.WaitUntilSatisfied());
+
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ ASSERT_FALSE(WasFrameWithScriptLoaded(GetMainFrame()));
+ EXPECT_TRUE(pass_listener.WaitUntilSatisfied());
+}
+
+// Ensure Declarative Net Request gets priority over the web request API.
+IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest, WebRequestPriority) {
+ // Load the extension with a background script so scripts can be run from its
+ // generated background page.
+ set_has_background_script(true);
+
+ GURL url = embedded_test_server()->GetURL("example.com",
+ "/pages_with_script/index.html");
+ GURL redirect_url = embedded_test_server()->GetURL(
+ "redirect.com", "/pages_with_script/index.html");
+
+ TestRule example_com_redirect_rule = CreateGenericRule();
+ example_com_redirect_rule.condition->url_filter = "||example.com";
+ example_com_redirect_rule.condition->resource_types =
+ std::vector<std::string>({"main_frame"});
+ example_com_redirect_rule.action->type = std::string("redirect");
+ example_com_redirect_rule.action->redirect.emplace();
+ example_com_redirect_rule.action->redirect->url = redirect_url.spec();
+ example_com_redirect_rule.priority = kMinValidPriority;
+
+ ASSERT_NO_FATAL_FAILURE(
+ LoadExtensionWithRules({example_com_redirect_rule}, "test_extension",
+ {URLPattern::kAllUrlsPattern}));
+
+ // Set up a web request listener to block the request to example.com.
+ const char kWebRequestBlockScript[] = R"(
+ let filter = {'urls' : ['%s'], 'types' : ['main_frame']};
+ chrome.webRequest.onBeforeRequest.addListener((details) => {
+ chrome.test.sendMessage('SEEN')
+ }, filter, ['blocking']);
+ chrome.test.sendMessage('INSTALLED');
+ )";
+
+ ExtensionTestMessageListener seen_listener("SEEN", false /* will_reply */);
+ ExtensionTestMessageListener installed_listener("INSTALLED",
+ false /* will_reply */);
+ ExecuteScriptInBackgroundPageNoWait(
+ last_loaded_extension_id(),
+ base::StringPrintf(kWebRequestBlockScript, url.spec().c_str()));
+
+ // Wait for the web request listeners to be installed before navigating.
+ ASSERT_TRUE(installed_listener.WaitUntilSatisfied());
+
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ // Ensure the response from the web request listener was ignored and the
+ // request was redirected.
+ ASSERT_TRUE(WasFrameWithScriptLoaded(GetMainFrame()));
+ EXPECT_EQ(web_contents()->GetLastCommittedURL(), redirect_url);
+
+ // Ensure onBeforeRequest is seen by the web request extension.
+ EXPECT_TRUE(seen_listener.WaitUntilSatisfied());
+}
+
// Test that the extension cannot retrieve the number of actions matched
// from the badge text by calling chrome.browserAction.getBadgeText.
IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
@@ -3046,6 +3150,116 @@ IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
}
}
+// Test that the badge text for extensions will update correctly for
+// removeHeader rules.
+IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest,
+ RemoveHeadersBadgeText) {
+ auto referer_url = embedded_test_server()->GetURL(
+ "example.com", "/set-header?referer: none");
+ auto set_cookie_url =
+ embedded_test_server()->GetURL("example.com", "/set-cookie?a=b");
+
+ // Navigates frame with name |frame_name| to |url|.
+ auto navigate_frame = [this](const std::string& frame_name, const GURL& url,
+ bool use_frame_referrer) {
+ content::TestNavigationObserver navigation_observer(
+ web_contents(), 1 /*number_of_navigations*/);
+
+ const char* referrer_policy = use_frame_referrer ? "origin" : "no-referrer";
+
+ ASSERT_TRUE(content::ExecuteScript(
+ GetMainFrame(),
+ base::StringPrintf(R"(
+ document.getElementsByName('%s')[0].referrerPolicy = '%s';
+ document.getElementsByName('%s')[0].src = '%s';)",
+ frame_name.c_str(), referrer_policy,
+ frame_name.c_str(), url.spec().c_str())));
+ navigation_observer.Wait();
+ };
+
+ const std::string kFrameName1 = "frame1";
+ const GURL page_url = embedded_test_server()->GetURL(
+ "nomatch.com", "/page_with_two_frames.html");
+
+ // Create an extension with a rule to remove the Set-Cookie header, and get
+ // the ExtensionAction for it.
+ TestRule rule1 = CreateGenericRule();
+ rule1.id = kMinValidID;
+ rule1.condition->url_filter = "example.com";
+ rule1.condition->resource_types = std::vector<std::string>({"sub_frame"});
+ rule1.action->type = "removeHeaders";
+ rule1.action->remove_headers_list = std::vector<std::string>({"setCookie"});
+
+ ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules({rule1}, "extension_1", {}));
+
+ const ExtensionId remove_set_cookie_ext_id = last_loaded_extension_id();
+ ExtensionPrefs::Get(profile())->SetDNRUseActionCountAsBadgeText(
+ remove_set_cookie_ext_id, true);
+
+ ExtensionAction* remove_set_cookie_action =
+ ExtensionActionManager::Get(web_contents()->GetBrowserContext())
+ ->GetExtensionAction(*extension_registry()->GetExtensionById(
+ remove_set_cookie_ext_id,
+ extensions::ExtensionRegistry::ENABLED));
+
+ // Create an extension with a rule to remove the referer header, and get the
+ // ExtensionAction for it.
+ TestRule rule2 = CreateGenericRule();
+ rule2.id = kMinValidID;
+ rule2.condition->url_filter = "example.com";
+ rule2.condition->resource_types = std::vector<std::string>({"sub_frame"});
+ rule2.action->type = "removeHeaders";
+ rule2.action->remove_headers_list = std::vector<std::string>({"referer"});
+
+ ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules({rule2}, "extension_2", {}));
+
+ const ExtensionId remove_referer_ext_id = last_loaded_extension_id();
+ ExtensionPrefs::Get(profile())->SetDNRUseActionCountAsBadgeText(
+ remove_referer_ext_id, true);
+
+ ExtensionAction* remove_referer_action =
+ ExtensionActionManager::Get(web_contents()->GetBrowserContext())
+ ->GetExtensionAction(*extension_registry()->GetExtensionById(
+ remove_referer_ext_id, extensions::ExtensionRegistry::ENABLED));
+
+ struct {
+ GURL url;
+ bool use_referrer;
+ std::string expected_remove_referer_badge_text;
+ std::string expected_remove_set_cookie_badge_text;
+ } test_cases[] = {
+ // This request only has a Set-Cookie header. Only the badge text for the
+ // extension with a remove Set-Cookie header rule should be incremented.
+ {set_cookie_url, false, "0", "1"},
+ // This request only has a Referer header. Only the badge text for the
+ // extension with a remove Referer header rule should be incremented.
+ {referer_url, true, "1", "1"},
+ // This request has both a Referer and a Set-Cookie header. The badge text
+ // for both extensions should be incremented.
+ {set_cookie_url, true, "2", "2"},
+ };
+
+ ui_test_utils::NavigateToURL(browser(), page_url);
+ ASSERT_TRUE(WasFrameWithScriptLoaded(GetMainFrame()));
+
+ int first_tab_id = ExtensionTabUtil::GetTabId(web_contents());
+ EXPECT_EQ("0", remove_set_cookie_action->GetDisplayBadgeText(first_tab_id));
+ EXPECT_EQ("0", remove_referer_action->GetDisplayBadgeText(first_tab_id));
+
+ for (const auto& test_case : test_cases) {
+ SCOPED_TRACE(base::StringPrintf("Testing URL: %s, using referrer: %s",
+ test_case.url.spec().c_str(),
+ test_case.use_referrer ? "true" : "false"));
+
+ navigate_frame(kFrameName1, test_case.url, test_case.use_referrer);
+ EXPECT_EQ(test_case.expected_remove_set_cookie_badge_text,
+ remove_set_cookie_action->GetDisplayBadgeText(first_tab_id));
+
+ EXPECT_EQ(test_case.expected_remove_referer_badge_text,
+ remove_referer_action->GetDisplayBadgeText(first_tab_id));
+ }
+}
+
// 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/ruleset_manager_unittest.cc b/chromium/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc
index 808d1b52973..1251a3a2281 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
@@ -15,6 +15,7 @@
#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/request_action.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"
@@ -28,6 +29,7 @@
#include "extensions/common/file_util.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/url_pattern.h"
+#include "net/http/http_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -37,8 +39,7 @@ namespace declarative_net_request {
// Note: This is not declared in the anonymous namespace so that we can use it
// with gtest.
-bool operator==(const RulesetManager::Action& lhs,
- const RulesetManager::Action& rhs) {
+bool operator==(const RequestAction& lhs, const RequestAction& rhs) {
static_assert(flat::ActionIndex_count == 7,
"Modify this method to ensure it stays updated as new actions "
"are added.");
@@ -72,8 +73,7 @@ class RulesetManagerTest : public DNRTestBase {
}
protected:
- using Action = RulesetManager::Action;
- using ActionType = Action::Type;
+ using RequestActionType = RequestAction::Type;
// Helper to create a composite matcher instance for the given |rules|.
void CreateMatcherForRules(
@@ -133,6 +133,24 @@ class RulesetManagerTest : public DNRTestBase {
return info;
}
+ // Returns renderer-initiated request params for the given |url| and
+ // |request_headers| request headers.
+ WebRequestInfoInitParams GetRequestParamsForURLWithHeaders(
+ base::StringPiece url,
+ const std::vector<std::string>& request_headers) {
+ const int kRendererId = 1;
+ WebRequestInfoInitParams info;
+ info.url = GURL(url);
+ info.render_process_id = kRendererId;
+
+ net::HttpRequestHeaders extra_request_headers;
+ for (const auto& header : request_headers)
+ extra_request_headers.SetHeaderIfMissing(header, "foo");
+
+ info.extra_request_headers = extra_request_headers;
+ return info;
+ }
+
RulesetManager* manager() { return manager_.get(); }
private:
@@ -156,9 +174,10 @@ TEST_P(RulesetManagerTest, MultipleRulesets) {
rule_two.condition->url_filter = std::string("two.com");
auto should_block_request = [this](const WebRequestInfo& request) {
- return manager()->EvaluateRequest(request,
- false /*is_incognito_context*/) ==
- Action(ActionType::BLOCK);
+ manager()->EvaluateRequest(request, false /*is_incognito_context*/);
+ return !request.dnr_actions->empty() &&
+ ((*request.dnr_actions)[0] ==
+ RequestAction(RequestActionType::BLOCK));
};
for (int mask = 0; mask < 4; mask++) {
@@ -228,28 +247,34 @@ TEST_P(RulesetManagerTest, IncognitoRequests) {
// incognito contexts should not be evaluated.
EXPECT_FALSE(util::IsIncognitoEnabled(last_loaded_extension()->id(),
browser_context()));
- EXPECT_EQ(
- Action(ActionType::NONE),
- manager()->EvaluateRequest(request_info, true /*is_incognito_context*/));
- request_info.dnr_action.reset();
- EXPECT_EQ(
- Action(ActionType::BLOCK),
- manager()->EvaluateRequest(request_info, false /*is_incognito_context*/));
- request_info.dnr_action.reset();
+
+ manager()->EvaluateRequest(request_info, true /*is_incognito_context*/);
+ EXPECT_TRUE(request_info.dnr_actions->empty());
+ request_info.dnr_actions.reset();
+
+ manager()->EvaluateRequest(request_info, false /*is_incognito_context*/);
+ ASSERT_EQ(1u, request_info.dnr_actions->size());
+ EXPECT_EQ(RequestAction(RequestActionType::BLOCK),
+ (*request_info.dnr_actions)[0]);
+ request_info.dnr_actions.reset();
// 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(ActionType::BLOCK),
- manager()->EvaluateRequest(request_info, true /*is_incognito_context*/));
- request_info.dnr_action.reset();
- EXPECT_EQ(
- Action(ActionType::BLOCK),
- manager()->EvaluateRequest(request_info, false /*is_incognito_context*/));
- request_info.dnr_action.reset();
+
+ manager()->EvaluateRequest(request_info, true /*is_incognito_context*/);
+ ASSERT_EQ(1u, request_info.dnr_actions->size());
+ EXPECT_EQ(RequestAction(RequestActionType::BLOCK),
+ (*request_info.dnr_actions)[0]);
+ request_info.dnr_actions.reset();
+
+ manager()->EvaluateRequest(request_info, false /*is_incognito_context*/);
+ ASSERT_EQ(1u, request_info.dnr_actions->size());
+ EXPECT_EQ(RequestAction(RequestActionType::BLOCK),
+ (*request_info.dnr_actions)[0]);
+ request_info.dnr_actions.reset();
}
// Tests that
@@ -265,15 +290,16 @@ TEST_P(RulesetManagerTest, TotalEvaluationTimeHistogram) {
"Extensions.DeclarativeNetRequest.EvaluateRequestTime.AllExtensions2";
{
base::HistogramTester tester;
- 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));
+
+ manager()->EvaluateRequest(example_com_request, is_incognito_context);
+ EXPECT_TRUE(example_com_request.dnr_actions->empty());
+
+ manager()->EvaluateRequest(google_com_request, is_incognito_context);
+ EXPECT_TRUE(google_com_request.dnr_actions->empty());
+
tester.ExpectTotalCount(kHistogramName, 0);
- example_com_request.dnr_action.reset();
- google_com_request.dnr_action.reset();
+ example_com_request.dnr_actions.reset();
+ google_com_request.dnr_actions.reset();
}
// Add an extension ruleset which blocks requests to "example.com".
@@ -287,16 +313,20 @@ TEST_P(RulesetManagerTest, TotalEvaluationTimeHistogram) {
{
base::HistogramTester tester;
- EXPECT_EQ(
- Action(ActionType::BLOCK),
- manager()->EvaluateRequest(example_com_request, is_incognito_context));
+
+ manager()->EvaluateRequest(example_com_request, is_incognito_context);
+ ASSERT_EQ(1u, example_com_request.dnr_actions->size());
+ EXPECT_EQ(RequestAction(RequestActionType::BLOCK),
+ (*example_com_request.dnr_actions)[0]);
+
tester.ExpectTotalCount(kHistogramName, 1);
- EXPECT_EQ(
- Action(ActionType::NONE),
- manager()->EvaluateRequest(google_com_request, is_incognito_context));
+
+ manager()->EvaluateRequest(google_com_request, is_incognito_context);
+ EXPECT_TRUE(google_com_request.dnr_actions->empty());
+
tester.ExpectTotalCount(kHistogramName, 2);
- example_com_request.dnr_action.reset();
- google_com_request.dnr_action.reset();
+ example_com_request.dnr_actions.reset();
+ google_com_request.dnr_actions.reset();
}
}
@@ -320,31 +350,33 @@ TEST_P(RulesetManagerTest, Redirect) {
// redirected to "google.com".
const bool is_incognito_context = false;
const char* kExampleURL = "http://example.com";
- Action expected_redirect_action(ActionType::REDIRECT);
+ RequestAction expected_redirect_action(RequestActionType::REDIRECT);
expected_redirect_action.redirect_url = GURL("http://google.com");
WebRequestInfo request_1(GetRequestParamsForURL(kExampleURL, base::nullopt));
- EXPECT_EQ(expected_redirect_action,
- manager()->EvaluateRequest(request_1, is_incognito_context));
+ manager()->EvaluateRequest(request_1, is_incognito_context);
+ ASSERT_EQ(1u, request_1.dnr_actions->size());
+ EXPECT_EQ(expected_redirect_action, (*request_1.dnr_actions)[0]);
// Change the initiator to "xyz.com". It should not be redirected since we
// don't have host permissions to the request initiator.
WebRequestInfo request_2(GetRequestParamsForURL(
kExampleURL, url::Origin::Create(GURL("http://xyz.com"))));
- EXPECT_EQ(Action(ActionType::NONE),
- manager()->EvaluateRequest(request_2, is_incognito_context));
+ manager()->EvaluateRequest(request_2, is_incognito_context);
+ EXPECT_TRUE(request_2.dnr_actions->empty());
// Change the initiator to "abc.com". It should be redirected since we have
// the required host permissions.
WebRequestInfo request_3(GetRequestParamsForURL(
kExampleURL, url::Origin::Create(GURL("http://abc.com"))));
- EXPECT_EQ(expected_redirect_action,
- manager()->EvaluateRequest(request_3, is_incognito_context));
+ manager()->EvaluateRequest(request_3, is_incognito_context);
+ ASSERT_EQ(1u, request_3.dnr_actions->size());
+ EXPECT_EQ(expected_redirect_action, (*request_3.dnr_actions)[0]);
// Ensure web-socket requests are not redirected.
WebRequestInfo request_4(
GetRequestParamsForURL("ws://example.com", base::nullopt));
- EXPECT_EQ(Action(ActionType::NONE),
- manager()->EvaluateRequest(request_4, is_incognito_context));
+ manager()->EvaluateRequest(request_4, is_incognito_context);
+ EXPECT_TRUE(request_4.dnr_actions->empty());
}
// Tests that an extension can't block or redirect resources on the chrome-
@@ -390,9 +422,10 @@ TEST_P(RulesetManagerTest, ExtensionScheme) {
// Ensure that "http://example.com" will be blocked (with blocking taking
// priority over redirection).
WebRequestInfo request_1(GetRequestParamsForURL("http://example.com"));
- EXPECT_EQ(
- Action(ActionType::BLOCK),
- manager()->EvaluateRequest(request_1, false /*is_incognito_context*/));
+ manager()->EvaluateRequest(request_1, false /*is_incognito_context*/);
+ ASSERT_EQ(1u, request_1.dnr_actions->size());
+ EXPECT_EQ(RequestAction(RequestActionType::BLOCK),
+ (*request_1.dnr_actions)[0]);
// Ensure that the background page for |extension_1| won't be blocked or
// redirected.
@@ -400,9 +433,8 @@ TEST_P(RulesetManagerTest, ExtensionScheme) {
EXPECT_TRUE(!background_page_url_1.is_empty());
WebRequestInfo request_2(
GetRequestParamsForURL(background_page_url_1.spec()));
- EXPECT_EQ(
- Action(ActionType::NONE),
- manager()->EvaluateRequest(request_2, false /*is_incognito_context*/));
+ manager()->EvaluateRequest(request_2, false /*is_incognito_context*/);
+ EXPECT_TRUE(request_2.dnr_actions->empty());
// Ensure that the background page for |extension_2| won't be blocked or
// redirected.
@@ -410,17 +442,89 @@ TEST_P(RulesetManagerTest, ExtensionScheme) {
EXPECT_TRUE(!background_page_url_2.is_empty());
WebRequestInfo request_3(
GetRequestParamsForURL(background_page_url_2.spec()));
- EXPECT_EQ(
- Action(ActionType::NONE),
- manager()->EvaluateRequest(request_3, false /*is_incognito_context*/));
+ manager()->EvaluateRequest(request_3, false /*is_incognito_context*/);
+ EXPECT_TRUE(request_3.dnr_actions->empty());
// Also ensure that an arbitrary url on the chrome extension scheme is also
// not blocked or redirected.
WebRequestInfo request_4(GetRequestParamsForURL(base::StringPrintf(
"%s://%s/%s", kExtensionScheme, "extension_id", "path")));
- EXPECT_EQ(
- Action(ActionType::NONE),
- manager()->EvaluateRequest(request_4, false /*is_incognito_context*/));
+ manager()->EvaluateRequest(request_4, false /*is_incognito_context*/);
+ EXPECT_TRUE(request_4.dnr_actions->empty());
+}
+
+// Test that headers to be removed in removeHeaders rules are attributed to the
+// correct extension.
+TEST_P(RulesetManagerTest, RemoveHeaders) {
+ const Extension* extension_1 = nullptr;
+ const Extension* extension_2 = nullptr;
+ // Add an extension with a background page which removes the "cookie" and
+ // "setCookie" headers.
+ {
+ std::unique_ptr<CompositeMatcher> matcher;
+ TestRule rule = CreateGenericRule();
+ rule.condition->url_filter = std::string("*");
+ rule.action->type = std::string("removeHeaders");
+ rule.action->remove_headers_list =
+ std::vector<std::string>({"cookie", "setCookie"});
+
+ ASSERT_NO_FATAL_FAILURE(
+ CreateMatcherForRules({rule}, "test extension", &matcher));
+ extension_1 = last_loaded_extension();
+ manager()->AddRuleset(extension_1->id(), std::move(matcher),
+ URLPatternSet());
+ }
+
+ // Add another extension with a background page which removes the "cookie" and
+ // "referer" headers.
+ {
+ std::unique_ptr<CompositeMatcher> matcher;
+ TestRule rule = CreateGenericRule();
+ rule.condition->url_filter = std::string("*");
+ rule.action->type = std::string("removeHeaders");
+ rule.action->remove_headers_list =
+ std::vector<std::string>({"cookie", "referer"});
+
+ ASSERT_NO_FATAL_FAILURE(
+ CreateMatcherForRules({rule}, "test extension 2", &matcher));
+ extension_2 = last_loaded_extension();
+ manager()->AddRuleset(extension_2->id(), std::move(matcher),
+ URLPatternSet());
+ }
+
+ EXPECT_EQ(2u, manager()->GetMatcherCountForTest());
+
+ // Create a request with the "cookie" and "referer" request headers, and the
+ // "set-cookie" response header.
+ WebRequestInfo request_1(GetRequestParamsForURLWithHeaders(
+ "http://example.com", std::vector<std::string>({"cookie", "referer"})));
+ request_1.response_headers = base::MakeRefCounted<net::HttpResponseHeaders>(
+ net::HttpUtil::AssembleRawHeaders("HTTP/1.1 200 OK\r\n"
+ "Content-Type: text/plain; UTF-8\r\n"
+ "Set-Cookie: custom/value\r\n"));
+
+ const std::vector<RequestAction>& actual_actions =
+ manager()->EvaluateRequest(request_1, false /*is_incognito_context*/);
+ ASSERT_EQ(2u, actual_actions.size());
+
+ // Removal of the cookie header should be attributed to |extension_2| because
+ // it was installed later than |extension_1| and thus has more priority.
+ RequestAction expected_action_1(RequestActionType::REMOVE_HEADERS);
+ expected_action_1.request_headers_to_remove.push_back(
+ net::HttpRequestHeaders::kCookie);
+
+ // Removal of the referer header should be attributed to |extension_2|.
+ expected_action_1.request_headers_to_remove.push_back(
+ net::HttpRequestHeaders::kReferer);
+
+ RequestAction expected_action_2(RequestActionType::REMOVE_HEADERS);
+ expected_action_2.response_headers_to_remove.push_back("set-cookie");
+
+ EXPECT_EQ(expected_action_1, actual_actions[0]);
+ EXPECT_EQ(extension_2->id(), actual_actions[0].extension_id);
+
+ EXPECT_EQ(expected_action_2, actual_actions[1]);
+ EXPECT_EQ(extension_1->id(), actual_actions[1].extension_id);
}
TEST_P(RulesetManagerTest, PageAllowingAPI) {
@@ -571,12 +675,16 @@ TEST_P(RulesetManagerTest, PageAllowingAPI) {
frame_params.pending_main_frame_url);
}
- Action expected_action = test_case.expect_blocked_with_allowed_pages
- ? Action(ActionType::BLOCK)
- : Action(ActionType::NONE);
- EXPECT_EQ(expected_action,
- manager()->EvaluateRequest(WebRequestInfo(std::move(params)),
- false /*is_incognito_context*/));
+ WebRequestInfo request_info(std::move(params));
+ const std::vector<RequestAction>& actions = manager()->EvaluateRequest(
+ request_info, false /*is_incognito_context*/);
+
+ if (test_case.expect_blocked_with_allowed_pages) {
+ ASSERT_EQ(1u, actions.size());
+ EXPECT_EQ(RequestAction(RequestActionType::BLOCK), actions[0]);
+ } else {
+ EXPECT_TRUE(actions.empty());
+ }
}
}
@@ -618,30 +726,28 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
struct TestCase {
std::string url;
base::Optional<url::Origin> initiator;
- ActionType expected_action_redirect_extension;
- ActionType expected_action_blocking_extension;
+ bool expected_action_redirect_extension;
+ bool expected_action_blocking_extension;
} cases[] = {
// Empty initiator. Has access.
- {"https://example.com", base::nullopt, ActionType::REDIRECT,
- ActionType::BLOCK},
+ {"https://example.com", base::nullopt, true, true},
// Opaque origin as initiator. Has access.
- {"https://example.com", url::Origin(), ActionType::REDIRECT,
- ActionType::BLOCK},
+ {"https://example.com", url::Origin(), true, true},
// yahoo.com as initiator. Has access.
{"https://example.com", url::Origin::Create(GURL("http://yahoo.com")),
- ActionType::REDIRECT, ActionType::BLOCK},
+ true, true},
// No matching rule.
{"https://yahoo.com", url::Origin::Create(GURL("http://example.com")),
- ActionType::NONE, ActionType::NONE},
+ false, false},
// 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")),
- ActionType::NONE, ActionType::BLOCK},
+ false, true},
};
auto verify_test_case = [this](const std::string& url,
const base::Optional<url::Origin>& initiator,
- const Action& expected_action) {
+ RequestAction* expected_action) {
SCOPED_TRACE(base::StringPrintf(
"Url-%s initiator-%s", url.c_str(),
initiator ? initiator->Serialize().c_str() : "empty"));
@@ -649,8 +755,14 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
WebRequestInfo request(GetRequestParamsForURL(url, initiator));
bool is_incognito_context = false;
- EXPECT_EQ(expected_action,
- manager()->EvaluateRequest(request, is_incognito_context));
+ manager()->EvaluateRequest(request, is_incognito_context);
+
+ if (expected_action) {
+ ASSERT_EQ(1u, request.dnr_actions->size());
+ EXPECT_EQ(*expected_action, (*request.dnr_actions)[0]);
+ } else {
+ EXPECT_TRUE(request.dnr_actions->empty());
+ }
};
// Test redirect extension.
@@ -659,11 +771,12 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
manager()->AddRuleset(redirect_extension_id, std::move(redirect_matcher),
URLPatternSet());
for (const auto& test : cases) {
- Action expected_action(test.expected_action_redirect_extension);
- if (test.expected_action_redirect_extension == ActionType::REDIRECT)
- expected_action.redirect_url = GURL("https://foo.com/");
+ RequestAction redirect_action(RequestActionType::REDIRECT);
+ redirect_action.redirect_url = GURL("https://foo.com/");
- verify_test_case(test.url, test.initiator, expected_action);
+ verify_test_case(
+ test.url, test.initiator,
+ test.expected_action_redirect_extension ? &redirect_action : nullptr);
}
manager()->RemoveRuleset(redirect_extension_id);
}
@@ -674,8 +787,11 @@ TEST_P(RulesetManagerTest, HostPermissionForInitiator) {
manager()->AddRuleset(blocking_extension_id, std::move(blocking_matcher),
URLPatternSet());
for (const auto& test : cases) {
- verify_test_case(test.url, test.initiator,
- Action(test.expected_action_blocking_extension));
+ RequestAction block_action(RequestActionType::BLOCK);
+
+ verify_test_case(
+ test.url, test.initiator,
+ test.expected_action_blocking_extension ? &block_action : nullptr);
}
manager()->RemoveRuleset(blocking_extension_id);
}
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 07369df425c..c0eed2de936 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
@@ -30,17 +30,16 @@
#include "extensions/common/manifest.h"
#include "extensions/common/switches.h"
#include "ui/base/l10n/l10n_util.h"
+#include "url/origin.h"
-using extensions::api::desktop_capture::ChooseDesktopMedia::Results::Options;
using content::DesktopMediaID;
+using extensions::api::desktop_capture::ChooseDesktopMedia::Results::Options;
namespace extensions {
namespace {
const char kInvalidSourceNameError[] = "Invalid source type specified.";
-const char kEmptySourcesListError[] =
- "At least one source type must be specified.";
DesktopMediaPickerFactory* g_picker_factory = nullptr;
@@ -65,11 +64,12 @@ void DesktopCaptureChooseDesktopMediaFunctionBase::Cancel() {
// Keep reference to |this| to ensure the object doesn't get destroyed before
// we return.
scoped_refptr<DesktopCaptureChooseDesktopMediaFunctionBase> self(this);
- if (picker_) {
- picker_.reset();
- SetResultList(Create(std::string(), Options()));
- SendResponse(true);
- }
+
+ // If this picker dialog is open, this will close it.
+ picker_controller_.reset();
+
+ SetResultList(Create(std::string(), Options()));
+ SendResponse(true);
}
bool DesktopCaptureChooseDesktopMediaFunctionBase::Execute(
@@ -77,8 +77,7 @@ bool DesktopCaptureChooseDesktopMediaFunctionBase::Execute(
content::WebContents* web_contents,
const GURL& origin,
const base::string16 target_name) {
- // Register to be notified when the tab is closed.
- Observe(web_contents);
+ DCHECK(!picker_controller_);
gfx::NativeWindow parent_window = web_contents->GetTopLevelNativeWindow();
// In case of coming from background extension page, |parent_window| will
@@ -122,34 +121,20 @@ bool DesktopCaptureChooseDesktopMediaFunctionBase::Execute(
}
}
- DesktopMediaPickerFactory* picker_factory =
- g_picker_factory ? g_picker_factory
- : DesktopMediaPickerFactoryImpl::GetInstance();
- // Keep same order as the input |sources| and avoid duplicates.
- std::vector<std::unique_ptr<DesktopMediaList>> source_lists =
- picker_factory->CreateMediaList(media_types);
- if (source_lists.empty()) {
- error_ = kEmptySourcesListError;
- return false;
- }
- picker_ = picker_factory->CreatePicker();
- if (!picker_) {
- error_ = "Desktop Capture API is not yet implemented for this platform.";
- return false;
- }
-
- DesktopMediaPicker::DoneCallback callback = base::Bind(
+ DesktopMediaPickerController::DoneCallback callback = base::BindOnce(
&DesktopCaptureChooseDesktopMediaFunctionBase::OnPickerDialogResults,
- this);
- DesktopMediaPicker::Params picker_params;
+ this, origin, web_contents);
+ DesktopMediaPickerController::Params picker_params;
picker_params.web_contents = web_contents;
picker_params.context = parent_window;
picker_params.parent = parent_window;
picker_params.app_name = base::UTF8ToUTF16(GetCallerDisplayName());
picker_params.target_name = target_name;
picker_params.request_audio = request_audio;
- picker_->Show(picker_params, std::move(source_lists), callback);
- origin_ = origin;
+ picker_controller_ =
+ std::make_unique<DesktopMediaPickerController>(g_picker_factory);
+ picker_controller_->Show(picker_params, std::move(media_types),
+ std::move(callback));
return true;
}
@@ -163,23 +148,38 @@ std::string DesktopCaptureChooseDesktopMediaFunctionBase::GetCallerDisplayName()
}
}
-void DesktopCaptureChooseDesktopMediaFunctionBase::WebContentsDestroyed() {
- Cancel();
-}
-
void DesktopCaptureChooseDesktopMediaFunctionBase::OnPickerDialogResults(
+ const GURL& origin,
+ content::WebContents* web_contents,
+ const std::string& err,
DesktopMediaID source) {
+ picker_controller_.reset();
+
+ if (!err.empty()) {
+ SetError(err);
+ SendResponse(false);
+ return;
+ }
+
+ if (source.is_null()) {
+ DLOG(ERROR) << "Sending empty results.";
+ SetResultList(Create(std::string(), Options()));
+ SendResponse(true);
+ return;
+ }
+
std::string result;
- if (source.type != DesktopMediaID::TYPE_NONE && web_contents()) {
+ if (source.type != DesktopMediaID::TYPE_NONE && web_contents) {
// TODO(miu): Once render_frame_host() is being set, we should register the
// exact RenderFrame requesting the stream, not the main RenderFrame. With
// that change, also update
// MediaCaptureDevicesDispatcher::ProcessDesktopCaptureAccessRequest().
// http://crbug.com/304341
- content::RenderFrameHost* const main_frame = web_contents()->GetMainFrame();
+ content::RenderFrameHost* const main_frame = web_contents->GetMainFrame();
result = content::DesktopStreamsRegistry::GetInstance()->RegisterStream(
- main_frame->GetProcess()->GetID(), main_frame->GetRoutingID(), origin_,
- source, extension()->name(), content::kRegistryStreamTypeDesktop);
+ main_frame->GetProcess()->GetID(), main_frame->GetRoutingID(),
+ url::Origin::Create(origin), source, extension()->name(),
+ content::kRegistryStreamTypeDesktop);
}
Options options;
diff --git a/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h b/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h
index 798348f9e7a..80232e13338 100644
--- a/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h
+++ b/chromium/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h
@@ -7,23 +7,22 @@
#include <array>
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/media/webrtc/desktop_media_list.h"
-#include "chrome/browser/media/webrtc/desktop_media_picker.h"
+#include "chrome/browser/media/webrtc/desktop_media_picker_controller.h"
#include "chrome/browser/media/webrtc/desktop_media_picker_factory.h"
#include "chrome/common/extensions/api/desktop_capture.h"
-#include "content/public/browser/web_contents_observer.h"
#include "url/gurl.h"
namespace extensions {
class DesktopCaptureChooseDesktopMediaFunctionBase
- : public ChromeAsyncExtensionFunction,
- public content::WebContentsObserver {
+ : public ChromeAsyncExtensionFunction {
public:
// Used to set PickerFactory used to create mock DesktopMediaPicker instances
// for tests. Calling tests keep ownership of the factory. Can be called with
@@ -41,12 +40,11 @@ class DesktopCaptureChooseDesktopMediaFunctionBase
// also be used to determine where to show the picker's UI.
// |origin| is the origin for which the stream is created.
// |target_name| is the display name of the stream target.
- bool Execute(
- const std::vector<api::desktop_capture::DesktopCaptureSourceType>&
- sources,
- content::WebContents* web_contents,
- const GURL& origin,
- const base::string16 target_name);
+ bool Execute(const std::vector<
+ api::desktop_capture::DesktopCaptureSourceType>& sources,
+ content::WebContents* web_contents,
+ const GURL& origin,
+ const base::string16 target_name);
// Returns the calling application name to show in the picker.
std::string GetCallerDisplayName() const;
@@ -54,16 +52,12 @@ class DesktopCaptureChooseDesktopMediaFunctionBase
int request_id_;
private:
- // content::WebContentsObserver overrides.
- void WebContentsDestroyed() override;
+ void OnPickerDialogResults(const GURL& origin,
+ content::WebContents* web_contents,
+ const std::string& err,
+ content::DesktopMediaID source);
- void OnPickerDialogResults(content::DesktopMediaID source);
-
- // URL of page that desktop capture was requested for.
- GURL origin_;
-
- std::unique_ptr<DesktopMediaPickerFactory> picker_factory_;
- std::unique_ptr<DesktopMediaPicker> picker_;
+ std::unique_ptr<DesktopMediaPickerController> picker_controller_;
};
class DesktopCaptureCancelChooseDesktopMediaFunctionBase
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 6cd0dd1f2f8..d08f651ecdf 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
@@ -20,6 +20,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
+#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/extensions/api/developer_private/developer_private_mangle.h"
#include "chrome/browser/extensions/api/developer_private/entry_picker.h"
@@ -46,7 +47,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/apps/app_info_dialog.h"
#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/extensions/app_launch_params.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/extensions/api/developer_private.h"
@@ -325,7 +325,7 @@ std::unique_ptr<developer::ProfileInfo> DeveloperPrivateAPI::CreateProfileInfo(
info->in_developer_mode =
!info->is_supervised &&
prefs->GetBoolean(prefs::kExtensionsUIDeveloperMode);
- info->app_info_dialog_enabled = CanShowAppInfoDialog();
+ info->app_info_dialog_enabled = CanPlatformShowAppInfoDialog();
info->can_load_unpacked =
ExtensionManagementFactory::GetForBrowserContext(profile)
->HasWhitelistedExtension();
@@ -358,16 +358,7 @@ DeveloperPrivateAPI::DeveloperPrivateAPI(content::BrowserContext* context)
}
DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile)
- : extension_registry_observer_(this),
- error_console_observer_(this),
- process_manager_observer_(this),
- app_window_registry_observer_(this),
- warning_service_observer_(this),
- extension_prefs_observer_(this),
- extension_management_observer_(this),
- command_service_observer_(this),
- profile_(profile),
- event_router_(EventRouter::Get(profile_)) {
+ : profile_(profile), event_router_(EventRouter::Get(profile_)) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
error_console_observer_.Add(ErrorConsole::Get(profile));
process_manager_observer_.Add(ProcessManager::Get(profile));
@@ -955,9 +946,8 @@ DeveloperPrivateUpdateExtensionConfigurationFunction::Run() {
return RespondNow(NoArguments());
}
-DeveloperPrivateReloadFunction::DeveloperPrivateReloadFunction()
- : registry_observer_(this), error_reporter_observer_(this) {}
-DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {}
+DeveloperPrivateReloadFunction::DeveloperPrivateReloadFunction() = default;
+DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() = default;
ExtensionFunction::ResponseAction DeveloperPrivateReloadFunction::Run() {
std::unique_ptr<Reload::Params> params(Reload::Params::Create(*args_));
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 639cf9e4777..33955e23630 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
@@ -30,8 +30,11 @@
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function.h"
+#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_prefs_observer.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
+#include "extensions/browser/process_manager.h"
#include "extensions/browser/process_manager_observer.h"
#include "extensions/browser/warning_service.h"
#include "storage/browser/fileapi/file_system_context.h"
@@ -45,8 +48,6 @@ namespace extensions {
class EventRouter;
class ExtensionError;
class ExtensionInfoGenerator;
-class ExtensionRegistry;
-class ProcessManager;
namespace api {
@@ -144,20 +145,21 @@ class DeveloperPrivateEventRouter : public ExtensionRegistryObserver,
std::vector<api::developer_private::ExtensionInfo> infos);
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
- ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_;
+ extension_registry_observer_{this};
+ ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_{
+ this};
ScopedObserver<ProcessManager, ProcessManagerObserver>
- process_manager_observer_;
+ process_manager_observer_{this};
ScopedObserver<AppWindowRegistry, AppWindowRegistry::Observer>
- app_window_registry_observer_;
+ app_window_registry_observer_{this};
ScopedObserver<WarningService, WarningService::Observer>
- warning_service_observer_;
+ warning_service_observer_{this};
ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver>
- extension_prefs_observer_;
+ extension_prefs_observer_{this};
ScopedObserver<ExtensionManagement, ExtensionManagement::Observer>
- extension_management_observer_;
+ extension_management_observer_{this};
ScopedObserver<CommandService, CommandService::Observer>
- command_service_observer_;
+ command_service_observer_{this};
Profile* profile_;
@@ -464,9 +466,9 @@ class DeveloperPrivateReloadFunction : public DeveloperPrivateAPIFunction,
base::FilePath reloading_extension_path_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- registry_observer_;
+ registry_observer_{this};
ScopedObserver<LoadErrorReporter, LoadErrorReporter::Observer>
- error_reporter_observer_;
+ error_reporter_observer_{this};
DISALLOW_COPY_AND_ASSIGN(DeveloperPrivateReloadFunction);
};
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 cf68ed7c110..62b206bf7ab 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
@@ -80,7 +80,7 @@ std::string SiteControlsToString(
list.GetList().reserve(controls.size());
for (const auto& control : controls) {
std::unique_ptr<base::Value> control_value = control.ToValue();
- list.GetList().push_back(std::move(*control_value));
+ list.Append(std::move(*control_value));
}
std::string json;
diff --git a/chromium/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc b/chromium/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
index 4d719aaff50..a81a0674b73 100644
--- a/chromium/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
+++ b/chromium/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
@@ -40,7 +40,7 @@ void ShowPermissionsDialogHelper::Show(content::BrowserContext* browser_context,
// Show the new-style extensions dialog when it is available. It is currently
// unavailable by default on Mac.
- if (CanShowAppInfoDialog()) {
+ if (CanPlatformShowAppInfoDialog()) {
if (from_webui) {
UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches",
AppInfoLaunchSource::FROM_EXTENSIONS_PAGE,
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 095b9e97d3f..b5f3d56bcb8 100644
--- a/chromium/chrome/browser/extensions/api/device_permissions_manager_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/device_permissions_manager_unittest.cc
@@ -69,10 +69,10 @@ class DevicePermissionsManagerTest : public testing::Test {
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));
+ mojo::PendingRemote<device::mojom::HidManager> hid_manager;
+ fake_hid_manager_.Bind(hid_manager.InitWithNewPipeAndPassReceiver());
HidDeviceManager::Get(env_->profile())
- ->SetFakeHidManagerForTesting(std::move(hid_manager_ptr));
+ ->SetFakeHidManagerForTesting(std::move(hid_manager));
base::RunLoop().RunUntilIdle();
device4_ = fake_hid_manager_.CreateAndAddDevice(
diff --git a/chromium/chrome/browser/extensions/api/downloads/downloads_api.cc b/chromium/chrome/browser/extensions/api/downloads/downloads_api.cc
index 7ba05fc5f7a..9a908ac71c4 100644
--- a/chromium/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chromium/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -70,7 +70,6 @@
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/browser/extension_prefs.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/browser/notification_types.h"
#include "extensions/browser/warning_service.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -149,6 +148,11 @@ const char kDangerUnwanted[] = "unwanted";
const char kDangerWhitelistedByPolicy[] = "whitelistedByPolicy";
const char kDangerAsyncScanning[] = "asyncScanning";
const char kDangerPasswordProtected[] = "passwordProtected";
+const char kDangerTooLarge[] = "blockedTooLarge";
+const char kDangerSensitiveContentWarning[] = "sensitiveContentWarning";
+const char kDangerSensitiveContentBlock[] = "sensitiveContentBlock";
+const char kDangerDeepScannedSafe[] = "deepScannedSafe";
+const char kDangerDeepScannedOpenedDangerous[] = "deepScannedOpenedDangerous";
const char kDangerUrl[] = "url";
const char kEndTimeKey[] = "endTime";
const char kEndedAfterKey[] = "endedAfter";
@@ -182,13 +186,23 @@ const char kFinalUrlRegexKey[] = "finalUrlRegex";
// Note: Any change to the danger type strings, should be accompanied by a
// corresponding change to downloads.json.
-const char* const kDangerStrings[] = {
- kDangerSafe, kDangerFile,
- kDangerUrl, kDangerContent,
- kDangerSafe, kDangerUncommon,
- kDangerAccepted, kDangerHost,
- kDangerUnwanted, kDangerWhitelistedByPolicy,
- kDangerAsyncScanning, kDangerPasswordProtected};
+const char* const kDangerStrings[] = {kDangerSafe,
+ kDangerFile,
+ kDangerUrl,
+ kDangerContent,
+ kDangerSafe,
+ kDangerUncommon,
+ kDangerAccepted,
+ kDangerHost,
+ kDangerUnwanted,
+ kDangerWhitelistedByPolicy,
+ kDangerAsyncScanning,
+ kDangerPasswordProtected,
+ kDangerTooLarge,
+ kDangerSensitiveContentWarning,
+ kDangerSensitiveContentBlock,
+ kDangerDeepScannedSafe,
+ kDangerDeepScannedOpenedDangerous};
static_assert(base::size(kDangerStrings) == download::DOWNLOAD_DANGER_TYPE_MAX,
"kDangerStrings should have DOWNLOAD_DANGER_TYPE_MAX elements");
@@ -396,7 +410,7 @@ void InitFilterTypeMap(FilterTypeMap* filter_types_ptr) {
AppendFilter(kFinalUrlKey, DownloadQuery::FILTER_URL, &v);
AppendFilter(kFinalUrlRegexKey, DownloadQuery::FILTER_URL_REGEX, &v);
- *filter_types_ptr = FilterTypeMap(std::move(v), base::KEEP_FIRST_OF_DUPES);
+ *filter_types_ptr = FilterTypeMap(std::move(v));
}
using SortTypeMap = base::flat_map<std::string, DownloadQuery::SortType>;
@@ -423,7 +437,7 @@ void InitSortTypeMap(SortTypeMap* sorter_types_ptr) {
AppendFilter(kUrlKey, DownloadQuery::SORT_ORIGINAL_URL, &v);
AppendFilter(kFinalUrlKey, DownloadQuery::SORT_URL, &v);
- *sorter_types_ptr = SortTypeMap(std::move(v), base::KEEP_FIRST_OF_DUPES);
+ *sorter_types_ptr = SortTypeMap(std::move(v));
}
bool IsNotTemporaryDownloadFilter(const DownloadItem& download_item) {
@@ -1611,9 +1625,7 @@ void DownloadsGetFileIconFunction::OnIconURLExtracted(const std::string& url) {
ExtensionDownloadsEventRouter::ExtensionDownloadsEventRouter(
Profile* profile,
DownloadManager* manager)
- : profile_(profile),
- notifier_(manager, this),
- extension_registry_observer_(this) {
+ : profile_(profile), notifier_(manager, this) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(profile_);
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
diff --git a/chromium/chrome/browser/extensions/api/downloads/downloads_api.h b/chromium/chrome/browser/extensions/api/downloads/downloads_api.h
index 1f39ba01ffd..d0b6f832269 100644
--- a/chromium/chrome/browser/extensions/api/downloads/downloads_api.h
+++ b/chromium/chrome/browser/extensions/api/downloads/downloads_api.h
@@ -20,16 +20,13 @@
#include "components/download/public/common/download_path_reservation_tracker.h"
#include "content/public/browser/download_manager.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/browser/warning_set.h"
class DownloadFileIconExtractor;
class DownloadOpenPrompt;
-namespace extensions {
-class ExtensionRegistry;
-}
-
// Functions in the chrome.downloads namespace facilitate
// controlling downloads from extensions. See the full API doc at
// http://goo.gl/6hO1n
@@ -395,7 +392,7 @@ class ExtensionDownloadsEventRouter
// Listen to extension unloaded notifications.
ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter);
};
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 0e2a4d31138..1bfce417f2e 100644
--- a/chromium/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
+++ b/chromium/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -932,7 +932,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
scoped_refptr<DownloadsOpenFunction> scoped_open(new DownloadsOpenFunction());
scoped_open->set_user_gesture(true);
base::Value args_list(base::Value::Type::LIST);
- args_list.GetList().emplace_back(static_cast<int>(download_item->GetId()));
+ args_list.Append(static_cast<int>(download_item->GetId()));
scoped_open->SetArgs(std::move(args_list));
scoped_open->set_browser_context(current_browser()->profile());
scoped_open->set_extension(extension());
@@ -1900,31 +1900,31 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
GoOnTheRecord();
static const char* const kUnsafeHeaders[] = {
- "Accept-chArsEt",
- "accept-eNcoding",
- "coNNection",
- "coNteNt-leNgth",
- "cooKIE",
- "cOOkie2",
- "coNteNt-traNsfer-eNcodiNg",
- "dAtE",
- "ExpEcT",
- "hOsT",
- "kEEp-aLivE",
- "rEfErEr",
- "tE",
- "trAilER",
- "trANsfer-eNcodiNg",
- "upGRAde",
- "usER-agENt",
- "viA",
- "pRoxY-",
- "sEc-",
- "pRoxY-probably-not-evil",
- "sEc-probably-not-evil",
- "oRiGiN",
- "Access-Control-Request-Headers",
- "Access-Control-Request-Method",
+ "Accept-chArsEt",
+ "accept-eNcoding",
+ "coNNection",
+ "coNteNt-leNgth",
+ "cooKIE",
+ "cOOkie2",
+ "dAtE",
+ "DNT",
+ "ExpEcT",
+ "hOsT",
+ "kEEp-aLivE",
+ "rEfErEr",
+ "tE",
+ "trAilER",
+ "trANsfer-eNcodiNg",
+ "upGRAde",
+ "usER-agENt",
+ "viA",
+ "pRoxY-",
+ "sEc-",
+ "pRoxY-probably-not-evil",
+ "sEc-probably-not-evil",
+ "oRiGiN",
+ "Access-Control-Request-Headers",
+ "Access-Control-Request-Method",
};
for (size_t index = 0; index < base::size(kUnsafeHeaders); ++index) {
diff --git a/chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_api.cc b/chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_api.cc
index 87b1c700975..60af1cbb3f6 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_api.cc
+++ b/chromium/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_api.cc
@@ -7,6 +7,7 @@
#include "base/values.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
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 9d3f31a0a72..b4f0086533c 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
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/json/json_writer.h"
#include "base/path_service.h"
-#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
@@ -15,6 +14,7 @@
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/browser/extensions/policy_test_utils.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chromeos/dbus/session_manager/fake_session_manager_client.h"
@@ -24,7 +24,6 @@
#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"
-#include "components/policy/policy_constants.h"
#include "components/prefs/pref_service.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_task_traits.h"
@@ -33,10 +32,7 @@
#include "content/public/test/test_utils.h"
#include "extensions/browser/api_test_utils.h"
#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/test/result_catcher.h"
-#include "net/test/embedded_test_server/http_request.h"
-#include "net/test/embedded_test_server/http_response.h"
namespace {
@@ -99,34 +95,6 @@ class EnterpriseDeviceAttributesTest
set_chromeos_user_ = false;
}
- // Replace "mock.http" with "127.0.0.1:<port>" on "update_manifest.xml" files.
- // Host resolver doesn't work here because the test file doesn't know the
- // correct port number.
- std::unique_ptr<net::test_server::HttpResponse> InterceptMockHttp(
- const net::test_server::HttpRequest& request) {
- const std::string kFileNameToIntercept = "update_manifest.xml";
- if (request.GetURL().ExtractFileName() != kFileNameToIntercept)
- return nullptr;
-
- base::FilePath test_data_dir;
- base::PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
- // Remove the leading '/'.
- std::string relative_manifest_path = request.GetURL().path().substr(1);
- std::string manifest_response;
- CHECK(base::ReadFileToString(test_data_dir.Append(relative_manifest_path),
- &manifest_response));
-
- base::ReplaceSubstringsAfterOffset(
- &manifest_response, 0, "mock.http",
- embedded_test_server()->host_port_pair().ToString());
-
- std::unique_ptr<net::test_server::BasicHttpResponse> response(
- new net::test_server::BasicHttpResponse());
- response->set_content_type("text/xml");
- response->set_content(manifest_response);
- return response;
- }
-
protected:
// ExtensionApiTest
void SetUpCommandLine(base::CommandLine* command_line) override {
@@ -192,29 +160,6 @@ class EnterpriseDeviceAttributesTest
ExtensionApiTest::SetUpOnMainThread();
}
- void SetPolicy() {
- // Extensions that are force-installed come from an update URL, which
- // defaults to the webstore. Use a mock URL for this test with an update
- // manifest that includes the crx file of the test extension.
- GURL update_manifest_url(
- embedded_test_server()->GetURL(kUpdateManifestPath));
-
- std::unique_ptr<base::ListValue> forcelist(new base::ListValue);
- forcelist->AppendString(base::StringPrintf(
- "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str()));
-
- policy::PolicyMap policy;
- policy.Set(policy::key::kExtensionInstallForcelist,
- policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE,
- policy::POLICY_SOURCE_CLOUD, std::move(forcelist), nullptr);
-
- // Set the policy and wait until the extension is installed.
- extensions::TestExtensionRegistryObserver observer(
- ExtensionRegistry::Get(profile()));
- policy_provider_.UpdateChromePolicy(policy);
- observer.WaitForExtensionLoaded();
- }
-
// Load |page_url| in |browser| and wait for PASSED or FAILED notification.
// The functionality of this function is reduced functionality of
// RunExtensionSubtest(), but we don't use it here because it requires
@@ -248,11 +193,12 @@ class EnterpriseDeviceAttributesTest
AccountId::FromUserEmailGaiaId(kAffiliatedUserEmail,
kAffiliatedUserGaiaId);
+ policy::MockConfigurationPolicyProvider policy_provider_;
+
private:
chromeos::ScopedStubInstallAttributes test_install_attributes_{
chromeos::StubInstallAttributes::CreateCloudManaged("fake-domain",
"fake-id")};
- policy::MockConfigurationPolicyProvider policy_provider_;
policy::DevicePolicyCrosTestHelper test_helper_;
chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
};
@@ -262,13 +208,11 @@ IN_PROC_BROWSER_TEST_P(EnterpriseDeviceAttributesTest, PRE_Success) {
}
IN_PROC_BROWSER_TEST_P(EnterpriseDeviceAttributesTest, Success) {
- // Setup |URLLoaderInterceptor|, which is required for force-installing the
- // test extension through policy.
- embedded_test_server()->RegisterRequestHandler(
- base::BindRepeating(&EnterpriseDeviceAttributesTest::InterceptMockHttp,
- base::Unretained(this)));
+ policy_test_utils::SetUpEmbeddedTestServer(embedded_test_server());
ASSERT_TRUE(embedded_test_server()->Start());
- SetPolicy();
+ policy_test_utils::SetExtensionInstallForcelistPolicy(
+ kTestExtensionID, embedded_test_server()->GetURL(kUpdateManifestPath),
+ profile(), &policy_provider_);
EXPECT_EQ(GetParam().affiliated, user_manager::UserManager::Get()
->FindUser(affiliated_account_id_)
diff --git a/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc b/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
index 2932c7037d5..dfcc812c94b 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
+++ b/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
@@ -45,8 +45,7 @@ std::string StringFromVector(const std::vector<uint8_t>& v) {
} // namespace
EnterprisePlatformKeysInternalGenerateKeyFunction::
- ~EnterprisePlatformKeysInternalGenerateKeyFunction() {
-}
+ ~EnterprisePlatformKeysInternalGenerateKeyFunction() = default;
ExtensionFunction::ResponseAction
EnterprisePlatformKeysInternalGenerateKeyFunction::Run() {
@@ -64,9 +63,7 @@ EnterprisePlatformKeysInternalGenerateKeyFunction::Run() {
DCHECK(service);
service->GenerateRSAKey(
- platform_keys_token_id,
- params->modulus_length,
- extension_id(),
+ platform_keys_token_id, params->modulus_length, extension_id(),
base::Bind(
&EnterprisePlatformKeysInternalGenerateKeyFunction::OnGeneratedKey,
this));
@@ -86,8 +83,7 @@ void EnterprisePlatformKeysInternalGenerateKeyFunction::OnGeneratedKey(
}
EnterprisePlatformKeysGetCertificatesFunction::
- ~EnterprisePlatformKeysGetCertificatesFunction() {
-}
+ ~EnterprisePlatformKeysGetCertificatesFunction() {}
ExtensionFunction::ResponseAction
EnterprisePlatformKeysGetCertificatesFunction::Run() {
@@ -118,8 +114,7 @@ void EnterprisePlatformKeysGetCertificatesFunction::OnGotCertificates(
std::unique_ptr<base::ListValue> client_certs(new base::ListValue());
for (net::CertificateList::const_iterator it = certs->begin();
- it != certs->end();
- ++it) {
+ it != certs->end(); ++it) {
base::StringPiece cert_der =
net::x509_util::CryptoBufferAsStringPiece((*it)->cert_buffer());
client_certs->Append(std::make_unique<base::Value>(
@@ -132,8 +127,7 @@ void EnterprisePlatformKeysGetCertificatesFunction::OnGotCertificates(
}
EnterprisePlatformKeysImportCertificateFunction::
- ~EnterprisePlatformKeysImportCertificateFunction() {
-}
+ ~EnterprisePlatformKeysImportCertificateFunction() {}
ExtensionFunction::ResponseAction
EnterprisePlatformKeysImportCertificateFunction::Run() {
@@ -157,8 +151,7 @@ EnterprisePlatformKeysImportCertificateFunction::Run() {
return RespondNow(Error(kEnterprisePlatformErrorInvalidX509Cert));
chromeos::platform_keys::ImportCertificate(
- platform_keys_token_id,
- cert_x509,
+ platform_keys_token_id, cert_x509,
base::Bind(&EnterprisePlatformKeysImportCertificateFunction::
OnImportedCertificate,
this),
@@ -176,8 +169,7 @@ void EnterprisePlatformKeysImportCertificateFunction::OnImportedCertificate(
}
EnterprisePlatformKeysRemoveCertificateFunction::
- ~EnterprisePlatformKeysRemoveCertificateFunction() {
-}
+ ~EnterprisePlatformKeysRemoveCertificateFunction() {}
ExtensionFunction::ResponseAction
EnterprisePlatformKeysRemoveCertificateFunction::Run() {
@@ -201,8 +193,7 @@ EnterprisePlatformKeysRemoveCertificateFunction::Run() {
return RespondNow(Error(kEnterprisePlatformErrorInvalidX509Cert));
chromeos::platform_keys::RemoveCertificate(
- platform_keys_token_id,
- cert_x509,
+ platform_keys_token_id, cert_x509,
base::Bind(&EnterprisePlatformKeysRemoveCertificateFunction::
OnRemovedCertificate,
this),
@@ -220,8 +211,7 @@ void EnterprisePlatformKeysRemoveCertificateFunction::OnRemovedCertificate(
}
EnterprisePlatformKeysInternalGetTokensFunction::
- ~EnterprisePlatformKeysInternalGetTokensFunction() {
-}
+ ~EnterprisePlatformKeysInternalGetTokensFunction() {}
ExtensionFunction::ResponseAction
EnterprisePlatformKeysInternalGetTokensFunction::Run() {
@@ -246,8 +236,7 @@ void EnterprisePlatformKeysInternalGetTokensFunction::OnGotTokens(
std::vector<std::string> token_ids;
for (std::vector<std::string>::const_iterator it =
platform_keys_token_ids->begin();
- it != platform_keys_token_ids->end();
- ++it) {
+ it != platform_keys_token_ids->end(); ++it) {
std::string token_id = platform_keys::PlatformKeysTokenIdToApiId(*it);
if (token_id.empty()) {
Respond(Error(kEnterprisePlatformErrorInternal));
@@ -260,13 +249,7 @@ void EnterprisePlatformKeysInternalGetTokensFunction::OnGotTokens(
}
EnterprisePlatformKeysChallengeMachineKeyFunction::
- EnterprisePlatformKeysChallengeMachineKeyFunction()
- : default_impl_(new EPKPChallengeMachineKey), impl_(default_impl_.get()) {}
-
-EnterprisePlatformKeysChallengeMachineKeyFunction::
- EnterprisePlatformKeysChallengeMachineKeyFunction(
- EPKPChallengeMachineKey* impl_for_testing)
- : impl_(impl_for_testing) {}
+ EnterprisePlatformKeysChallengeMachineKeyFunction() = default;
EnterprisePlatformKeysChallengeMachineKeyFunction::
~EnterprisePlatformKeysChallengeMachineKeyFunction() = default;
@@ -276,39 +259,32 @@ EnterprisePlatformKeysChallengeMachineKeyFunction::Run() {
std::unique_ptr<api_epk::ChallengeMachineKey::Params> params(
api_epk::ChallengeMachineKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- ChallengeKeyCallback callback = base::Bind(
+ chromeos::attestation::TpmChallengeKeyCallback callback = base::BindOnce(
&EnterprisePlatformKeysChallengeMachineKeyFunction::OnChallengedKey,
this);
// base::Unretained is safe on impl_ since its life-cycle matches |this| and
// |callback| holds a reference to |this|.
- base::Closure task =
- base::Bind(&EPKPChallengeMachineKey::Run, base::Unretained(impl_),
- scoped_refptr<ExtensionFunction>(this), callback,
- StringFromVector(params->challenge),
- params->register_key ? *params->register_key : false);
- base::PostTask(FROM_HERE, {content::BrowserThread::UI}, task);
+ base::OnceClosure task = base::BindOnce(
+ &EPKPChallengeKey::Run, base::Unretained(&impl_),
+ chromeos::attestation::KEY_DEVICE, scoped_refptr<ExtensionFunction>(this),
+ std::move(callback), StringFromVector(params->challenge),
+ params->register_key ? *params->register_key : false);
+ base::PostTask(FROM_HERE, {content::BrowserThread::UI}, std::move(task));
return RespondLater();
}
void EnterprisePlatformKeysChallengeMachineKeyFunction::OnChallengedKey(
- bool success,
- const std::string& data) {
- if (success) {
- Respond(ArgumentList(
- api_epk::ChallengeMachineKey::Results::Create(VectorFromString(data))));
+ const chromeos::attestation::TpmChallengeKeyResult& result) {
+ if (result.is_success) {
+ Respond(ArgumentList(api_epk::ChallengeMachineKey::Results::Create(
+ VectorFromString(result.data))));
} else {
- Respond(Error(data));
+ Respond(Error(result.error_message));
}
}
EnterprisePlatformKeysChallengeUserKeyFunction::
- EnterprisePlatformKeysChallengeUserKeyFunction()
- : default_impl_(new EPKPChallengeUserKey), impl_(default_impl_.get()) {}
-
-EnterprisePlatformKeysChallengeUserKeyFunction::
- EnterprisePlatformKeysChallengeUserKeyFunction(
- EPKPChallengeUserKey* impl_for_testing)
- : impl_(impl_for_testing) {}
+ EnterprisePlatformKeysChallengeUserKeyFunction() = default;
EnterprisePlatformKeysChallengeUserKeyFunction::
~EnterprisePlatformKeysChallengeUserKeyFunction() = default;
@@ -318,26 +294,26 @@ EnterprisePlatformKeysChallengeUserKeyFunction::Run() {
std::unique_ptr<api_epk::ChallengeUserKey::Params> params(
api_epk::ChallengeUserKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- ChallengeKeyCallback callback = base::Bind(
+ chromeos::attestation::TpmChallengeKeyCallback callback = base::Bind(
&EnterprisePlatformKeysChallengeUserKeyFunction::OnChallengedKey, this);
// base::Unretained is safe on impl_ since its life-cycle matches |this| and
// |callback| holds a reference to |this|.
- base::Closure task =
- base::Bind(&EPKPChallengeUserKey::Run, base::Unretained(impl_),
- scoped_refptr<ExtensionFunction>(this), callback,
- StringFromVector(params->challenge), params->register_key);
- base::PostTask(FROM_HERE, {content::BrowserThread::UI}, task);
+ base::OnceClosure task = base::BindOnce(
+ &EPKPChallengeKey::Run, base::Unretained(&impl_),
+ chromeos::attestation::KEY_USER, scoped_refptr<ExtensionFunction>(this),
+ std::move(callback), StringFromVector(params->challenge),
+ params->register_key);
+ base::PostTask(FROM_HERE, {content::BrowserThread::UI}, std::move(task));
return RespondLater();
}
void EnterprisePlatformKeysChallengeUserKeyFunction::OnChallengedKey(
- bool success,
- const std::string& data) {
- if (success) {
- Respond(ArgumentList(
- api_epk::ChallengeUserKey::Results::Create(VectorFromString(data))));
+ const chromeos::attestation::TpmChallengeKeyResult& result) {
+ if (result.is_success) {
+ Respond(ArgumentList(api_epk::ChallengeUserKey::Results::Create(
+ VectorFromString(result.data))));
} else {
- Respond(Error(data));
+ Respond(Error(result.error_message));
}
}
diff --git a/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h b/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h
index 9ec384a2ef3..598990b14ed 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h
+++ b/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h
@@ -15,8 +15,8 @@
namespace net {
class X509Certificate;
-typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
-}
+using CertificateList = std::vector<scoped_refptr<X509Certificate>>;
+} // namespace net
namespace extensions {
@@ -96,20 +96,16 @@ class EnterprisePlatformKeysChallengeMachineKeyFunction
: public ExtensionFunction {
public:
EnterprisePlatformKeysChallengeMachineKeyFunction();
- explicit EnterprisePlatformKeysChallengeMachineKeyFunction(
- EPKPChallengeMachineKey* impl_for_testing);
private:
~EnterprisePlatformKeysChallengeMachineKeyFunction() override;
ResponseAction Run() override;
- // Called when the challenge operation is complete. If the operation succeeded
- // |success| will be true and |data| will contain the challenge response data.
- // Otherwise |success| will be false and |data| is an error message.
- void OnChallengedKey(bool success, const std::string& data);
+ // Called when the challenge operation is complete.
+ void OnChallengedKey(
+ const chromeos::attestation::TpmChallengeKeyResult& result);
- std::unique_ptr<EPKPChallengeMachineKey> default_impl_;
- EPKPChallengeMachineKey* impl_;
+ EPKPChallengeKey impl_;
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeMachineKey",
ENTERPRISE_PLATFORMKEYS_CHALLENGEMACHINEKEY)
@@ -119,20 +115,16 @@ class EnterprisePlatformKeysChallengeUserKeyFunction
: public ExtensionFunction {
public:
EnterprisePlatformKeysChallengeUserKeyFunction();
- explicit EnterprisePlatformKeysChallengeUserKeyFunction(
- EPKPChallengeUserKey* impl_for_testing);
private:
~EnterprisePlatformKeysChallengeUserKeyFunction() override;
ResponseAction Run() override;
- // Called when the challenge operation is complete. If the operation succeeded
- // |success| will be true and |data| will contain the challenge response data.
- // Otherwise |success| will be false and |data| is an error message.
- void OnChallengedKey(bool success, const std::string& data);
+ // Called when the challenge operation is complete.
+ void OnChallengedKey(
+ const chromeos::attestation::TpmChallengeKeyResult& result);
- std::unique_ptr<EPKPChallengeUserKey> default_impl_;
- EPKPChallengeUserKey* impl_;
+ EPKPChallengeKey impl_;
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeUserKey",
ENTERPRISE_PLATFORMKEYS_CHALLENGEUSERKEY)
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 bffca7db092..386feaea2a6 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
@@ -4,170 +4,71 @@
#include "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h"
-#include <string>
+#include <utility>
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/memory/ptr_util.h"
-#include "base/strings/stringprintf.h"
-#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
+#include "chrome/browser/chromeos/attestation/mock_tpm_challenge_key.h"
#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/extensions/extension_function_test_utils.h"
#include "chrome/browser/signin/identity_manager_factory.h"
-#include "chrome/browser/ui/browser.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
-#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
-#include "chromeos/attestation/mock_attestation_flow.h"
-#include "chromeos/cryptohome/async_method_caller.h"
-#include "chromeos/cryptohome/cryptohome_parameters.h"
-#include "chromeos/cryptohome/mock_async_method_caller.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/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"
+#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/user_manager/scoped_user_manager.h"
#include "extensions/common/extension_builder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/cros_system_api/dbus/service_constants.h"
-using testing::_;
using testing::Invoke;
using testing::NiceMock;
-using testing::Return;
-using testing::WithArgs;
namespace utils = extension_function_test_utils;
namespace extensions {
namespace {
-// Certificate errors as reported to the calling extension.
-const int kDBusError = 1;
-const int kUserRejected = 2;
-const int kGetCertificateFailed = 3;
-const int kResetRequired = 4;
-
const char kUserEmail[] = "test@google.com";
-void RegisterKeyCallbackTrue(
- chromeos::attestation::AttestationKeyType key_type,
- const cryptohome::Identification& user_id,
- const std::string& key_name,
- const cryptohome::AsyncMethodCaller::Callback& callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, true, cryptohome::MOUNT_ERROR_NONE));
-}
-
-void RegisterKeyCallbackFalse(
- chromeos::attestation::AttestationKeyType key_type,
- const cryptohome::Identification& user_id,
- const std::string& key_name,
- const cryptohome::AsyncMethodCaller::Callback& callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, false, cryptohome::MOUNT_ERROR_NONE));
-}
-
-void SignChallengeCallbackTrue(
- chromeos::attestation::AttestationKeyType key_type,
- const cryptohome::Identification& user_id,
- const std::string& key_name,
- const std::string& domain,
- const std::string& device_id,
- chromeos::attestation::AttestationChallengeOptions options,
- const std::string& challenge,
- const std::string& key_name_for_spkac,
- const cryptohome::AsyncMethodCaller::DataCallback& callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, true, "response"));
-}
-
-void SignChallengeCallbackFalse(
+void FakeRunCheckNotRegister(
chromeos::attestation::AttestationKeyType key_type,
- const cryptohome::Identification& user_id,
- const std::string& key_name,
- const std::string& domain,
- const std::string& device_id,
- chromeos::attestation::AttestationChallengeOptions options,
+ Profile* profile,
+ chromeos::attestation::TpmChallengeKeyCallback callback,
const std::string& challenge,
- const std::string& key_name_for_spkac,
- const cryptohome::AsyncMethodCaller::DataCallback& callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, false, ""));
-}
-
-void GetCertificateCallbackTrue(
- chromeos::attestation::AttestationCertificateProfile certificate_profile,
- const AccountId& account_id,
- const std::string& request_origin,
- bool force_new_key,
- const std::string& key_name,
- const chromeos::attestation::AttestationFlow::CertificateCallback&
- callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::BindOnce(callback, chromeos::attestation::ATTESTATION_SUCCESS,
- "certificate"));
-}
-
-void GetCertificateCallbackFalse(
- chromeos::attestation::AttestationCertificateProfile certificate_profile,
- const AccountId& account_id,
- const std::string& request_origin,
- bool force_new_key,
- const std::string& key_name,
- const chromeos::attestation::AttestationFlow::CertificateCallback&
- callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::BindOnce(callback,
- chromeos::attestation::ATTESTATION_UNSPECIFIED_FAILURE,
- ""));
+ bool register_key,
+ const std::string& key_name_for_spkac) {
+ EXPECT_FALSE(register_key);
+ std::move(callback).Run(
+ chromeos::attestation::TpmChallengeKeyResult::MakeResult("response"));
}
class EPKChallengeKeyTestBase : public BrowserWithTestWindowTest {
protected:
EPKChallengeKeyTestBase()
- : settings_helper_(false),
- extension_(ExtensionBuilder("Test").Build()),
+ : extension_(ExtensionBuilder("Test").Build()),
fake_user_manager_(new chromeos::FakeChromeUserManager),
user_manager_enabler_(base::WrapUnique(fake_user_manager_)) {
- // Set up the default behavior of mocks.
- ON_CALL(mock_async_method_caller_, TpmAttestationRegisterKey(_, _, _, _))
- .WillByDefault(Invoke(RegisterKeyCallbackTrue));
- ON_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _, _, _))
- .WillByDefault(Invoke(SignChallengeCallbackTrue));
- ON_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .WillByDefault(Invoke(GetCertificateCallbackTrue));
-
stub_install_attributes_.SetCloudManaged("google.com", "device_id");
-
- settings_helper_.ReplaceDeviceSettingsProviderWithStub();
- settings_helper_.SetBoolean(chromeos::kDeviceAttestationEnabled, true);
}
void SetUp() override {
BrowserWithTestWindowTest::SetUp();
-
- // Set the user preferences.
prefs_ = browser()->profile()->GetPrefs();
- base::ListValue whitelist;
- whitelist.AppendString(extension_->id());
- prefs_->Set(prefs::kAttestationExtensionWhitelist, whitelist);
-
SetAuthenticatedUser();
}
+ void SetMockTpmChallenger() {
+ auto mock_tpm_challenge_key = std::make_unique<
+ NiceMock<chromeos::attestation::MockTpmChallengeKey>>();
+ // Will be used with EXPECT_CALL.
+ mock_tpm_challenge_key_ = mock_tpm_challenge_key.get();
+ mock_tpm_challenge_key->EnableFake();
+ // transfer ownership inside factory
+ chromeos::attestation::TpmChallengeKeyFactory::SetForTesting(
+ std::move(mock_tpm_challenge_key));
+ }
+
// This will be called by BrowserWithTestWindowTest::SetUp();
TestingProfile* CreateProfile() override {
fake_user_manager_->AddUserWithAffiliation(
@@ -205,8 +106,8 @@ class EPKChallengeKeyTestBase : public BrowserWithTestWindowTest {
function->set_has_callback(true);
utils::RunFunction(function, std::move(args), browser,
extensions::api_test_utils::NONE);
- EXPECT_TRUE(function->GetError().empty()) << "Unexpected error: "
- << function->GetError();
+ EXPECT_TRUE(function->GetError().empty())
+ << "Unexpected error: " << function->GetError();
const base::Value* single_result = NULL;
if (function->GetResultList() != NULL &&
function->GetResultList()->Get(0, &single_result)) {
@@ -215,33 +116,27 @@ class EPKChallengeKeyTestBase : public BrowserWithTestWindowTest {
return NULL;
}
- chromeos::FakeCryptohomeClient cryptohome_client_;
- NiceMock<cryptohome::MockAsyncMethodCaller> mock_async_method_caller_;
- NiceMock<chromeos::attestation::MockAttestationFlow> mock_attestation_flow_;
- chromeos::ScopedCrosSettingsTestHelper settings_helper_;
scoped_refptr<const extensions::Extension> extension_;
chromeos::StubInstallAttributes stub_install_attributes_;
// fake_user_manager_ is owned by user_manager_enabler_.
- chromeos::FakeChromeUserManager* fake_user_manager_;
+ chromeos::FakeChromeUserManager* fake_user_manager_ = nullptr;
user_manager::ScopedUserManager user_manager_enabler_;
PrefService* prefs_ = nullptr;
+ chromeos::attestation::MockTpmChallengeKey* mock_tpm_challenge_key_ = nullptr;
};
class EPKChallengeMachineKeyTest : public EPKChallengeKeyTestBase {
protected:
EPKChallengeMachineKeyTest()
- : impl_(&cryptohome_client_,
- &mock_async_method_caller_,
- &mock_attestation_flow_,
- &stub_install_attributes_),
- func_(new EnterprisePlatformKeysChallengeMachineKeyFunction(&impl_)) {
+ : func_(new EnterprisePlatformKeysChallengeMachineKeyFunction()) {
func_->set_extension(extension_.get());
}
// Returns an error string for the given code.
std::string GetCertificateError(int error_code) {
return base::StringPrintf(
- EPKPChallengeMachineKey::kGetCertificateFailedError, error_code);
+ chromeos::attestation::TpmChallengeKeyImpl::kGetCertificateFailedError,
+ error_code);
}
std::unique_ptr<base::ListValue> CreateArgs() {
@@ -266,170 +161,51 @@ class EPKChallengeMachineKeyTest : public EPKChallengeKeyTestBase {
return args;
}
- EPKPChallengeMachineKey impl_;
scoped_refptr<EnterprisePlatformKeysChallengeMachineKeyFunction> func_;
base::ListValue args_;
};
-TEST_F(EPKChallengeMachineKeyTest, NonEnterpriseDevice) {
- stub_install_attributes_.SetConsumerOwned();
-
- EXPECT_EQ(EPKPChallengeMachineKey::kNonEnterpriseDeviceError,
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
TEST_F(EPKChallengeMachineKeyTest, ExtensionNotWhitelisted) {
base::ListValue empty_whitelist;
prefs_->Set(prefs::kAttestationExtensionWhitelist, empty_whitelist);
- EXPECT_EQ(EPKPChallengeKeyBase::kExtensionNotWhitelistedError,
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeMachineKeyTest, DevicePolicyDisabled) {
- settings_helper_.SetBoolean(chromeos::kDeviceAttestationEnabled, false);
-
- EXPECT_EQ(EPKPChallengeKeyBase::kDevicePolicyDisabledError,
+ EXPECT_EQ(EPKPChallengeKey::kExtensionNotWhitelistedError,
RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
}
-TEST_F(EPKChallengeMachineKeyTest, DoesKeyExistDbusFailed) {
- cryptohome_client_.set_tpm_attestation_does_key_exist_should_succeed(false);
-
- EXPECT_EQ(GetCertificateError(kDBusError),
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeMachineKeyTest, GetCertificateFailed) {
- EXPECT_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .WillRepeatedly(Invoke(GetCertificateCallbackFalse));
-
- EXPECT_EQ(GetCertificateError(kGetCertificateFailed),
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeMachineKeyTest, SignChallengeFailed) {
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _, _, _))
- .WillRepeatedly(Invoke(SignChallengeCallbackFalse));
-
- EXPECT_EQ(EPKPChallengeKeyBase::kSignChallengeFailedError,
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeMachineKeyTest, KeyRegistrationFailed) {
- EXPECT_CALL(mock_async_method_caller_, TpmAttestationRegisterKey(_, _, _, _))
- .WillRepeatedly(Invoke(RegisterKeyCallbackFalse));
-
- EXPECT_EQ(
- EPKPChallengeMachineKey::kKeyRegistrationFailedError,
- RunFunctionAndReturnError(func_.get(), CreateArgsRegister(), browser()));
-}
-
-TEST_F(EPKChallengeMachineKeyTest, KeyExists) {
- cryptohome_client_.SetTpmAttestationDeviceCertificate("attest-ent-machine",
- std::string());
-
- // GetCertificate must not be called if the key exists.
- EXPECT_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .Times(0);
-
- EXPECT_TRUE(utils::RunFunction(func_.get(), CreateArgs(), browser(),
- extensions::api_test_utils::NONE));
-}
-
-TEST_F(EPKChallengeMachineKeyTest, KeyNotRegisteredByDefault) {
- EXPECT_CALL(mock_async_method_caller_, TpmAttestationRegisterKey(_, _, _, _))
- .Times(0);
-
- EXPECT_TRUE(utils::RunFunction(func_.get(), CreateArgs(), browser(),
- extensions::api_test_utils::NONE));
-}
-
-TEST_F(EPKChallengeMachineKeyTest, KeyNotRegistered) {
- EXPECT_CALL(mock_async_method_caller_, TpmAttestationRegisterKey(_, _, _, _))
- .Times(0);
-
- EXPECT_TRUE(utils::RunFunction(func_.get(), CreateArgsNoRegister(), browser(),
- extensions::api_test_utils::NONE));
-}
-
TEST_F(EPKChallengeMachineKeyTest, Success) {
- // GetCertificate must be called exactly once.
- EXPECT_CALL(mock_attestation_flow_,
- GetCertificate(
- chromeos::attestation::PROFILE_ENTERPRISE_MACHINE_CERTIFICATE,
- _, _, _, _, _))
- .Times(1);
- // SignEnterpriseChallenge must be called exactly once.
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(
- chromeos::attestation::KEY_DEVICE,
- cryptohome::Identification(), "attest-ent-machine",
- "google.com", "device_id", _, "challenge", _, _))
- .Times(1);
+ SetMockTpmChallenger();
+
+ base::Value whitelist(base::Value::Type::LIST);
+ whitelist.Append(extension_->id());
+ prefs_->Set(prefs::kAttestationExtensionWhitelist, whitelist);
std::unique_ptr<base::Value> value(
RunFunctionAndReturnSingleResult(func_.get(), CreateArgs(), browser()));
ASSERT_TRUE(value->is_blob());
- EXPECT_EQ("response",
- std::string(value->GetBlob().begin(), value->GetBlob().end()));
+ std::string response(value->GetBlob().begin(), value->GetBlob().end());
+ EXPECT_EQ("response", response);
}
-TEST_F(EPKChallengeMachineKeyTest, KeyRegisteredSuccess) {
- std::string key_name_for_spkac = "attest-ent-machine-" + extension_->id();
- // GetCertificate must be called exactly once.
- EXPECT_CALL(mock_attestation_flow_,
- GetCertificate(
- chromeos::attestation::PROFILE_ENTERPRISE_MACHINE_CERTIFICATE,
- _, _, _, _, _))
- .Times(1);
- // TpmAttestationRegisterKey must be called exactly once.
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationRegisterKey(chromeos::attestation::KEY_DEVICE,
- _ /* Unused by the API. */,
- key_name_for_spkac, _))
- .Times(1);
- // SignEnterpriseChallenge must be called exactly once.
- EXPECT_CALL(
- mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(
- chromeos::attestation::KEY_DEVICE, cryptohome::Identification(),
- "attest-ent-machine", "google.com", "device_id", _, "challenge",
- key_name_for_spkac, _))
- .Times(1);
-
- std::unique_ptr<base::Value> value(RunFunctionAndReturnSingleResult(
- func_.get(), CreateArgsRegister(), browser()));
-
- ASSERT_TRUE(value->is_blob());
- EXPECT_EQ("response",
- std::string(value->GetBlob().begin(), value->GetBlob().end()));
-}
+TEST_F(EPKChallengeMachineKeyTest, KeyNotRegisteredByDefault) {
+ SetMockTpmChallenger();
-TEST_F(EPKChallengeMachineKeyTest, AttestationNotPrepared) {
- cryptohome_client_.set_tpm_attestation_is_prepared(false);
+ base::ListValue whitelist;
+ whitelist.AppendString(extension_->id());
+ prefs_->Set(prefs::kAttestationExtensionWhitelist, whitelist);
- EXPECT_EQ(GetCertificateError(kResetRequired),
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
+ EXPECT_CALL(*mock_tpm_challenge_key_, Run)
+ .WillOnce(Invoke(FakeRunCheckNotRegister));
-TEST_F(EPKChallengeMachineKeyTest, AttestationPreparedDbusFailed) {
- cryptohome_client_.SetServiceIsAvailable(false);
-
- EXPECT_EQ(GetCertificateError(kDBusError),
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
+ EXPECT_TRUE(utils::RunFunction(func_.get(), CreateArgs(), browser(),
+ extensions::api_test_utils::NONE));
}
class EPKChallengeUserKeyTest : public EPKChallengeKeyTestBase {
protected:
EPKChallengeUserKeyTest()
- : impl_(&cryptohome_client_,
- &mock_async_method_caller_,
- &mock_attestation_flow_,
- &stub_install_attributes_),
- func_(new EnterprisePlatformKeysChallengeUserKeyFunction(&impl_)) {
+ : func_(new EnterprisePlatformKeysChallengeUserKeyFunction()) {
func_->set_extension(extension_.get());
}
@@ -440,12 +216,6 @@ class EPKChallengeUserKeyTest : public EPKChallengeKeyTestBase {
prefs_->SetBoolean(prefs::kAttestationEnabled, true);
}
- // Returns an error string for the given code.
- std::string GetCertificateError(int error_code) {
- return base::StringPrintf(EPKPChallengeUserKey::kGetCertificateFailedError,
- error_code);
- }
-
std::unique_ptr<base::ListValue> CreateArgs() {
return CreateArgsInternal(true);
}
@@ -461,183 +231,15 @@ class EPKChallengeUserKeyTest : public EPKChallengeKeyTestBase {
return args;
}
- EPKPChallengeUserKey impl_;
+ EPKPChallengeKey impl_;
scoped_refptr<EnterprisePlatformKeysChallengeUserKeyFunction> func_;
};
-TEST_F(EPKChallengeUserKeyTest, UserPolicyDisabled) {
- prefs_->SetBoolean(prefs::kAttestationEnabled, false);
-
- EXPECT_EQ(EPKPChallengeUserKey::kUserPolicyDisabledError,
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
TEST_F(EPKChallengeUserKeyTest, ExtensionNotWhitelisted) {
base::ListValue empty_whitelist;
prefs_->Set(prefs::kAttestationExtensionWhitelist, empty_whitelist);
- EXPECT_EQ(EPKPChallengeKeyBase::kExtensionNotWhitelistedError,
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeUserKeyTest, DevicePolicyDisabled) {
- settings_helper_.SetBoolean(chromeos::kDeviceAttestationEnabled, false);
-
- EXPECT_EQ(EPKPChallengeKeyBase::kDevicePolicyDisabledError,
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeUserKeyTest, DoesKeyExistDbusFailed) {
- cryptohome_client_.set_tpm_attestation_does_key_exist_should_succeed(false);
-
- EXPECT_EQ(GetCertificateError(kDBusError),
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeUserKeyTest, GetCertificateFailed) {
- EXPECT_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .WillRepeatedly(Invoke(GetCertificateCallbackFalse));
-
- EXPECT_EQ(GetCertificateError(kGetCertificateFailed),
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeUserKeyTest, SignChallengeFailed) {
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _, _, _))
- .WillRepeatedly(Invoke(SignChallengeCallbackFalse));
-
- EXPECT_EQ(EPKPChallengeKeyBase::kSignChallengeFailedError,
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeUserKeyTest, KeyRegistrationFailed) {
- EXPECT_CALL(mock_async_method_caller_, TpmAttestationRegisterKey(_, _, _, _))
- .WillRepeatedly(Invoke(RegisterKeyCallbackFalse));
-
- EXPECT_EQ(EPKPChallengeUserKey::kKeyRegistrationFailedError,
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeUserKeyTest, KeyExists) {
- cryptohome_client_.SetTpmAttestationUserCertificate(
- cryptohome::CreateAccountIdentifierFromAccountId(
- AccountId::FromUserEmail(kUserEmail)),
- "attest-ent-user", std::string());
- // GetCertificate must not be called if the key exists.
- EXPECT_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .Times(0);
-
- EXPECT_TRUE(utils::RunFunction(func_.get(), CreateArgs(), browser(),
- extensions::api_test_utils::NONE));
-}
-
-TEST_F(EPKChallengeUserKeyTest, KeyNotRegistered) {
- EXPECT_CALL(mock_async_method_caller_, TpmAttestationRegisterKey(_, _, _, _))
- .Times(0);
-
- EXPECT_TRUE(utils::RunFunction(func_.get(), CreateArgsNoRegister(), browser(),
- extensions::api_test_utils::NONE));
-}
-
-TEST_F(EPKChallengeUserKeyTest, PersonalDevice) {
- stub_install_attributes_.SetConsumerOwned();
-
- // Currently personal devices are not supported.
- EXPECT_EQ(GetCertificateError(kUserRejected),
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeUserKeyTest, Success) {
- // GetCertificate must be called exactly once.
- EXPECT_CALL(
- mock_attestation_flow_,
- GetCertificate(chromeos::attestation::PROFILE_ENTERPRISE_USER_CERTIFICATE,
- _, _, _, _, _))
- .Times(1);
- const cryptohome::Identification cryptohome_id(
- AccountId::FromUserEmail(kUserEmail));
- // SignEnterpriseChallenge must be called exactly once.
- EXPECT_CALL(
- mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(
- chromeos::attestation::KEY_USER, cryptohome_id, "attest-ent-user",
- kUserEmail, "device_id", _, "challenge", _, _))
- .Times(1);
- // RegisterKey must be called exactly once.
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationRegisterKey(chromeos::attestation::KEY_USER,
- cryptohome_id, "attest-ent-user", _))
- .Times(1);
-
- std::unique_ptr<base::Value> value(
- RunFunctionAndReturnSingleResult(func_.get(), CreateArgs(), browser()));
-
- ASSERT_TRUE(value->is_blob());
- EXPECT_EQ("response",
- std::string(value->GetBlob().begin(), value->GetBlob().end()));
-}
-
-TEST_F(EPKChallengeUserKeyTest, AttestationNotPrepared) {
- cryptohome_client_.set_tpm_attestation_is_prepared(false);
-
- EXPECT_EQ(GetCertificateError(kResetRequired),
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-TEST_F(EPKChallengeUserKeyTest, AttestationPreparedDbusFailed) {
- cryptohome_client_.SetServiceIsAvailable(false);
-
- EXPECT_EQ(GetCertificateError(kDBusError),
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-class EPKChallengeMachineKeyUnmanagedUserTest
- : public EPKChallengeMachineKeyTest {
- protected:
- void SetAuthenticatedUser() override {
- signin::MakePrimaryAccountAvailable(
- IdentityManagerFactory::GetForProfile(browser()->profile()),
- account_id_.GetUserEmail());
- }
-
- TestingProfile* CreateProfile() override {
- fake_user_manager_->AddUser(account_id_);
- return profile_manager()->CreateTestingProfile(account_id_.GetUserEmail());
- }
-
- const std::string email = "test@chromium.com";
- const AccountId account_id_ =
- AccountId::FromUserEmailGaiaId(email,
- signin::GetTestGaiaIdForEmail(email));
-};
-
-TEST_F(EPKChallengeMachineKeyUnmanagedUserTest, UserNotManaged) {
- EXPECT_EQ(EPKPChallengeKeyBase::kUserNotManaged,
- RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
-}
-
-class EPKChallengeUserKeyUnmanagedUserTest : public EPKChallengeUserKeyTest {
- protected:
- void SetAuthenticatedUser() override {
- signin::MakePrimaryAccountAvailable(
- IdentityManagerFactory::GetForProfile(browser()->profile()),
- account_id_.GetUserEmail());
- }
-
- TestingProfile* CreateProfile() override {
- fake_user_manager_->AddUser(account_id_);
- return profile_manager()->CreateTestingProfile(account_id_.GetUserEmail());
- }
-
- const std::string email = "test@chromium.com";
- const AccountId account_id_ =
- AccountId::FromUserEmailGaiaId(email,
- signin::GetTestGaiaIdForEmail(email));
-};
-
-TEST_F(EPKChallengeUserKeyUnmanagedUserTest, UserNotManaged) {
- EXPECT_EQ(EPKPChallengeKeyBase::kUserNotManaged,
+ EXPECT_EQ(EPKPChallengeKey::kExtensionNotWhitelistedError,
RunFunctionAndReturnError(func_.get(), CreateArgs(), browser()));
}
diff --git a/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc b/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
index aa1e7cd62db..36988ba6dac 100644
--- a/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
+++ b/chromium/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
@@ -11,23 +11,18 @@
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
-#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "chrome/browser/extensions/api/platform_keys/platform_keys_test_base.h"
+#include "chrome/browser/extensions/policy_test_utils.h"
#include "chrome/browser/net/nss_context.h"
#include "chrome/common/chrome_paths.h"
-#include "components/policy/core/common/policy_map.h"
-#include "components/policy/policy_constants.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
#include "crypto/nss_util_internal.h"
#include "crypto/scoped_test_system_nss_key_slot.h"
#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/test_extension_registry_observer.h"
#include "net/cert/nss_cert_database.h"
-#include "net/test/embedded_test_server/http_request.h"
-#include "net/test/embedded_test_server/http_response.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -168,9 +163,7 @@ class EnterprisePlatformKeysTest
}
void SetUpOnMainThread() override {
- embedded_test_server()->RegisterRequestHandler(
- base::BindRepeating(&EnterprisePlatformKeysTest::InterceptMockHttp,
- base::Unretained(this)));
+ policy_test_utils::SetUpEmbeddedTestServer(embedded_test_server());
PlatformKeysTestBase::SetUpOnMainThread();
}
@@ -184,57 +177,7 @@ class EnterprisePlatformKeysTest
done_callback.Run();
}
- void SetPolicy() {
- // Extensions that are force-installed come from an update URL, which
- // defaults to the webstore. Use a mock URL for this test with an update
- // manifest that includes the crx file of the test extension.
- GURL update_manifest_url(
- embedded_test_server()->GetURL(kUpdateManifestPath));
-
- std::unique_ptr<base::ListValue> forcelist(new base::ListValue);
- forcelist->AppendString(base::StringPrintf(
- "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str()));
-
- policy::PolicyMap policy;
- policy.Set(policy::key::kExtensionInstallForcelist,
- policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE,
- policy::POLICY_SOURCE_CLOUD, std::move(forcelist), nullptr);
-
- // Set the policy and wait until the extension is installed.
- TestExtensionRegistryObserver observer(ExtensionRegistry::Get(profile()));
- mock_policy_provider()->UpdateChromePolicy(policy);
- observer.WaitForExtensionWillBeInstalled();
- }
-
private:
- // Replace "mock.http" with "127.0.0.1:<port>" on "update_manifest.xml" files.
- // Host resolver doesn't work here because the test file doesn't know the
- // correct port number.
- std::unique_ptr<net::test_server::HttpResponse> InterceptMockHttp(
- const net::test_server::HttpRequest& request) {
- const std::string kFileNameToIntercept = "update_manifest.xml";
- if (request.GetURL().ExtractFileName() != kFileNameToIntercept)
- return nullptr;
-
- base::FilePath test_data_dir;
- base::PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
- // Remove the leading '/'.
- std::string relative_manifest_path = request.GetURL().path().substr(1);
- std::string manifest_response;
- CHECK(base::ReadFileToString(test_data_dir.Append(relative_manifest_path),
- &manifest_response));
-
- base::ReplaceSubstringsAfterOffset(
- &manifest_response, 0, "mock.http",
- embedded_test_server()->host_port_pair().ToString());
-
- std::unique_ptr<net::test_server::BasicHttpResponse> response(
- new net::test_server::BasicHttpResponse());
- response->set_content_type("text/xml");
- response->set_content(manifest_response);
- return response;
- }
-
void PrepareTestSystemSlotOnIO(
crypto::ScopedTestSystemNSSKeySlot* system_slot) override {
// Import a private key to the system slot. The Javascript part of this
@@ -263,7 +206,9 @@ IN_PROC_BROWSER_TEST_P(EnterprisePlatformKeysTest, Basic) {
loop.QuitClosure()));
loop.Run();
}
- SetPolicy();
+ policy_test_utils::SetExtensionInstallForcelistPolicy(
+ kTestExtensionID, embedded_test_server()->GetURL(kUpdateManifestPath),
+ profile(), mock_policy_provider());
// By default, the system token is disabled.
std::string system_token_availability = "";
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 c68aaa5367b..a7dfd046ebb 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
@@ -4,44 +4,20 @@
#include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h"
-#include <string>
-#include <utility>
-
#include "base/base64.h"
#include "base/bind.h"
-#include "base/callback.h"
-#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "base/values.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/attestation/attestation_ca_client.h"
-#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
-#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/enterprise_platform_keys_private.h"
#include "chrome/common/pref_names.h"
-#include "chromeos/attestation/attestation_flow.h"
-#include "chromeos/cryptohome/async_method_caller.h"
-#include "chromeos/cryptohome/cryptohome_parameters.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"
-#include "chromeos/tpm/install_attributes.h"
-#include "components/account_id/account_id.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
-#include "components/user_manager/known_user.h"
-#include "components/user_manager/user.h"
-#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/common/manifest.h"
-#include "google_apis/gaia/gaia_auth_util.h"
-#include "third_party/cros_system_api/dbus/service_constants.h"
namespace {
// Prefix for naming machine keys used for SignedPublicKeyAndChallenge when
@@ -53,615 +29,68 @@ namespace extensions {
namespace api_epkp = api::enterprise_platform_keys_private;
-// Base class
-
-const char EPKPChallengeKeyBase::kChallengeBadBase64Error[] =
- "Challenge is not base64 encoded.";
-const char EPKPChallengeKeyBase::kDevicePolicyDisabledError[] =
- "Remote attestation is not enabled for your device.";
-const char EPKPChallengeKeyBase::kExtensionNotWhitelistedError[] =
- "The extension does not have permission to call this function.";
-const char EPKPChallengeKeyBase::kResponseBadBase64Error[] =
- "Response cannot be encoded in base64.";
-const char EPKPChallengeKeyBase::kSignChallengeFailedError[] =
- "Failed to sign the challenge.";
-const char EPKPChallengeKeyBase::kUserNotManaged[] =
- "The user account is not enterprise managed.";
-
-EPKPChallengeKeyBase::PrepareKeyContext::PrepareKeyContext(
- chromeos::attestation::AttestationKeyType key_type,
- const AccountId& account_id,
- const std::string& key_name,
- chromeos::attestation::AttestationCertificateProfile certificate_profile,
- bool require_user_consent,
- const std::string& key_name_for_spkac,
- const base::Callback<void(PrepareKeyResult)>& callback)
- : key_type(key_type),
- account_id(account_id),
- key_name(key_name),
- certificate_profile(certificate_profile),
- require_user_consent(require_user_consent),
- key_name_for_spkac(key_name_for_spkac),
- callback(callback) {}
-
-EPKPChallengeKeyBase::PrepareKeyContext::PrepareKeyContext(
- const PrepareKeyContext& other) = default;
-
-EPKPChallengeKeyBase::PrepareKeyContext::~PrepareKeyContext() {
-}
-
-EPKPChallengeKeyBase::EPKPChallengeKeyBase()
- : cryptohome_client_(chromeos::CryptohomeClient::Get()),
- async_caller_(cryptohome::AsyncMethodCaller::GetInstance()),
- install_attributes_(g_browser_process->platform_part()
- ->browser_policy_connector_chromeos()
- ->GetInstallAttributes()) {
- std::unique_ptr<chromeos::attestation::ServerProxy> ca_client(
- new chromeos::attestation::AttestationCAClient());
- default_attestation_flow_.reset(new chromeos::attestation::AttestationFlow(
- async_caller_, cryptohome_client_, std::move(ca_client)));
- attestation_flow_ = default_attestation_flow_.get();
-}
-
-EPKPChallengeKeyBase::EPKPChallengeKeyBase(
- chromeos::CryptohomeClient* cryptohome_client,
- cryptohome::AsyncMethodCaller* async_caller,
- chromeos::attestation::AttestationFlow* attestation_flow,
- chromeos::InstallAttributes* install_attributes) :
- cryptohome_client_(cryptohome_client),
- async_caller_(async_caller),
- attestation_flow_(attestation_flow),
- install_attributes_(install_attributes) {
-}
+EPKPChallengeKey::EPKPChallengeKey() = default;
+EPKPChallengeKey::~EPKPChallengeKey() = default;
-EPKPChallengeKeyBase::~EPKPChallengeKeyBase() {
-}
-
-void EPKPChallengeKeyBase::GetDeviceAttestationEnabled(
- const base::Callback<void(bool)>& callback) const {
- chromeos::CrosSettings* settings = chromeos::CrosSettings::Get();
- chromeos::CrosSettingsProvider::TrustedStatus status =
- settings->PrepareTrustedValues(
- base::Bind(&EPKPChallengeKeyBase::GetDeviceAttestationEnabled,
- base::Unretained(this), callback));
-
- bool value = false;
- switch (status) {
- case chromeos::CrosSettingsProvider::TRUSTED:
- if (!settings->GetBoolean(chromeos::kDeviceAttestationEnabled, &value))
- value = false;
- break;
- case chromeos::CrosSettingsProvider::TEMPORARILY_UNTRUSTED:
- // Do nothing. This function will be called again when the values are
- // ready.
- return;
- case chromeos::CrosSettingsProvider::PERMANENTLY_UNTRUSTED:
- // If the value cannot be trusted, we assume that the device attestation
- // is false to be on the safe side.
- break;
- }
-
- callback.Run(value);
+void EPKPChallengeKey::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+ registry->RegisterListPref(prefs::kAttestationExtensionWhitelist);
}
-bool EPKPChallengeKeyBase::IsEnterpriseDevice() const {
- return install_attributes_->IsEnterpriseManaged();
-}
+const char EPKPChallengeKey::kExtensionNotWhitelistedError[] =
+ "The extension does not have permission to call this function.";
+const char EPKPChallengeKey::kChallengeBadBase64Error[] =
+ "Challenge is not base64 encoded.";
-bool EPKPChallengeKeyBase::IsExtensionWhitelisted() const {
- if (!chromeos::ProfileHelper::Get()->GetUserByProfile(profile_)) {
+// Check if the extension is whitelisted in the user policy.
+bool EPKPChallengeKey::IsExtensionWhitelisted(
+ Profile* profile,
+ scoped_refptr<const Extension> extension) {
+ if (!chromeos::ProfileHelper::Get()->GetUserByProfile(profile)) {
// Only allow remote attestation for apps that were force-installed on the
// login/signin screen.
// TODO(drcrash): Use a separate device-wide policy for the API.
- return Manifest::IsPolicyLocation(extension_->location());
+ return Manifest::IsPolicyLocation(extension->location());
}
- if (Manifest::IsComponentLocation(extension_->location())) {
+ if (Manifest::IsComponentLocation(extension->location())) {
// Note: For this to even be called, the component extension must also be
// whitelisted in chrome/common/extensions/api/_permission_features.json
return true;
}
const base::ListValue* list =
- profile_->GetPrefs()->GetList(prefs::kAttestationExtensionWhitelist);
- base::Value value(extension_->id());
+ profile->GetPrefs()->GetList(prefs::kAttestationExtensionWhitelist);
+ base::Value value(extension->id());
return list->Find(value) != list->end();
}
-AccountId EPKPChallengeKeyBase::GetAccountId() const {
- const user_manager::User* user =
- chromeos::ProfileHelper::Get()->GetUserByProfile(profile_);
-
- // Signin profile doesn't have associated user.
- if (!user) {
- return EmptyAccountId();
- }
-
- return user->GetAccountId();
-}
-
-bool EPKPChallengeKeyBase::IsUserAffiliated() const {
- const user_manager::User* const user =
- user_manager::UserManager::Get()->FindUser(GetAccountId());
-
- if (user) {
- return user->IsAffiliated();
- }
-
- return false;
-}
-
-std::string EPKPChallengeKeyBase::GetEnterpriseDomain() const {
- return install_attributes_->GetDomain();
-}
-
-std::string EPKPChallengeKeyBase::GetUserEmail() const {
- return GetAccountId().GetUserEmail();
-}
-
-std::string EPKPChallengeKeyBase::GetDeviceId() const {
- return install_attributes_->GetDeviceId();
-}
-
-void EPKPChallengeKeyBase::PrepareKey(
- chromeos::attestation::AttestationKeyType key_type,
- const AccountId& account_id,
- const std::string& key_name,
- chromeos::attestation::AttestationCertificateProfile certificate_profile,
- bool require_user_consent,
- const std::string& key_name_for_spkac,
- const base::Callback<void(PrepareKeyResult)>& callback) {
- const PrepareKeyContext context =
- PrepareKeyContext(key_type, account_id, key_name, certificate_profile,
- require_user_consent, key_name_for_spkac, callback);
- cryptohome_client_->TpmAttestationIsPrepared(
- base::BindOnce(&EPKPChallengeKeyBase::IsAttestationPreparedCallback,
- base::Unretained(this), context));
-}
-
-void EPKPChallengeKeyBase::IsAttestationPreparedCallback(
- const PrepareKeyContext& context,
- base::Optional<bool> result) {
- if (!result.has_value()) {
- context.callback.Run(PREPARE_KEY_DBUS_ERROR);
- return;
- }
- if (!result.value()) {
- cryptohome_client_->TpmIsEnabled(
- base::BindOnce(&EPKPChallengeKeyBase::PrepareKeyErrorHandlerCallback,
- base::Unretained(this), context));
- return;
- }
-
- if (!context.key_name_for_spkac.empty()) {
- // Generate a new key and have it signed by PCA.
- attestation_flow_->GetCertificate(
- context.certificate_profile, context.account_id,
- std::string(), // Not used.
- true, // Force a new key to be generated.
- context.key_name_for_spkac,
- base::Bind(&EPKPChallengeKeyBase::GetCertificateCallback,
- base::Unretained(this), context.callback));
- return;
- }
- // Attestation is available, see if the key we need already exists.
- cryptohome_client_->TpmAttestationDoesKeyExist(
- context.key_type,
- cryptohome::CreateAccountIdentifierFromAccountId(context.account_id),
- context.key_name,
- base::BindOnce(&EPKPChallengeKeyBase::DoesKeyExistCallback,
- base::Unretained(this), context));
-}
-
-void EPKPChallengeKeyBase::PrepareKeyErrorHandlerCallback(
- const PrepareKeyContext& context,
- base::Optional<bool> is_tpm_enabled) {
- if (!is_tpm_enabled.has_value()) {
- context.callback.Run(PREPARE_KEY_DBUS_ERROR);
- return;
- }
-
- if (is_tpm_enabled.value()) {
- context.callback.Run(PREPARE_KEY_RESET_REQUIRED);
- } else {
- context.callback.Run(PREPARE_KEY_ATTESTATION_UNSUPPORTED);
- }
-}
-
-void EPKPChallengeKeyBase::DoesKeyExistCallback(
- const PrepareKeyContext& context,
- base::Optional<bool> result) {
- if (!result.has_value()) {
- context.callback.Run(PREPARE_KEY_DBUS_ERROR);
- return;
- }
-
- if (result.value()) {
- // The key exists. Do nothing more.
- context.callback.Run(PREPARE_KEY_OK);
- } else {
- // The key does not exist. Create a new key and have it signed by PCA.
- if (context.require_user_consent) {
- // We should ask the user explicitly before sending any private
- // information to PCA.
- AskForUserConsent(
- base::Bind(&EPKPChallengeKeyBase::AskForUserConsentCallback,
- base::Unretained(this), context));
- } else {
- // User consent is not required. Skip to the next step.
- AskForUserConsentCallback(context, true);
- }
- }
-}
-
-void EPKPChallengeKeyBase::AskForUserConsent(
- const base::Callback<void(bool)>& callback) const {
- // TODO(davidyu): right now we just simply reject the request before we have
- // a way to ask for user consent.
- callback.Run(false);
-}
-
-void EPKPChallengeKeyBase::AskForUserConsentCallback(
- const PrepareKeyContext& context,
- bool result) {
- if (!result) {
- // The user rejects the request.
- context.callback.Run(PREPARE_KEY_USER_REJECTED);
- return;
- }
-
- // Generate a new key and have it signed by PCA.
- attestation_flow_->GetCertificate(
- context.certificate_profile, context.account_id,
- std::string(), // Not used.
- true, // Force a new key to be generated.
- std::string(), // Leave key name empty to generate a default name.
- base::Bind(&EPKPChallengeKeyBase::GetCertificateCallback,
- base::Unretained(this), context.callback));
-}
-
-void EPKPChallengeKeyBase::GetCertificateCallback(
- const base::Callback<void(PrepareKeyResult)>& callback,
- chromeos::attestation::AttestationStatus status,
- const std::string& pem_certificate_chain) {
- if (status != chromeos::attestation::ATTESTATION_SUCCESS) {
- callback.Run(PREPARE_KEY_GET_CERTIFICATE_FAILED);
- return;
- }
-
- callback.Run(PREPARE_KEY_OK);
-}
-
-// Implementation of ChallengeMachineKey()
-
-const char EPKPChallengeMachineKey::kGetCertificateFailedError[] =
- "Failed to get Enterprise machine certificate. Error code = %d";
-const char EPKPChallengeMachineKey::kKeyRegistrationFailedError[] =
- "Machine key registration failed.";
-const char EPKPChallengeMachineKey::kNonEnterpriseDeviceError[] =
- "The device is not enterprise enrolled.";
-
-EPKPChallengeMachineKey::EPKPChallengeMachineKey() : EPKPChallengeKeyBase() {
-}
-
-EPKPChallengeMachineKey::EPKPChallengeMachineKey(
- chromeos::CryptohomeClient* cryptohome_client,
- cryptohome::AsyncMethodCaller* async_caller,
- chromeos::attestation::AttestationFlow* attestation_flow,
- chromeos::InstallAttributes* install_attributes) :
- EPKPChallengeKeyBase(cryptohome_client,
- async_caller,
- attestation_flow,
- install_attributes) {
-}
-
-EPKPChallengeMachineKey::~EPKPChallengeMachineKey() {
-}
-
-void EPKPChallengeMachineKey::Run(scoped_refptr<ExtensionFunction> caller,
- const ChallengeKeyCallback& callback,
- const std::string& challenge,
- bool register_key) {
- callback_ = callback;
- profile_ = ChromeExtensionFunctionDetails(caller.get()).GetProfile();
- extension_ = scoped_refptr<const Extension>(caller->extension());
-
- // Check if the device is enterprise enrolled.
- if (!IsEnterpriseDevice()) {
- callback_.Run(false, kNonEnterpriseDeviceError);
- return;
- }
-
- // Check if the extension is whitelisted in the user policy.
- if (!IsExtensionWhitelisted()) {
- callback_.Run(false, kExtensionNotWhitelistedError);
- return;
- }
-
- // Check whether the user is managed unless the signin profile is used.
- if (chromeos::ProfileHelper::Get()->GetUserByProfile(profile_) &&
- !IsUserAffiliated()) {
- callback_.Run(false, kUserNotManaged);
- return;
- }
-
- // Check if RA is enabled in the device policy.
- GetDeviceAttestationEnabled(
- base::Bind(&EPKPChallengeMachineKey::GetDeviceAttestationEnabledCallback,
- base::Unretained(this), challenge, register_key));
-}
-
-void EPKPChallengeMachineKey::DecodeAndRun(
+void EPKPChallengeKey::Run(
+ chromeos::attestation::AttestationKeyType type,
scoped_refptr<ExtensionFunction> caller,
- const ChallengeKeyCallback& callback,
- const std::string& encoded_challenge,
+ chromeos::attestation::TpmChallengeKeyCallback callback,
+ const std::string& challenge,
bool register_key) {
- std::string challenge;
- if (!base::Base64Decode(encoded_challenge, &challenge)) {
- callback.Run(false, kChallengeBadBase64Error);
- return;
- }
- Run(caller, callback, challenge, register_key);
-}
+ Profile* profile = ChromeExtensionFunctionDetails(caller.get()).GetProfile();
-void EPKPChallengeMachineKey::GetDeviceAttestationEnabledCallback(
- const std::string& challenge,
- bool register_key,
- bool enabled) {
- if (!enabled) {
- callback_.Run(false, kDevicePolicyDisabledError);
+ if (!IsExtensionWhitelisted(profile, caller->extension())) {
+ std::move(callback).Run(
+ chromeos::attestation::TpmChallengeKeyResult::MakeError(
+ kExtensionNotWhitelistedError));
return;
}
- // The EMK cannot be registered as that would relinquish it and the DMServer
- // relies on it to remain stable. If register_key = true, generate a new
- // machine key to side-load into the system-wide token. This key will be
- // used for SignedPublicKeyAndChallenge but the challenge response will still
- // be singed using the stable EMK.
std::string key_name_for_spkac;
- if (register_key) {
- key_name_for_spkac = kEnterpriseMachineKeyForSpkacPrefix + extension_->id();
- }
- PrepareKey(chromeos::attestation::KEY_DEVICE,
- EmptyAccountId(), // Not used.
- chromeos::attestation::kEnterpriseMachineKey,
- chromeos::attestation::PROFILE_ENTERPRISE_MACHINE_CERTIFICATE,
- false, // user consent is not required.
- key_name_for_spkac,
- base::Bind(&EPKPChallengeMachineKey::PrepareKeyCallback,
- base::Unretained(this), challenge, register_key,
- key_name_for_spkac));
-}
-
-void EPKPChallengeMachineKey::PrepareKeyCallback(
- const std::string& challenge,
- bool register_key,
- const std::string& key_name_for_spkac,
- PrepareKeyResult result) {
- if (result != PREPARE_KEY_OK) {
- callback_.Run(false,
- base::StringPrintf(kGetCertificateFailedError, result));
- return;
- }
-
- // Everything is checked. Sign the challenge.
- async_caller_->TpmAttestationSignEnterpriseChallenge(
- chromeos::attestation::KEY_DEVICE,
- cryptohome::Identification(), // Not used.
- chromeos::attestation::kEnterpriseMachineKey, GetEnterpriseDomain(),
- GetDeviceId(),
- register_key ? chromeos::attestation::CHALLENGE_INCLUDE_SIGNED_PUBLIC_KEY
- : chromeos::attestation::CHALLENGE_OPTION_NONE,
- challenge, key_name_for_spkac,
- base::Bind(&EPKPChallengeMachineKey::SignChallengeCallback,
- base::Unretained(this), register_key));
-}
-
-void EPKPChallengeMachineKey::SignChallengeCallback(
- bool register_key,
- bool success,
- const std::string& response) {
- if (!success) {
- callback_.Run(false, kSignChallengeFailedError);
- return;
- }
- if (register_key) {
- std::string key_name_for_spkac =
- kEnterpriseMachineKeyForSpkacPrefix + extension_->id();
- async_caller_->TpmAttestationRegisterKey(
- chromeos::attestation::KEY_DEVICE,
- cryptohome::Identification(), // Not used.
- key_name_for_spkac,
- base::Bind(&EPKPChallengeMachineKey::RegisterKeyCallback,
- base::Unretained(this), response));
- } else {
- RegisterKeyCallback(response, true, cryptohome::MOUNT_ERROR_NONE);
- }
-}
-
-void EPKPChallengeMachineKey::RegisterKeyCallback(
- const std::string& response,
- bool success,
- cryptohome::MountError return_code) {
- if (!success || return_code != cryptohome::MOUNT_ERROR_NONE) {
- callback_.Run(false, kKeyRegistrationFailedError);
- return;
- }
- callback_.Run(true, response);
-}
-
-// Implementation of ChallengeUserKey()
-
-const char EPKPChallengeUserKey::kGetCertificateFailedError[] =
- "Failed to get Enterprise user certificate. Error code = %d";
-const char EPKPChallengeUserKey::kKeyRegistrationFailedError[] =
- "Key registration failed.";
-const char EPKPChallengeUserKey::kUserPolicyDisabledError[] =
- "Remote attestation is not enabled for your account.";
-const char EPKPChallengeUserKey::kUserKeyNotAvailable[] =
- "User keys cannot be challenged in this profile.";
-
-EPKPChallengeUserKey::EPKPChallengeUserKey() : EPKPChallengeKeyBase() {
-}
-
-EPKPChallengeUserKey::EPKPChallengeUserKey(
- chromeos::CryptohomeClient* cryptohome_client,
- cryptohome::AsyncMethodCaller* async_caller,
- chromeos::attestation::AttestationFlow* attestation_flow,
- chromeos::InstallAttributes* install_attributes) :
- EPKPChallengeKeyBase(cryptohome_client,
- async_caller,
- attestation_flow,
- install_attributes) {
-}
-
-EPKPChallengeUserKey::~EPKPChallengeUserKey() {
-}
-
-void EPKPChallengeUserKey::RegisterProfilePrefs(
- user_prefs::PrefRegistrySyncable* registry) {
- registry->RegisterBooleanPref(prefs::kAttestationEnabled, false);
- registry->RegisterListPref(prefs::kAttestationExtensionWhitelist);
-}
-
-void EPKPChallengeUserKey::Run(scoped_refptr<ExtensionFunction> caller,
- const ChallengeKeyCallback& callback,
- const std::string& challenge,
- bool register_key) {
- callback_ = callback;
- profile_ = ChromeExtensionFunctionDetails(caller.get()).GetProfile();
- extension_ = scoped_refptr<const Extension>(caller->extension());
-
- // Check if user keys are available in this profile.
- if (!chromeos::ProfileHelper::Get()->GetUserByProfile(profile_)) {
- callback_.Run(false, EPKPChallengeUserKey::kUserKeyNotAvailable);
- return;
- }
-
- // Check if RA is enabled in the user policy.
- if (!IsRemoteAttestationEnabledForUser()) {
- callback_.Run(false, kUserPolicyDisabledError);
- return;
- }
-
- // Check if the extension is whitelisted in the user policy.
- if (!IsExtensionWhitelisted()) {
- callback_.Run(false, kExtensionNotWhitelistedError);
- return;
- }
-
- if (IsEnterpriseDevice()) {
- if (!IsUserAffiliated()) {
- callback_.Run(false, kUserNotManaged);
- return;
- }
-
- // Check if RA is enabled in the device policy.
- GetDeviceAttestationEnabled(
- base::Bind(&EPKPChallengeUserKey::GetDeviceAttestationEnabledCallback,
- base::Unretained(this), challenge, register_key,
- false)); // user consent is not required.
- } else {
- // For personal devices, we don't need to check if RA is enabled in the
- // device, but we need to ask for user consent if the key does not exist.
- GetDeviceAttestationEnabledCallback(challenge, register_key,
- true, // user consent is required.
- true); // attestation is enabled.
- }
-}
-
-void EPKPChallengeUserKey::DecodeAndRun(scoped_refptr<ExtensionFunction> caller,
- const ChallengeKeyCallback& callback,
- const std::string& encoded_challenge,
- bool register_key) {
- std::string challenge;
- if (!base::Base64Decode(encoded_challenge, &challenge)) {
- callback.Run(false, kChallengeBadBase64Error);
- return;
- }
- Run(caller, callback, challenge, register_key);
-}
-
-void EPKPChallengeUserKey::GetDeviceAttestationEnabledCallback(
- const std::string& challenge,
- bool register_key,
- bool require_user_consent,
- bool enabled) {
- if (!enabled) {
- callback_.Run(false, kDevicePolicyDisabledError);
- return;
- }
-
- PrepareKey(chromeos::attestation::KEY_USER, GetAccountId(),
- chromeos::attestation::kEnterpriseUserKey,
- chromeos::attestation::PROFILE_ENTERPRISE_USER_CERTIFICATE,
- require_user_consent, std::string() /* key_name_for_spkac */,
- base::Bind(&EPKPChallengeUserKey::PrepareKeyCallback,
- base::Unretained(this), challenge, register_key));
-}
-
-void EPKPChallengeUserKey::PrepareKeyCallback(const std::string& challenge,
- bool register_key,
- PrepareKeyResult result) {
- if (result != PREPARE_KEY_OK) {
- callback_.Run(false,
- base::StringPrintf(kGetCertificateFailedError, result));
- return;
- }
-
- // Everything is checked. Sign the challenge.
- async_caller_->TpmAttestationSignEnterpriseChallenge(
- chromeos::attestation::KEY_USER,
- cryptohome::Identification(GetAccountId()),
- chromeos::attestation::kEnterpriseUserKey, GetUserEmail(), GetDeviceId(),
- register_key ? chromeos::attestation::CHALLENGE_INCLUDE_SIGNED_PUBLIC_KEY
- : chromeos::attestation::CHALLENGE_OPTION_NONE,
- challenge, std::string() /* key_name_for_spkac */,
- base::Bind(&EPKPChallengeUserKey::SignChallengeCallback,
- base::Unretained(this), register_key));
-}
-
-void EPKPChallengeUserKey::SignChallengeCallback(bool register_key,
- bool success,
- const std::string& response) {
- if (!success) {
- callback_.Run(false, kSignChallengeFailedError);
- return;
- }
-
- if (register_key) {
- async_caller_->TpmAttestationRegisterKey(
- chromeos::attestation::KEY_USER,
- cryptohome::Identification(GetAccountId()),
- chromeos::attestation::kEnterpriseUserKey,
- base::Bind(&EPKPChallengeUserKey::RegisterKeyCallback,
- base::Unretained(this), response));
- } else {
- RegisterKeyCallback(response, true, cryptohome::MOUNT_ERROR_NONE);
+ if (register_key && (type == chromeos::attestation::KEY_DEVICE)) {
+ key_name_for_spkac =
+ kEnterpriseMachineKeyForSpkacPrefix + caller->extension()->id();
}
-}
-
-void EPKPChallengeUserKey::RegisterKeyCallback(
- const std::string& response,
- bool success,
- cryptohome::MountError return_code) {
- if (!success || return_code != cryptohome::MOUNT_ERROR_NONE) {
- callback_.Run(false, kKeyRegistrationFailedError);
- return;
- }
- callback_.Run(true, response);
-}
-bool EPKPChallengeUserKey::IsRemoteAttestationEnabledForUser() const {
- return profile_->GetPrefs()->GetBoolean(prefs::kAttestationEnabled);
+ impl_ = chromeos::attestation::TpmChallengeKeyFactory::Create();
+ impl_->Run(type, profile, std::move(callback), challenge, register_key,
+ key_name_for_spkac);
}
EnterprisePlatformKeysPrivateChallengeMachineKeyFunction::
- EnterprisePlatformKeysPrivateChallengeMachineKeyFunction()
- : default_impl_(new EPKPChallengeMachineKey), impl_(default_impl_.get()) {}
-
-EnterprisePlatformKeysPrivateChallengeMachineKeyFunction::
- EnterprisePlatformKeysPrivateChallengeMachineKeyFunction(
- EPKPChallengeMachineKey* impl_for_testing)
- : impl_(impl_for_testing) {}
+ EnterprisePlatformKeysPrivateChallengeMachineKeyFunction() = default;
EnterprisePlatformKeysPrivateChallengeMachineKeyFunction::
~EnterprisePlatformKeysPrivateChallengeMachineKeyFunction() = default;
@@ -671,41 +100,41 @@ EnterprisePlatformKeysPrivateChallengeMachineKeyFunction::Run() {
std::unique_ptr<api_epkp::ChallengeMachineKey::Params> params(
api_epkp::ChallengeMachineKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- ChallengeKeyCallback callback =
+ chromeos::attestation::TpmChallengeKeyCallback callback =
base::Bind(&EnterprisePlatformKeysPrivateChallengeMachineKeyFunction::
OnChallengedKey,
this);
+
+ std::string challenge;
+ if (!base::Base64Decode(params->challenge, &challenge)) {
+ return RespondNow(Error(EPKPChallengeKey::kChallengeBadBase64Error));
+ }
+
// base::Unretained is safe on impl_ since its life-cycle matches |this| and
// |callback| holds a reference to |this|.
- base::Closure task = base::Bind(&EPKPChallengeMachineKey::DecodeAndRun,
- base::Unretained(impl_),
- scoped_refptr<ExtensionFunction>(this),
- callback, params->challenge, false);
- base::PostTask(FROM_HERE, {content::BrowserThread::UI}, task);
+ base::OnceClosure task = base::BindOnce(
+ &EPKPChallengeKey::Run, base::Unretained(&impl_),
+ chromeos::attestation::KEY_DEVICE, scoped_refptr<ExtensionFunction>(this),
+ std::move(callback), challenge,
+ /*register_key=*/false);
+ base::PostTask(FROM_HERE, {content::BrowserThread::UI}, std::move(task));
return RespondLater();
}
void EnterprisePlatformKeysPrivateChallengeMachineKeyFunction::OnChallengedKey(
- bool success,
- const std::string& data) {
- if (success) {
+ const chromeos::attestation::TpmChallengeKeyResult& result) {
+ if (result.is_success) {
std::string encoded_response;
- base::Base64Encode(data, &encoded_response);
+ base::Base64Encode(result.data, &encoded_response);
Respond(ArgumentList(
api_epkp::ChallengeMachineKey::Results::Create(encoded_response)));
} else {
- Respond(Error(data));
+ Respond(Error(result.error_message));
}
}
EnterprisePlatformKeysPrivateChallengeUserKeyFunction::
- EnterprisePlatformKeysPrivateChallengeUserKeyFunction()
- : default_impl_(new EPKPChallengeUserKey), impl_(default_impl_.get()) {}
-
-EnterprisePlatformKeysPrivateChallengeUserKeyFunction::
- EnterprisePlatformKeysPrivateChallengeUserKeyFunction(
- EPKPChallengeUserKey* impl_for_testing)
- : impl_(impl_for_testing) {}
+ EnterprisePlatformKeysPrivateChallengeUserKeyFunction() = default;
EnterprisePlatformKeysPrivateChallengeUserKeyFunction::
~EnterprisePlatformKeysPrivateChallengeUserKeyFunction() = default;
@@ -715,29 +144,34 @@ EnterprisePlatformKeysPrivateChallengeUserKeyFunction::Run() {
std::unique_ptr<api_epkp::ChallengeUserKey::Params> params(
api_epkp::ChallengeUserKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- ChallengeKeyCallback callback = base::Bind(
+ chromeos::attestation::TpmChallengeKeyCallback callback = base::Bind(
&EnterprisePlatformKeysPrivateChallengeUserKeyFunction::OnChallengedKey,
this);
+
+ std::string challenge;
+ if (!base::Base64Decode(params->challenge, &challenge)) {
+ return RespondNow(Error(EPKPChallengeKey::kChallengeBadBase64Error));
+ }
+
// base::Unretained is safe on impl_ since its life-cycle matches |this| and
// |callback| holds a reference to |this|.
- base::Closure task =
- base::Bind(&EPKPChallengeUserKey::DecodeAndRun, base::Unretained(impl_),
- scoped_refptr<ExtensionFunction>(this), callback,
- params->challenge, params->register_key);
- base::PostTask(FROM_HERE, {content::BrowserThread::UI}, task);
+ base::OnceClosure task = base::BindOnce(
+ &EPKPChallengeKey::Run, base::Unretained(&impl_),
+ chromeos::attestation::KEY_USER, scoped_refptr<ExtensionFunction>(this),
+ std::move(callback), challenge, params->register_key);
+ base::PostTask(FROM_HERE, {content::BrowserThread::UI}, std::move(task));
return RespondLater();
}
void EnterprisePlatformKeysPrivateChallengeUserKeyFunction::OnChallengedKey(
- bool success,
- const std::string& data) {
- if (success) {
+ const chromeos::attestation::TpmChallengeKeyResult& result) {
+ if (result.is_success) {
std::string encoded_response;
- base::Base64Encode(data, &encoded_response);
+ base::Base64Encode(result.data, &encoded_response);
Respond(ArgumentList(
api_epkp::ChallengeUserKey::Results::Create(encoded_response)));
} else {
- Respond(Error(data));
+ Respond(Error(result.error_message));
}
}
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 e8e9fa09d43..82231173f06 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
@@ -11,272 +11,60 @@
#include <memory>
#include <string>
-#include "base/callback.h"
-#include "base/compiler_specific.h"
-#include "base/optional.h"
-#include "chrome/common/extensions/api/enterprise_platform_keys_private.h"
-#include "chromeos/attestation/attestation_flow.h"
+#include "chrome/browser/chromeos/attestation/tpm_challenge_key.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"
-#include "third_party/cros_system_api/dbus/service_constants.h"
class Profile;
-namespace chromeos {
-class CryptohomeClient;
-class InstallAttributes;
-}
-
-namespace cryptohome {
-class AsyncMethodCaller;
-}
-
namespace user_prefs {
class PrefRegistrySyncable;
}
namespace extensions {
-// A callback for challenge key operations. If the operation succeeded,
-// |success| is true and |data| is the challenge response. Otherwise, |success|
-// is false and |data| is an error message.
-using ChallengeKeyCallback =
- base::Callback<void(bool success, const std::string& data)>;
-
-class EPKPChallengeKeyBase {
+class EPKPChallengeKey {
public:
- static const char kChallengeBadBase64Error[];
- static const char kDevicePolicyDisabledError[];
static const char kExtensionNotWhitelistedError[];
- static const char kResponseBadBase64Error[];
- static const char kSignChallengeFailedError[];
- static const char kUserNotManaged[];
-
- protected:
- enum PrepareKeyResult {
- PREPARE_KEY_OK = 0,
- PREPARE_KEY_DBUS_ERROR,
- PREPARE_KEY_USER_REJECTED,
- PREPARE_KEY_GET_CERTIFICATE_FAILED,
- PREPARE_KEY_RESET_REQUIRED,
- PREPARE_KEY_ATTESTATION_UNSUPPORTED
- };
-
- EPKPChallengeKeyBase();
- EPKPChallengeKeyBase(
- chromeos::CryptohomeClient* cryptohome_client,
- cryptohome::AsyncMethodCaller* async_caller,
- chromeos::attestation::AttestationFlow* attestation_flow,
- chromeos::InstallAttributes* install_attributes);
- virtual ~EPKPChallengeKeyBase();
-
- // Returns a trusted value from CroSettings indicating if the device
- // attestation is enabled.
- void GetDeviceAttestationEnabled(
- const base::Callback<void(bool)>& callback) const;
-
- // Returns true if the device is enterprise managed.
- bool IsEnterpriseDevice() const;
-
- // Returns true if the extension is white-listed in the user policy.
- bool IsExtensionWhitelisted() const;
-
- // Returns true if the user is managed and is affiliated with the domain the
- // device is enrolled to.
- bool IsUserAffiliated() const;
-
- // Returns the enterprise domain the device is enrolled to.
- std::string GetEnterpriseDomain() const;
-
- // Returns the user email.
- std::string GetUserEmail() const;
-
- // Returns account id.
- AccountId GetAccountId() const;
-
- // Returns the enterprise virtual device ID.
- std::string GetDeviceId() const;
-
- // Prepares the key for signing. It will first check if a new key should be
- // generated, i.e. |key_name_for_spkac| is not empty or the key doesn't
- // exist and, if necessary, call AttestationFlow::GetCertificate() to get a
- // new one. If require_user_consent is true, it will explicitly ask for user
- // consent before calling GetCertificate().
- void PrepareKey(
- chromeos::attestation::AttestationKeyType key_type,
- const AccountId& account_id,
- const std::string& key_name,
- chromeos::attestation::AttestationCertificateProfile certificate_profile,
- bool require_user_consent,
- const std::string& key_name_for_spkac,
- const base::Callback<void(PrepareKeyResult)>& callback);
-
- chromeos::CryptohomeClient* cryptohome_client_;
- cryptohome::AsyncMethodCaller* async_caller_;
- chromeos::attestation::AttestationFlow* attestation_flow_;
- std::unique_ptr<chromeos::attestation::AttestationFlow>
- default_attestation_flow_;
- ChallengeKeyCallback callback_;
- Profile* profile_;
- scoped_refptr<const Extension> extension_;
-
- private:
- // Holds the context of a PrepareKey() operation.
- struct PrepareKeyContext {
- PrepareKeyContext(chromeos::attestation::AttestationKeyType key_type,
- const AccountId& account_id,
- const std::string& key_name,
- chromeos::attestation::AttestationCertificateProfile
- certificate_profile,
- bool require_user_consent,
- const std::string& key_name_for_spkac,
- const base::Callback<void(PrepareKeyResult)>& callback);
- PrepareKeyContext(const PrepareKeyContext& other);
- ~PrepareKeyContext();
-
- chromeos::attestation::AttestationKeyType key_type;
- const AccountId account_id;
- const std::string key_name;
- chromeos::attestation::AttestationCertificateProfile certificate_profile;
- bool require_user_consent;
- std::string key_name_for_spkac;
- const base::Callback<void(PrepareKeyResult)> callback;
- };
-
- void IsAttestationPreparedCallback(const PrepareKeyContext& context,
- base::Optional<bool> result);
- void PrepareKeyErrorHandlerCallback(const PrepareKeyContext& context,
- base::Optional<bool> is_tpm_enabled);
- void DoesKeyExistCallback(const PrepareKeyContext& context,
- base::Optional<bool> result);
- void AskForUserConsent(const base::Callback<void(bool)>& callback) const;
- void AskForUserConsentCallback(
- const PrepareKeyContext& context,
- bool result);
- void GetCertificateCallback(
- const base::Callback<void(PrepareKeyResult)>& callback,
- chromeos::attestation::AttestationStatus status,
- const std::string& pem_certificate_chain);
-
- chromeos::InstallAttributes* install_attributes_;
-};
-
-class EPKPChallengeMachineKey : public EPKPChallengeKeyBase {
- public:
- static const char kGetCertificateFailedError[];
- static const char kKeyRegistrationFailedError[];
- static const char kNonEnterpriseDeviceError[];
-
- EPKPChallengeMachineKey();
- EPKPChallengeMachineKey(
- chromeos::CryptohomeClient* cryptohome_client,
- cryptohome::AsyncMethodCaller* async_caller,
- chromeos::attestation::AttestationFlow* attestation_flow,
- chromeos::InstallAttributes* install_attributes);
- ~EPKPChallengeMachineKey() override;
-
- // Asynchronously run the flow to challenge a machine key in the |caller|
- // context.
- void Run(scoped_refptr<ExtensionFunction> caller,
- const ChallengeKeyCallback& callback,
- const std::string& encoded_challenge,
- bool register_key);
-
- // Like |Run| but expects a Base64 |encoded_challenge|.
- void DecodeAndRun(scoped_refptr<ExtensionFunction> caller,
- const ChallengeKeyCallback& callback,
- const std::string& encoded_challenge,
- bool register_key);
-
- private:
- static const char kKeyName[];
-
- void GetDeviceAttestationEnabledCallback(const std::string& challenge,
- bool register_key,
- bool enabled);
- void PrepareKeyCallback(const std::string& challenge,
- bool register_key,
- const std::string& key_name_for_spkac,
- PrepareKeyResult result);
- void SignChallengeCallback(bool register_key,
- bool success,
- const std::string& response);
- void RegisterKeyCallback(const std::string& response,
- bool success,
- cryptohome::MountError return_code);
-};
-
-class EPKPChallengeUserKey : public EPKPChallengeKeyBase {
- public:
- static const char kGetCertificateFailedError[];
- static const char kKeyRegistrationFailedError[];
- static const char kUserKeyNotAvailable[];
- static const char kUserPolicyDisabledError[];
-
- EPKPChallengeUserKey();
- EPKPChallengeUserKey(
- chromeos::CryptohomeClient* cryptohome_client,
- cryptohome::AsyncMethodCaller* async_caller,
- chromeos::attestation::AttestationFlow* attestation_flow,
- chromeos::InstallAttributes* install_attributes);
- ~EPKPChallengeUserKey() override;
+ static const char kChallengeBadBase64Error[];
+ EPKPChallengeKey();
+ EPKPChallengeKey(const EPKPChallengeKey&) = delete;
+ EPKPChallengeKey& operator=(const EPKPChallengeKey&) = delete;
+ ~EPKPChallengeKey();
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
- // Asynchronously run the flow to challenge a user key in the |caller|
+ // Asynchronously run the flow to challenge a key in the |caller|
// context.
- void Run(scoped_refptr<ExtensionFunction> caller,
- const ChallengeKeyCallback& callback,
+ void Run(chromeos::attestation::AttestationKeyType type,
+ scoped_refptr<ExtensionFunction> caller,
+ chromeos::attestation::TpmChallengeKeyCallback callback,
const std::string& challenge,
bool register_key);
- // Like |Run| but expects a Base64 |encoded_challenge|.
- void DecodeAndRun(scoped_refptr<ExtensionFunction> caller,
- const ChallengeKeyCallback& callback,
- const std::string& encoded_challenge,
- bool register_key);
-
private:
- static const char kKeyName[];
-
- void GetDeviceAttestationEnabledCallback(const std::string& challenge,
- bool register_key,
- bool require_user_consent,
- bool enabled);
- void PrepareKeyCallback(const std::string& challenge,
- bool register_key,
- PrepareKeyResult result);
- void SignChallengeCallback(bool register_key,
- bool success,
- const std::string& response);
- void RegisterKeyCallback(const std::string& response,
- bool success,
- cryptohome::MountError return_code);
+ // Check if the extension is whitelisted in the user policy.
+ bool IsExtensionWhitelisted(Profile* profile,
+ scoped_refptr<const Extension> extension);
- bool IsRemoteAttestationEnabledForUser() const;
+ std::unique_ptr<chromeos::attestation::TpmChallengeKey> impl_;
};
class EnterprisePlatformKeysPrivateChallengeMachineKeyFunction
: public ExtensionFunction {
public:
EnterprisePlatformKeysPrivateChallengeMachineKeyFunction();
- explicit EnterprisePlatformKeysPrivateChallengeMachineKeyFunction(
- EPKPChallengeMachineKey* impl_for_testing);
private:
~EnterprisePlatformKeysPrivateChallengeMachineKeyFunction() override;
ResponseAction Run() override;
- // Called when the challenge operation is complete. If the operation succeeded
- // |success| will be true and |data| will contain the challenge response data.
- // Otherwise |success| will be false and |data| is an error message.
- void OnChallengedKey(bool success, const std::string& data);
+ // Called when the challenge operation is complete.
+ void OnChallengedKey(
+ const chromeos::attestation::TpmChallengeKeyResult& result);
- std::unique_ptr<EPKPChallengeMachineKey> default_impl_;
- EPKPChallengeMachineKey* impl_;
+ EPKPChallengeKey impl_;
DECLARE_EXTENSION_FUNCTION(
"enterprise.platformKeysPrivate.challengeMachineKey",
@@ -287,20 +75,16 @@ class EnterprisePlatformKeysPrivateChallengeUserKeyFunction
: public ExtensionFunction {
public:
EnterprisePlatformKeysPrivateChallengeUserKeyFunction();
- explicit EnterprisePlatformKeysPrivateChallengeUserKeyFunction(
- EPKPChallengeUserKey* impl_for_testing);
private:
~EnterprisePlatformKeysPrivateChallengeUserKeyFunction() override;
ResponseAction Run() override;
- // Called when the challenge operation is complete. If the operation succeeded
- // |success| will be true and |data| will contain the challenge response data.
- // Otherwise |success| will be false and |data| is an error message.
- void OnChallengedKey(bool success, const std::string& data);
+ // Called when the challenge operation is complete.
+ void OnChallengedKey(
+ const chromeos::attestation::TpmChallengeKeyResult& result);
- std::unique_ptr<EPKPChallengeUserKey> default_impl_;
- EPKPChallengeUserKey* impl_;
+ EPKPChallengeKey impl_;
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeysPrivate.challengeUserKey",
ENTERPRISE_PLATFORMKEYSPRIVATE_CHALLENGEUSERKEY)
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 6230610cb4a..db219faef44 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
@@ -4,206 +4,59 @@
#include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h"
-#include <string>
+#include <utility>
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/memory/ptr_util.h"
-#include "base/strings/stringprintf.h"
-#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
+#include "chrome/browser/chromeos/attestation/mock_tpm_challenge_key.h"
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
-#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/extensions/extension_function_test_utils.h"
#include "chrome/browser/signin/identity_manager_factory.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
-#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
-#include "chromeos/attestation/mock_attestation_flow.h"
-#include "chromeos/cryptohome/async_method_caller.h"
-#include "chromeos/cryptohome/cryptohome_parameters.h"
-#include "chromeos/cryptohome/mock_async_method_caller.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"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/user_manager/scoped_user_manager.h"
#include "extensions/common/extension_builder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/cros_system_api/dbus/service_constants.h"
-using testing::_;
-using testing::Invoke;
using testing::NiceMock;
-using testing::Return;
-using testing::WithArgs;
namespace utils = extension_function_test_utils;
namespace extensions {
namespace {
-// Certificate errors as reported to the calling extension.
-const int kDBusError = 1;
-const int kUserRejected = 2;
-const int kGetCertificateFailed = 3;
-const int kResetRequired = 4;
-const int kPrepareKeyAttestationUnsupported = 5;
-
const char kUserEmail[] = "test@google.com";
-void RegisterKeyCallbackTrue(
- chromeos::attestation::AttestationKeyType key_type,
- const cryptohome::Identification& user_id,
- const std::string& key_name,
- const cryptohome::AsyncMethodCaller::Callback& callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, true, cryptohome::MOUNT_ERROR_NONE));
-}
-
-void RegisterKeyCallbackFalse(
- chromeos::attestation::AttestationKeyType key_type,
- const cryptohome::Identification& user_id,
- const std::string& key_name,
- const cryptohome::AsyncMethodCaller::Callback& callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, false, cryptohome::MOUNT_ERROR_NONE));
-}
-
-void SignChallengeCallbackTrue(
- chromeos::attestation::AttestationKeyType key_type,
- const cryptohome::Identification& user_id,
- const std::string& key_name,
- const std::string& domain,
- const std::string& device_id,
- chromeos::attestation::AttestationChallengeOptions options,
- const std::string& challenge,
- const std::string& key_name_for_spkac,
- const cryptohome::AsyncMethodCaller::DataCallback& callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, true, "response"));
-}
-
-void SignChallengeCallbackFalse(
- chromeos::attestation::AttestationKeyType key_type,
- const cryptohome::Identification& user_id,
- const std::string& key_name,
- const std::string& domain,
- const std::string& device_id,
- chromeos::attestation::AttestationChallengeOptions options,
- const std::string& challenge,
- const std::string& key_name_for_spkac,
- const cryptohome::AsyncMethodCaller::DataCallback& callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, false, ""));
-}
-
-void GetCertificateCallbackTrue(
- chromeos::attestation::AttestationCertificateProfile certificate_profile,
- const AccountId& account_id,
- const std::string& request_origin,
- bool force_new_key,
- const std::string& key_name,
- const chromeos::attestation::AttestationFlow::CertificateCallback&
- callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::BindRepeating(callback, chromeos::attestation::ATTESTATION_SUCCESS,
- "certificate"));
-}
-
-void GetCertificateCallbackUnspecifiedFailure(
- chromeos::attestation::AttestationCertificateProfile certificate_profile,
- const AccountId& account_id,
- const std::string& request_origin,
- bool force_new_key,
- const std::string& key_name,
- const chromeos::attestation::AttestationFlow::CertificateCallback&
- callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::BindRepeating(
- callback, chromeos::attestation::ATTESTATION_UNSPECIFIED_FAILURE,
- ""));
-}
-
-void GetCertificateCallbackBadRequestFailure(
- chromeos::attestation::AttestationCertificateProfile certificate_profile,
- const AccountId& account_id,
- const std::string& request_origin,
- bool force_new_key,
- const std::string& key_name,
- const chromeos::attestation::AttestationFlow::CertificateCallback&
- callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::BindRepeating(
- callback,
- chromeos::attestation::ATTESTATION_SERVER_BAD_REQUEST_FAILURE, ""));
-}
-
class EPKPChallengeKeyTestBase : public BrowserWithTestWindowTest {
- public:
- enum class ProfileType { USER_PROFILE, SIGNIN_PROFILE };
-
protected:
- explicit EPKPChallengeKeyTestBase(ProfileType profile_type)
- : settings_helper_(false),
- profile_type_(profile_type),
- fake_user_manager_(new chromeos::FakeChromeUserManager),
+ EPKPChallengeKeyTestBase()
+ : fake_user_manager_(new chromeos::FakeChromeUserManager()),
user_manager_enabler_(base::WrapUnique(fake_user_manager_)) {
- // Create the extension.
- extension_ = CreateExtension();
-
- // Set up the default behavior of mocks.
- ON_CALL(mock_async_method_caller_, TpmAttestationRegisterKey(_, _, _, _))
- .WillByDefault(Invoke(RegisterKeyCallbackTrue));
- ON_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _, _, _))
- .WillByDefault(Invoke(SignChallengeCallbackTrue));
- ON_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .WillByDefault(Invoke(GetCertificateCallbackTrue));
-
- stub_install_attributes_.SetCloudManaged("google.com", "device_id");
-
- settings_helper_.ReplaceDeviceSettingsProviderWithStub();
- settings_helper_.SetBoolean(chromeos::kDeviceAttestationEnabled, true);
+ extension_ = ExtensionBuilder("Test").Build();
}
void SetUp() override {
BrowserWithTestWindowTest::SetUp();
- if (profile_type_ == ProfileType::USER_PROFILE) {
- // Set the user preferences.
- prefs_ = browser()->profile()->GetPrefs();
- base::ListValue whitelist;
- whitelist.AppendString(extension_->id());
- prefs_->Set(prefs::kAttestationExtensionWhitelist, whitelist);
-
- SetAuthenticatedUser();
- }
+ prefs_ = browser()->profile()->GetPrefs();
+ SetAuthenticatedUser();
+ }
+
+ void SetMockTpmChallenger() {
+ auto mock_tpm_challenge_key = std::make_unique<
+ NiceMock<chromeos::attestation::MockTpmChallengeKey>>();
+ mock_tpm_challenge_key->EnableFake();
+ chromeos::attestation::TpmChallengeKeyFactory::SetForTesting(
+ std::move(mock_tpm_challenge_key));
}
// This will be called by BrowserWithTestWindowTest::SetUp();
TestingProfile* CreateProfile() override {
- switch (profile_type_) {
- case ProfileType::USER_PROFILE:
- fake_user_manager_->AddUserWithAffiliation(
- AccountId::FromUserEmail(kUserEmail), true);
- return profile_manager()->CreateTestingProfile(kUserEmail);
-
- case ProfileType::SIGNIN_PROFILE:
- return profile_manager()->CreateTestingProfile(chrome::kInitialProfile);
- }
+ fake_user_manager_->AddUserWithAffiliation(
+ AccountId::FromUserEmail(kUserEmail), true);
+ return profile_manager()->CreateTestingProfile(kUserEmail);
}
// Derived classes can override this method to set the required authenticated
@@ -214,432 +67,90 @@ class EPKPChallengeKeyTestBase : public BrowserWithTestWindowTest {
signin::MakePrimaryAccountAvailable(identity_manager, kUserEmail);
}
- chromeos::FakeCryptohomeClient cryptohome_client_;
- NiceMock<cryptohome::MockAsyncMethodCaller> mock_async_method_caller_;
- NiceMock<chromeos::attestation::MockAttestationFlow> mock_attestation_flow_;
- chromeos::ScopedCrosSettingsTestHelper settings_helper_;
scoped_refptr<const Extension> extension_;
- chromeos::StubInstallAttributes stub_install_attributes_;
- ProfileType profile_type_;
// fake_user_manager_ is owned by user_manager_enabler_.
- chromeos::FakeChromeUserManager* fake_user_manager_;
+ chromeos::FakeChromeUserManager* fake_user_manager_ = nullptr;
user_manager::ScopedUserManager user_manager_enabler_;
PrefService* prefs_ = nullptr;
-
- private:
- scoped_refptr<const Extension> CreateExtension() {
- switch (profile_type_) {
- case ProfileType::USER_PROFILE:
- return ExtensionBuilder("Test").Build();
-
- case ProfileType::SIGNIN_PROFILE:
- return ExtensionBuilder("Test", ExtensionBuilder::Type::PLATFORM_APP)
- .SetLocation(Manifest::Location::EXTERNAL_POLICY)
- .Build();
- }
- }
};
class EPKPChallengeMachineKeyTest : public EPKPChallengeKeyTestBase {
protected:
- static const char kArgs[];
-
- explicit EPKPChallengeMachineKeyTest(
- ProfileType profile_type = ProfileType::USER_PROFILE)
- : EPKPChallengeKeyTestBase(profile_type),
- impl_(&cryptohome_client_,
- &mock_async_method_caller_,
- &mock_attestation_flow_,
- &stub_install_attributes_),
- func_(new EnterprisePlatformKeysPrivateChallengeMachineKeyFunction(
- &impl_)) {
- func_->set_extension(extension_.get());
- }
+ static const char kFuncArgs[];
- // Returns an error string for the given code.
- std::string GetCertificateError(int error_code) {
- return base::StringPrintf(
- EPKPChallengeMachineKey::kGetCertificateFailedError,
- error_code);
+ EPKPChallengeMachineKeyTest()
+ : func_(new EnterprisePlatformKeysPrivateChallengeMachineKeyFunction()) {
+ func_->set_extension(extension_.get());
}
- EPKPChallengeMachineKey impl_;
scoped_refptr<EnterprisePlatformKeysPrivateChallengeMachineKeyFunction> func_;
};
// Base 64 encoding of 'challenge'.
-const char EPKPChallengeMachineKeyTest::kArgs[] = "[\"Y2hhbGxlbmdl\"]";
-
-TEST_F(EPKPChallengeMachineKeyTest, ChallengeBadBase64) {
- EXPECT_EQ(EPKPChallengeKeyBase::kChallengeBadBase64Error,
- utils::RunFunctionAndReturnError(
- func_.get(), "[\"****\"]", browser()));
-}
-
-TEST_F(EPKPChallengeMachineKeyTest, NonEnterpriseDevice) {
- stub_install_attributes_.SetConsumerOwned();
-
- EXPECT_EQ(EPKPChallengeMachineKey::kNonEnterpriseDeviceError,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
+const char EPKPChallengeMachineKeyTest::kFuncArgs[] = "[\"Y2hhbGxlbmdl\"]";
TEST_F(EPKPChallengeMachineKeyTest, ExtensionNotWhitelisted) {
base::ListValue empty_whitelist;
prefs_->Set(prefs::kAttestationExtensionWhitelist, empty_whitelist);
- EXPECT_EQ(EPKPChallengeKeyBase::kExtensionNotWhitelistedError,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeMachineKeyTest, DevicePolicyDisabled) {
- settings_helper_.SetBoolean(chromeos::kDeviceAttestationEnabled, false);
-
- EXPECT_EQ(EPKPChallengeKeyBase::kDevicePolicyDisabledError,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
+ EXPECT_EQ(
+ EPKPChallengeKey::kExtensionNotWhitelistedError,
+ utils::RunFunctionAndReturnError(func_.get(), kFuncArgs, browser()));
}
-TEST_F(EPKPChallengeMachineKeyTest, DoesKeyExistDbusFailed) {
- cryptohome_client_.set_tpm_attestation_does_key_exist_should_succeed(false);
-
- EXPECT_EQ(GetCertificateError(kDBusError),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
+TEST_F(EPKPChallengeMachineKeyTest, Success) {
+ SetMockTpmChallenger();
-TEST_F(EPKPChallengeMachineKeyTest, GetCertificateFailed) {
- EXPECT_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .WillRepeatedly(Invoke(GetCertificateCallbackUnspecifiedFailure));
-
- EXPECT_EQ(GetCertificateError(kGetCertificateFailed),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeMachineKeyTest, SignChallengeFailed) {
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _, _, _))
- .WillRepeatedly(Invoke(SignChallengeCallbackFalse));
-
- EXPECT_EQ(EPKPChallengeKeyBase::kSignChallengeFailedError,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeMachineKeyTest, KeyExists) {
- cryptohome_client_.SetTpmAttestationDeviceCertificate("attest-ent-machine",
- std::string());
- // GetCertificate must not be called if the key exists.
- EXPECT_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .Times(0);
-
- EXPECT_TRUE(utils::RunFunction(func_.get(), kArgs, browser(),
- extensions::api_test_utils::NONE));
-}
-
-TEST_F(EPKPChallengeMachineKeyTest, AttestationNotPrepared) {
- cryptohome_client_.set_tpm_attestation_is_prepared(false);
-
- EXPECT_EQ(GetCertificateError(kResetRequired),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-// Test that we get proper error message in case we don't have TPM.
-TEST_F(EPKPChallengeMachineKeyTest, AttestationUnsupported) {
- cryptohome_client_.set_tpm_attestation_is_prepared(false);
- cryptohome_client_.set_tpm_is_enabled(false);
-
- EXPECT_EQ(GetCertificateError(kPrepareKeyAttestationUnsupported),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeMachineKeyTest, AttestationPreparedDbusFailed) {
- cryptohome_client_.SetServiceIsAvailable(false);
-
- EXPECT_EQ(GetCertificateError(kDBusError),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-// Tests the API with all profiles types as determined by the test parameter.
-class EPKPChallengeMachineKeyAllProfilesTest
- : public EPKPChallengeMachineKeyTest,
- public ::testing::WithParamInterface<
- EPKPChallengeKeyTestBase::ProfileType> {
- protected:
- EPKPChallengeMachineKeyAllProfilesTest()
- : EPKPChallengeMachineKeyTest(GetParam()) {}
-};
-
-TEST_P(EPKPChallengeMachineKeyAllProfilesTest, Success) {
- // GetCertificate must be called exactly once.
- EXPECT_CALL(mock_attestation_flow_,
- GetCertificate(
- chromeos::attestation::PROFILE_ENTERPRISE_MACHINE_CERTIFICATE,
- _, _, _, _, _))
- .Times(1);
- // SignEnterpriseChallenge must be called exactly once.
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(
- chromeos::attestation::KEY_DEVICE,
- cryptohome::Identification(), "attest-ent-machine",
- "google.com", "device_id", _, "challenge", _, _))
- .Times(1);
+ base::ListValue whitelist;
+ whitelist.AppendString(extension_->id());
+ prefs_->Set(prefs::kAttestationExtensionWhitelist, whitelist);
std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
- func_.get(), kArgs, browser(), extensions::api_test_utils::NONE));
+ func_.get(), kFuncArgs, browser(), extensions::api_test_utils::NONE));
std::string response;
value->GetAsString(&response);
EXPECT_EQ("cmVzcG9uc2U=" /* Base64 encoding of 'response' */, response);
}
-INSTANTIATE_TEST_SUITE_P(
- AllProfiles,
- EPKPChallengeMachineKeyAllProfilesTest,
- ::testing::Values(EPKPChallengeKeyTestBase::ProfileType::USER_PROFILE,
- EPKPChallengeKeyTestBase::ProfileType::SIGNIN_PROFILE));
-
class EPKPChallengeUserKeyTest : public EPKPChallengeKeyTestBase {
protected:
- static const char kArgs[];
-
- explicit EPKPChallengeUserKeyTest(
- ProfileType profile_type = ProfileType::USER_PROFILE)
- : EPKPChallengeKeyTestBase(profile_type),
- impl_(&cryptohome_client_,
- &mock_async_method_caller_,
- &mock_attestation_flow_,
- &stub_install_attributes_),
- func_(
- new EnterprisePlatformKeysPrivateChallengeUserKeyFunction(&impl_)) {
- func_->set_extension(extension_.get());
- }
+ static const char kFuncArgs[];
- void SetUp() override {
- EPKPChallengeKeyTestBase::SetUp();
-
- if (profile_type_ == ProfileType::USER_PROFILE) {
- // Set the user preferences.
- prefs_->SetBoolean(prefs::kAttestationEnabled, true);
- }
- }
-
- // Returns an error string for the given code.
- std::string GetCertificateError(int error_code) {
- return base::StringPrintf(EPKPChallengeUserKey::kGetCertificateFailedError,
- error_code);
+ EPKPChallengeUserKeyTest()
+ : func_(new EnterprisePlatformKeysPrivateChallengeUserKeyFunction()) {
+ func_->set_extension(extension_.get());
}
- EPKPChallengeUserKey impl_;
scoped_refptr<EnterprisePlatformKeysPrivateChallengeUserKeyFunction> func_;
};
-// Base 64 encoding of 'challenge'
-const char EPKPChallengeUserKeyTest::kArgs[] = "[\"Y2hhbGxlbmdl\", true]";
-
-TEST_F(EPKPChallengeUserKeyTest, ChallengeBadBase64) {
- EXPECT_EQ(EPKPChallengeKeyBase::kChallengeBadBase64Error,
- utils::RunFunctionAndReturnError(
- func_.get(), "[\"****\", true]", browser()));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, UserPolicyDisabled) {
- prefs_->SetBoolean(prefs::kAttestationEnabled, false);
-
- EXPECT_EQ(EPKPChallengeUserKey::kUserPolicyDisabledError,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
+// Base 64 encoding of 'challenge', register_key required.
+const char EPKPChallengeUserKeyTest::kFuncArgs[] = "[\"Y2hhbGxlbmdl\", true]";
TEST_F(EPKPChallengeUserKeyTest, ExtensionNotWhitelisted) {
base::ListValue empty_whitelist;
prefs_->Set(prefs::kAttestationExtensionWhitelist, empty_whitelist);
- EXPECT_EQ(EPKPChallengeKeyBase::kExtensionNotWhitelistedError,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, DevicePolicyDisabled) {
- settings_helper_.SetBoolean(chromeos::kDeviceAttestationEnabled, false);
-
- EXPECT_EQ(EPKPChallengeKeyBase::kDevicePolicyDisabledError,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, DoesKeyExistDbusFailed) {
- cryptohome_client_.set_tpm_attestation_does_key_exist_should_succeed(false);
-
- EXPECT_EQ(GetCertificateError(kDBusError),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, GetCertificateFailedWithUnspecifiedFailure) {
- EXPECT_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .WillRepeatedly(Invoke(GetCertificateCallbackUnspecifiedFailure));
-
- EXPECT_EQ(GetCertificateError(kGetCertificateFailed),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, GetCertificateFailedWithBadRequestFailure) {
- EXPECT_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .WillRepeatedly(Invoke(GetCertificateCallbackBadRequestFailure));
-
- EXPECT_EQ(GetCertificateError(kGetCertificateFailed),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, SignChallengeFailed) {
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _, _, _))
- .WillRepeatedly(Invoke(SignChallengeCallbackFalse));
-
- EXPECT_EQ(EPKPChallengeKeyBase::kSignChallengeFailedError,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, KeyRegistrationFailed) {
- EXPECT_CALL(mock_async_method_caller_, TpmAttestationRegisterKey(_, _, _, _))
- .WillRepeatedly(Invoke(RegisterKeyCallbackFalse));
-
- EXPECT_EQ(EPKPChallengeUserKey::kKeyRegistrationFailedError,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, KeyExists) {
- cryptohome_client_.SetTpmAttestationUserCertificate(
- cryptohome::CreateAccountIdentifierFromAccountId(
- AccountId::FromUserEmail(kUserEmail)),
- "attest-ent-user", std::string());
- // GetCertificate must not be called if the key exists.
- EXPECT_CALL(mock_attestation_flow_, GetCertificate(_, _, _, _, _, _))
- .Times(0);
-
- EXPECT_TRUE(utils::RunFunction(func_.get(), kArgs, browser(),
- extensions::api_test_utils::NONE));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, KeyNotRegistered) {
- EXPECT_CALL(mock_async_method_caller_, TpmAttestationRegisterKey(_, _, _, _))
- .Times(0);
-
- EXPECT_TRUE(utils::RunFunction(func_.get(), "[\"Y2hhbGxlbmdl\", false]",
- browser(), extensions::api_test_utils::NONE));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, PersonalDevice) {
- stub_install_attributes_.SetConsumerOwned();
-
- // Currently personal devices are not supported.
- EXPECT_EQ(GetCertificateError(kUserRejected),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
+ EXPECT_EQ(
+ EPKPChallengeKey::kExtensionNotWhitelistedError,
+ utils::RunFunctionAndReturnError(func_.get(), kFuncArgs, browser()));
}
TEST_F(EPKPChallengeUserKeyTest, Success) {
- // GetCertificate must be called exactly once.
- EXPECT_CALL(
- mock_attestation_flow_,
- GetCertificate(chromeos::attestation::PROFILE_ENTERPRISE_USER_CERTIFICATE,
- _, _, _, _, _))
- .Times(1);
- const AccountId account_id = AccountId::FromUserEmail(kUserEmail);
- // SignEnterpriseChallenge must be called exactly once.
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(
- chromeos::attestation::KEY_USER,
- cryptohome::Identification(account_id), "attest-ent-user",
- cryptohome::Identification(account_id).id(), "device_id", _,
- "challenge", _, _))
- .Times(1);
- // RegisterKey must be called exactly once.
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationRegisterKey(chromeos::attestation::KEY_USER,
- cryptohome::Identification(account_id),
- "attest-ent-user", _))
- .Times(1);
+ SetMockTpmChallenger();
+
+ base::ListValue whitelist;
+ whitelist.AppendString(extension_->id());
+ prefs_->Set(prefs::kAttestationExtensionWhitelist, whitelist);
std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
- func_.get(), kArgs, browser(), extensions::api_test_utils::NONE));
+ func_.get(), kFuncArgs, browser(), extensions::api_test_utils::NONE));
std::string response;
value->GetAsString(&response);
EXPECT_EQ("cmVzcG9uc2U=" /* Base64 encoding of 'response' */, response);
}
-TEST_F(EPKPChallengeUserKeyTest, AttestationNotPrepared) {
- cryptohome_client_.set_tpm_attestation_is_prepared(false);
-
- EXPECT_EQ(GetCertificateError(kResetRequired),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-TEST_F(EPKPChallengeUserKeyTest, AttestationPreparedDbusFailed) {
- cryptohome_client_.SetServiceIsAvailable(false);
-
- EXPECT_EQ(GetCertificateError(kDBusError),
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-class EPKPChallengeUserKeySigninProfileTest : public EPKPChallengeUserKeyTest {
- protected:
- EPKPChallengeUserKeySigninProfileTest()
- : EPKPChallengeUserKeyTest(ProfileType::SIGNIN_PROFILE) {}
-};
-
-TEST_F(EPKPChallengeUserKeySigninProfileTest, UserKeyNotAvailable) {
- settings_helper_.SetBoolean(chromeos::kDeviceAttestationEnabled, false);
-
- EXPECT_EQ(EPKPChallengeUserKey::kUserKeyNotAvailable,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-class EPKPChallengeMachineKeyUnmanagedUserTest
- : public EPKPChallengeMachineKeyTest {
- protected:
- void SetAuthenticatedUser() override {
- auto* identity_manager =
- IdentityManagerFactory::GetForProfile(browser()->profile());
- signin::MakePrimaryAccountAvailable(identity_manager,
- account_id_.GetUserEmail());
- }
-
- TestingProfile* CreateProfile() override {
- fake_user_manager_->AddUser(account_id_);
- return profile_manager()->CreateTestingProfile(account_id_.GetUserEmail());
- }
-
- private:
- const std::string kOtherEmail = "test@chromium.com";
- const AccountId account_id_ = AccountId::FromUserEmailGaiaId(
- kOtherEmail,
- signin::GetTestGaiaIdForEmail(kOtherEmail));
-};
-
-TEST_F(EPKPChallengeMachineKeyUnmanagedUserTest, UserNotManaged) {
- EXPECT_EQ(EPKPChallengeKeyBase::kUserNotManaged,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
-class EPKPChallengeUserKeyUnmanagedUserTest : public EPKPChallengeUserKeyTest {
- protected:
- void SetAuthenticatedUser() override {
- auto* identity_manager =
- IdentityManagerFactory::GetForProfile(browser()->profile());
- signin::MakePrimaryAccountAvailable(identity_manager,
- account_id_.GetUserEmail());
- }
-
- TestingProfile* CreateProfile() override {
- fake_user_manager_->AddUser(account_id_);
- return profile_manager()->CreateTestingProfile(account_id_.GetUserEmail());
- }
-
- private:
- const std::string kOtherEmail = "test@chromium.com";
- const AccountId account_id_ = AccountId::FromUserEmailGaiaId(
- kOtherEmail,
- signin::GetTestGaiaIdForEmail(kOtherEmail));
-};
-
-TEST_F(EPKPChallengeUserKeyUnmanagedUserTest, UserNotManaged) {
- EXPECT_EQ(EPKPChallengeKeyBase::kUserNotManaged,
- utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
-}
-
} // namespace
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chromium/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
index e8a2d2d10f7..f3052240da4 100644
--- a/chromium/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
@@ -38,6 +38,7 @@
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/overlay_window.h"
#include "content/public/browser/picture_in_picture_window_controller.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
diff --git a/chromium/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc b/chromium/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc
index 8fd11ee84dd..5d765101e1b 100644
--- a/chromium/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc
+++ b/chromium/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc
@@ -26,7 +26,6 @@
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
-#include "content/public/common/page_zoom.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/notification_types.h"
#include "extensions/common/extension.h"
@@ -34,6 +33,7 @@
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
+#include "third_party/blink/public/common/page/page_zoom.h"
#include "ui/base/buildflags.h"
#if defined(OS_WIN)
@@ -465,13 +465,13 @@ IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, PopupZoomsIndependently) {
content::HostZoomMap::GetForWebContents(popup_contents)
->GetDefaultZoomLevel();
double popup_zoom_level = content::HostZoomMap::GetZoomLevel(popup_contents);
- EXPECT_TRUE(content::ZoomValuesEqual(popup_zoom_level, default_zoom_level))
+ EXPECT_TRUE(blink::PageZoomValuesEqual(popup_zoom_level, default_zoom_level))
<< popup_zoom_level << " vs " << default_zoom_level;
// Preventing the use of the per-origin zoom level in the popup should not
// affect the zoom of the tab.
- EXPECT_TRUE(content::ZoomValuesEqual(zoom_controller->GetZoomLevel(),
- tab_new_zoom_level))
+ EXPECT_TRUE(blink::PageZoomValuesEqual(zoom_controller->GetZoomLevel(),
+ tab_new_zoom_level))
<< zoom_controller->GetZoomLevel() << " vs " << tab_new_zoom_level;
// Subsequent zooming in the tab should also be done independently of the
@@ -487,7 +487,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, PopupZoomsIndependently) {
zoom_change_watcher2.Wait();
popup_zoom_level = content::HostZoomMap::GetZoomLevel(popup_contents);
- EXPECT_TRUE(content::ZoomValuesEqual(popup_zoom_level, default_zoom_level))
+ EXPECT_TRUE(blink::PageZoomValuesEqual(popup_zoom_level, default_zoom_level))
<< popup_zoom_level << " vs " << default_zoom_level;
ClosePopup();
diff --git a/chromium/chrome/browser/extensions/api/file_system/file_system_apitest.cc b/chromium/chrome/browser/extensions/api/file_system/file_system_apitest.cc
index 0c5ea4b2b75..d624301ffc8 100644
--- a/chromium/chrome/browser/extensions/api/file_system/file_system_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/file_system/file_system_apitest.cc
@@ -33,7 +33,7 @@ class AppLoadObserver : public ExtensionRegistryObserver {
public:
AppLoadObserver(content::BrowserContext* browser_context,
base::Callback<void(const Extension*)> callback)
- : callback_(callback), extension_registry_observer_(this) {
+ : callback_(callback) {
extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context));
}
@@ -45,7 +45,7 @@ class AppLoadObserver : public ExtensionRegistryObserver {
private:
base::Callback<void(const Extension*)> callback_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(AppLoadObserver);
};
diff --git a/chromium/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc b/chromium/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
index 2b6050668d3..a3eab8edb33 100644
--- a/chromium/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
+++ b/chromium/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
@@ -144,16 +144,6 @@ class FileSystemApiTestForDrive : public PlatformAppBrowserTest {
// necessary because the fetch starts lazily upon the first read operation.
void SetUpOnMainThread() override {
PlatformAppBrowserTest::SetUpOnMainThread();
-
- if (!base::FeatureList::IsEnabled(chromeos::features::kDriveFs)) {
- std::unique_ptr<drive::ResourceEntry> entry;
- drive::FileError error = drive::FILE_ERROR_FAILED;
- integration_service_->file_system()->GetResourceEntry(
- base::FilePath::FromUTF8Unsafe("drive/root"), // whatever
- google_apis::test_util::CreateCopyResultCallback(&error, &entry));
- content::RunAllTasksUntilIdle();
- ASSERT_EQ(drive::FILE_ERROR_OK, error);
- }
}
void TearDown() override {
@@ -161,13 +151,7 @@ class FileSystemApiTestForDrive : public PlatformAppBrowserTest {
PlatformAppBrowserTest::TearDown();
}
- base::FilePath GetDriveMountPoint() {
- if (base::FeatureList::IsEnabled(chromeos::features::kDriveFs)) {
- return drivefs_mount_point_;
- } else {
- return drive::util::GetDriveMountPointPath(browser()->profile());
- }
- }
+ base::FilePath GetDriveMountPoint() { return drivefs_mount_point_; }
private:
drive::DriveIntegrationService* CreateDriveIntegrationService(
diff --git a/chromium/chrome/browser/extensions/api/history/history_api.cc b/chromium/chrome/browser/extensions/api/history/history_api.cc
index 010b8478e82..1692d8d951e 100644
--- a/chromium/chrome/browser/extensions/api/history/history_api.cc
+++ b/chromium/chrome/browser/extensions/api/history/history_api.cc
@@ -132,7 +132,7 @@ VisitItem GetVisitItem(const history::VisitRow& row) {
HistoryEventRouter::HistoryEventRouter(Profile* profile,
history::HistoryService* history_service)
- : profile_(profile), history_service_observer_(this) {
+ : profile_(profile) {
DCHECK(profile);
history_service_observer_.Add(history_service);
}
diff --git a/chromium/chrome/browser/extensions/api/history/history_api.h b/chromium/chrome/browser/extensions/api/history/history_api.h
index 5349fca6a52..8c3814eee95 100644
--- a/chromium/chrome/browser/extensions/api/history/history_api.h
+++ b/chromium/chrome/browser/extensions/api/history/history_api.h
@@ -13,6 +13,7 @@
#include "base/scoped_observer.h"
#include "base/task/cancelable_task_tracker.h"
#include "chrome/common/extensions/api/history.h"
+#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
@@ -24,10 +25,6 @@ namespace base {
class ListValue;
}
-namespace history {
-class HistoryService;
-}
-
namespace extensions {
// Observes History service and routes the notifications as events to the
@@ -55,7 +52,7 @@ class HistoryEventRouter : public history::HistoryServiceObserver {
Profile* profile_;
ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
- history_service_observer_;
+ history_service_observer_{this};
DISALLOW_COPY_AND_ASSIGN(HistoryEventRouter);
};
diff --git a/chromium/chrome/browser/extensions/api/identity/extension_token_key.cc b/chromium/chrome/browser/extensions/api/identity/extension_token_key.cc
index 08f81d01c1e..351ec13198d 100644
--- a/chromium/chrome/browser/extensions/api/identity/extension_token_key.cc
+++ b/chromium/chrome/browser/extensions/api/identity/extension_token_key.cc
@@ -9,7 +9,7 @@
namespace extensions {
ExtensionTokenKey::ExtensionTokenKey(const std::string& extension_id,
- const std::string& account_id,
+ const CoreAccountId& account_id,
const std::set<std::string>& scopes)
: extension_id(extension_id), account_id(account_id), scopes(scopes) {}
diff --git a/chromium/chrome/browser/extensions/api/identity/extension_token_key.h b/chromium/chrome/browser/extensions/api/identity/extension_token_key.h
index d722dee8a57..39c0a439a57 100644
--- a/chromium/chrome/browser/extensions/api/identity/extension_token_key.h
+++ b/chromium/chrome/browser/extensions/api/identity/extension_token_key.h
@@ -8,17 +8,19 @@
#include <set>
#include <string>
+#include "google_apis/gaia/core_account_id.h"
+
namespace extensions {
struct ExtensionTokenKey {
ExtensionTokenKey(const std::string& extension_id,
- const std::string& account_id,
+ const CoreAccountId& account_id,
const std::set<std::string>& scopes);
ExtensionTokenKey(const ExtensionTokenKey& other);
~ExtensionTokenKey();
bool operator<(const ExtensionTokenKey& rhs) const;
std::string extension_id;
- std::string account_id;
+ CoreAccountId account_id;
std::set<std::string> scopes;
};
diff --git a/chromium/chrome/browser/extensions/api/identity/extension_token_key_unittest.cc b/chromium/chrome/browser/extensions/api/identity/extension_token_key_unittest.cc
index aaedbd3bea4..cc2638bce5d 100644
--- a/chromium/chrome/browser/extensions/api/identity/extension_token_key_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/identity/extension_token_key_unittest.cc
@@ -26,9 +26,9 @@ TEST(IdentityExtensionTokenKeyTest, Ordering) {
extension_ids.push_back(extension_id1);
extension_ids.push_back(extension_id2);
- std::vector<std::string> user_ids;
- user_ids.push_back("user_id_1");
- user_ids.push_back("user_id_2");
+ std::vector<CoreAccountId> user_ids;
+ user_ids.push_back(CoreAccountId("user_id_1"));
+ user_ids.push_back(CoreAccountId("user_id_2"));
std::vector<std::set<std::string> > scopesets;
scopesets.push_back(scopes1);
@@ -40,7 +40,7 @@ TEST(IdentityExtensionTokenKeyTest, Ordering) {
ExtensionTokenKeyIterator;
std::vector<std::string>::const_iterator extension_it;
- std::vector<std::string>::const_iterator user_it;
+ std::vector<CoreAccountId>::const_iterator user_it;
std::vector<std::set<std::string> >::const_iterator scope_it;
for (extension_it = extension_ids.begin();
diff --git a/chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc b/chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc
index 63053cac503..f8677cb1515 100644
--- a/chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc
+++ b/chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc
@@ -30,13 +30,9 @@ GaiaWebAuthFlow::GaiaWebAuthFlow(Delegate* delegate,
: delegate_(delegate),
profile_(profile),
account_id_(token_key->account_id) {
- TRACE_EVENT_ASYNC_BEGIN2("identity",
- "GaiaWebAuthFlow",
- this,
- "extension_id",
- token_key->extension_id,
- "account_id",
- token_key->account_id);
+ TRACE_EVENT_ASYNC_BEGIN2("identity", "GaiaWebAuthFlow", this, "extension_id",
+ token_key->extension_id, "account_id",
+ token_key->account_id.id);
const char kOAuth2RedirectPathFormat[] = "/%s";
const char kOAuth2AuthorizeFormat[] =
diff --git a/chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h b/chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h
index 8ba5fa6780f..037ac0cd0b8 100644
--- a/chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h
+++ b/chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h
@@ -89,7 +89,7 @@ class GaiaWebAuthFlow : public WebAuthFlow::Delegate {
Delegate* delegate_;
Profile* profile_;
- std::string account_id_;
+ CoreAccountId account_id_;
std::string redirect_scheme_;
std::string redirect_path_prefix_;
GURL auth_url_;
diff --git a/chromium/chrome/browser/extensions/api/identity/identity_apitest.cc b/chromium/chrome/browser/extensions/api/identity/identity_apitest.cc
index ef79b4e60e5..9a1ff1ad423 100644
--- a/chromium/chrome/browser/extensions/api/identity/identity_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -485,7 +485,7 @@ class IdentityTestWithSignin : public AsyncExtensionBrowserTest {
protected:
// Returns the account ID of the created account.
- std::string SignIn(const std::string& email) {
+ CoreAccountId SignIn(const std::string& email) {
auto account_info = identity_test_env()->MakePrimaryAccountAvailable(email);
return account_info.account_id;
}
@@ -606,7 +606,7 @@ IN_PROC_BROWSER_TEST_F(IdentityGetAccountsFunctionTest, NoPrimaryAccount) {
IN_PROC_BROWSER_TEST_F(IdentityGetAccountsFunctionTest,
PrimaryAccountHasNoRefreshToken) {
- std::string primary_account_id = SignIn("primary@example.com");
+ CoreAccountId primary_account_id = SignIn("primary@example.com");
identity_test_env()->RemoveRefreshTokenForAccount(primary_account_id);
EXPECT_TRUE(ExpectGetAccounts({}));
}
@@ -776,7 +776,7 @@ class GetAuthTokenFunctionTest
return ext;
}
- std::string GetPrimaryAccountId() {
+ CoreAccountId GetPrimaryAccountId() {
return identity_test_env()->identity_manager()->GetPrimaryAccountId();
}
@@ -785,13 +785,14 @@ class GetAuthTokenFunctionTest
SetCachedTokenForAccount(GetPrimaryAccountId(), token_data);
}
- void SetCachedTokenForAccount(const std::string account_id,
+ void SetCachedTokenForAccount(const CoreAccountId account_id,
const IdentityTokenCacheValue& token_data) {
ExtensionTokenKey key(extension_id_, account_id, oauth_scopes_);
id_api()->SetCachedToken(key, token_data);
}
- const IdentityTokenCacheValue& GetCachedToken(const std::string& account_id) {
+ const IdentityTokenCacheValue& GetCachedToken(
+ const CoreAccountId& account_id) {
ExtensionTokenKey key(
extension_id_, account_id.empty() ? GetPrimaryAccountId() : account_id,
oauth_scopes_);
@@ -933,7 +934,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest,
EXPECT_FALSE(func->scope_ui_shown());
EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_ADVICE,
- GetCachedToken(std::string()).status());
+ GetCachedToken(CoreAccountId()).status());
}
IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest,
@@ -1019,7 +1020,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, NoOptionsSuccess) {
EXPECT_FALSE(func->login_ui_shown());
EXPECT_FALSE(func->scope_ui_shown());
EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_TOKEN,
- GetCachedToken(std::string()).status());
+ GetCachedToken(CoreAccountId()).status());
}
IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, NonInteractiveSuccess) {
@@ -1036,7 +1037,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, NonInteractiveSuccess) {
EXPECT_FALSE(func->login_ui_shown());
EXPECT_FALSE(func->scope_ui_shown());
EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_TOKEN,
- GetCachedToken(std::string()).status());
+ GetCachedToken(CoreAccountId()).status());
}
IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, InteractiveLoginCanceled) {
@@ -1310,7 +1311,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, InteractiveApprovalSuccess) {
EXPECT_TRUE(func->scope_ui_shown());
EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_TOKEN,
- GetCachedToken(std::string()).status());
+ GetCachedToken(CoreAccountId()).status());
}
#if !defined(OS_MACOSX)
@@ -1634,7 +1635,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, LoginInvalidatesTokenCache) {
EXPECT_TRUE(func->login_ui_shown());
EXPECT_TRUE(func->scope_ui_shown());
EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_NOTFOUND,
- GetCachedToken(std::string()).status());
+ GetCachedToken(CoreAccountId()).status());
}
#endif
@@ -1716,7 +1717,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest,
}
IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, ManuallyIssueToken) {
- std::string primary_account_id = SignIn("primary@example.com");
+ CoreAccountId primary_account_id = SignIn("primary@example.com");
scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction());
scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES));
@@ -1739,12 +1740,12 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, ManuallyIssueToken) {
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_TOKEN,
- GetCachedToken(std::string()).status());
+ GetCachedToken(CoreAccountId()).status());
EXPECT_EQ(primary_account_access_token, func->login_access_token());
}
IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, ManuallyIssueTokenFailure) {
- std::string primary_account_id = SignIn("primary@example.com");
+ CoreAccountId primary_account_id = SignIn("primary@example.com");
scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction());
scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES));
@@ -1772,7 +1773,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, ManuallyIssueTokenFailure) {
IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest,
MultiDefaultUserManuallyIssueToken) {
- std::string primary_account_id = SignIn("primary@example.com");
+ CoreAccountId primary_account_id = SignIn("primary@example.com");
identity_test_env()->MakeAccountAvailable("secondary@example.com");
scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction());
@@ -1794,13 +1795,13 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest,
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_TOKEN,
- GetCachedToken(std::string()).status());
+ GetCachedToken(CoreAccountId()).status());
EXPECT_EQ(primary_account_access_token, func->login_access_token());
}
IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest,
MultiPrimaryUserManuallyIssueToken) {
- std::string primary_account_id = SignIn("primary@example.com");
+ CoreAccountId primary_account_id = SignIn("primary@example.com");
identity_test_env()->MakeAccountAvailable("secondary@example.com");
scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction());
@@ -1824,7 +1825,7 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest,
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
EXPECT_EQ(IdentityTokenCacheValue::CACHE_STATUS_TOKEN,
- GetCachedToken(std::string()).status());
+ GetCachedToken(CoreAccountId()).status());
EXPECT_EQ(primary_account_access_token, func->login_access_token());
}
@@ -1834,8 +1835,8 @@ IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest,
if (id_api()->AreExtensionsRestrictedToPrimaryAccount())
return;
- std::string primary_account_id = SignIn("primary@example.com");
- std::string secondary_account_id =
+ SignIn("primary@example.com");
+ CoreAccountId secondary_account_id =
identity_test_env()
->MakeAccountAvailable("secondary@example.com")
.account_id;
@@ -2141,14 +2142,15 @@ class RemoveCachedAuthTokenFunctionTest : public ExtensionBrowserTest {
}
void SetCachedToken(const IdentityTokenCacheValue& token_data) {
- ExtensionTokenKey key(kExtensionId, "test@example.com",
+ ExtensionTokenKey key(kExtensionId, CoreAccountId("test@example.com"),
std::set<std::string>());
id_api()->SetCachedToken(key, token_data);
}
const IdentityTokenCacheValue& GetCachedToken() {
- return id_api()->GetCachedToken(ExtensionTokenKey(
- kExtensionId, "test@example.com", std::set<std::string>()));
+ return id_api()->GetCachedToken(
+ ExtensionTokenKey(kExtensionId, CoreAccountId("test@example.com"),
+ std::set<std::string>()));
}
};
@@ -2450,7 +2452,7 @@ IN_PROC_BROWSER_TEST_F(OnSignInChangedEventTest,
account_info.id = "gaia_id_for_primary_example.com";
AddExpectedEvent(api::identity::OnSignInChanged::Create(account_info, true));
- std::string primary_account_id = SignIn("primary@example.com");
+ CoreAccountId primary_account_id = SignIn("primary@example.com");
AddExpectedEvent(api::identity::OnSignInChanged::Create(account_info, false));
@@ -2468,7 +2470,7 @@ IN_PROC_BROWSER_TEST_F(OnSignInChangedEventTest,
account_info.id = "gaia_id_for_primary_example.com";
AddExpectedEvent(api::identity::OnSignInChanged::Create(account_info, true));
- std::string primary_account_id = SignIn("primary@example.com");
+ CoreAccountId primary_account_id = SignIn("primary@example.com");
AddExpectedEvent(api::identity::OnSignInChanged::Create(account_info, false));
identity_test_env()->RemoveRefreshTokenForAccount(primary_account_id);
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 1de99c202c3..5ef4deb52ad 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
@@ -14,6 +14,7 @@
#include "base/task/post_task.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/extensions/api/identity/identity_api.h"
#include "chrome/browser/extensions/api/identity/identity_constants.h"
#include "chrome/browser/profiles/profile.h"
@@ -76,7 +77,7 @@ IdentityGetAuthTokenFunction::IdentityGetAuthTokenFunction()
should_prompt_for_scopes_(false),
should_prompt_for_signin_(false),
token_key_(/*extension_id=*/std::string(),
- /*account_id=*/std::string(),
+ /*account_id=*/CoreAccountId(),
/*scopes=*/std::set<std::string>()),
scoped_identity_manager_observer_(this) {
}
@@ -205,7 +206,8 @@ void IdentityGetAuthTokenFunction::FetchExtensionAccountInfo(
void IdentityGetAuthTokenFunction::OnReceivedExtensionAccountInfo(
const CoreAccountInfo* account_info) {
- token_key_.account_id = account_info ? account_info->account_id : "";
+ token_key_.account_id =
+ account_info ? account_info->account_id : CoreAccountId();
#if defined(OS_CHROMEOS)
policy::BrowserPolicyConnectorChromeOS* connector =
@@ -675,7 +677,7 @@ void IdentityGetAuthTokenFunction::OnGetAccessTokenComplete(
if (access_token) {
TRACE_EVENT_ASYNC_STEP_PAST1("identity", "IdentityGetAuthTokenFunction",
this, "OnGetAccessTokenComplete", "account",
- token_key_.account_id);
+ token_key_.account_id.id);
StartGaiaRequest(access_token.value());
} else {
diff --git a/chromium/chrome/browser/extensions/api/identity/identity_mint_queue_unittest.cc b/chromium/chrome/browser/extensions/api/identity/identity_mint_queue_unittest.cc
index 3dd5952dfe2..b77326da9a8 100644
--- a/chromium/chrome/browser/extensions/api/identity/identity_mint_queue_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/identity/identity_mint_queue_unittest.cc
@@ -22,8 +22,8 @@ class MockRequest : public extensions::IdentityMintRequestQueue::Request {
std::unique_ptr<ExtensionTokenKey> ExtensionIdToKey(
const std::string& extension_id) {
- return std::unique_ptr<ExtensionTokenKey>(
- new ExtensionTokenKey(extension_id, "user_id", std::set<std::string>()));
+ return std::unique_ptr<ExtensionTokenKey>(new ExtensionTokenKey(
+ extension_id, CoreAccountId("user_id"), std::set<std::string>()));
}
} // namespace
diff --git a/chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.cc b/chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
index f0dbae03359..e8010124b5d 100644
--- a/chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
+++ b/chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
@@ -23,7 +23,6 @@
#include "content/public/browser/storage_partition.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_host.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/browser/notification_types.h"
#if defined(OS_CHROMEOS)
@@ -38,7 +37,7 @@ namespace image_writer {
using content::BrowserThread;
OperationManager::OperationManager(content::BrowserContext* context)
- : browser_context_(context), extension_registry_observer_(this) {
+ : browser_context_(context) {
extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_));
Profile* profile = Profile::FromBrowserContext(browser_context_);
registrar_.Add(this,
diff --git a/chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.h b/chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.h
index ae2a04f5658..f45645f523c 100644
--- a/chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.h
+++ b/chromium/chrome/browser/extensions/api/image_writer_private/operation_manager.h
@@ -18,6 +18,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/extension_id.h"
#include "url/gurl.h"
@@ -29,7 +30,6 @@ class BrowserContext;
}
namespace extensions {
-class ExtensionRegistry;
namespace image_writer {
@@ -116,7 +116,7 @@ class OperationManager : public BrowserContextKeyedAPI,
// Listen to extension unloaded notification.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
base::WeakPtrFactory<OperationManager> weak_factory_{this};
diff --git a/chromium/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_chromeos_unittest.cc b/chromium/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_chromeos_unittest.cc
index 431c9e43557..af1d4c4852b 100644
--- a/chromium/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_chromeos_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_chromeos_unittest.cc
@@ -15,9 +15,6 @@ namespace extensions {
namespace {
-using namespace chromeos::disks;
-using namespace api::image_writer_private;
-
const char kDevicePathUSB[] = "/dev/test-usb";
const char kDevicePathSD[] = "/dev/test-sd";
const char kMountPath[] = "/test-mount";
@@ -36,12 +33,13 @@ class RemovableStorageProviderChromeOsUnitTest : public testing::Test {
public:
RemovableStorageProviderChromeOsUnitTest() {}
void SetUp() override {
- disk_mount_manager_mock_ = new MockDiskMountManager();
- DiskMountManager::InitializeForTesting(disk_mount_manager_mock_);
+ disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager();
+ chromeos::disks::DiskMountManager::InitializeForTesting(
+ disk_mount_manager_mock_);
disk_mount_manager_mock_->SetupDefaultReplies();
}
- void TearDown() override { DiskMountManager::Shutdown(); }
+ void TearDown() override { chromeos::disks::DiskMountManager::Shutdown(); }
void DevicesCallback(scoped_refptr<StorageDeviceList> devices) {
devices_ = devices;
@@ -68,10 +66,8 @@ class RemovableStorageProviderChromeOsUnitTest : public testing::Test {
bool is_parent,
bool has_media,
bool on_boot_device) {
- DiskMountManager::MountPointInfo mount_info(
- device_path,
- kMountPath,
- chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::DiskMountManager::MountPointInfo mount_info(
+ device_path, kMountPath, chromeos::MOUNT_TYPE_DEVICE,
chromeos::disks::MOUNT_CONDITION_NONE);
disk_mount_manager_mock_->CreateDiskEntryForMountDevice(
mount_info, kDeviceId, kDeviceName, vendor_name, product_name,
@@ -80,13 +76,14 @@ class RemovableStorageProviderChromeOsUnitTest : public testing::Test {
}
// Checks if the DeviceList has a specific entry.
- RemovableStorageDevice* FindDevice(StorageDeviceList* list,
- const std::string& file_path) {
- for (RemovableStorageDevice& device : list->data) {
+ api::image_writer_private::RemovableStorageDevice* FindDevice(
+ StorageDeviceList* list,
+ const std::string& file_path) {
+ for (auto& device : list->data) {
if (device.storage_unit_id == file_path)
return &device;
}
- return NULL;
+ return nullptr;
}
void ExpectDevice(StorageDeviceList* list,
@@ -94,9 +91,9 @@ class RemovableStorageProviderChromeOsUnitTest : public testing::Test {
const std::string& vendor,
const std::string& model,
uint64_t capacity) {
- RemovableStorageDevice* device = FindDevice(devices_.get(), device_path);
+ auto* device = FindDevice(devices_.get(), device_path);
- ASSERT_TRUE(device != NULL);
+ ASSERT_TRUE(device);
EXPECT_EQ(device_path, device->storage_unit_id);
EXPECT_EQ(vendor, device->vendor);
@@ -105,7 +102,7 @@ class RemovableStorageProviderChromeOsUnitTest : public testing::Test {
}
content::BrowserTaskEnvironment task_environment_;
- MockDiskMountManager* disk_mount_manager_mock_;
+ chromeos::disks::MockDiskMountManager* disk_mount_manager_mock_;
scoped_refptr<StorageDeviceList> devices_;
};
diff --git a/chromium/chrome/browser/extensions/api/image_writer_private/test_utils.cc b/chromium/chrome/browser/extensions/api/image_writer_private/test_utils.cc
index c7ca25348d9..4828d5cdb23 100644
--- a/chromium/chrome/browser/extensions/api/image_writer_private/test_utils.cc
+++ b/chromium/chrome/browser/extensions/api/image_writer_private/test_utils.cc
@@ -314,7 +314,7 @@ bool ImageWriterTestUtils::FillFile(const base::FilePath& file,
}
ImageWriterUnitTestBase::ImageWriterUnitTestBase()
- : task_environment_(content::BrowserTaskEnvironment::REAL_IO_THREAD) {}
+ : task_environment_(content::BrowserTaskEnvironment::IO_MAINLOOP) {}
ImageWriterUnitTestBase::~ImageWriterUnitTestBase() {
}
diff --git a/chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc b/chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc
index fdebd683504..a5ebd3f0985 100644
--- a/chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc
+++ b/chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc
@@ -10,8 +10,8 @@
#include "content/public/browser/browser_thread.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/url_fetcher.h"
-#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/cpp/simple_url_loader.h"
+#include "services/network/public/mojom/url_response_head.mojom.h"
namespace extensions {
namespace image_writer {
@@ -136,7 +136,7 @@ void WriteFromUrlOperation::DestroySimpleURLLoader() {
void WriteFromUrlOperation::OnResponseStarted(
const GURL& final_url,
- const network::ResourceResponseHead& response_head) {
+ const network::mojom::URLResponseHead& response_head) {
total_response_bytes_ = response_head.content_length;
}
diff --git a/chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h b/chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h
index 617f609515a..b35f3654885 100644
--- a/chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h
+++ b/chromium/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h
@@ -9,10 +9,10 @@
#include "chrome/browser/extensions/api/image_writer_private/operation.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
+#include "services/network/public/mojom/url_response_head.mojom-forward.h"
#include "url/gurl.h"
namespace network {
-struct ResourceResponseHead;
class SimpleURLLoader;
} // namespace network
@@ -53,7 +53,7 @@ class WriteFromUrlOperation : public Operation {
private:
void DestroySimpleURLLoader();
void OnResponseStarted(const GURL& final_url,
- const network::ResourceResponseHead& response_head);
+ const network::mojom::URLResponseHead& response_head);
void OnDataDownloaded(uint64_t current);
void OnSimpleLoaderComplete(base::FilePath file_path);
void VerifyDownloadCompare(base::OnceClosure continuation,
diff --git a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api.cc
index 9bfb7c8e07c..573d7ebd794 100644
--- a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api.cc
+++ b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api.cc
@@ -25,7 +25,7 @@ using input_method::InputMethodEngineBase;
namespace {
const char kInputImeApiErrorEngineNotAvailable[] = "Engine is not available";
const char kInputImeApiErrorSetKeyEventsFail[] = "Could not send key events";
-}
+} // namespace
namespace ui {
ImeObserver::ImeObserver(const std::string& extension_id, Profile* profile)
@@ -80,7 +80,7 @@ void ImeObserver::OnBlur(int context_id) {
void ImeObserver::OnKeyEvent(
const std::string& component_id,
const InputMethodEngineBase::KeyboardEvent& event,
- IMEEngineHandlerInterface::KeyEventDoneCallback key_data) {
+ IMEEngineHandlerInterface::KeyEventDoneCallback callback) {
if (extension_id_.empty())
return;
@@ -89,7 +89,7 @@ void ImeObserver::OnKeyEvent(
if (!ShouldForwardKeyEvent()) {
// Continue processing the key event so that the physical keyboard can
// still work.
- std::move(key_data).Run(false);
+ std::move(callback).Run(false);
return;
}
@@ -99,22 +99,27 @@ void ImeObserver::OnKeyEvent(
return;
const std::string request_id =
event_router->GetEngineIfActive(extension_id_)
- ->AddRequest(component_id, std::move(key_data));
+ ->AddPendingKeyEvent(component_id, std::move(callback));
input_ime::KeyboardEvent key_data_value;
key_data_value.type = input_ime::ParseKeyboardEventType(event.type);
- key_data_value.request_id = request_id;
- if (!event.extension_id.empty())
- key_data_value.extension_id.reset(new std::string(event.extension_id));
+ // For legacy reasons, we still put a |requestID| into the keyData, even
+ // though there is already a |requestID| argument in OnKeyEvent.
+ key_data_value.request_id = std::make_unique<std::string>(request_id);
+ if (!event.extension_id.empty()) {
+ key_data_value.extension_id =
+ std::make_unique<std::string>(event.extension_id);
+ }
key_data_value.key = event.key;
key_data_value.code = event.code;
- key_data_value.alt_key.reset(new bool(event.alt_key));
- key_data_value.ctrl_key.reset(new bool(event.ctrl_key));
- key_data_value.shift_key.reset(new bool(event.shift_key));
- key_data_value.caps_lock.reset(new bool(event.caps_lock));
+ key_data_value.alt_key = std::make_unique<bool>(event.alt_key);
+ key_data_value.altgr_key = std::make_unique<bool>(event.altgr_key);
+ key_data_value.ctrl_key = std::make_unique<bool>(event.ctrl_key);
+ key_data_value.shift_key = std::make_unique<bool>(event.shift_key);
+ key_data_value.caps_lock = std::make_unique<bool>(event.caps_lock);
std::unique_ptr<base::ListValue> args(
- input_ime::OnKeyEvent::Create(component_id, key_data_value));
+ input_ime::OnKeyEvent::Create(component_id, key_data_value, request_id));
DispatchEventToExtension(extensions::events::INPUT_IME_ON_KEY_EVENT,
input_ime::OnKeyEvent::kEventName, std::move(args));
@@ -149,10 +154,6 @@ void ImeObserver::OnDeactivated(const std::string& component_id) {
void ImeObserver::OnCompositionBoundsChanged(
const std::vector<gfx::Rect>& bounds) {}
-bool ImeObserver::IsInterestedInKeyEvent() const {
- return ShouldForwardKeyEvent();
-}
-
void ImeObserver::OnSurroundingTextChanged(const std::string& component_id,
const std::string& text,
int cursor_pos,
@@ -266,11 +267,9 @@ InputImeEventRouterFactory* InputImeEventRouterFactory::GetInstance() {
return base::Singleton<InputImeEventRouterFactory>::get();
}
-InputImeEventRouterFactory::InputImeEventRouterFactory() {
-}
+InputImeEventRouterFactory::InputImeEventRouterFactory() = default;
-InputImeEventRouterFactory::~InputImeEventRouterFactory() {
-}
+InputImeEventRouterFactory::~InputImeEventRouterFactory() = default;
InputImeEventRouter* InputImeEventRouterFactory::GetRouter(Profile* profile) {
if (!profile)
@@ -400,16 +399,18 @@ ExtensionFunction::ResponseAction InputImeSendKeyEventsFunction::Run() {
SendKeyEvents::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(parent_params);
const SendKeyEvents::Params::Parameters& params = parent_params->parameters;
- std::vector<InputMethodEngineBase::KeyboardEvent> key_data_out;
+ std::vector<InputMethodEngineBase::KeyboardEvent> key_data_out;
+ key_data_out.reserve(params.key_data.size());
for (const auto& key_event : params.key_data) {
- key_data_out.push_back(InputMethodEngineBase::KeyboardEvent());
+ key_data_out.emplace_back();
InputMethodEngineBase::KeyboardEvent& event = key_data_out.back();
event.type = input_ime::ToString(key_event.type);
event.key = key_event.key;
event.code = key_event.code;
event.key_code = key_event.key_code.get() ? *(key_event.key_code) : 0;
event.alt_key = key_event.alt_key ? *(key_event.alt_key) : false;
+ event.altgr_key = key_event.altgr_key ? *(key_event.altgr_key) : false;
event.ctrl_key = key_event.ctrl_key ? *(key_event.ctrl_key) : false;
event.shift_key = key_event.shift_key ? *(key_event.shift_key) : false;
event.caps_lock = key_event.caps_lock ? *(key_event.caps_lock) : false;
@@ -420,7 +421,7 @@ ExtensionFunction::ResponseAction InputImeSendKeyEventsFunction::Run() {
}
InputImeAPI::InputImeAPI(content::BrowserContext* context)
- : browser_context_(context), extension_registry_observer_(this) {
+ : browser_context_(context) {
extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_));
EventRouter* event_router = EventRouter::Get(browser_context_);
diff --git a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api.h b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api.h
index c3fc3b3344e..30e838249f8 100644
--- a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api.h
+++ b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api.h
@@ -44,7 +44,7 @@ class ImeObserver : public input_method::InputMethodEngineBase::Observer {
public:
ImeObserver(const std::string& extension_id, Profile* profile);
- ~ImeObserver() override {}
+ ~ImeObserver() override = default;
// input_method::InputMethodEngineBase::Observer overrides.
void OnActivate(const std::string& component_id) override;
@@ -58,7 +58,6 @@ class ImeObserver : public input_method::InputMethodEngineBase::Observer {
void OnDeactivated(const std::string& component_id) override;
void OnCompositionBoundsChanged(
const std::vector<gfx::Rect>& bounds) override;
- bool IsInterestedInKeyEvent() const override;
void OnSurroundingTextChanged(const std::string& component_id,
const std::string& text,
int cursor_pos,
@@ -94,15 +93,17 @@ class ImeObserver : public input_method::InputMethodEngineBase::Observer {
IMEEngineHandlerInterface::InputContext input_context);
virtual bool ConvertInputContextAutoComplete(
IMEEngineHandlerInterface::InputContext input_context);
- virtual extensions::api::input_ime::AutoCapitalizeType
- ConvertInputContextAutoCapitalize(
- IMEEngineHandlerInterface::InputContext input_context);
virtual bool ConvertInputContextSpellCheck(
IMEEngineHandlerInterface::InputContext input_context);
std::string extension_id_;
Profile* profile_;
+ private:
+ extensions::api::input_ime::AutoCapitalizeType
+ ConvertInputContextAutoCapitalize(
+ IMEEngineHandlerInterface::InputContext input_context);
+
DISALLOW_COPY_AND_ASSIGN(ImeObserver);
};
@@ -134,7 +135,7 @@ class InputImeKeyEventHandledFunction : public ExtensionFunction {
INPUT_IME_KEYEVENTHANDLED)
protected:
- ~InputImeKeyEventHandledFunction() override {}
+ ~InputImeKeyEventHandledFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -146,7 +147,7 @@ class InputImeSetCompositionFunction : public ExtensionFunction {
INPUT_IME_SETCOMPOSITION)
protected:
- ~InputImeSetCompositionFunction() override {}
+ ~InputImeSetCompositionFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -157,7 +158,7 @@ class InputImeCommitTextFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("input.ime.commitText", INPUT_IME_COMMITTEXT)
protected:
- ~InputImeCommitTextFunction() override {}
+ ~InputImeCommitTextFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -168,7 +169,7 @@ class InputImeSendKeyEventsFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("input.ime.sendKeyEvents", INPUT_IME_SENDKEYEVENTS)
protected:
- ~InputImeSendKeyEventsFunction() override {}
+ ~InputImeSendKeyEventsFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -216,7 +217,7 @@ class InputImeAPI : public BrowserContextKeyedAPI,
// Listen to extension load, unloaded notifications.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
content::NotificationRegistrar registrar_;
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 697de915f2f..b8b1abc8c72 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
@@ -100,7 +100,7 @@ class ImeObserverChromeOS : public ui::ImeObserver {
ImeObserverChromeOS(const std::string& extension_id, Profile* profile)
: ImeObserver(extension_id, profile) {}
- ~ImeObserverChromeOS() override {}
+ ~ImeObserverChromeOS() override = default;
// input_method::InputMethodEngineBase::Observer overrides.
void OnInputContextUpdate(
@@ -191,12 +191,12 @@ class ImeObserverChromeOS : public ui::ImeObserver {
// Note: this is a private API event.
auto bounds_list = std::make_unique<base::ListValue>();
- for (size_t i = 0; i < bounds.size(); ++i) {
+ for (auto bound : bounds) {
auto bounds_value = std::make_unique<base::DictionaryValue>();
- bounds_value->SetInteger("x", bounds[i].x());
- bounds_value->SetInteger("y", bounds[i].y());
- bounds_value->SetInteger("w", bounds[i].width());
- bounds_value->SetInteger("h", bounds[i].height());
+ bounds_value->SetInteger("x", bound.x());
+ bounds_value->SetInteger("y", bound.y());
+ bounds_value->SetInteger("w", bound.width());
+ bounds_value->SetInteger("h", bound.height());
bounds_list->Append(std::move(bounds_value));
}
@@ -231,8 +231,8 @@ class ImeObserverChromeOS : public ui::ImeObserver {
ConvertInputContextType(context));
input_context.auto_correct = ConvertInputContextAutoCorrect(context);
input_context.auto_complete = ConvertInputContextAutoComplete(context);
- input_context.auto_capitalize = (input_method_private::AutoCapitalizeType)
- ConvertInputContextAutoCapitalize(context);
+ input_context.auto_capitalize =
+ ConvertInputContextAutoCapitalize(context.flags);
input_context.spell_check = ConvertInputContextSpellCheck(context);
input_context.has_been_password = ConvertHasBeenPassword(context);
input_context.should_do_learning = context.should_do_learning;
@@ -344,11 +344,22 @@ class ImeObserverChromeOS : public ui::ImeObserver {
return ImeObserver::ConvertInputContextAutoComplete(input_context);
}
- input_ime::AutoCapitalizeType ConvertInputContextAutoCapitalize(
- ui::IMEEngineHandlerInterface::InputContext input_context) override {
+ input_method_private::AutoCapitalizeType ConvertInputContextAutoCapitalize(
+ int flags) {
if (!GetKeyboardConfig().auto_capitalize)
- return input_ime::AUTO_CAPITALIZE_TYPE_NONE;
- return ImeObserver::ConvertInputContextAutoCapitalize(input_context);
+ return input_method_private::AUTO_CAPITALIZE_TYPE_OFF;
+ if (flags & ui::TEXT_INPUT_FLAG_AUTOCAPITALIZE_NONE)
+ return input_method_private::AUTO_CAPITALIZE_TYPE_OFF;
+ if (flags & ui::TEXT_INPUT_FLAG_AUTOCAPITALIZE_CHARACTERS)
+ return input_method_private::AUTO_CAPITALIZE_TYPE_CHARACTERS;
+ if (flags & ui::TEXT_INPUT_FLAG_AUTOCAPITALIZE_WORDS)
+ return input_method_private::AUTO_CAPITALIZE_TYPE_WORDS;
+ if (flags & ui::TEXT_INPUT_FLAG_AUTOCAPITALIZE_SENTENCES)
+ return input_method_private::AUTO_CAPITALIZE_TYPE_SENTENCES;
+
+ // Autocapitalize flag may be missing for native text fields.
+ // See https://crbug.com/1002713.
+ return input_method_private::AUTO_CAPITALIZE_TYPE_NONE;
}
bool ConvertInputContextSpellCheck(
@@ -383,7 +394,7 @@ InputMethodEngine* GetEngineIfActive(Profile* profile,
InputImeEventRouter::InputImeEventRouter(Profile* profile)
: InputImeEventRouterBase(profile) {}
-InputImeEventRouter::~InputImeEventRouter() {}
+InputImeEventRouter::~InputImeEventRouter() = default;
bool InputImeEventRouter::RegisterImeExtension(
const std::string& extension_id,
@@ -402,11 +413,7 @@ bool InputImeEventRouter::RegisterImeExtension(
// Only creates descriptors for 3rd party IME extension, because the
// descriptors for component IME extensions are managed by InputMethodUtil.
if (!comp_ext_ime_manager->IsWhitelistedExtension(extension_id)) {
- for (std::vector<InputComponentInfo>::const_iterator it =
- input_components.begin();
- it != input_components.end();
- ++it) {
- const InputComponentInfo& component = *it;
+ for (const auto& component : input_components) {
DCHECK(component.type == INPUT_COMPONENT_TYPE_IME);
std::vector<std::string> layouts;
@@ -439,40 +446,37 @@ bool InputImeEventRouter::RegisterImeExtension(
std::unique_ptr<InputMethodEngineBase::Observer> observer(
new ImeObserverChromeOS(extension_id, profile));
- chromeos::InputMethodEngine* engine = new chromeos::InputMethodEngine();
+ auto engine = std::make_unique<chromeos::InputMethodEngine>();
engine->Initialize(std::move(observer), extension_id.c_str(), profile);
- engine_map_[extension_id] = engine;
+ engine_map_[extension_id] = std::move(engine);
chromeos::UserSessionManager::GetInstance()
->GetDefaultIMEState(profile)
- ->AddInputMethodExtension(extension_id, descriptors, engine);
+ ->AddInputMethodExtension(extension_id, descriptors,
+ engine_map_[extension_id].get());
return true;
}
void InputImeEventRouter::UnregisterAllImes(const std::string& extension_id) {
- std::map<std::string, InputMethodEngine*>::iterator it =
- engine_map_.find(extension_id);
+ auto it = engine_map_.find(extension_id);
if (it != engine_map_.end()) {
chromeos::input_method::InputMethodManager::Get()
->GetActiveIMEState()
->RemoveInputMethodExtension(extension_id);
- delete it->second;
engine_map_.erase(it);
}
}
InputMethodEngine* InputImeEventRouter::GetEngine(
const std::string& extension_id) {
- std::map<std::string, InputMethodEngine*>::iterator it =
- engine_map_.find(extension_id);
- return (it != engine_map_.end()) ? it->second : nullptr;
+ auto it = engine_map_.find(extension_id);
+ return (it != engine_map_.end()) ? it->second.get() : nullptr;
}
InputMethodEngineBase* InputImeEventRouter::GetEngineIfActive(
const std::string& extension_id) {
- std::map<std::string, InputMethodEngine*>::iterator it =
- engine_map_.find(extension_id);
- return (it != engine_map_.end() && it->second->IsActive()) ? it->second
+ auto it = engine_map_.find(extension_id);
+ return (it != engine_map_.end() && it->second->IsActive()) ? it->second.get()
: nullptr;
}
@@ -592,7 +596,7 @@ ExtensionFunction::ResponseAction InputImeSetCandidatesFunction::Run() {
std::vector<InputMethodEngine::Candidate> candidates_out;
for (const auto& candidate_in : params.candidates) {
- candidates_out.push_back(InputMethodEngine::Candidate());
+ candidates_out.emplace_back();
candidates_out.back().value = candidate_in.candidate;
candidates_out.back().id = candidate_in.id;
if (candidate_in.label)
@@ -652,7 +656,7 @@ ExtensionFunction::ResponseAction InputImeSetMenuItemsFunction::Run() {
std::vector<chromeos::input_method::InputMethodManager::MenuItem> items_out;
for (const input_ime::MenuItem& item_in : params.items) {
- items_out.push_back(chromeos::input_method::InputMethodManager::MenuItem());
+ items_out.emplace_back();
SetMenuItemToMenu(item_in, &items_out.back());
}
@@ -676,7 +680,7 @@ ExtensionFunction::ResponseAction InputImeUpdateMenuItemsFunction::Run() {
std::vector<chromeos::input_method::InputMethodManager::MenuItem> items_out;
for (const input_ime::MenuItem& item_in : params.items) {
- items_out.push_back(chromeos::input_method::InputMethodManager::MenuItem());
+ items_out.emplace_back();
SetMenuItemToMenu(item_in, &items_out.back());
}
diff --git a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.h b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.h
index c07e7259450..12a8e0098a0 100644
--- a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.h
+++ b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.h
@@ -27,7 +27,7 @@ class InputImeClearCompositionFunction : public ExtensionFunction {
INPUT_IME_CLEARCOMPOSITION)
protected:
- ~InputImeClearCompositionFunction() override {}
+ ~InputImeClearCompositionFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -39,7 +39,7 @@ class InputImeSetCandidateWindowPropertiesFunction : public ExtensionFunction {
INPUT_IME_SETCANDIDATEWINDOWPROPERTIES)
protected:
- ~InputImeSetCandidateWindowPropertiesFunction() override {}
+ ~InputImeSetCandidateWindowPropertiesFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -50,7 +50,7 @@ class InputImeSetCandidatesFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("input.ime.setCandidates", INPUT_IME_SETCANDIDATES)
protected:
- ~InputImeSetCandidatesFunction() override {}
+ ~InputImeSetCandidatesFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -62,7 +62,7 @@ class InputImeSetCursorPositionFunction : public ExtensionFunction {
INPUT_IME_SETCURSORPOSITION)
protected:
- ~InputImeSetCursorPositionFunction() override {}
+ ~InputImeSetCursorPositionFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -73,7 +73,7 @@ class InputImeSetMenuItemsFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("input.ime.setMenuItems", INPUT_IME_SETMENUITEMS)
protected:
- ~InputImeSetMenuItemsFunction() override {}
+ ~InputImeSetMenuItemsFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -85,7 +85,7 @@ class InputImeUpdateMenuItemsFunction : public ExtensionFunction {
INPUT_IME_UPDATEMENUITEMS)
protected:
- ~InputImeUpdateMenuItemsFunction() override {}
+ ~InputImeUpdateMenuItemsFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -96,7 +96,7 @@ class InputImeDeleteSurroundingTextFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("input.ime.deleteSurroundingText",
INPUT_IME_DELETESURROUNDINGTEXT)
protected:
- ~InputImeDeleteSurroundingTextFunction() override {}
+ ~InputImeDeleteSurroundingTextFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -108,7 +108,7 @@ class InputImeHideInputViewFunction : public ExtensionFunction {
INPUT_IME_HIDEINPUTVIEW)
protected:
- ~InputImeHideInputViewFunction() override {}
+ ~InputImeHideInputViewFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -117,10 +117,10 @@ class InputImeHideInputViewFunction : public ExtensionFunction {
class InputMethodPrivateNotifyImeMenuItemActivatedFunction
: public ExtensionFunction {
public:
- InputMethodPrivateNotifyImeMenuItemActivatedFunction() {}
+ InputMethodPrivateNotifyImeMenuItemActivatedFunction() = default;
protected:
- ~InputMethodPrivateNotifyImeMenuItemActivatedFunction() override {}
+ ~InputMethodPrivateNotifyImeMenuItemActivatedFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -139,7 +139,7 @@ class InputMethodPrivateGetCompositionBoundsFunction
INPUTMETHODPRIVATE_GETCOMPOSITIONBOUNDS)
protected:
- ~InputMethodPrivateGetCompositionBoundsFunction() override {}
+ ~InputMethodPrivateGetCompositionBoundsFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -169,7 +169,8 @@ class InputImeEventRouter : public InputImeEventRouterBase {
private:
// The engine map from extension_id to an engine.
- std::map<std::string, chromeos::InputMethodEngine*> engine_map_;
+ std::map<std::string, std::unique_ptr<chromeos::InputMethodEngine>>
+ engine_map_;
// The first party ime extension which is unloaded unexpectedly.
std::string unloaded_component_extension_id_;
diff --git a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc
index 95a52f9e403..37db426539d 100644
--- a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc
+++ b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc
@@ -75,7 +75,7 @@ class ImeObserverNonChromeOS : public ui::ImeObserver {
ImeObserverNonChromeOS(const std::string& extension_id, Profile* profile)
: ImeObserver(extension_id, profile) {}
- ~ImeObserverNonChromeOS() override {}
+ ~ImeObserverNonChromeOS() override = default;
void OnCompositionBoundsChanged(
const std::vector<gfx::Rect>& bounds) override {
diff --git a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h
index 68e06c59d6a..e4f3fac9729 100644
--- a/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h
+++ b/chromium/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h
@@ -60,7 +60,7 @@ class InputImeCreateWindowFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("input.ime.createWindow", INPUT_IME_CREATEWINDOW)
protected:
- ~InputImeCreateWindowFunction() override {}
+ ~InputImeCreateWindowFunction() override = default;
// ExtensionFunction:
ExtensionFunction::ResponseAction Run() override;
@@ -71,7 +71,7 @@ class InputImeShowWindowFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("input.ime.showWindow", INPUT_IME_SHOWWINDOW)
protected:
- ~InputImeShowWindowFunction() override {}
+ ~InputImeShowWindowFunction() override = default;
// ExtensionFunction:
ExtensionFunction::ResponseAction Run() override;
@@ -82,7 +82,7 @@ class InputImeHideWindowFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("input.ime.hideWindow", INPUT_IME_HIDEWINDOW)
protected:
- ~InputImeHideWindowFunction() override {}
+ ~InputImeHideWindowFunction() override = default;
// ExtensionFunction:
ExtensionFunction::ResponseAction Run() override;
@@ -97,7 +97,7 @@ class InputImeActivateFunction : public ExtensionFunction {
static bool disable_bubble_for_testing_;
protected:
- ~InputImeActivateFunction() override {}
+ ~InputImeActivateFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
@@ -114,7 +114,7 @@ class InputImeDeactivateFunction : public ExtensionFunction {
DECLARE_EXTENSION_FUNCTION("input.ime.deactivate", INPUT_IME_DEACTIVATE)
protected:
- ~InputImeDeactivateFunction() override {}
+ ~InputImeDeactivateFunction() override = default;
// ExtensionFunction:
ResponseAction Run() override;
diff --git a/chromium/chrome/browser/extensions/api/input_ime/input_ime_event_router_base.cc b/chromium/chrome/browser/extensions/api/input_ime/input_ime_event_router_base.cc
index 5fba14ccace..0fc721fb9c9 100644
--- a/chromium/chrome/browser/extensions/api/input_ime/input_ime_event_router_base.cc
+++ b/chromium/chrome/browser/extensions/api/input_ime/input_ime_event_router_base.cc
@@ -11,6 +11,6 @@ namespace extensions {
InputImeEventRouterBase::InputImeEventRouterBase(Profile* profile)
: profile_(profile) {}
-InputImeEventRouterBase::~InputImeEventRouterBase() {}
+InputImeEventRouterBase::~InputImeEventRouterBase() = default;
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc b/chromium/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc
index 3e82ec740d5..50f513b5075 100644
--- a/chromium/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc
@@ -91,7 +91,7 @@ std::unordered_set<std::string> GetIMEsFromPref(PrefService* prefs,
// Returns the set of allowed UI locales.
std::unordered_set<std::string> GetAllowedLanguages(PrefService* prefs) {
std::unordered_set<std::string> allowed_languages;
- const base::Value::ListStorage& pref_value =
+ base::span<const base::Value> pref_value =
prefs->GetList(prefs::kAllowedLanguages)->GetList();
for (const base::Value& locale_value : pref_value)
allowed_languages.insert(locale_value.GetString());
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 9dd95841737..a1b11bc2c1a 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
@@ -227,7 +227,7 @@ class ChromeAppForLinkDelegate : public extensions::AppForLinkDelegate {
web_app_info->open_as_window = false;
if (!image_result.image.IsEmpty()) {
- WebApplicationInfo::IconInfo icon;
+ WebApplicationIconInfo icon;
icon.data = image_result.image.AsBitmap();
icon.width = icon.data.width();
icon.height = icon.data.height();
@@ -305,10 +305,10 @@ void ChromeManagementAPIDelegate::LaunchAppFunctionDelegate(
extensions::LaunchContainer launch_container =
GetLaunchContainer(extensions::ExtensionPrefs::Get(context), extension);
Profile* profile = Profile::FromBrowserContext(context);
- apps::LaunchService::Get(profile)->OpenApplication(
- AppLaunchParams(profile, extension->id(), launch_container,
- WindowOpenDisposition::NEW_FOREGROUND_TAB,
- apps::mojom::AppLaunchSource::kSourceManagementApi));
+ apps::LaunchService::Get(profile)->OpenApplication(apps::AppLaunchParams(
+ extension->id(), launch_container,
+ WindowOpenDisposition::NEW_FOREGROUND_TAB,
+ apps::mojom::AppLaunchSource::kSourceManagementApi));
#if defined(OS_CHROMEOS)
chromeos::DemoSession::RecordAppLaunchSourceIfInDemoMode(
diff --git a/chromium/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chromium/chrome/browser/extensions/api/management/management_api_browsertest.cc
index 93f3c8d8979..64291f90770 100644
--- a/chromium/chrome/browser/extensions/api/management/management_api_browsertest.cc
+++ b/chromium/chrome/browser/extensions/api/management/management_api_browsertest.cc
@@ -245,15 +245,12 @@ class ExtensionManagementApiEscalationTest :
// Install low-permission version of the extension.
ASSERT_TRUE(InstallExtension(path_v1, 1));
- EXPECT_TRUE(extension_registry()->GetExtensionById(
- kId, ExtensionRegistry::ENABLED));
+ EXPECT_TRUE(extension_registry()->enabled_extensions().GetByID(kId));
// Update to a high-permission version - it should get disabled.
EXPECT_FALSE(UpdateExtension(kId, path_v2, -1));
- EXPECT_FALSE(extension_registry()->GetExtensionById(
- kId, ExtensionRegistry::ENABLED));
- EXPECT_TRUE(extension_registry()->GetExtensionById(
- kId, ExtensionRegistry::COMPATIBILITY));
+ EXPECT_FALSE(extension_registry()->enabled_extensions().GetByID(kId));
+ EXPECT_TRUE(extension_registry()->disabled_extensions().GetByID(kId));
EXPECT_TRUE(ExtensionPrefs::Get(browser()->profile())
->DidExtensionEscalatePermissions(kId));
}
@@ -347,9 +344,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest,
extension_service()->AddExtension(target_extension.get());
SetEnabled(false, true, std::string(), source_extension);
SetEnabled(true, true, std::string(), source_extension);
- const Extension* extension =
- extension_registry()->GetExtensionById(kId, ExtensionRegistry::ENABLED);
- EXPECT_TRUE(extension);
+ EXPECT_TRUE(extension_registry()->enabled_extensions().GetByID(kId));
}
}
diff --git a/chromium/chrome/browser/extensions/api/management/management_api_non_persistent_apitest.cc b/chromium/chrome/browser/extensions/api/management/management_api_non_persistent_apitest.cc
index febd21f6435..3d664ad345b 100644
--- a/chromium/chrome/browser/extensions/api/management/management_api_non_persistent_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/management/management_api_non_persistent_apitest.cc
@@ -121,8 +121,9 @@ INSTANTIATE_TEST_SUITE_P(EventPage,
ManagementApiNonPersistentApiTest,
::testing::Values(ContextType::kEventPage));
-INSTANTIATE_TEST_SUITE_P(ServiceWorker,
- ManagementApiNonPersistentApiTest,
- ::testing::Values(ContextType::kServiceWorker));
+// Flaky: crbug.com/1003597
+// INSTANTIATE_TEST_SUITE_P(ServiceWorker,
+// ManagementApiNonPersistentApiTest,
+// ::testing::Values(ContextType::kServiceWorker));
} // namespace extensions
diff --git a/chromium/chrome/browser/extensions/api/management/management_api_unittest.cc b/chromium/chrome/browser/extensions/api/management/management_api_unittest.cc
index 5f753cc87b3..badfd1880a9 100644
--- a/chromium/chrome/browser/extensions/api/management/management_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/management/management_api_unittest.cc
@@ -549,6 +549,53 @@ TEST_F(ManagementApiUnitTest, ExtensionInfo_MayEnable) {
}
}
+TEST_F(ManagementApiUnitTest, ExtensionInfo_MayDisable) {
+ using ExtensionInfo = api::management::ExtensionInfo;
+
+ scoped_refptr<const Extension> extension = ExtensionBuilder("Test").Build();
+ service()->AddExtension(extension.get());
+
+ const std::string args =
+ base::StringPrintf("[\"%s\"]", extension->id().c_str());
+
+ // Initially the extension should show as enabled, so it may be disabled
+ // freely.
+ EXPECT_TRUE(registry()->enabled_extensions().Contains(extension->id()));
+ {
+ scoped_refptr<ExtensionFunction> function = new ManagementGetFunction();
+ std::unique_ptr<base::Value> value(
+ extension_function_test_utils::RunFunctionAndReturnSingleResult(
+ function.get(), args, browser()));
+ ASSERT_TRUE(value);
+ std::unique_ptr<ExtensionInfo> info = ExtensionInfo::FromValue(*value);
+ ASSERT_TRUE(info);
+ EXPECT_TRUE(info->enabled);
+ EXPECT_TRUE(info->may_disable);
+ }
+
+ // Simulate forcing the extension and verify that the extension shows with
+ // a false value of |may_disable|.
+ ManagementPolicy* policy =
+ ExtensionSystem::Get(profile())->management_policy();
+ policy->UnregisterAllProviders();
+ TestManagementPolicyProvider provider(
+ TestManagementPolicyProvider::MUST_REMAIN_ENABLED);
+ policy->RegisterProvider(&provider);
+ service()->CheckManagementPolicy();
+ EXPECT_TRUE(registry()->enabled_extensions().Contains(extension->id()));
+ {
+ scoped_refptr<ExtensionFunction> function = new ManagementGetFunction();
+ std::unique_ptr<base::Value> value(
+ extension_function_test_utils::RunFunctionAndReturnSingleResult(
+ function.get(), args, browser()));
+ ASSERT_TRUE(value);
+ std::unique_ptr<ExtensionInfo> info = ExtensionInfo::FromValue(*value);
+ ASSERT_TRUE(info);
+ EXPECT_TRUE(info->enabled);
+ EXPECT_FALSE(info->may_disable);
+ }
+}
+
// Tests enabling an extension via management API after it was disabled due to
// permission increase.
TEST_F(ManagementApiUnitTest, SetEnabledAfterIncreasedPermissions) {
diff --git a/chromium/chrome/browser/extensions/api/management/management_apitest.cc b/chromium/chrome/browser/extensions/api/management/management_apitest.cc
index bbc3cb9f617..89973e38806 100644
--- a/chromium/chrome/browser/extensions/api/management/management_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/management/management_apitest.cc
@@ -340,9 +340,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest,
extensions::ScopedTestDialogAutoConfirm::ACCEPT);
extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(browser()->profile());
- EXPECT_TRUE(
- registry->GetExtensionById(extension_ids_["enabled_extension"],
- extensions::ExtensionRegistry::ENABLED));
+ EXPECT_TRUE(registry->enabled_extensions().GetByID(
+ extension_ids_["enabled_extension"]));
// Ensure that all actions are allowed.
extensions::ExtensionSystem::Get(
@@ -353,7 +352,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest,
// The last thing the test does is uninstall the "enabled_extension".
EXPECT_FALSE(
registry->GetExtensionById(extension_ids_["enabled_extension"],
- extensions::ExtensionRegistry::COMPATIBILITY));
+ extensions::ExtensionRegistry::EVERYTHING));
}
// Fails often on Windows dbg bots. http://crbug.com/177163
@@ -368,16 +367,17 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest,
LoadExtensions();
extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(browser()->profile());
- EXPECT_TRUE(
- registry->GetExtensionById(extension_ids_["enabled_extension"],
- extensions::ExtensionRegistry::ENABLED));
+ EXPECT_TRUE(registry->enabled_extensions().GetByID(
+ extension_ids_["enabled_extension"]));
// Prohibit status changes.
extensions::ManagementPolicy* policy = extensions::ExtensionSystem::Get(
browser()->profile())->management_policy();
policy->UnregisterAllProviders();
extensions::TestManagementPolicyProvider provider(
- extensions::TestManagementPolicyProvider::PROHIBIT_MODIFY_STATUS);
+ extensions::TestManagementPolicyProvider::PROHIBIT_MODIFY_STATUS |
+ extensions::TestManagementPolicyProvider::MUST_REMAIN_ENABLED |
+ extensions::TestManagementPolicyProvider::MUST_REMAIN_INSTALLED);
policy->RegisterProvider(&provider);
ASSERT_TRUE(RunExtensionSubtest("management/management_policy",
"prohibited.html"));
@@ -410,7 +410,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
UninstallExtension(app_id);
ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
ASSERT_FALSE(registry->GetExtensionById(
- app_id, extensions::ExtensionRegistry::COMPATIBILITY));
+ app_id, extensions::ExtensionRegistry::EVERYTHING));
// Set a pref indicating that the user wants to launch in a regular tab.
// This should be ignored, because panel apps always load in a popup.
@@ -468,7 +468,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, MAYBE_LaunchTabApp) {
UninstallExtension(app_id);
ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
ASSERT_FALSE(registry->GetExtensionById(
- app_id, extensions::ExtensionRegistry::COMPATIBILITY));
+ app_id, extensions::ExtensionRegistry::EVERYTHING));
// Set a pref indicating that the user wants to launch in a window.
extensions::SetLaunchType(browser()->profile(), app_id,
diff --git a/chromium/chrome/browser/extensions/api/management/management_browsertest.cc b/chromium/chrome/browser/extensions/api/management/management_browsertest.cc
index 91b2e2ceb0a..265e4a24847 100644
--- a/chromium/chrome/browser/extensions/api/management/management_browsertest.cc
+++ b/chromium/chrome/browser/extensions/api/management/management_browsertest.cc
@@ -261,8 +261,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_InstallRequiresConfirm) {
// it being disabled, since good.crx has permissions that require approval.
std::string id = "ldnnhddmnhbkjipkidpdiheffobcpfmf";
ASSERT_FALSE(InstallExtension(test_data_dir_.AppendASCII("good.crx"), 0));
- ASSERT_TRUE(extension_registry()->GetExtensionById(
- id, ExtensionRegistry::COMPATIBILITY));
+ ASSERT_TRUE(extension_registry()->disabled_extensions().GetByID(id));
UninstallExtension(id);
// And the install should succeed when the permissions are accepted.
@@ -445,8 +444,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) {
install_observer.WaitForExtensionWillBeInstalled();
EXPECT_TRUE(listener2.WaitUntilSatisfied());
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
- extension = registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf",
- ExtensionRegistry::ENABLED);
+ extension = registry->enabled_extensions().GetByID(
+ "ogjcoiohnmldgjemafoockdghcjciccf");
ASSERT_TRUE(extension);
ASSERT_EQ("2.0", extension->VersionString());
ASSERT_TRUE(notification_listener.started());
@@ -470,8 +469,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) {
// Make sure the extension state is the same as before.
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
- extension = registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf",
- ExtensionRegistry::ENABLED);
+ extension = registry->enabled_extensions().GetByID(
+ "ogjcoiohnmldgjemafoockdghcjciccf");
ASSERT_TRUE(extension);
ASSERT_EQ("2.0", extension->VersionString());
}
@@ -546,11 +545,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
install_observer.WaitForExtensionWillBeInstalled();
ASSERT_EQ(disabled_size_before + 1, registry->disabled_extensions().size());
ASSERT_EQ(enabled_size_before, registry->enabled_extensions().size());
- extension = registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf",
- ExtensionRegistry::COMPATIBILITY);
+ extension = registry->disabled_extensions().GetByID(
+ "ogjcoiohnmldgjemafoockdghcjciccf");
ASSERT_TRUE(extension);
- ASSERT_FALSE(registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf",
- ExtensionRegistry::ENABLED));
+ ASSERT_FALSE(registry->enabled_extensions().GetByID(
+ "ogjcoiohnmldgjemafoockdghcjciccf"));
ASSERT_EQ("2.0", extension->VersionString());
// The extension should have not made the callback because it is disabled.
@@ -621,7 +620,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) {
install_observer.WaitForExtensionWillBeInstalled();
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
const Extension* extension =
- registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED);
+ registry->enabled_extensions().GetByID(kExtensionId);
ASSERT_TRUE(extension);
ASSERT_EQ("2.0", extension->VersionString());
@@ -726,7 +725,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) {
// Check if the extension got installed.
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
const Extension* extension =
- registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED);
+ registry->enabled_extensions().GetByID(kExtensionId);
ASSERT_TRUE(extension);
ASSERT_EQ("2.0", extension->VersionString());
EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location());
@@ -751,8 +750,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) {
policies.Erase(policy::key::kExtensionInstallForcelist);
UpdateProviderPolicy(policies);
EXPECT_EQ(size_before + 1, registry->enabled_extensions().size());
- EXPECT_FALSE(registry->GetExtensionById(kExtensionId,
- ExtensionRegistry::COMPATIBILITY));
+ EXPECT_FALSE(
+ registry->GetExtensionById(kExtensionId, ExtensionRegistry::EVERYTHING));
}
// See http://crbug.com/103371 and http://crbug.com/120640.
@@ -808,7 +807,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
ASSERT_TRUE(InstallExtension(v2_path, 1));
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
const Extension* extension =
- registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED);
+ registry->enabled_extensions().GetByID(kExtensionId);
ASSERT_TRUE(extension);
EXPECT_EQ(Manifest::INTERNAL, extension->location());
EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
@@ -827,8 +826,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
install_observer.WaitForExtensionWillBeInstalled();
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
- extension =
- registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED);
+ extension = registry->enabled_extensions().GetByID(kExtensionId);
ASSERT_TRUE(extension);
EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location());
EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
@@ -840,15 +838,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
policies.Erase(policy::key::kExtensionInstallForcelist);
UpdateProviderPolicy(policies);
ASSERT_EQ(size_before, registry->enabled_extensions().size());
- extension = registry->GetExtensionById(kExtensionId,
- ExtensionRegistry::COMPATIBILITY);
+ extension =
+ registry->GetExtensionById(kExtensionId, ExtensionRegistry::EVERYTHING);
EXPECT_FALSE(extension);
// User install again, but have it disabled too before setting the policy.
ASSERT_TRUE(InstallExtension(v2_path, 1));
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
- extension =
- registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED);
+ extension = registry->enabled_extensions().GetByID(kExtensionId);
ASSERT_TRUE(extension);
EXPECT_EQ(Manifest::INTERNAL, extension->location());
EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
@@ -856,8 +853,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
DisableExtension(kExtensionId);
EXPECT_EQ(1u, registry->disabled_extensions().size());
- extension = registry->GetExtensionById(kExtensionId,
- ExtensionRegistry::COMPATIBILITY);
+ extension = registry->disabled_extensions().GetByID(kExtensionId);
EXPECT_TRUE(extension);
EXPECT_FALSE(service->IsExtensionEnabled(kExtensionId));
@@ -873,8 +869,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
extension_observer.WaitForExtensionWillBeInstalled();
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
- extension =
- registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED);
+ extension = registry->enabled_extensions().GetByID(kExtensionId);
ASSERT_TRUE(extension);
EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location());
EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
diff --git a/chromium/chrome/browser/extensions/api/media_perception_private/media_perception_api_delegate_chromeos.cc b/chromium/chrome/browser/extensions/api/media_perception_private/media_perception_api_delegate_chromeos.cc
index 69ddd3fbc6a..70f0710c4cf 100644
--- a/chromium/chrome/browser/extensions/api/media_perception_private/media_perception_api_delegate_chromeos.cc
+++ b/chromium/chrome/browser/extensions/api/media_perception_private/media_perception_api_delegate_chromeos.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/component_updater/cros_component_installer_chromeos.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/chromeos/delegate_to_browser_gpu_service_accelerator_factory.h"
diff --git a/chromium/chrome/browser/extensions/api/messaging/chrome_messaging_delegate.cc b/chromium/chrome/browser/extensions/api/messaging/chrome_messaging_delegate.cc
index ff4cc1c31a6..a236b6b0709 100644
--- a/chromium/chrome/browser/extensions/api/messaging/chrome_messaging_delegate.cc
+++ b/chromium/chrome/browser/extensions/api/messaging/chrome_messaging_delegate.cc
@@ -86,8 +86,13 @@ std::unique_ptr<base::DictionaryValue> ChromeMessagingDelegate::MaybeGetTabInfo(
// reached as a result of a tab (or content script) messaging the extension.
// We need the extension to see the sender so that it can validate if it
// trusts it or not.
- return ExtensionTabUtil::CreateTabObject(
- web_contents, ExtensionTabUtil::kDontScrubTab, nullptr)
+ // TODO(tjudkins): Adjust scrubbing behavior in this situation to not scrub
+ // the last committed URL, but do scrub the pending URL based on
+ // permissions.
+ ExtensionTabUtil::ScrubTabBehavior scrub_tab_behavior = {
+ ExtensionTabUtil::kDontScrubTab, ExtensionTabUtil::kDontScrubTab};
+ return ExtensionTabUtil::CreateTabObject(web_contents, scrub_tab_behavior,
+ nullptr)
->ToValue();
}
return nullptr;
diff --git a/chromium/chrome/browser/extensions/api/messaging/native_messaging_apitest.cc b/chromium/chrome/browser/extensions/api/messaging/native_messaging_apitest.cc
index 33042b32456..3e6af3e0cc7 100644
--- a/chromium/chrome/browser/extensions/api/messaging/native_messaging_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/messaging/native_messaging_apitest.cc
@@ -33,7 +33,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, UserLevelNativeMessaging) {
class TestProcessManagerObserver : public ProcessManagerObserver {
public:
- TestProcessManagerObserver() : observer_(this) {}
+ TestProcessManagerObserver() = default;
+ ~TestProcessManagerObserver() override = default;
void WaitForProcessShutdown(ProcessManager* process_manager,
const std::string& extension_id) {
@@ -57,21 +58,29 @@ class TestProcessManagerObserver : public ProcessManagerObserver {
}
std::string extension_id_;
- ScopedObserver<ProcessManager, TestProcessManagerObserver> observer_;
+ ScopedObserver<ProcessManager, ProcessManagerObserver> observer_{this};
base::OnceClosure quit_;
DISALLOW_COPY_AND_ASSIGN(TestProcessManagerObserver);
};
+class NativeMessagingApiTest : public ExtensionApiTest {
+ public:
+ NativeMessagingApiTest() {
+ feature_list_.InitAndEnableFeature(features::kOnConnectNative);
+ }
+
+ private:
+ base::test::ScopedFeatureList feature_list_;
+};
+
// Disabled on Windows due to timeouts; see https://crbug.com/984897.
#if defined(OS_WIN)
#define MAYBE_NativeMessagingLaunch DISABLED_NativeMessagingLaunch
#else
#define MAYBE_NativeMessagingLaunch NativeMessagingLaunch
#endif
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_NativeMessagingLaunch) {
- base::test::ScopedFeatureList features;
- features.InitAndEnableFeature(features::kOnConnectNative);
+IN_PROC_BROWSER_TEST_F(NativeMessagingApiTest, MAYBE_NativeMessagingLaunch) {
ProcessManager::SetEventPageIdleTimeForTesting(1);
ProcessManager::SetEventPageSuspendingTimeForTesting(1);
extensions::ScopedTestNativeMessagingHost test_host;
@@ -112,10 +121,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_NativeMessagingLaunch) {
// natively-initiated connections is not allowed. The test extension expects the
// channel to be immediately closed with an error.
IN_PROC_BROWSER_TEST_F(
- ExtensionApiTest,
+ NativeMessagingApiTest,
NativeMessagingLaunch_LaunchFromNativeUnsupportedByNativeHost) {
- base::test::ScopedFeatureList features;
- features.InitAndEnableFeature(features::kOnConnectNative);
ProcessManager::SetEventPageIdleTimeForTesting(1);
ProcessManager::SetEventPageSuspendingTimeForTesting(1);
extensions::ScopedTestNativeMessagingHost test_host;
diff --git a/chromium/chrome/browser/extensions/api/messaging/native_process_launcher.cc b/chromium/chrome/browser/extensions/api/messaging/native_process_launcher.cc
index edfdcbf0bc5..e8480b47786 100644
--- a/chromium/chrome/browser/extensions/api/messaging/native_process_launcher.cc
+++ b/chromium/chrome/browser/extensions/api/messaging/native_process_launcher.cc
@@ -258,7 +258,7 @@ void NativeProcessLauncherImpl::Core::DoLaunchOnThreadPool(
base::Value args(base::Value::Type::LIST);
args.GetList().reserve(reconnect_command_line.argv().size());
for (const auto& arg : reconnect_command_line.argv()) {
- args.GetList().emplace_back(arg);
+ args.Append(arg);
}
std::string encoded_reconnect_command;
bool success =
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 bedfe826489..282c0c96f0f 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
@@ -39,12 +39,18 @@
#include "chromeos/network/onc/onc_utils.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "components/onc/onc_constants.h"
+#include "components/onc/onc_pref_names.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/policy_constants.h"
+#include "components/prefs/testing_pref_service.h"
+#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
+#include "components/proxy_config/proxy_config_dictionary.h"
+#include "components/proxy_config/proxy_config_pref_names.h"
+#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
#include "components/user_manager/user_names.h"
@@ -465,6 +471,13 @@ class NetworkingPrivateChromeOSApiTest : public extensions::ExtensionApiTest {
base::Value("third_party_provider_extension_id"));
profile_test_->AddService(kUser1ProfilePath, "stub_vpn2");
+ PrefProxyConfigTrackerImpl::RegisterProfilePrefs(user_prefs_.registry());
+ PrefProxyConfigTrackerImpl::RegisterPrefs(local_state_.registry());
+ ::onc::RegisterProfilePrefs(user_prefs_.registry());
+ ::onc::RegisterPrefs(local_state_.registry());
+
+ chromeos::NetworkHandler::Get()->InitializePrefServices(&user_prefs_,
+ &local_state_);
content::RunAllPendingInMessageLoop();
}
@@ -487,6 +500,8 @@ class NetworkingPrivateChromeOSApiTest : public extensions::ExtensionApiTest {
ShillServiceClient::TestInterface* service_test_;
ShillDeviceClient::TestInterface* device_test_;
policy::MockConfigurationPolicyProvider provider_;
+ sync_preferences::TestingPrefServiceSyncable user_prefs_;
+ TestingPrefServiceSimple local_state_;
std::string userhash_;
private:
@@ -550,10 +565,9 @@ IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest,
EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworksWifi")) << message_;
}
-// TODO(crbug.com/928778): Flaky on CrOS.
-IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest,
- DISABLED_EnabledNetworkTypes) {
- EXPECT_TRUE(RunNetworkingSubtest("enabledNetworkTypes")) << message_;
+IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, EnabledNetworkTypes) {
+ EXPECT_TRUE(RunNetworkingSubtest("enabledNetworkTypesDisable")) << message_;
+ EXPECT_TRUE(RunNetworkingSubtest("enabledNetworkTypesEnable")) << message_;
}
IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetDeviceStates) {
@@ -722,6 +736,9 @@ IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetManagedProperties) {
{ "GUID": "stub_wifi2",
"Type": "WiFi",
"Name": "My WiFi Network",
+ "ProxySettings":{
+ "Type": "Direct"
+ },
"WiFi": {
"HexSSID": "77696669325F50534B",
"Passphrase": "passphrase",
diff --git a/chromium/chrome/browser/extensions/api/notifications/notifications_apitest.cc b/chromium/chrome/browser/extensions/api/notifications/notifications_apitest.cc
index 427be63bed1..3c64e1f58d2 100644
--- a/chromium/chrome/browser/extensions/api/notifications/notifications_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/notifications/notifications_apitest.cc
@@ -206,11 +206,10 @@ class NotificationsApiTest : public extensions::ExtensionApiTest {
void LaunchPlatformApp(const Extension* extension) {
apps::LaunchService::Get(browser()->profile())
- ->OpenApplication(
- AppLaunchParams(browser()->profile(), extension->id(),
- apps::mojom::LaunchContainer::kLaunchContainerNone,
- WindowOpenDisposition::NEW_WINDOW,
- apps::mojom::AppLaunchSource::kSourceTest));
+ ->OpenApplication(apps::AppLaunchParams(
+ extension->id(), apps::mojom::LaunchContainer::kLaunchContainerNone,
+ WindowOpenDisposition::NEW_WINDOW,
+ apps::mojom::AppLaunchSource::kSourceTest));
}
std::unique_ptr<NotificationDisplayServiceTester> display_service_tester_;
diff --git a/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc
index 7438cd81785..25f06908256 100644
--- a/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc
+++ b/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.cc
@@ -26,7 +26,6 @@
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_prefs_factory.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/browser/notification_types.h"
#include "ui/gfx/image/image.h"
@@ -187,8 +186,7 @@ void ExtensionOmniboxEventRouter::OnDeleteSuggestion(
OmniboxAPI::OmniboxAPI(content::BrowserContext* context)
: profile_(Profile::FromBrowserContext(context)),
- url_service_(TemplateURLServiceFactory::GetForProfile(profile_)),
- extension_registry_observer_(this) {
+ url_service_(TemplateURLServiceFactory::GetForProfile(profile_)) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
if (url_service_) {
template_url_sub_ = url_service_->RegisterOnLoadedCallback(
diff --git a/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.h b/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.h
index 435ea6456f9..9a648b7e6fb 100644
--- a/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.h
+++ b/chromium/chrome/browser/extensions/api/omnibox/omnibox_api.h
@@ -18,6 +18,7 @@
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/search_engines/template_url_service.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
#include "ui/base/window_open_disposition.h"
@@ -35,7 +36,6 @@ class Image;
}
namespace extensions {
-class ExtensionRegistry;
// Event router class for events related to the omnibox API.
class ExtensionOmniboxEventRouter {
@@ -134,7 +134,7 @@ class OmniboxAPI : public BrowserContextKeyedAPI,
// Listen to extension load, unloaded notifications.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
// Keeps track of favicon-sized omnibox icons for extensions.
ExtensionIconManager omnibox_icon_manager_;
diff --git a/chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
index f07d7d273b8..7931d22b63e 100644
--- a/chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+++ b/chromium/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -265,6 +265,8 @@ void PasswordsPrivateDelegateImpl::SetPasswordList(
IDS_PASSWORDS_VIA_FEDERATION, GetDisplayFederation(*form))));
}
+ entry.from_account_store = form->IsUsingAccountStore();
+
current_entries_.push_back(std::move(entry));
}
@@ -292,6 +294,8 @@ void PasswordsPrivateDelegateImpl::SetPasswordExceptionList(
current_exception_entry.urls = CreateUrlCollectionFromForm(*form);
current_exception_entry.id = exception_id_generator_.GenerateId(
password_manager::CreateSortKey(*form));
+
+ current_exception_entry.from_account_store = form->IsUsingAccountStore();
current_exceptions_.push_back(std::move(current_exception_entry));
}
diff --git a/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc b/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc
index 2b6386c993b..2ae65f5c0f0 100644
--- a/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc
+++ b/chromium/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc
@@ -9,7 +9,6 @@
#include <utility>
#include "base/bind.h"
-#include "base/json/json_writer.h"
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
@@ -28,8 +27,8 @@
#include "crypto/scoped_test_system_nss_key_slot.h"
#include "net/cert/nss_cert_database.h"
#include "net/cert/test_root_certs.h"
+#include "net/cert/x509_certificate.h"
#include "net/test/cert_test_util.h"
-#include "net/test/test_data_directory.h"
namespace {
@@ -160,6 +159,10 @@ class PlatformKeysTest : public PlatformKeysTestBase {
const extensions::Extension* extension_;
private:
+ base::FilePath extension_path() const {
+ return test_data_dir_.AppendASCII("platform_keys");
+ }
+
void SetPrivateSoftwareSlotOnIO(crypto::ScopedPK11Slot slot) {
crypto::SetPrivateSoftwareSlotForChromeOSUserForTesting(std::move(slot));
}
@@ -193,25 +196,23 @@ class PlatformKeysTest : public PlatformKeysTestBase {
? cert_db->GetPrivateSlot()
: cert_db->GetPublicSlot();
client_cert1_ = net::ImportClientCertAndKeyFromFile(
- net::GetTestCertsDirectory(), "client_1.pem", "client_1.pk8",
- slot.get());
+ extension_path(), "client_1.pem", "client_1.pk8", slot.get());
ASSERT_TRUE(client_cert1_.get());
// Import a second client cert signed by another CA than client_1 into the
// system wide key slot.
client_cert2_ = net::ImportClientCertAndKeyFromFile(
- net::GetTestCertsDirectory(), "client_2.pem", "client_2.pk8",
+ extension_path(), "client_2.pem", "client_2.pk8",
test_system_slot()->slot());
ASSERT_TRUE(client_cert2_.get());
}
void SetupTestCACerts() {
net::TestRootCerts* root_certs = net::TestRootCerts::GetInstance();
- // "root_ca_cert.pem" is the issuer of "ok_cert.pem" which is loaded on the
- // JS side. Generated by create_test_certs.sh .
- base::FilePath extension_path = test_data_dir_.AppendASCII("platform_keys");
- root_certs->AddFromFile(
- test_data_dir_.AppendASCII("platform_keys").AppendASCII("root.pem"));
+ // "root.pem" is the issuer of the "l1_leaf.pem" and (transitively)
+ // "l1_leaf.pem" certs which are loaded on the JS side. Generated by
+ // create_test_certs.sh .
+ root_certs->AddFromFile(extension_path().AppendASCII("root.pem"));
}
const bool key_permission_policy_;
diff --git a/chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc b/chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc
index 7462a0021d7..3fa500422e4 100644
--- a/chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc
+++ b/chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc
@@ -91,7 +91,7 @@ void BrowserContextKeyedAPIFactory<
}
VerifyTrustAPI::VerifyTrustAPI(content::BrowserContext* context)
- : io_part_(new IOPart), registry_observer_(this) {
+ : io_part_(new IOPart) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
registry_observer_.Add(ExtensionRegistry::Get(context));
}
diff --git a/chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.h b/chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.h
index 7c08e3d6a3e..f3b21ee674f 100644
--- a/chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.h
+++ b/chromium/chrome/browser/extensions/api/platform_keys/verify_trust_api.h
@@ -98,7 +98,7 @@ class VerifyTrustAPI : public BrowserContextKeyedAPI,
std::unique_ptr<IOPart, content::BrowserThread::DeleteOnIOThread> io_part_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- registry_observer_;
+ registry_observer_{this};
base::WeakPtrFactory<VerifyTrustAPI> weak_factory_{this};
diff --git a/chromium/chrome/browser/extensions/api/preference/preference_api.cc b/chromium/chrome/browser/extensions/api/preference/preference_api.cc
index d8d88361618..f961cdda093 100644
--- a/chromium/chrome/browser/extensions/api/preference/preference_api.cc
+++ b/chromium/chrome/browser/extensions/api/preference/preference_api.cc
@@ -17,14 +17,12 @@
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "build/build_config.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_service.h"
#include "chrome/browser/extensions/api/preference/preference_api_constants.h"
#include "chrome/browser/extensions/api/preference/preference_helpers.h"
#include "chrome/browser/extensions/api/proxy/proxy_api.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/net/prediction_options.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "components/autofill/core/common/autofill_prefs.h"
#include "components/content_settings/core/common/pref_names.h"
@@ -35,9 +33,6 @@
#include "components/safe_browsing/common/safe_browsing_prefs.h"
#include "components/spellcheck/browser/pref_names.h"
#include "components/translate/core/browser/translate_pref_names.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_source.h"
#include "extensions/browser/extension_pref_value_map.h"
#include "extensions/browser/extension_pref_value_map_factory.h"
#include "extensions/browser/extension_prefs.h"
@@ -364,14 +359,15 @@ PreferenceEventRouter::PreferenceEventRouter(Profile* profile)
base::Bind(&PreferenceEventRouter::OnPrefChanged,
base::Unretained(this), registrar_.prefs()));
}
- notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED,
- content::NotificationService::AllSources());
- notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
- content::NotificationService::AllSources());
- OnIncognitoProfileCreated(profile->GetOffTheRecordPrefs());
+ DCHECK(!profile_->IsOffTheRecord());
+ observed_profiles_.Add(profile_);
+ if (profile->HasOffTheRecordProfile())
+ OnOffTheRecordProfileCreated(profile->GetOffTheRecordProfile());
+ else
+ ObserveOffTheRecordPrefs(profile->GetReadOnlyOffTheRecordPrefs());
}
-PreferenceEventRouter::~PreferenceEventRouter() { }
+PreferenceEventRouter::~PreferenceEventRouter() = default;
void PreferenceEventRouter::OnPrefChanged(PrefService* pref_service,
const std::string& browser_pref) {
@@ -423,33 +419,22 @@ void PreferenceEventRouter::OnPrefChanged(PrefService* pref_service,
browser_pref);
}
-void PreferenceEventRouter::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (type) {
- case chrome::NOTIFICATION_PROFILE_CREATED: {
- Profile* profile = content::Source<Profile>(source).ptr();
- if (profile != profile_ && profile->GetOriginalProfile() == profile_) {
- OnIncognitoProfileCreated(profile->GetPrefs());
- }
- break;
- }
- case chrome::NOTIFICATION_PROFILE_DESTROYED: {
- Profile* profile = content::Source<Profile>(source).ptr();
- if (profile != profile_ && profile->GetOriginalProfile() == profile_) {
- // The real PrefService is about to be destroyed so we must make sure we
- // get the "dummy" one.
- OnIncognitoProfileCreated(profile_->GetReadOnlyOffTheRecordPrefs());
- }
- break;
- }
- default:
- NOTREACHED();
+void PreferenceEventRouter::OnOffTheRecordProfileCreated(
+ Profile* off_the_record) {
+ observed_profiles_.Add(off_the_record);
+ ObserveOffTheRecordPrefs(off_the_record->GetPrefs());
+}
+
+void PreferenceEventRouter::OnProfileWillBeDestroyed(Profile* profile) {
+ observed_profiles_.Remove(profile);
+ if (profile->IsOffTheRecord()) {
+ // The real PrefService is about to be destroyed so we must make sure we
+ // get the "dummy" one.
+ ObserveOffTheRecordPrefs(profile_->GetReadOnlyOffTheRecordPrefs());
}
}
-void PreferenceEventRouter::OnIncognitoProfileCreated(PrefService* prefs) {
+void PreferenceEventRouter::ObserveOffTheRecordPrefs(PrefService* prefs) {
incognito_registrar_ = std::make_unique<PrefChangeRegistrar>();
incognito_registrar_->Init(prefs);
for (const auto& pref : kPrefMapping) {
diff --git a/chromium/chrome/browser/extensions/api/preference/preference_api.h b/chromium/chrome/browser/extensions/api/preference/preference_api.h
index 086434a7653..fbb632013c7 100644
--- a/chromium/chrome/browser/extensions/api/preference/preference_api.h
+++ b/chromium/chrome/browser/extensions/api/preference/preference_api.h
@@ -10,11 +10,12 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/scoped_observer.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_store.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_observer.h"
#include "components/prefs/pref_change_registrar.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_prefs_scope.h"
@@ -29,7 +30,7 @@ class Value;
namespace extensions {
class ExtensionPrefs;
-class PreferenceEventRouter : public content::NotificationObserver {
+class PreferenceEventRouter : public ProfileObserver {
public:
explicit PreferenceEventRouter(Profile* profile);
~PreferenceEventRouter() override;
@@ -38,20 +39,20 @@ class PreferenceEventRouter : public content::NotificationObserver {
void OnPrefChanged(PrefService* pref_service,
const std::string& pref_key);
- // content::NotificationObserver:
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
+ // ProfileObserver:
+ void OnOffTheRecordProfileCreated(Profile* off_the_record) override;
+ void OnProfileWillBeDestroyed(Profile* profile) override;
- void OnIncognitoProfileCreated(PrefService* prefs);
+ void ObserveOffTheRecordPrefs(PrefService* prefs);
- content::NotificationRegistrar notification_registrar_;
PrefChangeRegistrar registrar_;
std::unique_ptr<PrefChangeRegistrar> incognito_registrar_;
// Weak, owns us (transitively via ExtensionService).
Profile* profile_;
+ ScopedObserver<Profile, ProfileObserver> observed_profiles_{this};
+
DISALLOW_COPY_AND_ASSIGN(PreferenceEventRouter);
};
diff --git a/chromium/chrome/browser/extensions/api/preference/preference_apitest.cc b/chromium/chrome/browser/extensions/api/preference/preference_apitest.cc
index 10321960008..a347e5d47b0 100644
--- a/chromium/chrome/browser/extensions/api/preference/preference_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/preference/preference_apitest.cc
@@ -29,12 +29,12 @@
#include "components/safe_browsing/common/safe_browsing_prefs.h"
#include "components/translate/core/browser/translate_pref_names.h"
#include "content/public/browser/notification_service.h"
-#include "content/public/common/webrtc_ip_handling_policy.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
#include "media/media_buildflags.h"
+#include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h"
class ExtensionPreferenceApiTest : public extensions::ExtensionApiTest {
protected:
@@ -139,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, MAYBE_Standard) {
prefs->SetBoolean(prefs::kWebRTCMultipleRoutesEnabled, false);
prefs->SetBoolean(prefs::kWebRTCNonProxiedUdpEnabled, false);
prefs->SetString(prefs::kWebRTCIPHandlingPolicy,
- content::kWebRTCIPHandlingDefaultPublicInterfaceOnly);
+ blink::kWebRTCIPHandlingDefaultPublicInterfaceOnly);
const char kExtensionPath[] = "preference/standard";
diff --git a/chromium/chrome/browser/extensions/api/processes/processes_api.cc b/chromium/chrome/browser/extensions/api/processes/processes_api.cc
index 093fa4fd495..30d45fe2144 100644
--- a/chromium/chrome/browser/extensions/api/processes/processes_api.cc
+++ b/chromium/chrome/browser/extensions/api/processes/processes_api.cc
@@ -33,7 +33,6 @@
#include "content/public/common/child_process_host.h"
#include "content/public/common/result_codes.h"
#include "extensions/common/error_utils.h"
-#include "third_party/blink/public/platform/web_cache.h"
namespace extensions {
@@ -65,7 +64,7 @@ int64_t GetRefreshTypesForProcessOptionalData() {
}
std::unique_ptr<api::processes::Cache> CreateCacheData(
- const blink::WebCache::ResourceTypeStat& stat) {
+ const blink::WebCacheResourceTypeStat& stat) {
std::unique_ptr<api::processes::Cache> cache(new api::processes::Cache());
cache->size = static_cast<double>(stat.size);
cache->live_size = static_cast<double>(stat.size);
@@ -168,7 +167,7 @@ void FillProcessData(
sqlite_bytes)));
}
- blink::WebCache::ResourceTypeStats cache_stats;
+ blink::WebCacheResourceTypeStats cache_stats;
if (task_manager->GetWebCacheStats(id, &cache_stats)) {
out_process->image_cache = CreateCacheData(cache_stats.images);
out_process->script_cache = CreateCacheData(cache_stats.scripts);
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 06c58128a08..35898e2e8f3 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
@@ -28,7 +28,6 @@
#include "chrome/browser/ui/browser_window.h"
#include "components/update_client/update_query_params.h"
#include "content/public/browser/notification_service.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/notification_types.h"
#include "extensions/browser/warning_service.h"
@@ -145,9 +144,7 @@ struct ChromeRuntimeAPIDelegate::UpdateCheckInfo {
ChromeRuntimeAPIDelegate::ChromeRuntimeAPIDelegate(
content::BrowserContext* context)
- : browser_context_(context),
- registered_for_updates_(false),
- extension_registry_observer_(this) {
+ : browser_context_(context), registered_for_updates_(false) {
registrar_.Add(this,
extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND,
content::NotificationService::AllSources());
@@ -267,9 +264,12 @@ bool ChromeRuntimeAPIDelegate::CheckForUpdates(
true, kUpdateThrottled, "")));
} else {
info.callbacks.push_back(callback);
- updater->CheckExtensionSoon(
- extension_id, base::Bind(&ChromeRuntimeAPIDelegate::UpdateCheckComplete,
- base::Unretained(this), extension_id));
+
+ extensions::ExtensionUpdater::CheckParams params;
+ params.ids = {extension_id};
+ params.callback = base::Bind(&ChromeRuntimeAPIDelegate::UpdateCheckComplete,
+ base::Unretained(this), extension_id);
+ updater->CheckNow(std::move(params));
}
return true;
}
diff --git a/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h b/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h
index 3b1951383f0..7abc7209460 100644
--- a/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h
+++ b/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h
@@ -15,6 +15,7 @@
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/api/runtime/runtime_api.h"
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
namespace base {
@@ -29,7 +30,6 @@ class NotificationSource;
}
namespace extensions {
-class ExtensionRegistry;
class RuntimeAPI;
class UpdateObserver;
}
@@ -92,7 +92,7 @@ class ChromeRuntimeAPIDelegate : public extensions::RuntimeAPIDelegate,
ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(ChromeRuntimeAPIDelegate);
};
diff --git a/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate_unittest.cc b/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate_unittest.cc
index af092f1be71..c227368864d 100644
--- a/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate_unittest.cc
@@ -334,7 +334,7 @@ TEST_F(ChromeRuntimeAPIDelegateTest, RequestUpdateCheck) {
class ExtensionLoadWaiter : public ExtensionRegistryObserver {
public:
explicit ExtensionLoadWaiter(content::BrowserContext* context)
- : context_(context), extension_registry_observer_(this) {
+ : context_(context) {
extension_registry_observer_.Add(ExtensionRegistry::Get(context_));
}
@@ -366,7 +366,7 @@ class ExtensionLoadWaiter : public ExtensionRegistryObserver {
base::RunLoop run_loop_;
content::BrowserContext* context_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(ExtensionLoadWaiter);
};
diff --git a/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api_unittest.cc b/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api_unittest.cc
index bafb52e22ec..fdbd0c31876 100644
--- a/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api_unittest.cc
@@ -101,7 +101,7 @@ void SafeBrowsingPrivateApiUnitTest::SetUp() {
TestingBrowserProcess::GetGlobal()->SetSafeBrowsingService(
safe_browsing_service);
g_browser_process->safe_browsing_service()->Initialize();
- safe_browsing_service->AddPrefService(profile()->GetPrefs());
+ safe_browsing_service->OnProfileAdded(profile());
}
void SafeBrowsingPrivateApiUnitTest::TearDown() {
diff --git a/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc b/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc
index 7b0692cb8de..31c8db61f5f 100644
--- a/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc
+++ b/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/profiles/reporting_util.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/common/extensions/api/safe_browsing_private.h"
#include "components/policy/core/common/cloud/cloud_policy_client.h"
@@ -33,7 +34,7 @@
namespace extensions {
const base::Feature SafeBrowsingPrivateEventRouter::kRealtimeReportingFeature{
- "SafeBrowsingRealtimeReporting", base::FEATURE_ENABLED_BY_DEFAULT};
+ "SafeBrowsingRealtimeReporting", base::FEATURE_DISABLED_BY_DEFAULT};
// Key names used with when building the dictionary to pass to the real-time
// reporting API.
@@ -53,6 +54,9 @@ const char SafeBrowsingPrivateEventRouter::kKeyClickedThrough[] =
const char SafeBrowsingPrivateEventRouter::kKeyTriggeredRules[] =
"triggeredRules";
const char SafeBrowsingPrivateEventRouter::kKeyThreatType[] = "threatType";
+const char SafeBrowsingPrivateEventRouter::kKeyContentType[] = "contentType";
+const char SafeBrowsingPrivateEventRouter::kKeyContentSize[] = "contentSize";
+const char SafeBrowsingPrivateEventRouter::kKeyTrigger[] = "trigger";
const char SafeBrowsingPrivateEventRouter::kKeyPasswordReuseEvent[] =
"passwordReuseEvent";
@@ -67,6 +71,12 @@ const char SafeBrowsingPrivateEventRouter::kKeySensitiveDataEvent[] =
const char SafeBrowsingPrivateEventRouter::kKeyLargeUnscannedFileEvent[] =
"largeUnscannedFileEvent";
+const char SafeBrowsingPrivateEventRouter::kTriggerFileDownload[] =
+ "FILE_DOWNLOAD";
+const char SafeBrowsingPrivateEventRouter::kTriggerFileUpload[] = "FILE_UPLOAD";
+const char SafeBrowsingPrivateEventRouter::kTriggerWebContentUpload[] =
+ "WEB_CONTENT_UPLOAD";
+
SafeBrowsingPrivateEventRouter::SafeBrowsingPrivateEventRouter(
content::BrowserContext* context)
: context_(context) {
@@ -85,30 +95,6 @@ SafeBrowsingPrivateEventRouter::SafeBrowsingPrivateEventRouter(
}
}
-// TODO(rogerta): once new event types are implemented, will likely want to
-// move this to a more common place.
-base::Value BuildRealtimeReport(Profile* profile, base::Value event) {
- base::Value context(base::Value::Type::DICTIONARY);
-
- ProfileAttributesStorage& storage =
- g_browser_process->profile_manager()->GetProfileAttributesStorage();
- ProfileAttributesEntry* entry = nullptr;
- if (storage.GetProfileAttributesWithPath(profile->GetPath(), &entry)) {
- context.SetStringPath("profile.profileName", entry->GetName());
- context.SetStringPath("profile.gaiaEmail", entry->GetUserName());
- }
-
- context.SetStringPath("profile.profilePath", profile->GetPath().value());
- context.SetStringPath("browser.userAgent", GetUserAgent());
-
- base::Value report(base::Value::Type::DICTIONARY);
- report.SetKey(policy::RealtimeReportingJobConfiguration::kContextKey,
- std::move(context));
- report.SetKey(policy::RealtimeReportingJobConfiguration::kEventKey,
- std::move(event));
- return report;
-}
-
SafeBrowsingPrivateEventRouter::~SafeBrowsingPrivateEventRouter() {}
void SafeBrowsingPrivateEventRouter::OnPolicySpecifiedPasswordReuseDetected(
@@ -171,7 +157,9 @@ void SafeBrowsingPrivateEventRouter::OnPolicySpecifiedPasswordChanged(
void SafeBrowsingPrivateEventRouter::OnDangerousDownloadOpened(
const GURL& url,
const std::string& file_name,
- const std::string& download_digest_sha256) {
+ const std::string& download_digest_sha256,
+ const std::string& mime_type,
+ const int64_t content_size) {
api::safe_browsing_private::DangerousDownloadInfo params;
params.url = url.spec();
params.file_name = file_name;
@@ -197,6 +185,12 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDownloadOpened(
event.SetStringKey(kKeyFileName, params.file_name);
event.SetStringKey(kKeyDownloadDigestSha256, params.download_digest_sha256);
event.SetStringKey(kKeyProfileUserName, params.user_name);
+ event.SetStringKey(kKeyContentType, mime_type);
+ // |content_size| can be set to -1 to indicate an unknown size, in which
+ // case the field is not set.
+ if (content_size >= 0)
+ event.SetIntKey(kKeyContentSize, content_size);
+ event.SetStringKey(kKeyTrigger, kTriggerFileDownload);
ReportRealtimeEvent(kKeyDangerousDownloadEvent, std::move(event));
}
}
@@ -279,7 +273,10 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDeepScanningResult(
const GURL& url,
const std::string& file_name,
const std::string& download_digest_sha256,
- const std::string& threat_type) {
+ const std::string& threat_type,
+ const std::string& mime_type,
+ const std::string& trigger,
+ const int64_t content_size) {
if (IsRealtimeReportingEnabled()) {
// Create a real-time event dictionary from the arguments and report it.
base::Value event(base::Value::Type::DICTIONARY);
@@ -288,6 +285,12 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDeepScanningResult(
event.SetStringKey(kKeyDownloadDigestSha256, download_digest_sha256);
event.SetStringKey(kKeyProfileUserName, GetProfileUserName());
event.SetStringKey(kKeyThreatType, threat_type);
+ event.SetStringKey(kKeyContentType, mime_type);
+ // |content_size| can be set to -1 to indicate an unknown size, in which
+ // case the field is not set.
+ if (content_size >= 0)
+ event.SetIntKey(kKeyContentSize, content_size);
+ event.SetStringKey(kKeyTrigger, trigger);
ReportRealtimeEvent(kKeyDangerousDownloadEvent, std::move(event));
}
}
@@ -296,7 +299,10 @@ void SafeBrowsingPrivateEventRouter::OnSensitiveDataEvent(
const safe_browsing::DlpDeepScanningVerdict& verdict,
const GURL& url,
const std::string& file_name,
- const std::string& download_digest_sha256) {
+ const std::string& download_digest_sha256,
+ const std::string& mime_type,
+ const std::string& trigger,
+ const int64_t content_size) {
if (IsRealtimeReportingEnabled()) {
// Create a real-time event dictionary from the arguments and report it.
base::Value event(base::Value::Type::DICTIONARY);
@@ -304,6 +310,12 @@ void SafeBrowsingPrivateEventRouter::OnSensitiveDataEvent(
event.SetStringKey(kKeyFileName, file_name);
event.SetStringKey(kKeyDownloadDigestSha256, download_digest_sha256);
event.SetStringKey(kKeyProfileUserName, GetProfileUserName());
+ event.SetStringKey(kKeyContentType, mime_type);
+ // |content_size| can be set to -1 to indicate an unknown size, in which
+ // case the field is not set.
+ if (content_size >= 0)
+ event.SetIntKey(kKeyContentSize, content_size);
+ event.SetStringKey(kKeyTrigger, trigger);
base::ListValue triggered_rules;
for (auto rule : verdict.triggered_rules()) {
@@ -317,7 +329,10 @@ void SafeBrowsingPrivateEventRouter::OnSensitiveDataEvent(
void SafeBrowsingPrivateEventRouter::OnLargeUnscannedFileEvent(
const GURL& url,
const std::string& file_name,
- const std::string& download_digest_sha256) {
+ const std::string& download_digest_sha256,
+ const std::string& mime_type,
+ const std::string& trigger,
+ const int64_t content_size) {
if (IsRealtimeReportingEnabled()) {
// Create a real-time event dictionary from the arguments and report it.
base::Value event(base::Value::Type::DICTIONARY);
@@ -325,10 +340,70 @@ void SafeBrowsingPrivateEventRouter::OnLargeUnscannedFileEvent(
event.SetStringKey(kKeyFileName, file_name);
event.SetStringKey(kKeyDownloadDigestSha256, download_digest_sha256);
event.SetStringKey(kKeyProfileUserName, GetProfileUserName());
+ event.SetStringKey(kKeyContentType, mime_type);
+ // |content_size| can be set to -1 to indicate an unknown size, in which
+ // case the field is not set.
+ if (content_size >= 0)
+ event.SetIntKey(kKeyContentSize, content_size);
+ event.SetStringKey(kKeyTrigger, trigger);
ReportRealtimeEvent(kKeyLargeUnscannedFileEvent, std::move(event));
}
}
+void SafeBrowsingPrivateEventRouter::OnDangerousDownloadWarning(
+ const GURL& url,
+ const std::string& file_name,
+ const std::string& download_digest_sha256,
+ const std::string& threat_type,
+ const std::string& mime_type,
+ const int64_t content_size) {
+ if (!IsRealtimeReportingEnabled())
+ return;
+
+ // Create a real-time event dictionary and report it.
+ base::Value event(base::Value::Type::DICTIONARY);
+ event.SetStringKey(kKeyUrl, url.spec());
+ event.SetStringKey(kKeyFileName, file_name);
+ event.SetStringKey(kKeyDownloadDigestSha256, download_digest_sha256);
+ event.SetStringKey(kKeyProfileUserName, GetProfileUserName());
+ event.SetStringKey(kKeyThreatType, threat_type);
+ event.SetBoolKey(kKeyClickedThrough, false);
+ event.SetStringKey(kKeyContentType, mime_type);
+ // |content_size| can be set to -1 to indicate an unknown size, in which case
+ // the field is not set.
+ if (content_size >= 0)
+ event.SetIntKey(kKeyContentSize, content_size);
+ event.SetStringKey(kKeyTrigger, kTriggerFileDownload);
+ ReportRealtimeEvent(kKeyDangerousDownloadEvent, std::move(event));
+}
+
+void SafeBrowsingPrivateEventRouter::OnDangerousDownloadWarningBypassed(
+ const GURL& url,
+ const std::string& file_name,
+ const std::string& download_digest_sha256,
+ const std::string& threat_type,
+ const std::string& mime_type,
+ const int64_t content_size) {
+ if (!IsRealtimeReportingEnabled())
+ return;
+
+ // Create a real-time event dictionary and report it.
+ base::Value event(base::Value::Type::DICTIONARY);
+ event.SetStringKey(kKeyUrl, url.spec());
+ event.SetStringKey(kKeyFileName, file_name);
+ event.SetStringKey(kKeyDownloadDigestSha256, download_digest_sha256);
+ event.SetStringKey(kKeyProfileUserName, GetProfileUserName());
+ event.SetStringKey(kKeyThreatType, threat_type);
+ event.SetBoolKey(kKeyClickedThrough, true);
+ event.SetStringKey(kKeyContentType, mime_type);
+ // |content_size| can be set to -1 to indicate an unknown size, in which case
+ // the field is not set.
+ if (content_size >= 0)
+ event.SetIntKey(kKeyContentSize, content_size);
+ event.SetStringKey(kKeyTrigger, kTriggerFileDownload);
+ ReportRealtimeEvent(kKeyDangerousDownloadEvent, std::move(event));
+}
+
void SafeBrowsingPrivateEventRouter::SetCloudPolicyClientForTesting(
std::unique_ptr<policy::CloudPolicyClient> client) {
DCHECK_EQ(nullptr, client_.get());
@@ -337,14 +412,15 @@ void SafeBrowsingPrivateEventRouter::SetCloudPolicyClientForTesting(
void SafeBrowsingPrivateEventRouter::InitRealtimeReportingClient() {
#if !defined(OS_CHROMEOS)
- // This method is not compiled on chromeos because
- // MachineLevelUserCloudPolicyController does not exist. Also,
- // policy::BrowserDMTokenStorage::Get()->RetrieveDMToken() does return a
- // valid token either. Once these are fixed the #if !define can be removed.
// If already initialized, do nothing.
if (client_)
return;
+ // This method is not compiled on Chrome OS because
+ // MachineLevelUserCloudPolicyController does not exist. Also,
+ // policy::BrowserDMTokenStorage::Get()->RetrieveDMToken() doesn't return a
+ // valid token either. Once these are fixed the #if !defined can be removed.
+
if (!policy::MachineLevelUserCloudPolicyController::
IsMachineLevelUserCloudPolicyEnabled()) {
return;
@@ -435,9 +511,13 @@ void SafeBrowsingPrivateEventRouter::ReportRealtimeEvent(const char* name,
wrapper.SetStringKey("time", now_str);
wrapper.SetKey(name, std::move(event));
+ base::Value event_list(base::Value::Type::LIST);
+ event_list.Append(std::move(wrapper));
+
client_->UploadRealtimeReport(
- BuildRealtimeReport(Profile::FromBrowserContext(context_),
- std::move(wrapper)),
+ policy::RealtimeReportingJobConfiguration::BuildReport(
+ std::move(event_list),
+ reporting::GetContext(Profile::FromBrowserContext(context_))),
base::DoNothing());
}
diff --git a/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h b/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h
index 9a3441613dc..754a73b3f64 100644
--- a/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h
+++ b/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h
@@ -59,6 +59,9 @@ class SafeBrowsingPrivateEventRouter : public KeyedService {
static const char kKeyClickedThrough[];
static const char kKeyTriggeredRules[];
static const char kKeyThreatType[];
+ static const char kKeyContentType[];
+ static const char kKeyContentSize[];
+ static const char kKeyTrigger[];
static const char kKeyPasswordReuseEvent[];
static const char kKeyPasswordChangedEvent[];
@@ -67,6 +70,11 @@ class SafeBrowsingPrivateEventRouter : public KeyedService {
static const char kKeySensitiveDataEvent[];
static const char kKeyLargeUnscannedFileEvent[];
+ // String constants for the "trigger" event field.
+ static const char kTriggerFileDownload[];
+ static const char kTriggerFileUpload[];
+ static const char kTriggerWebContentUpload[];
+
explicit SafeBrowsingPrivateEventRouter(content::BrowserContext* context);
~SafeBrowsingPrivateEventRouter() override;
@@ -83,7 +91,9 @@ class SafeBrowsingPrivateEventRouter : public KeyedService {
// Notifies listeners that the user just opened a dangerous download.
void OnDangerousDownloadOpened(const GURL& url,
const std::string& file_name,
- const std::string& download_digest_sha256);
+ const std::string& download_digest_sha256,
+ const std::string& mime_type,
+ const int64_t content_size);
// Notifies listeners that the user saw a security interstitial.
void OnSecurityInterstitialShown(const GURL& url,
@@ -99,19 +109,53 @@ class SafeBrowsingPrivateEventRouter : public KeyedService {
void OnDangerousDeepScanningResult(const GURL& url,
const std::string& file_name,
const std::string& download_digest_sha256,
- const std::string& threat_type);
+ const std::string& threat_type,
+ const std::string& mime_type,
+ const std::string& trigger,
+ const int64_t content_size);
// Notifies listeners that scanning for sensitive data detected a violation.
void OnSensitiveDataEvent(
const safe_browsing::DlpDeepScanningVerdict& verdict,
const GURL& url,
const std::string& file_name,
- const std::string& download_digest_sha256);
+ const std::string& download_digest_sha256,
+ const std::string& mime_type,
+ const std::string& trigger,
+ const int64_t content_size);
// Notifies listeners that deep scanning failed, since the file was too large.
void OnLargeUnscannedFileEvent(const GURL& url,
const std::string& file_name,
- const std::string& download_digest_sha256);
+ const std::string& download_digest_sha256,
+ const std::string& mime_type,
+ const std::string& trigger,
+ const int64_t content_size);
+
+ // Notifies listeners that the user saw a download warning.
+ // - |url| is the download URL
+ // - |file_name| is the path on disk
+ // - |download_digest_sha256| is the hex-encoded SHA256
+ // - |threat_type| is the danger type of the download.
+ void OnDangerousDownloadWarning(const GURL& url,
+ const std::string& file_name,
+ const std::string& download_digest_sha256,
+ const std::string& threat_type,
+ const std::string& mime_type,
+ const int64_t content_size);
+
+ // Notifies listeners that the user bypassed a download warning.
+ // - |url| is the download URL
+ // - |file_name| is the path on disk
+ // - |download_digest_sha256| is the hex-encoded SHA256
+ // - |threat_type| is the danger type of the download.
+ void OnDangerousDownloadWarningBypassed(
+ const GURL& url,
+ const std::string& file_name,
+ const std::string& download_digest_sha256,
+ const std::string& threat_type,
+ const std::string& mime_type,
+ const int64_t content_size);
void SetCloudPolicyClientForTesting(
std::unique_ptr<policy::CloudPolicyClient> client);
diff --git a/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_unittest.cc b/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_unittest.cc
index 26c8393207c..b0085a1e5d2 100644
--- a/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_unittest.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h"
#include "base/bind.h"
+#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/mock_callback.h"
#include "base/values.h"
@@ -94,7 +95,7 @@ class SafeBrowsingPrivateEventRouterTest : public testing::Test {
SafeBrowsingPrivateEventRouterFactory::GetForProfile(profile_)
->OnDangerousDownloadOpened(GURL("https://evil.com/malware.exe"),
"/path/to/malware.exe",
- "sha256_or_malware_exe");
+ "sha256_of_malware_exe", "exe", 1234);
}
void TriggerOnSecurityInterstitialShownEvent() {
@@ -109,6 +110,20 @@ class SafeBrowsingPrivateEventRouterTest : public testing::Test {
"PHISHING", -201);
}
+ void TriggerOnDangerousDownloadWarningEvent() {
+ SafeBrowsingPrivateEventRouterFactory::GetForProfile(profile_)
+ ->OnDangerousDownloadWarning(
+ GURL("https://maybevil.com/warning.exe"), "/path/to/warning.exe",
+ "sha256_of_warning_exe", "POTENTIALLY_UNWANTED", "exe", 567);
+ }
+
+ void TriggerOnDangerousDownloadWarningEventBypass() {
+ SafeBrowsingPrivateEventRouterFactory::GetForProfile(profile_)
+ ->OnDangerousDownloadWarning(
+ GURL("https://bypassevil.com/bypass.exe"), "/path/to/bypass.exe",
+ "sha256_of_bypass_exe", "BYPASSED_WARNING", "exe", 890);
+ }
+
void SetReportingPolicy(bool enabled) {
TestingBrowserProcess::GetGlobal()->local_state()->SetBoolean(
prefs::kUnsafeEventsReportingEnabled, enabled);
@@ -166,12 +181,16 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnReuseDetected) {
Mock::VerifyAndClearExpectations(client_);
EXPECT_EQ(base::Value::Type::DICTIONARY, report.type());
- base::Value* wrapper =
- report.FindKey(policy::RealtimeReportingJobConfiguration::kEventKey);
- ASSERT_NE(nullptr, wrapper);
- EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper->type());
+ base::Value* event_list =
+ report.FindKey(policy::RealtimeReportingJobConfiguration::kEventListKey);
+ ASSERT_NE(nullptr, event_list);
+ EXPECT_EQ(base::Value::Type::LIST, event_list->type());
+ base::Value::ListStorage& mutable_list = event_list->GetList();
+ ASSERT_EQ(1, (int)mutable_list.size());
+ base::Value wrapper = std::move(mutable_list[0]);
+ EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper.type());
base::Value* event =
- wrapper->FindKey(SafeBrowsingPrivateEventRouter::kKeyPasswordReuseEvent);
+ wrapper.FindKey(SafeBrowsingPrivateEventRouter::kKeyPasswordReuseEvent);
EXPECT_NE(nullptr, event);
EXPECT_EQ("https://phishing.com/",
*event->FindStringKey(SafeBrowsingPrivateEventRouter::kKeyUrl));
@@ -197,12 +216,16 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnPasswordChanged) {
Mock::VerifyAndClearExpectations(client_);
EXPECT_EQ(base::Value::Type::DICTIONARY, report.type());
- base::Value* wrapper =
- report.FindKey(policy::RealtimeReportingJobConfiguration::kEventKey);
- ASSERT_NE(nullptr, wrapper);
- EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper->type());
- base::Value* event = wrapper->FindKey(
- SafeBrowsingPrivateEventRouter::kKeyPasswordChangedEvent);
+ base::Value* event_list =
+ report.FindKey(policy::RealtimeReportingJobConfiguration::kEventListKey);
+ ASSERT_NE(nullptr, event_list);
+ EXPECT_EQ(base::Value::Type::LIST, event_list->type());
+ base::Value::ListStorage& mutable_list = event_list->GetList();
+ ASSERT_EQ(1, (int)mutable_list.size());
+ base::Value wrapper = std::move(mutable_list[0]);
+ EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper.type());
+ base::Value* event =
+ wrapper.FindKey(SafeBrowsingPrivateEventRouter::kKeyPasswordChangedEvent);
EXPECT_NE(nullptr, event);
EXPECT_EQ("user_name_2", *event->FindStringKey(
SafeBrowsingPrivateEventRouter::kKeyUserName));
@@ -227,21 +250,31 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnDangerousDownloadOpened) {
EXPECT_EQ("/path/to/malware.exe",
captured_args.FindKey("fileName")->GetString());
EXPECT_EQ("", captured_args.FindKey("userName")->GetString());
- EXPECT_EQ("sha256_or_malware_exe",
+ EXPECT_EQ("sha256_of_malware_exe",
captured_args.FindKey("downloadDigestSha256")->GetString());
Mock::VerifyAndClearExpectations(client_);
EXPECT_EQ(base::Value::Type::DICTIONARY, report.type());
- base::Value* wrapper =
- report.FindKey(policy::RealtimeReportingJobConfiguration::kEventKey);
- ASSERT_NE(nullptr, wrapper);
- EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper->type());
- base::Value* event = wrapper->FindKey(
+ base::Value* event_list =
+ report.FindKey(policy::RealtimeReportingJobConfiguration::kEventListKey);
+ ASSERT_NE(nullptr, event_list);
+ EXPECT_EQ(base::Value::Type::LIST, event_list->type());
+ base::Value::ListStorage& mutable_list = event_list->GetList();
+ ASSERT_EQ(1, (int)mutable_list.size());
+ base::Value wrapper = std::move(mutable_list[0]);
+ EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper.type());
+ base::Value* event = wrapper.FindKey(
SafeBrowsingPrivateEventRouter::kKeyDangerousDownloadEvent);
EXPECT_NE(nullptr, event);
EXPECT_EQ(
"/path/to/malware.exe",
*event->FindStringKey(SafeBrowsingPrivateEventRouter::kKeyFileName));
+ EXPECT_EQ("exe", *event->FindStringKey(
+ SafeBrowsingPrivateEventRouter::kKeyContentType));
+ EXPECT_EQ(1234, *event->FindIntKey(
+ SafeBrowsingPrivateEventRouter::kKeyContentSize));
+ EXPECT_EQ(SafeBrowsingPrivateEventRouter::kTriggerFileDownload,
+ *event->FindStringKey(SafeBrowsingPrivateEventRouter::kKeyTrigger));
}
TEST_F(SafeBrowsingPrivateEventRouterTest,
@@ -266,12 +299,16 @@ TEST_F(SafeBrowsingPrivateEventRouterTest,
Mock::VerifyAndClearExpectations(client_);
EXPECT_EQ(base::Value::Type::DICTIONARY, report.type());
- base::Value* wrapper =
- report.FindKey(policy::RealtimeReportingJobConfiguration::kEventKey);
- ASSERT_NE(nullptr, wrapper);
- EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper->type());
+ base::Value* event_list =
+ report.FindKey(policy::RealtimeReportingJobConfiguration::kEventListKey);
+ ASSERT_NE(nullptr, event_list);
+ EXPECT_EQ(base::Value::Type::LIST, event_list->type());
+ base::Value::ListStorage& mutable_list = event_list->GetList();
+ ASSERT_EQ(1, (int)mutable_list.size());
+ base::Value wrapper = std::move(mutable_list[0]);
+ EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper.type());
base::Value* event =
- wrapper->FindKey(SafeBrowsingPrivateEventRouter::kKeyInterstitialEvent);
+ wrapper.FindKey(SafeBrowsingPrivateEventRouter::kKeyInterstitialEvent);
EXPECT_NE(nullptr, event);
EXPECT_EQ("PHISHING",
*event->FindStringKey(SafeBrowsingPrivateEventRouter::kKeyReason));
@@ -302,12 +339,16 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnSecurityInterstitialShown) {
Mock::VerifyAndClearExpectations(client_);
EXPECT_EQ(base::Value::Type::DICTIONARY, report.type());
- base::Value* wrapper =
- report.FindKey(policy::RealtimeReportingJobConfiguration::kEventKey);
- ASSERT_NE(nullptr, wrapper);
- EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper->type());
+ base::Value* event_list =
+ report.FindKey(policy::RealtimeReportingJobConfiguration::kEventListKey);
+ ASSERT_NE(nullptr, event_list);
+ EXPECT_EQ(base::Value::Type::LIST, event_list->type());
+ base::Value::ListStorage& mutable_list = event_list->GetList();
+ ASSERT_EQ(1, (int)mutable_list.size());
+ base::Value wrapper = std::move(mutable_list[0]);
+ EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper.type());
base::Value* event =
- wrapper->FindKey(SafeBrowsingPrivateEventRouter::kKeyInterstitialEvent);
+ wrapper.FindKey(SafeBrowsingPrivateEventRouter::kKeyInterstitialEvent);
EXPECT_NE(nullptr, event);
EXPECT_EQ("PHISHING",
*event->FindStringKey(SafeBrowsingPrivateEventRouter::kKeyReason));
@@ -317,6 +358,83 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnSecurityInterstitialShown) {
*event->FindBoolKey(SafeBrowsingPrivateEventRouter::kKeyClickedThrough));
}
+TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnDangerousDownloadWarning) {
+ SetUpRouters();
+ SafeBrowsingEventObserver event_observer(
+ api::safe_browsing_private::OnDangerousDownloadOpened::kEventName);
+ event_router_->AddEventObserver(&event_observer);
+
+ base::Value report;
+ EXPECT_CALL(*client_, UploadRealtimeReport(_, _))
+ .WillOnce(CaptureArg(&report));
+
+ TriggerOnDangerousDownloadWarningEvent();
+ base::RunLoop().RunUntilIdle();
+
+ Mock::VerifyAndClearExpectations(client_);
+ EXPECT_EQ(base::Value::Type::DICTIONARY, report.type());
+ base::Value* event_list =
+ report.FindKey(policy::RealtimeReportingJobConfiguration::kEventListKey);
+ ASSERT_NE(nullptr, event_list);
+ EXPECT_EQ(base::Value::Type::LIST, event_list->type());
+ base::Value::ListStorage& mutable_list = event_list->GetList();
+ ASSERT_EQ(1, (int)mutable_list.size());
+ base::Value wrapper = std::move(mutable_list[0]);
+ EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper.type());
+ base::Value* event = wrapper.FindKey(
+ SafeBrowsingPrivateEventRouter::kKeyDangerousDownloadEvent);
+ EXPECT_NE(nullptr, event);
+ EXPECT_EQ(
+ "/path/to/warning.exe",
+ *event->FindStringKey(SafeBrowsingPrivateEventRouter::kKeyFileName));
+ EXPECT_EQ("exe", *event->FindStringKey(
+ SafeBrowsingPrivateEventRouter::kKeyContentType));
+ EXPECT_EQ(
+ 567, *event->FindIntKey(SafeBrowsingPrivateEventRouter::kKeyContentSize));
+ EXPECT_EQ(
+ "POTENTIALLY_UNWANTED",
+ *event->FindStringKey(SafeBrowsingPrivateEventRouter::kKeyThreatType));
+}
+
+TEST_F(SafeBrowsingPrivateEventRouterTest,
+ TestOnDangerousDownloadWarningBypass) {
+ SetUpRouters();
+ SafeBrowsingEventObserver event_observer(
+ api::safe_browsing_private::OnDangerousDownloadOpened::kEventName);
+ event_router_->AddEventObserver(&event_observer);
+
+ base::Value report;
+ EXPECT_CALL(*client_, UploadRealtimeReport(_, _))
+ .WillOnce(CaptureArg(&report));
+
+ TriggerOnDangerousDownloadWarningEventBypass();
+ base::RunLoop().RunUntilIdle();
+
+ Mock::VerifyAndClearExpectations(client_);
+ EXPECT_EQ(base::Value::Type::DICTIONARY, report.type());
+ base::Value* event_list =
+ report.FindKey(policy::RealtimeReportingJobConfiguration::kEventListKey);
+ ASSERT_NE(nullptr, event_list);
+ EXPECT_EQ(base::Value::Type::LIST, event_list->type());
+ base::Value::ListStorage& mutable_list = event_list->GetList();
+ ASSERT_EQ(1, (int)mutable_list.size());
+ base::Value wrapper = std::move(mutable_list[0]);
+ EXPECT_EQ(base::Value::Type::DICTIONARY, wrapper.type());
+ base::Value* event = wrapper.FindKey(
+ SafeBrowsingPrivateEventRouter::kKeyDangerousDownloadEvent);
+ EXPECT_NE(nullptr, event);
+ EXPECT_EQ(
+ "/path/to/bypass.exe",
+ *event->FindStringKey(SafeBrowsingPrivateEventRouter::kKeyFileName));
+ EXPECT_EQ("exe", *event->FindStringKey(
+ SafeBrowsingPrivateEventRouter::kKeyContentType));
+ EXPECT_EQ(
+ 890, *event->FindIntKey(SafeBrowsingPrivateEventRouter::kKeyContentSize));
+ EXPECT_EQ(
+ "BYPASSED_WARNING",
+ *event->FindStringKey(SafeBrowsingPrivateEventRouter::kKeyThreatType));
+}
+
TEST_F(SafeBrowsingPrivateEventRouterTest, PolicyControlOnToOffIsDynamic) {
SetUpRouters();
SafeBrowsingEventObserver event_observer(
diff --git a/chromium/chrome/browser/extensions/api/sessions/sessions_api.cc b/chromium/chrome/browser/extensions/api/sessions/sessions_api.cc
index 882f22b3fdf..7d2d33e5188 100644
--- a/chromium/chrome/browser/extensions/api/sessions/sessions_api.cc
+++ b/chromium/chrome/browser/extensions/api/sessions/sessions_api.cc
@@ -104,10 +104,8 @@ api::tabs::Tab CreateTabModelHelper(
ExtensionTabUtil::ScrubTabBehavior scrub_tab_behavior =
ExtensionTabUtil::GetScrubTabBehavior(extension, context, url);
- if (scrub_tab_behavior != ExtensionTabUtil::kDontScrubTab) {
- ExtensionTabUtil::ScrubTabForExtension(extension, nullptr, &tab_struct,
- scrub_tab_behavior);
- }
+ ExtensionTabUtil::ScrubTabForExtension(extension, nullptr, &tab_struct,
+ scrub_tab_behavior);
return tab_struct;
}
diff --git a/chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc b/chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc
index f8fc80c5b23..4a84d88c33d 100644
--- a/chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/sessions/sessions_apitest.cc
@@ -27,7 +27,7 @@
#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/base/client_tag_hash.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"
@@ -144,8 +144,9 @@ testing::AssertionResult CheckSessionModels(const base::ListValue& devices,
return testing::AssertionSuccess();
}
-std::string TagHashFromSpecifics(const sync_pb::SessionSpecifics& specifics) {
- return syncer::GenerateSyncableHash(
+syncer::ClientTagHash TagHashFromSpecifics(
+ const sync_pb::SessionSpecifics& specifics) {
+ return syncer::ClientTagHash::FromUnhashed(
syncer::SESSIONS, sync_sessions::SessionStore::GetClientTag(specifics));
}
@@ -236,7 +237,8 @@ void ExtensionSessionsTest::CreateSessionModels() {
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->id =
+ "FakeId:" + header_entity_data->client_tag_hash.value();
header_entity_data->specifics = header_entity;
header_entity_data->creation_time =
time_now - base::TimeDelta::FromSeconds(index);
diff --git a/chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc b/chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc
index 706e3a5b7ab..a9d7d9a853b 100644
--- a/chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc
+++ b/chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc
@@ -22,7 +22,6 @@
#include "components/search_engines/template_url_prepopulate_data.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_prefs_factory.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/manifest_constants.h"
@@ -110,8 +109,7 @@ std::unique_ptr<TemplateURLData> ConvertSearchProvider(
SettingsOverridesAPI::SettingsOverridesAPI(content::BrowserContext* context)
: profile_(Profile::FromBrowserContext(context)),
- url_service_(TemplateURLServiceFactory::GetForProfile(profile_)),
- extension_registry_observer_(this) {
+ url_service_(TemplateURLServiceFactory::GetForProfile(profile_)) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
}
diff --git a/chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h b/chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h
index 3c80f897680..baf7419ef7b 100644
--- a/chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h
+++ b/chromium/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h
@@ -13,12 +13,12 @@
#include "base/scoped_observer.h"
#include "components/search_engines/template_url_service.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
class Profile;
namespace extensions {
-class ExtensionRegistry;
class SettingsOverridesAPI : public BrowserContextKeyedAPI,
public ExtensionRegistryObserver {
@@ -56,7 +56,7 @@ class SettingsOverridesAPI : public BrowserContextKeyedAPI,
// Listen to extension load, unloaded notifications.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(SettingsOverridesAPI);
};
diff --git a/chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_method_short.cc b/chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_method_short.cc
index 65c4c99243e..18323cfb6a8 100644
--- a/chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_method_short.cc
+++ b/chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_method_short.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_method_short.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/system/timezone_resolver_manager.h"
#include "chrome/browser/extensions/api/settings_private/generated_pref.h"
#include "chrome/browser/extensions/api/settings_private/generated_time_zone_pref_base.h"
diff --git a/chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_on_off.cc b/chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_on_off.cc
index 4227609b7ab..3eec3a7ea37 100644
--- a/chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_on_off.cc
+++ b/chromium/chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_on_off.cc
@@ -6,6 +6,7 @@
#include "base/feature_list.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/system/timezone_resolver_manager.h"
#include "chrome/browser/extensions/api/settings_private/generated_pref.h"
#include "chrome/browser/extensions/api/settings_private/generated_time_zone_pref_base.h"
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 9e1dae7356f..92dd63b50f5 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
@@ -6,6 +6,7 @@
#include "base/feature_list.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/system/timezone_resolver_manager.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_features.h"
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 40e299858d2..a4878a09ca6 100644
--- a/chromium/chrome/browser/extensions/api/settings_private/prefs_util.cc
+++ b/chromium/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -8,6 +8,7 @@
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/extensions/api/settings_private/generated_prefs.h"
#include "chrome/browser/extensions/api/settings_private/generated_prefs_factory.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
@@ -56,6 +57,7 @@
#include "chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_method_short.h"
#include "chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_on_off.h"
#include "chromeos/constants/chromeos_features.h"
+#include "chromeos/constants/chromeos_pref_names.h"
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/arc/arc_prefs.h"
@@ -150,6 +152,8 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[autofill::prefs::kAutofillCreditCardEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
+ (*s_whitelist)[autofill::prefs::kAutofillCreditCardFidoAuthEnabled] =
+ settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[payments::kCanMakePaymentEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[bookmarks::prefs::kShowBookmarkBar] =
@@ -344,6 +348,8 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[chromeos::kAccountsPrefUsers] =
settings_api::PrefType::PREF_TYPE_LIST;
+ (*s_whitelist)[chromeos::prefs::kSecondaryGoogleAccountSigninAllowed] =
+ settings_api::PrefType::PREF_TYPE_BOOLEAN;
// kEnableAutoScreenLock is read-only.
(*s_whitelist)[ash::prefs::kEnableAutoScreenLock] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
@@ -751,8 +757,13 @@ std::unique_ptr<settings_api::PrefObject> PrefsUtil::GetPref(
#endif
if (pref && pref->IsManaged()) {
- pref_object->controlled_by =
- settings_api::ControlledBy::CONTROLLED_BY_USER_POLICY;
+ if (profile_->IsChild()) {
+ pref_object->controlled_by =
+ settings_api::ControlledBy::CONTROLLED_BY_CHILD_RESTRICTION;
+ } else {
+ pref_object->controlled_by =
+ settings_api::ControlledBy::CONTROLLED_BY_USER_POLICY;
+ }
pref_object->enforcement = settings_api::Enforcement::ENFORCEMENT_ENFORCED;
return pref_object;
}
diff --git a/chromium/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc b/chromium/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc
index 9eb362464dd..1c6eddf0231 100644
--- a/chromium/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc
+++ b/chromium/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc
@@ -15,9 +15,9 @@
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
-#include "content/public/common/page_zoom.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
+#include "third_party/blink/public/common/page/page_zoom.h"
#include "url/gurl.h"
namespace extensions {
@@ -64,7 +64,7 @@ std::unique_ptr<base::Value> SettingsPrivateDelegate::GetDefaultZoom() {
// default value.
if (profile_->IsOffTheRecord())
return std::make_unique<base::Value>(0.0);
- double zoom = content::ZoomLevelToZoomFactor(
+ double zoom = blink::PageZoomLevelToZoomFactor(
profile_->GetZoomLevelPrefs()->GetDefaultZoomLevelPref());
return std::make_unique<base::Value>(zoom);
}
@@ -74,7 +74,7 @@ settings_private::SetPrefResult SettingsPrivateDelegate::SetDefaultZoom(
// See comment in GetDefaultZoom().
if (profile_->IsOffTheRecord())
return settings_private::SetPrefResult::PREF_NOT_MODIFIABLE;
- double zoom_factor = content::ZoomFactorToZoomLevel(zoom);
+ double zoom_factor = blink::PageZoomFactorToZoomLevel(zoom);
profile_->GetZoomLevelPrefs()->SetDefaultZoomLevelPref(zoom_factor);
return settings_private::SetPrefResult::SUCCESS;
}
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 cdc749a01c9..e6460b930f1 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
@@ -33,13 +33,17 @@ 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", base::Time(),
- /*send_tab_to_self_receiving_enabled=*/true));
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id1",
+ base::SysInfo::HardwareInfo(), base::Time(),
+ /*send_tab_to_self_receiving_enabled=*/true,
+ /*sharing_info=*/base::nullopt));
devices.push_back(std::make_unique<DeviceInfo>(
base::GenerateGUID(), "def Device", "XYZ v1", "XYZ SyncAgent v1",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id2", base::Time(),
- /*send_tab_to_self_receiving_enabled=*/true));
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id2",
+ base::SysInfo::HardwareInfo(), base::Time(),
+ /*send_tab_to_self_receiving_enabled=*/true,
+ /*sharing_info=*/base::nullopt));
base::DictionaryValue dictionary;
@@ -56,8 +60,10 @@ 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", base::Time(),
- /*send_tab_to_self_receiving_enabled=*/true));
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id3",
+ base::SysInfo::HardwareInfo(), base::Time(),
+ /*send_tab_to_self_receiving_enabled=*/true,
+ /*sharing_info=*/base::nullopt));
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 1d5d4eac138..0ebd0738031 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
@@ -18,16 +18,14 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/device_info_sync_service_factory.h"
#include "components/sync_device_info/device_info.h"
-#include "components/sync_device_info/device_info_sync_service.h"
-#include "components/sync_device_info/fake_device_info_tracker.h"
+#include "components/sync_device_info/fake_device_info_sync_service.h"
#include "content/public/test/browser_task_environment.h"
#include "extensions/common/extension.h"
-#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using syncer::DeviceInfo;
+using syncer::FakeDeviceInfoSyncService;
using syncer::FakeDeviceInfoTracker;
-using testing::Return;
namespace extensions {
@@ -45,12 +43,16 @@ TEST(SignedInDevicesAPITest, GetSignedInDevices) {
DeviceInfo device_info1(base::GenerateGUID(), "abc Device", "XYZ v1",
"XYZ SyncAgent v1",
sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id",
- base::Time(), true);
+ base::SysInfo::HardwareInfo(), base::Time(),
+ /*send_tab_to_self_receiving_enabled=*/true,
+ /*sharing_info=*/base::nullopt);
DeviceInfo device_info2(base::GenerateGUID(), "def Device", "XYZ v2",
"XYZ SyncAgent v2",
sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id",
- base::Time(), true);
+ base::SysInfo::HardwareInfo(), base::Time(),
+ /*send_tab_to_self_receiving_enabled=*/true,
+ /*sharing_info=*/base::nullopt);
device_tracker.Add(&device_info1);
device_tracker.Add(&device_info2);
@@ -70,7 +72,9 @@ TEST(SignedInDevicesAPITest, GetSignedInDevices) {
DeviceInfo device_info3(base::GenerateGUID(), "def Device", "jkl v2",
"XYZ SyncAgent v2",
sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id",
- base::Time(), true);
+ base::SysInfo::HardwareInfo(), base::Time(),
+ /*send_tab_to_self_receiving_enabled=*/true,
+ /*sharing_info=*/base::nullopt);
device_tracker.Add(&device_info3);
@@ -86,39 +90,16 @@ TEST(SignedInDevicesAPITest, GetSignedInDevices) {
EXPECT_NE(public_id3, public_id2);
}
-class MockDeviceInfoSyncService : public syncer::DeviceInfoSyncService {
- public:
- MockDeviceInfoSyncService() = default;
- ~MockDeviceInfoSyncService() override = default;
-
- FakeDeviceInfoTracker* fake_tracker() { return &tracker_; }
-
- // DeviceInfoSyncService implementation.
- syncer::LocalDeviceInfoProvider* GetLocalDeviceInfoProvider() override {
- return nullptr;
- }
- syncer::DeviceInfoTracker* GetDeviceInfoTracker() override {
- return &tracker_;
- }
- base::WeakPtr<syncer::ModelTypeControllerDelegate> GetControllerDelegate()
- override {
- return nullptr;
- }
-
- private:
- FakeDeviceInfoTracker tracker_;
-};
-
-std::unique_ptr<KeyedService> CreateMockDeviceInfoSyncService(
+std::unique_ptr<KeyedService> CreateFakeDeviceInfoSyncService(
content::BrowserContext* context) {
- return std::make_unique<MockDeviceInfoSyncService>();
+ return std::make_unique<FakeDeviceInfoSyncService>();
}
class ExtensionSignedInDevicesTest : public ExtensionApiUnittest {
private:
TestingProfile::TestingFactories GetTestingFactories() override {
return {{DeviceInfoSyncServiceFactory::GetInstance(),
- base::BindRepeating(&CreateMockDeviceInfoSyncService)}};
+ base::BindRepeating(&CreateFakeDeviceInfoSyncService)}};
}
};
@@ -151,20 +132,23 @@ base::DictionaryValue* GetDictionaryFromList(int index,
}
TEST_F(ExtensionSignedInDevicesTest, GetAll) {
- FakeDeviceInfoTracker* device_tracker =
- static_cast<MockDeviceInfoSyncService*>(
- DeviceInfoSyncServiceFactory::GetForProfile(profile()))
- ->fake_tracker();
+ FakeDeviceInfoTracker* device_tracker = static_cast<FakeDeviceInfoTracker*>(
+ DeviceInfoSyncServiceFactory::GetForProfile(profile())
+ ->GetDeviceInfoTracker());
DeviceInfo device_info1(base::GenerateGUID(), "abc Device", "XYZ v1",
"XYZ SyncAgent v1",
sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id",
- base::Time(), true);
+ base::SysInfo::HardwareInfo(), base::Time(),
+ /*send_tab_to_self_receiving_enabled=*/true,
+ /*sharing_info=*/base::nullopt);
DeviceInfo device_info2(base::GenerateGUID(), "def Device", "XYZ v2",
"XYZ SyncAgent v2",
sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id",
- base::Time(), true);
+ base::SysInfo::HardwareInfo(), base::Time(),
+ /*send_tab_to_self_receiving_enabled=*/true,
+ /*sharing_info=*/base::nullopt);
device_tracker->Add(&device_info1);
device_tracker->Add(&device_info2);
diff --git a/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc b/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc
index 8b6576e9656..aa0cb34d1f1 100644
--- a/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc
+++ b/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc
@@ -19,7 +19,6 @@
#include "components/sync_device_info/device_info.h"
#include "components/sync_device_info/device_info_sync_service.h"
#include "extensions/browser/event_router.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
using syncer::DeviceInfo;
@@ -93,13 +92,9 @@ SignedInDevicesManager::GetFactoryInstance() {
return g_signed_in_devices_manager_factory.Pointer();
}
-SignedInDevicesManager::SignedInDevicesManager()
- : profile_(NULL), extension_registry_observer_(this) {
-}
-
+SignedInDevicesManager::SignedInDevicesManager() = default;
SignedInDevicesManager::SignedInDevicesManager(content::BrowserContext* context)
- : profile_(Profile::FromBrowserContext(context)),
- extension_registry_observer_(this) {
+ : profile_(Profile::FromBrowserContext(context)) {
EventRouter* router = EventRouter::Get(profile_);
if (router) {
router->RegisterObserver(
diff --git a/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h b/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h
index bb7ab76b965..512d83d32fe 100644
--- a/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h
+++ b/chromium/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h
@@ -16,6 +16,7 @@
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
class Profile;
@@ -26,7 +27,6 @@ class BrowserContext;
namespace extensions {
class BrowserContextKeyedAPI;
-class ExtensionRegistry;
struct EventListenerInfo;
@@ -54,6 +54,8 @@ class SignedInDevicesChangeObserver
std::string extension_id_;
Profile* const profile_;
content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(SignedInDevicesChangeObserver);
};
class SignedInDevicesManager : public BrowserContextKeyedAPI,
@@ -90,12 +92,12 @@ class SignedInDevicesManager : public BrowserContextKeyedAPI,
void RemoveChangeObserverForExtension(const std::string& extension_id);
- Profile* const profile_;
+ Profile* const profile_ = nullptr;
std::vector<std::unique_ptr<SignedInDevicesChangeObserver>> change_observers_;
// Listen to extension unloaded notification.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
FRIEND_TEST_ALL_PREFIXES(SignedInDevicesManager, UpdateListener);
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 0e34dab6a97..49d784a90d7 100644
--- a/chromium/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
@@ -12,6 +12,8 @@
#include "content/public/browser/browser_context.h"
#include "content/public/test/test_storage_partition.h"
#include "extensions/browser/api/socket/tcp_socket.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -89,10 +91,10 @@ class TCPSocketUnitTestBase : public extensions::ExtensionServiceTestBase {
void Initialize() {
url_request_context_.Init();
network_context_ = std::make_unique<network::NetworkContext>(
- nullptr, mojo::MakeRequest(&network_context_ptr_),
+ nullptr, network_context_remote_.BindNewPipeAndPassReceiver(),
&url_request_context_,
/*cors_exempt_header_list=*/std::vector<std::string>());
- partition_.set_network_context(network_context_ptr_.get());
+ partition_.set_network_context(network_context_remote_.get());
}
net::TestURLRequestContext url_request_context_;
@@ -101,7 +103,7 @@ class TCPSocketUnitTestBase : public extensions::ExtensionServiceTestBase {
TestingProfile profile_;
content::TestStoragePartition partition_;
std::unique_ptr<network::NetworkContext> network_context_;
- network::mojom::NetworkContextPtr network_context_ptr_;
+ mojo::Remote<network::mojom::NetworkContext> network_context_remote_;
};
} // namespace
@@ -635,7 +637,9 @@ TEST_F(TCPSocketServerTest, ListenAccept) {
base::RunLoop accept_run_loop;
net::IPEndPoint accept_client_addr;
socket->Accept(base::BindLambdaForTesting(
- [&](int result, network::mojom::TCPConnectedSocketPtr accepted_socket,
+ [&](int result,
+ mojo::PendingRemote<network::mojom::TCPConnectedSocket>
+ accepted_socket,
const base::Optional<net::IPEndPoint>& remote_addr,
mojo::ScopedDataPipeConsumerHandle receive_handle,
mojo::ScopedDataPipeProducerHandle send_handle) {
@@ -690,7 +694,9 @@ TEST_F(TCPSocketServerTest, ReadAndWrite) {
std::unique_ptr<TCPSocket> accepted_socket;
socket->Accept(base::BindLambdaForTesting(
- [&](int result, network::mojom::TCPConnectedSocketPtr connected_socket,
+ [&](int result,
+ mojo::PendingRemote<network::mojom::TCPConnectedSocket>
+ connected_socket,
const base::Optional<net::IPEndPoint>& remote_addr,
mojo::ScopedDataPipeConsumerHandle receive_handle,
mojo::ScopedDataPipeProducerHandle send_handle) {
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 bab030e25d8..580a81c0d96 100644
--- a/chromium/chrome/browser/extensions/api/socket/tls_socket_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/socket/tls_socket_unittest.cc
@@ -12,6 +12,8 @@
#include "content/public/browser/browser_context.h"
#include "content/public/test/test_storage_partition.h"
#include "extensions/browser/api/socket/tls_socket.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -66,14 +68,16 @@ class TLSSocketTestBase : public extensions::ExtensionServiceTestBase {
socket->UpgradeToTLS(
nullptr /* options */,
base::BindLambdaForTesting(
- [&](int result, network::mojom::TLSClientSocketPtr tls_socket_ptr,
+ [&](int result,
+ mojo::PendingRemote<network::mojom::TLSClientSocket>
+ pending_tls_socket,
const net::IPEndPoint& local_addr,
const net::IPEndPoint& peer_addr,
mojo::ScopedDataPipeConsumerHandle receive_handle,
mojo::ScopedDataPipeProducerHandle send_handle) {
if (net::OK == result) {
tls_socket = std::make_unique<TLSSocket>(
- std::move(tls_socket_ptr), local_addr, peer_addr,
+ std::move(pending_tls_socket), local_addr, peer_addr,
std::move(receive_handle), std::move(send_handle), FAKE_ID);
}
run_loop.Quit();
@@ -89,10 +93,10 @@ class TLSSocketTestBase : public extensions::ExtensionServiceTestBase {
void Initialize() {
url_request_context_.Init();
network_context_ = std::make_unique<network::NetworkContext>(
- nullptr, mojo::MakeRequest(&network_context_ptr_),
+ nullptr, network_context_remote_.BindNewPipeAndPassReceiver(),
&url_request_context_,
/*cors_exempt_header_list=*/std::vector<std::string>());
- partition_.set_network_context(network_context_ptr_.get());
+ partition_.set_network_context(network_context_remote_.get());
}
net::TestURLRequestContext url_request_context_;
@@ -102,7 +106,7 @@ class TLSSocketTestBase : public extensions::ExtensionServiceTestBase {
TestingProfile profile_;
content::TestStoragePartition partition_;
std::unique_ptr<network::NetworkContext> network_context_;
- network::mojom::NetworkContextPtr network_context_ptr_;
+ mojo::Remote<network::mojom::NetworkContext> network_context_remote_;
};
} // namespace
@@ -170,12 +174,12 @@ TEST_F(TLSSocketTest, UpgradeToTLSWhilePendingRead) {
auto socket = CreateTCPSocket();
// This read will be pending when UpgradeToTLS() is called.
socket->Read(1 /* count */, base::DoNothing());
- network::mojom::TLSClientSocketPtr tls_socket_ptr;
base::RunLoop run_loop;
socket->UpgradeToTLS(
nullptr /* options */,
base::BindLambdaForTesting(
- [&](int result, network::mojom::TLSClientSocketPtr tls_socket_ptr,
+ [&](int result,
+ mojo::PendingRemote<network::mojom::TLSClientSocket> tls_socket,
const net::IPEndPoint& local_addr,
const net::IPEndPoint& peer_addr,
mojo::ScopedDataPipeConsumerHandle receive_handle,
@@ -203,7 +207,6 @@ TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptions) {
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.1");
@@ -213,7 +216,8 @@ TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptions) {
socket->UpgradeToTLS(
&options,
base::BindLambdaForTesting(
- [&](int result, network::mojom::TLSClientSocketPtr tls_socket_ptr,
+ [&](int result,
+ mojo::PendingRemote<network::mojom::TLSClientSocket> tls_socket,
const net::IPEndPoint& local_addr,
const net::IPEndPoint& peer_addr,
mojo::ScopedDataPipeConsumerHandle receive_handle,
@@ -244,7 +248,6 @@ TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptionsTLS13) {
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");
@@ -254,7 +257,8 @@ TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptionsTLS13) {
socket->UpgradeToTLS(
&options,
base::BindLambdaForTesting(
- [&](int result, network::mojom::TLSClientSocketPtr tls_socket_ptr,
+ [&](int result,
+ mojo::PendingRemote<network::mojom::TLSClientSocket> tls_socket,
const net::IPEndPoint& local_addr,
const net::IPEndPoint& peer_addr,
mojo::ScopedDataPipeConsumerHandle receive_handle,
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 10356bc10a2..e25c6ddbf40 100644
--- a/chromium/chrome/browser/extensions/api/socket/udp_socket_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/socket/udp_socket_unittest.cc
@@ -19,6 +19,8 @@
#include "chrome/test/base/browser_with_test_window_test.h"
#include "content/public/browser/storage_partition.h"
#include "extensions/browser/api/socket/udp_socket.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_address.h"
#include "net/base/test_completion_callback.h"
@@ -37,14 +39,15 @@ class UDPSocketUnitTest : public extensions::ExtensionServiceTestBase {
network::mojom::NetworkContext* network_context =
content::BrowserContext::GetDefaultStoragePartition(profile())
->GetNetworkContext();
- network::mojom::UDPSocketPtrInfo socket;
- network::mojom::UDPSocketListenerPtr listener_ptr;
- network::mojom::UDPSocketListenerRequest listener_request =
- mojo::MakeRequest(&listener_ptr);
- network_context->CreateUDPSocket(mojo::MakeRequest(&socket),
- std::move(listener_ptr));
- return std::make_unique<UDPSocket>(
- std::move(socket), std::move(listener_request), "abcdefghijklmnopqrst");
+ mojo::PendingRemote<network::mojom::UDPSocket> socket;
+ mojo::PendingRemote<network::mojom::UDPSocketListener> listener_remote;
+ mojo::PendingReceiver<network::mojom::UDPSocketListener> listener_receiver =
+ listener_remote.InitWithNewPipeAndPassReceiver();
+ network_context->CreateUDPSocket(socket.InitWithNewPipeAndPassReceiver(),
+ std::move(listener_remote));
+ return std::make_unique<UDPSocket>(std::move(socket),
+ std::move(listener_receiver),
+ "abcdefghijklmnopqrst");
}
};
diff --git a/chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc b/chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc
index 2605ca7cca4..0ba0c2d1008 100644
--- a/chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc
+++ b/chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc
@@ -8,7 +8,6 @@
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
#include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/common/manifest_constants.h"
namespace extensions {
@@ -36,13 +35,11 @@ SpellcheckService::DictionaryFormat GetDictionaryFormat(
} // namespace
-SpellcheckAPI::SpellcheckAPI(content::BrowserContext* context)
- : extension_registry_observer_(this) {
+SpellcheckAPI::SpellcheckAPI(content::BrowserContext* context) {
extension_registry_observer_.Add(ExtensionRegistry::Get(context));
}
-SpellcheckAPI::~SpellcheckAPI() {
-}
+SpellcheckAPI::~SpellcheckAPI() = default;
static base::LazyInstance<BrowserContextKeyedAPIFactory<SpellcheckAPI>>::
DestructorAtExit g_spellcheck_api_factory = LAZY_INSTANCE_INITIALIZER;
diff --git a/chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.h b/chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.h
index 71ed27ad628..b75884c6f62 100644
--- a/chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.h
+++ b/chromium/chrome/browser/extensions/api/spellcheck/spellcheck_api.h
@@ -8,10 +8,10 @@
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
namespace extensions {
-class ExtensionRegistry;
class SpellcheckAPI : public BrowserContextKeyedAPI,
public ExtensionRegistryObserver {
@@ -39,7 +39,7 @@ class SpellcheckAPI : public BrowserContextKeyedAPI,
// Listen to extension load, unloaded notifications.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(SpellcheckAPI);
};
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 91b42ede413..13344e45ef8 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
@@ -99,7 +99,7 @@ class ManagedValueStoreCache::ExtensionTracker
Profile* profile_;
policy::PolicyDomain policy_domain_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
policy::SchemaRegistry* schema_registry_;
base::WeakPtrFactory<ExtensionTracker> weak_factory_{this};
@@ -111,7 +111,6 @@ ManagedValueStoreCache::ExtensionTracker::ExtensionTracker(
policy::PolicyDomain policy_domain)
: profile_(profile),
policy_domain_(policy_domain),
- extension_registry_observer_(this),
schema_registry_(profile->GetPolicySchemaRegistryService()->registry()) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
// Load schemas when the extension system is ready. It might be ready now.
diff --git a/chromium/chrome/browser/extensions/api/storage/settings_sync_unittest.cc b/chromium/chrome/browser/extensions/api/storage/settings_sync_unittest.cc
index 12638792609..26678d70605 100644
--- a/chromium/chrome/browser/extensions/api/storage/settings_sync_unittest.cc
+++ b/chromium/chrome/browser/extensions/api/storage/settings_sync_unittest.cc
@@ -184,6 +184,8 @@ class ExtensionSettingsSyncTest : public testing::Test {
void SetUp() override {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
profile_.reset(new TestingProfile(temp_dir_.GetPath()));
+ content::RunAllTasksUntilIdle();
+
storage_factory_->Reset();
frontend_ =
StorageFrontend::CreateForTesting(storage_factory_, profile_.get());
diff --git a/chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc b/chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
index 926161b9923..6d8f4bc0eb0 100644
--- a/chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
+++ b/chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
@@ -18,7 +18,6 @@
#include "content/public/browser/web_contents.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_icon_image.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
@@ -141,9 +140,7 @@ SystemIndicatorManager::SystemIndicator::~SystemIndicator() = default;
SystemIndicatorManager::SystemIndicatorManager(Profile* profile,
StatusTray* status_tray)
- : profile_(profile),
- status_tray_(status_tray),
- extension_registry_observer_(this) {
+ : profile_(profile), status_tray_(status_tray) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
}
diff --git a/chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.h b/chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.h
index 378cc6a5796..4055d018928 100644
--- a/chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.h
+++ b/chromium/chrome/browser/extensions/api/system_indicator/system_indicator_manager.h
@@ -13,6 +13,7 @@
#include "base/scoped_observer.h"
#include "base/threading/thread_checker.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/extension_icon_set.h"
#include "extensions/common/extension_id.h"
@@ -25,7 +26,6 @@ namespace extensions {
FORWARD_DECLARE_TEST(SystemIndicatorApiTest, SystemIndicatorUnloaded);
class ExtensionIndicatorIcon;
-class ExtensionRegistry;
// Keeps track of all the systemIndicator icons created for a given Profile
// that are currently visible in the UI. Use SystemIndicatorManagerFactory to
@@ -86,7 +86,7 @@ class SystemIndicatorManager : public ExtensionRegistryObserver,
base::ThreadChecker thread_checker_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(SystemIndicatorManager);
};
diff --git a/chromium/chrome/browser/extensions/api/system_private/system_private_api.cc b/chromium/chrome/browser/extensions/api/system_private/system_private_api.cc
index 99b8663476b..a6571765205 100644
--- a/chromium/chrome/browser/extensions/api/system_private/system_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/system_private/system_private_api.cc
@@ -71,46 +71,49 @@ ExtensionFunction::ResponseAction SystemPrivateGetUpdateStatusFunction::Run() {
#if defined(OS_CHROMEOS)
// With UpdateEngineClient, we can provide more detailed information about
// system updates on ChromeOS.
- const chromeos::UpdateEngineClient::Status status =
- chromeos::DBusThreadManager::Get()->GetUpdateEngineClient()->
- GetLastStatus();
+ const update_engine::StatusResult status = chromeos::DBusThreadManager::Get()
+ ->GetUpdateEngineClient()
+ ->GetLastStatus();
// |download_progress| is set to 1 after download finishes
// (i.e. verify, finalize and need-reboot phase) to indicate the progress
// even though |status.download_progress| is 0 in these phases.
- switch (status.status) {
- case chromeos::UpdateEngineClient::UPDATE_STATUS_ERROR:
+ switch (status.current_operation()) {
+ case update_engine::Operation::ERROR:
+ case update_engine::Operation::DISABLED:
state = kNotAvailableState;
break;
- case chromeos::UpdateEngineClient::UPDATE_STATUS_IDLE:
+ case update_engine::Operation::IDLE:
state = kNotAvailableState;
break;
- case chromeos::UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE:
+ case update_engine::Operation::CHECKING_FOR_UPDATE:
state = kNotAvailableState;
break;
- case chromeos::UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE:
+ case update_engine::Operation::UPDATE_AVAILABLE:
state = kUpdatingState;
break;
- case chromeos::UpdateEngineClient::UPDATE_STATUS_DOWNLOADING:
+ case update_engine::Operation::DOWNLOADING:
state = kUpdatingState;
- download_progress = status.download_progress;
+ download_progress = status.progress();
break;
- case chromeos::UpdateEngineClient::UPDATE_STATUS_VERIFYING:
+ case update_engine::Operation::VERIFYING:
state = kUpdatingState;
download_progress = 1;
break;
- case chromeos::UpdateEngineClient::UPDATE_STATUS_FINALIZING:
+ case update_engine::Operation::FINALIZING:
state = kUpdatingState;
download_progress = 1;
break;
- case chromeos::UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT:
+ case update_engine::Operation::UPDATED_NEED_REBOOT:
state = kNeedRestartState;
download_progress = 1;
break;
- case chromeos::UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT:
- case chromeos::UpdateEngineClient::UPDATE_STATUS_ATTEMPTING_ROLLBACK:
- case chromeos::UpdateEngineClient::UPDATE_STATUS_NEED_PERMISSION_TO_UPDATE:
+ case update_engine::Operation::REPORTING_ERROR_EVENT:
+ case update_engine::Operation::ATTEMPTING_ROLLBACK:
+ case update_engine::Operation::NEED_PERMISSION_TO_UPDATE:
state = kNotAvailableState;
break;
+ default:
+ NOTREACHED();
}
#else
if (UpgradeDetector::GetInstance()->notify_upgrade()) {
diff --git a/chromium/chrome/browser/extensions/api/system_private/system_private_apitest.cc b/chromium/chrome/browser/extensions/api/system_private/system_private_apitest.cc
index 6f14af16ebc..c2f658bc796 100644
--- a/chromium/chrome/browser/extensions/api/system_private/system_private_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/system_private/system_private_apitest.cc
@@ -52,14 +52,14 @@ class GetUpdateStatusApiTest : public ExtensionApiTest {
};
IN_PROC_BROWSER_TEST_F(GetUpdateStatusApiTest, Progress) {
- UpdateEngineClient::Status status_not_available;
- status_not_available.status = UpdateEngineClient::UPDATE_STATUS_IDLE;
- UpdateEngineClient::Status status_updating;
- status_updating.status = UpdateEngineClient::UPDATE_STATUS_DOWNLOADING;
- status_updating.download_progress = 0.5;
- UpdateEngineClient::Status status_boot_needed;
- status_boot_needed.status =
- UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT;
+ update_engine::StatusResult status_not_available;
+ status_not_available.set_current_operation(update_engine::Operation::IDLE);
+ update_engine::StatusResult status_updating;
+ status_updating.set_current_operation(update_engine::Operation::DOWNLOADING);
+ status_updating.set_progress(0.5);
+ update_engine::StatusResult status_boot_needed;
+ status_boot_needed.set_current_operation(
+ update_engine::Operation::UPDATED_NEED_REBOOT);
// The fake client returns the last status in this order.
fake_update_engine_client_->PushLastStatus(status_not_available);
diff --git a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
index 414887222cd..8be2cd77dc9 100644
--- a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
+++ b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
@@ -30,6 +30,7 @@
#include "extensions/common/switches.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
+#include "testing/gmock/include/gmock/gmock.h"
namespace extensions {
@@ -417,33 +418,23 @@ IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_Constraints) {
#endif
// Tests that the tab indicator (in the tab strip) is shown during tab capture.
IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_TabIndicator) {
- ASSERT_EQ(TabAlertState::NONE,
- chrome::GetTabAlertStateForContents(
- browser()->tab_strip_model()->GetActiveWebContents()));
+ content::WebContents* const contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_THAT(chrome::GetTabAlertStatesForContents(contents),
+ ::testing::IsEmpty());
- // A TabStripModelObserver that quits the MessageLoop whenever the UI's model
- // is sent an event that changes the indicator status.
+ // A TabStripModelObserver that quits the MessageLoop whenever the
+ // UI's model is sent an event that might change the indicator status.
class IndicatorChangeObserver : public TabStripModelObserver {
public:
- explicit IndicatorChangeObserver(Browser* browser)
- : browser_(browser),
- last_alert_state_(chrome::GetTabAlertStateForContents(
- browser->tab_strip_model()->GetActiveWebContents())) {
+ explicit IndicatorChangeObserver(Browser* browser) : browser_(browser) {
browser_->tab_strip_model()->AddObserver(this);
}
- TabAlertState last_alert_state() const { return last_alert_state_; }
-
void TabChangedAt(content::WebContents* contents,
int index,
TabChangeType change_type) override {
- const TabAlertState alert_state =
- chrome::GetTabAlertStateForContents(contents);
- if (alert_state != last_alert_state_) {
- last_alert_state_ = alert_state;
- if (on_tab_changed_)
- std::move(on_tab_changed_).Run();
- }
+ std::move(on_tab_changed_).Run();
}
void WaitForTabChange() {
@@ -454,12 +445,11 @@ IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_TabIndicator) {
private:
Browser* const browser_;
- TabAlertState last_alert_state_;
base::OnceClosure on_tab_changed_;
};
- IndicatorChangeObserver observer(browser());
- ASSERT_EQ(TabAlertState::NONE, observer.last_alert_state());
+ ASSERT_THAT(chrome::GetTabAlertStatesForContents(contents),
+ ::testing::IsEmpty());
// Run an extension test that just turns on tab capture, which should cause
// the indicator to turn on.
@@ -469,10 +459,13 @@ IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_TabIndicator) {
// Run the browser until the indicator turns on.
const base::TimeTicks start_time = base::TimeTicks::Now();
- while (observer.last_alert_state() != TabAlertState::TAB_CAPTURING) {
+ IndicatorChangeObserver observer(browser());
+ while (!base::Contains(chrome::GetTabAlertStatesForContents(contents),
+ TabAlertState::TAB_CAPTURING)) {
if (base::TimeTicks::Now() - start_time >
TestTimeouts::action_max_timeout()) {
- EXPECT_EQ(TabAlertState::TAB_CAPTURING, observer.last_alert_state());
+ EXPECT_THAT(chrome::GetTabAlertStatesForContents(contents),
+ ::testing::Contains(TabAlertState::TAB_CAPTURING));
return;
}
observer.WaitForTabChange();
diff --git a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
index 9a140c10ead..82a0c898096 100644
--- a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
+++ b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
@@ -19,8 +19,8 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "extensions/browser/event_router.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
+#include "url/origin.h"
using content::BrowserThread;
using extensions::tab_capture::TabCaptureState;
@@ -57,18 +57,10 @@ class TabCaptureRegistry::LiveRequest : public content::WebContentsObserver {
~LiveRequest() override {}
// Accessors.
- const std::string& extension_id() const {
- return extension_id_;
- }
- bool is_anonymous() const {
- return is_anonymous_;
- }
- TabCaptureState capture_state() const {
- return capture_state_;
- }
- bool is_verified() const {
- return is_verified_;
- }
+ const std::string& extension_id() const { return extension_id_; }
+ bool is_anonymous() const { return is_anonymous_; }
+ TabCaptureState capture_state() const { return capture_state_; }
+ bool is_verified() const { return is_verified_; }
void SetIsVerified() {
DCHECK(!is_verified_);
@@ -78,7 +70,7 @@ class TabCaptureRegistry::LiveRequest : public content::WebContentsObserver {
bool WasTargettingRenderFrameID(int render_process_id,
int render_frame_id) const {
return render_process_id_ == render_process_id &&
- render_frame_id_ == render_frame_id;
+ render_frame_id_ == render_frame_id;
}
void UpdateCaptureState(TabCaptureState next_capture_state) {
@@ -140,7 +132,7 @@ class TabCaptureRegistry::LiveRequest : public content::WebContentsObserver {
};
TabCaptureRegistry::TabCaptureRegistry(content::BrowserContext* context)
- : browser_context_(context), extension_registry_observer_(this) {
+ : browser_context_(context) {
MediaCaptureDevicesDispatcher::GetInstance()->AddObserver(this);
extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_));
}
@@ -221,17 +213,17 @@ std::string TabCaptureRegistry::AddRequest(
content::RenderFrameHost* const main_frame = caller_contents->GetMainFrame();
if (main_frame) {
device_id = content::DesktopStreamsRegistry::GetInstance()->RegisterStream(
- main_frame->GetProcess()->GetID(), main_frame->GetRoutingID(), origin,
- source, extension_name, content::kRegistryStreamTypeTab);
+ main_frame->GetProcess()->GetID(), main_frame->GetRoutingID(),
+ url::Origin::Create(origin), source, extension_name,
+ content::kRegistryStreamTypeTab);
}
return device_id;
}
-bool TabCaptureRegistry::VerifyRequest(
- int render_process_id,
- int render_frame_id,
- const std::string& extension_id) {
+bool TabCaptureRegistry::VerifyRequest(int render_process_id,
+ int render_frame_id,
+ const std::string& extension_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
LiveRequest* const request = FindRequest(render_process_id, render_frame_id);
@@ -262,7 +254,7 @@ void TabCaptureRegistry::OnRequestUpdate(
LiveRequest* request =
FindRequest(target_render_process_id, target_render_frame_id);
if (!request) {
- return; // Stale or invalid request update.
+ return; // Stale or invalid request update.
}
TabCaptureState next_state = tab_capture::TAB_CAPTURE_STATE_NONE;
diff --git a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h
index 5f02c884095..586d8949b21 100644
--- a/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h
+++ b/chromium/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h
@@ -16,6 +16,7 @@
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/media_request_state.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
namespace base {
@@ -29,8 +30,6 @@ class WebContents;
namespace extensions {
-class ExtensionRegistry;
-
namespace tab_capture = api::tab_capture;
class TabCaptureRegistry : public BrowserContextKeyedAPI,
@@ -118,7 +117,7 @@ class TabCaptureRegistry : public BrowserContextKeyedAPI,
std::vector<std::unique_ptr<LiveRequest>> requests_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
DISALLOW_COPY_AND_ASSIGN(TabCaptureRegistry);
};
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc
index 874af5d556c..07871d23ce0 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -92,6 +92,7 @@
#include "net/base/escape.h"
#include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.h"
+#include "third_party/blink/public/common/page/page_zoom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/models/list_selection_model.h"
#include "ui/base/ui_base_types.h"
@@ -1357,15 +1358,13 @@ bool TabsUpdateFunction::UpdateURL(const std::string& url_string,
NavigationController::LoadURLParams load_params(url);
- // For the PDF extension, treat it as renderer-initiated so that it does not
- // show in the omnibox until it commits. This avoids URL spoofs since urls
- // can be opened on behalf of untrusted content.
- // TODO(devlin|nasko): Make this the default for all extensions.
- if (extension() && extension()->id() == extension_misc::kPdfExtensionId) {
- load_params.is_renderer_initiated = true;
- load_params.initiator_origin = url::Origin::Create(
- Extension::GetBaseURLFromExtensionId(extension()->id()));
- }
+ // Treat extension-initiated navigations as renderer-initiated so that the URL
+ // does not show in the omnibox until it commits. This avoids URL spoofs
+ // since URLs can be opened on behalf of untrusted content.
+ load_params.is_renderer_initiated = true;
+ load_params.initiator_origin = url::Origin::Create(
+ Extension::GetBaseURLFromExtensionId(extension()->id()));
+
web_contents_->GetController().LoadURLWithParams(load_params);
DCHECK_EQ(url,
@@ -1999,9 +1998,10 @@ ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
ZoomController* zoom_controller =
ZoomController::FromWebContents(web_contents);
- double zoom_level = params->zoom_factor > 0
- ? content::ZoomFactorToZoomLevel(params->zoom_factor)
- : zoom_controller->GetDefaultZoomLevel();
+ double zoom_level =
+ params->zoom_factor > 0
+ ? blink::PageZoomFactorToZoomLevel(params->zoom_factor)
+ : zoom_controller->GetDefaultZoomLevel();
auto client = base::MakeRefCounted<ExtensionZoomRequestClient>(extension());
if (!zoom_controller->SetZoomLevelByClient(zoom_level, client)) {
@@ -2026,7 +2026,7 @@ ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
double zoom_level =
ZoomController::FromWebContents(web_contents)->GetZoomLevel();
- double zoom_factor = content::ZoomLevelToZoomFactor(zoom_level);
+ double zoom_factor = blink::PageZoomLevelToZoomFactor(zoom_level);
return RespondNow(ArgumentList(tabs::GetZoom::Results::Create(zoom_factor)));
}
@@ -2100,8 +2100,9 @@ ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode();
api::tabs::ZoomSettings zoom_settings;
ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
- zoom_settings.default_zoom_factor.reset(new double(
- content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel())));
+ zoom_settings.default_zoom_factor.reset(
+ new double(blink::PageZoomLevelToZoomFactor(
+ zoom_controller->GetDefaultZoomLevel())));
return RespondNow(
ArgumentList(api::tabs::GetZoomSettings::Results::Create(zoom_settings)));
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_constants.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_constants.cc
index ed8ab5f7f37..751330613c9 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_constants.cc
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_constants.cc
@@ -48,6 +48,7 @@ const char kTitleKey[] = "title";
const char kToIndexKey[] = "toIndex";
const char kTopKey[] = "top";
const char kUrlKey[] = "url";
+const char kPendingUrlKey[] = "pendingUrl";
const char kWindowClosing[] = "isWindowClosing";
const char kWidthKey[] = "width";
const char kWindowIdKey[] = "windowId";
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_constants.h b/chromium/chrome/browser/extensions/api/tabs/tabs_constants.h
index a58d60121a3..968b0abf313 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_constants.h
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_constants.h
@@ -52,6 +52,7 @@ extern const char kTitleKey[];
extern const char kToIndexKey[];
extern const char kTopKey[];
extern const char kUrlKey[];
+extern const char kPendingUrlKey[];
extern const char kWidthKey[];
extern const char kWindowClosing[];
extern const char kWindowIdKey[];
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 f86ebb9b063..402d3de9620 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.cc
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.cc
@@ -28,6 +28,7 @@
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/features/feature.h"
+#include "third_party/blink/public/common/page/page_zoom.h"
using base::DictionaryValue;
using base::ListValue;
@@ -162,10 +163,7 @@ void TabsEventRouter::TabEntry::WebContentsDestroyed() {
}
TabsEventRouter::TabsEventRouter(Profile* profile)
- : profile_(profile),
- favicon_scoped_observer_(this),
- browser_tab_strip_tracker_(this, this, this),
- tab_manager_scoped_observer_(this) {
+ : profile_(profile), browser_tab_strip_tracker_(this, this, this) {
DCHECK(!profile->IsOffTheRecord());
browser_tab_strip_tracker_.Init();
@@ -275,9 +273,9 @@ void TabsEventRouter::OnZoomChanged(
api::tabs::OnZoomChange::ZoomChangeInfo zoom_change_info;
zoom_change_info.tab_id = tab_id;
zoom_change_info.old_zoom_factor =
- content::ZoomLevelToZoomFactor(data.old_zoom_level);
+ blink::PageZoomLevelToZoomFactor(data.old_zoom_level);
zoom_change_info.new_zoom_factor =
- content::ZoomLevelToZoomFactor(data.new_zoom_level);
+ blink::PageZoomLevelToZoomFactor(data.new_zoom_level);
ZoomModeToZoomSettings(data.zoom_mode, &zoom_change_info.zoom_settings);
// Dispatch the |onZoomChange| event.
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.h b/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.h
index 14f37b6f537..e7335a902ae 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.h
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_event_router.h
@@ -18,6 +18,7 @@
#include "chrome/browser/ui/browser_tab_strip_tracker.h"
#include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
+#include "components/favicon/core/favicon_driver.h"
#include "components/favicon/core/favicon_driver_observer.h"
#include "components/zoom/zoom_observer.h"
#include "content/public/browser/web_contents_observer.h"
@@ -27,10 +28,6 @@ namespace content {
class WebContents;
}
-namespace favicon {
-class FaviconDriver;
-}
-
namespace extensions {
// The TabsEventRouter listens to tab events and routes them to listeners inside
@@ -205,13 +202,14 @@ class TabsEventRouter : public TabStripModelObserver,
// The main profile that owns this event router.
Profile* profile_;
- ScopedObserver<favicon::FaviconDriver, TabsEventRouter>
- favicon_scoped_observer_;
+ ScopedObserver<favicon::FaviconDriver, favicon::FaviconDriverObserver>
+ favicon_scoped_observer_{this};
BrowserTabStripTracker browser_tab_strip_tracker_;
- ScopedObserver<resource_coordinator::TabManager, TabsEventRouter>
- tab_manager_scoped_observer_;
+ ScopedObserver<resource_coordinator::TabManager,
+ resource_coordinator::TabLifecycleObserver>
+ tab_manager_scoped_observer_{this};
DISALLOW_COPY_AND_ASSIGN(TabsEventRouter);
};
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_test.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_test.cc
index f5fb14246df..e908335e12f 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -48,7 +48,6 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/mime_handler_view_mode.h"
-#include "content/public/common/page_zoom.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
@@ -61,6 +60,7 @@
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "third_party/blink/public/common/page/page_zoom.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/widget/widget.h"
@@ -98,6 +98,8 @@ class ExtensionWindowCreateTest : public InProcessBrowserTest {
};
const int kUndefinedId = INT_MIN;
+const ExtensionTabUtil::ScrubTabBehavior kDontScrubBehavior = {
+ ExtensionTabUtil::kDontScrubTab, ExtensionTabUtil::kDontScrubTab};
int GetTabId(base::DictionaryValue* tab) {
int id = kUndefinedId;
@@ -1136,9 +1138,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTab) {
EXPECT_EQ(window_id, duplicate_tab_window_id);
EXPECT_EQ(tab_index + 1, duplicate_tab_index);
// The test empty tab extension has tabs permissions, therefore
- // |duplicate_result| should contain url, title, and faviconUrl
+ // |duplicate_result| should contain url, pendingUrl, title or faviconUrl
// in the function result.
- EXPECT_TRUE(utils::HasPrivacySensitiveFields(duplicate_result.get()));
+ EXPECT_TRUE(utils::HasAnyPrivacySensitiveFields(duplicate_result.get()));
}
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTabNoPermission) {
@@ -1174,8 +1176,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTabNoPermission) {
EXPECT_EQ(window_id, duplicate_tab_window_id);
EXPECT_EQ(tab_index + 1, duplicate_tab_index);
// The test empty extension has no permissions, therefore |duplicate_result|
- // should not contain url, title, and faviconUrl in the function result.
- EXPECT_FALSE(utils::HasPrivacySensitiveFields(duplicate_result.get()));
+ // should not contain url, pendingUrl, title and faviconUrl in the function
+ // result.
+ EXPECT_FALSE(utils::HasAnyPrivacySensitiveFields(duplicate_result.get()));
}
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, NoTabsEventOnDevTools) {
@@ -1323,8 +1326,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DiscardedProperty) {
// Creates Tab object to ensure the property is correct for the extension.
std::unique_ptr<api::tabs::Tab> tab_object_a =
- ExtensionTabUtil::CreateTabObject(web_contents_a,
- ExtensionTabUtil::kDontScrubTab,
+ ExtensionTabUtil::CreateTabObject(web_contents_a, kDontScrubBehavior,
nullptr, tab_strip_model, 0);
EXPECT_FALSE(tab_object_a->discarded);
@@ -1334,8 +1336,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DiscardedProperty) {
// Make sure the property is changed accordingly after discarding the tab.
tab_object_a = ExtensionTabUtil::CreateTabObject(
- web_contents_a, ExtensionTabUtil::kDontScrubTab, nullptr, tab_strip_model,
- 0);
+ web_contents_a, kDontScrubBehavior, nullptr, tab_strip_model, 0);
EXPECT_TRUE(tab_object_a->discarded);
// Get non-discarded tabs after discarding one tab.
@@ -1530,8 +1531,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, AutoDiscardableProperty) {
// Creates Tab object to ensure the property is correct for the extension.
TabStripModel* tab_strip_model = browser()->tab_strip_model();
std::unique_ptr<api::tabs::Tab> tab_object_a =
- ExtensionTabUtil::CreateTabObject(web_contents_a,
- ExtensionTabUtil::kDontScrubTab,
+ ExtensionTabUtil::CreateTabObject(web_contents_a, kDontScrubBehavior,
nullptr, tab_strip_model, 0);
EXPECT_TRUE(tab_object_a->auto_discardable);
@@ -1575,8 +1575,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, AutoDiscardableProperty) {
// Make sure the property is changed accordingly after updating the tab.
tab_object_a = ExtensionTabUtil::CreateTabObject(
- web_contents_a, ExtensionTabUtil::kDontScrubTab, nullptr, tab_strip_model,
- 0);
+ web_contents_a, kDontScrubBehavior, nullptr, tab_strip_model, 0);
EXPECT_FALSE(tab_object_a->auto_discardable);
// Get auto-discardable tabs after changing the status of web contents A.
@@ -1847,7 +1846,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, SetAndGetZoom) {
const double kZoomLevel = 0.8;
EXPECT_TRUE(RunSetZoom(tab_id, kZoomLevel));
EXPECT_EQ(kZoomLevel,
- content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents)));
+ blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents)));
// Test chrome.tabs.getZoom().
zoom_factor = -1;
@@ -1864,9 +1863,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, GetDefaultZoom) {
zoom::ZoomController::FromWebContents(web_contents);
double default_zoom_factor = -1.0;
EXPECT_TRUE(RunGetDefaultZoom(tab_id, &default_zoom_factor));
- EXPECT_TRUE(content::ZoomValuesEqual(
+ EXPECT_TRUE(blink::PageZoomValuesEqual(
zoom_controller->GetDefaultZoomLevel(),
- content::ZoomFactorToZoomLevel(default_zoom_factor)));
+ blink::PageZoomFactorToZoomLevel(default_zoom_factor)));
// Change the default zoom level and verify GetDefaultZoom returns the
// correct value.
@@ -1880,9 +1879,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, GetDefaultZoom) {
zoom_prefs->SetDefaultZoomLevelPref(default_zoom_level + 0.5);
default_zoom_factor = -1.0;
EXPECT_TRUE(RunGetDefaultZoom(tab_id, &default_zoom_factor));
- EXPECT_TRUE(content::ZoomValuesEqual(
+ EXPECT_TRUE(blink::PageZoomValuesEqual(
default_zoom_level + 0.5,
- content::ZoomFactorToZoomLevel(default_zoom_factor)));
+ blink::PageZoomFactorToZoomLevel(default_zoom_factor)));
}
IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, SetToDefaultZoom) {
@@ -1906,9 +1905,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, SetToDefaultZoom) {
double observed_zoom_factor = -1.0;
EXPECT_TRUE(RunSetZoom(tab_id, 0.0));
EXPECT_TRUE(RunGetZoom(tab_id, &observed_zoom_factor));
- EXPECT_TRUE(content::ZoomValuesEqual(
+ EXPECT_TRUE(blink::PageZoomValuesEqual(
new_default_zoom_level,
- content::ZoomFactorToZoomLevel(observed_zoom_factor)));
+ blink::PageZoomFactorToZoomLevel(observed_zoom_factor)));
}
IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, ZoomSettings) {
@@ -1936,48 +1935,48 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, ZoomSettings) {
int tab_id_B = ExtensionTabUtil::GetTabId(web_contents_B);
ASSERT_FLOAT_EQ(
- 1.f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
+ 1.f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
ASSERT_FLOAT_EQ(
- 1.f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
+ 1.f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
ASSERT_FLOAT_EQ(
- 1.f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_B)));
+ 1.f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_B)));
// Test per-origin automatic zoom settings.
EXPECT_TRUE(RunSetZoom(tab_id_B, 1.f));
EXPECT_TRUE(RunSetZoom(tab_id_A2, 1.1f));
EXPECT_FLOAT_EQ(
- 1.1f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
+ 1.1f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
EXPECT_FLOAT_EQ(
- 1.1f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
- EXPECT_FLOAT_EQ(1.f,
- content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_B)));
+ 1.1f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
+ EXPECT_FLOAT_EQ(
+ 1.f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_B)));
// Test per-tab automatic zoom settings.
EXPECT_TRUE(RunSetZoomSettings(tab_id_A1, "automatic", "per-tab"));
EXPECT_TRUE(RunSetZoom(tab_id_A1, 1.2f));
EXPECT_FLOAT_EQ(
- 1.2f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
+ 1.2f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
EXPECT_FLOAT_EQ(
- 1.1f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
+ 1.1f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
// Test 'manual' mode.
EXPECT_TRUE(RunSetZoomSettings(tab_id_A1, "manual", nullptr));
EXPECT_TRUE(RunSetZoom(tab_id_A1, 1.3f));
EXPECT_FLOAT_EQ(
- 1.3f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
+ 1.3f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
EXPECT_FLOAT_EQ(
- 1.1f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
+ 1.1f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
// Test 'disabled' mode, which will reset A1's zoom to 1.f.
EXPECT_TRUE(RunSetZoomSettings(tab_id_A1, "disabled", nullptr));
std::string error = RunSetZoomExpectError(tab_id_A1, 1.4f);
EXPECT_TRUE(base::MatchPattern(error, keys::kCannotZoomDisabledTabError));
EXPECT_FLOAT_EQ(
- 1.f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
+ 1.f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A1)));
// We should still be able to zoom A2 though.
EXPECT_TRUE(RunSetZoom(tab_id_A2, 1.4f));
EXPECT_FLOAT_EQ(
- 1.4f, content::ZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
+ 1.4f, blink::PageZoomLevelToZoomFactor(GetZoomLevel(web_contents_A2)));
}
IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, PerTabResetsOnNavigation) {
@@ -2061,13 +2060,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, CannotZoomInvalidTab) {
}
// Regression test for crbug.com/660498.
-// TODO(crbug.com/882213) Disabled due to timeouts on Linux builders.
-#if defined(OS_LINUX)
-#define MAYBE_TemporaryAddressSpoof DISABLED_TemporaryAddressSpoof
-#else
-#define MAYBE_TemporaryAddressSpoof TemporaryAddressSpoof
-#endif
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_TemporaryAddressSpoof) {
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, TemporaryAddressSpoof) {
ASSERT_TRUE(StartEmbeddedTestServer());
content::WebContents* first_web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
@@ -2115,6 +2108,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_TemporaryAddressSpoof) {
browser()->tab_strip_model()->GetActiveWebContents());
EXPECT_EQ(url, second_web_contents->GetVisibleURL());
+
+ // Wait for the TestNavigationManager-initiated navigation to complete to
+ // avoid a race during browser teardown (see crbug.com/882213).
+ navigation_manager.WaitForNavigationFinished();
}
// Tests how chrome.windows.create behaves when setSelfAsOpener parameter is
diff --git a/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc b/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
index 6a0c9a2833f..9a4b1776deb 100644
--- a/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
+++ b/chromium/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
@@ -4,13 +4,13 @@
#include "chrome/browser/extensions/api/tabs/tabs_util.h"
+#include "ash/public/cpp/assistant/assistant_state.h"
#include "ash/public/cpp/window_pin_type.h"
#include "ash/public/cpp/window_properties.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h"
+#include "chrome/browser/chromeos/arc/session/arc_session_manager.h"
#include "chrome/browser/chromeos/assistant/assistant_util.h"
#include "chrome/browser/ui/ash/chrome_screenshot_grabber.h"
#include "chrome/browser/ui/browser.h"
@@ -62,8 +62,7 @@ void SetLockedFullscreenState(Browser* browser, bool locked) {
if (assistant::IsAssistantAllowedForProfile(profile) ==
ash::mojom::AssistantAllowedState::ALLOWED) {
- arc::VoiceInteractionControllerClient::Get()
- ->NotifyLockedFullScreenStateChanged(locked);
+ ash::AssistantState::Get()->NotifyLockedFullScreenStateChanged(locked);
}
}
diff --git a/chromium/chrome/browser/extensions/api/tabs/windows_event_router.cc b/chromium/chrome/browser/extensions/api/tabs/windows_event_router.cc
index c890c88293c..5f41fa24c34 100644
--- a/chromium/chrome/browser/extensions/api/tabs/windows_event_router.cc
+++ b/chromium/chrome/browser/extensions/api/tabs/windows_event_router.cc
@@ -17,7 +17,6 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/window_controller.h"
-#include "chrome/browser/extensions/window_controller_list.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/windows.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -148,9 +147,7 @@ bool WillDispatchWindowFocusedEvent(
WindowsEventRouter::WindowsEventRouter(Profile* profile)
: profile_(profile),
focused_profile_(nullptr),
- focused_window_id_(extension_misc::kUnknownWindowId),
- observed_app_registry_(this),
- observed_controller_list_(this) {
+ focused_window_id_(extension_misc::kUnknownWindowId) {
DCHECK(!profile->IsOffTheRecord());
observed_app_registry_.Add(AppWindowRegistry::Get(profile_));
diff --git a/chromium/chrome/browser/extensions/api/tabs/windows_event_router.h b/chromium/chrome/browser/extensions/api/tabs/windows_event_router.h
index 0f9d46ff565..ce4bcaec46b 100644
--- a/chromium/chrome/browser/extensions/api/tabs/windows_event_router.h
+++ b/chromium/chrome/browser/extensions/api/tabs/windows_event_router.h
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "build/build_config.h"
+#include "chrome/browser/extensions/window_controller_list.h"
#include "chrome/browser/extensions/window_controller_list_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -32,7 +33,6 @@ namespace extensions {
class AppWindow;
class AppWindowController;
-class WindowControllerList;
// The WindowsEventRouter sends chrome.windows.* events to listeners
// inside extension process renderers. The router listens to *all* events,
@@ -97,11 +97,11 @@ class WindowsEventRouter : public AppWindowRegistry::Observer,
// Observed AppWindowRegistry.
ScopedObserver<AppWindowRegistry, AppWindowRegistry::Observer>
- observed_app_registry_;
+ observed_app_registry_{this};
// Observed WindowControllerList.
ScopedObserver<WindowControllerList, WindowControllerListObserver>
- observed_controller_list_;
+ observed_controller_list_{this};
DISALLOW_COPY_AND_ASSIGN(WindowsEventRouter);
};
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 2a0832b667a..425a808d8ea 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
@@ -257,7 +257,7 @@ bool ChromeVirtualKeyboardDelegate::ShowLanguageSettings() {
base::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog"));
chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(),
- chrome::kLanguageOptionsSubPage);
+ chrome::kLanguageSubPage);
return true;
}
@@ -383,8 +383,15 @@ void ChromeVirtualKeyboardDelegate::OnHasInputDevices(
"fstinputlogic",
base::FeatureList::IsEnabled(chromeos::features::kImeInputLogicFst)));
features->AppendString(GenerateFeatureFlag(
- "fstnonenglish", base::FeatureList::IsEnabled(
- chromeos::features::kImeInputLogicFstNonEnglish)));
+ "fstnonenglish",
+ base::FeatureList::IsEnabled(chromeos::features::kImeInputLogicFst)));
+ features->AppendString(GenerateFeatureFlag(
+ "floatingkeyboarddefault",
+ base::FeatureList::IsEnabled(
+ chromeos::features::kVirtualKeyboardFloatingDefault)));
+ features->AppendString(GenerateFeatureFlag(
+ "mozcinputlogic",
+ base::FeatureList::IsEnabled(chromeos::features::kImeInputLogicMozc)));
results->Set("features", std::move(features));
diff --git a/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index 98483bc6950..4c7a4ed1b8d 100644
--- a/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -260,7 +260,7 @@ void WebNavigationTabObserver::DidFinishNavigation(
HandleError(navigation_handle);
}
-void WebNavigationTabObserver::DocumentLoadedInFrame(
+void WebNavigationTabObserver::DOMContentLoaded(
content::RenderFrameHost* render_frame_host) {
if (!navigation_state_.CanSendEvents(render_frame_host))
return;
diff --git a/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.h b/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
index d5169edb107..2bfcc079c5c 100644
--- a/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
+++ b/chromium/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
@@ -51,8 +51,7 @@ class WebNavigationTabObserver
content::NavigationHandle* navigation_handle) override;
void DidFinishNavigation(
content::NavigationHandle* navigation_handle) override;
- void DocumentLoadedInFrame(
- content::RenderFrameHost* render_frame_host) override;
+ void DOMContentLoaded(content::RenderFrameHost* render_frame_host) override;
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;
void DidFailLoad(content::RenderFrameHost* render_frame_host,
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 2e416ee7641..98f99625b2f 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
@@ -51,6 +51,7 @@
#include "extensions/common/features/feature.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/http/http_util.h"
+#include "services/network/public/cpp/features.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest-message.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -87,7 +88,7 @@ using helpers::ResponseHeader;
using helpers::ResponseHeaders;
using helpers::StringToCharList;
using testing::ElementsAre;
-using Action = extensions::declarative_net_request::RulesetManager::Action;
+using DNRRequestAction = extensions::declarative_net_request::RequestAction;
namespace extensions {
@@ -171,14 +172,16 @@ namespace {
// Create the numerical representation of |values|, strings passed as
// extraInfoSpec by the event handler. Returns true on success, otherwise false.
-bool GenerateInfoSpec(const std::string& values, int* result) {
+bool GenerateInfoSpec(content::BrowserContext* browser_context,
+ const std::string& values,
+ int* result) {
// Create a base::ListValue of strings.
base::ListValue list_value;
for (const std::string& cur :
base::SplitString(values, ",", base::KEEP_WHITESPACE,
base::SPLIT_WANT_NONEMPTY))
list_value.AppendString(cur);
- return ExtraInfoSpec::InitFromValue(list_value, result);
+ return ExtraInfoSpec::InitFromValue(browser_context, list_value, result);
}
} // namespace
@@ -230,10 +233,13 @@ TEST_F(ExtensionWebRequestTest, AddAndRemoveListeners) {
namespace {
-void TestInitFromValue(const std::string& values, bool expected_return_code,
+void TestInitFromValue(content::BrowserContext* browser_context,
+ const std::string& values,
+ bool expected_return_code,
int expected_extra_info_spec) {
int actual_info_spec;
- bool actual_return_code = GenerateInfoSpec(values, &actual_info_spec);
+ bool actual_return_code =
+ GenerateInfoSpec(browser_context, values, &actual_info_spec);
EXPECT_EQ(expected_return_code, actual_return_code);
if (expected_return_code)
EXPECT_EQ(expected_extra_info_spec, actual_info_spec);
@@ -242,43 +248,30 @@ void TestInitFromValue(const std::string& values, bool expected_return_code,
} // namespace
TEST_F(ExtensionWebRequestTest, InitFromValue) {
- TestInitFromValue(std::string(), true, 0);
+ TestInitFromValue(&profile_, std::string(), true, 0);
// Single valid values.
- TestInitFromValue(
- "requestHeaders",
- true,
- ExtraInfoSpec::REQUEST_HEADERS);
- TestInitFromValue(
- "responseHeaders",
- true,
- ExtraInfoSpec::RESPONSE_HEADERS);
- TestInitFromValue(
- "blocking",
- true,
- ExtraInfoSpec::BLOCKING);
- TestInitFromValue(
- "asyncBlocking",
- true,
- ExtraInfoSpec::ASYNC_BLOCKING);
- TestInitFromValue(
- "requestBody",
- true,
- ExtraInfoSpec::REQUEST_BODY);
+ TestInitFromValue(&profile_, "requestHeaders", true,
+ ExtraInfoSpec::REQUEST_HEADERS);
+ TestInitFromValue(&profile_, "responseHeaders", true,
+ ExtraInfoSpec::RESPONSE_HEADERS);
+ TestInitFromValue(&profile_, "blocking", true, ExtraInfoSpec::BLOCKING);
+ TestInitFromValue(&profile_, "asyncBlocking", true,
+ ExtraInfoSpec::ASYNC_BLOCKING);
+ TestInitFromValue(&profile_, "requestBody", true,
+ ExtraInfoSpec::REQUEST_BODY);
// Multiple valid values are bitwise-or'ed.
- TestInitFromValue(
- "requestHeaders,blocking",
- true,
- ExtraInfoSpec::REQUEST_HEADERS | ExtraInfoSpec::BLOCKING);
+ TestInitFromValue(&profile_, "requestHeaders,blocking", true,
+ ExtraInfoSpec::REQUEST_HEADERS | ExtraInfoSpec::BLOCKING);
// Any invalid values lead to a bad parse.
- TestInitFromValue("invalidValue", false, 0);
- TestInitFromValue("blocking,invalidValue", false, 0);
- TestInitFromValue("invalidValue1,invalidValue2", false, 0);
+ TestInitFromValue(&profile_, "invalidValue", false, 0);
+ TestInitFromValue(&profile_, "blocking,invalidValue", false, 0);
+ TestInitFromValue(&profile_, "invalidValue1,invalidValue2", false, 0);
// BLOCKING and ASYNC_BLOCKING are mutually exclusive.
- TestInitFromValue("blocking,asyncBlocking", false, 0);
+ TestInitFromValue(&profile_, "blocking,asyncBlocking", false, 0);
}
TEST(ExtensionWebRequestHelpersTest,
@@ -332,8 +325,8 @@ TEST(ExtensionWebRequestHelpersTest, TestCalculateOnBeforeSendHeadersDelta) {
new_headers_added.SetHeader("key3", "value3");
new_headers_added.SetHeader("key2", "value2");
EventResponseDelta delta_added = CalculateOnBeforeSendHeadersDelta(
- "extid", base::Time::Now(), cancel, &old_headers, &new_headers_added,
- 0 /* extra_info_spec */);
+ nullptr /* browser_context */, "extid", base::Time::Now(), cancel,
+ &old_headers, &new_headers_added, 0 /* extra_info_spec */);
EXPECT_TRUE(delta_added.cancel);
ASSERT_TRUE(delta_added.modified_request_headers.GetHeader("key3", &value));
EXPECT_EQ("value3", value);
@@ -342,8 +335,8 @@ TEST(ExtensionWebRequestHelpersTest, TestCalculateOnBeforeSendHeadersDelta) {
net::HttpRequestHeaders new_headers_deleted;
new_headers_deleted.SetHeader("key1", "value1");
EventResponseDelta delta_deleted = CalculateOnBeforeSendHeadersDelta(
- "extid", base::Time::Now(), cancel, &old_headers, &new_headers_deleted,
- 0 /* extra_info_spec */);
+ nullptr /* browser_context */, "extid", base::Time::Now(), cancel,
+ &old_headers, &new_headers_deleted, 0 /* extra_info_spec */);
ASSERT_EQ(1u, delta_deleted.deleted_request_headers.size());
ASSERT_EQ("key2", delta_deleted.deleted_request_headers.front());
@@ -352,8 +345,8 @@ TEST(ExtensionWebRequestHelpersTest, TestCalculateOnBeforeSendHeadersDelta) {
new_headers_modified.SetHeader("key1", "value1");
new_headers_modified.SetHeader("key2", "value3");
EventResponseDelta delta_modified = CalculateOnBeforeSendHeadersDelta(
- "extid", base::Time::Now(), cancel, &old_headers, &new_headers_modified,
- 0 /* extra_info_spec */);
+ nullptr /* browser_context */, "extid", base::Time::Now(), cancel,
+ &old_headers, &new_headers_modified, 0 /* extra_info_spec */);
EXPECT_TRUE(delta_modified.deleted_request_headers.empty());
ASSERT_TRUE(
delta_modified.modified_request_headers.GetHeader("key2", &value));
@@ -367,8 +360,8 @@ TEST(ExtensionWebRequestHelpersTest, TestCalculateOnBeforeSendHeadersDelta) {
new_headers_modified2.SetHeader("key2", "value2");
new_headers_modified2.SetHeader("key2", "value3");
EventResponseDelta delta_modified2 = CalculateOnBeforeSendHeadersDelta(
- "extid", base::Time::Now(), cancel, &old_headers, &new_headers_modified,
- 0 /* extra_info_spec */);
+ nullptr /* browser_context */, "extid", base::Time::Now(), cancel,
+ &old_headers, &new_headers_modified, 0 /* extra_info_spec */);
EXPECT_TRUE(delta_modified2.deleted_request_headers.empty());
ASSERT_TRUE(
delta_modified2.modified_request_headers.GetHeader("key2", &value));
@@ -386,14 +379,14 @@ TEST(ExtensionWebRequestHelpersTest,
net::HttpRequestHeaders new_headers = old_headers;
new_headers.SetHeader(name, "value");
EventResponseDelta delta = CalculateOnBeforeSendHeadersDelta(
- "extid", base::Time::Now(), false, &old_headers, &new_headers,
- 0 /* extra_info_spec */);
+ nullptr /* browser_context */, "extid", base::Time::Now(), false,
+ &old_headers, &new_headers, 0 /* extra_info_spec */);
EXPECT_FALSE(delta.modified_request_headers.HasHeader(name));
// Test with extra headers in spec.
- delta = CalculateOnBeforeSendHeadersDelta("extid", base::Time::Now(), false,
- &old_headers, &new_headers,
- ExtraInfoSpec::EXTRA_HEADERS);
+ delta = CalculateOnBeforeSendHeadersDelta(
+ nullptr /* browser_context */, "extid", base::Time::Now(), false,
+ &old_headers, &new_headers, ExtraInfoSpec::EXTRA_HEADERS);
std::string value;
EXPECT_TRUE(delta.modified_request_headers.GetHeader(name, &value));
EXPECT_EQ("value", value);
@@ -402,15 +395,15 @@ TEST(ExtensionWebRequestHelpersTest,
new_headers = old_headers;
// Add header to old headers, it will be treated as removed.
old_headers.SetHeader(name, "value");
- delta = CalculateOnBeforeSendHeadersDelta("extid", base::Time::Now(), false,
- &old_headers, &new_headers,
- 0 /* extra_info_spec */);
+ delta = CalculateOnBeforeSendHeadersDelta(
+ nullptr /* browser_context */, "extid", base::Time::Now(), false,
+ &old_headers, &new_headers, 0 /* extra_info_spec */);
EXPECT_TRUE(delta.deleted_request_headers.empty());
// Test with extra headers in spec.
- delta = CalculateOnBeforeSendHeadersDelta("extid", base::Time::Now(), false,
- &old_headers, &new_headers,
- ExtraInfoSpec::EXTRA_HEADERS);
+ delta = CalculateOnBeforeSendHeadersDelta(
+ nullptr /* browser_context */, "extid", base::Time::Now(), false,
+ &old_headers, &new_headers, ExtraInfoSpec::EXTRA_HEADERS);
EXPECT_THAT(delta.deleted_request_headers, ElementsAre(name));
}
}
@@ -771,7 +764,7 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeSendHeadersResponses) {
headers0.MergeFrom(base_headers);
WebRequestInfoInitParams info_params;
WebRequestInfo info(std::move(info_params));
- info.dnr_action.emplace(Action::Type::NONE);
+ info.dnr_actions = std::vector<DNRRequestAction>();
MergeOnBeforeSendHeadersResponses(info, deltas, &headers0, &ignored_actions,
&ignore1, &ignore2,
&request_headers_modified0);
@@ -879,8 +872,12 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeSendHeadersResponses) {
bool request_headers_modified4 = false;
net::HttpRequestHeaders headers4;
headers4.MergeFrom(base_headers);
- info.dnr_action.emplace(Action::Type::REMOVE_HEADERS);
- info.dnr_action->request_headers_to_remove = {"key5"};
+
+ DNRRequestAction remove_headers_action(
+ DNRRequestAction::Type::REMOVE_HEADERS);
+ remove_headers_action.request_headers_to_remove = {"key5"};
+ info.dnr_actions = std::vector<DNRRequestAction>();
+ info.dnr_actions->push_back(std::move(remove_headers_action));
MergeOnBeforeSendHeadersResponses(info, deltas, &headers4, &ignored_actions,
&ignore1, &ignore2,
&request_headers_modified4);
@@ -927,7 +924,7 @@ TEST(ExtensionWebRequestHelpersTest,
WebRequestInfoInitParams info_params;
WebRequestInfo info(std::move(info_params));
- info.dnr_action.emplace(Action::Type::NONE);
+ info.dnr_actions = std::vector<DNRRequestAction>();
helpers::IgnoredActions ignored_actions;
std::set<std::string> removed_headers, set_headers;
bool request_headers_modified = false;
@@ -1270,7 +1267,7 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponses) {
WebRequestInfoInitParams info_params;
info_params.url = GURL(kExampleUrl);
WebRequestInfo info(std::move(info_params));
- info.dnr_action.emplace(Action::Type::NONE);
+ info.dnr_actions = std::vector<DNRRequestAction>();
MergeOnHeadersReceivedResponses(info, deltas, base_headers.get(),
&new_headers0, &allowed_unsafe_redirect_url0,
@@ -1350,8 +1347,12 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponses) {
// Ensure headers removed by Declarative Net Request API can't be added by web
// request extensions and result in a conflict.
- info.dnr_action.emplace(Action::Type::REMOVE_HEADERS);
- info.dnr_action->response_headers_to_remove = {"key3"};
+ DNRRequestAction remove_headers_action(
+ DNRRequestAction::Type::REMOVE_HEADERS);
+ remove_headers_action.response_headers_to_remove = {"key3"};
+ info.dnr_actions = std::vector<DNRRequestAction>();
+ info.dnr_actions->push_back(std::move(remove_headers_action));
+
ignored_actions.clear();
bool response_headers_modified3 = false;
scoped_refptr<net::HttpResponseHeaders> new_headers3;
@@ -1406,7 +1407,7 @@ TEST(ExtensionWebRequestHelpersTest,
WebRequestInfoInitParams info_params;
info_params.url = GURL(kExampleUrl);
WebRequestInfo info(std::move(info_params));
- info.dnr_action.emplace(Action::Type::NONE);
+ info.dnr_actions = std::vector<DNRRequestAction>();
MergeOnHeadersReceivedResponses(info, deltas, base_headers.get(),
&new_headers1, &allowed_unsafe_redirect_url1,
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 622cdec21a1..7cbbb84af36 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
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/json/json_reader.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/optional.h"
@@ -28,6 +29,7 @@
#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/extension_with_management_policy_apitest.h"
#include "chrome/browser/extensions/scripting_permissions_modifier.h"
@@ -100,6 +102,7 @@
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_filter.h"
#include "net/url_request/url_request_interceptor.h"
+#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/test/test_url_loader_client.h"
@@ -141,6 +144,55 @@ class CancelLoginDialog : public content::NotificationObserver {
DISALLOW_COPY_AND_ASSIGN(CancelLoginDialog);
};
+// Observer that listens for messages from chrome.test.sendMessage to allow them
+// to be used to trigger browser initiated naviagations from the javascript for
+// testing purposes.
+class NavigateTabMessageHandler : public content::NotificationObserver {
+ public:
+ explicit NavigateTabMessageHandler(Profile* profile) : profile_(profile) {
+ registrar_.Add(this, extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE,
+ content::NotificationService::AllSources());
+ }
+
+ ~NavigateTabMessageHandler() override {}
+
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) override {
+ HandleNavigateTabMessage(type, source, details, profile_);
+ }
+
+ private:
+ void HandleNavigateTabMessage(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details,
+ Profile* profile) {
+ DCHECK_EQ(NOTIFICATION_EXTENSION_TEST_MESSAGE, type);
+ const auto message =
+ content::Details<std::pair<std::string, bool*>>(details)->first;
+ base::Optional<base::Value> command = base::JSONReader::Read(message);
+ if (command && command->is_dict()) { // Check the message decoded from JSON
+ base::Value* data = command->FindDictKey("navigate");
+ if (data && data->is_dict()) {
+ int tab_id = *data->FindIntKey("tabId");
+ GURL url = GURL(*data->FindStringKey("url"));
+ ASSERT_TRUE(url.is_valid());
+
+ content::WebContents* contents = nullptr;
+ ExtensionTabUtil::GetTabById(
+ tab_id, profile, profile->HasOffTheRecordProfile(), &contents);
+ ASSERT_NE(contents, nullptr)
+ << "Could not find tab with id: " << tab_id;
+ content::NavigationController::LoadURLParams params(url);
+ contents->GetController().LoadURLWithParams(params);
+ }
+ }
+ }
+
+ content::NotificationRegistrar registrar_;
+ Profile* profile_;
+};
+
// Sends an XHR request to the provided host, port, and path, and responds when
// the request was sent.
const char kPerformXhrJs[] =
@@ -230,6 +282,7 @@ class ExtensionWebRequestApiTest : public ExtensionApiTest {
void SetUpOnMainThread() override {
ExtensionApiTest::SetUpOnMainThread();
host_resolver()->AddRule("*", "127.0.0.1");
+ navigationHandler_ = std::make_unique<NavigateTabMessageHandler>(profile());
}
void SetUpCommandLine(base::CommandLine* command_line) override {
@@ -274,6 +327,7 @@ class ExtensionWebRequestApiTest : public ExtensionApiTest {
private:
std::vector<std::unique_ptr<TestExtensionDir>> test_dirs_;
+ std::unique_ptr<NavigateTabMessageHandler> navigationHandler_;
};
class DevToolsFrontendInWebRequestApiTest : public ExtensionApiTest {
@@ -287,6 +341,8 @@ class DevToolsFrontendInWebRequestApiTest : public ExtensionApiTest {
url_loader_interceptor_ = std::make_unique<content::URLLoaderInterceptor>(
base::BindRepeating(&DevToolsFrontendInWebRequestApiTest::OnIntercept,
base::Unretained(this), port));
+
+ navigationHandler_ = std::make_unique<NavigateTabMessageHandler>(profile());
}
void TearDownOnMainThread() override {
@@ -352,6 +408,7 @@ class DevToolsFrontendInWebRequestApiTest : public ExtensionApiTest {
base::FilePath test_root_dir_;
std::unique_ptr<content::URLLoaderInterceptor> url_loader_interceptor_;
+ std::unique_ptr<NavigateTabMessageHandler> navigationHandler_;
};
IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestApi) {
@@ -469,23 +526,30 @@ class ExtensionWebRequestApiAuthRequiredTest
}
};
+// Note: this is flaky on multiple platforms (crbug.com/1003598).
IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest,
- WebRequestAuthRequired) {
+ DISABLED_WebRequestAuthRequired) {
CancelLoginDialog login_dialog_helper;
ASSERT_TRUE(StartEmbeddedTestServer());
+
+ // Pass "debug" as a custom arg to debug test flakiness.
ASSERT_TRUE(RunExtensionSubtestWithArgAndFlags(
- "webrequest", "test_auth_required.html", nullptr, GetFlags()))
+ "webrequest", "test_auth_required.html", "debug", GetFlags()))
<< message_;
}
+// Note: this is flaky on multiple platforms (crbug.com/1003598). Temporarily
+// enabled to find flakiness cause.
IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest,
- WebRequestAuthRequiredAsync) {
+ DISABLED_WebRequestAuthRequiredAsync) {
CancelLoginDialog login_dialog_helper;
ASSERT_TRUE(StartEmbeddedTestServer());
+
+ // Pass "debug" as a custom arg to debug test flakiness.
ASSERT_TRUE(RunExtensionSubtestWithArgAndFlags(
- "webrequest", "test_auth_required_async.html", nullptr, GetFlags()))
+ "webrequest", "test_auth_required_async.html", "debug", GetFlags()))
<< message_;
}
@@ -535,7 +599,15 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
<< message_;
}
-IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestExtraHeaders) {
+// Flaky on ChromeOS: https://crbug.com/1003661 and Linux:
+// https://crbug.com/1864717
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+#define MAYBE_WebRequestExtraHeaders DISABLED_WebRequestExtraHeaders
+#else
+#define MAYBE_WebRequestExtraHeaders WebRequestExtraHeaders
+#endif
+IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
+ MAYBE_WebRequestExtraHeaders) {
CancelLoginDialog login_dialog_helper;
ASSERT_TRUE(StartEmbeddedTestServer());
@@ -546,7 +618,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestExtraHeaders) {
IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
WebRequestCORSWithExtraHeaders) {
ASSERT_TRUE(StartEmbeddedTestServer());
- ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_cors.html")) << message_;
+ std::string test = "test_cors.html";
+ if (network::features::ShouldEnableOutOfBlinkCorsForTesting())
+ test += "?cors_mode=network_service";
+ else
+ test += "?cors_mode=blink";
+ ASSERT_TRUE(RunExtensionSubtest("webrequest", test)) << message_;
}
IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestRedirects) {
@@ -869,7 +946,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, ExtensionRequests) {
// The extension frame does run in the extension's process. Any requests made
// by it should not be visible to other extensions, since they won't have
// access to the request initiator.
- EXPECT_EQ("Did not intercept any requests.", listener_result.message());
+ //
+ // OTOH, the content script executes fetches/XHRs as-if they were initiated by
+ // the webpage that the content script got injected into. Here, the webpage
+ // has origin of http://127.0.0.1:<some port>, and so the webRequest API
+ // extension should have access to the request.
+ EXPECT_EQ("Intercepted requests: ?contentscript", listener_result.message());
}
IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, HostedAppRequest) {
diff --git a/chromium/chrome/browser/extensions/api/webrtc_logging_private/OWNERS b/chromium/chrome/browser/extensions/api/webrtc_logging_private/OWNERS
index 67620a285c7..c954e4277f5 100644
--- a/chromium/chrome/browser/extensions/api/webrtc_logging_private/OWNERS
+++ b/chromium/chrome/browser/extensions/api/webrtc_logging_private/OWNERS
@@ -1 +1,3 @@
+eladalon@chromium.org
grunell@chromium.org
+guidou@chromium.org
diff --git a/chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
index dcff38d5276..8cc6edf6286 100644
--- a/chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+++ b/chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/install_tracker.h"
+#include "chrome/browser/extensions/scoped_active_install.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
diff --git a/chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.h b/chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
index 72f65444b0c..7bb1172e1cc 100644
--- a/chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
+++ b/chromium/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
@@ -26,6 +26,7 @@ class GpuFeatureChecker;
namespace extensions {
class Extension;
+class ScopedActiveInstall;
class WebstorePrivateApi {
public:
diff --git a/chromium/chrome/browser/flag-metadata.json b/chromium/chrome/browser/flag-metadata.json
index ec2a104c72d..f7f2ce3924b 100644
--- a/chromium/chrome/browser/flag-metadata.json
+++ b/chromium/chrome/browser/flag-metadata.json
@@ -29,6 +29,11 @@
[
{
+ "name": "accessibility-internals-page-improvements",
+ "owners": [ "abigailbklein" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "account-consistency",
"owners": [ "droger", "msarda" ],
"expiry_milestone": 80
@@ -39,6 +44,11 @@
"expiry_milestone": 81
},
{
+ "name": "aggregated-ml-search-ranking",
+ "owners": [ "thanhdng", "jiameng" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "allow-disable-mouse-acceleration",
"owners": [ "zentaro" ],
"expiry_milestone": 82
@@ -61,11 +71,6 @@
"expiry_milestone": -1
},
{
- "name": "allow-remote-context-for-notifications",
- "owners": [ "pshmakov", "peter" ],
- "expiry_milestone": 74
- },
- {
"name": "allow-sxg-certs-without-extension",
"owners": [ "//content/browser/web_package/OWNERS" ],
// Used by developers for testing signed exchange loading using normal
@@ -85,7 +90,7 @@
{
"name": "android-picture-in-picture-api",
"owners": [ "beccahughes", "jazzhsu" ],
- "expiry_milestone": 78
+ "expiry_milestone": 82
},
{
"name": "android-setup-search-engine",
@@ -100,12 +105,12 @@
{
"name": "animated-avatar-button",
"owners": ["jkrcal"],
- "expiry_milestone": 78
+ "expiry_milestone": 79
},
{
"name": "app-management",
"owners": [ "//chrome/browser/resources/app_management/OWNERS" ],
- "expiry_milestone": 79
+ "expiry_milestone": 81
},
{
"name": "app-service-ash",
@@ -113,6 +118,11 @@
"expiry_milestone": 79
},
{
+ "name": "app-service-intent-handling",
+ "owners": [ "chromeos-apps-foundation-team@google.com" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "app-service-shelf",
"owners": [ "//chrome/services/app_service/OWNERS" ],
"expiry_milestone": 79
@@ -219,9 +229,9 @@
"expiry_milestone": 79
},
{
- "name": "autofill-always-show-server-cards-in-sync-transport",
- "owners": [ "sebsg" ],
- "expiry_milestone": 74
+ "name": "autofill-always-return-cloud-tokenized-card",
+ "owners": [ "aneeshali@google.com", "annelim@google.com", "jsaul@google.com" ],
+ "expiry_milestone": 87
},
{
"name": "autofill-assistant-chrome-entry",
@@ -331,6 +341,11 @@
"expiry_milestone": 79
},
{
+ "name": "back-forward-cache",
+ "owners": [ "bfcache-dev" ],
+ "expiry_milestone": 83
+ },
+ {
"name": "background-task-component-update",
"owners": [ "sorin", "waffles", "tiborg" ],
"expiry_milestone": 76
@@ -341,11 +356,6 @@
"expiry_milestone": 80
},
{
- "name": "bundled-exchanges",
- "owners": [ "toyoshim", "ksakamoto", "horo", "kinuko" ],
- "expiry_milestone": 83
- },
- {
"name": "BundledConnectionHelp",
"owners": [ "carlosil" ],
"expiry_milestone": 76
@@ -421,6 +431,11 @@
"expiry_milestone": 79
},
{
+ "name": "chrome-sharing-hub",
+ "owners": ["kmilka"],
+ "expiry_milestone": 83
+ },
+ {
"name": "clear-old-browsing-data",
"owners": [ "dullweber" ],
"expiry_milestone": 78
@@ -428,22 +443,22 @@
{
"name": "click-to-call-context-menu-selected-text",
"owners": [ "//chrome/browser/sharing/OWNERS" ],
- "expiry_milestone": 80
+ "expiry_milestone": 82
},
{
"name": "click-to-call-open-dialer-directly",
"owners": [ "//chrome/browser/sharing/OWNERS" ],
- "expiry_milestone": 81
+ "expiry_milestone": 82
},
{
"name": "click-to-call-receiver",
"owners": [ "//chrome/browser/sharing/OWNERS" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "click-to-call-ui",
"owners": [ "//chrome/browser/sharing/OWNERS" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "click-to-open-pdf",
@@ -533,12 +548,12 @@
{
"name": "crostini-gpu-support",
"owners": [ "nverne", "benwells" ],
- "expiry_milestone": 78
+ "expiry_milestone": 85
},
{
"name": "crostini-usb-allow-unsupported",
"owners": [ "nverne", "benwells" ],
- "expiry_milestone": 77
+ "expiry_milestone": 85
},
{
"name": "crostini-usb-support",
@@ -551,6 +566,11 @@
"expiry_milestone": 82
},
{
+ "name": "cryptauth-v2-devicesync",
+ "owners": [ "khorimoto", "nohle" ],
+ "expiry_milestone": 85
+ },
+ {
"name": "cryptauth-v2-enrollment",
"owners": [ "khorimoto", "nohle" ],
"expiry_milestone": 82
@@ -561,6 +581,11 @@
"expiry_milestone": 78
},
{
+ "name": "darken-websites-checkbox-in-themes-setting",
+ "owners": [ "lazzzis@google.com", "twellington" ],
+ "expiry_milestone": 83
+ },
+ {
"name": "data-saver-server-previews",
"owners": [ "//components/data_reduction_proxy/OWNERS" ],
// This flag is used for frequent manual testing and should not be removed.
@@ -681,6 +706,13 @@
"expiry_milestone": 83
},
{
+ "name": "disable-office-editing-component-app",
+ "owners": [
+ "chrome-apps-platform-rationalization@google.com",
+ "quickoffice-chrome-eng@google.com" ],
+ "expiry_milestone": 88
+ },
+ {
// See https://crbug.com/882238.
"name": "disable-pushstate-throttle",
"owners": [ "arthursonzogni@chromium.org", "palmer@chromium.org" ],
@@ -756,14 +788,9 @@
"expiry_milestone": 80
},
{
- "name": "download-home-v2",
- "owners": [ "shaktisahu", "xingliu", "dtrainor" ],
- "expiry_milestone": 76
- },
- {
"name": "download-rename",
"owners": [ "hesen", "dtrainor" ],
- "expiry_milestone": 76
+ "expiry_milestone": 79
},
{
"name": "download-resumption-without-strong-validators",
@@ -771,11 +798,6 @@
"expiry_milestone": 80
},
{
- "name": "drag-to-pin-tabs",
- "owners": ["chrome-desktop-ui-seattle@google.com", "cyan", "tbergquist"],
- "expiry_milestone": 82
- },
- {
"name": "draw-vertically-edge-to-edge",
"owners": [ "chrome-android-app@chromium.org" ],
"expiry_milestone": 88
@@ -787,6 +809,16 @@
"expiry_milestone": 89
},
{
+ "name": "enable-accessibility-expose-aria-annotations",
+ "owners": [ "aleventhal@chromium.org", "//third_party/blink/renderer/modules/accessibility/OWNERS", "//ui/accessibility/OWNERS" ],
+ "expiry_milestone": 85
+ },
+ {
+ "name": "enable-accessibility-expose-display-none",
+ "owners": [ "adettenb@microsoft.com", "//third_party/blink/renderer/modules/accessibility/OWNERS", "//ui/accessibility/OWNERS" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "enable-accessibility-image-descriptions",
"owners": [ "//ui/accessibility/OWNERS" ],
"expiry_milestone": 77
@@ -794,7 +826,7 @@
{
"name": "enable-accessibility-object-model",
"owners": [ "//ui/accessibility/OWNERS" ],
- "expiry_milestone": 76
+ "expiry_milestone": 79
},
{
"name": "enable-advanced-ppd-attributes",
@@ -834,12 +866,12 @@
{
"name": "enable-app-data-search",
"owners": [ "jennyz", "kaznacheev" ],
- "expiry_milestone": 78
+ "expiry_milestone": 86
},
{
"name": "enable-app-grid-ghost",
"owners": [ "mmourgos" ],
- "expiry_milestone": 78
+ "expiry_milestone": 82
},
{
"name": "enable-app-list-search-autocomplete",
@@ -859,7 +891,12 @@
{
"name": "enable-arc-unified-audio-focus",
"owners": [ "beccahughes", "media-dev" ],
- "expiry_milestone": 76
+ "expiry_milestone": 82
+ },
+ {
+ "name": "enable-assistant-aec",
+ "owners": [ "croissant-eng" ],
+ "expiry_milestone": 88
},
{
"name": "enable-assistant-app-support",
@@ -904,7 +941,7 @@
{
"name": "enable-audio-focus-enforcement",
"owners": [ "beccahughes", "media-dev" ],
- "expiry_milestone": 76
+ "expiry_milestone": 82
},
{
"name": "enable-aura-tooltips-on-windows",
@@ -955,11 +992,6 @@
"expiry_milestone": 80
},
{
- "name": "enable-autofill-import-dynamic-forms",
- "owners": [ "hozhng@google.com", "jiahuiguo@google.com" ],
- "expiry_milestone": 79
- },
- {
"name": "enable-autofill-local-card-migration-uses-strike-system-v2",
"owners": [ "annelim@google.com", "jsaul@google.com" , "jiahuiguo@google.com"],
"expiry_milestone": 84
@@ -990,9 +1022,9 @@
"expiry_milestone": 87
},
{
- "name": "enable-avoid-flash-between-navigation",
- "owners": [ "schenney", "paint-dev" ],
- "expiry_milestone": 80
+ "name": "enable-autofill-upi-vpa",
+ "owners": ["cfroussios"],
+ "expiry_milestone": 82
},
{
"name": "enable-backdrop-filter",
@@ -1055,7 +1087,7 @@
"expiry_milestone": 84
},
{
- "name": "enable-close-tab-suggestions-stale",
+ "name": "enable-close-tab-suggestions",
"owners": [ "memex-team@google.com" ],
"expiry_milestone": 82
},
@@ -1087,19 +1119,24 @@
"expiry_milestone": 76
},
{
+ "name": "enable-cros-action-recorder",
+ "owners": [ "charleszhao", "tby" ],
+ "expiry_milestone": 84
+ },
+ {
"name": "enable-cros-ime-input-logic-fst",
"owners": [ "essential-inputs-team@google.com" ],
"expiry_milestone": 77
},
{
- "name": "enable-cros-vm-cups-proxy",
- "owners": [ "//chrome/services/cups_proxy/OWNERS" ],
- "expiry_milestone": 78
+ "name": "enable-cssom-view-scroll-coordinates",
+ "owners": [ "cathiechen@igalia.com", "fwang@igalia.com" ],
+ "expiry_milestone": 83
},
{
"name": "enable-cups-printers-ui-overhaul",
"owners": [ "jimmyxgong" ],
- "expiry_milestone": 79
+ "expiry_milestone": 81
},
{
"name": "enable-custom-mac-paper-sizes",
@@ -1159,6 +1196,11 @@
"expiry_milestone": 80
},
{
+ "name": "enable-duet-tabstrip-integration",
+ "owners": [ "memex-team@google.com" ],
+ "expiry_milestone": 84
+ },
+ {
"name": "enable-encryption-migration",
"owners": [ "fukino" ],
"expiry_milestone": 76
@@ -1169,6 +1211,11 @@
"expiry_milestone": 80
},
{
+ "name": "enable-ephemeral-tab-bottom-sheet",
+ "owners": [ "donnd", "jinsukkim" ],
+ "expiry_milestone": 80
+ },
+ {
"name": "enable-experimental-accessibility-autoclick",
"owners": [ "katie", "dmazzoni", "dtseng" ],
"expiry_milestone": 78
@@ -1176,7 +1223,7 @@
{
"name": "enable-experimental-accessibility-chromevox-language-switching",
"owners": [ "akihiroota", "dmazzoni", "dtseng" ],
- "expiry_milestone": 78
+ "expiry_milestone": 82
},
{
"name": "enable-experimental-accessibility-chromevox-sub-node-language-switching",
@@ -1186,7 +1233,7 @@
{
"name": "enable-experimental-accessibility-features",
"owners": [ "//ui/accessibility/OWNERS" ],
- "expiry_milestone": 76
+ "expiry_milestone": 79
},
{
"name": "enable-experimental-accessibility-language-detection",
@@ -1196,17 +1243,22 @@
{
"name": "enable-experimental-accessibility-switch-access",
"owners": [ "anastasi@google.com", "//ui/accessibility/OWNERS" ],
- "expiry_milestone": 78
+ "expiry_milestone": 85
},
{
"name": "enable-experimental-accessibility-switch-access-text",
"owners": [ "anastasi@google.com", "//ui/accessibility/OWNERS" ],
+ "expiry_milestone": 85
+ },
+ {
+ "name": "enable-experimental-fling-animation",
+ "owners": [ "sarsha@microsoft.com" ],
"expiry_milestone": 80
},
{
"name": "enable-experimental-kernel-vm-support",
"owners": [ "jflat", "zwisler" ],
- "expiry_milestone": 78
+ "expiry_milestone": 82
},
{
"name": "enable-experimental-productivity-features",
@@ -1228,11 +1280,6 @@
"expiry_milestone": -1
},
{
- "name": "enable-filesystem-in-incognito",
- "owners": [ "rhalavati" ],
- "expiry_milestone": 78
- },
- {
"name": "enable-filtering-scroll-events",
"owners": [ "axantoine", "eirage", "nzolghadr", "input-dev" ],
"expiry_milestone": 80
@@ -1298,7 +1345,7 @@
{
"name": "enable-history-favicons-google-server-query",
"owners": ["victorvianna", "jkrcal"],
- "expiry_milestone": 78
+ "expiry_milestone": 79
},
{
"name": "enable-history-manipulation-intervention",
@@ -1306,11 +1353,6 @@
"expiry_milestone": 76
},
{
- "name": "enable-homepage-tile",
- "owners": [ "dimich", "twellington" ],
- "expiry_milestone": 78
- },
- {
"name": "enable-horizontal-tab-switcher",
"owners": [ "memex-team@google.com" ],
"expiry_milestone": 77
@@ -1343,7 +1385,7 @@
{
"name": "enable-intent-picker",
"owners": [ "chromeos-apps-foundation-team@google.com" ],
- "expiry_milestone": 78
+ "expiry_milestone": 80
},
{
"name": "enable-javascript-harmony",
@@ -1403,17 +1445,12 @@
{
"name": "enable-media-session-notifications",
"owners": [ "beccahughes", "media-dev" ],
- "expiry_milestone": 80
+ "expiry_milestone": 82
},
{
"name": "enable-media-session-service",
"owners": [ "beccahughes", "media-dev" ],
- "expiry_milestone": 76
- },
- {
- "name": "enable_messages_web_push",
- "owners": [ "azeemarshad", "jlklein", "khorimoto" ],
- "expiry_milestone": 76
+ "expiry_milestone": 82
},
{
"name": "enable-nacl",
@@ -1428,7 +1465,7 @@
{
"name": "enable-native-notifications",
"owners": [ "peter", "finnur" ],
- "expiry_milestone": 76
+ "expiry_milestone": 84
},
{
"name": "enable-navigation-tracing",
@@ -1448,11 +1485,6 @@
"expiry_milestone": 80
},
{
- "name": "enable-new-photo-picker",
- "owners": [ "finnur", "peter" ],
- "expiry_milestone": 72
- },
- {
"name": "enable-new-print-preview-layout",
"owners": [ "//printing/OWNERS" ],
"expiry_milestone": 78
@@ -1466,12 +1498,7 @@
{
"name": "enable-notification-indicator",
"owners": [ "newcomer" ],
- "expiry_milestone": 78
- },
- {
- "name": "enable-ntp-button",
- "owners": [ "twellington" ],
- "expiry_milestone": 78
+ "expiry_milestone": 83
},
{
"name": "enable-ntp-remote-suggestions",
@@ -1494,6 +1521,11 @@
"owners": [ "enne", "khushalsagar" ],
"expiry_milestone": 80
},
+ {
+ "name": "enable-paint-holding",
+ "owners": [ "schenney", "paint-dev" ],
+ "expiry_milestone": 80
+ },
{
"name": "enable-parallel-downloading",
"owners": [ "qinmin", "xingliu", "dtrainor" ],
@@ -1516,7 +1548,7 @@
{
"name": "enable-play-store-search",
"owners": [ "jennyz", "kaznacheev" ],
- "expiry_milestone": 78
+ "expiry_milestone": 83
},
{
"name" : "enable-pointer-lock-options",
@@ -1550,8 +1582,8 @@
},
{
"name": "enable-quic",
- "owners": [ "rch" ],
- "expiry_milestone": 78
+ "owners": [ "//net/quic/OWNERS" ],
+ "expiry_milestone": 88
},
{
"name": "enable-reader-mode",
@@ -1589,11 +1621,6 @@
"expiry_milestone": 80
},
{
- "name": "enable-resource-load-scheduler",
- "owners": [ "toyoshim" ],
- "expiry_milestone": 78
- },
- {
"name": "enable-resource-loading-hints",
"owners": [ "//components/data_reduction_proxy/OWNERS" ],
// This flag is used for frequent manual testing and should not be removed.
@@ -1616,11 +1643,6 @@
"expiry_milestone": -1
},
{
- "name": "enable-scroll-anchor-serialization",
- "owners": [ "pnoland" ],
- "expiry_milestone": 76
- },
- {
"name": "enable-search-box-selection",
"owners": [ "ginko", "newcomer" ],
"expiry_milestone": 78
@@ -1657,9 +1679,14 @@
"expiry_milestone": 77
},
{
+ "name": "enable-service-worker-on-ui",
+ "owners": [ "falken" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "enable-sharing-device-registration",
"owners": [ "//chrome/browser/sharing/OWNERS" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "enable-shill-sandboxing",
@@ -1729,8 +1756,8 @@
},
{
"name": "enable-surfaces-for-videos",
- "owners": [ "enne", "lethalantidote", "mlamouri" ],
- "expiry_milestone": 76
+ "owners": [ "ericrk", "khushalsagar", "mlamouri" ],
+ "expiry_milestone": 85
},
{
"name": "enable-sxg-prefetch-cache-for-navigations",
@@ -1743,6 +1770,11 @@
"expiry_milestone": 80
},
{
+ "name": "enable-sync-device-info-in-transport-mode",
+ "owners": ["//components/sync/OWNERS", "//chrome/browser/sharing/OWNERS"],
+ "expiry_milestone": 81
+ },
+ {
"name": "enable-sync-uss-bookmarks",
"owners": [ "mamir", "//components/sync/OWNERS" ],
"expiry_milestone": 80
@@ -1750,12 +1782,12 @@
{
"name": "enable-sync-uss-nigori",
"owners": [ "mmoskvitin@google.com", "//components/sync/OWNERS" ],
- "expiry_milestone": 78
+ "expiry_milestone": 80
},
{
"name": "enable-sync-uss-passwords",
"owners": [ "mamir", "//components/sync/OWNERS" ],
- "expiry_milestone": 77
+ "expiry_milestone": 80
},
{
"name": "enable-system-webapps",
@@ -1778,6 +1810,11 @@
"expiry_milestone": 82
},
{
+ "name": "enable-tab-groups-continuation",
+ "owners": [ "memex-team@google.com" ],
+ "expiry_milestone": 84
+ },
+ {
"name": "enable-tab-groups-ui-improvements",
"owners": [ "memex-team@google.com" ],
"expiry_milestone": 82
@@ -1827,16 +1864,16 @@
"expiry_milestone": 82
},
{
- "name": "enable-url-loader-lite-page-server-previews",
- "owners": [ "//components/data_reduction_proxy/OWNERS" ],
- "expiry_milestone": 79
- },
- {
"name": "enable-usbguard",
"owners": [ "allenwebb", "mnissler", "jorgelo" ],
"expiry_milestone": 80
},
{
+ "name": "enable-use-hdr-transfer-function",
+ "owners": [ "mcasas" ],
+ "expiry_milestone": 89
+ },
+ {
"name": "enable-use-zoom-for-dsf",
"owners": [ "ccameron" ],
"expiry_milestone": 80
@@ -1879,19 +1916,19 @@
"expiry_milestone": 79
},
{
- "name": "enable-web-authentication-ble-support",
- "owners": [ "webauthn-team@google.com" ],
+ "name": "enable-vulkan",
+ "owners": [ "penghuang" ],
"expiry_milestone": 82
},
{
- "name": "enable-web-authentication-cable-support",
+ "name": "enable-web-authentication-ble-support",
"owners": [ "webauthn-team@google.com" ],
- "expiry_milestone": 80
+ "expiry_milestone": 82
},
{
- "name": "enable-web-authentication-pin-support",
+ "name": "enable-web-authentication-cable-v2-support",
"owners": [ "webauthn-team@google.com" ],
- "expiry_milestone": 77
+ "expiry_milestone": 84
},
{
"name": "enable-web-authentication-testing-api",
@@ -1908,7 +1945,7 @@
},
{
"name": "enable-webassembly-baseline",
- "owners": [ "clemensh", "wasm-team@google.com" ],
+ "owners": [ "clemensb", "wasm-team@google.com" ],
"expiry_milestone": 83
},
{
@@ -1918,7 +1955,7 @@
},
{
"name": "enable-webassembly-code-gc",
- "owners": [ "clemensh", "wasm-team@google.com" ],
+ "owners": [ "clemensb", "wasm-team@google.com" ],
"expiry_milestone": 83
},
{
@@ -1941,7 +1978,7 @@
{
"name": "enable-webgl2-compute-context",
"owners": [ "webgl-team@google.com" ],
- "expiry_milestone": 77
+ "expiry_milestone": 81
},
{
"name": "enable-webnfc",
@@ -1950,8 +1987,8 @@
},
{
"name": "enable-webrtc-hide-local-ips-with-mdns",
- "owners": [ "qingsi", "jeroendb" ],
- "expiry_milestone": 78
+ "owners": [ "qingsi" ],
+ "expiry_milestone": 81
},
{
"name": "enable-webrtc-hw-h264-encoding",
@@ -1976,7 +2013,7 @@
{
"name": "enable-webrtc-new-encode-cpu-load-estimator",
"owners": [ "nisse" ],
- "expiry_milestone": 77
+ "expiry_milestone": 85
},
{
"name": "enable-webrtc-pipewire-capturer",
@@ -2001,14 +2038,19 @@
{
"name": "enable-webvr",
"owners": [ "//third_party/blink/renderer/modules/vr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 80
+ },
+ {
+ "name": "enable-winrt-geolocation-implementation",
+ "owners": [ "pelavall@microsoft.com" ],
+ "expiry_milestone": 81
},
{
"name": "enable-winrt-sensor-implementation",
"owners": [ "wensh@microsoft.com" ],
"expiry_milestone": 80
},
- {
+ {
"name": "enable-zero-copy",
"owners": [ "ccameron", "chrome-gpu@google.com" ],
// This flag is commonly used when asking users to help gather debug info.
@@ -2025,11 +2067,6 @@
"expiry_milestone": 75
},
{
- "name": "enforce-tls13-downgrade",
- "owners": [ "davidben", "svaldez" ],
- "expiry_milestone": 82
- },
- {
"name": "enterprise-reporting-in-browser",
"owners": [ "pastarmovj", "zmin" ],
"expiry_milestone": 79
@@ -2040,6 +2077,11 @@
"expiry_milestone": 83
},
{
+ "name": "exo-pointer-lock",
+ "owners": [ "hollingum" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "expensive-background-timer-throttling",
"owners": [ "altimin" ],
"expiry_milestone": 76
@@ -2072,11 +2114,6 @@
"expiry_milestone": 82
},
{
- "name": "fcm-invalidations",
- "owners": [ "melandory", "chrome-sync-dev@google.com" ],
- "expiry_milestone": 76
- },
- {
"name": "file-handling-api",
"owners": ["harrisjay@chromium.org", "raymes@chromium.org"],
"expiry_milestone": 79
@@ -2084,12 +2121,7 @@
{
"name": "file-manager-feedback-panel",
"owners": [ "adanilo" ],
- "expiry_milestone": 78
- },
- {
- "name": "file-manager-format-dialog",
- "owners": [ "austinct" ],
- "expiry_milestone": 78
+ "expiry_milestone": 81
},
{
// See https://crbug.com/904630, offical builds only.
@@ -2140,11 +2172,6 @@
"expiry_milestone": -1
},
{
- "name": "force-enable-home-page-button",
- "owners": [ "twellington", "chrome-android-app" ],
- "expiry_milestone": 81
- },
- {
"name": "force-enable-system-aec",
"owners": [ "grunell" ],
"expiry_milestone": 80
@@ -2179,14 +2206,14 @@
"expiry_milestone": -1
},
{
- "name": "foreground-notification-manager",
- "owners": [ "//components/download/OWNERS" ],
- "expiry_milestone": 76
+ "name": "forced-colors",
+ "owners": [ "weblayout@microsoft.com" ],
+ "expiry_milestone": 82
},
{
"name": "form-controls-refresh",
"owners": [ "iopopesc@microsoft.com", "//third_party/blink/renderer/core/OWNERS" ],
- "expiry_milestone": 78
+ "expiry_milestone": 81
},
{
"name": "fractional-scroll-offsets",
@@ -2194,6 +2221,11 @@
"expiry_milestone": 81
},
{
+ "name": "fuzzy-app-search",
+ "owners": [ "thanhdng", "jiameng" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "gaia-action-buttons",
"owners": [ "jeroendh", "rsorokin" ],
"expiry_milestone": 79
@@ -2220,11 +2252,6 @@
"expiry_milestone": 82
},
{
- "name": "grid-layout-for-ntp-shortcuts",
- "owners": [ "kristipark", "ramyan" ],
- "expiry_milestone": 78
- },
- {
"name": "handwriting-gesture",
"owners": [ "essential-inputs-team@google.com" ],
"expiry_milestone": 80
@@ -2232,7 +2259,7 @@
{
"name": "happiness-tracking-surveys-for-desktop",
"owners": [ "//chrome/browser/ui/hats/OWNERS" ],
- "expiry_milestone": 78
+ "expiry_milestone": 80
},
{
"name": "happiness-tracking-surveys-for-desktop-demo",
@@ -2240,12 +2267,12 @@
// A debugging and demo flag to allow UI/dev/testing team to always show the UI
// components for the survey without being limited by the triggering mechanism.
// This flag should expire along with the above feature flag.
- "expiry_milestone": 78
+ "expiry_milestone": 80
},
{
"name": "hardware-media-key-handling",
"owners": [ "steimel", "media-dev" ],
- "expiry_milestone": 77
+ "expiry_milestone": 84
},
{
"name": "harfbuzz-pdf-subsetter",
@@ -2287,6 +2314,11 @@
"expiry_milestone": 84
},
{
+ "name": "improved-cookie-controls-for-third-party-cookie-blocking",
+ "owners": [ "dullweber", "huanzhong" ],
+ "expiry_milestone": 84
+ },
+ {
"name": "in-product-help-demo-mode-choice",
"owners": [ "dtrainor", "nyquist" ],
// This flag is used by teams as they develop in-product help integrations,
@@ -2350,7 +2382,7 @@
{
"name": "mac-syscall-sandbox",
"owners": [ "kerrnel@google.com" ],
- "expiry_milestone": 80
+ "expiry_milestone": 88
},
{
"name": "mac-system-media-permissions-info-ui",
@@ -2360,7 +2392,7 @@
{
"name": "mac-v2-gpu-sandbox",
"owners": [ "kerrnel@google.com" ],
- "expiry_milestone": 78
+ "expiry_milestone": 88
},
{
"name": "mac-views-task-manager",
@@ -2370,7 +2402,7 @@
{
"name": "manual-password-generation-android",
"owners": [ "ioanap" ],
- "expiry_milestone": 78
+ "expiry_milestone": 80
},
{
"name": "media-router-cast-allow-all-ips",
@@ -2409,6 +2441,16 @@
"expiry_milestone": -1
},
{
+ "name": "message-center-redesign",
+ "owners": ["amehfooz", "tengs"],
+ "expiry_milestone": 81
+ },
+ {
+ "name": "metal",
+ "owners": ["ccameron", "jvanverth"],
+ "expiry_milestone": 83
+ },
+ {
"name": "mime-handler-view-in-cross-process-frame",
"owners": [ "ekaramad" ],
"expiry_milestone": 80
@@ -2481,7 +2523,12 @@
{
"name": "ntp-disable-initial-most-visited-fade-in",
"owners": ["dbeam"],
- "expiry_milestone": 80
+ "expiry_milestone": 79
+ },
+ {
+ "name": "ntp-dismiss-promos",
+ "owners": ["dbeam"],
+ "expiry_milestone": 82
},
{
"name": "ntp-realbox",
@@ -2491,7 +2538,12 @@
{
"name": "oculus-vr",
"owners": [ "//device/vr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
+ },
+ {
+ "name": "offline-home",
+ "owners": [ "shaktisahu", "dtrainor"],
+ "expiry_milestone": 85
},
{
"name": "offline-indicator-always-http-probe",
@@ -2504,6 +2556,11 @@
"expiry_milestone": 76
},
{
+ "name": "offline-indicator-v2",
+ "owners": [ "sinansahin@google.com", "twellington", "offline-dev" ],
+ "expiry_milestone": 85
+ },
+ {
"name": "offline-pages-alternate-dino-page",
"owners": [ "carlosk", "offline-dev" ],
"expiry_milestone": 76
@@ -2569,9 +2626,9 @@
"expiry_milestone": 76
},
{
- "name": "omnibox-alternate-match-description-separator",
- "owners": [ "tommycli", "chrome-omnibox-team@google.com" ],
- "expiry_milestone": 80
+ "name": "omnibox-autocomplete-titles",
+ "owners": [ "manukh", "chrome-omnibox-team@google.com" ],
+ "expiry_milestone": 85
},
{
"name": "omnibox-disable-instant-extended-limit",
@@ -2629,16 +2686,21 @@
"expiry_milestone": 80
},
{
+ "name": "omnibox-preserve-default-match-against-async-update",
+ "owners": [ "tommycli", "chrome-omnibox-team@google.com" ],
+ "expiry_milestone": 85
+ },
+ {
+ "name": "omnibox-remove-suggestions-from-clipboard",
+ "owners": [ "gangwu" ],
+ "expiry_milestone": 85
+ },
+ {
"name": "omnibox-reverse-answers",
"owners": [ "jdonnelly", "chrome-omnibox-team@google.com" ],
"expiry_milestone": 76
},
{
- "name": "omnibox-reverse-tab-switch-logic",
- "owners": [ "krb", "chrome-omnibox-team@google.com" ],
- "expiry_milestone": 77
- },
- {
"name": "omnibox-rich-entity-suggestions",
"owners": [ "jdonnelly", "chrome-omnibox-team@google.com" ],
"expiry_milestone": 80
@@ -2666,7 +2728,7 @@
{
"name": "omnibox-tab-switch-suggestions",
"owners": [ "krb", "chrome-omnibox-team@google.com" ],
- "expiry_milestone": 76
+ "expiry_milestone": 82
},
{
"name": "omnibox-tab-switch-suggestions-dedicated-row",
@@ -2704,11 +2766,6 @@
"expiry_milestone": 76
},
{
- "name": "omnibox-ui-show-placeholder-when-caret-showing",
- "owners": [ "tommycli", "chrome-omnibox-team@google.com" ],
- "expiry_milestone": 76
- },
- {
"name": "omnibox-ui-show-suggestion-favicons",
"owners": [ "ender", "chrome-omnibox-team@google.com" ],
"expiry_milestone": 79
@@ -2719,16 +2776,21 @@
"expiry_milestone": 76
},
{
- "name": "omnibox-wrap-popup-position",
- "owners": [ "krb", "chrome-omnibox-team@google.com" ],
- "expiry_milestone": 78
- },
- {
"name": "omnibox-zero-suggestions-on-ntp",
"owners": [ "chrome-omnibox-team@google.com" ],
"expiry_milestone": 81
},
{
+ "name": "omnibox-zero-suggestions-on-ntp-realbox",
+ "owners": [ "dbeam", "mahmadi" ],
+ "expiry_milestone": 85
+ },
+ {
+ "name": "omnibox-zero-suggestions-on-serp",
+ "owners": [ "tommycli", "pnoland" ],
+ "expiry_milestone": 85
+ },
+ {
"name": "on-the-fly-mhtml-hash-computation",
"owners": [ "mtlieuu", "offline-dev@chromium.org" ],
"expiry_milestone": 76
@@ -2736,12 +2798,12 @@
{
"name": "openvr",
"owners": [ "//device/vr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "openxr",
"owners": [ "//device/vr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "out-of-blink-cors",
@@ -2826,16 +2888,16 @@
"expiry_milestone": 82
},
{
- "name": "pdf-isolation",
- "owners": [ "tsepez" ],
- "expiry_milestone": 76
- },
- {
"name": "per-method-can-make-payment-quota",
"owners": [ "rouslan" ],
"expiry_milestone": 78
},
{
+ "name": "percent-based-scrolling",
+ "owners": [ "maamert@microsoft.com" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "periodic-background-sync",
"owners": [ "nator" ],
"expiry_milestone": 80
@@ -2846,11 +2908,6 @@
"expiry_milestone": 80
},
{
- "name": "postscript-printing",
- "owners": [ "//printing/OWNERS" ],
- "expiry_milestone": 76
- },
- {
"name": "prefetch-main-resource-network-isolation-key",
"owners": [ "dom", "yhirano" ],
"expiry_milestone": 85
@@ -2861,9 +2918,15 @@
"expiry_milestone": 85
},
{
- "name": "proactive-tab-freeze-and-discard",
+ "name": "privacy-settings-redesign",
+ "owners": ["harrisonsean", "msramek",
+ "chrome-privacy-core@google.com"],
+ "expiry_milestone": 82
+ },
+ {
+ "name": "proactive-tab-freeze",
"owners": [ "fdoray" ],
- "expiry_milestone": 75
+ "expiry_milestone": 80
},
{
"name": "profile-menu-revamp",
@@ -2871,6 +2934,11 @@
"expiry_milestone": 82
},
{
+ "name": "prominent-dark-mode-active-tab-title",
+ "owners": [ "dfried" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "pull-to-refresh",
"owners": [ "afakhry" ],
"expiry_milestone": 83
@@ -2885,10 +2953,14 @@
"owners": [ "mdjones" ],
"expiry_milestone": 78
},
+ { "name": "reduce-display-notifications",
+ "owners": [ "baileyberro", "zentaro" ],
+ "expiry_milestone": 82
+ },
{
"name": "reduced-referrer-granularity",
- "owners": [ "jochen", "mkwst" ],
- "expiry_milestone": 78
+ "owners": [ "davidvc", "mkwst", "jochen" ],
+ "expiry_milestone": 81
},
{
"name": "release-notes",
@@ -2933,7 +3005,7 @@
{
"name": "scheduler-configuration",
"owners": [ "kerrnel", "mnissler" ],
- "expiry_milestone": 77
+ "expiry_milestone": 88
},
{
"name": "scrollable-tabstrip",
@@ -2946,11 +3018,6 @@
"expiry_milestone": 79
},
{
- "name": "session-restore-prioritizes-background-use-cases",
- "owners": [ "chrisha" ],
- "expiry_milestone": 76
- },
- {
"name": "set-market-url-for-testing",
"owners": [ "//chrome/android/java/src/org/chromium/chrome/browser/omaha/OWNERS" ],
// This is required by test teams to verify functionality on devices which
@@ -2962,35 +3029,35 @@
"owners": [ "binji" ],
"expiry_milestone": 78
},
- {
+ {
"name": "shared-clipboard-receiver",
"owners": [ "//chrome/browser/sharing/OWNERS" ],
- "expiry_milestone": 80
+ "expiry_milestone": 82
},
{
"name": "shared-clipboard-ui",
"owners": [ "//chrome/browser/sharing/OWNERS" ],
- "expiry_milestone": 80
+ "expiry_milestone": 82
},
{
- "name": "sharing-use-device-info",
+ "name": "sharing-derive-vapid-key",
"owners": [ "//chrome/browser/sharing/OWNERS" ],
- "expiry_milestone": 80
+ "expiry_milestone": 82
},
{
- "name": "shelf-dense-clamshell",
- "owners": [ "manucornet", "mmourgos" ],
+ "name": "sharing-use-device-info",
+ "owners": [ "//chrome/browser/sharing/OWNERS" ],
"expiry_milestone": 82
},
{
"name": "shelf-hotseat",
- "owners": [ "manucornet", "newcomer" ],
+ "owners": [ "manucornet", "mmourgos", "newcomer" ],
"expiry_milestone": 82
},
{
"name": "shelf-hover-previews",
"owners": [ "manucornet" ],
- "expiry_milestone": 77
+ "expiry_milestone": 84
},
{
"name": "shelf-scrollable",
@@ -3010,11 +3077,24 @@
"expiry_milestone": -1
},
{
+ "name": "show-bluetooth-debug-log-toggle",
+ "owners": [ "hansberry", "khorimoto", "yshavit" ],
+ // This is a debug tool used to help in the field with Bluetooth issues
+ // caused by specific hardware, noisy environments, etc. Thus, it should not
+ // expire.
+ "expiry_milestone": -1
+ },
+ {
"name": "show-bluetooth-device-battery",
"owners": [ "hansberry" ],
"expiry_milestone": 80
},
{
+ "name": "show-legacy-tls-warnings",
+ "owners": [ "cthomp" ],
+ "expiry_milestone": 85
+ },
+ {
"name": "show-sync-paused-reason-cookies-cleared-on-exit",
"owners": [ "msalama" ],
"expiry_milestone": 85
@@ -3126,11 +3206,6 @@
"expiry_milestone": 79
},
{
- "name": "system-tray-pagination",
- "owners": ["amehfooz", "tengs"],
- "expiry_milestone": 81
- },
- {
"name": "tab-groups",
"owners": [ "chrome-desktop-ui-seattle@google.com", "bsep" ],
"expiry_milestone": 82
@@ -3161,6 +3236,11 @@
"expiry_milestone": 80
},
{
+ "name": "temporary-unexpire-flags-m78",
+ "owners": [ "ellyjones", "flags-dev" ],
+ "expiry_milestone": 81
+ },
+ {
"name": "terminal-system-app",
"owners": [ "joelhockey", "benwells", "//chrome/browser/chromeos/guest_os/OWNERS" ],
"expiry_milestone": 82
@@ -3173,6 +3253,11 @@
"expiry_milestone": -1
},
{
+ "name": "tls13-hardening-for-local-anchors",
+ "owners": [ "davidben", "svaldez" ],
+ "expiry_milestone": 85
+ },
+ {
"name": "top-chrome-touch-ui",
"owners": [ "chrome-desktop-ui-sea@google.com" ],
"expiry_milestone": 81
@@ -3350,7 +3435,7 @@
{
"name": "use-winrt-midi-api",
"owners": [ "toyoshim" ],
- "expiry_milestone": 76
+ "expiry_milestone": 83
},
{
"name": "user-activation-v2",
@@ -3375,11 +3460,21 @@
"expiry_milestone": -1
},
{
+ "name": "web-bundles",
+ "owners": [ "toyoshim", "ksakamoto", "horo", "kinuko" ],
+ "expiry_milestone": 83
+ },
+ {
"name": "web-contents-occlusion",
"owners": [ "davidbienvenu" ],
"expiry_milestone": 81
},
{
+ "name": "webui-a11y-enhancements",
+ "owners": [ "aee" ],
+ "expiry_milestone": 82
+ },
+ {
"name": "webui-tab-strip",
"owners": [ "johntlee", "pbos" ],
"expiry_milestone": 82
@@ -3387,32 +3482,37 @@
{
"name": "webxr",
"owners": [ "//third_party/blink/renderer/modules/xr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "webxr-anchors",
"owners": [ "//third_party/blink/renderer/modules/xr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
+ },
+ {
+ "name": "webxr-ar-dom-overlay",
+ "owners": [ "//third_party/blink/renderer/modules/xr/OWNERS", "xr-dev@chromium.org" ],
+ "expiry_milestone": 81
},
{
"name": "webxr-ar-module",
"owners": [ "//third_party/blink/renderer/modules/xr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 80
+ "expiry_milestone": 82
},
{
"name": "webxr-hit-test",
"owners": [ "//third_party/blink/renderer/modules/xr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "webxr-orientation-sensor-device",
"owners": [ "//device/vr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "webxr-plane-detection",
"owners": [ "//third_party/blink/renderer/modules/xr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "win-use-native-spellchecker",
@@ -3422,12 +3522,12 @@
{
"name": "windows-mixed-reality",
"owners": [ "//device/vr/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "xr-sandbox",
"owners": [ "//chrome/services/isolated_xr_device/OWNERS", "xr-dev@chromium.org" ],
- "expiry_milestone": 79
+ "expiry_milestone": 82
},
{
"name": "zero-state-files",
diff --git a/chromium/chrome/browser/flag-never-expire-list.json b/chromium/chrome/browser/flag-never-expire-list.json
index a3f6b9fdc7e..dcd980b4bac 100644
--- a/chromium/chrome/browser/flag-never-expire-list.json
+++ b/chromium/chrome/browser/flag-never-expire-list.json
@@ -75,6 +75,7 @@
"overlay-strategies",
"set-market-url-for-testing",
"show-autofill-type-predictions",
+ "show-bluetooth-debug-log-toggle",
"show-taps",
"show-touch-hud",
"tint-gl-composited-content",
diff --git a/chromium/chrome/browser/image_fetcher/BUILD.gn b/chromium/chrome/browser/image_fetcher/BUILD.gn
new file mode 100644
index 00000000000..9aabc0ff856
--- /dev/null
+++ b/chromium/chrome/browser/image_fetcher/BUILD.gn
@@ -0,0 +1,33 @@
+# 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/config/android/rules.gni")
+
+android_library("java") {
+ deps = [
+ "//base:base_java",
+ "//base:jni_java",
+ "//chrome/android/public/profiles:java",
+ "//chrome/browser/util/android:java",
+ "//content/public/android:content_java",
+ "//third_party/gif_player:gif_player_java",
+ ]
+ annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
+ java_files = [
+ "android/java/src/org/chromium/chrome/browser/image_fetcher/CachedImageFetcher.java",
+ "android/java/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherBridge.java",
+ "android/java/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherFactory.java",
+ "android/java/src/org/chromium/chrome/browser/image_fetcher/ImageFetcher.java",
+ "android/java/src/org/chromium/chrome/browser/image_fetcher/InMemoryCachedImageFetcher.java",
+ "android/java/src/org/chromium/chrome/browser/image_fetcher/NetworkImageFetcher.java",
+ ]
+
+ srcjar_deps = [ "//components/image_fetcher/core:java_enums_srcjar" ]
+}
+
+generate_jni("jni_headers") {
+ sources = [
+ "android/java/src/org/chromium/chrome/browser/image_fetcher/ImageFetcherBridge.java",
+ ]
+}
diff --git a/chromium/chrome/browser/media/webrtc/desktop_media_list.h b/chromium/chrome/browser/media/webrtc/desktop_media_list.h
index 8e02a8a95eb..a489bf6ea21 100644
--- a/chromium/chrome/browser/media/webrtc/desktop_media_list.h
+++ b/chromium/chrome/browser/media/webrtc/desktop_media_list.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_MEDIA_WEBRTC_DESKTOP_MEDIA_LIST_H_
#define CHROME_BROWSER_MEDIA_WEBRTC_DESKTOP_MEDIA_LIST_H_
+#include <vector>
+
#include "base/strings/string16.h"
#include "base/time/time.h"
#include "content/public/browser/desktop_media_id.h"
@@ -16,6 +18,8 @@ class DesktopMediaListObserver;
// tabs), and their thumbnails, to the desktop media picker dialog. It
// transparently updates the list in the background, and notifies the desktop
// media picker when something changes.
+//
+// TODO(crbug.com/987001): Consider renaming this class.
class DesktopMediaList {
public:
// Struct used to represent each entry in the list.
@@ -30,6 +34,8 @@ class DesktopMediaList {
gfx::ImageSkia thumbnail;
};
+ using UpdateCallback = base::OnceClosure;
+
virtual ~DesktopMediaList() {}
// Sets time interval between updates. By default list of sources and their
@@ -53,6 +59,14 @@ class DesktopMediaList {
// model.
virtual void StartUpdating(DesktopMediaListObserver* observer) = 0;
+ // Updates the model and calls |callback| when all currently existing sources
+ // have been found, passing |this| as the argument. In most respects, this is
+ // a simplified version of StartUpdating(). This method should only be called
+ // once per DesktopMediaList instance. It should not be called after
+ // StartUpdating(), and StartUpdating() should not be called until |callback|
+ // has been called.
+ virtual void Update(UpdateCallback callback) = 0;
+
virtual int GetSourceCount() const = 0;
virtual const Source& GetSource(int index) const = 0;
diff --git a/chromium/chrome/browser/metrics/perf/BUILD.gn b/chromium/chrome/browser/metrics/perf/BUILD.gn
new file mode 100644
index 00000000000..6c3697f9a75
--- /dev/null
+++ b/chromium/chrome/browser/metrics/perf/BUILD.gn
@@ -0,0 +1,20 @@
+# 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/config/ui.gni")
+import("//testing/test.gni")
+
+test("profile_provider_unittest") {
+ sources = [
+ "profile_provider_unittest_main.cc",
+ ]
+ deps = [
+ "//base",
+ "//base/test:test_support",
+ "//chrome/browser",
+ "//chromeos/dbus",
+ "//content/test:test_support",
+ "//testing/gtest",
+ ]
+}
diff --git a/chromium/chrome/browser/notifications/scheduler/internal/BUILD.gn b/chromium/chrome/browser/notifications/scheduler/internal/BUILD.gn
index fd22666e58a..affd9de8681 100644
--- a/chromium/chrome/browser/notifications/scheduler/internal/BUILD.gn
+++ b/chromium/chrome/browser/notifications/scheduler/internal/BUILD.gn
@@ -89,6 +89,7 @@ source_set("unit_tests") {
"notification_store_unittest.cc",
"proto_conversion_unittest.cc",
"scheduled_notification_manager_unittest.cc",
+ "scheduler_config_unittest.cc",
"scheduler_utils_unittest.cc",
"stats_unittest.cc",
]
@@ -98,6 +99,7 @@ source_set("unit_tests") {
"//chrome/browser/notifications/scheduler/internal:lib",
"//chrome/browser/notifications/scheduler/public",
"//chrome/browser/notifications/scheduler/test:test_lib",
+ "//chrome/browser/notifications/scheduler/test:test_support",
"//components/leveldb_proto:test_support",
"//skia",
"//testing/gmock",
diff --git a/chromium/chrome/browser/notifications/scheduler/test/BUILD.gn b/chromium/chrome/browser/notifications/scheduler/test/BUILD.gn
index ac7bef4d697..28d6a8d0a39 100644
--- a/chromium/chrome/browser/notifications/scheduler/test/BUILD.gn
+++ b/chromium/chrome/browser/notifications/scheduler/test/BUILD.gn
@@ -2,6 +2,29 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+# Test support target that contains only public mocks and fakes.
+source_set("test_support") {
+ testonly = true
+
+ sources = [
+ "mock_display_agent.cc",
+ "mock_display_agent.h",
+ "mock_notification_background_task_scheduler.cc",
+ "mock_notification_background_task_scheduler.h",
+ "mock_notification_scheduler_client.cc",
+ "mock_notification_scheduler_client.h",
+ ]
+
+ deps = [
+ "//base",
+ "//chrome/browser/notifications/scheduler/public",
+ "//skia",
+ "//testing/gmock",
+ "//testing/gtest",
+ ]
+}
+
+# Test library that is used internally and can't be exposed to the embedder.
source_set("test_lib") {
testonly = true
visibility =
@@ -12,16 +35,10 @@ source_set("test_lib") {
"fake_clock.h",
"mock_background_task_coordinator.cc",
"mock_background_task_coordinator.h",
- "mock_display_agent.cc",
- "mock_display_agent.h",
"mock_display_decider.cc",
"mock_display_decider.h",
"mock_impression_history_tracker.cc",
"mock_impression_history_tracker.h",
- "mock_notification_background_task_scheduler.cc",
- "mock_notification_background_task_scheduler.h",
- "mock_notification_scheduler_client.cc",
- "mock_notification_scheduler_client.h",
"mock_scheduled_notification_manager.cc",
"mock_scheduled_notification_manager.h",
"test_utils.cc",
diff --git a/chromium/chrome/browser/performance_manager/BUILD.gn b/chromium/chrome/browser/performance_manager/BUILD.gn
index 588d3c05779..ab1114ae8b4 100644
--- a/chromium/chrome/browser/performance_manager/BUILD.gn
+++ b/chromium/chrome/browser/performance_manager/BUILD.gn
@@ -3,19 +3,8 @@
# found in the LICENSE file.
import("//chrome/common/features.gni")
-import("//mojo/public/tools/bindings/mojom.gni")
import("//third_party/protobuf/proto_library.gni")
-mojom("mojo_bindings") {
- sources = [
- "webui_graph_dump.mojom",
- ]
- public_deps = [
- "//mojo/public/mojom/base",
- "//url/mojom:url_mojom_gurl",
- ]
-}
-
proto_library("site_data_proto") {
sources = [
"persistence/site_data/site_data.proto",
diff --git a/chromium/chrome/browser/performance_manager/webui_graph_dump.mojom b/chromium/chrome/browser/performance_manager/webui_graph_dump.mojom
deleted file mode 100644
index eb3af7d7195..00000000000
--- a/chromium/chrome/browser/performance_manager/webui_graph_dump.mojom
+++ /dev/null
@@ -1,69 +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.
-
-// This file exposes an interface to the chrome://discards Web UI to allow
-// viewing and exploring the CU graph.
-
-module performance_manager.mojom;
-
-import "mojo/public/mojom/base/process_id.mojom";
-import "mojo/public/mojom/base/time.mojom";
-import "url/mojom/url.mojom";
-
-// Represents the momentary state of a Page CU.
-struct WebUIPageInfo {
- int64 id;
-
- url.mojom.Url main_frame_url;
-
- // TODO(siggi): Estimate data.
-};
-
-// Represents the momentary state of a Frame CU.
-struct WebUIFrameInfo {
- int64 id;
-
- url.mojom.Url url;
- int64 page_id;
- int64 parent_frame_id;
- int64 process_id;
-};
-
-// Represents the momentary state of a Process CU.
-struct WebUIProcessInfo {
- int64 id;
-
- mojo_base.mojom.ProcessId pid;
- mojo_base.mojom.TimeDelta cumulative_cpu_usage;
- uint64 private_footprint_kb;
-};
-
-// Used to transport favicon data.
-struct WebUIFavIconInfo {
- int64 node_id;
-
- // Contains the base64-encoded icon data, suitable for inclusion in a
- // data URL.
- string icon_data;
-};
-
-interface WebUIGraphChangeStream {
- FrameCreated(WebUIFrameInfo frame);
- PageCreated(WebUIPageInfo pages);
- ProcessCreated(WebUIProcessInfo process);
-
- FrameChanged(WebUIFrameInfo frame);
- PageChanged(WebUIPageInfo page);
- ProcessChanged(WebUIProcessInfo process);
-
- FavIconDataAvailable(WebUIFavIconInfo favicon);
-
- NodeDeleted(int64 node_id);
-};
-
-// This interface allows subscribing to a stream of events that track the state
-// of the performance manager graph.
-interface WebUIGraphDump {
- SubscribeToChanges(WebUIGraphChangeStream change_subscriber);
-};
diff --git a/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc b/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc
index 36a6b566782..f182c0a50a2 100644
--- a/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc
+++ b/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc
@@ -231,9 +231,10 @@ ServiceProcessControl* CloudPrintProxyService::GetServiceProcessControl() {
}
cloud_print::mojom::CloudPrint& CloudPrintProxyService::GetCloudPrintProxy() {
- if (!cloud_print_proxy_ || cloud_print_proxy_.encountered_error()) {
+ if (!cloud_print_proxy_ || !cloud_print_proxy_.is_connected()) {
+ cloud_print_proxy_.reset();
GetServiceProcessControl()->remote_interfaces().GetInterface(
- &cloud_print_proxy_);
+ cloud_print_proxy_.BindNewPipeAndPassReceiver());
}
return *cloud_print_proxy_;
}
diff --git a/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h b/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h
index 32cf5b39a99..bff6a94dd84 100644
--- a/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h
+++ b/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h
@@ -17,6 +17,7 @@
#include "chrome/common/cloud_print.mojom.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_change_registrar.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "printing/buildflags/buildflags.h"
#if !BUILDFLAG(ENABLE_PRINT_PREVIEW) || defined(OS_CHROMEOS)
@@ -98,7 +99,7 @@ class CloudPrintProxyService : public KeyedService {
// For watching for connector policy changes.
PrefChangeRegistrar pref_change_registrar_;
- cloud_print::mojom::CloudPrintPtr cloud_print_proxy_;
+ mojo::Remote<cloud_print::mojom::CloudPrint> cloud_print_proxy_;
base::WeakPtrFactory<CloudPrintProxyService> weak_factory_{this};
diff --git a/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc b/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc
index dd0565c9fcc..73636317041 100644
--- a/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc
+++ b/chromium/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc
@@ -8,6 +8,7 @@
#include <memory>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/command_line.h"
@@ -29,7 +30,8 @@
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/browser_task_environment.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver_set.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -92,8 +94,9 @@ void MockServiceProcessControl::SetConnectSuccessMockExpectations() {
class MockCloudPrintProxy : public cloud_print::mojom::CloudPrint {
public:
- void AddBinding(cloud_print::mojom::CloudPrintRequest request) {
- bindings_.AddBinding(this, std::move(request));
+ void AddReceiver(
+ mojo::PendingReceiver<cloud_print::mojom::CloudPrint> receiver) {
+ receivers_.Add(this, std::move(receiver));
}
void ReturnDisabledInfo() {
@@ -109,11 +112,11 @@ class MockCloudPrintProxy : public cloud_print::mojom::CloudPrint {
}
bool has_been_enabled() {
- bindings_.FlushForTesting();
+ receivers_.FlushForTesting();
return enabled_;
}
bool has_been_disabled() {
- bindings_.FlushForTesting();
+ receivers_.FlushForTesting();
return disabled_;
}
@@ -134,7 +137,7 @@ class MockCloudPrintProxy : public cloud_print::mojom::CloudPrint {
enabled_ = true;
}
- mojo::BindingSet<cloud_print::mojom::CloudPrint> bindings_;
+ mojo::ReceiverSet<cloud_print::mojom::CloudPrint> receivers_;
bool cloud_proxy_info_expectation_set_ = false;
cloud_print::CloudPrintProxyInfo cloud_proxy_info_;
@@ -193,8 +196,9 @@ class TestCloudPrintProxyService : public CloudPrintProxyService {
private:
void HandleCloudPrintProxyRequest(mojo::ScopedMessagePipeHandle handle) {
- mock_proxy_.AddBinding(
- cloud_print::mojom::CloudPrintRequest(std::move(handle)));
+ mock_proxy_.AddReceiver(
+ mojo::PendingReceiver<cloud_print::mojom::CloudPrint>(
+ std::move(handle)));
}
MockServiceProcessControl process_control_;
diff --git a/chromium/chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc b/chromium/chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc
index a790a424c0f..55fc976539c 100644
--- a/chromium/chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc
+++ b/chromium/chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc
@@ -28,6 +28,7 @@
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
+#include "services/network/public/mojom/url_response_head.mojom.h"
using net::DefineNetworkTrafficAnnotation;
@@ -146,7 +147,7 @@ void GCDApiFlowImpl::OnAccessTokenFetchComplete(
void GCDApiFlowImpl::OnDownloadedToString(
std::unique_ptr<std::string> response_body) {
- const network::ResourceResponseHead* response_info =
+ const network::mojom::URLResponseHead* response_info =
url_loader_->ResponseInfo();
if (url_loader_->NetError() != net::OK || !response_info) {
diff --git a/chromium/chrome/browser/printing/cloud_print/privet_http_unittest.cc b/chromium/chrome/browser/printing/cloud_print/privet_http_unittest.cc
index 84fb22c6872..b15d7c30566 100644
--- a/chromium/chrome/browser/printing/cloud_print/privet_http_unittest.cc
+++ b/chromium/chrome/browser/printing/cloud_print/privet_http_unittest.cc
@@ -323,7 +323,7 @@ class PrivetHTTPTest : public TestWithParam<const char*> {
net::HttpStatusCode http_status = net::HTTP_OK) {
return test_url_loader_factory_.SimulateResponseForPendingRequest(
request_url, network::URLLoaderCompletionStatus(net::OK),
- network::CreateResourceResponseHead(http_status), content);
+ network::CreateURLResponseHead(http_status), content);
}
std::string GetUploadDataAsNormalizedJSON(const GURL& url) {
diff --git a/chromium/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc b/chromium/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc
index 3293ddc528b..d73190d598a 100644
--- a/chromium/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc
+++ b/chromium/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc
@@ -104,7 +104,7 @@ class PrivetNotificationsListenerTest : public testing::Test {
bool SuccessfulResponseToInfo(const std::string& response) {
return test_url_loader_factory_.SimulateResponseForPendingRequest(
GURL(kDeviceInfoURL), network::URLLoaderCompletionStatus(net::OK),
- network::CreateResourceResponseHead(net::HTTP_OK), response);
+ network::CreateURLResponseHead(net::HTTP_OK), response);
}
protected:
@@ -168,7 +168,7 @@ TEST_F(PrivetNotificationsListenerTest, HTTPErrorTest) {
notification_listener_->DeviceChanged(kExampleDeviceName, description_);
EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest(
GURL(kDeviceInfoURL), network::URLLoaderCompletionStatus(net::OK),
- network::CreateResourceResponseHead(net::HTTP_NOT_FOUND),
+ network::CreateURLResponseHead(net::HTTP_NOT_FOUND),
/*content=*/""));
}
diff --git a/chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.cc b/chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.cc
index f9070dffd50..79a7799b6c9 100644
--- a/chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.cc
+++ b/chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.cc
@@ -17,6 +17,8 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/storage_partition.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/base/address_family.h"
#include "net/base/ip_address.h"
#include "net/base/network_interfaces.h"
@@ -63,13 +65,14 @@ void GetNetworkListOnUIThread(
void CreateUDPSocketOnUIThread(
content::BrowserContext* profile,
- network::mojom::UDPSocketRequest request,
- network::mojom::UDPSocketListenerPtr listener_ptr) {
+ mojo::PendingReceiver<network::mojom::UDPSocket> receiver,
+ mojo::PendingRemote<network::mojom::UDPSocketListener> listener_remote) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
network::mojom::NetworkContext* network_context =
content::BrowserContext::GetDefaultStoragePartition(profile)
->GetNetworkContext();
- network_context->CreateUDPSocket(std::move(request), std::move(listener_ptr));
+ network_context->CreateUDPSocket(std::move(receiver),
+ std::move(listener_remote));
}
} // namespace
@@ -108,8 +111,7 @@ PrivetTrafficDetector::Helper::Helper(
base::RepeatingClosure on_traffic_detected)
: profile_(profile),
on_traffic_detected_(on_traffic_detected),
- restart_attempts_(kMaxRestartAttempts),
- listener_binding_(this) {
+ restart_attempts_(kMaxRestartAttempts) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}
@@ -148,14 +150,10 @@ void PrivetTrafficDetector::Helper::Restart(
void PrivetTrafficDetector::Helper::Bind() {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- network::mojom::UDPSocketListenerPtr listener_ptr;
- network::mojom::UDPSocketListenerRequest listener_request =
- mojo::MakeRequest(&listener_ptr);
- listener_binding_.Bind(std::move(listener_request));
- base::PostTask(
- FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(&CreateUDPSocketOnUIThread, profile_,
- mojo::MakeRequest(&socket_), std::move(listener_ptr)));
+ base::PostTask(FROM_HERE, {content::BrowserThread::UI},
+ base::BindOnce(&CreateUDPSocketOnUIThread, profile_,
+ socket_.BindNewPipeAndPassReceiver(),
+ listener_receiver_.BindNewPipeAndPassRemote()));
network::mojom::UDPSocketOptionsPtr socket_options =
network::mojom::UDPSocketOptions::New();
@@ -238,7 +236,7 @@ void PrivetTrafficDetector::Helper::OnJoinGroupComplete(int rv) {
void PrivetTrafficDetector::Helper::ResetConnection() {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
socket_.reset();
- listener_binding_.Close();
+ listener_receiver_.reset();
}
void PrivetTrafficDetector::Helper::OnReceived(
diff --git a/chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.h b/chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.h
index 52df267f286..65c613fb7c4 100644
--- a/chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.h
+++ b/chromium/chrome/browser/printing/cloud_print/privet_traffic_detector.h
@@ -9,7 +9,8 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/ip_endpoint.h"
#include "net/base/network_interfaces.h"
#include "services/network/public/cpp/network_connection_tracker.h"
@@ -79,11 +80,11 @@ class PrivetTrafficDetector
// Only accessed on the IO thread.
net::NetworkInterfaceList networks_;
net::IPEndPoint recv_addr_;
- network::mojom::UDPSocketPtr socket_;
+ mojo::Remote<network::mojom::UDPSocket> socket_;
// Implementation of socket listener callback.
// Initialized on the UI thread, but only accessed on the IO thread.
- mojo::Binding<network::mojom::UDPSocketListener> listener_binding_;
+ mojo::Receiver<network::mojom::UDPSocketListener> listener_receiver_{this};
base::WeakPtrFactory<Helper> weak_ptr_factory_{this};
diff --git a/chromium/chrome/browser/printing/cloud_print/privet_url_loader.cc b/chromium/chrome/browser/printing/cloud_print/privet_url_loader.cc
index 7f82e017dfb..81207239a71 100644
--- a/chromium/chrome/browser/printing/cloud_print/privet_url_loader.cc
+++ b/chromium/chrome/browser/printing/cloud_print/privet_url_loader.cc
@@ -27,6 +27,7 @@
#include "net/base/load_flags.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "services/network/public/mojom/url_response_head.mojom.h"
namespace cloud_print {
@@ -220,7 +221,7 @@ void PrivetURLLoader::SetUploadData(const std::string& upload_content_type,
void PrivetURLLoader::OnResponseStarted(
const GURL& final_url,
- const network::ResourceResponseHead& response_head) {
+ const network::mojom::URLResponseHead& response_head) {
if (!response_head.headers ||
response_head.headers->response_code() == net::HTTP_SERVICE_UNAVAILABLE) {
url_loader_.reset();
diff --git a/chromium/chrome/browser/printing/cloud_print/privet_url_loader.h b/chromium/chrome/browser/printing/cloud_print/privet_url_loader.h
index 537cd503da8..93fcb3a22e7 100644
--- a/chromium/chrome/browser/printing/cloud_print/privet_url_loader.h
+++ b/chromium/chrome/browser/printing/cloud_print/privet_url_loader.h
@@ -17,6 +17,7 @@
#include "base/values.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/simple_url_loader.h"
+#include "services/network/public/mojom/url_response_head.mojom-forward.h"
#include "url/gurl.h"
namespace network {
@@ -115,7 +116,7 @@ class PrivetURLLoader {
void RequestTokenRefresh();
void RefreshToken(const std::string& token);
void OnResponseStarted(const GURL& final_url,
- const network::ResourceResponseHead& response_head);
+ const network::mojom::URLResponseHead& response_head);
void OnDownloadedToString(std::unique_ptr<std::string> response_body);
void OnDownloadedToFile(base::FilePath path);
bool CheckURLLoaderForError();
diff --git a/chromium/chrome/browser/printing/pdf_nup_converter_client.cc b/chromium/chrome/browser/printing/pdf_nup_converter_client.cc
index a251fe6b559..275e664efc6 100644
--- a/chromium/chrome/browser/printing/pdf_nup_converter_client.cc
+++ b/chromium/chrome/browser/printing/pdf_nup_converter_client.cc
@@ -24,7 +24,7 @@ void PdfNupConverterClient::DoNupPdfConvert(
const gfx::Rect& printable_area,
std::vector<base::ReadOnlySharedMemoryRegion> pdf_page_regions,
mojom::PdfNupConverter::NupPageConvertCallback callback) {
- auto& nup_converter = GetPdfNupConverterRequest(document_cookie);
+ auto& nup_converter = GetPdfNupConverterRemote(document_cookie);
nup_converter->NupPageConvert(pages_per_sheet, page_size, printable_area,
std::move(pdf_page_regions),
std::move(callback));
@@ -37,7 +37,7 @@ void PdfNupConverterClient::DoNupPdfDocumentConvert(
const gfx::Rect& printable_area,
base::ReadOnlySharedMemoryRegion src_pdf_document,
mojom::PdfNupConverter::NupDocumentConvertCallback callback) {
- auto& nup_converter = GetPdfNupConverterRequest(document_cookie);
+ auto& nup_converter = GetPdfNupConverterRemote(document_cookie);
nup_converter->NupDocumentConvert(
pages_per_sheet, page_size, printable_area, std::move(src_pdf_document),
base::BindOnce(&PdfNupConverterClient::OnDidNupPdfDocumentConvert,
@@ -50,12 +50,12 @@ void PdfNupConverterClient::OnDidNupPdfDocumentConvert(
mojom::PdfNupConverter::NupDocumentConvertCallback callback,
mojom::PdfNupConverter::Status status,
base::ReadOnlySharedMemoryRegion region) {
- RemovePdfNupConverterRequest(document_cookie);
+ RemovePdfNupConverterRemote(document_cookie);
std::move(callback).Run(status, std::move(region));
}
-mojom::PdfNupConverterPtr& PdfNupConverterClient::GetPdfNupConverterRequest(
- int cookie) {
+mojo::Remote<mojom::PdfNupConverter>&
+PdfNupConverterClient::GetPdfNupConverterRemote(int cookie) {
auto iter = pdf_nup_converter_map_.find(cookie);
if (iter != pdf_nup_converter_map_.end()) {
DCHECK(iter->second.is_bound());
@@ -63,21 +63,21 @@ mojom::PdfNupConverterPtr& PdfNupConverterClient::GetPdfNupConverterRequest(
}
auto iterator =
- pdf_nup_converter_map_.emplace(cookie, CreatePdfNupConverterRequest())
+ pdf_nup_converter_map_.emplace(cookie, CreatePdfNupConverterRemote())
.first;
return iterator->second;
}
-void PdfNupConverterClient::RemovePdfNupConverterRequest(int cookie) {
+void PdfNupConverterClient::RemovePdfNupConverterRemote(int cookie) {
size_t erased = pdf_nup_converter_map_.erase(cookie);
DCHECK_EQ(erased, 1u);
}
-mojom::PdfNupConverterPtr
-PdfNupConverterClient::CreatePdfNupConverterRequest() {
- mojom::PdfNupConverterPtr pdf_nup_converter;
+mojo::Remote<mojom::PdfNupConverter>
+PdfNupConverterClient::CreatePdfNupConverterRemote() {
+ mojo::Remote<mojom::PdfNupConverter> pdf_nup_converter;
GetPrintingService()->BindPdfNupConverter(
- mojo::MakeRequest(&pdf_nup_converter));
+ pdf_nup_converter.BindNewPipeAndPassReceiver());
pdf_nup_converter->SetWebContentsURL(web_contents_->GetLastCommittedURL());
return pdf_nup_converter;
}
diff --git a/chromium/chrome/browser/printing/pdf_nup_converter_client.h b/chromium/chrome/browser/printing/pdf_nup_converter_client.h
index 3efc158496f..794a215c0e6 100644
--- a/chromium/chrome/browser/printing/pdf_nup_converter_client.h
+++ b/chromium/chrome/browser/printing/pdf_nup_converter_client.h
@@ -10,6 +10,7 @@
#include "chrome/services/printing/public/mojom/pdf_nup_converter.mojom.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "services/service_manager/public/cpp/connector.h"
namespace printing {
@@ -48,19 +49,19 @@ class PdfNupConverterClient
mojom::PdfNupConverter::Status status,
base::ReadOnlySharedMemoryRegion region);
- // Get the request or create a new one if none exists.
- mojom::PdfNupConverterPtr& GetPdfNupConverterRequest(int cookie);
+ // Get the mojo::Remote or create a new one if none exists.
+ mojo::Remote<mojom::PdfNupConverter>& GetPdfNupConverterRemote(int cookie);
- // Remove an existing request from |pdf_nup_converter_map_|.
- void RemovePdfNupConverterRequest(int cookie);
+ // Remove an existing mojo::Remote from |pdf_nup_converter_map_|.
+ void RemovePdfNupConverterRemote(int cookie);
- mojom::PdfNupConverterPtr CreatePdfNupConverterRequest();
+ mojo::Remote<mojom::PdfNupConverter> CreatePdfNupConverterRemote();
std::unique_ptr<service_manager::Connector> connector_;
// Stores the mapping between document cookies and their corresponding
- // requests.
- std::map<int, mojom::PdfNupConverterPtr> pdf_nup_converter_map_;
+ // mojo::Remote.
+ std::map<int, mojo::Remote<mojom::PdfNupConverter>> pdf_nup_converter_map_;
content::WebContents* web_contents_;
diff --git a/chromium/chrome/browser/printing/pdf_nup_converter_client_browsertest.cc b/chromium/chrome/browser/printing/pdf_nup_converter_client_browsertest.cc
new file mode 100644
index 00000000000..2a0e53063d1
--- /dev/null
+++ b/chromium/chrome/browser/printing/pdf_nup_converter_client_browsertest.cc
@@ -0,0 +1,191 @@
+// 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/bind.h"
+#include "base/files/file_util.h"
+#include "base/optional.h"
+#include "base/path_service.h"
+#include "base/run_loop.h"
+#include "base/threading/thread_restrictions.h"
+#include "chrome/browser/printing/pdf_nup_converter_client.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_paths.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "pdf/pdf.h"
+
+namespace printing {
+
+namespace {
+
+void ResultCallbackImpl(mojom::PdfNupConverter::Status* status_out,
+ base::ReadOnlySharedMemoryRegion* nup_pdf_region_out,
+ bool* called,
+ base::OnceClosure quit_closure,
+ mojom::PdfNupConverter::Status status_in,
+ base::ReadOnlySharedMemoryRegion nup_pdf_region_in) {
+ *status_out = status_in;
+ *nup_pdf_region_out = std::move(nup_pdf_region_in);
+ *called = true;
+ std::move(quit_closure).Run();
+}
+
+base::FilePath GetTestDir() {
+ base::FilePath dir;
+ base::PathService::Get(chrome::DIR_TEST_DATA, &dir);
+ if (!dir.empty())
+ dir = dir.AppendASCII("printing");
+ return dir;
+}
+
+base::MappedReadOnlyRegion GetPdfRegion(const char* file_name) {
+ base::ScopedAllowBlockingForTesting allow_blocking;
+ base::MappedReadOnlyRegion pdf_region;
+
+ base::FilePath test_data_dir = GetTestDir();
+ if (test_data_dir.empty())
+ return pdf_region;
+
+ base::FilePath pdf_file = test_data_dir.AppendASCII(file_name);
+ std::string pdf_str;
+ if (!base::ReadFileToString(pdf_file, &pdf_str) || pdf_str.empty())
+ return pdf_region;
+
+ pdf_region = base::ReadOnlySharedMemoryRegion::Create(pdf_str.size());
+ if (!pdf_region.IsValid())
+ return pdf_region;
+
+ memcpy(pdf_region.mapping.memory(), pdf_str.data(), pdf_str.size());
+ return pdf_region;
+}
+
+base::MappedReadOnlyRegion GetBadDataRegion() {
+ static const char kBadData[] = "BADDATA";
+ base::MappedReadOnlyRegion pdf_region =
+ base::ReadOnlySharedMemoryRegion::Create(base::size(kBadData));
+ if (!pdf_region.IsValid())
+ return pdf_region;
+
+ memcpy(pdf_region.mapping.memory(), kBadData, base::size(kBadData));
+ return pdf_region;
+}
+
+} // namespace
+
+class PdfNupConverterClientBrowserTest : public InProcessBrowserTest {
+ public:
+ PdfNupConverterClientBrowserTest() = default;
+ ~PdfNupConverterClientBrowserTest() override = default;
+
+ base::Optional<mojom::PdfNupConverter::Status> Convert(
+ base::ReadOnlySharedMemoryRegion pdf_region,
+ int pages_per_sheet,
+ base::ReadOnlySharedMemoryRegion* out_nup_pdf_region) {
+ mojom::PdfNupConverter::Status status;
+ base::ReadOnlySharedMemoryRegion nup_pdf_region;
+ bool called = false;
+ auto converter = std::make_unique<PdfNupConverterClient>(
+ browser()->tab_strip_model()->GetActiveWebContents());
+
+ {
+ base::RunLoop run_loop;
+ converter->DoNupPdfDocumentConvert(
+ /*document_cookie=*/8, pages_per_sheet,
+ /*page_size=*/gfx::Size(2550, 3300),
+ /*printable_area=*/gfx::Rect(2550, 3300), std::move(pdf_region),
+ base::BindOnce(&ResultCallbackImpl, &status, &nup_pdf_region, &called,
+ run_loop.QuitClosure()));
+ run_loop.Run();
+ }
+
+ if (!called)
+ return base::nullopt;
+
+ *out_nup_pdf_region = std::move(nup_pdf_region);
+ return status;
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(PdfNupConverterClientBrowserTest,
+ DocumentConvert2UpSuccess) {
+ base::MappedReadOnlyRegion pdf_region =
+ GetPdfRegion("pdf_converter_basic.pdf");
+ ASSERT_TRUE(pdf_region.IsValid());
+
+ // Make sure pdf_converter_basic.pdf has 3 pages.
+ int num_pages;
+ double max_width_in_points;
+ ASSERT_TRUE(
+ chrome_pdf::GetPDFDocInfo(pdf_region.mapping.GetMemoryAsSpan<uint8_t>(),
+ &num_pages, &max_width_in_points));
+ EXPECT_EQ(3, num_pages);
+ EXPECT_DOUBLE_EQ(612.0, max_width_in_points);
+
+ base::ReadOnlySharedMemoryRegion nup_pdf_region;
+ base::Optional<mojom::PdfNupConverter::Status> status = Convert(
+ std::move(pdf_region.region), /*pages_per_sheet=*/2, &nup_pdf_region);
+
+ ASSERT_TRUE(status.has_value());
+ EXPECT_EQ(mojom::PdfNupConverter::Status::SUCCESS, status.value());
+ base::ReadOnlySharedMemoryMapping nup_pdf_mapping = nup_pdf_region.Map();
+ ASSERT_TRUE(nup_pdf_mapping.IsValid());
+
+ // For 2-up, a 3 page portrait document fits on 2 landscape-oriented pages.
+ ASSERT_TRUE(
+ chrome_pdf::GetPDFDocInfo(nup_pdf_mapping.GetMemoryAsSpan<uint8_t>(),
+ &num_pages, &max_width_in_points));
+ EXPECT_EQ(2, num_pages);
+ EXPECT_DOUBLE_EQ(3300.0, max_width_in_points);
+}
+
+IN_PROC_BROWSER_TEST_F(PdfNupConverterClientBrowserTest,
+ DocumentConvert4UpSuccess) {
+ base::MappedReadOnlyRegion pdf_region =
+ GetPdfRegion("pdf_converter_basic.pdf");
+ ASSERT_TRUE(pdf_region.IsValid());
+
+ // Make sure pdf_converter_basic.pdf has 3 pages.
+ int num_pages;
+ double max_width_in_points;
+ ASSERT_TRUE(
+ chrome_pdf::GetPDFDocInfo(pdf_region.mapping.GetMemoryAsSpan<uint8_t>(),
+ &num_pages, &max_width_in_points));
+ EXPECT_EQ(3, num_pages);
+ EXPECT_DOUBLE_EQ(612.0, max_width_in_points);
+
+ base::ReadOnlySharedMemoryRegion nup_pdf_region;
+ base::Optional<mojom::PdfNupConverter::Status> status = Convert(
+ std::move(pdf_region.region), /*pages_per_sheet=*/4, &nup_pdf_region);
+
+ ASSERT_TRUE(status.has_value());
+ EXPECT_EQ(mojom::PdfNupConverter::Status::SUCCESS, status.value());
+ base::ReadOnlySharedMemoryMapping nup_pdf_mapping = nup_pdf_region.Map();
+ ASSERT_TRUE(nup_pdf_mapping.IsValid());
+
+ // For 4-up, a 3 page portrait document fits on 1 landscape-oriented page.
+ ASSERT_TRUE(
+ chrome_pdf::GetPDFDocInfo(nup_pdf_mapping.GetMemoryAsSpan<uint8_t>(),
+ &num_pages, &max_width_in_points));
+ EXPECT_EQ(1, num_pages);
+ EXPECT_DOUBLE_EQ(2550.0, max_width_in_points);
+}
+
+IN_PROC_BROWSER_TEST_F(PdfNupConverterClientBrowserTest,
+ DocumentConvertBadData) {
+ base::MappedReadOnlyRegion pdf_region = GetBadDataRegion();
+ ASSERT_TRUE(pdf_region.IsValid());
+
+ base::ReadOnlySharedMemoryRegion nup_pdf_region;
+ base::Optional<mojom::PdfNupConverter::Status> status = Convert(
+ std::move(pdf_region.region), /*pages_per_sheet=*/2, &nup_pdf_region);
+
+ ASSERT_TRUE(status.has_value());
+ EXPECT_EQ(mojom::PdfNupConverter::Status::CONVERSION_FAILURE, status.value());
+ base::ReadOnlySharedMemoryMapping nup_pdf_mapping = nup_pdf_region.Map();
+ EXPECT_FALSE(nup_pdf_mapping.IsValid());
+}
+
+} // namespace printing
diff --git a/chromium/chrome/browser/printing/pdf_to_emf_converter.cc b/chromium/chrome/browser/printing/pdf_to_emf_converter.cc
index 962a023b0da..3a9141aaebe 100644
--- a/chromium/chrome/browser/printing/pdf_to_emf_converter.cc
+++ b/chromium/chrome/browser/printing/pdf_to_emf_converter.cc
@@ -28,7 +28,10 @@
#include "chrome/services/printing/public/mojom/pdf_to_emf_converter.mojom.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "printing/emf_win.h"
#include "printing/pdf_render_settings.h"
@@ -41,8 +44,8 @@ namespace {
class PdfToEmfConverterClientImpl : public mojom::PdfToEmfConverterClient {
public:
explicit PdfToEmfConverterClientImpl(
- mojom::PdfToEmfConverterClientRequest request)
- : binding_(this, std::move(request)) {}
+ mojo::PendingReceiver<mojom::PdfToEmfConverterClient> receiver)
+ : receiver_(this, std::move(receiver)) {}
private:
// mojom::PdfToEmfConverterClient implementation.
@@ -84,7 +87,7 @@ class PdfToEmfConverterClientImpl : public mojom::PdfToEmfConverterClient {
std::move(callback).Run();
}
- mojo::Binding<mojom::PdfToEmfConverterClient> binding_;
+ mojo::Receiver<mojom::PdfToEmfConverterClient> receiver_;
};
// Emf subclass that knows how to play back PostScript data embedded as EMF
@@ -164,7 +167,8 @@ class PdfConverterImpl : public PdfConverter {
std::unique_ptr<MetafilePlayer> GetMetaFileFromMapping(
base::ReadOnlySharedMemoryMapping mapping);
- void OnPageCount(mojom::PdfToEmfConverterPtr converter, uint32_t page_count);
+ void OnPageCount(mojo::PendingRemote<mojom::PdfToEmfConverter> converter,
+ uint32_t page_count);
void OnPageDone(base::ReadOnlySharedMemoryRegion emf_region,
float scale_factor);
@@ -191,9 +195,9 @@ class PdfConverterImpl : public PdfConverter {
std::unique_ptr<PdfToEmfConverterClientImpl>
pdf_to_emf_converter_client_impl_;
- mojom::PdfToEmfConverterPtr pdf_to_emf_converter_;
+ mojo::Remote<mojom::PdfToEmfConverter> pdf_to_emf_converter_;
- mojom::PdfToEmfConverterFactoryPtr pdf_to_emf_converter_factory_;
+ mojo::Remote<mojom::PdfToEmfConverterFactory> pdf_to_emf_converter_factory_;
base::WeakPtrFactory<PdfConverterImpl> weak_ptr_factory_{this};
@@ -269,29 +273,31 @@ void PdfConverterImpl::Initialize(scoped_refptr<base::RefCountedMemory> data) {
memcpy(memory.mapping.memory(), data->front(), data->size());
GetPrintingService()->BindPdfToEmfConverterFactory(
- mojo::MakeRequest(&pdf_to_emf_converter_factory_));
- pdf_to_emf_converter_factory_.set_connection_error_handler(base::BindOnce(
+ pdf_to_emf_converter_factory_.BindNewPipeAndPassReceiver());
+ pdf_to_emf_converter_factory_.set_disconnect_handler(base::BindOnce(
&PdfConverterImpl::OnFailed, weak_ptr_factory_.GetWeakPtr(),
std::string("Connection to PdfToEmfConverterFactory error.")));
- mojom::PdfToEmfConverterClientPtr pdf_to_emf_converter_client_ptr;
+ mojo::PendingRemote<mojom::PdfToEmfConverterClient>
+ pdf_to_emf_converter_client_remote;
pdf_to_emf_converter_client_impl_ =
std::make_unique<PdfToEmfConverterClientImpl>(
- mojo::MakeRequest(&pdf_to_emf_converter_client_ptr));
+ pdf_to_emf_converter_client_remote.InitWithNewPipeAndPassReceiver());
pdf_to_emf_converter_factory_->CreateConverter(
std::move(memory.region), settings_,
- std::move(pdf_to_emf_converter_client_ptr),
+ std::move(pdf_to_emf_converter_client_remote),
base::BindOnce(&PdfConverterImpl::OnPageCount,
weak_ptr_factory_.GetWeakPtr()));
}
-void PdfConverterImpl::OnPageCount(mojom::PdfToEmfConverterPtr converter,
- uint32_t page_count) {
+void PdfConverterImpl::OnPageCount(
+ mojo::PendingRemote<mojom::PdfToEmfConverter> converter,
+ uint32_t page_count) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!pdf_to_emf_converter_.is_bound());
- pdf_to_emf_converter_ = std::move(converter);
- pdf_to_emf_converter_.set_connection_error_handler(base::BindOnce(
+ pdf_to_emf_converter_.Bind(std::move(converter));
+ pdf_to_emf_converter_.set_disconnect_handler(base::BindOnce(
&PdfConverterImpl::OnFailed, weak_ptr_factory_.GetWeakPtr(),
std::string("Connection to PdfToEmfConverter error.")));
std::move(start_callback_).Run(page_count);
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 0794ce53f65..e912e01e8c8 100644
--- a/chromium/chrome/browser/printing/pdf_to_emf_converter_browsertest.cc
+++ b/chromium/chrome/browser/printing/pdf_to_emf_converter_browsertest.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/browser/printing/pdf_to_emf_converter.h"
-#include <Windows.h>
+#include <windows.h>
#include "base/bind.h"
+#include "base/containers/span.h"
#include "base/files/file_util.h"
#include "base/hash/sha1.h"
#include "base/memory/ref_counted_memory.h"
@@ -15,8 +16,8 @@
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
-#include "chrome/browser/printing/pdf_to_emf_converter.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/test/base/in_process_browser_test.h"
#include "printing/emf_win.h"
#include "printing/metafile.h"
#include "printing/pdf_render_settings.h"
@@ -58,7 +59,7 @@ std::string GetFileNameForPageNumber(const std::string& name, int page_number) {
std::unique_ptr<ENHMETAHEADER> GetEmfHeader(const std::string& emf_data) {
Emf emf;
- if (!emf.InitFromData(emf_data.data(), emf_data.length()))
+ if (!emf.InitFromData(emf_data.data(), emf_data.size()))
return nullptr;
auto meta_header = std::make_unique<ENHMETAHEADER>();
@@ -90,9 +91,8 @@ void CompareEmfHeaders(const ENHMETAHEADER& expected_header,
}
std::string HashData(const char* data, size_t len) {
- unsigned char buf[base::kSHA1Length];
- base::SHA1HashBytes(reinterpret_cast<const unsigned char*>(data), len, buf);
- return base::HexEncode(buf, sizeof(buf));
+ auto span = base::make_span(reinterpret_cast<const uint8_t*>(data), len);
+ return base::HexEncode(base::SHA1HashSpan(span));
}
class PdfToEmfConverterBrowserTest : public InProcessBrowserTest {
@@ -169,8 +169,8 @@ class PdfToEmfConverterBrowserTest : public InProcessBrowserTest {
void ComparePageEmfHeader() {
// TODO(crbug.com/781403): the generated data can differ visually. Until
// this is fixed only checking the output size and parts of the EMF header.
- ASSERT_EQ(expected_current_emf_data_.length(),
- actual_current_emf_data_.length());
+ ASSERT_EQ(expected_current_emf_data_.size(),
+ actual_current_emf_data_.size());
std::unique_ptr<ENHMETAHEADER> expected_header =
GetEmfHeader(expected_current_emf_data_);
@@ -182,10 +182,10 @@ class PdfToEmfConverterBrowserTest : public InProcessBrowserTest {
}
void ComparePageEmfPayload() {
- ASSERT_EQ(expected_current_emf_data_.length(),
- actual_current_emf_data_.length());
- ASSERT_GT(expected_current_emf_data_.length(), kHeaderSize);
- size_t size = expected_current_emf_data_.length() - kHeaderSize;
+ ASSERT_EQ(expected_current_emf_data_.size(),
+ actual_current_emf_data_.size());
+ ASSERT_GT(expected_current_emf_data_.size(), kHeaderSize);
+ size_t size = expected_current_emf_data_.size() - kHeaderSize;
EXPECT_EQ(HashData(expected_current_emf_data_.data() + kHeaderSize, size),
HashData(actual_current_emf_data_.data() + kHeaderSize, size));
}
@@ -195,8 +195,6 @@ class PdfToEmfConverterBrowserTest : public InProcessBrowserTest {
base::FilePath test_data_dir;
if (base::PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir))
test_data_dir = test_data_dir.AppendASCII("printing");
- else
- test_data_dir.clear();
return test_data_dir;
}
diff --git a/chromium/chrome/browser/printing/print_browsertest.cc b/chromium/chrome/browser/printing/print_browsertest.cc
index e2a8b92c752..20e8cf2ea0a 100644
--- a/chromium/chrome/browser/printing/print_browsertest.cc
+++ b/chromium/chrome/browser/printing/print_browsertest.cc
@@ -7,6 +7,7 @@
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/files/file_path.h"
+#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
@@ -46,7 +47,12 @@ constexpr int kDefaultDocumentCookie = 1234;
class PrintPreviewObserver : PrintPreviewUI::TestDelegate {
public:
- PrintPreviewObserver() { PrintPreviewUI::SetDelegateForTesting(this); }
+ explicit PrintPreviewObserver(bool wait_for_loaded) {
+ if (wait_for_loaded)
+ queue_.emplace(); // DOMMessageQueue doesn't allow assignment
+ PrintPreviewUI::SetDelegateForTesting(this);
+ }
+
~PrintPreviewObserver() override {
PrintPreviewUI::SetDelegateForTesting(nullptr);
}
@@ -58,6 +64,12 @@ class PrintPreviewObserver : PrintPreviewUI::TestDelegate {
base::RunLoop run_loop;
base::AutoReset<base::RunLoop*> auto_reset(&run_loop_, &run_loop);
run_loop.Run();
+
+ if (queue_.has_value()) {
+ std::string message;
+ EXPECT_TRUE(queue_->WaitForMessage(&message));
+ EXPECT_EQ("\"success\"", message);
+ }
}
private:
@@ -72,9 +84,20 @@ class PrintPreviewObserver : PrintPreviewUI::TestDelegate {
CHECK(rendered_page_count_ <= total_page_count_);
if (rendered_page_count_ == total_page_count_ && run_loop_) {
run_loop_->Quit();
+
+ if (queue_.has_value()) {
+ content::ExecuteScriptAsync(
+ preview_dialog,
+ "window.addEventListener('message', event => {"
+ " if (event.data.type === 'documentLoaded') {"
+ " domAutomationController.send(event.data.load_state);"
+ " }"
+ "});");
+ }
}
}
+ base::Optional<content::DOMMessageQueue> queue_;
int total_page_count_ = 1;
int rendered_page_count_ = 0;
base::RunLoop* run_loop_ = nullptr;
@@ -192,9 +215,20 @@ class PrintBrowserTest : public InProcessBrowserTest {
}
void PrintAndWaitUntilPreviewIsReady(bool print_only_selection) {
- PrintPreviewObserver print_preview_observer;
+ PrintPreviewObserver print_preview_observer(/*wait_for_loaded=*/false);
+
+ StartPrint(browser()->tab_strip_model()->GetActiveWebContents(),
+ /*print_renderer=*/nullptr,
+ /*print_preview_disabled=*/false, print_only_selection);
+
+ print_preview_observer.WaitUntilPreviewIsReady();
+ }
+
+ void PrintAndWaitUntilPreviewIsReadyAndLoaded(bool print_only_selection) {
+ PrintPreviewObserver print_preview_observer(/*wait_for_loaded=*/true);
StartPrint(browser()->tab_strip_model()->GetActiveWebContents(),
+ /*print_renderer=*/nullptr,
/*print_preview_disabled=*/false, print_only_selection);
print_preview_observer.WaitUntilPreviewIsReady();
@@ -278,9 +312,10 @@ class PrintExtensionBrowserTest : public extensions::ExtensionBrowserTest {
~PrintExtensionBrowserTest() override = default;
void PrintAndWaitUntilPreviewIsReady(bool print_only_selection) {
- PrintPreviewObserver print_preview_observer;
+ PrintPreviewObserver print_preview_observer(/*wait_for_loaded=*/false);
StartPrint(browser()->tab_strip_model()->GetActiveWebContents(),
+ /*print_renderer=*/nullptr,
/*print_preview_disabled=*/false, print_only_selection);
print_preview_observer.WaitUntilPreviewIsReady();
@@ -609,4 +644,20 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessPrintBrowserTest, PrintNup) {
PrintAndWaitUntilPreviewIsReady(/*print_only_selection=*/false);
}
+IN_PROC_BROWSER_TEST_F(PrintBrowserTest, MultipagePrint) {
+ ASSERT_TRUE(embedded_test_server()->Started());
+ GURL url(embedded_test_server()->GetURL("/printing/multipage.html"));
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ PrintAndWaitUntilPreviewIsReadyAndLoaded(/*print_only_selection=*/false);
+}
+
+IN_PROC_BROWSER_TEST_F(SitePerProcessPrintBrowserTest, MultipagePrint) {
+ ASSERT_TRUE(embedded_test_server()->Started());
+ GURL url(embedded_test_server()->GetURL("/printing/multipage.html"));
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ PrintAndWaitUntilPreviewIsReadyAndLoaded(/*print_only_selection=*/false);
+}
+
} // namespace printing
diff --git a/chromium/chrome/browser/printing/print_dialog_cloud_win.cc b/chromium/chrome/browser/printing/print_dialog_cloud_win.cc
index b77e8bc0cdb..250d420e9e2 100644
--- a/chromium/chrome/browser/printing/print_dialog_cloud_win.cc
+++ b/chromium/chrome/browser/printing/print_dialog_cloud_win.cc
@@ -69,8 +69,7 @@ class PrintDataSetter : public content::WebContentsObserver {
private:
// Overridden from content::WebContentsObserver:
- void DocumentLoadedInFrame(
- content::RenderFrameHost* render_frame_host) override {
+ void DOMContentLoaded(content::RenderFrameHost* render_frame_host) override {
GURL url = web_contents()->GetURL();
if (cloud_devices::IsCloudPrintURL(url)) {
base::string16 origin = base::UTF8ToUTF16(url.GetOrigin().spec());
diff --git a/chromium/chrome/browser/printing/print_job.cc b/chromium/chrome/browser/printing/print_job.cc
index c01d535bddb..7a90438438b 100644
--- a/chromium/chrome/browser/printing/print_job.cc
+++ b/chromium/chrome/browser/printing/print_job.cc
@@ -107,9 +107,7 @@ void PrintJob::StartConversionToNativeFormat(
const PrintSettings& settings = document()->settings();
if (settings.printer_is_textonly()) {
StartPdfToTextConversion(print_data, page_size);
- } else if ((settings.printer_is_ps2() || settings.printer_is_ps3()) &&
- !base::FeatureList::IsEnabled(
- features::kDisablePostScriptPrinting)) {
+ } else if (settings.printer_is_ps2() || settings.printer_is_ps3()) {
StartPdfToPostScriptConversion(print_data, content_area, physical_offsets,
settings.printer_is_ps2());
} else {
diff --git a/chromium/chrome/browser/printing/print_job_worker.cc b/chromium/chrome/browser/printing/print_job_worker.cc
index 13f9d7af3ae..ab32d5475a0 100644
--- a/chromium/chrome/browser/printing/print_job_worker.cc
+++ b/chromium/chrome/browser/printing/print_job_worker.cc
@@ -22,11 +22,13 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/printing/print_job.h"
#include "chrome/grit/generated_resources.h"
+#include "components/crash/core/common/crash_keys.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
+#include "printing/backend/print_backend.h"
#include "printing/print_job_constants.h"
#include "printing/printed_document.h"
#include "printing/printing_utils.h"
@@ -39,6 +41,7 @@
#endif
#if defined(OS_WIN)
+#include "base/threading/thread_restrictions.h"
#include "printing/printed_page_win.h"
#endif
@@ -203,6 +206,21 @@ void PrintJobWorker::SetSettingsFromPOD(
void PrintJobWorker::UpdatePrintSettings(base::Value new_settings,
SettingsCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ std::unique_ptr<crash_keys::ScopedPrinterInfo> crash_key;
+ if (new_settings.FindIntKey(kSettingPrinterType).value() == kLocalPrinter) {
+#if defined(OS_WIN)
+ // Blocking is needed here because Windows printer drivers are oftentimes
+ // not thread-safe and have to be accessed on the UI thread.
+ base::ScopedAllowBlocking allow_blocking;
+#endif
+ scoped_refptr<PrintBackend> print_backend =
+ PrintBackend::CreateInstance(nullptr);
+ std::string printer_name = *new_settings.FindStringKey(kSettingDeviceName);
+ crash_key = std::make_unique<crash_keys::ScopedPrinterInfo>(
+ print_backend->GetPrinterDriverInfo(printer_name));
+ }
+
PrintingContext::Result result =
printing_context_->UpdatePrintSettings(std::move(new_settings));
GetSettingsDone(std::move(callback), result);
diff --git a/chromium/chrome/browser/printing/print_preview_message_handler.cc b/chromium/chrome/browser/printing/print_preview_message_handler.cc
index e18eeb6a3b7..23b820f5d64 100644
--- a/chromium/chrome/browser/printing/print_preview_message_handler.cc
+++ b/chromium/chrome/browser/printing/print_preview_message_handler.cc
@@ -31,6 +31,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
+#include "mojo/public/cpp/bindings/callback_helpers.h"
#include "printing/nup_parameters.h"
#include "printing/page_setup.h"
#include "printing/print_job_constants.h"
@@ -166,9 +167,12 @@ void PrintPreviewMessageHandler::OnDidPreviewPage(
// Use utility process to convert skia metafile to pdf.
client->DoCompositePageToPdf(
params.document_cookie, render_frame_host, content,
- base::BindOnce(&PrintPreviewMessageHandler::OnCompositePdfPageDone,
- weak_ptr_factory_.GetWeakPtr(), page_number,
- params.document_cookie, ids));
+ mojo::WrapCallbackWithDefaultInvokeIfNotRun(
+ base::BindOnce(&PrintPreviewMessageHandler::OnCompositePdfPageDone,
+ weak_ptr_factory_.GetWeakPtr(), page_number,
+ params.document_cookie, ids),
+ mojom::PdfCompositor::Status::kCompositingFailure,
+ base::ReadOnlySharedMemoryRegion()));
} else {
NotifyUIPreviewPageReady(
print_preview_ui, page_number, ids,
@@ -207,10 +211,13 @@ void PrintPreviewMessageHandler::OnMetafileReadyForPrinting(
client->DoCompositeDocumentToPdf(
params.document_cookie, render_frame_host, content,
- base::BindOnce(&PrintPreviewMessageHandler::OnCompositePdfDocumentDone,
- weak_ptr_factory_.GetWeakPtr(),
- params.expected_pages_count, params.document_cookie,
- ids));
+ mojo::WrapCallbackWithDefaultInvokeIfNotRun(
+ base::BindOnce(
+ &PrintPreviewMessageHandler::OnCompositePdfDocumentDone,
+ weak_ptr_factory_.GetWeakPtr(), params.expected_pages_count,
+ params.document_cookie, ids),
+ mojom::PdfCompositor::Status::kCompositingFailure,
+ base::ReadOnlySharedMemoryRegion()));
} else {
NotifyUIPreviewDocumentReady(
print_preview_ui, params.expected_pages_count, ids,
@@ -315,12 +322,14 @@ void PrintPreviewMessageHandler::OnCompositePdfPageDone(
mojom::PdfCompositor::Status status,
base::ReadOnlySharedMemoryRegion region) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(ids.ui_id);
if (status != mojom::PdfCompositor::Status::kSuccess) {
DLOG(ERROR) << "Compositing pdf failed with error " << status;
+ if (print_preview_ui)
+ print_preview_ui->OnPrintPreviewFailed(ids.request_id);
return;
}
- PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(ids.ui_id);
if (!print_preview_ui)
return;
@@ -353,8 +362,12 @@ void PrintPreviewMessageHandler::OnCompositePdfPageDone(
client->DoNupPdfConvert(
document_cookie, pages_per_sheet, print_preview_ui->page_size(),
printable_area, std::move(pdf_page_regions),
- base::BindOnce(&PrintPreviewMessageHandler::OnNupPdfConvertDone,
- weak_ptr_factory_.GetWeakPtr(), new_page_number, ids));
+ mojo::WrapCallbackWithDefaultInvokeIfNotRun(
+ base::BindOnce(&PrintPreviewMessageHandler::OnNupPdfConvertDone,
+ weak_ptr_factory_.GetWeakPtr(), new_page_number,
+ ids),
+ mojom::PdfNupConverter::Status::CONVERSION_FAILURE,
+ base::ReadOnlySharedMemoryRegion()));
}
}
}
@@ -365,12 +378,14 @@ void PrintPreviewMessageHandler::OnNupPdfConvertDone(
mojom::PdfNupConverter::Status status,
base::ReadOnlySharedMemoryRegion region) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(ids.ui_id);
if (status != mojom::PdfNupConverter::Status::SUCCESS) {
DLOG(ERROR) << "Nup pdf page conversion failed with error " << status;
+ if (print_preview_ui)
+ print_preview_ui->OnPrintPreviewFailed(ids.request_id);
return;
}
- PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(ids.ui_id);
if (!print_preview_ui)
return;
@@ -386,12 +401,14 @@ void PrintPreviewMessageHandler::OnCompositePdfDocumentDone(
mojom::PdfCompositor::Status status,
base::ReadOnlySharedMemoryRegion region) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(ids.ui_id);
if (status != mojom::PdfCompositor::Status::kSuccess) {
DLOG(ERROR) << "Compositing pdf failed with error " << status;
+ if (print_preview_ui)
+ print_preview_ui->OnPrintPreviewFailed(ids.request_id);
return;
}
- PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(ids.ui_id);
if (!print_preview_ui)
return;
@@ -412,10 +429,13 @@ void PrintPreviewMessageHandler::OnCompositePdfDocumentDone(
client->DoNupPdfDocumentConvert(
document_cookie, pages_per_sheet, print_preview_ui->page_size(),
printable_area, std::move(region),
- base::BindOnce(&PrintPreviewMessageHandler::OnNupPdfDocumentConvertDone,
- weak_ptr_factory_.GetWeakPtr(),
- (page_count + pages_per_sheet - 1) / pages_per_sheet,
- ids));
+ mojo::WrapCallbackWithDefaultInvokeIfNotRun(
+ base::BindOnce(
+ &PrintPreviewMessageHandler::OnNupPdfDocumentConvertDone,
+ weak_ptr_factory_.GetWeakPtr(),
+ (page_count + pages_per_sheet - 1) / pages_per_sheet, ids),
+ mojom::PdfNupConverter::Status::CONVERSION_FAILURE,
+ base::ReadOnlySharedMemoryRegion()));
}
}
@@ -425,12 +445,14 @@ void PrintPreviewMessageHandler::OnNupPdfDocumentConvertDone(
mojom::PdfNupConverter::Status status,
base::ReadOnlySharedMemoryRegion region) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(ids.ui_id);
if (status != mojom::PdfNupConverter::Status::SUCCESS) {
DLOG(ERROR) << "Nup pdf document convert failed with error " << status;
+ if (print_preview_ui)
+ print_preview_ui->OnPrintPreviewFailed(ids.request_id);
return;
}
- PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(ids.ui_id);
if (!print_preview_ui)
return;
diff --git a/chromium/chrome/browser/printing/print_test_utils.cc b/chromium/chrome/browser/printing/print_test_utils.cc
index dca5eafb812..ab3585c1be4 100644
--- a/chromium/chrome/browser/printing/print_test_utils.cc
+++ b/chromium/chrome/browser/printing/print_test_utils.cc
@@ -16,60 +16,54 @@ namespace printing {
const char kDummyPrinterName[] = "DefaultPrinter";
-base::Value GetPrintTicket(PrinterType type, bool cloud) {
- bool is_privet_printer = !cloud && type == kPrivetPrinter;
- bool is_extension_printer = !cloud && type == kExtensionPrinter;
-
+base::Value GetPrintTicket(PrinterType type) {
base::Value ticket(base::Value::Type::DICTIONARY);
// Letter
base::Value media_size(base::Value::Type::DICTIONARY);
- media_size.SetKey(kSettingMediaSizeIsDefault, base::Value(true));
- media_size.SetKey(kSettingMediaSizeWidthMicrons, base::Value(215900));
- media_size.SetKey(kSettingMediaSizeHeightMicrons, base::Value(279400));
+ media_size.SetBoolKey(kSettingMediaSizeIsDefault, true);
+ media_size.SetIntKey(kSettingMediaSizeWidthMicrons, 215900);
+ media_size.SetIntKey(kSettingMediaSizeHeightMicrons, 279400);
ticket.SetKey(kSettingMediaSize, std::move(media_size));
- ticket.SetKey(kSettingPreviewPageCount, base::Value(1));
- ticket.SetKey(kSettingLandscape, base::Value(false));
- ticket.SetKey(kSettingColor, base::Value(2)); // color printing
- ticket.SetKey(kSettingHeaderFooterEnabled, base::Value(false));
- ticket.SetKey(kSettingMarginsType, base::Value(0)); // default margins
- ticket.SetKey(kSettingDuplexMode, base::Value(LONG_EDGE));
- ticket.SetKey(kSettingCopies, base::Value(1));
- ticket.SetKey(kSettingCollate, base::Value(true));
- ticket.SetKey(kSettingShouldPrintBackgrounds, base::Value(false));
- ticket.SetKey(kSettingShouldPrintSelectionOnly, base::Value(false));
- ticket.SetKey(kSettingPreviewModifiable, base::Value(false));
- ticket.SetKey(kSettingPrintToPDF, base::Value(!cloud && type == kPdfPrinter));
- ticket.SetKey(kSettingCloudPrintDialog, base::Value(cloud));
- ticket.SetKey(kSettingPrintWithPrivet, base::Value(is_privet_printer));
- ticket.SetKey(kSettingPrintWithExtension, base::Value(is_extension_printer));
- ticket.SetKey(kSettingRasterizePdf, base::Value(false));
- ticket.SetKey(kSettingScaleFactor, base::Value(100));
- ticket.SetKey(kSettingPagesPerSheet, base::Value(1));
- ticket.SetKey(kSettingDpiHorizontal, base::Value(kTestPrinterDpi));
- ticket.SetKey(kSettingDpiVertical, base::Value(kTestPrinterDpi));
- ticket.SetKey(kSettingDeviceName, base::Value(kDummyPrinterName));
- ticket.SetKey(kSettingFitToPageEnabled, base::Value(true));
- ticket.SetKey(kSettingPageWidth, base::Value(215900));
- ticket.SetKey(kSettingPageHeight, base::Value(279400));
- ticket.SetKey(kSettingShowSystemDialog, base::Value(false));
-
- if (cloud)
- ticket.SetKey(kSettingCloudPrintId, base::Value(kDummyPrinterName));
+ ticket.SetIntKey(kSettingPreviewPageCount, 1);
+ ticket.SetBoolKey(kSettingLandscape, false);
+ ticket.SetIntKey(kSettingColor, 2); // color printing
+ ticket.SetBoolKey(kSettingHeaderFooterEnabled, false);
+ ticket.SetIntKey(kSettingMarginsType, 0); // default margins
+ ticket.SetIntKey(kSettingDuplexMode, LONG_EDGE);
+ ticket.SetIntKey(kSettingCopies, 1);
+ ticket.SetBoolKey(kSettingCollate, true);
+ ticket.SetBoolKey(kSettingShouldPrintBackgrounds, false);
+ ticket.SetBoolKey(kSettingShouldPrintSelectionOnly, false);
+ ticket.SetBoolKey(kSettingPreviewModifiable, true);
+ ticket.SetBoolKey(kSettingPreviewIsPdf, false);
+ ticket.SetIntKey(kSettingPrinterType, type);
+ ticket.SetBoolKey(kSettingRasterizePdf, false);
+ ticket.SetIntKey(kSettingScaleFactor, 100);
+ ticket.SetIntKey(kSettingScalingType, FIT_TO_PAGE);
+ ticket.SetIntKey(kSettingPagesPerSheet, 1);
+ ticket.SetIntKey(kSettingDpiHorizontal, kTestPrinterDpi);
+ ticket.SetIntKey(kSettingDpiVertical, kTestPrinterDpi);
+ ticket.SetStringKey(kSettingDeviceName, kDummyPrinterName);
+ ticket.SetIntKey(kSettingPageWidth, 215900);
+ ticket.SetIntKey(kSettingPageHeight, 279400);
+ ticket.SetBoolKey(kSettingShowSystemDialog, false);
- if (is_privet_printer || is_extension_printer) {
+ if (type == kCloudPrinter) {
+ ticket.SetStringKey(kSettingCloudPrintId, kDummyPrinterName);
+ } else if (type == kPrivetPrinter || type == kExtensionPrinter) {
base::Value capabilities(base::Value::Type::DICTIONARY);
- capabilities.SetKey("duplex", base::Value(true)); // non-empty
+ capabilities.SetBoolKey("duplex", true); // non-empty
std::string caps_string;
base::JSONWriter::Write(capabilities, &caps_string);
- ticket.SetKey(kSettingCapabilities, base::Value(caps_string));
+ ticket.SetStringKey(kSettingCapabilities, caps_string);
base::Value print_ticket(base::Value::Type::DICTIONARY);
- print_ticket.SetKey("version", base::Value("1.0"));
+ print_ticket.SetStringKey("version", "1.0");
print_ticket.SetKey("print", base::Value());
std::string ticket_string;
base::JSONWriter::Write(print_ticket, &ticket_string);
- ticket.SetKey(kSettingTicket, base::Value(ticket_string));
+ ticket.SetStringKey(kSettingTicket, ticket_string);
}
return ticket;
diff --git a/chromium/chrome/browser/printing/print_test_utils.h b/chromium/chrome/browser/printing/print_test_utils.h
index fd1802ed5e4..34fc3b09508 100644
--- a/chromium/chrome/browser/printing/print_test_utils.h
+++ b/chromium/chrome/browser/printing/print_test_utils.h
@@ -18,7 +18,7 @@ const int kTestPrinterDpi = 600;
// Creates a print ticket with some default values. Based on ticket creation in
// chrome/browser/resources/print_preview/native_layer.js.
-base::Value GetPrintTicket(PrinterType type, bool cloud);
+base::Value GetPrintTicket(PrinterType type);
} // namespace printing
diff --git a/chromium/chrome/browser/printing/print_view_manager.cc b/chromium/chrome/browser/printing/print_view_manager.cc
index c3a8b8056b3..ee743fe16fc 100644
--- a/chromium/chrome/browser/printing/print_view_manager.cc
+++ b/chromium/chrome/browser/printing/print_view_manager.cc
@@ -26,6 +26,7 @@
#include "content/public/common/webplugininfo.h"
#include "ipc/ipc_message_macros.h"
#include "printing/buildflags/buildflags.h"
+#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
using content::BrowserThread;
@@ -87,9 +88,13 @@ bool PrintViewManager::PrintForSystemDialogNow(
is_switching_to_system_dialog_ = true;
SetPrintingRFH(print_preview_rfh_);
- int32_t id = print_preview_rfh_->GetRoutingID();
- return PrintNowInternal(print_preview_rfh_,
- std::make_unique<PrintMsg_PrintForSystemDialog>(id));
+
+ // Don't print / print preview interstitials or crashed tabs.
+ if (IsInterstitialOrCrashed())
+ return false;
+
+ GetPrintRenderFrame(print_preview_rfh_)->PrintForSystemDialog();
+ return true;
}
bool PrintViewManager::BasicPrint(content::RenderFrameHost* rfh) {
@@ -108,21 +113,13 @@ bool PrintViewManager::BasicPrint(content::RenderFrameHost* rfh) {
bool PrintViewManager::PrintPreviewNow(content::RenderFrameHost* rfh,
bool has_selection) {
- // Users can send print commands all they want and it is beyond
- // PrintViewManager's control. Just ignore the extra commands.
- // See http://crbug.com/136842 for example.
- if (print_preview_state_ != NOT_PREVIEWING)
- return false;
-
- auto message = std::make_unique<PrintMsg_InitiatePrintPreview>(
- rfh->GetRoutingID(), has_selection);
- if (!PrintNowInternal(rfh, std::move(message)))
- return false;
+ return PrintPreview(rfh, nullptr, has_selection);
+}
- DCHECK(!print_preview_rfh_);
- print_preview_rfh_ = rfh;
- print_preview_state_ = USER_INITIATED_PREVIEW;
- return true;
+bool PrintViewManager::PrintPreviewWithPrintRenderer(
+ content::RenderFrameHost* rfh,
+ mojom::PrintRendererAssociatedPtrInfo print_renderer) {
+ return PrintPreview(rfh, std::move(print_renderer), false);
}
void PrintViewManager::PrintPreviewForWebNode(content::RenderFrameHost* rfh) {
@@ -148,22 +145,20 @@ void PrintViewManager::PrintPreviewDone() {
if (print_preview_state_ == NOT_PREVIEWING)
return;
-// Send ClosePrintPreview message for 'afterprint' event.
+// Send OnPrintPreviewDialogClosed message for 'afterprint' event.
#if defined(OS_WIN)
- // On Windows, we always send ClosePrintPreviewDialog. It's ok to dispatch
+ // On Windows, we always send OnPrintPreviewDialogClosed. It's ok to dispatch
// 'afterprint' at this timing because system dialog printing on
// Windows doesn't need the original frame.
bool send_message = true;
#else
- // On non-Windows, we don't need to send ClosePrintPreviewDialog when we are
- // switching to system dialog. PrintRenderFrameHelper is responsible to
+ // On non-Windows, we don't need to send OnPrintPreviewDialogClosed when we
+ // are switching to system dialog. PrintRenderFrameHelper is responsible to
// dispatch 'afterprint' event.
bool send_message = !is_switching_to_system_dialog_;
#endif
- if (send_message) {
- print_preview_rfh_->Send(new PrintMsg_ClosePrintPreviewDialog(
- print_preview_rfh_->GetRoutingID()));
- }
+ if (send_message)
+ GetPrintRenderFrame(print_preview_rfh_)->OnPrintPreviewDialogClosed();
is_switching_to_system_dialog_ = false;
if (print_preview_state_ == SCRIPTED_PREVIEW) {
@@ -196,6 +191,47 @@ void PrintViewManager::RenderFrameDeleted(
if (render_frame_host == print_preview_rfh_)
PrintPreviewDone();
PrintViewManagerBase::RenderFrameDeleted(render_frame_host);
+ print_render_frames_.erase(render_frame_host);
+}
+
+const mojo::AssociatedRemote<printing::mojom::PrintRenderFrame>&
+PrintViewManager::GetPrintRenderFrame(content::RenderFrameHost* rfh) {
+ auto it = print_render_frames_.find(rfh);
+ if (it == print_render_frames_.end()) {
+ mojo::AssociatedRemote<printing::mojom::PrintRenderFrame> remote;
+ rfh->GetRemoteAssociatedInterfaces()->GetInterface(&remote);
+ it = print_render_frames_.insert({rfh, std::move(remote)}).first;
+ } else if (it->second.is_bound() && !it->second.is_connected()) {
+ // When print preview is closed, the remote is disconnected from the
+ // receiver. Reset and bind the remote before using it again.
+ it->second.reset();
+ rfh->GetRemoteAssociatedInterfaces()->GetInterface(&it->second);
+ }
+
+ return it->second;
+}
+
+bool PrintViewManager::PrintPreview(
+ content::RenderFrameHost* rfh,
+ mojom::PrintRendererAssociatedPtrInfo print_renderer,
+ bool has_selection) {
+ // Users can send print commands all they want and it is beyond
+ // PrintViewManager's control. Just ignore the extra commands.
+ // See http://crbug.com/136842 for example.
+ if (print_preview_state_ != NOT_PREVIEWING)
+ return false;
+
+ // Don't print / print preview interstitials or crashed tabs.
+ if (IsInterstitialOrCrashed())
+ return false;
+
+ GetPrintRenderFrame(rfh)->InitiatePrintPreview(std::move(print_renderer),
+ has_selection);
+
+ DCHECK(!print_preview_rfh_);
+ print_preview_rfh_ = rfh;
+ print_preview_state_ = USER_INITIATED_PREVIEW;
+ return true;
}
void PrintViewManager::OnDidShowPrintDialog(content::RenderFrameHost* rfh) {
diff --git a/chromium/chrome/browser/printing/print_view_manager.h b/chromium/chrome/browser/printing/print_view_manager.h
index 8415c9ccf35..87192a1f6f7 100644
--- a/chromium/chrome/browser/printing/print_view_manager.h
+++ b/chromium/chrome/browser/printing/print_view_manager.h
@@ -5,9 +5,13 @@
#ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
+#include <map>
+
#include "base/macros.h"
#include "chrome/browser/printing/print_view_manager_base.h"
+#include "components/printing/common/print.mojom.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "mojo/public/cpp/bindings/associated_remote.h"
#include "printing/buildflags/buildflags.h"
namespace content {
@@ -33,12 +37,17 @@ class PrintViewManager : public PrintViewManagerBase,
// preview dialog.
bool BasicPrint(content::RenderFrameHost* rfh);
- // Initiate print preview of the current document by first notifying the
- // renderer. Since this happens asynchronous, the print preview dialog
- // creation will not be completed on the return of this function. Returns
- // false if print preview is impossible at the moment.
+ // Initiate print preview of the current document and specify whether a
+ // selection or the entire frame is being printed.
bool PrintPreviewNow(content::RenderFrameHost* rfh, bool has_selection);
+ // Initiate print preview of the current document and provide the renderer
+ // a printing::mojom::PrintRenderer to perform the actual rendering of
+ // the print document.
+ bool PrintPreviewWithPrintRenderer(
+ content::RenderFrameHost* rfh,
+ mojom::PrintRendererAssociatedPtrInfo print_renderer);
+
// Notify PrintViewManager that print preview is starting in the renderer for
// a particular WebNode.
void PrintPreviewForWebNode(content::RenderFrameHost* rfh);
@@ -73,6 +82,20 @@ class PrintViewManager : public PrintViewManagerBase,
struct FrameDispatchHelper;
+ // Helper method to fetch the PrintRenderFrame associated remote interface
+ // pointer.
+ const mojo::AssociatedRemote<printing::mojom::PrintRenderFrame>&
+ GetPrintRenderFrame(content::RenderFrameHost* rfh);
+
+ // Helper method for PrintPreviewNow() and PrintPreviewWithRenderer().
+ // Initiate print preview of the current document by first notifying the
+ // renderer. Since this happens asynchronously, the print preview dialog
+ // creation will not be completed on the return of this function. Returns
+ // false if print preview is impossible at the moment.
+ bool PrintPreview(content::RenderFrameHost* rfh,
+ mojom::PrintRendererAssociatedPtrInfo print_renderer,
+ bool has_selection);
+
// IPC Message handlers.
void OnDidShowPrintDialog(content::RenderFrameHost* rfh);
void OnSetupScriptedPrintPreview(content::RenderFrameHost* rfh,
@@ -102,6 +125,13 @@ class PrintViewManager : public PrintViewManagerBase,
// flag is true between PrintForSystemDialogNow() and PrintPreviewDone().
bool is_switching_to_system_dialog_ = false;
+ // Stores a PrintRenderFrame associated remote with the RenderFrameHost used
+ // to bind it. The PrintRenderFrame is used to transmit mojo interface method
+ // calls to the associated receiver.
+ std::map<content::RenderFrameHost*,
+ mojo::AssociatedRemote<printing::mojom::PrintRenderFrame>>
+ print_render_frames_;
+
WEB_CONTENTS_USER_DATA_KEY_DECL();
DISALLOW_COPY_AND_ASSIGN(PrintViewManager);
diff --git a/chromium/chrome/browser/printing/print_view_manager_base.cc b/chromium/chrome/browser/printing/print_view_manager_base.cc
index da3383624ff..7d1e56b3b1a 100644
--- a/chromium/chrome/browser/printing/print_view_manager_base.cc
+++ b/chromium/chrome/browser/printing/print_view_manager_base.cc
@@ -682,11 +682,16 @@ bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
return true;
}
+bool PrintViewManagerBase::IsInterstitialOrCrashed() {
+ return web_contents()->ShowingInterstitialPage() ||
+ web_contents()->IsCrashed();
+}
+
bool PrintViewManagerBase::PrintNowInternal(
content::RenderFrameHost* rfh,
std::unique_ptr<IPC::Message> message) {
// Don't print / print preview interstitials or crashed tabs.
- if (web_contents()->ShowingInterstitialPage() || web_contents()->IsCrashed())
+ if (IsInterstitialOrCrashed())
return false;
return rfh->Send(message.release());
}
diff --git a/chromium/chrome/browser/printing/print_view_manager_base.h b/chromium/chrome/browser/printing/print_view_manager_base.h
index 9dc22fa933e..af49d3e2f8a 100644
--- a/chromium/chrome/browser/printing/print_view_manager_base.h
+++ b/chromium/chrome/browser/printing/print_view_manager_base.h
@@ -73,6 +73,10 @@ class PrintViewManagerBase : public content::NotificationObserver,
protected:
explicit PrintViewManagerBase(content::WebContents* web_contents);
+ // Helper method for checking whether the WebContents is showing an
+ // interstitial page or is crashed.
+ bool IsInterstitialOrCrashed();
+
// Helper method for Print*Now().
bool PrintNowInternal(content::RenderFrameHost* rfh,
std::unique_ptr<IPC::Message> message);
diff --git a/chromium/chrome/browser/printing/print_view_manager_basic_unittest.cc b/chromium/chrome/browser/printing/print_view_manager_basic_unittest.cc
index 2d90b8df7bd..ba2a26706b3 100644
--- a/chromium/chrome/browser/printing/print_view_manager_basic_unittest.cc
+++ b/chromium/chrome/browser/printing/print_view_manager_basic_unittest.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/printing/print_view_manager_basic.h"
+#include <utility>
+
#include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/print_test_utils.h"
@@ -54,7 +56,7 @@ TEST_F(PrintViewManagerBasicTest, CancelJobDuringDestruction) {
auto query = queue->CreatePrinterQuery(main_rfh()->GetProcess()->GetID(),
main_rfh()->GetRoutingID());
base::RunLoop runloop;
- query->SetSettings(GetPrintTicket(printing::kLocalPrinter, false),
+ query->SetSettings(GetPrintTicket(printing::kLocalPrinter),
runloop.QuitClosure());
runloop.Run();
auto cookie = query->cookie();
diff --git a/chromium/chrome/browser/printing/print_view_manager_common.cc b/chromium/chrome/browser/printing/print_view_manager_common.cc
index 449b31c33c3..afc5c7d1ec4 100644
--- a/chromium/chrome/browser/printing/print_view_manager_common.cc
+++ b/chromium/chrome/browser/printing/print_view_manager_common.cc
@@ -50,6 +50,7 @@ content::RenderFrameHost* GetRenderFrameHostToUse(
} // namespace
void StartPrint(content::WebContents* contents,
+ mojom::PrintRendererAssociatedPtrInfo print_renderer,
bool print_preview_disabled,
bool has_selection) {
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
@@ -71,7 +72,12 @@ void StartPrint(content::WebContents* contents,
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
if (!print_preview_disabled) {
- print_view_manager->PrintPreviewNow(rfh_to_use, has_selection);
+ if (print_renderer) {
+ print_view_manager->PrintPreviewWithPrintRenderer(
+ rfh_to_use, std::move(print_renderer));
+ } else {
+ print_view_manager->PrintPreviewNow(rfh_to_use, has_selection);
+ }
return;
}
#endif // ENABLE_PRINT_PREVIEW
diff --git a/chromium/chrome/browser/printing/print_view_manager_common.h b/chromium/chrome/browser/printing/print_view_manager_common.h
index b3c34616c73..edaefc04fd7 100644
--- a/chromium/chrome/browser/printing/print_view_manager_common.h
+++ b/chromium/chrome/browser/printing/print_view_manager_common.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_COMMON_H_
#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_COMMON_H_
+#include "components/printing/common/print.mojom.h"
#include "printing/buildflags/buildflags.h"
namespace content {
@@ -15,7 +16,10 @@ class WebContents;
namespace printing {
// Start printing using the appropriate PrintViewManagerBase subclass.
+// Optionally provide a printing::mojom::PrintRenderer to render print
+// documents.
void StartPrint(content::WebContents* web_contents,
+ mojom::PrintRendererAssociatedPtrInfo print_renderer,
bool print_preview_disabled,
bool has_selection);
diff --git a/chromium/chrome/browser/printing/print_view_manager_unittest.cc b/chromium/chrome/browser/printing/print_view_manager_unittest.cc
index 18f1bea8802..598561d150c 100644
--- a/chromium/chrome/browser/printing/print_view_manager_unittest.cc
+++ b/chromium/chrome/browser/printing/print_view_manager_unittest.cc
@@ -18,8 +18,10 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/browser_with_test_window_test.h"
-#include "components/printing/common/print_messages.h"
+#include "components/printing/common/print.mojom.h"
#include "content/public/test/test_renderer_host.h"
+#include "mojo/public/cpp/bindings/associated_remote.h"
+#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
namespace printing {
@@ -40,9 +42,14 @@ class TestPrintViewManager : public PrintViewManagerBase {
// Mostly copied from PrintViewManager::PrintPreviewNow(). We can't override
// PrintViewManager since it is a user data class.
bool PrintPreviewNow(content::RenderFrameHost* rfh, bool has_selection) {
- auto msg = std::make_unique<PrintMsg_InitiatePrintPreview>(
- rfh->GetRoutingID(), has_selection);
- return PrintNowInternal(rfh, std::move(msg));
+ // Don't print / print preview interstitials or crashed tabs.
+ if (IsInterstitialOrCrashed())
+ return false;
+
+ mojo::AssociatedRemote<mojom::PrintRenderFrame> print_render_frame;
+ rfh->GetRemoteAssociatedInterfaces()->GetInterface(&print_render_frame);
+ print_render_frame->InitiatePrintPreview(nullptr, has_selection);
+ return true;
}
// Getters for validating arguments to StartPdf...Conversion functions
@@ -138,7 +145,7 @@ TEST_F(PrintViewManagerTest, PostScriptHasCorrectOffsets) {
print_view_manager->PrintPreviewNow(web_contents->GetMainFrame(), false);
- base::Value print_ticket = GetPrintTicket(printing::kLocalPrinter, false);
+ base::Value print_ticket = GetPrintTicket(printing::kLocalPrinter);
const char kTestData[] = "abc";
auto print_data = base::MakeRefCounted<base::RefCountedStaticMemory>(
kTestData, sizeof(kTestData));
diff --git a/chromium/chrome/browser/resource_coordinator/BUILD.gn b/chromium/chrome/browser/resource_coordinator/BUILD.gn
index bf5e45c8a1e..c308b7901ac 100644
--- a/chromium/chrome/browser/resource_coordinator/BUILD.gn
+++ b/chromium/chrome/browser/resource_coordinator/BUILD.gn
@@ -18,12 +18,6 @@ mojom("mojo_bindings") {
]
}
-proto_library("intervention_policy_database_proto") {
- sources = [
- "intervention_policy_database.proto",
- ]
-}
-
source_set("tab_manager_features") {
public = [
"tab_manager_features.h",
diff --git a/chromium/chrome/browser/resources/BUILD.gn b/chromium/chrome/browser/resources/BUILD.gn
index d1b6a8b7b45..8346f4fa503 100644
--- a/chromium/chrome/browser/resources/BUILD.gn
+++ b/chromium/chrome/browser/resources/BUILD.gn
@@ -3,7 +3,9 @@
# found in the LICENSE file.
import("//chrome/common/features.gni")
+import("//chrome/test/base/js2gtest.gni")
import("//tools/grit/grit_rule.gni")
+import("//tools/grit/repack.gni")
assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome")
@@ -19,11 +21,13 @@ if (closure_compile) {
"bluetooth_internals:closure_compile",
"bookmarks:closure_compile",
"discards:closure_compile",
+ "download_internals:closure_compile",
"downloads:closure_compile",
"history:closure_compile",
"local_ntp:closure_compile",
"local_state:closure_compile",
"management:closure_compile",
+ "media_router:closure_compile",
"ntp4:closure_compile",
"omnibox:closure_compile",
"pdf:closure_compile",
@@ -36,6 +40,9 @@ if (closure_compile) {
"welcome:closure_compile",
]
}
+ if (is_win || is_android || is_linux) {
+ deps += [ "sandbox_internals:closure_compile" ]
+ }
if (is_chromeos) {
deps += [ "chromeos:closure_compile" ]
}
@@ -103,6 +110,18 @@ grit("webapks_ui_resources") {
if (!is_android) {
grit("component_extension_resources") {
source = "component_extension_resources.grd"
+
+ # The .grd contains references to generated files.
+ source_is_generated = true
+ grit_flags = [
+ "-E",
+ "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
+ ]
+
+ deps = [
+ "//chrome/browser/resources/pdf/elements:polymer3_elements",
+ ]
+
defines = chrome_grit_defines
if (enable_hangout_services_extension) {
defines += [ "enable_hangout_services_extension" ]
@@ -224,6 +243,17 @@ if (!is_android && !is_chromeos) {
grit("welcome_resources") {
source = "welcome/welcome_resources.grd"
+ # The .grd contains references to generated files.
+ source_is_generated = true
+
+ deps = [
+ "//chrome/browser/resources/welcome:polymer3_elements",
+ ]
+ grit_flags = [
+ "-E",
+ "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
+ ]
+
defines = chrome_grit_defines
outputs = [
"grit/welcome_resources.h",
@@ -327,3 +357,52 @@ if (enable_webui_tab_strip) {
]
}
}
+
+repack("dev_ui_paks") {
+ output = "$root_gen_dir/chrome/dev_ui_page_resources.pak"
+
+ sources = [
+ "$root_gen_dir/chrome/bluetooth_internals_resources.pak",
+ "$root_gen_dir/chrome/omnibox_resources.pak",
+ "$root_gen_dir/chrome/usb_internals_resources.pak",
+ "$root_gen_dir/components/sync_driver_resources.pak",
+ ]
+ deps = [
+ "//chrome/browser/resources/bluetooth_internals:resources",
+ "//chrome/browser/resources/omnibox:resources",
+ "//chrome/browser/resources/usb_internals:resources",
+ "//components/sync/driver:resources",
+ ]
+}
+
+# TODO(https://crbug.com/930109): Figure out why this test fails on MAC ASAN.
+if (!is_asan || !is_mac) {
+ js2gtest("resources_unitjs_tests") {
+ test_type = "webui"
+ sources = [
+ "gaia_auth_host/password_change_authenticator_test.unitjs",
+ ]
+
+ # This has to be a gen_include, so it doesn't collide with other js2gtests
+ gen_include_files = [ "//ui/webui/resources/js/cr.js" ]
+
+ # But these have to be extra_js_files, since it uses a native object
+ # EventTarget, which doesn't work at compile time.
+ extra_js_files = [
+ "//ui/webui/resources/js/cr/event_target.js",
+ "gaia_auth_host/password_change_authenticator.js",
+ ]
+ defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
+ }
+
+ source_set("browser_tests") {
+ testonly = true
+ deps = [
+ ":resources_unitjs_tests",
+ ]
+ }
+} else {
+ source_set("browser_tests") {
+ testonly = true
+ }
+}
diff --git a/chromium/chrome/browser/resources/accessibility/accessibility.html b/chromium/chrome/browser/resources/accessibility/accessibility.html
index 478c0c27385..1d9b645429c 100644
--- a/chromium/chrome/browser/resources/accessibility/accessibility.html
+++ b/chromium/chrome/browser/resources/accessibility/accessibility.html
@@ -17,11 +17,20 @@ found in the LICENSE file.
</head>
<body>
<h1>Accessibility Internals</h1>
+ <p>
+ Use this page to inspect the internal representation of accessibility in
+ Chrome. You can see and modify the various accessibility modes Chrome has.
+ You can also view the accessibility tree for a specific page, or for the
+ Chrome app natively.
+ </p>
<div class="columns">
<div class="column">
- <h2>Global accessibility mode:</h2>
-
+ <h2>Accessibility modes:</h2>
+ <p>
+ Check/uncheck accessibility modes to see how they change a page's
+ accessibility.
+ </p>
<div class="checkbox-row">
<label>
<span class="checkbox-wrapper">
@@ -103,8 +112,25 @@ found in the LICENSE file.
Automatically labels images.
</div>
- <h2>Options:</h2>
+ <h2>Command line options:</h2>
+ <p>
+ Accessibility features in Chrome are off by default and enabled
+ automatically on-demand. Changes to these modes only take effect
+ until the next time Chrome is restarted.
+ </p>
+ <p>
+ To force accessibility to be enabled at launch, run Chrome with this
+ flag:
+ <pre>--force-renderer-accessibility</pre>
+ </p>
+ <p>
+ To disable accessibility, run Chrome with this flag:
+ <pre>--disable-renderer-accessibility</pre>
+ </p>
+ </div>
+ <div class="column">
+ <h2>Accessibility tree viewing options:</h2>
<div class="checkbox-row">
<span class="checkbox-wrapper">
<input type="checkbox" id="internal"
@@ -118,37 +144,47 @@ found in the LICENSE file.
Show internal accessibility tree instead of native
</div>
- </div>
- <div class="column">
- <p>
- Accessibility features in Chrome are off by default and enabled
- automatically on-demand. Changes to this page only take effect
- until the next time Chrome is restarted.
- </p>
+ <h3>Filters:</h3>
<p>
- To force accessibility to be enabled at launch, run Chrome with this
- command-line flag:
- <pre>--force-renderer-accessibility</pre>
- </p>
- <p>
- To disable accessibility, run Chrome with this flag:
- <pre>--disable-renderer-accessibility</pre>
+ Use filters to match the attributes and attribute values you want
+ included in the output. Filters can contain simple wildcards (*) only,
+ they're not regular expressions. Attributes are separated by spaces.
</p>
- </div>
- </div>
- <!--
- <div id="global" class="row">Global accessibility mode:
- <a is="action-link" role="button" id="toggle_global"
- aria-labelledby="global"></a>
- </div>
+ <div>
+ <label for="filter-allow">
+ Allow:
+ </label>
+ <input id="filter-allow" aria-describedby="allow_secondary">
+ </div>
+ <div id="allow_secondary" class="secondary">
+ Include these attributes. Empty attributes are skipped.
+ </div>
- <div id="internal" class="row">
- Show internal accessibility tree instead of native:
- <a is="action-link" role="button" id="toggle_internal"
- aria-labelledby="internal"></a>
+ <div>
+ <label for="filter-allow-empty">
+ Allow empty:
+ </label>
+ <input id="filter-allow-empty"
+ aria-describedby="allow-empty_secondary">
+ </div>
+ <div id="allow-empty_secondary" class="secondary">
+ Include these attributes, even if they are empty.
+ </div>
+
+ <div>
+ <label for="filter-deny">
+ Deny:
+ </label>
+ <input id="filter-deny" aria-describedby="deny_secondary">
+ </div>
+ <div id="deny_secondary" class="secondary">
+ Exclude these attributes.
+ </div>
+
+ </div>
</div>
--->
+
<h2>Chrome Native UI:</h2>
<div id="browsers" class="list">
Set a delay, in milliseconds, before getting the native accessibility tree:
diff --git a/chromium/chrome/browser/resources/accessibility/accessibility.js b/chromium/chrome/browser/resources/accessibility/accessibility.js
index e5f19928733..7db0aafd5e0 100644
--- a/chromium/chrome/browser/resources/accessibility/accessibility.js
+++ b/chromium/chrome/browser/resources/accessibility/accessibility.js
@@ -57,15 +57,24 @@ cr.define('accessibility', function() {
const tree = $(id + ':tree');
// If the tree is visible, request a new tree with the updated mode.
const shouldRequestTree = !!tree && tree.style.display != 'none';
- chrome.send('toggleAccessibility', [
- String(data.processId), String(data.routeId), mode,
- String(shouldRequestTree)
- ]);
+ chrome.send('toggleAccessibility', [{
+ 'processId': data.processId,
+ 'routeId': data.routeId,
+ 'modeId': mode,
+ 'shouldRequestTree': shouldRequestTree
+ }]);
}
function requestTree(data, element) {
+ const allow = $('filter-allow').value;
+ const allowEmpty = $('filter-allow-empty').value;
+ const deny = $('filter-deny').value;
+ window.localStorage['chrome-accessibility-filter-allow'] = allow;
+ window.localStorage['chrome-accessibility-filter-allow-empty'] = allowEmpty;
+ window.localStorage['chrome-accessibility-filter-deny'] = deny;
+
// The calling |element| is a button with an id of the format
- // <treeId>:<requestType>, where requestType is one of 'showTree',
+ // <treeId>:<requestType>, where requestType is one of 'showOrRefreshTree',
// 'copyTree'. Send the request type to C++ so is calls the corresponding
// function with the result.
const requestType = element.id.split(':')[1];
@@ -73,12 +82,21 @@ cr.define('accessibility', function() {
const delay = $('native_ui_delay').value;
setTimeout(() => {
chrome.send(
- 'requestNativeUITree', [String(data.sessionId), requestType]);
+ 'requestNativeUITree', [{
+ 'sessionId': data.sessionId,
+ 'requestType': requestType,
+ 'filters':
+ {'allow': allow, 'allowEmpty': allowEmpty, 'deny': deny}
+ }]);
}, delay);
} else {
chrome.send(
- 'requestWebContentsTree',
- [String(data.processId), String(data.routeId), requestType]);
+ 'requestWebContentsTree', [{
+ 'processId': data.processId,
+ 'routeId': data.routeId,
+ 'requestType': requestType,
+ 'filters': {'allow': allow, 'allowEmpty': allowEmpty, 'deny': deny}
+ }]);
}
}
@@ -91,7 +109,7 @@ cr.define('accessibility', function() {
bindCheckbox('text', data['text']);
bindCheckbox('screenreader', data['screenreader']);
bindCheckbox('html', data['html']);
- bindCheckbox('label_images', data['label_images']);
+ bindCheckbox('label_images', data['labelImages']);
bindCheckbox('internal', data['internal']);
$('pages').textContent = '';
@@ -105,6 +123,15 @@ cr.define('accessibility', function() {
for (let i = 0; i < browsers.length; i++) {
addToBrowsersList(browsers[i]);
}
+
+ // Cache filters so they're easily accessible on page refresh.
+ const allow = window.localStorage['chrome-accessibility-filter-allow'];
+ const allowEmpty =
+ window.localStorage['chrome-accessibility-filter-allow-empty'];
+ const deny = window.localStorage['chrome-accessibility-filter-deny'];
+ $('filter-allow').value = allow ? allow : '*';
+ $('filter-allow-empty').value = allowEmpty ? allowEmpty : '';
+ $('filter-deny').value = deny ? deny : '';
}
function bindCheckbox(name, value) {
@@ -116,7 +143,8 @@ cr.define('accessibility', function() {
$(name).labels[0].classList.add('disabled');
}
$(name).addEventListener('change', function() {
- chrome.send('setGlobalFlag', [name, $(name).checked]);
+ chrome.send(
+ 'setGlobalFlag', [{'flagName': name, 'enabled': $(name).checked}]);
document.location.reload();
});
}
@@ -157,7 +185,7 @@ cr.define('accessibility', function() {
if (data.type == 'page') {
const siteInfo = document.createElement('div');
- const properties = ['favicon_url', 'name', 'url'];
+ const properties = ['faviconUrl', 'name', 'url'];
for (let j = 0; j < properties.length; j++) {
siteInfo.appendChild(formatValue(data, properties[j]));
}
@@ -169,7 +197,7 @@ cr.define('accessibility', function() {
row.appendChild(createModeElement(AXMode.kScreenReader, data, 'web'));
row.appendChild(createModeElement(AXMode.kHTML, data, 'web'));
row.appendChild(
- createModeElement(AXMode.kLabelImages, data, 'label_images'));
+ createModeElement(AXMode.kLabelImages, data, 'labelImages'));
} else {
const siteInfo = document.createElement('span');
siteInfo.appendChild(formatValue(data, 'name'));
@@ -200,7 +228,7 @@ cr.define('accessibility', function() {
function formatValue(data, property) {
const value = data[property];
- if (property == 'favicon_url') {
+ if (property == 'faviconUrl') {
const faviconElement = document.createElement('img');
if (value) {
faviconElement.src = value;
@@ -245,7 +273,7 @@ cr.define('accessibility', function() {
}
function createModeElement(mode, data, globalStateName) {
- const currentMode = data['a11y_mode'];
+ const currentMode = data['a11yMode'];
const link = document.createElement('a', 'action-link');
link.setAttribute('role', 'button');
@@ -282,7 +310,7 @@ cr.define('accessibility', function() {
} else {
show.textContent = 'Show accessibility tree';
}
- show.id = id + ':showTree';
+ show.id = id + ':showOrRefreshTree';
show.setAttribute('aria-expanded', String(opt_refresh));
show.addEventListener('click', requestTree.bind(this, data, show));
return show;
@@ -293,7 +321,7 @@ cr.define('accessibility', function() {
hide.textContent = 'Hide accessibility tree';
hide.id = id + ':hideTree';
hide.addEventListener('click', function() {
- const show = $(id + ':showTree');
+ const show = $(id + ':showOrRefreshTree');
show.textContent = 'Show accessibility tree';
show.setAttribute('aria-expanded', 'false');
show.focus();
@@ -335,7 +363,7 @@ cr.define('accessibility', function() {
}
// Called from C++
- function showTree(data) {
+ function showOrRefreshTree(data) {
const id = getIdFromData(data);
const row = $(id);
if (!row) {
@@ -344,7 +372,7 @@ cr.define('accessibility', function() {
row.textContent = '';
formatRow(row, data);
- $(id + ':hideTree').focus();
+ $(id + ':showOrRefreshTree').focus();
}
// Called from C++
@@ -371,11 +399,11 @@ cr.define('accessibility', function() {
console.error('Unable to copy accessibility tree.', data.error);
}
-
const tree = $(id + ':tree');
// If the tree is currently shown, update it since it may have changed.
if (tree && tree.style.display != 'none') {
- showTree(data);
+ showOrRefreshTree(data);
+ $(id + ':copyTree').focus();
}
}
@@ -401,7 +429,11 @@ cr.define('accessibility', function() {
}
// These are the functions we export so they can be called from C++.
- return {copyTree: copyTree, initialize: initialize, showTree: showTree};
+ return {
+ copyTree: copyTree,
+ initialize: initialize,
+ showOrRefreshTree: showOrRefreshTree
+ };
});
document.addEventListener('DOMContentLoaded', accessibility.initialize);
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/BUILD.gn b/chromium/chrome/browser/resources/bluetooth_internals/BUILD.gn
index 7ab5c808a39..d53ec0f8316 100644
--- a/chromium/chrome/browser/resources/bluetooth_internals/BUILD.gn
+++ b/chromium/chrome/browser/resources/bluetooth_internals/BUILD.gn
@@ -17,6 +17,7 @@ js_library("bluetooth_internals") {
"adapter_page.js",
"bluetooth_internals.js",
"characteristic_list.js",
+ "debug_log_page.js",
"descriptor_list.js",
"device_broker.js",
"device_collection.js",
@@ -32,14 +33,33 @@ js_library("bluetooth_internals") {
]
deps = [
+ ":page",
+ ":page_manager",
"//chrome/browser/ui/webui/bluetooth_internals:mojo_bindings_js_library_for_compile",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:util",
"//ui/webui/resources/js/cr/ui:array_data_model",
"//ui/webui/resources/js/cr/ui:list",
"//ui/webui/resources/js/cr/ui:list_item",
- "//ui/webui/resources/js/cr/ui/page_manager:page",
- "//ui/webui/resources/js/cr/ui/page_manager:page_manager",
+ ]
+}
+
+js_library("page") {
+ deps = [
+ "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:util",
+ "//ui/webui/resources/js/cr:event_target",
+ "//ui/webui/resources/js/cr/ui:bubble",
+ "//ui/webui/resources/js/cr/ui:focus_outline_manager",
+ "//ui/webui/resources/js/cr/ui:node_utils",
+ "//ui/webui/resources/js/cr/ui:overlay",
+ ]
+}
+
+js_library("page_manager") {
+ deps = [
+ ":page",
+ "//ui/webui/resources/js:cr",
]
}
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/adapter_broker.js b/chromium/chrome/browser/resources/bluetooth_internals/adapter_broker.js
index 0da84a773fe..1ca5ea685c5 100644
--- a/chromium/chrome/browser/resources/bluetooth_internals/adapter_broker.js
+++ b/chromium/chrome/browser/resources/bluetooth_internals/adapter_broker.js
@@ -154,15 +154,18 @@ cr.define('adapter_broker', function() {
/**
* Initializes an AdapterBroker if one doesn't exist.
+ * @param {!mojom.BluetoothInternalsHandlerRemote=}
+ * opt_bluetoothInternalsHandler
* @return {!Promise<!adapter_broker.AdapterBroker>} resolves with
* AdapterBroker, rejects if Bluetooth is not supported.
*/
- function getAdapterBroker() {
+ function getAdapterBroker(opt_bluetoothInternalsHandler) {
if (adapterBroker) {
return Promise.resolve(adapterBroker);
}
- const bluetoothInternalsHandler =
+ const bluetoothInternalsHandler = opt_bluetoothInternalsHandler ?
+ opt_bluetoothInternalsHandler :
mojom.BluetoothInternalsHandler.getRemote();
// Get an Adapter service.
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.html b/chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.html
index fdd34a71f54..1e4063113f5 100644
--- a/chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.html
+++ b/chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.html
@@ -20,8 +20,10 @@
<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/cr/ui/overlay.html">
- <link rel="import" href="chrome://resources/html/cr/ui/page_manager/page_manager.html">
- <link rel="import" href="chrome://resources/html/cr/ui/page_manager/page.html">
+
+ <link rel="import" href="page_manager.html">
+ <link rel="import" href="page.html">
+
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.html">
@@ -39,6 +41,7 @@
<script src="service_list.js"></script>
<script src="descriptor_list.js"></script>
<script src="adapter_page.js"></script>
+ <script src="debug_log_page.js"></script>
<script src="device_collection.js"></script>
<script src="device_details_page.js"></script>
<script src="device_table.js"></script>
@@ -63,6 +66,9 @@
<button id="scan-btn">Start Scan</button>
</div>
</section>
+ <section id="debug" hidden>
+ <div class="header-extras" id="debug-container"></div>
+ </section>
</div>
<div id="snackbar-container"></div>
<aside id="sidebar">
@@ -79,6 +85,9 @@
<li data-page-name="devices">
<button class="custom-appearance">Devices</button>
</li>
+ <li data-page-name="debug" data-page-name="debug">
+ <button class="custom-appearance">Debug Logs</button>
+ </li>
</ul>
</nav>
</section>
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.js b/chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.js
index de4b6d0a4d9..e146a8e1746 100644
--- a/chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.js
+++ b/chromium/chrome/browser/resources/bluetooth_internals/bluetooth_internals.js
@@ -19,6 +19,7 @@ cr.define('bluetooth_internals', function() {
const AdapterPage = adapter_page.AdapterPage;
const DeviceDetailsPage = device_details_page.DeviceDetailsPage;
const DevicesPage = devices_page.DevicesPage;
+ const DebugLogPage = debug_log_page.DebugLogPage;
const PageManager = cr.ui.pageManager.PageManager;
const Snackbar = snackbar.Snackbar;
const SnackbarType = snackbar.SnackbarType;
@@ -29,6 +30,8 @@ cr.define('bluetooth_internals', function() {
let adapterPage = null;
/** @type {devices_page.DevicesPage} */
let devicesPage = null;
+ /** @type {debug_log_page.DebugLogPage} */
+ let debugLogPage = null;
/** @type {bluetooth.mojom.DiscoverySessionRemote} */
let discoverySession = null;
@@ -36,6 +39,9 @@ cr.define('bluetooth_internals', function() {
/** @type {boolean} */
let userRequestedScanStop = false;
+ /** @type {!mojom.BluetoothInternalsHandlerRemote} */
+ const bluetoothInternalsHandler = mojom.BluetoothInternalsHandler.getRemote();
+
/**
* Observer for page changes. Used to update page title header.
* @constructor
@@ -258,6 +264,8 @@ cr.define('bluetooth_internals', function() {
PageManager.register(devicesPage);
adapterPage = new AdapterPage();
PageManager.register(adapterPage);
+ debugLogPage = new DebugLogPage(bluetoothInternalsHandler);
+ PageManager.register(debugLogPage);
// Set up hash-based navigation.
window.addEventListener('hashchange', function() {
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/debug_log_page.js b/chromium/chrome/browser/resources/bluetooth_internals/debug_log_page.js
new file mode 100644
index 00000000000..5c13a39a26e
--- /dev/null
+++ b/chromium/chrome/browser/resources/bluetooth_internals/debug_log_page.js
@@ -0,0 +1,68 @@
+// 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 DebugLogPage, served from chrome://bluetooth-internals/.
+ */
+cr.define('debug_log_page', function() {
+ /** @const {string} */
+ const LOGS_NOT_SUPPORTED_STRING = 'Debug logs not supported';
+
+ /**
+ * Page that allows user to enable/disable debug logs.
+ */
+ class DebugLogPage extends cr.ui.pageManager.Page {
+ /**
+ * @param {!mojom.BluetoothInternalsHandlerRemote} bluetoothInternalsHandler
+ */
+ constructor(bluetoothInternalsHandler) {
+ super('debug', 'Debug Logs', 'debug');
+
+ /**
+ * @private {?mojom.DebugLogsChangeHandlerRemote}
+ */
+ this.debugLogsChangeHandler_ = null;
+
+ /** @private {?HTMLInputElement} */
+ this.inputElement_ = null;
+
+ /** @private {!HTMLDivElement} */
+ this.debugContainer_ =
+ /** @type {!HTMLDivElement} */ ($('debug-container'));
+
+ bluetoothInternalsHandler.getDebugLogsChangeHandler().then((params) => {
+ if (params.handler) {
+ this.setUpInput(params.handler, params.initialToggleValue);
+ } else {
+ this.debugContainer_.textContent = LOGS_NOT_SUPPORTED_STRING;
+ }
+ });
+ }
+
+ /**
+ * @param {!mojom.DebugLogsChangeHandlerRemote} handler
+ * @param {boolean} initialInputValue
+ */
+ setUpInput(handler, initialInputValue) {
+ this.debugLogsChangeHandler_ = handler;
+
+ this.inputElement_ =
+ /** @type {!HTMLInputElement} */ (document.createElement('input'));
+ this.inputElement_.setAttribute('type', 'checkbox');
+ this.inputElement_.checked = initialInputValue;
+ this.inputElement_.addEventListener(
+ 'change', this.onToggleChange.bind(this));
+ this.debugContainer_.appendChild(this.inputElement_);
+ }
+
+ onToggleChange() {
+ this.debugLogsChangeHandler_.changeDebugLogsState(
+ this.inputElement_.checked);
+ }
+ }
+
+ return {
+ DebugLogPage: DebugLogPage,
+ };
+});
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/page.html b/chromium/chrome/browser/resources/bluetooth_internals/page.html
new file mode 100644
index 00000000000..f6e2de85f42
--- /dev/null
+++ b/chromium/chrome/browser/resources/bluetooth_internals/page.html
@@ -0,0 +1 @@
+<script src="page.js"></script>
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/page.js b/chromium/chrome/browser/resources/bluetooth_internals/page.js
new file mode 100644
index 00000000000..6c40a9ea35e
--- /dev/null
+++ b/chromium/chrome/browser/resources/bluetooth_internals/page.js
@@ -0,0 +1,314 @@
+// 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.
+
+// <include src="../node_utils.js">
+
+cr.define('cr.ui.pageManager', function() {
+ const PageManager = cr.ui.pageManager.PageManager;
+
+ /**
+ * Base class for pages that can be shown and hidden by PageManager. Each Page
+ * is like a node in a forest, corresponding to a particular div. At any
+ * point, one root Page is visible, and any visible Page can show a child Page
+ * as an overlay. The host of the root Page(s) should provide a container div
+ * for each nested level to enforce the stack order of overlays.
+ */
+ class Page extends cr.EventTarget {
+ /**
+ * @param {string} name Page name.
+ * @param {string} title Page title, used for history.
+ * @param {string} pageDivName ID of the div corresponding to the page.
+ */
+ constructor(name, title, pageDivName) {
+ super();
+
+ this.name = name;
+ this.title = title;
+ this.pageDivName = pageDivName;
+ this.pageDiv = getRequiredElement(this.pageDivName);
+ // |pageDiv.page| is set to the page object (this) when the page is
+ // visible to track which page is being shown when multiple pages can
+ // share the same underlying div.
+ this.pageDiv.page = null;
+ this.tab = null;
+ this.lastFocusedElement = null;
+ this.hash = '';
+
+ /**
+ * The parent page of this page; or null for root pages.
+ * @type {cr.ui.pageManager.Page}
+ */
+ this.parentPage = null;
+
+ /**
+ * The section on the parent page that is associated with this page.
+ * Can be null.
+ * @type {Element}
+ */
+ this.associatedSection = null;
+
+ /**
+ * An array of controls that are associated with this page. The first
+ * control should be located on a root page.
+ * @type {Array<Element>}
+ */
+ this.associatedControls = null;
+
+ /**
+ * If true; this page should always be considered the top-most page when
+ * visible.
+ * @private {boolean}
+ */
+ this.alwaysOnTop_ = false;
+
+ /**
+ * Set this to handle cancelling an overlay (and skip some typical steps).
+ * @see {cr.ui.PageManager.prototype.cancelOverlay}
+ * @type {?Function}
+ */
+ this.handleCancel = null;
+
+ /** @type {boolean} */
+ this.isOverlay = false;
+ }
+
+ /**
+ * Initializes page content.
+ */
+ initializePage() {}
+
+ /**
+ * Called by the PageManager when this.hash changes while the page is
+ * already visible. This is analogous to the hashchange DOM event.
+ */
+ didChangeHash() {}
+
+ /**
+ * Sets focus on the first focusable element. Override for a custom focus
+ * strategy.
+ */
+ focus() {
+ cr.ui.setInitialFocus(this.pageDiv);
+ }
+
+ /**
+ * Reverse any buttons strips in this page (only applies to overlays).
+ * @see cr.ui.reverseButtonStrips for an explanation of why this is
+ * necessary and when it's done.
+ */
+ reverseButtonStrip() {
+ assert(this.isOverlay);
+ cr.ui.reverseButtonStrips(this.pageDiv);
+ }
+
+ /**
+ * Whether it should be possible to show the page.
+ * @return {boolean} True if the page should be shown.
+ */
+ canShowPage() {
+ return true;
+ }
+
+ /**
+ * Updates the hash of the current page. If the page is topmost, the history
+ * state is updated.
+ * @param {string} hash The new hash value. Like location.hash, this
+ * should include the leading '#' if not empty.
+ */
+ setHash(hash) {
+ if (this.hash == hash) {
+ return;
+ }
+ this.hash = hash;
+ PageManager.onPageHashChanged(this);
+ }
+
+ /**
+ * Called after the page has been shown.
+ */
+ didShowPage() {}
+
+ /**
+ * Called before the page will be hidden, e.g., when a different root page
+ * will be shown.
+ */
+ willHidePage() {}
+
+ /**
+ * Called after the overlay has been closed.
+ */
+ didClosePage() {}
+
+ /**
+ * Gets the container div for this page if it is an overlay.
+ * @type {HTMLDivElement}
+ */
+ get container() {
+ assert(this.isOverlay);
+ return this.pageDiv.parentNode;
+ }
+
+ /**
+ * Gets page visibility state.
+ * @type {boolean}
+ */
+ get visible() {
+ // If this is an overlay dialog it is no longer considered visible while
+ // the overlay is fading out. See http://crbug.com/118629.
+ if (this.isOverlay && this.container.classList.contains('transparent')) {
+ return false;
+ }
+ if (this.pageDiv.hidden) {
+ return false;
+ }
+ return this.pageDiv.page == this;
+ }
+
+ /**
+ * Sets page visibility.
+ * @type {boolean}
+ */
+ set visible(visible) {
+ if ((this.visible && visible) || (!this.visible && !visible)) {
+ return;
+ }
+
+ // If using an overlay, the visibility of the dialog is toggled at the
+ // same time as the overlay to show the dialog's out transition. This
+ // is handled in setOverlayVisible.
+ if (this.isOverlay) {
+ this.setOverlayVisible_(visible);
+ } else {
+ this.pageDiv.page = this;
+ this.pageDiv.hidden = !visible;
+ PageManager.onPageVisibilityChanged(this);
+ }
+
+ cr.dispatchPropertyChange(this, 'visible', visible, !visible);
+ }
+
+ /**
+ * Whether the page is considered 'sticky', such that it will remain a root
+ * page even if sub-pages change.
+ * @type {boolean} True if this page is sticky.
+ */
+ get sticky() {
+ return false;
+ }
+
+ /**
+ * @type {boolean} True if this page should always be considered the
+ * top-most page when visible.
+ */
+ get alwaysOnTop() {
+ return this.alwaysOnTop_;
+ }
+
+ /**
+ * @type {boolean} True if this page should always be considered the
+ * top-most page when visible. Only overlays can be always on top.
+ */
+ set alwaysOnTop(value) {
+ assert(this.isOverlay);
+ this.alwaysOnTop_ = value;
+ }
+
+ /**
+ * Shows or hides an overlay (including any visible dialog).
+ * @param {boolean} visible Whether the overlay should be visible or not.
+ * @private
+ */
+ setOverlayVisible_(visible) {
+ assert(this.isOverlay);
+ const pageDiv = this.pageDiv;
+ const container = this.container;
+
+ if (container.hidden != visible) {
+ if (visible) {
+ // If the container is set hidden and then immediately set visible
+ // again, the fadeCompleted_ callback would cause it to be erroneously
+ // hidden again. Removing the transparent tag avoids that.
+ container.classList.remove('transparent');
+
+ // Hide all dialogs in this container since a different one may have
+ // been previously visible before fading out.
+ const pages = container.querySelectorAll('.page');
+ for (let i = 0; i < pages.length; i++) {
+ pages[i].hidden = true;
+ }
+ // Show the new dialog.
+ pageDiv.hidden = false;
+ pageDiv.page = this;
+ }
+ return;
+ }
+
+ const self = this;
+ const loading = PageManager.isLoading();
+ if (!loading) {
+ // TODO(flackr): Use an event delegate to avoid having to subscribe and
+ // unsubscribe for transitionend events.
+ container.addEventListener('transitionend', function f(e) {
+ const propName = e.propertyName;
+ if (e.target != e.currentTarget ||
+ (propName && propName != 'opacity')) {
+ return;
+ }
+ container.removeEventListener('transitionend', f);
+ self.fadeCompleted_();
+ });
+ // transition is 200ms. Let's wait for 400ms.
+ ensureTransitionEndEvent(container, 400);
+ }
+
+ if (visible) {
+ container.hidden = false;
+ pageDiv.hidden = false;
+ pageDiv.page = this;
+ // NOTE: This is a hacky way to force the container to layout which
+ // will allow us to trigger the transition.
+ /** @suppress {uselessCode} */
+ container.scrollTop;
+
+ this.pageDiv.removeAttribute('aria-hidden');
+ if (this.parentPage) {
+ this.parentPage.pageDiv.parentElement.setAttribute(
+ 'aria-hidden', true);
+ }
+ container.classList.remove('transparent');
+ PageManager.onPageVisibilityChanged(this);
+ } else {
+ // Kick change events for text fields.
+ if (pageDiv.contains(document.activeElement)) {
+ document.activeElement.blur();
+ }
+ container.classList.add('transparent');
+ }
+
+ if (loading) {
+ this.fadeCompleted_();
+ }
+ }
+
+ /**
+ * Called when a container opacity transition finishes.
+ * @private
+ */
+ fadeCompleted_() {
+ if (this.container.classList.contains('transparent')) {
+ this.pageDiv.hidden = true;
+ this.container.hidden = true;
+
+ if (this.parentPage) {
+ this.parentPage.pageDiv.parentElement.removeAttribute('aria-hidden');
+ }
+
+ PageManager.onPageVisibilityChanged(this);
+ }
+ }
+ }
+
+ // Export
+ return {Page: Page};
+});
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/page_manager.html b/chromium/chrome/browser/resources/bluetooth_internals/page_manager.html
new file mode 100644
index 00000000000..5ce86ea9086
--- /dev/null
+++ b/chromium/chrome/browser/resources/bluetooth_internals/page_manager.html
@@ -0,0 +1 @@
+<script src="page_manager.js"></script>
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/page_manager.js b/chromium/chrome/browser/resources/bluetooth_internals/page_manager.js
new file mode 100644
index 00000000000..bca2b6dbb76
--- /dev/null
+++ b/chromium/chrome/browser/resources/bluetooth_internals/page_manager.js
@@ -0,0 +1,800 @@
+// 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.
+
+cr.define('cr.ui.pageManager', function() {
+ /**
+ * PageManager contains a list of root Page and overlay Page objects and
+ * handles "navigation" by showing and hiding these pages and overlays. On
+ * initial load, PageManager can use the path to open the correct hierarchy
+ * of pages and overlay(s). Handlers for user events, like pressing buttons,
+ * can call into PageManager to open a particular overlay or cancel an
+ * existing overlay.
+ */
+ const PageManager = {
+ /**
+ * True if page is served from a dialog.
+ * @type {boolean}
+ */
+ isDialog: false,
+
+ /**
+ * Offset of page container in pixels. Uber pages that use the side menu
+ * can override this with the setter.
+ * @type {number}
+ */
+ horizontalOffset_: 23,
+
+ /**
+ * Root pages. Maps lower-case page names to the respective page object.
+ * @type {!Object<!cr.ui.pageManager.Page>}
+ */
+ registeredPages: {},
+
+ /**
+ * Pages which are meant to behave like modal dialogs. Maps lower-case
+ * overlay names to the respective overlay object.
+ * @type {!Object<!cr.ui.pageManager.Page>}
+ * @private
+ */
+ registeredOverlayPages: {},
+
+ /**
+ * Observers will be notified when opening and closing overlays.
+ * @type {!Array<!cr.ui.pageManager.PageManager.Observer>}
+ */
+ observers_: [],
+
+ /**
+ * Initializes the complete page.
+ * @param {cr.ui.pageManager.Page} defaultPage The page to be shown when no
+ * page is specified in the path.
+ */
+ initialize: function(defaultPage) {
+ this.defaultPage_ = defaultPage;
+
+ cr.ui.FocusOutlineManager.forDocument(document);
+ document.addEventListener('scroll', this.handleScroll_.bind(this));
+
+ // Trigger the scroll handler manually to set the initial state.
+ this.handleScroll_();
+
+ // Shake the dialog if the user clicks outside the dialog bounds.
+ const containers = /** @type {!NodeList<!HTMLElement>} */ (
+ document.querySelectorAll('body > .overlay'));
+ for (let i = 0; i < containers.length; i++) {
+ const overlay = containers[i];
+ cr.ui.overlay.setupOverlay(overlay);
+ overlay.addEventListener(
+ 'cancelOverlay', this.cancelOverlay.bind(this));
+ }
+
+ cr.ui.overlay.globalInitialization();
+ },
+
+ /**
+ * Registers new page.
+ * @param {!cr.ui.pageManager.Page} page Page to register.
+ */
+ register: function(page) {
+ this.registeredPages[page.name.toLowerCase()] = page;
+ page.initializePage();
+ },
+
+ /**
+ * Unregisters an existing page.
+ * @param {!cr.ui.pageManager.Page} page Page to unregister.
+ */
+ unregister: function(page) {
+ delete this.registeredPages[page.name.toLowerCase()];
+ },
+
+ /**
+ * Registers a new Overlay page.
+ * @param {!cr.ui.pageManager.Page} overlay Overlay to register.
+ * @param {cr.ui.pageManager.Page} parentPage Associated parent page for
+ * this overlay.
+ * @param {Array} associatedControls Array of control elements associated
+ * with this page.
+ */
+ registerOverlay: function(overlay, parentPage, associatedControls) {
+ this.registeredOverlayPages[overlay.name.toLowerCase()] = overlay;
+ overlay.parentPage = parentPage;
+ if (associatedControls) {
+ overlay.associatedControls = associatedControls;
+ if (associatedControls.length) {
+ overlay.associatedSection =
+ this.findSectionForNode_(associatedControls[0]);
+ }
+
+ // Sanity check.
+ for (let i = 0; i < associatedControls.length; ++i) {
+ assert(associatedControls[i], 'Invalid element passed.');
+ }
+ }
+
+ overlay.tab = undefined;
+ overlay.isOverlay = true;
+
+ overlay.reverseButtonStrip();
+ overlay.initializePage();
+ },
+
+ /**
+ * Shows the default page.
+ * @param {boolean=} opt_updateHistory If we should update the history after
+ * showing the page (defaults to true).
+ */
+ showDefaultPage: function(opt_updateHistory) {
+ assert(
+ this.defaultPage_ instanceof cr.ui.pageManager.Page,
+ 'PageManager must be initialized with a default page.');
+ this.showPageByName(this.defaultPage_.name, opt_updateHistory);
+ },
+
+ /**
+ * Shows a registered page. This handles both root and overlay pages.
+ * @param {string} pageName Page name.
+ * @param {boolean=} opt_updateHistory If we should update the history after
+ * showing the page (defaults to true).
+ * @param {Object=} opt_propertyBag An optional bag of properties including
+ * replaceState (if history state should be replaced instead of pushed).
+ * hash (a hash state to attach to the page).
+ */
+ showPageByName: function(pageName, opt_updateHistory, opt_propertyBag) {
+ opt_updateHistory = opt_updateHistory !== false;
+ opt_propertyBag = opt_propertyBag || {};
+
+ // If a bubble is currently being shown, hide it.
+ this.hideBubble();
+
+ // Find the currently visible root-level page.
+ let rootPage = null;
+ for (const name in this.registeredPages) {
+ const page = this.registeredPages[name];
+ if (page.visible && !page.parentPage) {
+ rootPage = page;
+ break;
+ }
+ }
+
+ // Find the target page.
+ let targetPage = this.registeredPages[pageName.toLowerCase()];
+ if (!targetPage || !targetPage.canShowPage()) {
+ // If it's not a page, try it as an overlay.
+ const hash = opt_propertyBag.hash || '';
+ if (!targetPage && this.showOverlay_(pageName, hash, rootPage)) {
+ if (opt_updateHistory) {
+ this.updateHistoryState_(!!opt_propertyBag.replaceState);
+ }
+ this.updateTitle_();
+ return;
+ }
+ targetPage = this.defaultPage_;
+ }
+
+ pageName = targetPage.name.toLowerCase();
+ const targetPageWasVisible = targetPage.visible;
+
+ // Determine if the root page is 'sticky', meaning that it
+ // shouldn't change when showing an overlay. This can happen for special
+ // pages like Search.
+ const isRootPageLocked =
+ rootPage && rootPage.sticky && targetPage.parentPage;
+
+ // Notify pages if they will be hidden.
+ this.forEachPage_(!isRootPageLocked, function(page) {
+ if (page.name != pageName && !this.isAncestorOfPage(page, targetPage)) {
+ page.willHidePage();
+ }
+ });
+
+ // Update the page's hash.
+ targetPage.hash = opt_propertyBag.hash || '';
+
+ // Update visibilities to show only the hierarchy of the target page.
+ this.forEachPage_(!isRootPageLocked, function(page) {
+ page.visible =
+ page.name == pageName || this.isAncestorOfPage(page, targetPage);
+ });
+
+ // Update the history and current location.
+ if (opt_updateHistory) {
+ this.updateHistoryState_(!!opt_propertyBag.replaceState);
+ }
+
+ // Update focus if any other control was focused on the previous page,
+ // or the previous page is not known.
+ if (document.activeElement != document.body &&
+ (!rootPage || rootPage.pageDiv.contains(document.activeElement))) {
+ targetPage.focus();
+ }
+
+ // Notify pages if they were shown.
+ this.forEachPage_(!isRootPageLocked, function(page) {
+ if (!targetPageWasVisible &&
+ (page.name == pageName ||
+ this.isAncestorOfPage(page, targetPage))) {
+ page.didShowPage();
+ }
+ });
+
+ // If the target page was already visible, notify it that its hash
+ // changed externally.
+ if (targetPageWasVisible) {
+ targetPage.didChangeHash();
+ }
+
+ // Update the document title. Do this after didShowPage was called, in
+ // case a page decides to change its title.
+ this.updateTitle_();
+ },
+
+ /**
+ * Returns the name of the page from the current path.
+ * @return {string} Name of the page specified by the current path.
+ */
+ getPageNameFromPath: function() {
+ const path = location.pathname;
+ if (path.length <= 1) {
+ return this.defaultPage_.name;
+ }
+
+ // Skip starting slash and remove trailing slash (if any).
+ return path.slice(1).replace(/\/$/, '');
+ },
+
+ /**
+ * Gets the level of the page. Root pages (e.g., BrowserOptions) are at
+ * level 0.
+ * @return {number} How far down this page is from the root page.
+ */
+ getNestingLevel: function(page) {
+ let level = 0;
+ let parent = page.parentPage;
+ while (parent) {
+ level++;
+ parent = parent.parentPage;
+ }
+ return level;
+ },
+
+ /**
+ * Checks whether one page is an ancestor of the other page in terms of
+ * subpage nesting.
+ * @param {cr.ui.pageManager.Page} potentialAncestor Potential ancestor.
+ * @param {cr.ui.pageManager.Page} potentialDescendent Potential descendent.
+ * @return {boolean} True if |potentialDescendent| is nested under
+ * |potentialAncestor|.
+ */
+ isAncestorOfPage: function(potentialAncestor, potentialDescendent) {
+ let parent = potentialDescendent.parentPage;
+ while (parent) {
+ if (parent == potentialAncestor) {
+ return true;
+ }
+ parent = parent.parentPage;
+ }
+ return false;
+ },
+
+ /**
+ * Returns true if the page is a direct descendent of a root page, or if
+ * the page is considered always on top. Doesn't consider visibility.
+ * @param {cr.ui.pageManager.Page} page Page to check.
+ * @return {boolean} True if |page| is a top-level overlay.
+ */
+ isTopLevelOverlay: function(page) {
+ return page.isOverlay &&
+ (page.alwaysOnTop || this.getNestingLevel(page) == 1);
+ },
+
+ /**
+ * Called when an page is shown or hidden to update the root page
+ * based on the page's new visibility.
+ * @param {cr.ui.pageManager.Page} page The page being made visible or
+ * invisible.
+ */
+ onPageVisibilityChanged: function(page) {
+ this.updateRootPageFreezeState();
+
+ for (let i = 0; i < this.observers_.length; ++i) {
+ this.observers_[i].onPageVisibilityChanged(page);
+ }
+
+ if (!page.visible && this.isTopLevelOverlay(page)) {
+ this.updateScrollPosition_();
+ }
+ },
+
+ /**
+ * Called when a page's hash changes. If the page is the topmost visible
+ * page, the history state is updated.
+ * @param {cr.ui.pageManager.Page} page The page whose hash has changed.
+ */
+ onPageHashChanged: function(page) {
+ if (page == this.getTopmostVisiblePage()) {
+ this.updateHistoryState_(false);
+ }
+ },
+
+ /**
+ * Returns the topmost visible page, or null if no page is visible.
+ * @return {cr.ui.pageManager.Page} The topmost visible page.
+ */
+ getTopmostVisiblePage: function() {
+ // Check overlays first since they're top-most if visible.
+ return this.getVisibleOverlay_() ||
+ this.getTopmostVisibleNonOverlayPage_();
+ },
+
+ /**
+ * Closes the visible overlay. Updates the history state after closing the
+ * overlay.
+ */
+ closeOverlay: function() {
+ const overlay = this.getVisibleOverlay_();
+ if (!overlay) {
+ return;
+ }
+
+ overlay.visible = false;
+ overlay.didClosePage();
+
+ this.updateHistoryState_(false);
+ this.updateTitle_();
+
+ this.restoreLastFocusedElement_();
+ },
+
+ /**
+ * Closes all overlays and updates the history after each closed overlay.
+ */
+ closeAllOverlays: function() {
+ while (this.isOverlayVisible_()) {
+ this.closeOverlay();
+ }
+ },
+
+ /**
+ * Cancels (closes) the overlay, due to the user pressing <Esc>.
+ */
+ cancelOverlay: function() {
+ // Blur the active element to ensure any changed pref value is saved.
+ document.activeElement.blur();
+ const overlay = this.getVisibleOverlay_();
+ if (!overlay) {
+ return;
+ }
+ // Let the overlay handle the <Esc> if it wants to.
+ if (overlay.handleCancel) {
+ overlay.handleCancel();
+ this.restoreLastFocusedElement_();
+ } else {
+ this.closeOverlay();
+ }
+ },
+
+ /**
+ * Shows an informational bubble displaying |content| and pointing at the
+ * |target| element. If |content| has focusable elements, they join the
+ * current page's tab order as siblings of |domSibling|.
+ * @param {HTMLDivElement} content The content of the bubble.
+ * @param {HTMLElement} target The element at which the bubble points.
+ * @param {HTMLElement} domSibling The element after which the bubble is
+ * added to the DOM.
+ * @param {cr.ui.ArrowLocation} location The arrow location.
+ */
+ showBubble: function(content, target, domSibling, location) {
+ this.hideBubble();
+
+ const bubble = new cr.ui.AutoCloseBubble;
+ bubble.anchorNode = target;
+ bubble.domSibling = domSibling;
+ bubble.arrowLocation = location;
+ bubble.content = content;
+ bubble.show();
+ this.bubble_ = bubble;
+ },
+
+ /**
+ * Hides the currently visible bubble, if any.
+ */
+ hideBubble: function() {
+ if (this.bubble_) {
+ this.bubble_.hide();
+ }
+ },
+
+ /**
+ * Returns the currently visible bubble, or null if no bubble is visible.
+ * @return {cr.ui.AutoCloseBubble} The bubble currently being shown.
+ */
+ getVisibleBubble: function() {
+ const bubble = this.bubble_;
+ return bubble && !bubble.hidden ? bubble : null;
+ },
+
+ /**
+ * Callback for window.onpopstate to handle back/forward navigations.
+ * @param {string} pageName The current page name.
+ * @param {string} hash The hash to pass into the page.
+ * @param {Object} data State data pushed into history.
+ */
+ setState: function(pageName, hash, data) {
+ const currentOverlay = this.getVisibleOverlay_();
+ const lowercaseName = pageName.toLowerCase();
+ const newPage = this.registeredPages[lowercaseName] ||
+ this.registeredOverlayPages[lowercaseName] || this.defaultPage_;
+ if (currentOverlay && !this.isAncestorOfPage(currentOverlay, newPage)) {
+ currentOverlay.visible = false;
+ currentOverlay.didClosePage();
+ }
+ this.showPageByName(pageName, false, {hash: hash});
+ },
+
+
+ /**
+ * Whether the page is still loading (i.e. onload hasn't finished running).
+ * @return {boolean} Whether the page is still loading.
+ */
+ isLoading: function() {
+ return document.documentElement.classList.contains('loading');
+ },
+
+ /**
+ * Callback for window.onbeforeunload. Used to notify overlays that they
+ * will be closed.
+ */
+ willClose: function() {
+ const overlay = this.getVisibleOverlay_();
+ if (overlay) {
+ overlay.didClosePage();
+ }
+ },
+
+ /**
+ * Freezes/unfreezes the scroll position of the root page based on the
+ * current page stack.
+ */
+ updateRootPageFreezeState: function() {
+ const topPage = this.getTopmostVisiblePage();
+ if (topPage) {
+ this.setRootPageFrozen_(topPage.isOverlay);
+ }
+ },
+
+ /**
+ * Change the horizontal offset used to reposition elements while showing an
+ * overlay from the default.
+ */
+ set horizontalOffset(value) {
+ this.horizontalOffset_ = value;
+ },
+
+ /**
+ * @param {!cr.ui.pageManager.PageManager.Observer} observer The observer to
+ * register.
+ */
+ addObserver: function(observer) {
+ this.observers_.push(observer);
+ },
+
+ /**
+ * Shows a registered overlay page. Does not update history.
+ * @param {string} overlayName Page name.
+ * @param {string} hash The hash state to associate with the overlay.
+ * @param {cr.ui.pageManager.Page} rootPage The currently visible root-level
+ * page.
+ * @return {boolean} Whether we showed an overlay.
+ * @private
+ */
+ showOverlay_: function(overlayName, hash, rootPage) {
+ const overlay = this.registeredOverlayPages[overlayName.toLowerCase()];
+ if (!overlay || !overlay.canShowPage()) {
+ return false;
+ }
+
+ const focusOutlineManager =
+ cr.ui.FocusOutlineManager.forDocument(document);
+
+ // Save the currently focused element in the page for restoration later.
+ const currentPage = this.getTopmostVisiblePage();
+ if (currentPage && focusOutlineManager.visible) {
+ currentPage.lastFocusedElement = document.activeElement;
+ }
+
+ if ((!rootPage || !rootPage.sticky) && overlay.parentPage &&
+ !overlay.parentPage.visible) {
+ this.showPageByName(overlay.parentPage.name, false);
+ }
+
+ overlay.hash = hash;
+ if (!overlay.visible) {
+ overlay.visible = true;
+ overlay.didShowPage();
+ } else {
+ overlay.didChangeHash();
+ }
+
+ if (focusOutlineManager.visible) {
+ overlay.focus();
+ }
+
+ if (!overlay.pageDiv.contains(document.activeElement)) {
+ document.activeElement.blur();
+ }
+
+ if ($('search-field') && $('search-field').value == '') {
+ const section = overlay.associatedSection;
+ if (section) {
+ /** @suppress {checkTypes|checkVars} */
+ (function() {
+ options.BrowserOptions.scrollToSection(section);
+ })();
+ }
+ }
+
+ return true;
+ },
+
+ /**
+ * Returns whether or not an overlay is visible.
+ * @return {boolean} True if an overlay is visible.
+ * @private
+ */
+ isOverlayVisible_: function() {
+ return this.getVisibleOverlay_() != null;
+ },
+
+ /**
+ * Returns the currently visible overlay, or null if no page is visible.
+ * @return {cr.ui.pageManager.Page} The visible overlay.
+ * @private
+ */
+ getVisibleOverlay_: function() {
+ let topmostPage = null;
+ for (const name in this.registeredOverlayPages) {
+ const page = this.registeredOverlayPages[name];
+ if (!page.visible) {
+ continue;
+ }
+
+ if (page.alwaysOnTop) {
+ return page;
+ }
+
+ if (!topmostPage ||
+ this.getNestingLevel(page) > this.getNestingLevel(topmostPage)) {
+ topmostPage = page;
+ }
+ }
+ return topmostPage;
+ },
+
+ /**
+ * Returns the topmost visible page (overlays excluded).
+ * @return {cr.ui.pageManager.Page} The topmost visible page aside from any
+ * overlays.
+ * @private
+ */
+ getTopmostVisibleNonOverlayPage_: function() {
+ for (const name in this.registeredPages) {
+ const page = this.registeredPages[name];
+ if (page.visible) {
+ return page;
+ }
+ }
+
+ return null;
+ },
+
+ /**
+ * Scrolls the page to the correct position (the top when opening an
+ * overlay, or the old scroll position a previously hidden overlay
+ * becomes visible).
+ * @private
+ */
+ updateScrollPosition_: function() {
+ const container = $('page-container');
+ const scrollTop = container.oldScrollTop || 0;
+ container.oldScrollTop = undefined;
+ window.scroll(scrollLeftForDocument(document), scrollTop);
+ },
+
+ /**
+ * Updates the title to the title of the current page, or of the topmost
+ * visible page with a non-empty title.
+ * @private
+ */
+ updateTitle_: function() {
+ let page = this.getTopmostVisiblePage();
+ while (page) {
+ if (page.title) {
+ for (let i = 0; i < this.observers_.length; ++i) {
+ this.observers_[i].updateTitle(page.title);
+ }
+ return;
+ }
+ page = page.parentPage;
+ }
+ },
+
+ /**
+ * Constructs a new path to push onto the history stack, using observers
+ * to update the history.
+ * @param {boolean} replace If true, handlers should replace the current
+ * history event rather than create new ones.
+ * @private
+ */
+ updateHistoryState_: function(replace) {
+ if (this.isDialog) {
+ return;
+ }
+
+ const page = this.getTopmostVisiblePage();
+ let path = window.location.pathname + window.location.hash;
+ if (path) {
+ // Remove trailing slash.
+ path = path.slice(1).replace(/\/(?:#|$)/, '');
+ }
+
+ // If the page is already in history (the user may have clicked the same
+ // link twice, or this is the initial load), do nothing.
+ const newPath = (page == this.defaultPage_ ? '' : page.name) + page.hash;
+ if (path == newPath) {
+ return;
+ }
+
+ for (let i = 0; i < this.observers_.length; ++i) {
+ this.observers_[i].updateHistory(newPath, replace);
+ }
+ },
+
+ /**
+ * Restores the last focused element on a given page.
+ * @private
+ */
+ restoreLastFocusedElement_: function() {
+ const currentPage = this.getTopmostVisiblePage();
+
+ if (!currentPage.lastFocusedElement) {
+ return;
+ }
+
+ if (cr.ui.FocusOutlineManager.forDocument(document).visible) {
+ currentPage.lastFocusedElement.focus();
+ }
+
+ currentPage.lastFocusedElement = null;
+ },
+
+ /**
+ * Find an enclosing section for an element if it exists.
+ * @param {Node} node Element to search.
+ * @return {Node} The section element, or null.
+ * @private
+ */
+ findSectionForNode_: function(node) {
+ while (node = node.parentNode) {
+ if (node.nodeName == 'SECTION') {
+ return node;
+ }
+ }
+ return null;
+ },
+
+ /**
+ * Freezes/unfreezes the scroll position of the root page container.
+ * @param {boolean} freeze Whether the page should be frozen.
+ * @private
+ */
+ setRootPageFrozen_: function(freeze) {
+ const container = $('page-container');
+ if (container.classList.contains('frozen') == freeze) {
+ return;
+ }
+
+ if (freeze) {
+ // Lock the width, since auto width computation may change.
+ container.style.width = window.getComputedStyle(container).width;
+ container.oldScrollTop = scrollTopForDocument(document);
+ container.classList.add('frozen');
+ const verticalPosition =
+ container.getBoundingClientRect().top - container.oldScrollTop;
+ container.style.top = verticalPosition + 'px';
+ this.updateFrozenElementHorizontalPosition_(container);
+ } else {
+ container.classList.remove('frozen');
+ container.style.top = '';
+ container.style.left = '';
+ container.style.right = '';
+ container.style.width = '';
+ }
+ },
+
+ /**
+ * Called when the page is scrolled; moves elements that are position:fixed
+ * but should only behave as if they are fixed for vertical scrolling.
+ * @private
+ */
+ handleScroll_: function() {
+ this.updateAllFrozenElementPositions_();
+ },
+
+ /**
+ * Updates all frozen pages to match the horizontal scroll position.
+ * @private
+ */
+ updateAllFrozenElementPositions_: function() {
+ const frozenElements = document.querySelectorAll('.frozen');
+ for (let i = 0; i < frozenElements.length; i++) {
+ this.updateFrozenElementHorizontalPosition_(frozenElements[i]);
+ }
+ },
+
+ /**
+ * Updates the given frozen element to match the horizontal scroll position.
+ * @param {HTMLElement} e The frozen element to update.
+ * @private
+ */
+ updateFrozenElementHorizontalPosition_: function(e) {
+ if (isRTL()) {
+ e.style.right = this.horizontalOffset + 'px';
+ } else {
+ const scrollLeft = scrollLeftForDocument(document);
+ e.style.left = this.horizontalOffset - scrollLeft + 'px';
+ }
+ },
+
+ /**
+ * Calls the given callback with each registered page.
+ * @param {boolean} includeRootPages Whether the callback should be called
+ * for the root pages.
+ * @param {function(cr.ui.pageManager.Page)} callback The callback.
+ * @private
+ */
+ forEachPage_: function(includeRootPages, callback) {
+ let pageNames = Object.keys(this.registeredOverlayPages);
+ if (includeRootPages) {
+ pageNames = Object.keys(this.registeredPages).concat(pageNames);
+ }
+
+ pageNames.forEach(function(name) {
+ callback.call(
+ this,
+ this.registeredOverlayPages[name] || this.registeredPages[name]);
+ }, this);
+ },
+ };
+
+ /**
+ * An observer of PageManager.
+ * @constructor
+ */
+ PageManager.Observer = function() {};
+
+ PageManager.Observer.prototype = {
+ /**
+ * Called when a page is being shown or has been hidden.
+ * @param {cr.ui.pageManager.Page} page The page being shown or hidden.
+ */
+ onPageVisibilityChanged: function(page) {},
+
+ /**
+ * Called when a new title should be set.
+ * @param {string} title The title to set.
+ */
+ updateTitle: function(title) {},
+
+ /**
+ * Called when a page is navigated to.
+ * @param {string} path The path of the page being visited.
+ * @param {boolean} replace If true, allow no history events to be created.
+ */
+ updateHistory: function(path, replace) {},
+ };
+
+ // Export
+ return {PageManager: PageManager};
+});
diff --git a/chromium/chrome/browser/resources/bluetooth_internals/resources.grd b/chromium/chrome/browser/resources/bluetooth_internals/resources.grd
index 786dc15be70..4cd5644cc98 100644
--- a/chromium/chrome/browser/resources/bluetooth_internals/resources.grd
+++ b/chromium/chrome/browser/resources/bluetooth_internals/resources.grd
@@ -29,6 +29,10 @@
file="adapter_page.js"
type="BINDATA"
compress="gzip" />
+ <include name="IDR_BLUETOOTH_INTERNALS_DEBUG_LOG_PAGE_JS"
+ file="debug_log_page.js"
+ type="BINDATA"
+ compress="gzip" />
<include name="IDR_BLUETOOTH_INTERNALS_CHARACTERISTIC_LIST_JS"
file="characteristic_list.js"
type="BINDATA"
@@ -89,6 +93,23 @@
file="object_fieldset.js"
type="BINDATA"
compress="gzip" />
+ <include name="IDR_BLUETOOTH_INTERNALS_PAGE_MANAGER_HTML"
+ file="page_manager.html"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_BLUETOOTH_INTERNALS_PAGE_MANAGER_JS"
+ file="page_manager.js"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_BLUETOOTH_INTERNALS_PAGE_HTML"
+ file="page.html"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_BLUETOOTH_INTERNALS_PAGE_JS"
+ file="page.js"
+ type="BINDATA"
+ compress="gzip" />
+
<include name="IDR_BLUETOOTH_INTERNALS_SERVICE_LIST_JS"
file="service_list.js"
type="BINDATA"
diff --git a/chromium/chrome/browser/resources/bookmarks/README.md b/chromium/chrome/browser/resources/bookmarks/README.md
index c6c83b16d7f..272a91dad29 100644
--- a/chromium/chrome/browser/resources/bookmarks/README.md
+++ b/chromium/chrome/browser/resources/bookmarks/README.md
@@ -23,11 +23,11 @@ of the code:
and between two different BMM instances from different Chrome profiles.
* **Policy support**: Several policies are respected:
- - [EditBookmarksEnabled](https://www.chromium.org/administrators/policy-list-3#EditBookmarksEnabled):
+ - [EditBookmarksEnabled](https://cloud.google.com/docs/chrome-enterprise/policies/?policy=EditBookmarksEnabled):
Prevents all editing operations
- - [ManagedBookmarks](https://www.chromium.org/administrators/policy-list-3#ManagedBookmarks):
+ - [ManagedBookmarks](https://cloud.google.com/docs/chrome-enterprise/policies/?policy=ManagedBookmarks):
Defines a folder of immutable bookmarks.
- - [IncognitoModeAvailability](https://www.chromium.org/administrators/policy-list-3#IncognitoModeAvailability):
+ - [IncognitoModeAvailability](https://cloud.google.com/docs/chrome-enterprise/policies/?policy=IncognitoModeAvailability):
Disables/force-enables opening bookmarks in Incognito
## Data-flow model
diff --git a/chromium/chrome/browser/resources/bookmarks/command_manager.html b/chromium/chrome/browser/resources/bookmarks/command_manager.html
index a2e14d04d4e..aa5a6854590 100644
--- a/chromium/chrome/browser/resources/bookmarks/command_manager.html
+++ b/chromium/chrome/browser/resources/bookmarks/command_manager.html
@@ -37,7 +37,7 @@
<button class="dropdown-item"
command$="[[command]]"
hidden$="[[!isCommandVisible_(command, menuIds_)]]"
- disabled$="[[!isCommandEnabled_(command, menuIds_)]]"
+ disabled$="[[!isCommandEnabled_(command, menuIds_, canPaste_)]]"
on-click="onCommandClick_">
<span class="label">
[[getCommandLabel_(command, menuIds_)]]
diff --git a/chromium/chrome/browser/resources/bookmarks/command_manager.js b/chromium/chrome/browser/resources/bookmarks/command_manager.js
index 3d83ab732f6..eb2408d17a2 100644
--- a/chromium/chrome/browser/resources/bookmarks/command_manager.js
+++ b/chromium/chrome/browser/resources/bookmarks/command_manager.js
@@ -43,6 +43,9 @@ cr.define('bookmarks', function() {
},
/** @private */
+ canPaste_: Boolean,
+
+ /** @private */
globalCanEdit_: Boolean,
},
@@ -53,9 +56,7 @@ cr.define('bookmarks', function() {
assert(CommandManager.instance_ == null);
CommandManager.instance_ = this;
- this.watch('globalCanEdit_', function(state) {
- return state.prefs.canEdit;
- });
+ this.watch('globalCanEdit_', state => state.prefs.canEdit);
this.updateFromStore();
/** @private {!Map<Command, cr.ui.KeyboardShortcutList>} */
@@ -214,8 +215,9 @@ cr.define('bookmarks', function() {
isCommandVisible_: function(command, itemIds) {
switch (command) {
case Command.EDIT:
- case Command.PASTE:
return itemIds.size == 1 && this.globalCanEdit_;
+ case Command.PASTE:
+ return this.globalCanEdit_;
case Command.CUT:
case Command.COPY:
return itemIds.size >= 1 && this.globalCanEdit_;
@@ -274,7 +276,7 @@ cr.define('bookmarks', function() {
case Command.IMPORT:
return this.globalCanEdit_;
case Command.PASTE:
- return true; // TODO(hcarmona): Add check for CanPasteFromClipboard.
+ return this.canPaste_;
default:
return true;
}
@@ -800,6 +802,19 @@ cr.define('bookmarks', function() {
cr.toastManager.getInstance().showForStringPieces(pieces, canUndo);
},
+ /**
+ * @param {number} targetId
+ * @private
+ */
+ updateCanPaste_: function(targetId) {
+ return new Promise(resolve => {
+ chrome.bookmarkManagerPrivate.canPaste(`${targetId}`, result => {
+ this.canPaste_ = result;
+ resolve();
+ });
+ });
+ },
+
////////////////////////////////////////////////////////////////////////////
// Event handlers:
@@ -807,7 +822,8 @@ cr.define('bookmarks', function() {
* @param {Event} e
* @private
*/
- onOpenCommandMenu_: function(e) {
+ onOpenCommandMenu_: async function(e) {
+ await this.updateCanPaste_(e.detail.source);
if (e.detail.targetElement) {
this.openCommandMenuAtElement(e.detail.targetElement, e.detail.source);
} else {
diff --git a/chromium/chrome/browser/resources/bookmarks/shared_style.html b/chromium/chrome/browser/resources/bookmarks/shared_style.html
index 723f2db2e60..12b92904a9e 100644
--- a/chromium/chrome/browser/resources/bookmarks/shared_style.html
+++ b/chromium/chrome/browser/resources/bookmarks/shared_style.html
@@ -61,7 +61,7 @@
width: 20px;
}
-<if expr="is_macosx or is_ios">
+<if expr="is_macosx">
@media (prefers-color-scheme: dark) {
.folder-icon {
content: url(chrome://theme/IDR_FOLDER_CLOSED_WHITE);
@@ -69,7 +69,7 @@
}
</if>
-<if expr="not is_macosx and not is_ios">
+<if expr="not is_macosx">
.folder-icon[open] {
content: url(chrome://theme/IDR_FOLDER_OPEN);
}
diff --git a/chromium/chrome/browser/resources/browser_switch/BUILD.gn b/chromium/chrome/browser/resources/browser_switch/BUILD.gn
index 17c4dc37f59..7b25cc542d0 100644
--- a/chromium/chrome/browser/resources/browser_switch/BUILD.gn
+++ b/chromium/chrome/browser/resources/browser_switch/BUILD.gn
@@ -3,8 +3,10 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/polymer/polymer.gni")
js_type_check("closure_compile") {
+ is_polymer3 = true
deps = [
":app",
":browser_switch_proxy",
@@ -14,13 +16,20 @@ js_type_check("closure_compile") {
js_library("app") {
deps = [
- "//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:i18n_behavior",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/js:i18n_behavior.m",
+ "//ui/webui/resources/js:load_time_data.m",
]
}
js_library("browser_switch_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
}
+
+polymer_modulizer("app") {
+ js_file = "app.js"
+ html_file = "app.html"
+ html_type = "v3-ready"
+}
diff --git a/chromium/chrome/browser/resources/browser_switch/app.html b/chromium/chrome/browser/resources/browser_switch/app.html
index 93b4c21d693..69890063617 100644
--- a/chromium/chrome/browser/resources/browser_switch/app.html
+++ b/chromium/chrome/browser/resources/browser_switch/app.html
@@ -1,43 +1,31 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<style>
+ :host {
+ @apply --cr-card-elevation;
+ background-color: var(--cr-card-background-color);
+ border-radius: var(--cr-card-border-radius);
+ display: block;
+ margin: 16px;
+ max-width: 640px;
+ min-width: 500px;
+ padding: 16px;
+ }
-<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/cr_elements/shared_vars_css.html">
-<link rel="import" href="browser_switch_proxy.html">
+ h1 {
+ color: var(--cr-primary-text-color);
+ font-size: 1rem;
+ font-weight: 500;
+ margin: 0;
+ padding: 0 0 14px 0;
+ }
-<dom-module id="browser-switch-app">
- <template>
- <style>
- :host {
- @apply --cr-card-elevation;
- background-color: var(--cr-card-background-color);
- border-radius: var(--cr-card-border-radius);
- display: block;
- margin: 16px;
- max-width: 640px;
- min-width: 500px;
- padding: 16px;
- }
+ p {
+ color: var(--cr-primary-text-color);
+ /* Should be 13px when html font-size is 16px */
+ font-size: 0.8125rem;
+ margin: 0;
+ max-width: 450px;
+ }
+</style>
- h1 {
- color: var(--cr-primary-text-color);
- font-size: 1rem;
- font-weight: 500;
- margin: 0;
- padding: 0 0 14px 0;
- }
-
- p {
- color: var(--cr-primary-text-color);
- /* Should be 13px when html font-size is 16px */
- font-size: 0.8125rem;
- margin: 0;
- max-width: 450px;
- }
- </style>
-
- <h1>[[computeTitle_(error_, secondCounter_)]]</h1>
- <p inner-h-t-m-l="[[computeDescription_(url_, error_)]]"></p>
- </template>
- <script src="app.js"></script>
-</dom-module>
+<h1>[[computeTitle_(error_, secondCounter_)]]</h1>
+<p inner-h-t-m-l="[[computeDescription_(url_, error_)]]"></p>
diff --git a/chromium/chrome/browser/resources/browser_switch/app.js b/chromium/chrome/browser/resources/browser_switch/app.js
index f8979c89826..6e4522ed222 100644
--- a/chromium/chrome/browser/resources/browser_switch/app.js
+++ b/chromium/chrome/browser/resources/browser_switch/app.js
@@ -2,9 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-'use strict';
+import 'chrome://resources/cr_elements/shared_vars_css.m.js';
+import './strings.m.js';
-(function() {
+import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
+import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {BrowserSwitchProxyImpl} from './browser_switch_proxy.js';
/** @type {number} */
const MS_PER_SECOND = 1000;
@@ -18,6 +23,8 @@ const LaunchError = {
Polymer({
is: 'browser-switch-app',
+ _template: html`{__html_template__}`,
+
behaviors: [I18nBehavior],
properties: {
@@ -141,6 +148,5 @@ function getUrlHostname(url) {
}
function getProxy() {
- return browser_switch.BrowserSwitchProxyImpl.getInstance();
+ return BrowserSwitchProxyImpl.getInstance();
}
-})();
diff --git a/chromium/chrome/browser/resources/browser_switch/browser_switch.html b/chromium/chrome/browser/resources/browser_switch/browser_switch.html
index 968ae80f108..f987974dea6 100644
--- a/chromium/chrome/browser/resources/browser_switch/browser_switch.html
+++ b/chromium/chrome/browser/resources/browser_switch/browser_switch.html
@@ -25,9 +25,6 @@
<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/load_time_data.html">
- <script src="strings.js"></script>
- <link rel="import" href="app.html">
+ <script type="module" src="app.js"></script>
</body>
</html>
diff --git a/chromium/chrome/browser/resources/browser_switch/browser_switch_proxy.html b/chromium/chrome/browser/resources/browser_switch/browser_switch_proxy.html
deleted file mode 100644
index 4dd11cd933b..00000000000
--- a/chromium/chrome/browser/resources/browser_switch/browser_switch_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="browser_switch_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/browser_switch/browser_switch_proxy.js b/chromium/chrome/browser/resources/browser_switch/browser_switch_proxy.js
index dd35bff286e..0be32291879 100644
--- a/chromium/chrome/browser/resources/browser_switch/browser_switch_proxy.js
+++ b/chromium/chrome/browser/resources/browser_switch/browser_switch_proxy.js
@@ -2,36 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('browser_switch', function() {
- /** @interface */
- class BrowserSwitchProxy {
- /**
- * @param {string} url URL to open in alternative browser.
- * @return {Promise} A promise that can fail if unable to launch. It will
- * never resolve, because the tab closes if this succeeds.
- */
- launchAlternativeBrowserAndCloseTab(url) {}
+import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
- gotoNewTabPage() {}
- }
+/** @interface */
+export class BrowserSwitchProxy {
+ /**
+ * @param {string} url URL to open in alternative browser.
+ * @return {Promise} A promise that can fail if unable to launch. It will
+ * never resolve, because the tab closes if this succeeds.
+ */
+ launchAlternativeBrowserAndCloseTab(url) {}
- /** @implements {browser_switch.BrowserSwitchProxy} */
- class BrowserSwitchProxyImpl {
- /** @override */
- launchAlternativeBrowserAndCloseTab(url) {
- return cr.sendWithPromise('launchAlternativeBrowserAndCloseTab', url);
- }
+ gotoNewTabPage() {}
+}
- /** @override */
- gotoNewTabPage() {
- chrome.send('gotoNewTabPage');
- }
+/** @implements {BrowserSwitchProxy} */
+export class BrowserSwitchProxyImpl {
+ /** @override */
+ launchAlternativeBrowserAndCloseTab(url) {
+ return sendWithPromise('launchAlternativeBrowserAndCloseTab', url);
}
- cr.addSingletonGetter(BrowserSwitchProxyImpl);
+ /** @override */
+ gotoNewTabPage() {
+ chrome.send('gotoNewTabPage');
+ }
+}
- return {
- BrowserSwitchProxy: BrowserSwitchProxy,
- BrowserSwitchProxyImpl: BrowserSwitchProxyImpl
- };
-});
+addSingletonGetter(BrowserSwitchProxyImpl);
diff --git a/chromium/chrome/browser/resources/chromeos/BUILD.gn b/chromium/chrome/browser/resources/chromeos/BUILD.gn
index 6d5a60739fa..8de13aa3ad6 100644
--- a/chromium/chrome/browser/resources/chromeos/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/BUILD.gn
@@ -65,6 +65,7 @@ group("closure_compile") {
"bluetooth_pairing_dialog:closure_compile",
"braille_ime:closure_compile",
"camera/src/js:closure_compile",
+ "crostini_installer:closure_compile",
"internet_config_dialog:closure_compile",
"internet_detail_dialog:closure_compile",
"login:closure_compile",
diff --git a/chromium/chrome/browser/resources/chromeos/camera/BUILD.gn b/chromium/chrome/browser/resources/chromeos/camera/BUILD.gn
index d41c627794d..ad8a9d9ac16 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/camera/BUILD.gn
@@ -79,8 +79,9 @@ copy("chrome_camera_app_images") {
"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_intro_banner_close.svg",
- "src/images/camera_intro_banner_icon.svg",
+ "src/images/camera_intent_play_video.svg",
+ "src/images/camera_intent_result_cancel.svg",
+ "src/images/camera_intent_result_confirm.svg",
"src/images/camera_mode_photo.svg",
"src/images/camera_mode_portrait.svg",
"src/images/camera_mode_square.svg",
@@ -114,6 +115,7 @@ copy("chrome_camera_app_js") {
"src/js/background.js",
"src/js/gallerybutton.js",
"src/js/google-analytics-bundle.js",
+ "src/js/intent.js",
"src/js/main.js",
"src/js/metrics.js",
"src/js/nav.js",
@@ -146,6 +148,7 @@ copy("chrome_camera_app_js_device") {
"src/js/device/camera3_device_info.js",
"src/js/device/constraints_preferrer.js",
"src/js/device/device_info_updater.js",
+ "src/js/device/error.js",
]
outputs = [
@@ -155,11 +158,13 @@ copy("chrome_camera_app_js_device") {
copy("chrome_camera_app_js_models") {
sources = [
+ "src/js/models/file_video_saver.js",
"src/js/models/filenamer.js",
"src/js/models/filesystem.js",
"src/js/models/gallery.js",
+ "src/js/models/intent_video_saver.js",
"src/js/models/result_saver.js",
- "src/js/models/video_saver.js",
+ "src/js/models/video_saver_interface.js",
]
outputs = [
@@ -169,6 +174,7 @@ copy("chrome_camera_app_js_models") {
copy("chrome_camera_app_js_mojo") {
sources = [
+ "src/js/mojo/chrome_helper.js",
"src/js/mojo/device_operator.js",
"src/js/mojo/image_capture.js",
]
@@ -182,6 +188,7 @@ copy("chrome_camera_app_js_views") {
sources = [
"src/js/views/browser.js",
"src/js/views/camera.js",
+ "src/js/views/camera_intent.js",
"src/js/views/dialog.js",
"src/js/views/gallery_base.js",
"src/js/views/settings.js",
@@ -201,6 +208,7 @@ copy("chrome_camera_app_js_views_camera") {
"src/js/views/camera/options.js",
"src/js/views/camera/preview.js",
"src/js/views/camera/recordtime.js",
+ "src/js/views/camera/review_result.js",
"src/js/views/camera/timertick.js",
]
@@ -214,7 +222,9 @@ copy("chrome_camera_app_sounds") {
"src/sounds/record_end.ogg",
"src/sounds/record_start.ogg",
"src/sounds/shutter.ogg",
- "src/sounds/tick.ogg",
+ "src/sounds/tick_final.ogg",
+ "src/sounds/tick_inc.ogg",
+ "src/sounds/tick_start.ogg",
]
outputs = [
@@ -234,6 +244,8 @@ copy("chrome_camera_app_views") {
copy("chrome_camera_app_mojo_generated") {
sources = [
+ "$root_gen_dir/components/arc/mojom/camera_intent.mojom-lite.js",
+ "$root_gen_dir/components/chromeos_camera/common/camera_app_helper.mojom-lite.js",
"$root_gen_dir/media/capture/mojom/image_capture.mojom-lite.js",
"$root_gen_dir/media/capture/video/chromeos/mojom/camera_app.mojom-lite.js",
"$root_gen_dir/media/capture/video/chromeos/mojom/camera_common.mojom-lite.js",
@@ -245,6 +257,9 @@ copy("chrome_camera_app_mojo_generated") {
]
deps = [
+ "//components/arc/mojom:camera_intent_js",
+ "//components/arc/mojom:mojom_js",
+ "//components/chromeos_camera/common:camera_app_helper_js",
"//media/capture/mojom:image_capture_js",
"//media/capture/video/chromeos/mojom:cros_camera_js",
"//mojo/public/js:bindings_lite",
diff --git a/chromium/chrome/browser/resources/chromeos/camera/camera_resources.grd b/chromium/chrome/browser/resources/chromeos/camera/camera_resources.grd
index 0a9ac124ab1..5db7aa1386c 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/camera_resources.grd
+++ b/chromium/chrome/browser/resources/chromeos/camera/camera_resources.grd
@@ -17,16 +17,20 @@
<structure name="IDR_CAMERA_BUNDLE_JS" file="src/js/google-analytics-bundle.js" type="chrome_html" />
<structure name="IDR_CAMERA_CAMERA3_DEVICE_INFO_JS" file="src/js/device/camera3_device_info.js" type="chrome_html" />
<structure name="IDR_CAMERA_CAMERA_JS" file="src/js/views/camera.js" type="chrome_html" />
+ <structure name="IDR_CAMERA_CAMERA_INTENT_JS" file="src/js/views/camera_intent.js" type="chrome_html" />
<structure name="IDR_CAMERA_CONSTRAINTS_PREFERRER_JS" file="src/js/device/constraints_preferrer.js" type="chrome_html" />
+ <structure name="IDR_CAMERA_CHROME_HELPER_JS" file="src/js/mojo/chrome_helper.js" type="chrome_html" />
<structure name="IDR_CAMERA_DEVICE_OPERATOR_JS" file="src/js/mojo/device_operator.js" type="chrome_html" />
<structure name="IDR_CAMERA_DEVICE_INFO_UPDATER_JS" file="src/js/device/device_info_updater.js" type="chrome_html" />
<structure name="IDR_CAMERA_DIALOG_JS" file="src/js/views/dialog.js" type="chrome_html" />
+ <structure name="IDR_CAMERA_ERROR_JS" file="src/js/device/error.js" type="chrome_html" />
<structure name="IDR_CAMERA_FILENAMER_JS" file="src/js/models/filenamer.js" type="chrome_html" />
<structure name="IDR_CAMERA_FILESYSTEM_JS" file="src/js/models/filesystem.js" type="chrome_html" />
<structure name="IDR_CAMERA_GALLERY_BASE_JS" file="src/js/views/gallery_base.js" type="chrome_html" />
<structure name="IDR_CAMERA_GALLERY_JS" file="src/js/models/gallery.js" type="chrome_html" />
<structure name="IDR_CAMERA_GALLERYBUTTON_JS" file="src/js/gallerybutton.js" type="chrome_html" />
<structure name="IDR_CAMERA_IMAGECAPTURE_JS" file="src/js/mojo/image_capture.js" type="chrome_html" />
+ <structure name="IDR_CAMERA_INTENT_JS" file="src/js/intent.js" type="chrome_html" />
<structure name="IDR_CAMERA_LAYOUT_JS" file="src/js/views/camera/layout.js" type="chrome_html" />
<structure name="IDR_CAMERA_MAIN_CSS" file="src/css/main.css" type="chrome_html" />
<structure name="IDR_CAMERA_MAIN_HTML" file="src/views/main.html" type="chrome_html" />
@@ -40,6 +44,7 @@
<structure name="IDR_CAMERA_RECORDTIME_JS" file="src/js/views/camera/recordtime.js" type="chrome_html" />
<structure name="IDR_CAMERA_RESOLUTION_EVENT_BROKER_JS" file="src/js/resolution_event_broker.js" type="chrome_html" />
<structure name="IDR_CAMERA_RESULT_SAVER_JS" file="src/js/models/result_saver.js" type="chrome_html" />
+ <structure name="IDR_CAMERA_REVIEW_RESULT_JS" file="src/js/views/camera/review_result.js" type="chrome_html" />
<structure name="IDR_CAMERA_SCROLLBAR_JS" file="src/js/scrollbar.js" type="chrome_html" />
<structure name="IDR_CAMERA_SETTINGS_JS" file="src/js/views/settings.js" type="chrome_html" />
<structure name="IDR_CAMERA_SOUND_JS" file="src/js/sound.js" type="chrome_html" />
@@ -48,13 +53,19 @@
<structure name="IDR_CAMERA_TOAST_JS" file="src/js/toast.js" type="chrome_html" />
<structure name="IDR_CAMERA_TOOLTIP_JS" file="src/js/tooltip.js" type="chrome_html" />
<structure name="IDR_CAMERA_UTIL_JS" file="src/js/util.js" type="chrome_html" />
- <structure name="IDR_CAMERA_VIDEO_SAVER_JS" file="src/js/models/video_saver.js" type="chrome_html" />
+ <structure name="IDR_CAMERA_VIDEO_SAVER_INTERFACE_JS" file="src/js/models/video_saver_interface.js" type="chrome_html" />
+ <structure name="IDR_CAMERA_INTENT_VIDEO_SAVER_JS" file="src/js/models/file_video_saver.js" type="chrome_html" />
+ <structure name="IDR_CAMERA_FILE_VIDEO_SAVER_JS" file="src/js/models/intent_video_saver.js" type="chrome_html" />
<structure name="IDR_CAMERA_VIEW_JS" file="src/js/views/view.js" type="chrome_html" />
<structure name="IDR_CAMERA_WARNING_JS" file="src/js/views/warning.js" type="chrome_html" />
<structure name="IDR_CAMERA_WEBUI_BROWSER_PROXY" file="src/js/browser_proxy/webui_browser_proxy.js" type="chrome_html" />
</structures>
<includes>
<!-- Mojo Lite Bindings -->
+ <include name="IDR_CAMERA_CAMERA_INTENT_MOJOM_LITE_JS"
+ file="${root_gen_dir}/components/arc/mojom/camera_intent.mojom-lite.js"
+ use_base_dir="false"
+ type="BINDATA"/>
<include name="IDR_CAMERA_IMAGE_CAPTURE_MOJOM_LITE_JS"
file="${root_gen_dir}/media/capture/mojom/image_capture.mojom-lite.js"
use_base_dir="false"
@@ -79,14 +90,15 @@
<include name="IDR_CAMERA_RECORD_END_OGG" file="src/sounds/record_end.ogg" type="BINDATA" />
<include name="IDR_CAMERA_RECORD_START_OGG" file="src/sounds/record_start.ogg" type="BINDATA" />
<include name="IDR_CAMERA_SHUTTER_OGG" file="src/sounds/shutter.ogg" type="BINDATA" />
- <include name="IDR_CAMERA_TICK_OGG" file="src/sounds/tick.ogg" type="BINDATA" />
+ <include name="IDR_CAMERA_TICK_FINAL_OGG" file="src/sounds/tick_final.ogg" type="BINDATA" />
+ <include name="IDR_CAMERA_TICK_INC_OGG" file="src/sounds/tick_inc.ogg" type="BINDATA" />
+ <include name="IDR_CAMERA_TICK_START_OGG" file="src/sounds/tick_start.ogg" type="BINDATA" />
<include name="IDR_CAMERA_CAMERA_MODE_SQUARE_SVG" file="src/images/camera_mode_square.svg" type="BINDATA" />
<include name="IDR_CAMERA_SETTINGS_BUTTON_BACK_SVG" file="src/images/settings_button_back.svg" type="BINDATA" />
<include name="IDR_CAMERA_CAMERA_MODE_PORTRAIT_SVG" file="src/images/camera_mode_portrait.svg" type="BINDATA" />
<include name="IDR_CAMERA_CAMERA_BUTTON_TIMER_ON_3S_SVG" file="src/images/camera_button_timer_on_3s.svg" type="BINDATA" />
<include name="IDR_CAMERA_CAMERA_SHUTTER_VIDEO_START_HOVER_SVG" file="src/images/camera_shutter_video_start_hover.svg" type="BINDATA" />
<include name="IDR_CAMERA_SPINNER_SVG" file="src/images/spinner.svg" type="BINDATA" />
- <include name="IDR_CAMERA_CAMERA_INTRO_BANNER_ICON_SVG" file="src/images/camera_intro_banner_icon.svg" type="BINDATA" />
<include name="IDR_CAMERA_CAMERA_BUTTON_GRID_OFF_SVG" file="src/images/camera_button_grid_off.svg" type="BINDATA" />
<include name="IDR_CAMERA_CAMERA_BUTTON_MIC_ON_SVG" file="src/images/camera_button_mic_on.svg" type="BINDATA" />
<include name="IDR_CAMERA_BROWSER_BUTTON_DELETE_SVG" file="src/images/browser_button_delete.svg" type="BINDATA" />
@@ -110,7 +122,6 @@
<include name="IDR_CAMERA_SETTINGS_GRID_TYPE_SVG" file="src/images/settings_grid_type.svg" type="BINDATA" />
<include name="IDR_CAMERA_CAMERA_BUTTON_MIRROR_OFF_SVG" file="src/images/camera_button_mirror_off.svg" type="BINDATA" />
<include name="IDR_CAMERA_BROWSER_BUTTON_EXPORT_SVG" file="src/images/browser_button_export.svg" type="BINDATA" />
- <include name="IDR_CAMERA_CAMERA_INTRO_BANNER_CLOSE_SVG" file="src/images/camera_intro_banner_close.svg" type="BINDATA" />
<include name="IDR_CAMERA_CAMERA_SHUTTER_PHOTO_START_SVG" file="src/images/camera_shutter_photo_start.svg" type="BINDATA" />
<include name="IDR_CAMERA_BROWSER_BUTTON_BACK_SVG" file="src/images/browser_button_back.svg" type="BINDATA" />
<include name="IDR_CAMERA_CAMERA_SHUTTER_VIDEO_STOP_SVG" file="src/images/camera_shutter_video_stop.svg" type="BINDATA" />
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 cf3600060c5..3a824bee776 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
@@ -95,6 +95,14 @@
"message": "Grid type",
"description": "Label for the button of grid-type options."
},
+ "LABEL_30FPS": {
+ "message": "30 FPS",
+ "description": "Label showing current state of 30 FPS on tooltip of toggle 60 FPS recording checkbox."
+ },
+ "LABEL_60FPS": {
+ "message": "60 FPS",
+ "description": "Label showing current state of 60 FPS on tooltip of toggle 60 FPS recording checkbox."
+ },
"TOGGLE_60FPS_BUTTON": {
"message": "60 FPS",
"description": "Label for the checkbox to toggle 60 FPS recording."
@@ -333,20 +341,16 @@
"message": "Photos and videos taken with the camera will be moved to the Downloads folder. You can access them in Files.\n\nApps with storage permissions will have access to your photos and videos.",
"description": "Message shown before moving all photos and videos stored in the Camera App to the Downloads folder."
},
- "BANNER_TITLE": {
- "message": "A whole new look",
- "description": "Title of banner shown for introducing new camera App UI."
+ "CONFIRM_REVIEW_BUTTON": {
+ "message": "Confirm",
+ "description": "Label for the confirm button to confirm with the reviewed photo or video."
},
- "BANNER_MSG": {
- "message": "Your camera now supports new modes and your photos and videos will be available under your Downloads folders.",
- "description": "Message in the banner shown for introducing new camera App UI."
- },
- "BANNER_CLOSE_BUTTON": {
- "message": "Close",
- "description": "Label for close introducing new camera App UI banner button."
+ "CANCEL_REVIEW_BUTTON": {
+ "message": "Cancel",
+ "description": "Label for the cancel button to cancel with the reviewed photo or video."
},
- "BANNER_LEARN_MORE_BUTTON": {
- "message": "Learn more",
- "description": "Label for learn more about new camera App UI button."
+ "PLAY_RESULT_VIDEO_BUTTON": {
+ "message": "Play video",
+ "description": "Label for the button to play video."
}
} \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn b/chromium/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn
index 059505eb02c..7ea176a9a3f 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn
@@ -17,6 +17,9 @@ group("closure_compile") {
js_type_check("compile_resources") {
deps = [
+ ":background",
+ ":intent",
+ ":metrics",
":nav",
":resolution_event_broker",
":state",
@@ -26,6 +29,18 @@ js_type_check("compile_resources") {
]
}
+js_library("intent") {
+ deps = [
+ "mojo:chrome_helper",
+ ]
+}
+
+js_library("metrics") {
+ deps = [
+ "externs:chrome_platform_analytics",
+ ]
+}
+
js_library("resolution_event_broker") {
}
@@ -39,6 +54,12 @@ js_library("nav") {
js_library("state") {
}
+js_library("background") {
+ deps = [
+ ":intent",
+ ]
+}
+
js_library("toast") {
deps = [
":util",
@@ -52,6 +73,7 @@ js_library("util") {
deps = [
":tooltip",
"browser_proxy:browser_proxy",
+ "mojo:chrome_helper",
]
externs_list = [ "$externs_path/chrome_extensions.js" ]
}
diff --git a/chromium/chrome/browser/resources/chromeos/camera/src/js/device/BUILD.gn b/chromium/chrome/browser/resources/chromeos/camera/src/js/device/BUILD.gn
index cc01ba9b370..a54df9607b7 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/src/js/device/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/js/device/BUILD.gn
@@ -9,6 +9,7 @@ js_type_check("closure_compile") {
":camera3_device_info",
":constraints_preferrer",
":device_info_updater",
+ ":error",
]
}
@@ -31,6 +32,10 @@ js_library("device_info_updater") {
deps = [
":camera3_device_info",
":constraints_preferrer",
+ ":error",
"..:state",
]
}
+
+js_library("error") {
+}
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/BUILD.gn b/chromium/chrome/browser/resources/chromeos/camera/src/js/externs/BUILD.gn
index b542932ff9c..e41499011b1 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/js/externs/BUILD.gn
@@ -4,11 +4,8 @@
import("//third_party/closure_compiler/compile_js.gni")
-js_type_check("closure_compile") {
- deps = [
- ":viewer-pen-options",
- ]
-}
+js_library("chrome_platform_analytics") {
+ sources = []
-js_library("viewer-pen-options") {
+ externs_list = [ "chrome_platform_analytics.js" ]
}
diff --git a/chromium/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn b/chromium/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn
index db0f77e3e3f..39e60221b1d 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn
@@ -33,4 +33,12 @@ js_library("result_saver") {
}
js_library("video_saver") {
+ sources = [
+ "file_video_saver.js",
+ "intent_video_saver.js",
+ "video_saver_interface.js",
+ ]
+ deps = [
+ "..:intent",
+ ]
}
diff --git a/chromium/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn b/chromium/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn
index 3be85b7f5c2..ba8aca34aad 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn
@@ -6,11 +6,20 @@ import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
+ ":chrome_helper",
":device_operator",
":image_capture",
]
}
+js_library("chrome_helper") {
+ deps = [
+ "//components/arc/mojom:camera_intent_js_library_for_compile",
+ "//components/chromeos_camera/common:camera_app_helper_js_library_for_compile",
+ ]
+ externs_list = [ "$externs_path/pending.js" ]
+}
+
js_library("device_operator") {
deps = [
"//media/capture/video/chromeos/mojom:cros_camera_js_library_for_compile",
diff --git a/chromium/chrome/browser/resources/chromeos/camera/src/js/views/BUILD.gn b/chromium/chrome/browser/resources/chromeos/camera/src/js/views/BUILD.gn
index 84560373b2c..d52516bb184 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/src/js/views/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/js/views/BUILD.gn
@@ -7,6 +7,7 @@ import("//third_party/closure_compiler/compile_js.gni")
group("closure_compile") {
deps = [
":compile_resources",
+ "camera:compile_resources",
]
}
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning/BUILD.gn b/chromium/chrome/browser/resources/chromeos/camera/src/js/views/camera/BUILD.gn
index e27ead67627..38a22c262b9 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/js/views/camera/BUILD.gn
@@ -4,15 +4,21 @@
import("//third_party/closure_compiler/compile_js.gni")
-js_type_check("closure_compile") {
+group("closure_compile") {
deps = [
- ":viewer-form-warning",
+ ":compile_resources",
]
}
-js_library("viewer-form-warning") {
+js_type_check("compile_resources") {
deps = [
- "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog",
- "//ui/webui/resources/js:promise_resolver",
+ ":review_result",
+ ]
+}
+
+js_library("review_result") {
+ deps = [
+ "../..:state",
+ "../..:util",
]
}
diff --git a/chromium/chrome/browser/resources/chromeos/camera/src/manifest.json b/chromium/chrome/browser/resources/chromeos/camera/src/manifest.json
index 412686f9bed..f0c5c272c5b 100644
--- a/chromium/chrome/browser/resources/chromeos/camera/src/manifest.json
+++ b/chromium/chrome/browser/resources/chromeos/camera/src/manifest.json
@@ -25,7 +25,14 @@
],
"app": {
"background": {
- "scripts": ["js/background.js"]
+ "scripts": [
+ "js/mojo/mojo_bindings_lite.js",
+ "js/mojo/camera_intent.mojom-lite.js",
+ "js/mojo/camera_app_helper.mojom-lite.js",
+ "js/mojo/chrome_helper.js",
+ "js/intent.js",
+ "js/background.js"
+ ]
}
}
}
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 299d99fff8c..f5c800a6df4 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
@@ -297,6 +297,12 @@
<message desc="Label for the button of grid-type options." name="IDS_GRID_TYPE_BUTTON">
Grid type
</message>
+ <message desc="Label showing current state of 30 FPS on tooltip of toggle 60 FPS recording checkbox." name="IDS_LABEL_30FPS">
+ 30 FPS
+ </message>
+ <message desc="Label showing current state of 60 FPS on tooltip of toggle 60 FPS recording checkbox." name="IDS_LABEL_60FPS">
+ 60 FPS
+ </message>
<message desc="Label for the checkbox to toggle 60 FPS recording." name="IDS_TOGGLE_60FPS_BUTTON">
60 FPS
</message>
@@ -315,17 +321,14 @@
<message desc="Label for switch to take portrait photo mode button." name="IDS_LABEL_SWITCH_TAKE_PORTRAIT_PHOTO_BUTTON">
Portrait
</message>
- <message desc="Title of banner shown for introducing new camera App UI." name="IDS_BANNER_TITLE">
- A whole new look
+ <message desc="Label for the confirm button to confirm with the reviewed photo or video." name="IDS_CONFIRM_REVIEW_BUTTON">
+ Confirm
</message>
- <message desc="Message in the banner shown for introducing new camera App UI." name="IDS_BANNER_MSG">
- Your camera now supports new modes and your photos and videos will be available under your Downloads folders.
- </message>
- <message desc="Label for close introducing new camera App UI banner button." name="IDS_BANNER_CLOSE_BUTTON">
- Close
+ <message desc="Label for the cancel button to cancel with the reviewed photo or video." name="IDS_CANCEL_REVIEW_BUTTON">
+ Cancel
</message>
- <message desc="Label for learn more about new camera App UI button." name="IDS_BANNER_LEARN_MORE_BUTTON">
- Learn more
+ <message desc="Label for the button to play video." name="IDS_PLAY_RESULT_VIDEO_BUTTON">
+ Play video
</message>
</messages>
</release>
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn b/chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn
index 39bba1fa5d9..5210a02ce52 100644
--- a/chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/chromevox/BUILD.gn
@@ -158,6 +158,7 @@ chromevox_modules = [
"cvox2/background/panel_command.js",
"cvox2/background/panel_menu.js",
"cvox2/background/panel_menu_item.js",
+ "cvox2/background/phonetic_data.js",
"cvox2/background/recovery_strategy.js",
"cvox2/background/tree_dumper.js",
"cvox2/background/tree_walker.js",
@@ -187,6 +188,7 @@ chromevox_modules = [
"host/interface/braille_interface.js",
"host/interface/host_factory.js",
"host/interface/tts_interface.js",
+ "third_party/tamachiyomi/ja_phonetic_data.js",
"walkers/abstract_node_walker.js",
"walkers/abstract_selection_walker.js",
"walkers/abstract_shifter.js",
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json
index ddee7a20815..f049fa2f5b9 100644
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json
+++ b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json
@@ -924,6 +924,25 @@
}
},
{
+ "command": "previousSimilarItem",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [73],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextSimilarItem",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [73]
+ }
+ }
+ },
+ {
"command": "jumpToDetails",
"sequence": {
"cvoxModifier": true,
@@ -998,7 +1017,7 @@
}
},
{
- "command": "getBatteryDescription",
+ "command": "announceBatteryDescription",
"sequence": {
"cvoxModifier": true,
"keys": {
@@ -1007,13 +1026,22 @@
}
},
{
- "command": "getRichTextDescription",
+ "command": "announceRichTextDescription",
"sequence": {
"cvoxModifier": true,
"keys": {
"keyCode": [65, 70]
}
}
+ },
+ {
+ "command": "readPhoneticPronunciation",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [65, 67]
+ }
+ }
}
]
}
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 2028ad38ee8..60b38c2f415 100644
--- a/chromium/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
+++ b/chromium/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
@@ -1072,6 +1072,21 @@
<message desc="This is an abbreviated ARIA widget role name shown on a braille display. When translating, try to find a contracted form of the translation for 'alert dialog' according to local conventions. If reasonable, use all lowercase and avoid punctuation to keep the number of characters as low as possible." name="IDS_CHROMEVOX_ROLE_ALERTDIALOG_BRL">
alrt dlg
</message>
+ <message desc="Accessibility role description for attribution, meaning authoring information tied to specific content" name="IDS_CHROMEVOX_ROLE_ANNOTATION_ATTRIBUTION">
+ Authoring info
+ </message>
+ <message desc="Accessibility role description for commentary" name="IDS_CHROMEVOX_ROLE_ANNOTATION_COMMENTARY">
+ Comments
+ </message>
+ <message desc="Accessibility role description for presence, meaning information about another collaborator who is currently reviewing or editing this content" name="IDS_CHROMEVOX_ROLE_ANNOTATION_PRESENCE">
+ Live presence
+ </message>
+ <message desc="Accessibility role description for revision, meaining historical change info tied to this content" name="IDS_CHROMEVOX_ROLE_ANNOTATION_REVISION">
+ Revision
+ </message>
+ <message desc="Accessibility role description for suggestion, meaning a suggested change to some content" name="IDS_CHROMEVOX_ROLE_ANNOTATION_SUGGESTION" >
+ Suggestion
+ </message>
<message desc="Describes an element with the ARIA role button." name="IDS_CHROMEVOX_ROLE_BUTTON">
Button
</message>
@@ -1900,6 +1915,8 @@
<message desc="In an editable text box, describes a line with only whitespace." name="IDS_CHROMEVOX_TEXT_BOX_WHITESPACE" meaning="UI element">
Space
</message>
+ <!-- TODO(crbug.com/999781): The following 3 messages are combined with other message fragments. -->
+ <!-- Combining message fragments is a I18N code-smell. Combine fragments into a single message. -->
<message desc="Further describes a list-like element with a number of items. e.g. This will be combined with other messages to produce: List with 3 items." name="IDS_CHROMEVOX_LIST_WITH_ITEMS_NOT_PLURALIZED">
with <ph name="num">$1</ph> items
</message>
@@ -1907,10 +1924,11 @@
+<ph name="num">$1</ph>
</message>
<message desc="Further describes a list-like element with a number of items. e.g. This will be combined with other messages to produce: List with 3 items." name="IDS_CHROMEVOX_LIST_WITH_ITEMS">
- with {COUNT, plural, =1 {# item}other {# items}}
+ {COUNT, plural, =1{with # item} other{with # items}}
</message>
+ <!-- TODO(crbug.com/999781): This should not need ICU msg format. Fix where the message is used. -->
<message desc="Further describes a list-like element with a number of items in braille." name="IDS_CHROMEVOX_LIST_WITH_ITEMS_BRL">
- +{COUNT, plural, =1 {#}other {#}}
+ {COUNT, plural, =1{+#} other{+#}}
</message>
<message desc="Describes the state of a progress bar, in percent." name="IDS_CHROMEVOX_STATE_PERCENT">
<ph name="num">$1</ph>%
@@ -2275,6 +2293,12 @@
<message desc="The description of the next group command. Displayed in the Options page." name="IDS_CHROMEVOX_NEXT_GROUP">
Next Group
</message>
+ <message desc="The description of the previous similar command." name="IDS_CHROMEVOX_PREVIOUS_SIMILAR_ITEM">
+ Previous similar item
+ </message>
+ <message desc="The description of the next similar item command." name="IDS_CHROMEVOX_NEXT_SIMILAR_ITEM">
+ Next similar item
+ </message>
<message desc="Describes nodes or anything describing them as a landmark." name="IDS_CHROMEVOX_ROLE_LANDMARK">
Landmark
</message>
@@ -3706,6 +3730,21 @@ If you're done with the tutorial, use ChromeVox to navigate to the Close button
<message desc="Appends language in front of content." name="IDS_CHROMEVOX_LANGUAGE_SWITCH">
<ph name="language">$1<ex>English</ex></ph>: <ph name="content">$2<ex>This is example content</ex></ph>
</message>
+ <message desc="The description of the readPhoneticPronunciation key. Displayed in the ChromeVox menu." name="IDS_CHROMEVOX_READ_PHONETIC_PRONUNCIATION">
+ Announce phonetic pronunciation for word
+ </message>
+ <message desc="Spoken to inform the user that the node's name is empty" name="IDS_CHROMEVOX_EMPTY_NAME">
+ No available text for this item
+ </message>
+ <message desc="The description of the announceBatteryDescription key. Displayed in the ChromeVox menu." name="IDS_CHROMEVOX_ANNOUNCE_BATTERY_DESCRIPTION">
+ Announce current battery status
+ </message>
+ <message desc="The description of the announceRichTextDescription key. Displayed in the ChromeVox menu." name="IDS_CHROMEVOX_ANNOUNCE_RICH_TEXT_DESCRIPTION">
+ Announce formatting for current item
+ </message>
+ <message desc="Announced when there is no available voice for a language." name="IDS_CHROMEVOX_VOICE_UNAVAILABLE_FOR_LANGUAGE">
+ No voice available for language: <ph name="language">$1<ex>English</ex></ph>
+ </message>
</messages>
</release>
</grit>
diff --git a/chromium/chrome/browser/resources/chromeos/crostini_installer/BUILD.gn b/chromium/chrome/browser/resources/chromeos/crostini_installer/BUILD.gn
new file mode 100644
index 00000000000..2ce6341b27d
--- /dev/null
+++ b/chromium/chrome/browser/resources/chromeos/crostini_installer/BUILD.gn
@@ -0,0 +1,44 @@
+# 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")
+import("//tools/polymer/polymer.gni")
+
+js_type_check("closure_compile") {
+ is_polymer3 = true
+ closure_flags = default_closure_args + [
+ "js_module_root=../../chrome/browser/resources/chromeos/crostini_installer/",
+ "js_module_root=./gen/chrome/browser/resources/chromeos/crostini_installer/",
+ ]
+ deps = [
+ ":app",
+ ":browser_proxy",
+ ]
+}
+
+js_library("app") {
+ deps = [
+ ":browser_proxy",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ ]
+}
+
+js_library("browser_proxy") {
+ deps = [
+ "//chrome/browser/ui/webui/chromeos/crostini_installer:mojo_bindings_js_library_for_compile",
+ "//ui/webui/resources/js:cr.m",
+ ]
+}
+
+polymer_modulizer("app") {
+ js_file = "app.js"
+ html_file = "app.html"
+ html_type = "v3-ready"
+}
+
+group("polymer3_elements") {
+ deps = [
+ ":app_module",
+ ]
+}
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 e59dd858d6c..5aae7aca66d 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
@@ -617,7 +617,8 @@
"id": "xkb:es::spa",
"description": "",
"language": [
- "es"
+ "es",
+ "es-ES"
],
"layouts": [
"es"
@@ -629,7 +630,7 @@
"name": "__MSG_keyboard_catalan__",
"type": "ime",
"id": "xkb:es:cat:cat",
- "indicator": "CAS",
+ "indicator": "CAT",
"description": "",
"language": [
"ca"
diff --git a/chromium/chrome/browser/resources/chromeos/input_method/xkb_manifest.json b/chromium/chrome/browser/resources/chromeos/input_method/xkb_manifest.json
index 0bc467ac313..ca18e770961 100644
--- a/chromium/chrome/browser/resources/chromeos/input_method/xkb_manifest.json
+++ b/chromium/chrome/browser/resources/chromeos/input_method/xkb_manifest.json
@@ -483,7 +483,8 @@
"id": "xkb:es::spa",
"description": "",
"language": [
- "es"
+ "es",
+ "es-ES"
],
"layouts": [
"es"
@@ -494,7 +495,7 @@
"name": "__MSG_keyboard_catalan__",
"type": "ime",
"id": "xkb:es:cat:cat",
- "indicator": "CAS",
+ "indicator": "CAT",
"description": "",
"language": [
"ca"
diff --git a/chromium/chrome/browser/resources/chromeos/internet_config_dialog/BUILD.gn b/chromium/chrome/browser/resources/chromeos/internet_config_dialog/BUILD.gn
index 02db3721b9f..5137ae377cc 100644
--- a/chromium/chrome/browser/resources/chromeos/internet_config_dialog/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/internet_config_dialog/BUILD.gn
@@ -25,9 +25,8 @@ js_type_check("closure_compile") {
js_library("internet_config_dialog") {
deps = [
"//ui/webui/resources/cr_components/chromeos/network:network_config",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
"//ui/webui/resources/cr_elements/cr_dialog:cr_dialog",
- "//ui/webui/resources/cr_elements/policy:cr_policy_network_behavior",
+ "//ui/webui/resources/cr_elements/policy:cr_policy_network_behavior_mojo",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:i18n_behavior",
]
diff --git a/chromium/chrome/browser/resources/chromeos/internet_detail_dialog/BUILD.gn b/chromium/chrome/browser/resources/chromeos/internet_detail_dialog/BUILD.gn
index 7f45f293dd0..c292ee7e2d0 100644
--- a/chromium/chrome/browser/resources/chromeos/internet_detail_dialog/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/internet_detail_dialog/BUILD.gn
@@ -25,15 +25,11 @@ js_type_check("closure_compile") {
js_library("internet_detail_dialog") {
deps = [
"//ui/webui/resources/cr_elements/chromeos/network:cr_network_listener_behavior",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
+ "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_strings",
"//ui/webui/resources/cr_elements/policy:cr_policy_network_behavior_mojo",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:i18n_behavior",
"//ui/webui/resources/js/chromeos:onc_mojo",
]
- externs_list = [
- "$externs_path/chrome_send.js",
- "$externs_path/networking_private.js",
- ]
- extra_sources = [ "$interfaces_path/networking_private_interface.js" ]
+ externs_list = [ "$externs_path/chrome_send.js" ]
}
diff --git a/chromium/chrome/browser/resources/chromeos/login/BUILD.gn b/chromium/chrome/browser/resources/chromeos/login/BUILD.gn
index 77459dd1bf6..a37b11a9538 100644
--- a/chromium/chrome/browser/resources/chromeos/login/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/login/BUILD.gn
@@ -235,7 +235,7 @@ 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",
+ "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_strings",
"//ui/webui/resources/js/chromeos:onc_mojo",
]
}
diff --git a/chromium/chrome/browser/resources/chromeos/network_ui/BUILD.gn b/chromium/chrome/browser/resources/chromeos/network_ui/BUILD.gn
index 199569c5a92..dcc92a7bfb2 100644
--- a/chromium/chrome/browser/resources/chromeos/network_ui/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/network_ui/BUILD.gn
@@ -15,7 +15,7 @@ js_library("network_ui") {
"//chromeos/services/network_config/public/mojom:mojom_js_library_for_compile",
"//ui/webui/resources/cr_components/chromeos/network:mojo_interface_provider",
"//ui/webui/resources/cr_elements/chromeos/network:cr_network_icon",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
+ "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_strings",
"//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:util",
"//ui/webui/resources/js/chromeos:onc_mojo",
diff --git a/chromium/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn b/chromium/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn
index 7e924f7353c..ce57213b9dc 100644
--- a/chromium/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/set_time_dialog/BUILD.gn
@@ -3,8 +3,10 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/polymer/polymer.gni")
js_type_check("closure_compile") {
+ is_polymer3 = true
deps = [
":set_time_browser_proxy",
":set_time_dialog",
@@ -14,17 +16,29 @@ js_type_check("closure_compile") {
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",
+ "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m",
+ "//ui/webui/resources/js:assert.m",
+ "//ui/webui/resources/js:cr.m",
+ "//ui/webui/resources/js:load_time_data.m",
+ "//ui/webui/resources/js:web_ui_listener_behavior.m",
]
}
js_library("set_time_browser_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
externs_list = [ "$externs_path/chrome_send.js" ]
}
+
+polymer_modulizer("set_time_dialog") {
+ js_file = "set_time_dialog.js"
+ html_file = "set_time_dialog.html"
+ html_type = "v3-ready"
+}
+
+group("polymer3_elements") {
+ deps = [
+ ":set_time_dialog_module",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn b/chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn
index a38c408d0f3..34d99739608 100644
--- a/chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn
+++ b/chromium/chrome/browser/resources/chromeos/switch_access/BUILD.gn
@@ -36,6 +36,7 @@ run_jsbundler("switch_access_copied_files") {
"back_button_manager.js",
"background.js",
"commands.js",
+ "event_helper.js",
"focus_ring_manager.js",
"icons/back.svg",
"icons/copy.svg",
@@ -175,6 +176,7 @@ js_type_check("closure_compile") {
":back_button_manager",
":background",
":commands",
+ ":event_helper",
":focus_ring_manager",
":menu_manager",
":menu_panel",
@@ -203,6 +205,7 @@ js_library("auto_scan_manager") {
js_library("navigation_manager") {
deps = [
":back_button_manager",
+ ":event_helper",
":focus_ring_manager",
":menu_manager",
":menu_panel_interface",
@@ -231,6 +234,7 @@ js_library("background") {
js_library("back_button_manager") {
deps = [
":menu_panel_interface",
+ ":rect_helper",
]
externs_list = [
"$externs_path/accessibility_private.js",
@@ -244,6 +248,10 @@ js_library("commands") {
]
}
+js_library("event_helper") {
+ externs_list = [ "$externs_path/automation.js" ]
+}
+
js_library("focus_ring_manager") {
deps = [
":back_button_manager",
@@ -254,6 +262,7 @@ js_library("focus_ring_manager") {
js_library("menu_manager") {
deps = [
":menu_panel_interface",
+ ":rect_helper",
":switch_access_interface",
]
externs_list = [ "$externs_path/accessibility_private.js" ]
@@ -309,11 +318,15 @@ js_library("switch_access_predicate") {
}
js_library("text_input_manager") {
+ deps = [
+ ":event_helper",
+ ]
externs_list = [ "$externs_path/accessibility_private.js" ]
}
js_library("text_navigation_manager") {
deps = [
+ ":event_helper",
":switch_access_constants",
]
externs_list = [ "$externs_path/accessibility_private.js" ]
diff --git a/chromium/chrome/browser/resources/component_extension_resources.grd b/chromium/chrome/browser/resources/component_extension_resources.grd
index f159f9a242b..a534601664a 100644
--- a/chromium/chrome/browser/resources/component_extension_resources.grd
+++ b/chromium/chrome/browser/resources/component_extension_resources.grd
@@ -100,6 +100,7 @@
<include name="IDR_PDF_INDEX_CSS" file="pdf/index.css" allowexternalscript="true" type="BINDATA" />
<include name="IDR_PDF_MAIN_JS" file="pdf/main.js" type="BINDATA" />
<include name="IDR_PDF_PDF_VIEWER_JS" file="pdf/pdf_viewer.js" type="BINDATA" />
+ <include name="IDR_PDF_CONTROLLER_JS" file="pdf/controller.js" type="BINDATA" />
<include name="IDR_PDF_TOOLBAR_MANAGER_JS" file="pdf/toolbar_manager.js" type="BINDATA" />
<include name="IDR_PDF_PDF_FITTING_TYPE_JS" file="pdf/pdf_fitting_type.js" type="BINDATA" />
<include name="IDR_PDF_VIEWPORT_JS" file="pdf/viewport.js" type="BINDATA" />
@@ -113,35 +114,38 @@
<include name="IDR_PDF_METRICS_JS" file="pdf/metrics.js" type="BINDATA" />
<include name="IDR_PDF_SHARED_VARS_HTML" file="pdf/elements/shared-vars.html" type="BINDATA" />
+ <!-- TODO(crbug.com/1005029): Dummy generated file used for ChromeComponentExtensionResourceManager tests.
+ Replace with a file actually used by the PDF Viewer once migration to Polymer3 is completed. -->
+ <include name="IDR_PDF_SHARED_VARS_M_JS" file="${root_gen_dir}/chrome/browser/resources/pdf/elements/shared-vars.m.js" use_base_dir="false" type="BINDATA" />
<include name="IDR_PDF_ICONS_HTML" file="pdf/elements/icons.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_BOOKMARK_HTML" file="pdf/elements/viewer-bookmark/viewer-bookmark.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_BOOKMARK_JS" file="pdf/elements/viewer-bookmark/viewer-bookmark.js" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_ERROR_SCREEN_HTML" file="pdf/elements/viewer-error-screen/viewer-error-screen.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_ERROR_SCREEN_JS" file="pdf/elements/viewer-error-screen/viewer-error-screen.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_BOOKMARK_HTML" file="pdf/elements/viewer-bookmark.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_BOOKMARK_JS" file="pdf/elements/viewer-bookmark.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_ERROR_SCREEN_HTML" file="pdf/elements/viewer-error-screen.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_ERROR_SCREEN_JS" file="pdf/elements/viewer-error-screen.js" type="BINDATA" />
<if expr="chromeos">
<include name="IDR_PDF_VIEWER_INK_INDEX_HTML" file="pdf/ink/index.html" type="BINDATA" />
<include name="IDR_PDF_VIEWER_INK_INK_API_JS" file="pdf/ink/ink_api.js" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_INK_HOST_HTML" file="pdf/elements/viewer-ink-host/viewer-ink-host.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_INK_HOST_JS" file="pdf/elements/viewer-ink-host/viewer-ink-host.js" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_PEN_OPTIONS_HTML" file="pdf/elements/viewer-pen-options/viewer-pen-options.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_PEN_OPTIONS_JS" file="pdf/elements/viewer-pen-options/viewer-pen-options.js" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_FORM_WARNING_HTML" file="pdf/elements/viewer-form-warning/viewer-form-warning.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_FORM_WARNING_JS" file="pdf/elements/viewer-form-warning/viewer-form-warning.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_INK_HOST_HTML" file="pdf/elements/viewer-ink-host.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_INK_HOST_JS" file="pdf/elements/viewer-ink-host.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_PEN_OPTIONS_HTML" file="pdf/elements/viewer-pen-options.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_PEN_OPTIONS_JS" file="pdf/elements/viewer-pen-options.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_FORM_WARNING_HTML" file="pdf/elements/viewer-form-warning.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_FORM_WARNING_JS" file="pdf/elements/viewer-form-warning.js" type="BINDATA" />
</if>
- <include name="IDR_PDF_VIEWER_PAGE_INDICATOR_HTML" file="pdf/elements/viewer-page-indicator/viewer-page-indicator.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_PAGE_INDICATOR_JS" file="pdf/elements/viewer-page-indicator/viewer-page-indicator.js" type="BINDATA" flattenhtml="true" />
- <include name="IDR_PDF_VIEWER_PAGE_SELECTOR_HTML" file="pdf/elements/viewer-page-selector/viewer-page-selector.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_PAGE_SELECTOR_JS" file="pdf/elements/viewer-page-selector/viewer-page-selector.js" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_PASSWORD_SCREEN_HTML" file="pdf/elements/viewer-password-screen/viewer-password-screen.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_PASSWORD_SCREEN_JS" file="pdf/elements/viewer-password-screen/viewer-password-screen.js" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_PDF_TOOLBAR_HTML" file="pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html" type="BINDATA" preprocess="true" />
- <include name="IDR_PDF_VIEWER_PDF_TOOLBAR_JS" file="pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_TOOLBAR_DROPDOWN_HTML" file="pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_TOOLBAR_DROPDOWN_JS" file="pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.js" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_ZOOM_BUTTON_HTML" file="pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_ZOOM_BUTTON_JS" file="pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_ZOOM_SELECTOR_HTML" file="pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.html" type="BINDATA" />
- <include name="IDR_PDF_VIEWER_ZOOM_SELECTOR_JS" file="pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_PAGE_INDICATOR_HTML" file="pdf/elements/viewer-page-indicator.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_PAGE_INDICATOR_JS" file="pdf/elements/viewer-page-indicator.js" type="BINDATA" flattenhtml="true" />
+ <include name="IDR_PDF_VIEWER_PAGE_SELECTOR_HTML" file="pdf/elements/viewer-page-selector.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_PAGE_SELECTOR_JS" file="pdf/elements/viewer-page-selector.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_PASSWORD_SCREEN_HTML" file="pdf/elements/viewer-password-screen.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_PASSWORD_SCREEN_JS" file="pdf/elements/viewer-password-screen.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_PDF_TOOLBAR_HTML" file="pdf/elements/viewer-pdf-toolbar.html" type="BINDATA" preprocess="true" />
+ <include name="IDR_PDF_VIEWER_PDF_TOOLBAR_JS" file="pdf/elements/viewer-pdf-toolbar.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_TOOLBAR_DROPDOWN_HTML" file="pdf/elements/viewer-toolbar-dropdown.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_TOOLBAR_DROPDOWN_JS" file="pdf/elements/viewer-toolbar-dropdown.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_ZOOM_BUTTON_HTML" file="pdf/elements/viewer-zoom-button.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_ZOOM_BUTTON_JS" file="pdf/elements/viewer-zoom-button.js" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_ZOOM_SELECTOR_HTML" file="pdf/elements/viewer-zoom-toolbar.html" type="BINDATA" />
+ <include name="IDR_PDF_VIEWER_ZOOM_SELECTOR_JS" file="pdf/elements/viewer-zoom-toolbar.js" type="BINDATA" />
</if>
<include name="IDR_CRYPTOTOKEN_UTIL_JS" file="cryptotoken/util.js" type="BINDATA" />
<include name="IDR_CRYPTOTOKEN_B64_JS" file="cryptotoken/b64.js" type="BINDATA" />
diff --git a/chromium/chrome/browser/resources/conflicts/about_conflicts.html b/chromium/chrome/browser/resources/conflicts/about_conflicts.html
index efeabe223b0..c8da460f8c8 100644
--- a/chromium/chrome/browser/resources/conflicts/about_conflicts.html
+++ b/chromium/chrome/browser/resources/conflicts/about_conflicts.html
@@ -11,7 +11,7 @@ body {
a {
color: blue;
- font-size: 103%;
+ text-decoration: none;
}
#header {
@@ -96,8 +96,8 @@ div.content {
padding-top: 5px;
}
-.module {
- border-bottom: 1px solid #cdcdcd;
+.module:hover {
+ background: rgb(255, 255, 170);
}
.module-name {
@@ -110,23 +110,10 @@ div.content {
text-align: center;
}
-.suspected-bad {
- color: rgb(221, 119, 0);
-}
-
-.confirmed-bad {
- color: red;
-}
-
.nowrap {
white-space: nowrap;
}
-.extra-info-text {
- margin-bottom: 1em;
- margin-top: -1em;
-}
-
.clearing {
clear: left;
float: left;
@@ -150,7 +137,9 @@ html[dir=rtl] .clearing {
<div id="header"><h1>Modules loaded</h1></div>
<div id="blurb-container">
- <span>This page lists all modules loaded into the browser and renderer processes and modules registered to load at a later point.</span>
+ <span>This page lists <a href="#">all</a> modules loaded into the
+ <a href="#B">browser</a> and <a href="#R">renderer</a> processes and
+ modules registered to load at a <a href="#None">later</a> point.</span>
</div>
<div id="modulesTemplate">
@@ -211,7 +200,8 @@ html[dir=rtl] .clearing {
<span dir="ltr">Conflicts Status</span>
</td>
</tr>
- <tr jsselect="moduleList">
+ <tr jsvalues="data-process:process_types.toLowerCase()"
+ jsselect="moduleList" class="module">
<td valign="top" class="datacell">
<span dir="ltr"
jsvalues=".innerHTML:description"
diff --git a/chromium/chrome/browser/resources/conflicts/about_conflicts.js b/chromium/chrome/browser/resources/conflicts/about_conflicts.js
index eb750549ea5..f44af07a016 100644
--- a/chromium/chrome/browser/resources/conflicts/about_conflicts.js
+++ b/chromium/chrome/browser/resources/conflicts/about_conflicts.js
@@ -43,15 +43,35 @@ function requestModuleListData() {
}
/**
+ * Filters list of displayed modules to those listed in the process types
+ * specified in the url fragment. For instance, chrome://conflicts/#r will show
+ * only those modules that have loaded into a renderer.
+ */
+function filterModuleListData() {
+ const filter = window.location.hash.substr(1).toLowerCase();
+ const modules = document.getElementsByClassName('module');
+
+ // Loop through all modules, and hide all that don't match the filter.
+ for (i = 0; i < modules.length; ++i) {
+ modules[i].style.display =
+ modules[i].dataset.process.includes(filter) ? '' : 'none';
+ }
+}
+
+/**
* Called by the WebUI to re-populate the page with data representing the
* current state of installed modules.
* @param {Object} moduleListData Information about available modules.
*/
function returnModuleList(moduleListData) {
renderTemplate(moduleListData);
+ if (window.location.hash.length > 1) {
+ filterModuleListData();
+ }
$('loading-message').style.visibility = 'hidden';
$('body-container').style.visibility = 'visible';
}
// Get data and have it displayed upon loading.
document.addEventListener('DOMContentLoaded', requestModuleListData);
+window.addEventListener('hashchange', filterModuleListData, false);
diff --git a/chromium/chrome/browser/resources/cryptotoken/enroller.js b/chromium/chrome/browser/resources/cryptotoken/enroller.js
index 7bde035b0a1..fd81423f478 100644
--- a/chromium/chrome/browser/resources/cryptotoken/enroller.js
+++ b/chromium/chrome/browser/resources/cryptotoken/enroller.js
@@ -352,6 +352,18 @@ var ConveyancePreference = {
};
/**
+ * WebAuthnAttestationConveyancePreference is the
+ * AttestationConveyancePreference enum from WebAuthn.
+ * @enum{string}
+ */
+const WebAuthnAttestationConveyancePreference = {
+ NONE: 'none',
+ INDIRECT: 'indirect',
+ DIRECT: 'direct',
+ ENTERPRISE: 'enterprise',
+};
+
+/**
* conveyancePreference returns the attestation certificate replacement mode.
*
* @param {EnrollChallenge} enrollChallenge
@@ -397,12 +409,14 @@ function handleU2fEnrollRequest(messageSender, request, sendResponse) {
if (conveyancePreference(enrollChallenge) == ConveyancePreference.NONE) {
isDirect = false;
} else if (chrome.cryptotokenPrivate != null) {
- isDirect = await(new Promise((resolve, reject) => {
+ isDirect = await (new Promise((resolve, reject) => {
chrome.cryptotokenPrivate.canAppIdGetAttestation(
- {'appId': appId,
- 'tabId': messageSender.tab.id,
- 'origin': sender.origin,
- }, resolve);
+ {
+ 'appId': appId,
+ 'tabId': messageSender.tab.id,
+ 'origin': sender.origin,
+ },
+ resolve);
}));
}
@@ -821,11 +835,11 @@ Enroller.prototype.sendEnrollRequestToHelper_ = function() {
let v2Challenge;
for (let index = 0; index < self.enrollChallenges_.length; index++) {
if (self.enrollChallenges_[index]['version'] === 'U2F_V2') {
- v2Challenge = self.enrollChallenges_[index]['challenge'];
+ v2Challenge = self.enrollChallenges_[index];
}
}
- if (v2Challenge === undefined) {
+ if (v2Challenge['challenge'] === undefined) {
console.warn('Did not find U2F_V2 challenge');
this.notifyError_({errorCode: ErrorCodes.BAD_REQUEST});
return;
@@ -844,23 +858,39 @@ const googleCorpAppId =
* @private
*/
Enroller.prototype.doRegisterWebAuthn_ = function(appId, challenge, request) {
+ const encodedChallenge = challenge['challenge'];
+
if (appId == googleCorpAppId) {
- this.doRegisterWebAuthnContinue_(appId, challenge, request, true);
+ this.doRegisterWebAuthnContinue_(
+ appId, encodedChallenge, request,
+ WebAuthnAttestationConveyancePreference.ENTERPRISE);
return;
}
+ const attestationPreference =
+ conveyancePreference(challenge) == ConveyancePreference.DIRECT ?
+ WebAuthnAttestationConveyancePreference.DIRECT :
+ WebAuthnAttestationConveyancePreference.NONE;
+
if (!chrome.cryptotokenPrivate) {
- this.doRegisterWebAuthnContinue_(appId, challenge, request, false);
+ this.doRegisterWebAuthnContinue_(
+ appId, encodedChallenge, request, attestationPreference);
return;
}
chrome.cryptotokenPrivate.isAppIdHashInEnterpriseContext(
decodeWebSafeBase64ToArray(B64_encode(sha256HashOfString(appId))),
- this.doRegisterWebAuthnContinue_.bind(this, appId, challenge, request));
+ (enterprise_context) => {
+ this.doRegisterWebAuthnContinue_(
+ appId, encodedChallenge, request,
+ enterprise_context ?
+ WebAuthnAttestationConveyancePreference.ENTERPRISE :
+ attestationPreference);
+ });
};
Enroller.prototype.doRegisterWebAuthnContinue_ = function(
- appId, challenge, request, useIndividualAttestation) {
+ appId, challenge, request, attestationMode) {
// Set a random ID.
const randomId = new Uint8Array(new ArrayBuffer(16));
crypto.getRandomValues(randomId);
@@ -895,7 +925,6 @@ Enroller.prototype.doRegisterWebAuthnContinue_ = function(
// Request enterprise attestation for the gstatic corp App ID and domains
// whitelisted via enterprise policy. Otherwise request 'direct' attestation
// (which might later get stripped).
- const attestationMode = useIndividualAttestation ? 'enterprise' : 'direct';
const options = {
publicKey: {
rp: {
diff --git a/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.css b/chromium/chrome/browser/resources/dev_ui/dev_ui_loader_error.html
index aa35e0acfab..76ca63ebc52 100644
--- a/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.css
+++ b/chromium/chrome/browser/resources/dev_ui/dev_ui_loader_error.html
@@ -1,7 +1,10 @@
-/* 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. */
-
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>DevUI DFM Loader</title>
+ <style>
body {
align-items: center;
display: flex;
@@ -11,11 +14,6 @@ body {
justify-content: flex-start;
}
-/* This is needed to hide elements that have "display" set. */
-[hidden] {
- display: none !important;
-}
-
#failure-message {
display: inline-block;
padding-top: 100px;
@@ -43,3 +41,16 @@ ul.suggestions-list li {
color: #2B2B2B;
line-height: 1.55;
}
+ </style>
+</head>
+<body>
+<div id="failure-message">
+ <h1 class="heading">$i18n{h1}</h1>
+ <p class="list-header">$i18n{p}</p>
+ <ul class="suggestions-list">
+ <li>$i18n{li-1}</li>
+ <li>$i18n{li-2}</li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.grdp b/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.grdp
deleted file mode 100644
index 547e30b812d..00000000000
--- a/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.grdp
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<grit-part>
- <include name="IDR_DEV_UI_LOADER_HTML" file="resources/dev_ui_loader/dev_ui_loader.html" compress="gzip" type="BINDATA" />
- <include name="IDR_DEV_UI_LOADER_CSS" file="resources/dev_ui_loader/dev_ui_loader.css" compress="gzip" type="BINDATA" />
- <include name="IDR_DEV_UI_LOADER_JS" file="resources/dev_ui_loader/dev_ui_loader.js" compress="gzip" type="BINDATA" />
-</grit-part>
diff --git a/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.html b/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.html
deleted file mode 100644
index fc95229fb39..00000000000
--- a/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>DevUI DFM Loader</title>
- <link rel="stylesheet" href="dev_ui_loader.css">
- <script src="chrome://resources/js/cr.js"></script>
- <script src="chrome://resources/js/promise_resolver.js"></script>
- <script src="dev_ui_loader.js"></script>
-</head>
-<body>
-<div id="failure-message" hidden>
- <h1 class="heading">Something went wrong</h1>
- <p class="list-header">Try:</p>
- <ul class="suggestions-list">
- <li>Reloading this page</li>
- <li>Checking your internet connection</li>
- </ul>
-</div>
-</body>
-</html>
diff --git a/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.js b/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.js
deleted file mode 100644
index 61bc4c25be8..00000000000
--- a/chromium/chrome/browser/resources/dev_ui_loader/dev_ui_loader.js
+++ /dev/null
@@ -1,51 +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.
-
-(function() {
-'use strict';
-
-/** @return {!URL} */
-function getRedirectUrl() {
- try { // For potential TypeError from new URL().
- const urlString = new URL(location).searchParams.get('url');
- if (urlString) {
- const url = new URL(decodeURIComponent(urlString));
- // Perform basic filtering. Also skip 'dev-ui-loader' to avoid redirect
- // cycle (benign but bizarre). Note that |url.host| is always lowercase.
- if (url.protocol === 'chrome:' && url.host.match(/[a-z0-9_\-]+/) &&
- url.host !== 'dev-ui-loader') {
- return url;
- }
- }
- } catch (e) {
- }
- return new URL('chrome://chrome-urls');
-}
-
-function redirectToChromePage() {
- // Use replace() so the current page disappears from history.
- location.replace(getRedirectUrl());
-}
-
-function doInstall() {
- cr.sendWithPromise('installAndLoadDevUiDfm').then((response) => {
- const status = response[0];
- if (status === 'success' || status === 'noop') {
- redirectToChromePage();
- } else if (status === 'failure') {
- document.querySelector('#failure-message').hidden = false;
- }
- });
-}
-
-document.addEventListener('DOMContentLoaded', () => {
- cr.sendWithPromise('getDevUiDfmState').then((state) => {
- if (state === 'ready') {
- redirectToChromePage();
- } else if (state === 'not-installed' || 'not-loaded') {
- doInstall();
- }
- });
-});
-})();
diff --git a/chromium/chrome/browser/resources/discards/BUILD.gn b/chromium/chrome/browser/resources/discards/BUILD.gn
index abe3f6ba262..8cdbf0b7951 100644
--- a/chromium/chrome/browser/resources/discards/BUILD.gn
+++ b/chromium/chrome/browser/resources/discards/BUILD.gn
@@ -50,7 +50,6 @@ js_library("discards_tab") {
js_library("graph_tab") {
deps = [
- "//chrome/browser/performance_manager:mojo_bindings_js_library_for_compile",
"//chrome/browser/ui/webui/discards:mojo_bindings_js_library_for_compile",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
@@ -59,7 +58,7 @@ js_library("graph_tab") {
js_library("graph_doc") {
deps = [
- "//chrome/browser/performance_manager:mojo_bindings_js_library_for_compile",
+ "//chrome/browser/ui/webui/discards:mojo_bindings_js_library_for_compile",
]
externs_list = [ "../../../../third_party/d3/src/externs.js" ]
diff --git a/chromium/chrome/browser/resources/discards/database_tab.js b/chromium/chrome/browser/resources/discards/database_tab.js
index 1fc56fbba26..f8a9e74e9d7 100644
--- a/chromium/chrome/browser/resources/discards/database_tab.js
+++ b/chromium/chrome/browser/resources/discards/database_tab.js
@@ -7,10 +7,10 @@ cr.define('database_tab', function() {
/**
* Compares two db rows by their origin.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} a The first value being
- * compared.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} b The second value being
- * compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} a The first value
+ * being compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} b The second value
+ * being compared.
* @return {number} A negative number if a < b, 0 if a == b, and a positive
* number if a > b.
*/
@@ -20,10 +20,10 @@ cr.define('database_tab', function() {
/**
* Compares two db rows by their dirty bit.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} a The first value being
- * compared.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} b The second value being
- * compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} a The first value
+ * being compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} b The second value
+ * being compared.
* @return {number} A negative number if a < b, 0 if a == b, and a positive
* number if a > b.
*/
@@ -33,10 +33,10 @@ cr.define('database_tab', function() {
/**
* Compares two db rows by their last load time.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} a The first value being
- * compared.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} b The second value being
- * compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} a The first value
+ * being compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} b The second value
+ * being compared.
* @return {number} A negative number if a < b, 0 if a == b, and a positive
* number if a > b.
*/
@@ -46,10 +46,10 @@ cr.define('database_tab', function() {
/**
* Compares two db rows by their CPU usage.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} a The first value being
- * compared.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} b The second value being
- * compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} a The first value
+ * being compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} b The second value
+ * being compared.
* @return {number} A negative number if a < b, 0 if a == b, and a positive
* number if a > b.
*/
@@ -63,10 +63,10 @@ cr.define('database_tab', function() {
/**
* Compares two db rows by their memory usage.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} a The first value being
- * compared.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} b The second value being
- * compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} a The first value
+ * being compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} b The second value
+ * being compared.
* @return {number} A negative number if a < b, 0 if a == b, and a positive
* number if a > b.
*/
@@ -82,10 +82,10 @@ cr.define('database_tab', function() {
/**
* Compares two db rows by their load duration.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} a The first value being
- * compared.
- * @param {mojom.SiteCharacteristicsDatabaseEntry} b The second value being
- * compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} a The first value
+ * being compared.
+ * @param {discards.mojom.SiteCharacteristicsDatabaseEntry} b The second value
+ * being compared.
* @return {number} A negative number if a < b, 0 if a == b, and a positive
* number if a > b.
*/
@@ -101,8 +101,8 @@ cr.define('database_tab', function() {
/**
* @param {string} sortKey The sort key to get a function for.
- * @return {function(mojom.SiteCharacteristicsDatabaseEntry,
- mojom.SiteCharacteristicsDatabaseEntry): number}
+ * @return {function(discards.mojom.SiteCharacteristicsDatabaseEntry,
+ discards.mojom.SiteCharacteristicsDatabaseEntry): number}
* A comparison function that compares two tab infos, returns
* negative number if a < b, 0 if a == b, and a positive
* number if a > b.
@@ -194,7 +194,7 @@ Polymer({
properties: {
/**
* List of database rows.
- * @private {?Array<!mojom.SiteCharacteristicsDatabaseEntry>}
+ * @private {?Array<!discards.mojom.SiteCharacteristicsDatabaseEntry>}
*/
rows_: {
type: Array,
@@ -202,7 +202,7 @@ Polymer({
/**
* The database size response.
- * @private {!mojom.SiteCharacteristicsDatabaseSize}
+ * @private {!discards.mojom.SiteCharacteristicsDatabaseSize}
*/
size_: {
type: Object,
@@ -227,7 +227,7 @@ Polymer({
/** @private {!Object} */
requestedOrigins_: {},
- /** @private {?mojom.DiscardsDetailsProviderRemote} */
+ /** @private {?discards.mojom.DetailsProviderRemote} */
discardsDetailsProvider_: null,
/** @override */
@@ -399,7 +399,7 @@ Polymer({
},
/**
- * @param {?mojom.SiteCharacteristicsFeature} feature The feature
+ * @param {?discards.mojom.SiteCharacteristicsFeature} feature The feature
* in question.
* @return {string} A human-readable string representing the feature.
* @private
diff --git a/chromium/chrome/browser/resources/discards/discards.js b/chromium/chrome/browser/resources/discards/discards.js
index 1e8740a01f1..ea65798e9e6 100644
--- a/chromium/chrome/browser/resources/discards/discards.js
+++ b/chromium/chrome/browser/resources/discards/discards.js
@@ -10,11 +10,11 @@ cr.define('discards', function() {
let discardsDetailsProvider;
/**
- * @return {!mojom.DiscardsDetailsProviderRemote} Provides discards details.
+ * @return {!discards.mojom.DetailsProviderRemote} Provides discards details.
*/
function getOrCreateDetailsProvider() {
if (!discardsDetailsProvider) {
- discardsDetailsProvider = mojom.DiscardsDetailsProvider.getRemote();
+ discardsDetailsProvider = discards.mojom.DetailsProvider.getRemote();
}
return discardsDetailsProvider;
}
diff --git a/chromium/chrome/browser/resources/discards/discards_tab.js b/chromium/chrome/browser/resources/discards/discards_tab.js
index b7a64869944..58cccce5e4e 100644
--- a/chromium/chrome/browser/resources/discards/discards_tab.js
+++ b/chromium/chrome/browser/resources/discards/discards_tab.js
@@ -89,7 +89,7 @@ Polymer({
properties: {
/**
* List of tabinfos.
- * @private {?Array<!mojom.TabDiscardsInfo>}
+ * @private {?Array<!discards.mojom.TabDiscardsInfo>}
*/
tabInfos_: {
type: Array,
@@ -99,7 +99,7 @@ Polymer({
/** @private The current update timer if any. */
updateTimer_: 0,
- /** @private {(mojom.DiscardsDetailsProviderRemote|null)} */
+ /** @private {(discards.mojom.DetailsProviderRemote|null)} */
discardsDetailsProvider_: null,
/** @override */
@@ -137,17 +137,18 @@ Polymer({
/**
* Returns a string representation of a visibility enum value for display in
* a table.
- * @param {mojom.LifecycleUnitVisibility} visibility A visibility value.
+ * @param {discards.mojom.LifecycleUnitVisibility} visibility A visibility
+ * value.
* @return {string} A string representation of the visibility.
* @private
*/
visibilityToString_: function(visibility) {
switch (visibility) {
- case mojom.LifecycleUnitVisibility.HIDDEN:
+ case discards.mojom.LifecycleUnitVisibility.HIDDEN:
return 'hidden';
- case mojom.LifecycleUnitVisibility.OCCLUDED:
+ case discards.mojom.LifecycleUnitVisibility.OCCLUDED:
return 'occluded';
- case mojom.LifecycleUnitVisibility.VISIBLE:
+ case discards.mojom.LifecycleUnitVisibility.VISIBLE:
return 'visible';
}
assertNotReached('Unknown visibility: ' + visibility);
@@ -196,7 +197,8 @@ Polymer({
* @param {mojom.LifecycleUnitState} state The lifecycle state.
* @param {mojom.LifecycleUnitDiscardReason} reason The discard reason. This
* is only used if the state is discard related.
- * @param {mojom.LifecycleUnitVisibility} visibility A visibility value.
+ * @param {discards.mojom.LifecycleUnitVisibility} visibility A visibility
+ * value.
* @param {boolean} hasFocus Whether or not the tab has input focus.
* @param {mojoBase.mojom.TimeDelta} stateChangeTime Delta between Unix Epoch
* and time at which the lifecycle state has changed.
@@ -208,11 +210,11 @@ Polymer({
state, reason, visibility, hasFocus, stateChangeTime) {
const pageLifecycleStateFromVisibilityAndFocus = function() {
switch (visibility) {
- case mojom.LifecycleUnitVisibility.HIDDEN:
- case mojom.LifecycleUnitVisibility.OCCLUDED:
+ case discards.mojom.LifecycleUnitVisibility.HIDDEN:
+ case discards.mojom.LifecycleUnitVisibility.OCCLUDED:
// An occluded page is also considered hidden.
return 'hidden';
- case mojom.LifecycleUnitVisibility.VISIBLE:
+ case discards.mojom.LifecycleUnitVisibility.VISIBLE:
return hasFocus ? 'active' : 'passive';
}
assertNotReached('Unknown visibility: ' + visibility);
@@ -269,7 +271,7 @@ Polymer({
/**
* Formats an items reactivation for display.
- * @param {mojom.TabDiscardsInfo} item The item in question.
+ * @param {discards.mojom.TabDiscardsInfo} item The item in question.
* @return {string} The formatted reactivation score.
* @private
*/
@@ -280,7 +282,7 @@ Polymer({
/**
* Formats an items site engagement score for display.
- * @param {mojom.TabDiscardsInfo} item The item in question.
+ * @param {discards.mojom.TabDiscardsInfo} item The item in question.
* @return {string} The formatted site engagemetn score.
* @private
*/
@@ -290,7 +292,7 @@ Polymer({
/**
* Retrieves favicon style tag value for an item.
- * @param {mojom.TabDiscardsInfo} item The item in question.
+ * @param {discards.mojom.TabDiscardsInfo} item The item in question.
* @return {string} A style to retrieve and display the item's favicon.
* @private
*/
@@ -301,7 +303,7 @@ Polymer({
/**
* Formats an items lifecycle state for display.
- * @param {mojom.TabDiscardsInfo} item The item in question.
+ * @param {discards.mojom.TabDiscardsInfo} item The item in question.
* @return {string} A human readable lifecycle state.
* @private
*/
@@ -338,7 +340,7 @@ Polymer({
/**
* Tests whether an item has reasons why it cannot be frozen.
- * @param {mojom.TabDiscardsInfo} item The item in question.
+ * @param {discards.mojom.TabDiscardsInfo} item The item in question.
* @return {boolean} true iff there are reasons why the item cannot be frozen.
* @private
*/
@@ -347,7 +349,7 @@ Polymer({
},
/**
* Tests whether an item has reasons why it cannot be discarded.
- * @param {mojom.TabDiscardsInfo} item The item in question.
+ * @param {discards.mojom.TabDiscardsInfo} item The item in question.
* @return {boolean} true iff there are reasons why the item cannot be
* discarded.
* @private
@@ -358,7 +360,7 @@ Polymer({
/**
* Tests whether an item can be loaded.
- * @param {mojom.TabDiscardsInfo} item The item in question.
+ * @param {discards.mojom.TabDiscardsInfo} item The item in question.
* @return {boolean} true iff the item can be loaded.
* @private
*/
@@ -368,13 +370,13 @@ Polymer({
/**
* Tests whether an item can be frozen.
- * @param {mojom.TabDiscardsInfo} item The item in question.
+ * @param {discards.mojom.TabDiscardsInfo} item The item in question.
* @return {boolean} true iff the item can be frozen.
* @private
*/
canFreeze_: function(item) {
- if (item.visibility == mojom.LifecycleUnitVisibility.HIDDEN ||
- item.visibility == mojom.LifecycleUnitVisibility.OCCLUDED) {
+ if (item.visibility == discards.mojom.LifecycleUnitVisibility.HIDDEN ||
+ item.visibility == discards.mojom.LifecycleUnitVisibility.OCCLUDED) {
// Only tabs that aren't visible can be frozen for now.
switch (item.state) {
case mojom.LifecycleUnitState.DISCARDED:
@@ -390,13 +392,13 @@ Polymer({
/**
* Tests whether an item can be discarded.
- * @param {mojom.TabDiscardsInfo} item The item in question.
+ * @param {discards.mojom.TabDiscardsInfo} item The item in question.
* @return {boolean} true iff the item can be discarded.
* @private
*/
canDiscard_: function(item) {
- if (item.visibility == mojom.LifecycleUnitVisibility.HIDDEN ||
- item.visibility == mojom.LifecycleUnitVisibility.OCCLUDED) {
+ if (item.visibility == discards.mojom.LifecycleUnitVisibility.HIDDEN ||
+ item.visibility == discards.mojom.LifecycleUnitVisibility.OCCLUDED) {
// Only tabs that aren't visible can be discarded for now.
switch (item.state) {
case mojom.LifecycleUnitState.DISCARDED:
diff --git a/chromium/chrome/browser/resources/discards/graph_doc.js b/chromium/chrome/browser/resources/discards/graph_doc.js
index 959cb80ae5b..ad07b1fa090 100644
--- a/chromium/chrome/browser/resources/discards/graph_doc.js
+++ b/chromium/chrome/browser/resources/discards/graph_doc.js
@@ -104,10 +104,10 @@ class GraphNode {
}
class PageNode extends GraphNode {
- /** @param {!performanceManager.mojom.WebUIPageInfo} page */
+ /** @param {!discards.mojom.PageInfo} page */
constructor(page) {
super(page.id);
- /** @type {!performanceManager.mojom.WebUIPageInfo} */
+ /** @type {!discards.mojom.PageInfo} */
this.page = page;
this.y = kPageNodesTargetY;
}
@@ -135,10 +135,10 @@ class PageNode extends GraphNode {
}
class FrameNode extends GraphNode {
- /** @param {!performanceManager.mojom.WebUIFrameInfo} frame */
+ /** @param {!discards.mojom.FrameInfo} frame */
constructor(frame) {
super(frame.id);
- /** @type {!performanceManager.mojom.WebUIFrameInfo} frame */
+ /** @type {!discards.mojom.FrameInfo} frame */
this.frame = frame;
this.color = this.selectColor(frame.processId);
}
@@ -168,10 +168,10 @@ class FrameNode extends GraphNode {
}
class ProcessNode extends GraphNode {
- /** @param {!performanceManager.mojom.WebUIProcessInfo} process */
+ /** @param {!discards.mojom.ProcessInfo} process */
constructor(process) {
super(process.id);
- /** @type {!performanceManager.mojom.WebUIProcessInfo} */
+ /** @type {!discards.mojom.ProcessInfo} */
this.process = process;
this.color = this.selectColor(process.id);
@@ -234,7 +234,7 @@ function bounding_force(graph_height) {
}
/**
- * @implements {performanceManager.mojom.WebUIGraphChangeStreamInterface}
+ * @implements {discards.mojom.GraphChangeStreamInterface}
*/
class Graph {
/**
@@ -377,31 +377,31 @@ class Graph {
switch (type) {
case 'frameCreated':
this.frameCreated(
- /** @type {!performanceManager.mojom.WebUIFrameInfo} */ (data));
+ /** @type {!discards.mojom.FrameInfo} */ (data));
break;
case 'pageCreated':
this.pageCreated(
- /** @type {!performanceManager.mojom.WebUIPageInfo} */ (data));
+ /** @type {!discards.mojom.PageInfo} */ (data));
break;
case 'processCreated':
this.processCreated(
- /** @type {!performanceManager.mojom.WebUIProcessInfo} */ (data));
+ /** @type {!discards.mojom.ProcessInfo} */ (data));
break;
case 'frameChanged':
this.frameChanged(
- /** @type {!performanceManager.mojom.WebUIFrameInfo} */ (data));
+ /** @type {!discards.mojom.FrameInfo} */ (data));
break;
case 'pageChanged':
this.pageChanged(
- /** @type {!performanceManager.mojom.WebUIPageInfo} */ (data));
+ /** @type {!discards.mojom.PageInfo} */ (data));
break;
case 'processChanged':
this.processChanged(
- /** @type {!performanceManager.mojom.WebUIProcessInfo} */ (data));
+ /** @type {!discards.mojom.ProcessInfo} */ (data));
break;
case 'favIconDataAvailable':
this.favIconDataAvailable(
- /** @type {!performanceManager.mojom.WebUIFavIconInfo} */ (data));
+ /** @type {!discards.mojom.FavIconInfo} */ (data));
break;
case 'nodeDeleted':
this.nodeDeleted(/** @type {number} */ (data));
diff --git a/chromium/chrome/browser/resources/discards/graph_tab.js b/chromium/chrome/browser/resources/discards/graph_tab.js
index c4538c5718f..1ac3f9b9f34 100644
--- a/chromium/chrome/browser/resources/discards/graph_tab.js
+++ b/chromium/chrome/browser/resources/discards/graph_tab.js
@@ -5,9 +5,9 @@
cr.define('graph_tab', function() {
'use strict';
/**
- * @implements {performanceManager.mojom.WebUIGraphChangeStreamInterface}
+ * @implements {discards.mojom.GraphChangeStreamInterface}
*/
- class WebUIGraphChangeStreamImpl {
+ class DiscardsGraphChangeStreamImpl {
constructor(contentWindow) {
this.contentWindow_ = contentWindow;
}
@@ -62,7 +62,7 @@ cr.define('graph_tab', function() {
}
return {
- WebUIGraphChangeStreamImpl: WebUIGraphChangeStreamImpl,
+ DiscardsGraphChangeStreamImpl: DiscardsGraphChangeStreamImpl,
};
});
@@ -72,20 +72,20 @@ Polymer({
/**
* The Mojo graph data source.
*
- * @private {performanceManager.mojom.WebUIGraphDumpRemote}
+ * @private {discards.mojom.GraphDumpRemote}
*/
graphDump_: null,
/**
* The graph change listener.
*
- * @private {performanceManager.mojom.WebUIGraphChangeStreamInterface}
+ * @private {discards.mojom.GraphChangeStreamInterface}
*/
changeListener_: null,
/** @override */
ready: function() {
- this.graphDump_ = performanceManager.mojom.WebUIGraphDump.getRemote();
+ this.graphDump_ = discards.mojom.GraphDump.getRemote();
},
/** @override */
@@ -97,10 +97,10 @@ Polymer({
/** @private */
onWebViewReady_: function() {
- this.changeListener_ =
- new graph_tab.WebUIGraphChangeStreamImpl(this.$.webView.contentWindow);
- this.client_ = new performanceManager.mojom.WebUIGraphChangeStreamReceiver(
- this.changeListener_);
+ this.changeListener_ = new graph_tab.DiscardsGraphChangeStreamImpl(
+ this.$.webView.contentWindow);
+ this.client_ =
+ new discards.mojom.GraphChangeStreamReceiver(this.changeListener_);
// Save helper to work around closure compiler bug: https://crbug.com/969212
const helper = this.client_.$;
diff --git a/chromium/chrome/browser/resources/discards/mojo_api.html b/chromium/chrome/browser/resources/discards/mojo_api.html
index 2dd0baa6b43..fa352178ff6 100644
--- a/chromium/chrome/browser/resources/discards/mojo_api.html
+++ b/chromium/chrome/browser/resources/discards/mojo_api.html
@@ -11,4 +11,3 @@ found in the LICENSE file.
src="chrome/browser/resource_coordinator/lifecycle_unit_state.mojom-lite.js">
</script>
<script src="chrome/browser/ui/webui/discards/discards.mojom-lite.js"></script>
-<script src="mojom/webui_graph_dump.mojom-lite.js"></script>
diff --git a/chromium/chrome/browser/resources/download_internals/BUILD.gn b/chromium/chrome/browser/resources/download_internals/BUILD.gn
index e1314cfd5de..1d0ff828cdb 100644
--- a/chromium/chrome/browser/resources/download_internals/BUILD.gn
+++ b/chromium/chrome/browser/resources/download_internals/BUILD.gn
@@ -15,6 +15,7 @@ js_type_check("closure_compile") {
js_library("download_internals") {
deps = [
":download_internals_browser_proxy",
+ "//third_party/jstemplate:jstemplate",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
"//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 62b2d8c3794..9c60f4f637b 100644
--- a/chromium/chrome/browser/resources/download_internals/download_internals.html
+++ b/chromium/chrome/browser/resources/download_internals/download_internals.html
@@ -4,14 +4,12 @@
<meta charset="utf-8">
<title>Download Internals</title>
<meta name="viewport" content="width=device-width">
- <link rel="stylesheet" href="chrome://resources/css/list.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
<link rel="stylesheet" href="download_internals.css">
- <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/util.html">
+ <script src="chrome://resources/js/promise_resolver.js"></script>
+ <script src="chrome://resources/js/cr.js"></script>
+ <script src="chrome://resources/js/util.js"></script>
<script src="download_internals_browser_proxy.js"></script>
<script src="download_internals.js"></script>
diff --git a/chromium/chrome/browser/resources/downloads/BUILD.gn b/chromium/chrome/browser/resources/downloads/BUILD.gn
index eb003e5f9e1..7fceff2e48b 100644
--- a/chromium/chrome/browser/resources/downloads/BUILD.gn
+++ b/chromium/chrome/browser/resources/downloads/BUILD.gn
@@ -118,6 +118,7 @@ js_library("item") {
"//ui/webui/resources/js/cr/ui:focus_row_behavior",
"//ui/webui/resources/js/cr/ui:focus_without_ink",
]
+ externs_list = [ "$externs_path/pending_polymer.js" ]
}
js_library("manager") {
diff --git a/chromium/chrome/browser/resources/downloads/item.html b/chromium/chrome/browser/resources/downloads/item.html
index 16252c86252..cd2f60d97f3 100644
--- a/chromium/chrome/browser/resources/downloads/item.html
+++ b/chromium/chrome/browser/resources/downloads/item.html
@@ -295,7 +295,7 @@
}
</style>
- <div id="date">[[computeDate_(data.hideDate,
+ <div id="date" role="heading" aria-level="2">[[computeDate_(data.hideDate,
data.sinceString,
data.dateString)]]</div>
diff --git a/chromium/chrome/browser/resources/extensions/BUILD.gn b/chromium/chrome/browser/resources/extensions/BUILD.gn
index 1798f6238a7..734470fdaf4 100644
--- a/chromium/chrome/browser/resources/extensions/BUILD.gn
+++ b/chromium/chrome/browser/resources/extensions/BUILD.gn
@@ -7,46 +7,48 @@ import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("../optimize_webui.gni")
-extensions_pak_file = "extensions_resources.pak"
-unpak_folder = "extensions_resources.unpak"
-
-optimize_webui("build") {
- host = "extensions"
- html_in_files = [ "extensions.html" ]
- html_out_files = [ "vulcanized.html" ]
- insert_in_head = "<base href=\"chrome://extensions\">"
- input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir)
- js_out_files = [ "crisper.js" ]
- replace_for_html_imports_polyfill = "crisper.js"
-
- deps = [
- ":unpak",
- ]
-}
-
-unpak("unpak") {
- pak_file = extensions_pak_file
- out_folder = unpak_folder
-
- deps = [
- ":flattened_resources",
- ]
-}
-
-grit("flattened_resources") {
- source = "extensions_resources.grd"
-
- # The .grd contains references to generated files.
- source_is_generated = true
-
- defines = chrome_grit_defines
- outputs = [
- "grit/extensions_resources.h",
- "grit/extensions_resources_map.cc",
- "grit/extensions_resources_map.h",
- extensions_pak_file,
- ]
- output_dir = "$root_gen_dir/chrome/browser/resources/extensions"
+if (optimize_webui) {
+ extensions_pak_file = "extensions_resources.pak"
+ unpak_folder = "extensions_resources.unpak"
+
+ optimize_webui("build") {
+ host = "extensions"
+ html_in_files = [ "extensions.html" ]
+ html_out_files = [ "vulcanized.html" ]
+ insert_in_head = "<base href=\"chrome://extensions\">"
+ input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir)
+ js_out_files = [ "crisper.js" ]
+ replace_for_html_imports_polyfill = "crisper.js"
+
+ deps = [
+ ":unpak",
+ ]
+ }
+
+ unpak("unpak") {
+ pak_file = extensions_pak_file
+ out_folder = unpak_folder
+
+ deps = [
+ ":flattened_resources",
+ ]
+ }
+
+ grit("flattened_resources") {
+ source = "extensions_resources.grd"
+
+ # The .grd contains references to generated files.
+ source_is_generated = true
+
+ defines = chrome_grit_defines
+ outputs = [
+ "grit/extensions_resources.h",
+ "grit/extensions_resources_map.cc",
+ "grit/extensions_resources_map.h",
+ extensions_pak_file,
+ ]
+ output_dir = "$root_gen_dir/chrome/browser/resources/extensions"
+ }
}
group("closure_compile") {
@@ -69,6 +71,7 @@ js_type_check("extensions_resources") {
":item_behavior",
":item_list",
":item_util",
+ ":keyboard_shortcut_delegate",
":keyboard_shortcuts",
":kiosk_browser_proxy",
":kiosk_dialog",
@@ -207,9 +210,17 @@ js_library("item_util") {
externs_list = [ "$externs_path/developer_private.js" ]
}
+js_library("keyboard_shortcut_delegate") {
+ deps = [
+ "//ui/webui/resources/js:cr",
+ ]
+ externs_list = [ "$externs_path/developer_private.js" ]
+}
+
js_library("keyboard_shortcuts") {
deps = [
":item_behavior",
+ ":keyboard_shortcut_delegate",
"//ui/webui/resources/cr_elements:cr_container_shadow_behavior",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
@@ -324,6 +335,7 @@ js_library("service") {
deps = [
":error_page",
":item",
+ ":keyboard_shortcut_delegate",
":load_error",
":navigation_helper",
":pack_dialog",
@@ -345,6 +357,7 @@ js_library("service") {
js_library("shortcut_input") {
deps = [
+ ":keyboard_shortcut_delegate",
":shortcut_util",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
diff --git a/chromium/chrome/browser/resources/extensions/detail_view.html b/chromium/chrome/browser/resources/extensions/detail_view.html
index df4e5baf623..23cdc7bc32e 100644
--- a/chromium/chrome/browser/resources/extensions/detail_view.html
+++ b/chromium/chrome/browser/resources/extensions/detail_view.html
@@ -178,7 +178,9 @@
data.type,
'$i18nPolymer{appIcon}',
'$i18nPolymer{extensionIcon}')]]">
- <span id="name" class="cr-title-text">[[data.name]]</span>
+ <span id="name" class="cr-title-text" role="heading" aria-level="1">
+ [[data.name]]
+ </span>
</div>
<div class="section continuation control-line" id="enable-section">
<span class$="[[computeEnabledStyle_(data.state)]]">
@@ -258,17 +260,23 @@
</div>
</div>
<div class="section continuation block">
- <div class="section-title">$i18n{itemDescriptionLabel}</div>
+ <div class="section-title" role="heading" aria-level="2">
+ $i18n{itemDescriptionLabel}
+ </div>
<div class="section-content" id="description">
[[getDescription_(data.description, '$i18nPolymer{noDescription}')]]
</div>
</div>
<div class="section block">
- <div class="section-title">$i18n{itemVersion}</div>
+ <div class="section-title" role="heading" aria-level="2">
+ $i18n{itemVersion}
+ </div>
<div class="section-content">[[data.version]]</div>
</div>
<div class="section block">
- <div class="section-title">$i18n{itemSize}</div>
+ <div class="section-title" role="heading" aria-level="2">
+ $i18n{itemSize}
+ </div>
<div class="section-content" id="size">
<span>[[size_]]</span>
<paper-spinner-lite active="[[!size_]]" hidden="[[size_]]">
@@ -276,12 +284,16 @@
</div>
</div>
<div class="section block" id="id-section" hidden$="[[!inDevMode]]">
- <div class="section-title">$i18n{itemIdHeading}</div>
+ <div class="section-title" role="heading" aria-level="2">
+ $i18n{itemIdHeading}
+ </div>
<div class="section-content">[[data.id]]</div>
</div>
<template is="dom-if" if="[[inDevMode]]">
<div class="section block" id="inspectable-views">
- <div class="section-title">$i18n{itemInspectViews}</div>
+ <div class="section-title" role="heading" aria-level="2">
+ $i18n{itemInspectViews}
+ </div>
<div class="section-content">
<ul id="inspect-views">
<li hidden="[[data.views.length]]">
@@ -300,7 +312,9 @@
</div>
</template>
<div class="section block">
- <div class="section-title">$i18n{itemPermissions}</div>
+ <div class="section-title" role="heading" aria-level="2">
+ $i18n{itemPermissions}
+ </div>
<div class="section-content">
<span id="no-permissions" hidden$="[[hasPermissions_(data.*)]]">
$i18n{itemPermissionsEmpty}
@@ -322,7 +336,9 @@
</div>
</div>
<div class="section block">
- <div class="section-title">$i18n{itemSiteAccess}</div>
+ <div class="section-title" role="heading" aria-level="2">
+ $i18n{itemSiteAccess}
+ </div>
<div class="section-content">
<span id="no-site-access"
hidden$="[[showSiteAccessContent_(data.*)]]">
@@ -349,7 +365,9 @@
<template is="dom-if"
if="[[hasDependentExtensions_(data.dependentExtensions.splices)]]">
<div class="section block">
- <div class="section-title">$i18n{itemDependencies}</div>
+ <div class="section-title" role="heading" aria-level="2">
+ $i18n{itemDependencies}
+ </div>
<div class="section-content">
<ul id="dependent-extensions-list">
<template is="dom-repeat" items="[[data.dependentExtensions]]">
@@ -405,7 +423,9 @@
id="viewInStore" label="$i18n{viewInStore}"
on-click="onViewInStoreTap_" external></cr-link-row>
<div class="section block">
- <div class="section-title">$i18n{itemSource}</div>
+ <div class="section-title" role="heading" aria-level="2">
+ $i18n{itemSource}
+ </div>
<div id="source" class="section-content">
[[computeSourceString_(data.*)]]
</div>
diff --git a/chromium/chrome/browser/resources/extensions/extensions.html b/chromium/chrome/browser/resources/extensions/extensions.html
index 83ea4fe724a..832434023d9 100644
--- a/chromium/chrome/browser/resources/extensions/extensions.html
+++ b/chromium/chrome/browser/resources/extensions/extensions.html
@@ -61,6 +61,6 @@
</script>
<extensions-manager></extensions-manager>
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
- <link rel="import" href="chrome://extensions/manager.html">
+ <link rel="import" href="manager.html">
</body>
</html>
diff --git a/chromium/chrome/browser/resources/extensions/extensions_resources.grd b/chromium/chrome/browser/resources/extensions/extensions_resources.grd
index 1bb6baea7c5..9201c338087 100644
--- a/chromium/chrome/browser/resources/extensions/extensions_resources.grd
+++ b/chromium/chrome/browser/resources/extensions/extensions_resources.grd
@@ -85,6 +85,12 @@
<structure name="IDR_EXTENSIONS_ERROR_PAGE_JS"
file="error_page.js"
type="chrome_html" />
+ <structure name="IDR_EXTENSIONS_KEYBOARD_SHORTCUT_DELEGATE_HTML"
+ file="keyboard_shortcut_delegate.html"
+ type="chrome_html" />
+ <structure name="IDR_EXTENSIONS_KEYBOARD_SHORTCUT_DELEGATE_JS"
+ file="keyboard_shortcut_delegate.js"
+ type="chrome_html" />
<structure name="IDR_EXTENSIONS_KEYBOARD_SHORTCUTS_HTML"
file="keyboard_shortcuts.html"
type="chrome_html" />
diff --git a/chromium/chrome/browser/resources/extensions/keyboard_shortcut_delegate.html b/chromium/chrome/browser/resources/extensions/keyboard_shortcut_delegate.html
new file mode 100644
index 00000000000..bb851cf9c59
--- /dev/null
+++ b/chromium/chrome/browser/resources/extensions/keyboard_shortcut_delegate.html
@@ -0,0 +1 @@
+<script src="keyboard_shortcut_delegate.js"></script>
diff --git a/chromium/chrome/browser/resources/extensions/keyboard_shortcut_delegate.js b/chromium/chrome/browser/resources/extensions/keyboard_shortcut_delegate.js
new file mode 100644
index 00000000000..d83e47926d3
--- /dev/null
+++ b/chromium/chrome/browser/resources/extensions/keyboard_shortcut_delegate.js
@@ -0,0 +1,41 @@
+// 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.
+
+cr.define('extensions', function() {
+ 'use strict';
+
+ /** @interface */
+ class KeyboardShortcutDelegate {
+ /**
+ * Called when shortcut capturing changes in order to suspend or re-enable
+ * global shortcut handling. This is important so that the shortcuts aren't
+ * processed normally as the user types them.
+ * TODO(devlin): From very brief experimentation, it looks like preventing
+ * the default handling on the event also does this. Investigate more in the
+ * future.
+ * @param {boolean} isCapturing
+ */
+ setShortcutHandlingSuspended(isCapturing) {}
+
+ /**
+ * Updates an extension command's keybinding.
+ * @param {string} extensionId
+ * @param {string} commandName
+ * @param {string} keybinding
+ */
+ updateExtensionCommandKeybinding(extensionId, commandName, keybinding) {}
+
+ /**
+ * Updates an extension command's scope.
+ * @param {string} extensionId
+ * @param {string} commandName
+ * @param {chrome.developerPrivate.CommandScope} scope
+ */
+ updateExtensionCommandScope(extensionId, commandName, scope) {}
+ }
+
+ return {
+ KeyboardShortcutDelegate: KeyboardShortcutDelegate,
+ };
+});
diff --git a/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.html b/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.html
index 73968d69f68..cc985093d80 100644
--- a/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.html
+++ b/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.html
@@ -7,6 +7,7 @@
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="item_behavior.html">
+<link rel="import" href="keyboard_shortcut_delegate.html">
<link rel="import" href="shortcut_input.html">
<dom-module id="extensions-keyboard-shortcuts">
diff --git a/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.js b/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.js
index c740d566ea3..f0716526957 100644
--- a/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.js
+++ b/chromium/chrome/browser/resources/extensions/keyboard_shortcuts.js
@@ -5,36 +5,6 @@
cr.define('extensions', function() {
'use strict';
- /** @interface */
- class KeyboardShortcutDelegate {
- /**
- * Called when shortcut capturing changes in order to suspend or re-enable
- * global shortcut handling. This is important so that the shortcuts aren't
- * processed normally as the user types them.
- * TODO(devlin): From very brief experimentation, it looks like preventing
- * the default handling on the event also does this. Investigate more in the
- * future.
- * @param {boolean} isCapturing
- */
- setShortcutHandlingSuspended(isCapturing) {}
-
- /**
- * Updates an extension command's keybinding.
- * @param {string} extensionId
- * @param {string} commandName
- * @param {string} keybinding
- */
- updateExtensionCommandKeybinding(extensionId, commandName, keybinding) {}
-
- /**
- * Updates an extension command's scope.
- * @param {string} extensionId
- * @param {string} commandName
- * @param {chrome.developerPrivate.CommandScope} scope
- */
- updateExtensionCommandScope(extensionId, commandName, scope) {}
- }
-
// The UI to display and manage keyboard shortcuts set for extension commands.
const KeyboardShortcuts = Polymer({
is: 'extensions-keyboard-shortcuts',
@@ -127,7 +97,6 @@ cr.define('extensions', function() {
});
return {
- KeyboardShortcutDelegate: KeyboardShortcutDelegate,
KeyboardShortcuts: KeyboardShortcuts,
};
});
diff --git a/chromium/chrome/browser/resources/extensions/toolbar.html b/chromium/chrome/browser/resources/extensions/toolbar.html
index 9b8706bd762..38cf1124e61 100644
--- a/chromium/chrome/browser/resources/extensions/toolbar.html
+++ b/chromium/chrome/browser/resources/extensions/toolbar.html
@@ -97,10 +97,11 @@
narrow-threshold="1000">
<div class="more-actions">
<span id="devModeLabel">$i18n{toolbarDevMode}</span>
- <cr-tooltip-icon hidden$="[[!devModeControlledByPolicy]]"
- tooltip-text="$i18n{controlledSettingPolicy}"
- icon-class="cr20:domain"
- icon-aria-label="$i18n{controlledSettingPolicy}">
+ <cr-tooltip-icon hidden="[[!shouldDisableDevMode_(
+ devModeControlledByPolicy, isSupervised)]]"
+ tooltip-text="[[getTooltipText_(isSupervised)]]"
+ icon-class="[[getIcon_(isSupervised)]]"
+ icon-aria-label="[[getTooltipText_(isSupervised)]]">
</cr-tooltip-icon>
<cr-toggle id="devMode" on-change="onDevModeToggleChange_"
disabled="[[shouldDisableDevMode_(
diff --git a/chromium/chrome/browser/resources/extensions/toolbar.js b/chromium/chrome/browser/resources/extensions/toolbar.js
index bd3590edcba..228cc45667d 100644
--- a/chromium/chrome/browser/resources/extensions/toolbar.js
+++ b/chromium/chrome/browser/resources/extensions/toolbar.js
@@ -76,6 +76,24 @@ cr.define('extensions', function() {
},
/**
+ * @return {string}
+ * @private
+ */
+ getTooltipText_: function() {
+ return this.i18n(
+ this.isSupervised ? 'controlledSettingChildRestriction' :
+ 'controlledSettingPolicy');
+ },
+
+ /**
+ * @return {string}
+ * @private
+ */
+ getIcon_: function() {
+ return this.isSupervised ? 'cr20:kite' : 'cr20:domain';
+ },
+
+ /**
* @param {!CustomEvent<boolean>} e
* @private
*/
diff --git a/chromium/chrome/browser/resources/feedback/html/default.html b/chromium/chrome/browser/resources/feedback/html/default.html
index 4443627fb7e..c2e2f2782b5 100644
--- a/chromium/chrome/browser/resources/feedback/html/default.html
+++ b/chromium/chrome/browser/resources/feedback/html/default.html
@@ -47,13 +47,14 @@
<!-- Attach a file -->
<div id="attach-file-container" class="text-field-container">
<label id="attach-file-label" i18n-content="attach-file-label"></label>
- <input id="attach-file" type="file" aria-labelledby="attach-file-label">
+ <input id="attach-file" type="file" aria-labelledby="attach-file-label"
+ aria-describedby="attach-file-note">
<div id="custom-file-container" hidden>
<label id="attached-filename-text"></label>
<button id="remove-attached-file" class="remove-file-button"></button>
</div>
<div id="attach-error" class="attach-file-notification"
- i18n-content="attach-file-to-big" hidden></div>
+ role="alert" i18n-content="attach-file-to-big" hidden></div>
</div>
<div id="attach-file-note" i18n-content="attach-file-note"></div>
<!-- Screenshot -->
diff --git a/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js b/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
index 7161b0893c1..6881172f6dc 100644
--- a/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
+++ b/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
@@ -241,6 +241,7 @@ cr.define('cr.login', function() {
this.confirmPasswordCallback = null;
this.noPasswordCallback = null;
+ this.onePasswordCallback = null;
this.insecureContentBlockedCallback = null;
this.samlApiUsedCallback = null;
this.missingGaiaInfoCallback = null;
@@ -848,7 +849,9 @@ cr.define('cr.login', function() {
if (this.samlHandler_.samlApiUsed) {
if (this.samlApiUsedCallback) {
- this.samlApiUsedCallback();
+ // Makes distinction between Gaia and Chrome Credentials Passing API
+ // login to properly fill ChromeOS.SAML.ApiLogin metrics.
+ this.samlApiUsedCallback(this.authFlow == AuthFlow.SAML);
}
this.password_ = this.samlHandler_.apiPasswordBytes;
this.onAuthCompleted_();
@@ -870,6 +873,9 @@ cr.define('cr.login', function() {
// If we scraped exactly one password, we complete the
// authentication right away.
this.password_ = this.samlHandler_.firstScrapedPassword;
+ if (this.onePasswordCallback) {
+ this.onePasswordCallback();
+ }
this.onAuthCompleted_();
return;
}
@@ -888,8 +894,8 @@ cr.define('cr.login', function() {
/**
* Invoked to complete the authentication using the password the user
- * enters manually for non-principals API SAML IdPs that we couldn't
- * scrape their password input.
+ * enters manually for SAML IdPs that do not use Chrome Credentials Passing
+ * API and we couldn't scrape their password input.
*/
completeAuthWithManualPassword(password) {
this.password_ = password;
diff --git a/chromium/chrome/browser/resources/gaia_auth_host/okta_detect_success_injected.js b/chromium/chrome/browser/resources/gaia_auth_host/okta_detect_success_injected.js
new file mode 100644
index 00000000000..d2b13e7c2bc
--- /dev/null
+++ b/chromium/chrome/browser/resources/gaia_auth_host/okta_detect_success_injected.js
@@ -0,0 +1,58 @@
+// 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.
+
+/**
+ * Intercept Ajax responses, detect responses to the password-change endpoint
+ * that don't contain any errors.
+ */
+(function() {
+function oktaDetectSuccess() {
+ const PARENT_ORIGIN = 'chrome://password-change';
+
+ let messageFromParent;
+ function onMessageReceived(event) {
+ if (event.origin == PARENT_ORIGIN) {
+ messageFromParent = event;
+ }
+ }
+ window.addEventListener('message', onMessageReceived, false);
+
+ function checkResponse(responseUrl, responseData) {
+ if (responseUrl.includes('/internal_login/password') &&
+ !responseData.match(/"has[A-Za-z]*Errors":true/)) {
+ console.info('passwordChangeSuccess');
+ messageFromParent.source.postMessage(
+ 'passwordChangeSuccess', PARENT_ORIGIN);
+ }
+ }
+
+ const proxied = window.XMLHttpRequest.prototype.send;
+
+ window.XMLHttpRequest.prototype.send = function() {
+ this.addEventListener('load', function() {
+ checkResponse(this.responseURL, this.response);
+ });
+ return proxied.apply(this, arguments);
+ };
+}
+
+/** Run a script in the window context - not isolated as a content-script. */
+function runInPageContext(jsFn) {
+ const script = document.createElement('script');
+ script.type = 'text/javascript';
+ script.innerHTML = '(' + jsFn + ')();';
+ document.head.prepend(script);
+}
+
+/** Wait until DOM is loaded, then run oktaDetectSuccess script. */
+function initialize() {
+ if (document.body && document.head) {
+ console.info('initialize');
+ runInPageContext(oktaDetectSuccess);
+ } else {
+ requestIdleCallback(initialize);
+ }
+}
+requestIdleCallback(initialize);
+})();
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
index 0f5fa464c5f..7854c1b20cb 100644
--- a/chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js
+++ b/chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js
@@ -12,9 +12,105 @@
cr.define('cr.samlPasswordChange', function() {
'use strict';
+ /** @const */
+ const oktaInjectedScriptName = 'oktaInjected';
+
+ /**
+ * The script to inject into Okta user settings page.
+ * @type {string}
+ */
+ const oktaInjectedJs = String.raw`
+ // <include src="okta_detect_success_injected.js">
+ `;
+
const BLANK_PAGE_URL = 'about:blank';
/**
+ * The different providers of password-change pages that we support, or are
+ * working on supporting.
+ * @enum {number}
+ */
+ const PasswordChangePageProvider = {
+ UNKNOWN: 0,
+ ADFS: 1,
+ AZURE: 2,
+ OKTA: 3,
+ PING: 4,
+ };
+
+ /**
+ * @param {URL?} url The url of the webpage that is being interacted with.
+ * @return {PasswordChangePageProvider} The provider of the password change
+ * page, as detected based on the URL.
+ */
+ function detectProvider_(url) {
+ if (!url) {
+ return null;
+ }
+ if (url.pathname.match(/\/updatepassword\/?$/)) {
+ return PasswordChangePageProvider.ADFS;
+ }
+ if (url.pathname.endsWith('/ChangePassword.aspx')) {
+ return PasswordChangePageProvider.AZURE;
+ }
+ if (url.host.match(/\.okta\.com$/)) {
+ return PasswordChangePageProvider.OKTA;
+ }
+ if (url.pathname.match('/password/chg/')) {
+ return PasswordChangePageProvider.PING;
+ }
+ return PasswordChangePageProvider.UNKNOWN;
+ }
+
+ /**
+ * @param {string?} str A string that should be a valid URL.
+ * @return {URL?} A valid URL object, or null.
+ */
+ function safeParseUrl_(str) {
+ try {
+ return new URL(str);
+ } catch (error) {
+ console.error('Invalid url: ' + str);
+ return null;
+ }
+ }
+
+ /**
+ * @param {Object} details The web-request details.
+ * @return {boolean} True if we detect that a password change was successful.
+ */
+ function detectPasswordChangeSuccess(details) {
+ const url = safeParseUrl_(details.url);
+ if (!url) {
+ return false;
+ }
+
+ // We count it as a success whenever "status=0" is in the query params.
+ // This is what we use for ADFS, but for now, we allow it for every IdP, so
+ // that an otherwise unsupported IdP can also send it as a success message.
+ // TODO(https://crbug.com/930109): Consider removing this entirely, or,
+ // using a more self-documenting parameter like 'passwordChanged=1'.
+ if (url.searchParams.get('status') == '0') {
+ return true;
+ }
+
+ const pageProvider = detectProvider_(url);
+ // These heuristics work for the following SAML IdPs:
+ if (pageProvider == PasswordChangePageProvider.ADFS) {
+ return url.searchParams.get('status') == '0';
+ }
+ if (pageProvider == PasswordChangePageProvider.AZURE) {
+ return url.searchParams.get('ReturnCode') == '0';
+ }
+
+ // We can't currently detect success for Okta or Ping just by inspecting the
+ // URL or even response headers. To inspect the response body, we need
+ // to inject scripts onto their page (see okta_detect_success_injected.js).
+
+ return false;
+ }
+
+ /**
* Initializes the authenticator component.
*/
class Authenticator extends cr.EventTarget {
@@ -67,8 +163,27 @@ cr.define('cr.samlPasswordChange', function() {
this.samlHandler_, 'authPageLoaded',
this.onAuthPageLoaded_.bind(this));
+ // Listen for completed main-frame requests to check for password-change
+ // success.
+ this.webviewEventManager_.addWebRequestEventListener(
+ this.webview_.request.onCompleted,
+ this.onCompleted_.bind(this),
+ {urls: ['*://*/*'], types: ['main_frame']},
+ );
+
+ // Inject a custom script for detecting password change success in Okta.
+ this.webview_.addContentScripts([{
+ name: oktaInjectedScriptName,
+ matches: ['*://*.okta.com/*'],
+ js: {code: oktaInjectedJs},
+ all_frames: true,
+ run_at: 'document_start'
+ }]);
+
+ // Okta-detect-success-inject script signals success by posting a message
+ // that says "passwordChangeSuccess", which we listen for:
this.webviewEventManager_.addEventListener(
- this.webview_, 'contentload', this.onContentLoad_.bind(this));
+ window, 'message', this.onMessageReceived_.bind(this));
}
/**
@@ -129,7 +244,7 @@ cr.define('cr.samlPasswordChange', function() {
* Sends scraped password and resets the state.
* @private
*/
- completeAuth_() {
+ onPasswordChangeSuccess_() {
const passwordsOnce = this.samlHandler_.getPasswordsScrapedTimes(1);
const passwordsTwice = this.samlHandler_.getPasswordsScrapedTimes(2);
@@ -151,17 +266,43 @@ cr.define('cr.samlPasswordChange', function() {
}
/**
- * Invoked when a new document is loaded.
+ * Invoked when a new document loading completes.
+ * @param {Object} details The web-request details.
* @private
*/
- onContentLoad_(e) {
- const currentUrl = this.webview_.src;
- // TODO(rsorokin): Implement more robust check.
- if (currentUrl.lastIndexOf('status=0') != -1) {
- this.completeAuth_();
+ onCompleted_(details) {
+ if (detectPasswordChangeSuccess(details)) {
+ this.onPasswordChangeSuccess_();
+ }
+
+ // Okta_detect_success_injected.js needs to be contacted by the parent,
+ // so that it can send messages back to the parent.
+ const pageProvider = detectProvider_(safeParseUrl_(details.url));
+ if (pageProvider == PasswordChangePageProvider.OKTA) {
+ // Using setTimeout gives the page time to finish initializing.
+ setTimeout(() => {
+ this.webview_.contentWindow.postMessage('connect', details.url);
+ }, 1000);
+ }
+ }
+
+ /**
+ * Invoked when the webview posts a message.
+ * @param {Object} event The message event.
+ * @private
+ */
+ onMessageReceived_(event) {
+ if (event.data == 'passwordChangeSuccess') {
+ const pageProvider = detectProvider_(safeParseUrl_(event.origin));
+ if (pageProvider == PasswordChangePageProvider.OKTA) {
+ this.onPasswordChangeSuccess_();
+ }
}
}
}
- return {Authenticator: Authenticator};
+ return {
+ Authenticator: Authenticator,
+ detectPasswordChangeSuccess: detectPasswordChangeSuccess,
+ };
});
diff --git a/chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator_test.unitjs b/chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator_test.unitjs
new file mode 100644
index 00000000000..617677b55ee
--- /dev/null
+++ b/chromium/chrome/browser/resources/gaia_auth_host/password_change_authenticator_test.unitjs
@@ -0,0 +1,76 @@
+// 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.
+
+GEN_INCLUDE(['//ui/webui/resources/js/cr.js']);
+
+const EXAMPLE_ADFS_ENDPOINT =
+ 'https://example.com/adfs/portal/updatepassword/';
+
+const EXAMPLE_AZURE_ENDPOINT =
+ 'https://example.windowsazure.com/ChangePassword.aspx';
+
+const EXAMPLE_OKTA_ENDPOINT =
+ 'https://example.okta.com/user/profile/internal_login/password';
+
+const EXAMPLE_PING_ENDPOINT =
+ 'https://login.pingone.com/idp/directory/a/12345/password/chg/67890';
+
+PasswordChangeAuthenticatorUnitTest = class extends testing.Test {
+ get browsePreload() {
+ return DUMMY_URL;
+ }
+
+ // No need to run these checks - see comment in SamlPasswordAttributesTest.
+ get runAccessibilityChecks() {
+ return false;
+ }
+
+ get extraLibraries() {
+ return [
+ '//ui/webui/resources/js/cr/event_target.js',
+ 'password_change_authenticator.js',
+ ];
+ }
+
+ assertSuccess(details) {
+ assertTrue(this.detectSuccess(details));
+ }
+
+ assertNotSuccess(details, responseData) {
+ assertFalse(this.detectSuccess(details));
+ }
+
+ detectSuccess(details) {
+ if (typeof details == 'string') {
+ details = {'url': details};
+ }
+ return cr.samlPasswordChange.detectPasswordChangeSuccess(details);
+ }
+}
+
+TEST_F('PasswordChangeAuthenticatorUnitTest', 'DetectAdfsSuccess', function() {
+ const endpointUrl = EXAMPLE_ADFS_ENDPOINT;
+
+ this.assertNotSuccess(endpointUrl);
+ this.assertNotSuccess(endpointUrl + '?status=1');
+ this.assertSuccess(endpointUrl + '?status=0');
+
+ // We allow "status=0" to count as success everywhere right now, but this
+ // should be narrowed down to ADFS - see the TODO in the code.
+ this.assertSuccess(EXAMPLE_AZURE_ENDPOINT + '?status=0');
+});
+
+TEST_F('PasswordChangeAuthenticatorUnitTest', 'DetectAzureSuccess', function() {
+ const endpointUrl = EXAMPLE_AZURE_ENDPOINT;
+ const extraParam = 'BrandContextID=O123';
+
+ this.assertNotSuccess(endpointUrl);
+ this.assertNotSuccess(endpointUrl + '?' + extraParam);
+ this.assertNotSuccess(endpointUrl + '?ReturnCode=1&' + extraParam);
+ this.assertNotSuccess(endpointUrl + '?' + extraParam + '&ReturnCode=1');
+ this.assertNotSuccess(EXAMPLE_PING_ENDPOINT + '?ReturnCode=0');
+
+ this.assertSuccess(endpointUrl + '?ReturnCode=0&' + extraParam);
+ this.assertSuccess(endpointUrl + '?' + extraParam + '&ReturnCode=0');
+}); \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/hangout_services/OWNERS b/chromium/chrome/browser/resources/hangout_services/OWNERS
index db6c6c297e3..f283b346811 100644
--- a/chromium/chrome/browser/resources/hangout_services/OWNERS
+++ b/chromium/chrome/browser/resources/hangout_services/OWNERS
@@ -1,2 +1,2 @@
-bemasc@chromium.org
+eladalon@chromium.org
grunell@chromium.org
diff --git a/chromium/chrome/browser/resources/hats/hats.html b/chromium/chrome/browser/resources/hats/hats.html
index 18ec74d79e5..9c17d2a6fa8 100644
--- a/chromium/chrome/browser/resources/hats/hats.html
+++ b/chromium/chrome/browser/resources/hats/hats.html
@@ -16,6 +16,13 @@
/* Needs to override dynamically loaded, more specific styles. */
outline-color: rgb(77, 144, 254) !important;
}
+ /* Make sure scroll bars are added only when necessary, the overriden
+ * value is 'scroll' which causes scroll bars always show.
+ * TODO(weili): Remove this once the overriden value changed to auto.
+ */
+ #t402-prompt.t402-prompt-websat-modal {
+ overflow: auto !important;
+ }
</style>
<script>
/**
diff --git a/chromium/chrome/browser/resources/history/BUILD.gn b/chromium/chrome/browser/resources/history/BUILD.gn
index 7bf036c5332..042656ba371 100644
--- a/chromium/chrome/browser/resources/history/BUILD.gn
+++ b/chromium/chrome/browser/resources/history/BUILD.gn
@@ -87,6 +87,7 @@ js_library("history_list") {
"//third_party/polymer/v1_0/components-chromium/iron-scroll-threshold:iron-scroll-threshold-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/js:i18n_behavior",
"//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:util",
]
diff --git a/chromium/chrome/browser/resources/history/history_list.html b/chromium/chrome/browser/resources/history/history_list.html
index cbd4f20d146..01e555cf217 100644
--- a/chromium/chrome/browser/resources/history/history_list.html
+++ b/chromium/chrome/browser/resources/history/history_list.html
@@ -2,6 +2,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
+<link rel="import" href="chrome://resources/html/i18n_behavior.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/iron-list/iron-list.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-scroll-threshold/iron-scroll-threshold.html">
diff --git a/chromium/chrome/browser/resources/history/history_list.js b/chromium/chrome/browser/resources/history/history_list.js
index 18805d54ef2..35b256e2fab 100644
--- a/chromium/chrome/browser/resources/history/history_list.js
+++ b/chromium/chrome/browser/resources/history/history_list.js
@@ -5,6 +5,8 @@
Polymer({
is: 'history-list',
+ behaviors: [I18nBehavior],
+
properties: {
// The search term for the current query. Set when the query returns.
searchedTerm: {
@@ -60,6 +62,10 @@ Polymer({
actionMenuModel_: Object,
},
+ hostAttributes: {
+ role: 'application',
+ },
+
listeners: {
'history-checkbox-select': 'onItemSelected_',
'open-menu': 'onOpenMenu_',
@@ -74,6 +80,7 @@ Polymer({
/** @type {IronListElement} */ (this.$['infinite-list']).notifyResize();
this.$['infinite-list'].scrollTarget = this;
this.$['scroll-threshold'].scrollTarget = this;
+ this.setAttribute('aria-roledescription', this.i18n('ariaRoleDescription'));
},
/////////////////////////////////////////////////////////////////////////////
diff --git a/chromium/chrome/browser/resources/identity_internals/identity_internals.js b/chromium/chrome/browser/resources/identity_internals/identity_internals.js
index 23cb35553cf..76de89b9d71 100644
--- a/chromium/chrome/browser/resources/identity_internals/identity_internals.js
+++ b/chromium/chrome/browser/resources/identity_internals/identity_internals.js
@@ -11,7 +11,7 @@ cr.define('identity_internals', function() {
* @constructor
*/
function TokenListItem(tokenInfo) {
- const el = cr.doc.createElement('div');
+ const el = document.createElement('div');
el.data_ = tokenInfo;
el.__proto__ = TokenListItem.prototype;
el.decorate();
diff --git a/chromium/chrome/browser/resources/inline_login/inline_login.html b/chromium/chrome/browser/resources/inline_login/inline_login.html
index 3bc61db7ddc..ba073cef263 100644
--- a/chromium/chrome/browser/resources/inline_login/inline_login.html
+++ b/chromium/chrome/browser/resources/inline_login/inline_login.html
@@ -1,6 +1,7 @@
<!doctype html>
<html dir="$i18n{textdirection}" lang="$i18n{language}">
<head>
+ <meta charset="utf-8">
<title>$i18n{title}</title>
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
diff --git a/chromium/chrome/browser/resources/local_ntp/customize.css b/chromium/chrome/browser/resources/local_ntp/customize.css
index ec345861118..b860452291c 100644
--- a/chromium/chrome/browser/resources/local_ntp/customize.css
+++ b/chromium/chrome/browser/resources/local_ntp/customize.css
@@ -665,8 +665,7 @@ html[dir=rtl] .selected-check {
color: white;
font-weight: 500;
left: 16px;
- max-width: 80%;
- padding: 8px 8px 8px 8px;
+ padding: 8px;
position: fixed;
text-shadow: 0 0 16px rgba(0, 0, 0, .3);
z-index: -1;
@@ -678,18 +677,30 @@ html[dir=rtl] #custom-bg-attr {
right: 16px;
}
-.attr-common {
+#custom-bg-attr a {
+ clear: both;
+ color: inherit;
+ float: left;
font-size: 13px;
height: 20px;
line-height: 20px;
+ max-width: 50vw;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
white-space: nowrap;
- width: -webkit-fill-available;
}
-.attr-common.attr-small {
+[dir=rtl] #custom-bg-attr a {
+ float: right;
+}
+
+#custom-bg-attr a[href=''] {
+ cursor: auto;
+ text-decoration: none;
+}
+
+#custom-bg-attr a ~ a {
font-size: 11px;
}
@@ -697,11 +708,6 @@ html[dir=rtl] #custom-bg-attr {
background: rgba(var(--GG900-rgb), .1);
}
-.attr-link {
- display: inline-block;
- text-decoration: underline;
-}
-
#link-icon {
background: url(icons/link.svg);
background-size: 10px 10px;
diff --git a/chromium/chrome/browser/resources/local_ntp/customize.js b/chromium/chrome/browser/resources/local_ntp/customize.js
index ce243db2718..487827f5bed 100644
--- a/chromium/chrome/browser/resources/local_ntp/customize.js
+++ b/chromium/chrome/browser/resources/local_ntp/customize.js
@@ -163,7 +163,6 @@ customize.IDS = {
*/
customize.CLASSES = {
ATTR_SMALL: 'attr-small',
- ATTR_COMMON: 'attr-common',
ATTR_LINK: 'attr-link',
COLLECTION_DIALOG: 'is-col-sel',
COLLECTION_SELECTED: 'bg-selected', // Highlight selected tile
@@ -358,25 +357,27 @@ customize.onThemeChange = function() {
customize.setAttribution = function(
attributionLine1, attributionLine2, attributionActionUrl) {
const attributionBox = $(customize.IDS.ATTRIBUTIONS);
- const attr1 = document.createElement('span');
+ const attr1 = document.createElement('a');
attr1.id = customize.IDS.ATTR1;
- const attr2 = document.createElement('span');
+ const attr2 = document.createElement('a');
attr2.id = customize.IDS.ATTR2;
if (attributionLine1 !== '') {
// Shouldn't be changed from textContent for security assurances.
attr1.textContent = attributionLine1;
- attr1.classList.add(customize.CLASSES.ATTR_COMMON);
+ attr1.href = attributionActionUrl || '';
$(customize.IDS.ATTRIBUTIONS).appendChild(attr1);
}
+
if (attributionLine2 !== '') {
// Shouldn't be changed from textContent for security assurances.
attr2.textContent = attributionLine2;
- attr2.classList.add(customize.CLASSES.ATTR_SMALL);
- attr2.classList.add(customize.CLASSES.ATTR_COMMON);
+ attr2.href = attributionActionUrl || '';
attributionBox.appendChild(attr2);
}
- if (attributionActionUrl !== '') {
+
+ const hasActionUrl = attributionActionUrl !== '';
+ if (hasActionUrl) {
const attr = (attributionLine2 !== '' ? attr2 : attr1);
attr.classList.add(customize.CLASSES.ATTR_LINK);
@@ -388,24 +389,18 @@ customize.setAttribution = function(
}
attr.insertBefore(linkIcon, attr.firstChild);
- attributionBox.classList.add(customize.CLASSES.ATTR_LINK);
- attributionBox.href = attributionActionUrl;
- attributionBox.onclick = function() {
- ntpApiHandle.logEvent(
- customize.LOG_TYPE.NTP_CUSTOMIZE_ATTRIBUTION_CLICKED);
+ attributionBox.onclick = e => {
+ if (attr1.contains(e.target) || attr2.contains(e.target)) {
+ ntpApiHandle.logEvent(
+ customize.LOG_TYPE.NTP_CUSTOMIZE_ATTRIBUTION_CLICKED);
+ }
};
- attributionBox.style.cursor = 'pointer';
}
+ attributionBox.classList.toggle(customize.CLASSES.ATTR_LINK, hasActionUrl);
};
customize.clearAttribution = function() {
- const attributions = $(customize.IDS.ATTRIBUTIONS);
- attributions.removeAttribute('href');
- attributions.className = '';
- attributions.style.cursor = 'default';
- while (attributions.firstChild) {
- attributions.removeChild(attributions.firstChild);
- }
+ $(customize.IDS.ATTRIBUTIONS).innerHTML = '';
};
customize.unselectTile = function() {
@@ -765,6 +760,7 @@ customize.showCollectionSelectionDialog = function() {
$(customize.IDS.BACKGROUNDS_MENU) :
$(customize.IDS.TILES);
if (configData.richerPicker && customize.builtTiles) {
+ tileContainer.focus();
return;
}
customize.builtTiles = true;
@@ -855,7 +851,7 @@ customize.showCollectionSelectionDialog = function() {
$(customize.IDS.BACKGROUNDS_DEFAULT_ICON).onClickOverride =
$(customize.IDS.BACKGROUNDS_DEFAULT).onkeydown;
- $(customize.IDS.TILES).focus();
+ tileContainer.focus();
};
/**
@@ -929,7 +925,7 @@ customize.richerPicker_previewImage = function(tile) {
if (tile.id === customize.IDS.BACKGROUNDS_DEFAULT_ICON) {
preview.dataset.hasImage = false;
preview.style.backgroundImage = '';
- preview.style.backgroundColor = document.body.style.backgroundColor;
+ preview.style.backgroundColor = 'transparent';
} else if (tile.id === customize.IDS.BACKGROUNDS_UPLOAD_ICON) {
// No previews for uploaded images.
return;
@@ -939,6 +935,9 @@ customize.richerPicker_previewImage = function(tile) {
const re = /w\d+\-h\d+/;
preview.style.backgroundImage =
tile.style.backgroundImage.replace(re, 'w1280-h720');
+ preview.dataset.attributionLine1 = tile.dataset.attributionLine1;
+ preview.dataset.attributionLine2 = tile.dataset.attributionLine2;
+ preview.dataset.attributionActionUrl = tile.dataset.attributionActionUrl;
}
background.style.opacity = 0;
preview.style.opacity = 1;
@@ -1393,10 +1392,7 @@ customize.richerPicker_resetSelectedOptions = function() {
customize.selectedOptions.background = null;
customize.selectedOptions.backgroundData = null;
- // Reset color selection.
- customize.richerPicker_removeSelectedState(customize.selectedOptions.color);
- customize.selectedOptions.color = null;
- customize.preselectedOptions.colorsMenuTile = null;
+ customize.resetColorsSelectedOptions();
customize.richerPicker_preselectShortcutOptions();
};
@@ -1461,7 +1457,7 @@ customize.richerPicker_resetCustomizationMenu = function() {
customize.richerPicker_resetSelectedOptions();
customize.richerPicker_resetImageMenu();
customize.richerPicker_hideOpenSubmenu();
- customize.resetColorsMenu();
+ customize.resetColorPicker();
};
/**
@@ -1522,7 +1518,6 @@ customize.richerPicker_applyCustomization = function() {
customize.init = function(showErrorNotification, hideCustomLinkNotification) {
ntpApiHandle = window.chrome.embeddedSearch.newTabPage;
const editDialog = $(customize.IDS.EDIT_BG_DIALOG);
- const menu = $(customize.IDS.MENU);
$(customize.IDS.OPTIONS_TITLE).textContent =
configData.translatedStrings.customizeThisPage;
@@ -1557,6 +1552,8 @@ customize.init = function(showErrorNotification, hideCustomLinkNotification) {
}
};
$(customize.IDS.EDIT_BG).onclick = function(event) {
+ $(customize.IDS.CUSTOMIZATION_MENU)
+ .classList.add(customize.CLASSES.MOUSE_NAV);
editDialog.classList.add(customize.CLASSES.MOUSE_NAV);
editBackgroundInteraction();
};
@@ -1982,7 +1979,9 @@ customize.initCustomBackgrounds = function(showErrorNotification) {
richerPicker.classList.add(customize.CLASSES.MOUSE_NAV);
};
richerPicker.onkeydown = function(event) {
- richerPicker.classList.remove(customize.CLASSES.MOUSE_NAV);
+ if (Object.values(customize.KEYCODES).includes(event.keyCode)) {
+ richerPicker.classList.remove(customize.CLASSES.MOUSE_NAV);
+ }
if (event.keyCode === customize.KEYCODES.BACKSPACE &&
customize.richerPicker_selectedSubmenu.menu.id ===
@@ -2040,6 +2039,7 @@ customize.initCustomBackgrounds = function(showErrorNotification) {
// Handle arrow key navigation.
event.preventDefault();
event.stopPropagation();
+ richerPicker.classList.remove(customize.CLASSES.MOUSE_NAV);
if (event.keyCode === forwardArrowKey) {
mvOption.focus();
} else if (event.keyCode === customize.KEYCODES.DOWN) {
@@ -2068,6 +2068,7 @@ customize.initCustomBackgrounds = function(showErrorNotification) {
// Handle arrow key navigation.
event.preventDefault();
event.stopPropagation();
+ richerPicker.classList.remove(customize.CLASSES.MOUSE_NAV);
if (event.keyCode === backArrowKey) {
clOption.focus();
} else if (
@@ -2094,6 +2095,7 @@ customize.initCustomBackgrounds = function(showErrorNotification) {
// Handle arrow key navigation.
event.preventDefault();
event.stopPropagation();
+ richerPicker.classList.remove(customize.CLASSES.MOUSE_NAV);
if (event.keyCode === backArrowKey ||
event.keyCode === customize.KEYCODES.UP) {
mvOption.focus();
@@ -2204,11 +2206,11 @@ customize.updateColorsMenuTileSelection = function(tile) {
*/
customize.colorTileInteraction = function(event) {
customize.updateColorsMenuTileSelection(
- /** @type HTMLElement */ (event.target));
- const id = parseInt(event.target.dataset.id, 10);
+ /** @type HTMLElement */ (event.currentTarget));
+ const id = parseInt(event.currentTarget.dataset.id, 10);
if (id) {
ntpApiHandle.applyAutogeneratedTheme(
- id, event.target.dataset.color.split(','));
+ id, event.currentTarget.dataset.color.split(','));
}
};
@@ -2219,7 +2221,7 @@ customize.colorTileInteraction = function(event) {
*/
customize.defaultThemeTileInteraction = function(event) {
customize.updateColorsMenuTileSelection(
- /** @type HTMLElement */ (event.target));
+ /** @type HTMLElement */ (event.currentTarget));
ntpApiHandle.applyDefaultTheme();
};
@@ -2229,7 +2231,7 @@ customize.defaultThemeTileInteraction = function(event) {
* @param {Event} event The event attributes for the interaction.
*/
customize.colorPickerTileInteraction = function(event) {
- const hex = event.target.value;
+ const hex = event.currentTarget.value;
const r = parseInt(hex.substring(1, 3), 16);
const g = parseInt(hex.substring(3, 5), 16);
const b = parseInt(hex.substring(5, 7), 16);
@@ -2244,14 +2246,22 @@ customize.colorPickerTileInteraction = function(event) {
};
/**
- * Loads Colors menu elements.
+ * Loads Colors menu elements and initializes the selected state.
*/
customize.loadColorsMenu = function() {
- if (customize.colorsMenuLoaded) {
- customize.colorsMenuPreselectTile();
- return;
+ if (!customize.colorsMenuLoaded) {
+ customize.loadColorMenuTiles();
+ customize.colorsMenuLoaded = true;
}
+ customize.resetColorsSelectedOptions();
+ customize.colorsMenuOnThemeChange();
+};
+
+/**
+ * Loads Colors menu tiles, e.g. color picker, default tile and color tiles.
+ */
+customize.loadColorMenuTiles = function() {
const colorsColl = ntpApiHandle.getColorsInfo();
for (let i = 0; i < colorsColl.length; ++i) {
// After 4 color tiles create an empty tile to take the place of the color
@@ -2303,15 +2313,11 @@ customize.loadColorsMenu = function() {
$(customize.IDS.COLOR_PICKER).onchange =
customize.colorPickerTileInteraction;
}
-
- customize.colorsMenuOnThemeChange();
-
- customize.colorsMenuLoaded = true;
};
/**
- * Update webstore theme info and preselect Colors menu tile according to the
- * theme update.
+ * Update webstore theme info and preselect Colors menu tile according to
+ * the theme update.
*/
customize.colorsMenuOnThemeChange = function() {
// Update webstore theme information.
@@ -2330,6 +2336,10 @@ customize.colorsMenuOnThemeChange = function() {
customize.selectedOptions.color);
customize.selectedOptions.color = null;
}
+ if (!customize.preselectedOptions.colorsMenuTile) {
+ customize.preselectedOptions.colorsMenuTile =
+ $(customize.IDS.COLORS_THEME);
+ }
} else {
$(customize.IDS.COLORS_THEME).classList.remove(customize.CLASSES.VISIBLE);
@@ -2343,7 +2353,6 @@ customize.colorsMenuOnThemeChange = function() {
*/
customize.colorsMenuPreselectTile = function() {
const themeInfo = assert(ntpApiHandle.themeBackgroundInfo);
-
let tile;
if (themeInfo.usingDefaultTheme) {
tile = $(customize.IDS.COLORS_DEFAULT_ICON);
@@ -2383,6 +2392,7 @@ customize.colorsMenuPreselectTile = function() {
if (!customize.preselectedOptions.colorsMenuTile) {
customize.preselectedOptions.colorsMenuTile = tile;
}
+
customize.updateColorsMenuTileSelection(
/** @type HTMLElement */ (tile));
}
@@ -2393,11 +2403,8 @@ customize.colorsMenuPreselectTile = function() {
* menu.
*/
customize.isColorOptionSelected = function() {
- return (!customize.preselectedOptions.colorsMenuTile &&
- customize.selectedOptions.color) ||
- (customize.preselectedOptions.colorsMenuTile &&
- customize.selectedOptions.color.id !==
- customize.preselectedOptions.colorsMenuTile.id);
+ return customize.preselectedOptions.colorsMenuTile !==
+ customize.selectedOptions.color;
};
/**
@@ -2428,10 +2435,9 @@ customize.cancelColor = function() {
};
/**
- * Reset Colors Menu elements to the default state, specifically the color
- * picker.
+ * Reset color picker to its default state.
*/
-customize.resetColorsMenu = function() {
+customize.resetColorPicker = function() {
customize.customColorPicked = customize.defaultCustomColor;
$(customize.IDS.COLOR_PICKER).value = null;
$(customize.IDS.COLORS_MENU).style.setProperty('--custom-color-border', '');
@@ -2441,6 +2447,15 @@ customize.resetColorsMenu = function() {
};
/**
+ * Reset color selection.
+ */
+customize.resetColorsSelectedOptions = function() {
+ customize.richerPicker_removeSelectedState(customize.selectedOptions.color);
+ customize.selectedOptions.color = null;
+ customize.preselectedOptions.colorsMenuTile = null;
+};
+
+/**
* Converts an RGBA component into hex format.
* @param {number} c RGBA component.
* @return {string} RGBA component in hex format.
diff --git a/chromium/chrome/browser/resources/local_ntp/doodles.css b/chromium/chrome/browser/resources/local_ntp/doodles.css
index 885619db2c1..ca9a379de2d 100644
--- a/chromium/chrome/browser/resources/local_ntp/doodles.css
+++ b/chromium/chrome/browser/resources/local_ntp/doodles.css
@@ -263,7 +263,8 @@ body.alternate-logo #logo-non-white {
#ddlsd-title {
color: #212121;
font-size: 22px;
- padding: 0 40px 16px 0;
+ padding-bottom: 16px;
+ padding-inline-end: 40px;
}
@media (prefers-color-scheme: dark) {
@@ -273,7 +274,6 @@ body.alternate-logo #logo-non-white {
}
#ddlsd-close {
- background: url(icons/close.svg) no-repeat;
height: 24px;
position: absolute;
right: 22px;
@@ -281,6 +281,29 @@ body.alternate-logo #logo-non-white {
width: 24px;
}
+[dir=rtl] #ddlsd-close {
+ left: 22px;
+ right: auto;
+}
+
+#ddlsd-close::before {
+ -webkit-mask-image: url(../../../../ui/webui/resources/images/icon_clear.svg);
+ -webkit-mask-position: center center;
+ -webkit-mask-repeat: no-repeat;
+ -webkit-mask-size: 32px;
+ background-color: #4d4d4d;
+ content: '';
+ display: block;
+ height: 100%;
+ width: 100%;
+}
+
+@media (prefers-color-scheme: dark) {
+ #ddlsd-close::before {
+ background-color: rgb(var(--GG500-rgb));
+ }
+}
+
#ddlsd-fbb {
background: url(icons/facebook.svg) no-repeat center;
}
@@ -315,7 +338,6 @@ body.alternate-logo #logo-non-white {
background: url(icons/copy.svg) no-repeat center;
background-size: contain;
display: inline-block;
- float: right;
height: 36px;
margin: 5px;
width: 36px;
@@ -338,8 +360,8 @@ body.alternate-logo #logo-non-white {
}
#ddlsd-link {
+ display: flex;
margin: 6px;
- overflow: hidden;
}
#ddlsd-text-ctr {
diff --git a/chromium/chrome/browser/resources/local_ntp/externs.js b/chromium/chrome/browser/resources/local_ntp/externs.js
index 04feef1b03c..945e9807564 100644
--- a/chromium/chrome/browser/resources/local_ntp/externs.js
+++ b/chromium/chrome/browser/resources/local_ntp/externs.js
@@ -27,13 +27,13 @@ let MostVisitedData;
* chrome/browser/search/local_ntp_source.cc:
* LocalNtpSource::SearchConfigurationProvider::UpdateConfigData()
* @typedef {{chromeColors: boolean,
- * enableShortcutsGrid: boolean,
* googleBaseUrl: string,
* isAccessibleBrowser: boolean,
* isGooglePage: boolean,
+ * realboxEnabled: boolean,
* richerPicker: boolean,
- * showFakeboxPlaceholderOnFocus: boolean,
- * translatedStrings: Array<string>}}
+ * suggestionTransparencyEnabled: boolean,
+ * translatedStrings: Object<string>}}
*/
let configData;
@@ -108,8 +108,9 @@ 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}}
+ * @typedef {{promoHtml: (string|undefined),
+ * promoLogUrl: (string|undefined),
+ * promoId: (string|undefined)}}
*/
let promo;
@@ -373,18 +374,73 @@ window.chrome.embeddedSearch.newTabPage.undoMostVisitedDeletion;
*/
window.chrome.embeddedSearch.newTabPage.updateCustomLink;
+/** @param {string} promoId */
+window.chrome.embeddedSearch.newTabPage.blocklistPromo;
+
/**
* Embedded Search API methods defined in
* chrome/renderer/searchbox/searchbox_extension.cc:
* SearchBoxBindings::GetObjectTemplateBuilder()
*/
window.chrome.embeddedSearch.searchBox;
+/** @param {number} line */
+window.chrome.embeddedSearch.searchBox.deleteAutocompleteMatch;
window.chrome.embeddedSearch.searchBox.isKeyCaptureEnabled;
window.chrome.embeddedSearch.searchBox.paste;
window.chrome.embeddedSearch.searchBox.rtl;
window.chrome.embeddedSearch.searchBox.startCapturingKeyStrokes;
window.chrome.embeddedSearch.searchBox.stopCapturingKeyStrokes;
+/** @param {string} input */
+window.chrome.embeddedSearch.searchBox.queryAutocomplete;
+/** @param {boolean} clearResult */
+window.chrome.embeddedSearch.searchBox.stopAutocomplete;
+
+/** @typedef {{offset: number, style: number}} */
+let ACMatchClassification;
+
+/**
+ * @typedef {{
+ * allowedToBeDefaultMatch: boolean,
+ * contents: string,
+ * contentsClass: !Array<!ACMatchClassification>,
+ * description: string,
+ * descriptionClass: !Array<!ACMatchClassification>,
+ * destinationUrl: string,
+ * inlineAutocompletion: string,
+ * isSearchType: boolean,
+ * fillIntoEdit: string,
+ * supportsDeletion: boolean,
+ * swapContentsAndDescription: boolean,
+ * type: string,
+ * }}
+ */
+let AutocompleteMatch;
+
+/** @enum {number} */
+const AutocompleteResultStatus = {};
+
+/**
+ * @typedef {{
+ * input: string,
+ * matches: !Array<!AutocompleteMatch>,
+ * status: !AutocompleteResultStatus,
+ * }}
+ */
+let AutocompleteResult;
+
+/** @type {function(!AutocompleteResult):void} */
+window.chrome.embeddedSearch.searchBox.onqueryautocompletedone;
+
+/**
+ * @typedef {{
+ * success: boolean,
+ * matches: !Array<!AutocompleteMatch>,
+ * }}
+ */
+let DeleteAutocompleteMatchResult;
+/** @type {function(!DeleteAutocompleteMatchResult):void} */
+window.chrome.embeddedSearch.searchBox.ondeleteautocompletematch;
/**************************** Translated Strings *****************************/
@@ -393,7 +449,6 @@ window.chrome.embeddedSearch.searchBox.stopCapturingKeyStrokes;
* chrome/browser/search/local_ntp_source.cc:
* GetTranslatedStrings()
*/
-
configData.translatedStrings.addLinkTitle;
configData.translatedStrings.addLinkTooltip;
configData.translatedStrings.attributionIntro;
@@ -407,6 +462,7 @@ configData.translatedStrings.copyLink;
configData.translatedStrings.customizeThisPage;
configData.translatedStrings.defaultWallpapers;
configData.translatedStrings.details;
+configData.translatedStrings.dismissPromo;
configData.translatedStrings.editLinkTitle;
configData.translatedStrings.editLinkTooltip;
configData.translatedStrings.fakeboxMicrophoneTooltip;
@@ -432,6 +488,8 @@ configData.translatedStrings.noVoice;
configData.translatedStrings.otherError;
configData.translatedStrings.permissionError;
configData.translatedStrings.ready;
+configData.translatedStrings.realboxSeparator;
+configData.translatedStrings.removeSuggestion;
configData.translatedStrings.removeThumbnailTooltip;
configData.translatedStrings.restoreDefaultBackground;
configData.translatedStrings.restoreDefaultLinks;
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/clock.svg b/chromium/chrome/browser/resources/local_ntp/icons/clock.svg
new file mode 100644
index 00000000000..d4420ae7d7a
--- /dev/null
+++ b/chromium/chrome/browser/resources/local_ntp/icons/clock.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/><path d="M0 0h24v24H0z" fill="none"/><path d="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"/></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
deleted file mode 100644
index 282fa77de8f..00000000000
--- a/chromium/chrome/browser/resources/local_ntp/icons/close.svg
+++ /dev/null
@@ -1 +0,0 @@
-<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/dont_show.png b/chromium/chrome/browser/resources/local_ntp/icons/dont_show.png
new file mode 100644
index 00000000000..bcf13913d64
--- /dev/null
+++ b/chromium/chrome/browser/resources/local_ntp/icons/dont_show.png
Binary files differ
diff --git a/chromium/chrome/browser/resources/local_ntp/icons/dont_show_2x.png b/chromium/chrome/browser/resources/local_ntp/icons/dont_show_2x.png
new file mode 100644
index 00000000000..815d7e7a84a
--- /dev/null
+++ b/chromium/chrome/browser/resources/local_ntp/icons/dont_show_2x.png
Binary files differ
diff --git a/chromium/chrome/browser/resources/local_ntp/local_ntp.css b/chromium/chrome/browser/resources/local_ntp/local_ntp.css
index 206b5f9e96f..0a02e7356be 100644
--- a/chromium/chrome/browser/resources/local_ntp/local_ntp.css
+++ b/chromium/chrome/browser/resources/local_ntp/local_ntp.css
@@ -93,7 +93,9 @@ button {
}
#logo,
-#fakebox-container {
+#fakebox-container,
+#realbox-container {
+ --searchbox-height: 44px;
flex-shrink: 0;
}
@@ -122,67 +124,225 @@ body.hide-fakebox #fakebox {
width: var(--content-width);
}
-#fakebox {
+#realbox-input-wrapper {
+ position: relative;
+ z-index: 0;
+}
+
+#fakebox,
+#realbox {
background: white;
border-radius: 22px;
- box-shadow: 0 1px 6px 0 rgba(32, 33, 36, .28);
box-sizing: border-box;
- cursor: text;
font-size: 16px;
- height: 44px;
- margin: 0 auto;
- max-width: 584px;
+ height: var(--searchbox-height);
opacity: 1;
position: relative;
transition: none;
}
+#fakebox,
+#realbox-input-wrapper:not(.show-matches) #realbox,
+#realbox-input-wrapper.show-matches #realbox-matches {
+ box-shadow: 0 1px 6px 0 rgba(32, 33, 36, .28);
+}
+
+#fakebox,
+#realbox-input-wrapper {
+ margin: 0 auto;
+ max-width: 584px;
+}
+
+#fakebox {
+ cursor: text;
+}
+
+#realbox {
+ border: none;
+ display: block;
+ outline: none;
+ padding-inline-end: 48px;
+ width: 100%;
+ z-index: 2;
+}
+
+#realbox::-webkit-search-decoration,
+#realbox::-webkit-search-cancel-button,
+#realbox::-webkit-search-results-button,
+#realbox::-webkit-search-results-decoration {
+ display: none;
+}
+
+#realbox::placeholder {
+ color: rgb(117, 117, 117);
+}
+
+#realbox:focus::placeholder {
+ color: transparent;
+}
+
@media (prefers-color-scheme: dark) {
- #fakebox {
+ #fakebox,
+ #realbox-input-wrapper:not(.show-matches) #realbox,
+ #realbox-input-wrapper.show-matches #realbox-matches {
box-shadow: 0 1px 6px 0 rgba(32, 33, 36, .78);
}
}
-.non-google-page #fakebox-container {
+.non-google-page :-webkit-any(#fakebox-container, #realbox-container) {
display: none;
}
-#fakebox > input {
- bottom: 0;
- box-sizing: border-box;
+#realbox-matches {
+ background: white;
+ border-radius: 8px;
+ display: none;
left: 0;
- margin: 0;
- opacity: 0;
- padding-inline-start: 20px;
+ overflow: hidden;
+ padding-top: var(--searchbox-height);
position: absolute;
+ right: 0;
top: 0;
- width: 100%;
+ z-index: 1;
}
-html[dir=rtl] #fakebox > input {
- right: 0;
+#realbox-input-wrapper.show-matches #realbox-matches {
+ display: flex;
+ flex-direction: column;
+}
+
+#realbox-matches :-webkit-any(a, span) {
+ color: inherit;
+ font-family: inherit;
+}
+
+#realbox-matches a {
+ background-position: 16px center;
+ background-repeat: no-repeat;
+ background-size: 24px;
+ font-size: 16px;
+ outline: none;
+ overflow: hidden;
+ padding-bottom: 8px;
+ padding-inline-end: 16px;
+ padding-inline-start: 48px;
+ padding-top: 8px;
+ position: relative;
+ text-decoration: none;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+[dir=rtl] #realbox-matches a {
+ background-position-x: calc(100% - 16px);
+}
+
+#realbox-matches.removable a {
+ padding-inline-end: 48px;
+}
+
+.clock-icon,
+.search-icon {
+ -webkit-mask-position: center;
+ -webkit-mask-repeat: no-repeat;
+ background-color: rgb(117, 117, 117);
+ bottom: 0;
+ left: 16px;
+ position: absolute;
+ top: 0;
+ width: 24px;
+}
+
+.clock-icon {
+ -webkit-mask-image: url(icons/clock.svg);
+ -webkit-mask-size: 16px;
}
-#fakebox-search-icon {
+.search-icon {
-webkit-mask-image:
url(../../../../ui/webui/resources/images/icon_search.svg);
+ -webkit-mask-size: 20px;
+}
+
+html[dir=rtl] :-webkit-any(.clock-icon, .search-icon) {
+ right: 16px;
+}
+
+#realbox-matches a:-webkit-any(:hover, .selected) {
+ background-color: rgb(var(--GG100-rgb));
+}
+
+#realbox-matches a:focus-within {
+ background-color: rgb(var(--GG200-rgb));
+}
+
+#realbox-matches .match {
+ font-weight: bold;
+}
+
+#realbox-matches .dim {
+ color: rgb(var(--GG600-rgb));
+}
+
+#realbox-matches .url {
+ color: rgb(var(--GB600-rgb));
+}
+
+#realbox-matches .remove-match {
+ border-radius: 50%;
+ height: 24px;
+ position: absolute;
+ right: 16px;
+ top: 4px;
+ width: 24px;
+}
+
+[dir=rtl] #realbox-matches .remove-match {
+ left: 16px;
+ right: auto;
+}
+
+#realbox-matches .remove-match:hover {
+ background-color: rgba(var(--GG900-rgb), .08);
+}
+
+#realbox-matches .remove-match:focus-within {
+ background-color: rgba(var(--GG900-rgb), .16);
+}
+
+#realbox-matches .remove-icon {
+ height: 100%;
+ width: 100%;
+}
+
+#realbox-matches a:-webkit-any(:hover, :focus-within) .remove-icon {
+ -webkit-mask-image: url(../../../../ui/webui/resources/images/icon_clear.svg);
+ -webkit-mask-position: center;
-webkit-mask-repeat: no-repeat;
- -webkit-mask-size: 100%;
- background: 24px 24px rgb(117, 117, 117);
+ -webkit-mask-size: 16px;
+ background-color: rgb(var(--GG900-rgb));
+}
+
+#fakebox > input {
bottom: 0;
- height: 24px;
+ box-sizing: border-box;
left: 0;
- margin: auto 0;
- margin-inline-start: 16px;
+ margin: 0;
+ opacity: 0;
+ padding-inline-start: 20px;
position: absolute;
top: 0;
- width: 24px;
+ width: 100%;
}
-html[dir=rtl] #fakebox-search-icon {
+html[dir=rtl] #fakebox > input {
right: 0;
}
+#fakebox .search-icon {
+ -webkit-mask-size: 20px;
+}
+
#fakebox-text {
bottom: 0;
color: rgb(117, 117, 117);
@@ -192,7 +352,6 @@ html[dir=rtl] #fakebox-search-icon {
line-height: 44px;
margin: auto 0;
overflow: hidden;
- padding-inline-start: 48px;
position: absolute;
right: 44px;
text-align: initial;
@@ -209,6 +368,11 @@ html[dir=rtl] #fakebox-text {
right: 0;
}
+#fakebox-text,
+#realbox {
+ padding-inline-start: 48px;
+}
+
#fakebox-cursor {
background: #333;
/* Total 16px height: (46px fakebox height - 2px border) - 14px top - 14px
@@ -226,7 +390,7 @@ html[dir=rtl] #fakebox-cursor {
right: 48px;
}
-#fakebox-microphone {
+.microphone-icon {
background: url(icons/googlemic_clr_24px.svg) no-repeat center;
background-size: 21px 21px;
bottom: 0;
@@ -239,11 +403,15 @@ html[dir=rtl] #fakebox-cursor {
width: 21px;
}
-html[dir=rtl] #fakebox-microphone {
+html[dir=rtl] .microphone-icon {
left: 0;
right: auto;
}
+#realbox-input-wrapper :-webkit-any(.search-icon, .microphone-icon) {
+ z-index: 3;
+}
+
@keyframes blink {
0% {
opacity: 1;
@@ -253,8 +421,8 @@ html[dir=rtl] #fakebox-microphone {
}
}
-body.fakebox-drag-focused #fakebox-text:not(.show-placeholder),
-body.fakebox-focused #fakebox-text:not(.show-placeholder) {
+body.fakebox-drag-focused #fakebox-text,
+body.fakebox-focused #fakebox-text {
visibility: hidden;
}
@@ -339,7 +507,7 @@ body.fakebox-focused #fakebox-cursor {
}
@media (prefers-color-scheme: dark) {
- body:not(.light-chip) #mv-notice {
+ body:not(.light-chip) #mv-notice {
background-color: rgb(var(--GG900-rgb));
border-color: rgba(0, 0, 0, .1);
}
@@ -356,7 +524,7 @@ body.fakebox-focused #fakebox-cursor {
}
@media (prefers-color-scheme: dark) {
- body:not(.light-chip) #mv-notice span {
+ body:not(.light-chip) #mv-notice span {
color: rgb(var(--GG200-rgb));
}
}
@@ -374,7 +542,7 @@ body.fakebox-focused #fakebox-cursor {
}
@media (prefers-color-scheme: dark) {
- body:not(.light-chip) #mv-notice-links span {
+ body:not(.light-chip) #mv-notice-links span {
color: rgb(var(--GB400-dark-rgb));
}
}
@@ -391,7 +559,7 @@ body.fakebox-focused #fakebox-cursor {
}
@media (prefers-color-scheme: dark) {
- body:not(.light-chip) #mv-notice-links
+ body:not(.light-chip) #mv-notice-links
:-webkit-any(span:hover, span:active) {
background-color: rgba(var(--GB400-dark-rgb), .1);
}
@@ -403,8 +571,7 @@ body.fakebox-focused #fakebox-cursor {
}
@media (prefers-color-scheme: dark) {
- body:not(.light-chip) .default-theme.dark #mv-msg,
- body:not(.light-chip) .default-theme.dark #mv-notice-links span {
+ body:not(.light-chip) #mv-msg {
color: rgb(var(--GG200-rgb));
}
}
@@ -596,13 +763,13 @@ html[dir=rtl] #error-notice.has-link #error-notice-msg {
#promo {
bottom: 16px;
- display: none;
left: 0;
pointer-events: none;
position: fixed;
right: 0;
text-align: center;
transition: bottom 400ms;
+ visibility: hidden;
}
#promo.float-down {
@@ -610,6 +777,7 @@ html[dir=rtl] #error-notice.has-link #error-notice-msg {
}
#promo > div {
+ --dismiss-background-rgb: var(--GG900-rgb);
background-color: #FFF;
border: 1px solid rgb(var(--GG300-rgb));
border-radius: 16px;
@@ -617,34 +785,69 @@ html[dir=rtl] #error-notice.has-link #error-notice-msg {
color: rgb(var(--GG700-rgb));
display: inline-block;
font-size: 12px;
- line-height: 32px;
+ height: 32px;
+ line-height: 30px; /* Height - 1px border-top - 1px border-bottom. */
margin-bottom: 0;
- max-width: 505px;
+ /* TODO(crbug.com/969062): this magic constant would be better implemented as
+ * real multi-line promo text support or a better QA process to check that
+ * promo messages aren't ellided. It's ultimately quite hard to make any pixel
+ * value here useful as font face, sizes, and zoom can all vary. Pushing for
+ * a more dynamic UI or better qualification process has been met with
+ * significant resistance, so we keep arbitrarily changing this value. */
+ max-width: 537px;
overflow: hidden;
padding: 0 16px;
pointer-events: all;
+ position: relative;
text-overflow: ellipsis;
white-space: nowrap;
}
+#promo.dismissable > div {
+ padding-inline-end: 36px; /* +24px for dismiss-icon - 4px less end padding */
+}
+
@media (prefers-color-scheme: dark) {
body:not(.light-chip) #promo > div {
+ --dismiss-background-rgb: var(--GG100-rgb);
background-color: rgb(var(--GG900-rgb));
border-color: rgba(0, 0, 0, .1);
color: rgb(var(--GG200-rgb));
}
}
-/**
- * Hide the promo if the window is too small:
- * max-width = promo.max-width (505px) + 2 * edit gear icon (16px + 28px + 8px)
- * max-height = ntp-contents.max-height (628px) + promo div height (16px + 22px)
- */
-@media only screen and (max-width: 609px),
- screen and (max-height: 666px) {
- #promo > div {
- display: none;
- }
+#promo > div .dismiss-promo {
+ border-radius: 50%;
+ height: 24px;
+ position: absolute;
+ right: 4px;
+ top: 3px; /* 4px from top - 1px of border. */
+ width: 24px;
+}
+
+[dir=rtl] #promo > div .dismiss-promo {
+ left: 4px;
+ right: auto;
+}
+
+#promo > div .dismiss-icon {
+ -webkit-mask-image: url(../../../../ui/webui/resources/images/icon_clear.svg);
+ -webkit-mask-position: center center;
+ -webkit-mask-repeat: no-repeat;
+ -webkit-mask-size: 16px;
+ background-color: rgb(var(--dismiss-background-rgb));
+ display: block;
+ height: 100%;
+ outline: none;
+ width: 100%;
+}
+
+#promo > div .dismiss-promo:hover {
+ background-color: rgba(var(--dismiss-background-rgb), .08);
+}
+
+#promo > div .dismiss-promo:focus-within {
+ background-color: rgba(var(--dismiss-background-rgb), .16);
}
#promo > div > a {
@@ -665,7 +868,9 @@ html[dir=rtl] #error-notice.has-link #error-notice-msg {
#promo > div > img {
border-radius: 50%;
height: 24px;
- margin: 0 8px 2px -12px;
+ margin-bottom: 2px;
+ margin-inline-end: 8px;
+ margin-inline-start: -12px;
object-fit: cover;
vertical-align: middle;
width: 24px;
@@ -677,8 +882,7 @@ html[dir=rtl] #error-notice.has-link #error-notice-msg {
}
}
-#one-google.show-element,
-#promo.show-element {
+#one-google.show-element {
display: block;
}
@@ -733,7 +937,6 @@ html[dir=rtl] #error-notice.has-link #error-notice-msg {
font-size: 14px;
height: 32px;
left: 0;
- line-height: 32px;
margin-bottom: 16px;
outline: none;
text-align: start;
@@ -891,7 +1094,6 @@ html[dir=rtl] .menu-option {
margin-inline-start: 40px;
position: relative;
width: 568px;
- z-index: 1;
}
.menu-panel {
@@ -951,6 +1153,7 @@ html[dir=rtl] .menu-option {
}
}
+#customization-menu.using-mouse-nav,
.using-mouse-nav .bg-sel-tile:focus {
outline: none;
}
@@ -1656,6 +1859,7 @@ html[dir=rtl] #colors-menu .bg-sel-tile .selected-check {
border: 1px solid rgb(var(--GG200-rgb));
border-radius: 4px;
display: none;
+ font-size: 13px;
height: 64px;
margin-bottom: 24px;
max-width: 544px;
@@ -1670,7 +1874,6 @@ html[dir=rtl] #colors-menu .bg-sel-tile .selected-check {
#colors-theme.visible {
display: flex;
- font-size: small;
}
#colors-theme > * {
diff --git a/chromium/chrome/browser/resources/local_ntp/local_ntp.html b/chromium/chrome/browser/resources/local_ntp/local_ntp.html
index 0893eb63f94..8c7f4b11a7c 100644
--- a/chromium/chrome/browser/resources/local_ntp/local_ntp.html
+++ b/chromium/chrome/browser/resources/local_ntp/local_ntp.html
@@ -1,5 +1,5 @@
<!doctype html>
-<html lang="$i18n{language}"><!-- TODO(dbeam): dir="$i18n{textdirection}"? -->
+<html lang="$i18n{language}" dir="$i18n{textdirection}">
<!-- 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. -->
@@ -65,14 +65,24 @@
</div>
</div>
- <div id="fakebox-container">
+ <div id="fakebox-container" $i18n{hiddenIfRealboxEnabled}>
<div id="fakebox">
- <div id="fakebox-search-icon"></div>
+ <div class="search-icon"></div>
<div id="fakebox-text"></div>
<input id="fakebox-input" autocomplete="off" tabindex="-1" type="url"
aria-hidden="true">
<div id="fakebox-cursor"></div>
- <button id="fakebox-microphone" hidden></button>
+ <button id="fakebox-microphone" class="microphone-icon" hidden></button>
+ </div>
+ </div>
+
+ <div id="realbox-container" $i18n{hiddenIfRealboxDisabled}>
+ <div id="realbox-input-wrapper">
+ <div class="search-icon"></div>
+ <input id="realbox" type="search" autocomplete="off" spellcheck="false"
+ aria-live="polite" autofocus>
+ <button id="realbox-microphone" class="microphone-icon" hidden></button>
+ <div id="realbox-matches"></div>
</div>
</div>
@@ -111,7 +121,7 @@
<span id="edit-bg-text">$i18n{customizeButton}</span>
</div>
- <a id="custom-bg-attr"></a>
+ <div id="custom-bg-attr"></div>
</div>
<dialog div id="edit-bg-dialog">
@@ -147,10 +157,10 @@
<button id="ddlsd-emb" class="ddlsd-sbtn"></button>
<hr id="ddlsd-hr">
<div id="ddlsd-link">
- <button id="ddlsd-copy"></button>
<span id="ddlsd-text-ctr">
<input type="text" id="ddlsd-text" dir="ltr">
</span>
+ <button id="ddlsd-copy"></button>
</div>
</div>
</dialog>
diff --git a/chromium/chrome/browser/resources/local_ntp/local_ntp.js b/chromium/chrome/browser/resources/local_ntp/local_ntp.js
index 21ebc4ef20f..50972ac06fb 100644
--- a/chromium/chrome/browser/resources/local_ntp/local_ntp.js
+++ b/chromium/chrome/browser/resources/local_ntp/local_ntp.js
@@ -31,6 +31,37 @@ let tilesAreLoaded = false;
function LocalNTP() {
'use strict';
+// Type definitions.
+
+/** @enum {number} */
+const ACMatchClassificationStyle = {
+ NONE: 0,
+ URL: 1 << 0,
+ MATCH: 1 << 1,
+ DIM: 1 << 2,
+};
+
+/** @enum {number} */
+const AutocompleteResultStatus = {
+ SUCCESS: 0,
+ SKIPPED: 1,
+};
+
+/** @type {string} */
+let lastInput;
+
+/** @typedef {{inline: string, text: string}} */
+let RealboxOutput;
+
+/**
+ * @typedef {{
+ * moveCursorToEnd: (boolean|undefined),
+ * inline: (string|undefined),
+ * text: (string|undefined),
+ * }}
+ */
+let RealboxOutputUpdate;
+
// Constants.
/**
@@ -40,16 +71,17 @@ function LocalNTP() {
*/
const CLASSES = {
ALTERNATE_LOGO: 'alternate-logo', // Shows white logo if required by theme
+ // Shows a clock next to historical realbox results.
+ CLOCK_ICON: 'clock-icon',
// Applies styles to dialogs used in customization.
CUSTOMIZE_DIALOG: 'customize-dialog',
- DARK: 'dark',
- DEFAULT_THEME: 'default-theme',
DELAYED_HIDE_NOTIFICATION: 'mv-notice-delayed-hide',
+ DISMISSABLE: 'dismissable',
+ DISMISS_ICON: 'dismiss-icon',
+ DISMISS_PROMO: 'dismiss-promo',
// Extended and elevated style for customization entry point.
ENTRY_POINT_ENHANCED: 'ep-enhanced',
FAKEBOX_FOCUS: 'fakebox-focused', // Applies focus styles to the fakebox
- // Applied when the fakebox placeholder text should not be hidden on focus.
- SHOW_PLACEHOLDER: 'show-placeholder',
// Applies float animations to the Most Visited notification
FLOAT_DOWN: 'float-down',
FLOAT_UP: 'float-up',
@@ -63,20 +95,22 @@ const CLASSES = {
LEFT_ALIGN_ATTRIBUTION: 'left-align-attribution',
// Vertically centers the most visited section for a non-Google provided page.
NON_GOOGLE_PAGE: 'non-google-page',
- NON_WHITE_BG: 'non-white-bg',
- RTL: 'rtl', // Right-to-left language text.
+ REMOVABLE: 'removable',
+ REMOVE_ICON: 'remove-icon',
+ REMOVE_MATCH: 'remove-match',
+ SEARCH_ICON: 'search-icon', // Magnifying glass/search icon.
+ SELECTED: 'selected', // A selected (via up/down arrow key) realbox match.
SHOW_ELEMENT: 'show-element',
+ // When the realbox has matches to show.
+ SHOW_MATCHES: 'show-matches',
// Applied when the doodle notifier should be shown instead of the doodle.
USE_NOTIFIER: 'use-notifier',
};
-/**
- * Background color for Chrome dark mode. Used to determine if it is possible to
- * display a Google Doodle, or if the notifier should be used instead.
- * @type {string}
- * @const
- */
-const DARK_MODE_BACKGROUND_COLOR = 'rgba(50,54,57,1)';
+const SEARCH_HISTORY_MATCH_TYPES = [
+ 'search-history',
+ 'search-suggest-personalized',
+];
/**
* The period of time (ms) before transitions can be applied to a toast
@@ -101,7 +135,6 @@ const IDS = {
ERROR_NOTIFICATION_LINK: 'error-notice-link',
ERROR_NOTIFICATION_MSG: 'error-notice-msg',
FAKEBOX: 'fakebox',
- FAKEBOX_ICON: 'fakebox-search-icon',
FAKEBOX_INPUT: 'fakebox-input',
FAKEBOX_TEXT: 'fakebox-text',
FAKEBOX_MICROPHONE: 'fakebox-microphone',
@@ -112,6 +145,10 @@ const IDS = {
NTP_CONTENTS: 'ntp-contents',
OGB: 'one-google',
PROMO: 'promo',
+ REALBOX: 'realbox',
+ REALBOX_INPUT_WRAPPER: 'realbox-input-wrapper',
+ REALBOX_MATCHES: 'realbox-matches',
+ REALBOX_MICROPHONE: 'realbox-microphone',
RESTORE_ALL_LINK: 'mv-restore',
SUGGESTIONS: 'suggestions',
TILES: 'mv-tiles',
@@ -188,7 +225,7 @@ const NOTIFICATION_TIMEOUT = 10000;
*/
const NTP_DESIGN = {
backgroundColor: [255, 255, 255, 255],
- darkBackgroundColor: [50, 54, 57, 255],
+ darkBackgroundColor: [53, 54, 58, 255],
iconBackgroundColor: [241, 243, 244, 255], /** GG100 */
iconDarkBackgroundColor: [32, 33, 36, 255], /** GG900 */
numTitleLines: 1,
@@ -196,16 +233,21 @@ const NTP_DESIGN = {
titleColorAgainstDark: [248, 249, 250, 255], /** GG050 */
};
-/**
- * Background colors considered "white". Used to determine if it is possible to
- * display a Google Doodle, or if the notifier should be used instead. Also used
- * to determine if a colored or white logo should be used.
- * @const
- */
-const WHITE_BACKGROUND_COLORS = ['rgba(255,255,255,1)', 'rgba(0,0,0,0)'];
+const REALBOX_KEYDOWN_HANDLED_KEYS = [
+ 'ArrowDown',
+ 'ArrowUp',
+ 'Delete',
+ 'Enter',
+ 'Escape',
+ 'PageDown',
+ 'PageUp',
+];
// Local statics.
+/** @type {!Array<!AutocompleteMatch>} */
+let autocompleteMatches = [];
+
/**
* The currently visible notification element. Null if no notification is
* present.
@@ -226,6 +268,16 @@ let delayedHideNotification = null;
*/
let isDarkModeEnabled = false;
+/** Used to prevent inline autocompleting recently deleted output. */
+let isDeletingInput = false;
+
+/**
+ * The rendered autocomplete match currently being deleted, or null if there
+ * isn't one.
+ * @type {?Element}
+ */
+let matchElBeingDeleted = null;
+
/**
* The last blacklisted tile rid if any, which by definition should not be
* filler.
@@ -234,6 +286,13 @@ let isDarkModeEnabled = false;
let lastBlacklistedTile = null;
/**
+ * Last text/inline autocompletion shown in the realbox (either by user input or
+ * outputting autocomplete matches).
+ * @type {!RealboxOutput}
+ */
+let lastOutput = {text: '', inline: ''};
+
+/**
* The browser embeddedSearch.newTabPage object.
* @type {Object}
*/
@@ -241,6 +300,29 @@ let ntpApiHandle;
// Helper methods.
+/** @return {boolean} */
+function areRealboxMatchesVisible() {
+ return $(IDS.REALBOX_INPUT_WRAPPER).classList.contains(CLASSES.SHOW_MATCHES);
+}
+
+/**
+ * @param {number} style
+ * @return {!Array<string>}
+ */
+function classificationStyleToClasses(style) {
+ const classes = [];
+ if (style & ACMatchClassificationStyle.DIM) {
+ classes.push('dim');
+ }
+ if (style & ACMatchClassificationStyle.MATCH) {
+ classes.push('match');
+ }
+ if (style & ACMatchClassificationStyle.URL) {
+ classes.push('url');
+ }
+ return classes;
+}
+
/**
* Converts an Array of color components into RGBA format "rgba(R,G,B,A)".
* @param {Array<number>} color Array of rgba color components.
@@ -296,9 +378,6 @@ function createIframes() {
if (configData.isGooglePage) {
args.push('enableCustomLinks=1');
- if (configData.enableShortcutsGrid) {
- args.push('enableGrid=1');
- }
args.push(
'addLink=' +
encodeURIComponent(configData.translatedStrings.addLinkTitle));
@@ -536,6 +615,12 @@ function getThemeBackgroundInfo() {
// backgroundImage is in the form: url("actual url"). Remove everything
// except the actual url.
info.imageUrl = preview.style.backgroundImage.slice(5, -2);
+
+ if (preview.dataset.hasImage === 'true') {
+ info.attribution1 = preview.dataset.attributionLine1;
+ info.attribution2 = preview.dataset.attributionLine2;
+ info.attributionActionUrl = preview.dataset.attributionActionUrl;
+ }
}
return info;
}
@@ -569,7 +654,7 @@ function handlePostMessage(event) {
$(IDS.SUGGESTIONS).style.visibility = 'visible';
}
if ($(IDS.PROMO)) {
- $(IDS.PROMO).classList.add(CLASSES.SHOW_ELEMENT);
+ showPromoIfNotOverlappingAndTrackResizes();
}
if (customLinksEnabled()) {
$(customize.IDS.CUSTOM_LINKS_RESTORE_DEFAULT)
@@ -672,70 +757,89 @@ function init() {
customize.init(showErrorNotification, hideNotification);
- if (configData.showFakeboxPlaceholderOnFocus) {
- $(IDS.FAKEBOX_TEXT).classList.add(CLASSES.SHOW_PLACEHOLDER);
- }
+ if (configData.realboxEnabled) {
+ const realboxEl = $(IDS.REALBOX);
+ realboxEl.placeholder = configData.translatedStrings.searchboxPlaceholder;
+ realboxEl.addEventListener('copy', onRealboxCutCopy);
+ realboxEl.addEventListener('cut', onRealboxCutCopy);
+ realboxEl.addEventListener('input', onRealboxInput);
- // Set up the fakebox (which only exists on the Google NTP).
- ntpApiHandle.oninputstart = onInputStart;
- ntpApiHandle.oninputcancel = onInputCancel;
+ const realboxWrapper = $(IDS.REALBOX_INPUT_WRAPPER);
+ realboxWrapper.addEventListener('focusin', onRealboxWrapperFocusIn);
+ realboxWrapper.addEventListener('focusout', onRealboxWrapperFocusOut);
- if (ntpApiHandle.isInputInProgress) {
- onInputStart();
- }
+ searchboxApiHandle.onqueryautocompletedone = onQueryAutocompleteDone;
+ searchboxApiHandle.ondeleteautocompletematch = onDeleteAutocompleteMatch;
- $(IDS.FAKEBOX_TEXT).textContent =
- configData.translatedStrings.searchboxPlaceholder;
+ if (!iframesAndVoiceSearchDisabledForTesting) {
+ speech.init(
+ configData.googleBaseUrl, configData.translatedStrings,
+ $(IDS.REALBOX_MICROPHONE), searchboxApiHandle);
+ }
- if (!iframesAndVoiceSearchDisabledForTesting) {
- speech.init(
- configData.googleBaseUrl, configData.translatedStrings,
- $(IDS.FAKEBOX_MICROPHONE), searchboxApiHandle);
- }
+ utils.disableOutlineOnMouseClick($(IDS.REALBOX_MICROPHONE));
+ } else {
+ // Set up the fakebox (which only exists on the Google NTP).
+ ntpApiHandle.oninputstart = onInputStart;
+ ntpApiHandle.oninputcancel = onInputCancel;
- // Listener for updating the key capture state.
- document.body.onmousedown = function(event) {
- if (isFakeboxClick(event)) {
- searchboxApiHandle.startCapturingKeyStrokes();
- } else if (isFakeboxFocused()) {
- searchboxApiHandle.stopCapturingKeyStrokes();
+ if (ntpApiHandle.isInputInProgress) {
+ onInputStart();
}
- };
- searchboxApiHandle.onkeycapturechange = function() {
- setFakeboxFocus(searchboxApiHandle.isKeyCaptureEnabled);
- };
- const inputbox = $(IDS.FAKEBOX_INPUT);
- inputbox.onpaste = function(event) {
- event.preventDefault();
- // Send pasted text to Omnibox.
- const text = event.clipboardData.getData('text/plain');
- if (text) {
- searchboxApiHandle.paste(text);
+
+ $(IDS.FAKEBOX_TEXT).textContent =
+ configData.translatedStrings.searchboxPlaceholder;
+
+ if (!iframesAndVoiceSearchDisabledForTesting) {
+ speech.init(
+ configData.googleBaseUrl, configData.translatedStrings,
+ $(IDS.FAKEBOX_MICROPHONE), searchboxApiHandle);
}
- };
- inputbox.ondrop = function(event) {
- event.preventDefault();
- const text = event.dataTransfer.getData('text/plain');
- if (text) {
- searchboxApiHandle.paste(text);
+
+ // Listener for updating the key capture state.
+ document.body.onmousedown = function(event) {
+ if (isFakeboxClick(event)) {
+ searchboxApiHandle.startCapturingKeyStrokes();
+ } else if (isFakeboxFocused()) {
+ searchboxApiHandle.stopCapturingKeyStrokes();
+ }
+ };
+ searchboxApiHandle.onkeycapturechange = function() {
+ setFakeboxFocus(searchboxApiHandle.isKeyCaptureEnabled);
+ };
+ const inputbox = $(IDS.FAKEBOX_INPUT);
+ inputbox.onpaste = function(event) {
+ event.preventDefault();
+ // Send pasted text to Omnibox.
+ const text = event.clipboardData.getData('text/plain');
+ if (text) {
+ searchboxApiHandle.paste(text);
+ }
+ };
+ inputbox.ondrop = function(event) {
+ event.preventDefault();
+ const text = event.dataTransfer.getData('text/plain');
+ if (text) {
+ searchboxApiHandle.paste(text);
+ }
+ setFakeboxDragFocus(false);
+ };
+ inputbox.ondragenter = function() {
+ setFakeboxDragFocus(true);
+ };
+ inputbox.ondragleave = function() {
+ setFakeboxDragFocus(false);
+ };
+ utils.disableOutlineOnMouseClick($(IDS.FAKEBOX_MICROPHONE));
+
+ // Update the fakebox style to match the current key capturing state.
+ setFakeboxFocus(searchboxApiHandle.isKeyCaptureEnabled);
+ // Also tell the browser that we're capturing, otherwise it's possible
+ // that both fakebox and Omnibox have visible focus at the same time, see
+ // crbug.com/792850.
+ if (searchboxApiHandle.isKeyCaptureEnabled) {
+ searchboxApiHandle.startCapturingKeyStrokes();
}
- setFakeboxDragFocus(false);
- };
- inputbox.ondragenter = function() {
- setFakeboxDragFocus(true);
- };
- inputbox.ondragleave = function() {
- setFakeboxDragFocus(false);
- };
- utils.disableOutlineOnMouseClick($(IDS.FAKEBOX_MICROPHONE));
-
- // Update the fakebox style to match the current key capturing state.
- setFakeboxFocus(searchboxApiHandle.isKeyCaptureEnabled);
- // Also tell the browser that we're capturing, otherwise it's possible
- // that both fakebox and Omnibox have visible focus at the same time, see
- // crbug.com/792850.
- if (searchboxApiHandle.isKeyCaptureEnabled) {
- searchboxApiHandle.startCapturingKeyStrokes();
}
doodles.init();
@@ -745,13 +849,6 @@ function init() {
if (searchboxApiHandle.rtl) {
$(IDS.NOTIFICATION).dir = 'rtl';
- // Grabbing the root HTML element. TODO(dbeam): could this just be <html ...
- // dir="$i18n{textdirection}"> in the .html file instead? It could result in
- // less flicker for RTL users (as HTML/CSS can render before JavaScript has
- // the chance to run).
- document.documentElement.setAttribute('dir', 'rtl');
- // Add class for setting alignments based on language directionality.
- document.documentElement.classList.add(CLASSES.RTL);
}
if (!iframesAndVoiceSearchDisabledForTesting) {
@@ -807,7 +904,10 @@ function injectOneGoogleBar(ogb) {
* doesn't block the main page load.
*/
function injectPromo(promo) {
- if (promo.promoHtml == '') {
+ if (!promo.promoHtml) {
+ if ($(IDS.PROMO)) {
+ $(IDS.PROMO).remove();
+ }
return;
}
@@ -822,16 +922,35 @@ function injectPromo(promo) {
ntpApiHandle.logEvent(LOG_TYPE.NTP_MIDDLE_SLOT_PROMO_SHOWN);
- const links = promoContainer.getElementsByTagName('a');
- if (links[0]) {
- links[0].onclick = function() {
+ const link = promoContainer.querySelector('a');
+ if (link) {
+ link.onclick = function() {
ntpApiHandle.logEvent(LOG_TYPE.NTP_MIDDLE_SLOT_PROMO_LINK_CLICKED);
};
}
+ if (promo.promoId) {
+ const icon = document.createElement('button');
+ icon.classList.add(CLASSES.DISMISS_ICON);
+
+ icon.title = configData.translatedStrings.dismissPromo;
+ icon.onclick = e => {
+ ntpApiHandle.blocklistPromo(promo.promoId);
+ promoContainer.remove();
+ window.removeEventListener('resize', showPromoIfNotOverlapping);
+ };
+
+ const dismiss = document.createElement('div');
+ dismiss.classList.add(CLASSES.DISMISS_PROMO);
+ dismiss.appendChild(icon);
+
+ promoContainer.querySelector('div').appendChild(dismiss);
+ promoContainer.classList.add(CLASSES.DISMISSABLE);
+ }
+
// The the MV tiles are already loaded show the promo immediately.
if (tilesAreLoaded) {
- promoContainer.classList.add(CLASSES.SHOW_ELEMENT);
+ showPromoIfNotOverlappingAndTrackResizes();
}
}
@@ -873,6 +992,71 @@ function isFakeboxFocused() {
document.body.classList.contains(CLASSES.FAKEBOX_DRAG_FOCUS);
}
+/** @return {boolean} */
+function isPromoOverlapping() {
+ const MARGIN = 10;
+
+ /**
+ * @param {string} id
+ * @return {DOMRect}
+ */
+ const rect = id => $(id).getBoundingClientRect();
+
+ const promoRect = $(IDS.PROMO).querySelector('div').getBoundingClientRect();
+
+ if (promoRect.top - MARGIN <= rect(IDS.USER_CONTENT).bottom) {
+ return true;
+ }
+
+ if (window.chrome.embeddedSearch.searchBox.rtl) {
+ const attributionRect = rect(IDS.ATTRIBUTION);
+ if (attributionRect.width > 0 &&
+ promoRect.left - MARGIN <= attributionRect.right) {
+ return true;
+ }
+
+ const editBgRect = rect(customize.IDS.EDIT_BG);
+ assert(editBgRect.width > 0);
+ if (promoRect.left - 2 * MARGIN <= editBgRect.right) {
+ return true;
+ }
+
+ const customAttributionsRect = rect(customize.IDS.ATTRIBUTIONS);
+ if (customAttributionsRect.width > 0 &&
+ promoRect.right + MARGIN >= customAttributionsRect.left) {
+ return true;
+ }
+ } else {
+ const customAttributionsRect = rect(customize.IDS.ATTRIBUTIONS);
+ if (customAttributionsRect.width > 0 &&
+ promoRect.left - MARGIN <= customAttributionsRect.right) {
+ return true;
+ }
+
+ const editBgRect = rect(customize.IDS.EDIT_BG);
+ assert(editBgRect.width > 0);
+ if (promoRect.right + 2 * MARGIN >= editBgRect.left) {
+ return true;
+ }
+
+ const attributionEl = $(IDS.ATTRIBUTION);
+ const attributionRect = attributionEl.getBoundingClientRect();
+ if (attributionRect.width > 0) {
+ const attributionOnLeft =
+ attributionEl.classList.contains(CLASSES.LEFT_ALIGN_ATTRIBUTION);
+ if (attributionOnLeft) {
+ if (promoRect.left - MARGIN <= attributionRect.right) {
+ return true;
+ }
+ } else if (promoRect.right + MARGIN >= attributionRect.left) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
/** Binds event listeners. */
function listen() {
document.addEventListener('DOMContentLoaded', init);
@@ -893,6 +1077,47 @@ function onAddCustomLinkDone(success) {
ntpApiHandle.logEvent(LOG_TYPE.NTP_CUSTOMIZE_SHORTCUT_DONE);
}
+/** @param {!DeleteAutocompleteMatchResult} result */
+function onDeleteAutocompleteMatch(result) {
+ assert(matchElBeingDeleted);
+
+ if (!result.success) {
+ matchElBeingDeleted = null;
+ return;
+ }
+
+ $(IDS.REALBOX).focus();
+
+ populateAutocompleteMatches(result.matches);
+ matchElBeingDeleted = null;
+
+ if (result.matches.length === 0) {
+ updateRealboxOutput({inline: '', text: ''});
+ return;
+ }
+
+ const firstMatch = autocompleteMatches[0];
+ if (firstMatch.allowedToBeDefaultMatch) {
+ const matchEls = Array.from($(IDS.REALBOX_MATCHES).children);
+ selectMatchEl(matchEls[0]);
+
+ const fill = firstMatch.fillIntoEdit;
+ const inline = firstMatch.inlineAutocompletion;
+ const textEnd = fill.length - inline.length;
+ updateRealboxOutput({
+ moveCursorToEnd: true,
+ inline: inline,
+ text: assert(fill.substr(0, textEnd)),
+ });
+ } else {
+ updateRealboxOutput({
+ moveCursorToEnd: true,
+ inline: '',
+ text: lastInput,
+ });
+ }
+}
+
/**
* Callback for embeddedSearch.newTabPage.ondeletecustomlinkdone. Called when
* the custom link was successfully deleted. Shows the "Shortcut deleted"
@@ -936,6 +1161,233 @@ function onMostVisitedChange() {
reloadTiles();
}
+/** @param {!AutocompleteResult} result */
+function onQueryAutocompleteDone(result) {
+ if (result.status === AutocompleteResultStatus.SKIPPED ||
+ result.input !== lastOutput.text) {
+ return; // Stale or skipped result; ignore.
+ }
+
+ populateAutocompleteMatches(result.matches);
+
+ if (result.matches.length === 0) {
+ return;
+ }
+
+ if (result.matches[0].allowedToBeDefaultMatch) {
+ selectMatchEl(assert($(IDS.REALBOX_MATCHES).firstElementChild));
+ }
+
+ // If the user is deleting content, don't quickly re-suggest the same
+ // output.
+ if (!isDeletingInput) {
+ const first = result.matches[0];
+ if (first.allowedToBeDefaultMatch && first.inlineAutocompletion) {
+ updateRealboxOutput({inline: first.inlineAutocompletion});
+ }
+ }
+}
+
+/** @param {!Event} e */
+function onRealboxCutCopy(e) {
+ const realboxEl = $(IDS.REALBOX);
+ if (!realboxEl.value || realboxEl.selectionStart !== 0 ||
+ realboxEl.selectionEnd !== realboxEl.value.length ||
+ autocompleteMatches.length === 0) {
+ // Only handle cut/copy when realbox has content and it's all selected.
+ return;
+ }
+
+ const matchEls = Array.from($(IDS.REALBOX_MATCHES).children);
+ const selected = matchEls.findIndex(matchEl => {
+ return matchEl.classList.contains(CLASSES.SELECTED);
+ });
+
+ const selectedMatch = autocompleteMatches[selected];
+ if (selectedMatch && !selectedMatch.isSearchType) {
+ e.clipboardData.setData('text/plain', selectedMatch.destinationUrl);
+ e.preventDefault();
+ if (e.type === 'cut') {
+ realboxEl.value = '';
+ }
+ }
+}
+
+function onRealboxInput() {
+ const realboxValue = $(IDS.REALBOX).value;
+
+ updateRealboxOutput({inline: '', text: realboxValue});
+
+ if (realboxValue.trim()) {
+ queryAutocomplete(realboxValue);
+ } else {
+ setRealboxMatchesVisible(false);
+ setRealboxWrapperListenForKeydown(false);
+ setAutocompleteMatches([]);
+ }
+}
+
+/** @param {Event} e */
+function onRealboxWrapperFocusIn(e) {
+ if (e.target.matches(`#${IDS.REALBOX}`) && !$(IDS.REALBOX).value) {
+ queryAutocomplete('');
+ } else if (e.target.matches(`#${IDS.REALBOX_MATCHES} *`)) {
+ let target = e.target;
+ while (target && target.nodeName !== 'A') {
+ target = target.parentNode;
+ }
+ if (!target) {
+ return;
+ }
+ const selectedIndex = selectMatchEl(target);
+ // It doesn't really make sense to use fillFromMatch() here as the focus
+ // change drops the selection (and is probably just noisy to
+ // screenreaders).
+ const newFill = autocompleteMatches[selectedIndex].fillIntoEdit;
+ updateRealboxOutput({moveCursorToEnd: true, inline: '', text: newFill});
+ }
+}
+
+/** @param {Event} e */
+function onRealboxWrapperFocusOut(e) {
+ const target = /** @type {Element} */ (e.target);
+ if (matchElBeingDeleted && matchElBeingDeleted.contains(target)) {
+ // When a match is being deleted, the focus gets dropped temporariliy as the
+ // element is deleted from the DOM. Don't stop autocomplete in those cases.
+ return;
+ }
+
+ const relatedTarget = /** @type {Element} */ (e.relatedTarget);
+ const realboxWrapper = $(IDS.REALBOX_INPUT_WRAPPER);
+ if (!realboxWrapper.contains(relatedTarget)) {
+ setRealboxMatchesVisible(false);
+ // Note: intentionally leaving keydown listening and match data intact.
+ window.chrome.embeddedSearch.searchBox.stopAutocomplete(
+ /*clearResult=*/ true);
+
+ // Clear the input if it was empty when displaying the matches.
+ if (lastInput === '') {
+ updateRealboxOutput({inline: '', text: ''});
+ }
+ }
+}
+
+/** @param {Event} e */
+function onRealboxWrapperKeydown(e) {
+ assert(autocompleteMatches.length > 0);
+
+ const key = e.key;
+
+ const realboxEl = $(IDS.REALBOX);
+ if (e.target === realboxEl && lastOutput.inline) {
+ const realboxValue = realboxEl.value;
+ const realboxSelected = realboxValue.substring(
+ realboxEl.selectionStart, realboxEl.selectionEnd);
+ // If the current state matches the default text + inline autocompletion
+ // and the user types the next key in the inline autocompletion, just move
+ // the selection and requery autocomplete. This is required to avoid flicker
+ // while setting .value and .selection{Start,End} to keep typing smooth.
+ if (realboxSelected === lastOutput.inline &&
+ realboxValue === lastOutput.text + lastOutput.inline &&
+ lastOutput.inline[0].toLocaleLowerCase() === key.toLocaleLowerCase()) {
+ updateRealboxOutput({
+ inline: lastOutput.inline.substr(1),
+ text: assert(lastOutput.text + key),
+ });
+ queryAutocomplete(lastOutput.text);
+ e.preventDefault();
+ return;
+ }
+ }
+
+ if (!REALBOX_KEYDOWN_HANDLED_KEYS.includes(key)) {
+ return;
+ }
+
+ const realboxMatchesEl = $(IDS.REALBOX_MATCHES);
+ const matchEls = Array.from(realboxMatchesEl.children);
+ const selected = matchEls.findIndex(matchEl => {
+ return matchEl.classList.contains(CLASSES.SELECTED);
+ });
+
+ if (key === 'Delete') {
+ if (e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey) {
+ const selectedMatch = autocompleteMatches[selected];
+ if (selectedMatch && selectedMatch.supportsDeletion) {
+ matchElBeingDeleted = matchEls[selected];
+ window.chrome.embeddedSearch.searchBox.deleteAutocompleteMatch(
+ selected);
+ e.preventDefault();
+ }
+ }
+ return;
+ }
+
+ const hasMods = e.altKey || e.ctrlKey || e.metaKey || e.shiftKey;
+ if (hasMods && key !== 'Enter') {
+ return;
+ }
+
+ if (key === 'Enter') {
+ if (matchEls[selected] && matchEls.concat(realboxEl).includes(e.target)) {
+ // Note: dispatching a MouseEvent here instead of using e.g. .click() as
+ // this forwards key modifiers. This enables Shift+Enter to open a match
+ // in a new window, for example.
+ matchEls[selected].dispatchEvent(new MouseEvent('click', e));
+ e.preventDefault();
+ }
+ return;
+ }
+
+ if (!areRealboxMatchesVisible()) {
+ if (key === 'ArrowUp' || key === 'ArrowDown') {
+ setRealboxMatchesVisible(true);
+ e.preventDefault();
+ }
+ return;
+ }
+
+ if (key === 'Escape' && selected === 0) {
+ updateRealboxOutput({inline: '', text: ''});
+ setRealboxMatchesVisible(false);
+ setRealboxWrapperListenForKeydown(false);
+ setAutocompleteMatches([]);
+ e.preventDefault();
+ return;
+ }
+
+ /** @type {number} */ let newSelected;
+ if (key === 'ArrowDown') {
+ newSelected = selected + 1 < matchEls.length ? selected + 1 : 0;
+ } else if (key === 'ArrowUp') {
+ newSelected = selected - 1 >= 0 ? selected - 1 : matchEls.length - 1;
+ } else if (key === 'Escape' || key === 'PageUp') {
+ newSelected = 0;
+ } else if (key === 'PageDown') {
+ newSelected = matchEls.length - 1;
+ }
+ assert(selectMatchEl(assert(matchEls[newSelected])) >= 0);
+ e.preventDefault();
+
+ if (realboxMatchesEl.contains(document.activeElement)) {
+ // Selection should match focus if focus is currently in the matches.
+ matchEls[newSelected].focus();
+ }
+
+ const newMatch = autocompleteMatches[newSelected];
+ const newFill = newMatch.fillIntoEdit;
+ let newInline = '';
+ if (newMatch.allowedToBeDefaultMatch) {
+ newInline = newMatch.inlineAutocompletion;
+ }
+ const newFillEnd = newFill.length - newInline.length;
+ updateRealboxOutput({
+ moveCursorToEnd: true,
+ inline: newInline,
+ text: assert(newFill.substr(0, newFillEnd)),
+ });
+}
+
/**
* Handles a click on the restore all notification link by hiding the
* notification and informing Chrome.
@@ -958,6 +1410,9 @@ function onThemeChange() {
renderTheme();
renderOneGoogleBarTheme();
sendThemeInfoToMostVisitedIframe();
+ if ($(IDS.PROMO)) {
+ showPromoIfNotOverlapping();
+ }
}
/**
@@ -999,6 +1454,103 @@ function overrideExecutableTimeoutForTesting(timeout) {
}
/**
+ * @param {!Array<!AutocompleteMatch>} matches
+ */
+function populateAutocompleteMatches(matches) {
+ const realboxMatchesEl = document.createElement('div');
+ realboxMatchesEl.setAttribute('role', 'listbox');
+
+ for (let i = 0; i < matches.length; ++i) {
+ const match = matches[i];
+ const matchEl = document.createElement('a');
+ matchEl.href = match.destinationUrl;
+ matchEl.setAttribute('role', 'option');
+
+ if (match.isSearchType) {
+ const icon = document.createElement('div');
+ const isSearchHistory = SEARCH_HISTORY_MATCH_TYPES.includes(match.type);
+ icon.classList.add(
+ isSearchHistory ? CLASSES.CLOCK_ICON : CLASSES.SEARCH_ICON);
+ matchEl.appendChild(icon);
+ } else {
+ // TODO(crbug.com/997229): use chrome://favicon/<url> when perms allow.
+ const iconUrl = new URL('chrome-search://ntpicon/');
+ iconUrl.searchParams.set('show_fallback_monogram', 'false');
+ iconUrl.searchParams.set('size', '24@' + window.devicePixelRatio + 'x');
+ iconUrl.searchParams.set('url', match.destinationUrl);
+ matchEl.style.backgroundImage = 'url(' + iconUrl.toString() + ')';
+ }
+
+ const contentsEls =
+ renderMatchClassifications(match.contents, match.contentsClass);
+ const descriptionEls = [];
+ const separatorEls = [];
+ let separatorText = '';
+
+ if (match.description) {
+ descriptionEls.push(...renderMatchClassifications(
+ match.description, match.descriptionClass));
+ separatorText = configData.translatedStrings.realboxSeparator;
+ separatorEls.push(document.createTextNode(separatorText));
+ }
+
+ const ariaLabel = match.swapContentsAndDescription ?
+ match.description + separatorText + match.contents :
+ match.contents + separatorText + match.description;
+ matchEl.setAttribute('aria-label', ariaLabel);
+
+ const layout = match.swapContentsAndDescription ?
+ [descriptionEls, separatorEls, contentsEls] :
+ [contentsEls, separatorEls, descriptionEls];
+
+ for (const col of layout) {
+ col.forEach(colEl => matchEl.appendChild(colEl));
+ }
+
+ if (match.supportsDeletion && configData.suggestionTransparencyEnabled) {
+ const icon = document.createElement('button');
+ icon.title = configData.translatedStrings.removeSuggestion;
+ icon.classList.add(CLASSES.REMOVE_ICON);
+ icon.onmousedown = e => {
+ e.preventDefault(); // Stops default browser action (focus)
+ };
+ icon.onclick = e => {
+ matchElBeingDeleted = matchEl;
+ window.chrome.embeddedSearch.searchBox.deleteAutocompleteMatch(i);
+ e.preventDefault(); // Stops default browser action (navigation)
+ };
+
+ const remove = document.createElement('div');
+ remove.classList.add(CLASSES.REMOVE_MATCH);
+
+ remove.appendChild(icon);
+ matchEl.appendChild(remove);
+ realboxMatchesEl.classList.add(CLASSES.REMOVABLE);
+ }
+
+ realboxMatchesEl.append(matchEl);
+ }
+
+ $(IDS.REALBOX_MATCHES).remove();
+ realboxMatchesEl.id = IDS.REALBOX_MATCHES;
+
+ $(IDS.REALBOX_INPUT_WRAPPER).appendChild(realboxMatchesEl);
+
+ const hasMatches = matches.length > 0;
+ setRealboxMatchesVisible(hasMatches);
+ setRealboxWrapperListenForKeydown(hasMatches);
+ setAutocompleteMatches(matches);
+}
+
+/**
+ * @param {string} input
+ */
+function queryAutocomplete(input) {
+ lastInput = input;
+ window.chrome.embeddedSearch.searchBox.queryAutocomplete(input);
+}
+
+/**
* @param {!Element} element
* @param {!Array<string>} keys
* @param {!function(Event)} handler
@@ -1044,6 +1596,21 @@ function reloadTiles() {
}
/**
+ * @param {string} text
+ * @param {!Array<!ACMatchClassification>} classifications
+ * @return {!Array<!Element>}
+ */
+function renderMatchClassifications(text, classifications) {
+ return classifications.map((classification, i) => {
+ const classes = classificationStyleToClasses(classification.style);
+ const next = classifications[i + 1] || {offset: text.length};
+ const classifiedText = text.substring(classification.offset, next.offset);
+ return classes.length ? spanWithClasses(classifiedText, classes) :
+ document.createTextNode(classifiedText);
+ });
+}
+
+/**
* Updates the OneGoogleBar (if it is loaded) based on the current theme.
* TODO(crbug.com/918582): Add support for OGB dark mode.
*/
@@ -1071,29 +1638,14 @@ function renderTheme() {
return;
}
- $(IDS.NTP_CONTENTS).classList.toggle(CLASSES.DARK, info.isNtpBackgroundDark);
-
// Update dark mode styling.
isDarkModeEnabled = window.matchMedia('(prefers-color-scheme: dark)').matches;
document.body.classList.toggle('light-chip', !getUseDarkChips(info));
- const background = [
- convertToRGBAColor(info.backgroundColorRgba), info.imageUrl,
- info.imageTiling, info.imageHorizontalAlignment, info.imageVerticalAlignment
- ].join(' ').trim();
-
- // If a custom background has been selected the image will be applied to the
- // custom-background element instead of the body.
- if (!info.customBackgroundConfigured) {
- document.body.style.background = background;
- }
-
// Dark mode uses a white Google logo.
const useWhiteLogo =
info.alternateLogo || (info.usingDefaultTheme && isDarkModeEnabled);
document.body.classList.toggle(CLASSES.ALTERNATE_LOGO, useWhiteLogo);
- const isNonWhiteBackground = !WHITE_BACKGROUND_COLORS.includes(background);
- document.body.classList.toggle(CLASSES.NON_WHITE_BG, isNonWhiteBackground);
if (info.logoColor) {
document.body.style.setProperty(
@@ -1103,14 +1655,22 @@ function renderTheme() {
// The doodle notifier should be shown for non-default backgrounds. This
// includes non-white backgrounds, excluding dark mode gray if dark mode is
// enabled.
- const isDefaultBackground = WHITE_BACKGROUND_COLORS.includes(background) ||
- (isDarkModeEnabled && background === DARK_MODE_BACKGROUND_COLOR);
+ const isDefaultBackground = info.usingDefaultTheme && !info.imageUrl;
document.body.classList.toggle(CLASSES.USE_NOTIFIER, !isDefaultBackground);
- updateThemeAttribution(info.attributionUrl, info.imageHorizontalAlignment);
- setCustomThemeStyle(info);
+ // If a custom background has been selected the image will be applied to the
+ // custom-background element instead of the body.
+ if (!info.customBackgroundConfigured) {
+ document.body.style.background = [
+ convertToRGBAColor(info.backgroundColorRgba), info.imageUrl,
+ info.imageTiling, info.imageHorizontalAlignment,
+ info.imageVerticalAlignment
+ ].join(' ').trim();
- if (info.customBackgroundConfigured) {
+ $(IDS.CUSTOM_BG).style.opacity = '0';
+ $(IDS.CUSTOM_BG).style.backgroundImage = '';
+ customize.clearAttribution();
+ } else {
// Do anything only if the custom background changed.
const imageUrl = assert(info.imageUrl);
if (!$(IDS.CUSTOM_BG).style.backgroundImage.includes(imageUrl)) {
@@ -1140,12 +1700,11 @@ function renderTheme() {
'' + info.attribution1, '' + info.attribution2,
'' + info.attributionActionUrl);
}
- } else {
- $(IDS.CUSTOM_BG).style.opacity = '0';
- $(IDS.CUSTOM_BG).style.backgroundImage = '';
- customize.clearAttribution();
}
+ updateThemeAttribution(info.attributionUrl, info.imageHorizontalAlignment);
+ setCustomThemeStyle(info);
+
$(customize.IDS.RESTORE_DEFAULT)
.classList.toggle(
customize.CLASSES.OPTION_DISABLED, !info.customBackgroundConfigured);
@@ -1200,6 +1759,23 @@ function requestAndInsertGoogleResources() {
}
}
+/**
+ * @param {!EventTarget} elToSelect
+ * @return {number} The selected index (if found); else -1.
+ */
+function selectMatchEl(elToSelect) {
+ let selectedIndex = -1;
+ Array.from($(IDS.REALBOX_MATCHES).children).forEach((matchEl, i) => {
+ const found = matchEl === elToSelect;
+ matchEl.classList.toggle(CLASSES.SELECTED, found);
+ matchEl.setAttribute('aria-selected', found);
+ if (found) {
+ selectedIndex = i;
+ }
+ });
+ return selectedIndex;
+}
+
/** Sends the current theme info to the most visited iframe. */
function sendThemeInfoToMostVisitedIframe() {
const info = getThemeBackgroundInfo();
@@ -1236,6 +1812,11 @@ function setAttributionVisibility(show) {
$(IDS.ATTRIBUTION).style.display = show ? '' : 'none';
}
+/** @param {!Array<!AutocompleteMatch>} matches */
+function setAutocompleteMatches(matches) {
+ autocompleteMatches = matches;
+}
+
/**
* Updates the NTP style according to theme.
* @param {Object} themeInfo The information about the theme.
@@ -1250,9 +1831,6 @@ function setCustomThemeStyle(themeInfo) {
mvxFilter = 'drop-shadow(0 0 0 ' + textColor + ')';
}
- $(IDS.NTP_CONTENTS)
- .classList.toggle(CLASSES.DEFAULT_THEME, themeInfo.usingDefaultTheme);
-
document.body.style.setProperty('--text-color', textColor);
document.body.style.setProperty('--text-color-light', textColorLight);
}
@@ -1278,6 +1856,21 @@ function setFakeboxVisibility(show) {
document.body.classList.toggle(CLASSES.HIDE_FAKEBOX, !show);
}
+/** @param {boolean} visible */
+function setRealboxMatchesVisible(visible) {
+ $(IDS.REALBOX_INPUT_WRAPPER).classList.toggle(CLASSES.SHOW_MATCHES, visible);
+}
+
+/** @param {boolean} listen */
+function setRealboxWrapperListenForKeydown(listen) {
+ const realboxWrapper = $(IDS.REALBOX_INPUT_WRAPPER);
+ if (listen) {
+ realboxWrapper.addEventListener('keydown', onRealboxWrapperKeydown);
+ } else {
+ realboxWrapper.removeEventListener('keydown', onRealboxWrapperKeydown);
+ }
+}
+
/**
* Shows the error pop-up notification and triggers a delay to hide it. The
* message will be set to |msg|. If |linkName| and |linkOnClick| are present,
@@ -1315,6 +1908,63 @@ function showNotification(msg) {
$(IDS.UNDO_LINK).focus();
}
+function showPromoIfNotOverlapping() {
+ $(IDS.PROMO).style.visibility = isPromoOverlapping() ? 'hidden' : 'visible';
+}
+
+function showPromoIfNotOverlappingAndTrackResizes() {
+ showPromoIfNotOverlapping();
+ // The removal before addition is to ensure only 1 event listener is ever
+ // active at the same time.
+ window.removeEventListener('resize', showPromoIfNotOverlapping);
+ window.addEventListener('resize', showPromoIfNotOverlapping);
+}
+
+/**
+ * @param {string} text
+ * @param {!Array<string>} classes
+ * @return {!Element}
+ */
+function spanWithClasses(text, classes) {
+ const span = document.createElement('span');
+ span.classList.add(...classes);
+ span.textContent = text;
+ return span;
+}
+
+/** @param {!RealboxOutputUpdate} update */
+function updateRealboxOutput(update) {
+ assert(Object.keys(update).length > 0);
+
+ const realboxEl = $(IDS.REALBOX);
+ const newOutput =
+ /** @type {!RealboxOutput} */ (Object.assign({}, lastOutput, update));
+ const newAll = newOutput.text + newOutput.inline;
+
+ const inlineDiffers = newOutput.inline !== lastOutput.inline;
+ const preserveSelection = !inlineDiffers && !update.moveCursorToEnd;
+ let needsSelectionUpdate = !preserveSelection;
+
+ const oldSelectionStart = realboxEl.selectionStart;
+
+ if (newAll !== realboxEl.value) {
+ realboxEl.value = newAll;
+ needsSelectionUpdate = true; // Setting .value blows away selection.
+ }
+
+ if (newAll.trim() && needsSelectionUpdate) {
+ realboxEl.selectionStart =
+ preserveSelection ? oldSelectionStart : newOutput.text.length;
+ // If the selection shouldn't be preserved, set the selection end to the
+ // same as the selection start (i.e. drop selection but move cursor).
+ realboxEl.selectionEnd =
+ preserveSelection ? oldSelectionStart : newAll.length;
+ }
+
+ isDeletingInput = userDeletedOutput(lastOutput, newOutput);
+ lastOutput = newOutput;
+}
+
/**
* Renders the attribution if the URL is present, otherwise hides it.
* @param {string|undefined} url The URL of the attribution image, if any.
@@ -1342,6 +1992,17 @@ function updateThemeAttribution(url, themeBackgroundAlignment) {
setAttributionVisibility(true);
}
+/**
+ * @param {!RealboxOutput} before
+ * @param {!RealboxOutput} after
+ * @return {boolean}
+ */
+function userDeletedOutput(before, after) {
+ const beforeAll = before.text + before.inline;
+ const afterAll = after.text + after.inline;
+ return beforeAll.length > afterAll.length && beforeAll.startsWith(afterAll);
+}
+
return {
init: init, // Exposed for testing.
listen: listen,
diff --git a/chromium/chrome/browser/resources/local_ntp/local_ntp_common.css b/chromium/chrome/browser/resources/local_ntp/local_ntp_common.css
index 102d85b4595..0f89aa12292 100644
--- a/chromium/chrome/browser/resources/local_ntp/local_ntp_common.css
+++ b/chromium/chrome/browser/resources/local_ntp/local_ntp_common.css
@@ -5,7 +5,7 @@
html {
/* Material Design colors. Keep in sync with ui/gfx/color_palette.h. */
- --dark-mode-bg-rgb: 50, 54, 57;
+ --dark-mode-bg-rgb: 53, 54, 58;
--dark-mode-dialog-rgb: 41, 42, 45;
/* Google Grey */
diff --git a/chromium/chrome/browser/resources/local_ntp/local_ntp_resources.grd b/chromium/chrome/browser/resources/local_ntp/local_ntp_resources.grd
index ade6f647ab8..f4b535827d9 100644
--- a/chromium/chrome/browser/resources/local_ntp/local_ntp_resources.grd
+++ b/chromium/chrome/browser/resources/local_ntp/local_ntp_resources.grd
@@ -27,6 +27,8 @@
<include name="IDR_LOCAL_NTP_UTILS_JS" file="utils.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_LOCAL_NTP_VOICE_CSS" file="voice.css" flattenhtml="true" type="BINDATA" />
<include name="IDR_LOCAL_NTP_VOICE_JS" file="voice.js" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_MOST_VISITED_DONT_SHOW_PNG" file="icons\dont_show.png" type="BINDATA" />
+ <include name="IDR_MOST_VISITED_DONT_SHOW_2X_PNG" file="icons\dont_show_2x.png" type="BINDATA" />
<include name="IDR_MOST_VISITED_IFRAME_CSS" file="most_visited_iframe.css" type="BINDATA" />
<include name="IDR_MOST_VISITED_SINGLE_CSS" file="most_visited_single.css" type="BINDATA" />
<include name="IDR_MOST_VISITED_SINGLE_HTML" file="most_visited_single.html" type="BINDATA" />
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 995e9a8b6b6..d1ed09f7a96 100644
--- a/chromium/chrome/browser/resources/local_ntp/most_visited_single.css
+++ b/chromium/chrome/browser/resources/local_ntp/most_visited_single.css
@@ -54,32 +54,11 @@ a:visited {
#mv-tiles,
.mv-tiles-old {
- display: flex;
- flex-wrap: wrap;
font-size: 0;
- justify-content: center;
- /* 5 112px tiles per row. If you change this, also change the corresponding
- * values in local_ntp.css. */
- max-width: calc(var(--md-tile-size) * var(--md-max-tiles-row));
opacity: 0;
- position: static;
- /* This align correctly for both LTR and RTL */
- text-align: -webkit-auto;
- user-select: none;
-}
-
-body.grid-layout #mv-tiles,
-body.grid-layout .mv-tiles-old {
- display: block;
- flex-wrap: unset;
- justify-content: unset;
- max-width: unset;
position: relative;
- text-align: unset;
-}
-
-html:not(.no-initial-fade) :-webkit-any(#mv-tiles, .mv-tiles-old) {
transition: opacity 300ms;
+ user-select: none;
}
.mv-tiles-old {
@@ -104,11 +83,11 @@ html:not(.no-initial-fade) :-webkit-any(#mv-tiles, .mv-tiles-old) {
/* Prevent transitions on the held tile in order for it to smoothly follow the
* mouse. */
-.grid-reorder .grid-tile {
+.reorder .grid-tile {
transition-duration: 0s;
}
-.grid-reorder {
+.reorder {
z-index: 10; /* Ensure the held tile is visible. */
}
@@ -127,46 +106,24 @@ html:not(.no-initial-fade) :-webkit-any(#mv-tiles, .mv-tiles-old) {
width: var(--md-tile-size);
}
-.reorder {
- background-color: white;
- border-radius: 4px;
- box-shadow: 0 1px 3px 0 rgba(var(--GG800-rgb), .3),
- 0 4px 8px 3px rgba(var(--GG800-rgb), .15);
- color: rgb(var(--GG800-rgb));
- transition-duration: 200ms;
-}
-
-@media (prefers-color-scheme: dark) {
- .reorder {
- background-color: rgb(var(--dark-mode-bg-rgb));
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .4),
- 0 4px 8px 3px rgba(0, 0, 0, .25);
- color: rgb(var(--GG100-rgb));
- }
-}
-
-.reorder .md-tile-inner {
- z-index: unset;
-}
-
.md-empty-tile {
display: none;
}
body:not(.reordering) .md-tile:hover,
-.grid-reorder .md-tile {
+.reorder .md-tile {
background-color: rgba(var(--GG900-rgb), .06);
}
@media (prefers-color-scheme: dark) {
body:not(.reordering) .md-tile:hover,
- .grid-reorder .md-tile {
+ .reorder .md-tile {
background-color: rgba(255, 255, 255, .1);
}
}
body.dark-theme:not(.reordering) .md-tile:hover,
-body.dark-theme .grid-reorder .md-tile {
+body.dark-theme .reorder .md-tile {
background-color: rgba(255, 255, 255, .1);
}
@@ -257,7 +214,7 @@ body.mac-chromeos .md-title {
}
/* Apply when a custom background is set. */
-body.custom-background .md-tile:not(.reorder) .md-title {
+body.custom-background .md-title {
filter: drop-shadow(0 0 6px rgba(0, 0, 0, .35));
}
@@ -266,12 +223,9 @@ body.use-title-container .md-title {
background-color: white;
/* Necessary for a "pill" shape. Using 50% creates an oval. */
border-radius: 500px;
- padding: 0 8px;
-}
-
-body.use-title-container .md-tile:not(.reorder) {
color: rgb(var(--GG800-rgb));
filter: unset;
+ padding: 0 8px;
}
.md-menu {
@@ -300,9 +254,10 @@ body:not(.reordering) .md-menu:focus:not(.mouse-navigation) {
/* We use ::after without content to provide the masked X element. */
.md-menu::after {
--mask-width: calc(var(--md-menu-size) - 2);
+ /* TODO(crbug.com/1012065): Use SVG for the "X" icon. */
-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);
+ url(chrome-search://most-visited/dont_show.png) 1x,
+ url(chrome-search://most-visited/dont_show_2x.png) 2x);
-webkit-mask-repeat: no-repeat;
-webkit-mask-size: var(--mask-width);
background-color: rgb(var(--GG600-rgb));
@@ -345,13 +300,13 @@ body:not(.reordering) .md-menu:focus::after {
}
}
-body.dark-theme .md-tile:not(.reorder) .md-menu::after,
+body.dark-theme .md-tile .md-menu::after,
body.dark-theme:not(.reordering) .md-menu:focus:not(.mouse-navigation)::after {
background-color: white;
}
@media (prefers-color-scheme: dark) {
- body.dark-theme .md-tile:not(.reorder) .md-menu::after,
+ body.dark-theme .md-tile .md-menu::after,
body.dark-theme:not(.reordering)
.md-menu:focus:not(.mouse-navigation)::after {
background-color: rgb(var(--GG200-rgb));
diff --git a/chromium/chrome/browser/resources/local_ntp/most_visited_single.html b/chromium/chrome/browser/resources/local_ntp/most_visited_single.html
index 9d8db297c9a..0fa5b62d10b 100644
--- a/chromium/chrome/browser/resources/local_ntp/most_visited_single.html
+++ b/chromium/chrome/browser/resources/local_ntp/most_visited_single.html
@@ -1,5 +1,5 @@
<!doctype html>
-<html class="$i18n{noInitialFade}">
+<html>
<!-- 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. -->
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 c497599fdb4..1fe5765c7fd 100644
--- a/chromium/chrome/browser/resources/local_ntp/most_visited_single.js
+++ b/chromium/chrome/browser/resources/local_ntp/most_visited_single.js
@@ -46,9 +46,6 @@ const IDS = {
*/
const CLASSES = {
FAILED_FAVICON: 'failed-favicon', // Applied when the favicon fails to load.
- GRID_LAYOUT: 'grid-layout',
- // Applied to the grid tile being moved while reordering.
- GRID_REORDER: 'grid-reorder',
GRID_TILE: 'grid-tile',
GRID_TILE_CONTAINER: 'grid-tile-container',
REORDER: 'reorder', // Applied to the tile being moved while reordering.
@@ -56,7 +53,6 @@ const CLASSES = {
REORDERING: 'reordering',
MAC_CHROMEOS: 'mac-chromeos', // Reduces font weight for MacOS and ChromeOS.
// Material Design classes.
- MD_EMPTY_TILE: 'md-empty-tile',
MD_FALLBACK_LETTER: 'md-fallback-letter',
MD_ICON: 'md-icon',
MD_ADD_ICON: 'md-add-icon',
@@ -65,7 +61,6 @@ const CLASSES = {
MD_TILE: 'md-tile',
MD_TILE_INNER: 'md-tile-inner',
MD_TITLE: 'md-title',
- NO_INITIAL_FADE: 'no-initial-fade',
};
/**
@@ -96,8 +91,6 @@ const TileVisualType = {
ICON_REAL: 1,
ICON_COLOR: 2,
ICON_DEFAULT: 3,
- THUMBNAIL: 7,
- THUMBNAIL_FAILED: 8,
};
/**
@@ -114,6 +107,12 @@ const RESIZE_TIMEOUT_DELAY = 66;
const MD_MAX_NUM_CUSTOM_LINK_TILES = 10;
/**
+ * Maximum number of tiles if Most Visited is enabled.
+ * @const {number}
+ */
+const MD_MAX_NUM_MOST_VISITED_TILES = 8;
+
+/**
* Maximum number of tiles per row for Material Design.
* @const {number}
*/
@@ -142,8 +141,8 @@ const MD_TILE_WIDTH = 112;
const MD_NUM_TILES_ALWAYS_VISIBLE = 6;
/**
- * The origin of this request, i.e. 'https://www.google.TLD' for the remote NTP,
- * or 'chrome-search://local-ntp' for the local NTP.
+ * The origin of this request, i.e. 'chrome-search://local-ntp' for the local
+ * NTP.
* @const {string}
*/
const DOMAIN_ORIGIN = '{{ORIGIN}}';
@@ -163,34 +162,12 @@ let loadedCounter = 1;
let tiles = null;
/**
- * Maximum number of MostVisited tiles to show at any time. If the host page
- * doesn't send enough tiles and custom links is not enabled, we fill them blank
- * tiles. This can be changed depending on what feature is enabled. Set by the
- * host page, while 8 is default.
- * @type {number}
- */
-let maxNumTiles = 8;
-
-/**
* List of parameters passed by query args.
* @type {Object}
*/
let queryArgs = {};
/**
- * True if we are currently reordering the tiles.
- * @type {boolean}
- */
-let reordering = false;
-
-/**
- * The tile that is being moved during the reorder flow. Null if we are
- * currently not reordering.
- * @type {?Element}
- */
-let elementToReorder = null;
-
-/**
* True if the custom links feature is enabled, i.e. when this is a Google NTP.
* Set when the iframe is initialized.
* @type {boolean}
@@ -198,26 +175,12 @@ let elementToReorder = null;
let customLinksFeatureEnabled = false;
/**
- * True if the grid layout is enabled.
- * @type {boolean}
- */
-let isGridEnabled = false;
-
-/**
* The current grid of tiles.
* @type {?Grid}
*/
let currGrid = null;
/**
- * Called by tests to enable the grid layout.
- */
-function enableGridLayoutForTesting() {
- isGridEnabled = true;
- document.body.classList.add(CLASSES.GRID_LAYOUT);
-}
-
-/**
* Additional API for Array. Moves the item at index |from| to index |to|.
* @param {number} from Index of the item to move.
* @param {number} to Index to move the item to.
@@ -296,17 +259,13 @@ class Grid {
this.tilesAlwaysVisible_ =
params.tilesAlwaysVisible || MD_NUM_TILES_ALWAYS_VISIBLE;
this.maxTilesPerRow_ = params.maxTilesPerRow || MD_MAX_TILES_PER_ROW;
- this.maxTiles_ = params.maxTiles || maxNumTiles;
+ this.maxTiles_ = params.maxTiles || getMaxNumTiles();
this.maxTilesPerRowWindow_ = this.getMaxTilesPerRow_();
this.tiles_ =
this.container_.getElementsByClassName(CLASSES.GRID_TILE_CONTAINER);
- if (this.tiles_.length > this.maxTiles_) {
- throw new Error(
- 'The number of tiles (' + this.tiles_.length +
- ') exceeds the maximum (' + this.maxTiles_ + ').');
- }
+ // Ignore any tiles past the maximum allowed.
this.position_ = new Array(this.maxTiles_);
this.order_ = new Array(this.maxTiles_);
for (let i = 0; i < this.maxTiles_; i++) {
@@ -557,7 +516,7 @@ class Grid {
this.newIndexOfItemToReorder_ = index;
// Apply reorder styling.
- tile.classList.add(CLASSES.GRID_REORDER);
+ tile.classList.add(CLASSES.REORDER);
// Disable other hover/active styling for all tiles.
document.body.classList.add(CLASSES.REORDERING);
@@ -609,7 +568,7 @@ class Grid {
const index = Number(tile.getAttribute('index'));
// Remove reorder styling.
- tile.classList.remove(CLASSES.GRID_REORDER);
+ tile.classList.remove(CLASSES.REORDER);
document.body.classList.remove(CLASSES.REORDERING);
// Move the tile to its new position and notify EmbeddedSearchAPI that the
@@ -634,7 +593,7 @@ class Grid {
reorderToIndexAtPoint_(x, y) {
const elements = document.elementsFromPoint(x, y);
for (let i = 0; i < elements.length; i++) {
- if (elements[i].classList.contains('grid-tile-container') &&
+ if (elements[i].classList.contains(CLASSES.GRID_TILE_CONTAINER) &&
elements[i].getAttribute('index') !== null) {
this.reorderToIndex_(Number(elements[i].getAttribute('index')));
return;
@@ -737,7 +696,7 @@ function logEvent(eventType) {
/**
* Log impression of an NTP tile.
- * @param {number} tileIndex Position of the tile, >= 0 and < |maxNumTiles|.
+ * @param {number} tileIndex Position of the tile, >= 0 and < getMaxNumTiles().
* @param {number} tileTitleSource The source of the tile's title as received
* from getMostVisitedItemData.
* @param {number} tileSource The tile's source as received from
@@ -754,7 +713,7 @@ function logMostVisitedImpression(
/**
* Log click on an NTP tile.
- * @param {number} tileIndex Position of the tile, >= 0 and < |maxNumTiles|.
+ * @param {number} tileIndex Position of the tile, >= 0 and < getMaxNumTiles().
* @param {number} tileTitleSource The source of the tile's title as received
* from getMostVisitedItemData.
* @param {number} tileSource The tile's source as received from
@@ -771,6 +730,7 @@ function logMostVisitedNavigation(
/**
* Returns true if custom links are enabled.
+ * @return {boolean}
*/
function isCustomLinksEnabled() {
return customLinksFeatureEnabled &&
@@ -778,6 +738,16 @@ function isCustomLinksEnabled() {
}
/**
+ * Returns the maximum number of tiles to show at any time. This can be changed
+ * depending on what feature is enabled.
+ * @return {number}
+ */
+function getMaxNumTiles() {
+ return isCustomLinksEnabled() ? MD_MAX_NUM_CUSTOM_LINK_TILES :
+ MD_MAX_NUM_MOST_VISITED_TILES;
+}
+
+/**
* Down counts the DOM elements that we are waiting for the page to load.
* When we get to 0, we send a message to the parent window.
* This is usually used as an EventListener of onload/onerror.
@@ -895,9 +865,8 @@ function removeAllOldTiles() {
}
/**
- * Called when all tiles have finished loading (successfully or not), including
- * their thumbnail images, and we are ready to show the new tiles and drop the
- * old ones.
+ * Called when all tiles have finished loading (successfully or not), and we are
+ * ready to show the new tiles and drop the old ones.
*/
function swapInNewTiles() {
// Store the tiles on the current closure.
@@ -905,7 +874,7 @@ function swapInNewTiles() {
// Add an "add new custom link" button if we haven't reached the maximum
// number of tiles.
- if (isCustomLinksEnabled() && cur.childNodes.length < maxNumTiles) {
+ if (isCustomLinksEnabled() && cur.childNodes.length < getMaxNumTiles()) {
const data = {
'rid': -1,
'title': queryArgs['addLink'],
@@ -915,7 +884,7 @@ function swapInNewTiles() {
'tileSource': -1,
'tileTitleSource': -1
};
- tiles.appendChild(renderMaterialDesignTile(data));
+ tiles.appendChild(renderTile(data));
}
const parent = document.querySelector('#' + IDS.MOST_VISITED);
@@ -937,18 +906,9 @@ function swapInNewTiles() {
cur.id = IDS.MV_TILES;
parent.appendChild(cur);
- if (isGridEnabled) {
- // Initialize the new tileset before modifying opacity. This will prevent
- // the transform transition from applying after the tiles fade in.
- currGrid.init(cur);
- } else {
- // Re-balance the tiles if there are more than |MD_MAX_TILES_PER_ROW| in
- // order to make even rows.
- if (cur.childNodes.length > MD_MAX_TILES_PER_ROW) {
- cur.style.maxWidth = 'calc(var(--md-tile-size) * ' +
- Math.ceil(cur.childNodes.length / 2) + ')';
- }
- }
+ // Initialize the new tileset before modifying opacity. This will prevent the
+ // transform transition from applying after the tiles fade in.
+ currGrid.init(cur);
const flushOpacity = () => window.getComputedStyle(cur).opacity;
@@ -957,11 +917,6 @@ function swapInNewTiles() {
flushOpacity();
cur.style.opacity = 1.0;
- if (document.documentElement.classList.contains(CLASSES.NO_INITIAL_FADE)) {
- flushOpacity();
- document.documentElement.classList.remove(CLASSES.NO_INITIAL_FADE);
- }
-
// Make sure the tiles variable contain the next tileset we'll use if the host
// page sends us an updated set of tiles.
tiles = document.createElement('div');
@@ -989,27 +944,25 @@ 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 {?MostVisitedData} args Data for the tile to be rendered.
+ * @param {!MostVisitedData} args Data for the tile to be rendered.
*/
function addTile(args) {
- if (isFinite(args.rid)) {
- // An actual suggestion. Grab the data from the embeddedSearch API.
- const data =
- chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid);
- if (!data) {
- return;
- }
+ if (!isFinite(args.rid)) {
+ return;
+ }
- if (!data.faviconUrl) {
- data.faviconUrl = 'chrome-search://favicon/size/16@' +
- window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.rid;
- }
- tiles.appendChild(renderTile(data));
- } else {
- // An empty tile
- tiles.appendChild(renderTile(null));
+ // Grab the tile's data from the embeddedSearch API.
+ const data =
+ chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid);
+ if (!data) {
+ return;
+ }
+
+ if (!data.faviconUrl) {
+ data.faviconUrl = 'chrome-search://favicon/size/16@' +
+ window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.rid;
}
+ tiles.appendChild(renderTile(data));
}
/**
@@ -1045,105 +998,15 @@ function editCustomLink(rid) {
}
/**
- * Starts the reorder flow. Updates the visual style of the held tile to
- * indicate that it is being moved.
- * @param {!Element} tile Tile that is being moved.
- */
-function startReorder(tile) {
- reordering = true;
- elementToReorder = tile;
-
- tile.classList.add(CLASSES.REORDER);
- // Disable other hover/active styling for all tiles.
- document.body.classList.add(CLASSES.REORDERING);
-
- document.addEventListener('dragend', () => {
- stopReorder(tile);
- }, {once: true});
-}
-
-/**
- * Stops the reorder flow. Resets the held tile's visual style and tells the
- * EmbeddedSearchAPI that a tile has been moved.
- * @param {!Element} tile Tile that has been moved.
- */
-function stopReorder(tile) {
- reordering = false;
- elementToReorder = null;
-
- tile.classList.remove(CLASSES.REORDER);
- document.body.classList.remove(CLASSES.REORDERING);
-
- // Update |data-pos| for all tiles and notify EmbeddedSearchAPI that the tile
- // has been moved.
- const allTiles = document.querySelectorAll('#mv-tiles .' + CLASSES.MD_TILE);
- for (let i = 0; i < allTiles.length; i++) {
- allTiles[i].setAttribute('data-pos', i);
- }
- chrome.embeddedSearch.newTabPage.reorderCustomLink(
- Number(tile.getAttribute('data-rid')),
- Number(tile.getAttribute('data-pos')));
-}
-
-/**
- * Sets up event listeners necessary for tile reordering.
- * @param {!Element} tile Tile on which to set the event listeners.
- */
-function setupReorder(tile) {
- // Starts the reorder flow.
- tile.addEventListener('dragstart', (event) => {
- if (!reordering) {
- startReorder(tile);
- }
- });
-
- tile.addEventListener('dragover', (event) => {
- // Only executed when the reorder flow is ongoing. Inserts the tile that is
- // being moved before/after this |tile| according to order in the list.
- if (reordering && elementToReorder && elementToReorder != tile) {
- // Determine which side to insert the element on:
- // - If the held tile comes after the current tile, insert behind the
- // current tile.
- // - If the held tile comes before the current tile, insert in front of
- // the current tile.
- let insertBefore; // Element to insert the held tile behind.
- if (tile.compareDocumentPosition(elementToReorder) &
- Node.DOCUMENT_POSITION_FOLLOWING) {
- insertBefore = tile;
- } else {
- insertBefore = tile.nextSibling;
- }
- $('mv-tiles').insertBefore(elementToReorder, insertBefore);
- }
- });
-}
-
-/**
- * Renders a MostVisited tile to the DOM.
- * @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
+ * Renders a MostVisited tile (i.e. shortcut) to the DOM.
+ * @param {!MostVisitedData} data Object containing rid, url, title, favicon,
+ * and optionally isAddButton. isAddButton is true if you want to construct
+ * an add custom link button, and can only be set if custom links is
* enabled.
- */
-function renderTile(data) {
- return renderMaterialDesignTile(data);
-}
-
-/**
- * Renders a MostVisited tile with Material Design styles.
- * @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) {
+function renderTile(data) {
const mdTile = document.createElement('a');
- if (data == null) {
- mdTile.className = CLASSES.MD_EMPTY_TILE;
- return mdTile;
- }
mdTile.className = CLASSES.MD_TILE;
// The tile will be appended to |tiles|.
@@ -1297,16 +1160,7 @@ function renderMaterialDesignTile(data) {
mdTile.appendChild(mdMenu);
}
- if (isGridEnabled) {
- return currGrid.createGridTile(mdTile, data.rid, !!data.isAddButton);
- } else {
- // Enable reordering.
- if (isCustomLinksEnabled() && !data.isAddButton) {
- mdTile.draggable = 'true';
- setupReorder(mdTile);
- }
- return mdTile;
- }
+ return currGrid.createGridTile(mdTile, data.rid, !!data.isAddButton);
}
/**
@@ -1316,7 +1170,7 @@ function init() {
// Create a new DOM element to hold the tiles. The tiles will be added
// one-by-one via addTile, and the whole thing will be inserted into the page
// in swapInNewTiles, after the parent has sent us the 'show' message, and all
- // thumbnails and favicons have loaded.
+ // favicons have loaded.
tiles = document.createElement('div');
// Parse query arguments.
@@ -1342,17 +1196,6 @@ function init() {
customLinksFeatureEnabled = true;
}
- // Enable grid layout.
- if (queryArgs['enableGrid'] == '1') {
- isGridEnabled = true;
- document.body.classList.add(CLASSES.GRID_LAYOUT);
- }
-
- // Set the maximum number of tiles to show.
- if (isCustomLinksEnabled()) {
- maxNumTiles = MD_MAX_NUM_CUSTOM_LINK_TILES;
- }
-
currGrid = new Grid();
// Set up layout updates on window resize. Throttled according to
// |RESIZE_TIMEOUT_DELAY|.
@@ -1363,11 +1206,7 @@ function init() {
}
resizeTimeout = window.setTimeout(() => {
resizeTimeout = null;
- if (isGridEnabled) {
- currGrid.onResize();
- } else {
- updateTileVisibility();
- }
+ currGrid.onResize();
}, RESIZE_TIMEOUT_DELAY);
};
@@ -1384,7 +1223,6 @@ function listen() {
return {
Grid: Grid, // Exposed for testing.
init: init, // Exposed for testing.
- enableGridLayoutForTesting: enableGridLayoutForTesting,
listen: listen,
};
}
diff --git a/chromium/chrome/browser/resources/management/BUILD.gn b/chromium/chrome/browser/resources/management/BUILD.gn
index 82dfd3d4cd9..4e27e412b9f 100644
--- a/chromium/chrome/browser/resources/management/BUILD.gn
+++ b/chromium/chrome/browser/resources/management/BUILD.gn
@@ -3,8 +3,10 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/polymer/polymer.gni")
js_type_check("closure_compile") {
+ is_polymer3 = true
deps = [
":management_browser_proxy",
":management_ui",
@@ -13,15 +15,34 @@ js_type_check("closure_compile") {
js_library("management_ui") {
deps = [
- "//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:i18n_behavior",
- "//ui/webui/resources/js:load_time_data",
- "//ui/webui/resources/js:web_ui_listener_behavior",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/js:i18n_behavior.m",
+ "//ui/webui/resources/js:load_time_data.m",
+ "//ui/webui/resources/js:web_ui_listener_behavior.m",
]
}
js_library("management_browser_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
+ ]
+}
+
+polymer_modulizer("management_ui") {
+ js_file = "management_ui.js"
+ html_file = "management_ui.html"
+ html_type = "v3-ready"
+}
+
+polymer_modulizer("icons") {
+ js_file = "icons.js"
+ html_file = "icons.html"
+ html_type = "v3-ready"
+}
+
+group("polymer3_elements") {
+ deps = [
+ ":icons_module",
+ ":management_ui_module",
]
}
diff --git a/chromium/chrome/browser/resources/management/icons.html b/chromium/chrome/browser/resources/management/icons.html
index 2311bf2ec29..e6a075711d8 100644
--- a/chromium/chrome/browser/resources/management/icons.html
+++ b/chromium/chrome/browser/resources/management/icons.html
@@ -1,9 +1,4 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html">
-
<!-- Set of the management specific icons -->
-
<iron-iconset-svg name="management" size="24">
<svg>
<defs>
diff --git a/chromium/chrome/browser/resources/management/icons.js b/chromium/chrome/browser/resources/management/icons.js
new file mode 100644
index 00000000000..02ab37aaf4d
--- /dev/null
+++ b/chromium/chrome/browser/resources/management/icons.js
@@ -0,0 +1,10 @@
+// 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://resources/polymer/v3_0/iron-iconset-svg/iron-iconset-svg.js';
+
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+const template = html`{__html_template__}`;
+document.head.appendChild(template.content);
diff --git a/chromium/chrome/browser/resources/management/management.html b/chromium/chrome/browser/resources/management/management.html
index 8b4f15545d9..aea7f12bb74 100644
--- a/chromium/chrome/browser/resources/management/management.html
+++ b/chromium/chrome/browser/resources/management/management.html
@@ -7,7 +7,6 @@
<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);
@@ -30,8 +29,7 @@
}
</style>
- <link rel="import" href="management_ui.html">
- <script src="strings.js"></script>
+ <script type="module" src="management_ui.js"></script>
</head>
<body>
<management-ui></management-ui>
diff --git a/chromium/chrome/browser/resources/management/management_browser_proxy.html b/chromium/chrome/browser/resources/management/management_browser_proxy.html
deleted file mode 100644
index abaff4208aa..00000000000
--- a/chromium/chrome/browser/resources/management/management_browser_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="management_browser_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/management/management_browser_proxy.js b/chromium/chrome/browser/resources/management/management_browser_proxy.js
index a86bbaa7b15..9c5614071dd 100644
--- a/chromium/chrome/browser/resources/management/management_browser_proxy.js
+++ b/chromium/chrome/browser/resources/management/management_browser_proxy.js
@@ -2,166 +2,156 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('management', function() {
- /**
- * @typedef {{
- * name: string,
- * permissions: !Array<string>
- * }}
- */
- let Extension;
-
- /** @enum {string} */
- const ReportingType = {
- SECURITY: 'security',
- DEVICE: 'device',
- USER: 'user',
- USER_ACTIVITY: 'user-activity',
- EXTENSIONS: 'extensions'
- };
+import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
+
+/**
+ * @typedef {{
+ * name: string,
+ * permissions: !Array<string>
+ * }}
+ */
+export let Extension;
+
+/** @enum {string} */
+export const ReportingType = {
+ SECURITY: 'security',
+ DEVICE: 'device',
+ USER: 'user',
+ USER_ACTIVITY: 'user-activity',
+ EXTENSIONS: 'extensions'
+};
+
+/**
+ * @typedef {{
+ * messageId: string,
+ * reportingType: !ReportingType,
+ * }}
+ */
+export let BrowserReportingResponse;
+
+/**
+ * @typedef {{
+ * browserManagementNotice: string,
+ * extensionReportingTitle: string,
+ * pageSubtitle: string,
+ * managed: boolean,
+ * overview: string,
+ * customerLogo: string,
+ * threatProtectionDescription: string
+ * }}
+ */
+let ManagedDataResponse;
+
+/**
+ * @typedef {{
+ * title: string,
+ * permission: string
+ * }}
+ */
+let ThreatProtectionPermission;
+
+/**
+ * @typedef {{
+ * info: !Array<!ThreatProtectionPermission>,
+ * description: string
+ * }}
+ */
+export let ThreatProtectionInfo;
+
+// <if expr="chromeos">
+/**
+ * @enum {string} Look at ToJSDeviceReportingType usage in
+ * management_ui_handler.cc for more details.
+ */
+export const DeviceReportingType = {
+ SUPERVISED_USER: 'supervised user',
+ DEVICE_ACTIVITY: 'device activity',
+ STATISTIC: 'device statistics',
+ DEVICE: 'device',
+ LOGS: 'logs',
+ PRINT: 'print',
+ CROSTINI: 'crostini'
+};
+
+
+/**
+ * @typedef {{
+ * messageId: string,
+ * reportingType: !DeviceReportingType,
+ * }}
+ */
+export let DeviceReportingResponse;
+// </if>
+
+/** @interface */
+export class ManagementBrowserProxy {
+ /** @return {!Promise<!Array<!Extension>>} */
+ getExtensions() {}
+ // <if expr="chromeos">
/**
- * @typedef {{
- * messageId: string,
- * reportingType: !management.ReportingType,
- * }}
+ * @return {!Promise<boolean>} Boolean describing trust root configured
+ * or not.
*/
- let BrowserReportingResponse;
+ getLocalTrustRootsInfo() {}
/**
- * @typedef {{
- * browserManagementNotice: string,
- * extensionReportingTitle: string,
- * pageSubtitle: string,
- * managed: boolean,
- * overview: string,
- * customerLogo: string,
- * threatProtectionDescription: string
- * }}
+ * @return {!Promise<!Array<DeviceReportingResponse>>} List of
+ * items to display in device reporting section.
*/
- let ManagedDataResponse;
+ getDeviceReportingInfo() {}
+ // </if>
- /**
- * @typedef {{
- * title: string,
- * permission: string
- * }}
- */
- let ThreatProtectionPermission;
+ /** @return {!Promise<!ManagedDataResponse>} */
+ getContextualManagedData() {}
- /**
- * @typedef {{
- * info: !Array<!ThreatProtectionPermission>,
- * description: string
- * }}
- */
- let ThreatProtectionInfo;
+ /** @return {!Promise<!ThreatProtectionInfo>} */
+ getThreatProtectionInfo() {}
- // <if expr="chromeos">
/**
- * @enum {string} Look at ToJSDeviceReportingType usage in
- * management_ui_handler.cc for more details.
+ * @return {!Promise<!Array<!BrowserReportingResponse>>} The list
+ * of browser reporting info messages.
*/
- const DeviceReportingType = {
- SUPERVISED_USER: 'supervised user',
- DEVICE_ACTIVITY: 'device activity',
- STATISTIC: 'device statistics',
- DEVICE: 'device',
- LOGS: 'logs',
- PRINT: 'print',
- CROSTINI: 'crostini'
- };
+ initBrowserReportingInfo() {}
+}
+
+/** @implements {ManagementBrowserProxy} */
+export class ManagementBrowserProxyImpl {
+ /** @override */
+ getExtensions() {
+ return sendWithPromise('getExtensions');
+ }
+ // <if expr="chromeos">
+ /** @override */
+ getLocalTrustRootsInfo() {
+ return sendWithPromise('getLocalTrustRootsInfo');
+ }
- /**
- * @typedef {{
- * messageId: string,
- * reportingType: !management.DeviceReportingType,
- * }}
- */
- let DeviceReportingResponse;
+ /** @override */
+ getDeviceReportingInfo() {
+ return sendWithPromise('getDeviceReportingInfo');
+ }
// </if>
- /** @interface */
- class ManagementBrowserProxy {
- /** @return {!Promise<!Array<!management.Extension>>} */
- getExtensions() {}
-
- // <if expr="chromeos">
- /**
- * @return {!Promise<boolean>} Boolean describing trust root configured
- * or not.
- */
- getLocalTrustRootsInfo() {}
-
- /**
- * @return {!Promise<!Array<management.DeviceReportingResponse>>} List of
- * items to display in device reporting section.
- */
- getDeviceReportingInfo() {}
- // </if>
-
- /** @return {!Promise<!management.ManagedDataResponse>} */
- getContextualManagedData() {}
-
- /** @return {!Promise<!management.ThreatProtectionInfo>} */
- getThreatProtectionInfo() {}
-
- /**
- * @return {!Promise<!Array<!management.BrowserReportingResponse>>} The list
- * of browser reporting info messages.
- */
- initBrowserReportingInfo() {}
+ /** @override */
+ getContextualManagedData() {
+ return sendWithPromise('getContextualManagedData');
+ }
+
+ /** @override */
+ getThreatProtectionInfo() {
+ return sendWithPromise('getThreatProtectionInfo');
}
- /** @implements {management.ManagementBrowserProxy} */
- class ManagementBrowserProxyImpl {
- /** @override */
- getExtensions() {
- return cr.sendWithPromise('getExtensions');
- }
-
- // <if expr="chromeos">
- /** @override */
- getLocalTrustRootsInfo() {
- return cr.sendWithPromise('getLocalTrustRootsInfo');
- }
-
- /** @override */
- getDeviceReportingInfo() {
- return cr.sendWithPromise('getDeviceReportingInfo');
- }
- // </if>
-
- /** @override */
- getContextualManagedData() {
- return cr.sendWithPromise('getContextualManagedData');
- }
-
- /** @override */
- getThreatProtectionInfo() {
- return cr.sendWithPromise('getThreatProtectionInfo');
- }
-
- /** @override */
- initBrowserReportingInfo() {
- return cr.sendWithPromise('initBrowserReportingInfo');
- }
+ /** @override */
+ initBrowserReportingInfo() {
+ return sendWithPromise('initBrowserReportingInfo');
}
+}
+
+addSingletonGetter(ManagementBrowserProxyImpl);
- cr.addSingletonGetter(ManagementBrowserProxyImpl);
-
- return {
- BrowserReportingResponse: BrowserReportingResponse,
- // <if expr="chromeos">
- DeviceReportingResponse: DeviceReportingResponse,
- DeviceReportingType: DeviceReportingType,
- // </if>
- Extension: Extension,
- ManagedDataResponse: ManagedDataResponse,
- ManagementBrowserProxyImpl: ManagementBrowserProxyImpl,
- ManagementBrowserProxy: ManagementBrowserProxy,
- ReportingType: ReportingType,
- ThreatProtectionInfo: ThreatProtectionInfo,
- };
-});
+// Export |ManagementBrowserProxyImpl| on |window| so that it can be accessed by
+// management_ui_browsertest.cc
+window.ManagementBrowserProxyImpl = ManagementBrowserProxyImpl;
diff --git a/chromium/chrome/browser/resources/management/management_ui.html b/chromium/chrome/browser/resources/management/management_ui.html
index f52326d1ad8..93ecc899507 100644
--- a/chromium/chrome/browser/resources/management/management_ui.html
+++ b/chromium/chrome/browser/resources/management/management_ui.html
@@ -1,20 +1,4 @@
-<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_page_host_style_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">
-<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="icons.html">
-<link rel="import" href="management_browser_proxy.html">
-
-<dom-module id="management-ui">
- <template>
<style include="cr-icons cr-hidden-style cr-page-host-style
cr-shared-style">
:host {
@@ -324,6 +308,3 @@
</div>
</div>
</main>
- </template>
- <script src="management_ui.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/management/management_ui.js b/chromium/chrome/browser/resources/management/management_ui.js
index a04d5ed4935..4968ac9d058 100644
--- a/chromium/chrome/browser/resources/management/management_ui.js
+++ b/chromium/chrome/browser/resources/management/management_ui.js
@@ -2,294 +2,309 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('management', function() {
- /**
- * @typedef {{
- * messageIds: !Array<string>,
- * icon: string,
- * }}
- */
- let BrowserReportingData;
-
- Polymer({
- is: 'management-ui',
+import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.m.js';
+import 'chrome://resources/cr_elements/cr_icons_css.m.js';
+import 'chrome://resources/cr_elements/cr_page_host_style_css.m.js';
+import 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar.m.js';
+import 'chrome://resources/cr_elements/hidden_style_css.m.js';
+import 'chrome://resources/cr_elements/icons.m.js';
+import 'chrome://resources/cr_elements/shared_style_css.m.js';
+import './icons.js';
+import './strings.m.js';
+
+import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
+import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
+import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js';
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {BrowserReportingResponse, Extension, ManagementBrowserProxy, ManagementBrowserProxyImpl, ReportingType, ThreatProtectionInfo} from './management_browser_proxy.js';
+// <if expr="chromeos">
+import {DeviceReportingResponse, DeviceReportingType} from './management_browser_proxy.js';
+// </if>
+
+/**
+ * @typedef {{
+ * messageIds: !Array<string>,
+ * icon: string,
+ * }}
+ */
+let BrowserReportingData;
+
+Polymer({
+ is: 'management-ui',
+
+ _template: html`{__html_template__}`,
+
+ behaviors: [
+ I18nBehavior,
+ WebUIListenerBehavior,
+ ],
+
+ properties: {
+ /**
+ * List of messages related to browser reporting.
+ * @private {?Array<!BrowserReportingData>}
+ */
+ browserReportingInfo_: Array,
- behaviors: [
- I18nBehavior,
- WebUIListenerBehavior,
- ],
+ /**
+ * List of messages related to browser reporting.
+ * @private {?Array<!Extension>}
+ */
+ extensions_: Array,
- properties: {
- /**
- * List of messages related to browser reporting.
- * @private {?Array<!management.BrowserReportingData>}
- */
- browserReportingInfo_: Array,
+ // <if expr="chromeos">
+ /**
+ * List of messages related to device reporting.
+ * @private {?Array<!DeviceReportingResponse>}
+ */
+ deviceReportingInfo_: Array,
- /**
- * List of messages related to browser reporting.
- * @private {?Array<!management.Extension>}
- */
- extensions_: Array,
+ /**
+ * Message stating if the Trust Roots are configured.
+ * @private
+ */
+ localTrustRoots_: String,
- // <if expr="chromeos">
- /**
- * List of messages related to device reporting.
- * @private {?Array<!management.DeviceReportingResponse>}
- */
- deviceReportingInfo_: Array,
+ /** @private */
+ customerLogo_: String,
- /**
- * Message stating if the Trust Roots are configured.
- * @private
- */
- localTrustRoots_: String,
+ /** @private */
+ managementOverview_: String,
- /** @private */
- customerLogo_: String,
+ // </if>
- /** @private */
- managementOverview_: String,
+ /** @private */
+ subtitle_: String,
- // </if>
+ // <if expr="not chromeos">
+ /** @private */
+ managementNoticeHtml_: String,
+ // </if>
- /** @private */
- subtitle_: String,
+ /** @private */
+ managed_: Boolean,
- // <if expr="not chromeos">
- /** @private */
- managementNoticeHtml_: String,
- // </if>
+ /** @private */
+ extensionReportingSubtitle_: String,
- /** @private */
- managed_: Boolean,
+ /** @private {!ThreatProtectionInfo} */
+ threatProtectionInfo_: Object,
+ },
- /** @private */
- extensionReportingSubtitle_: String,
+ /** @private {?ManagementBrowserProxy} */
+ browserProxy_: null,
- /** @private {!management.ThreatProtectionInfo} */
- threatProtectionInfo_: Object,
- },
+ /** @override */
+ attached() {
+ document.documentElement.classList.remove('loading');
+ this.browserProxy_ = ManagementBrowserProxyImpl.getInstance();
+ this.updateManagedFields_();
+ this.initBrowserReportingInfo_();
+ this.getThreatProtectionInfo_();
- /** @private {?management.ManagementBrowserProxy} */
- browserProxy_: null,
+ this.addWebUIListener(
+ 'browser-reporting-info-updated',
+ reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo));
- /** @override */
- attached() {
- document.documentElement.classList.remove('loading');
- this.browserProxy_ = management.ManagementBrowserProxyImpl.getInstance();
+ this.addWebUIListener('managed_data_changed', () => {
this.updateManagedFields_();
- this.initBrowserReportingInfo_();
- this.getThreatProtectionInfo_();
-
- this.addWebUIListener(
- 'browser-reporting-info-updated',
- reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo));
-
- this.addWebUIListener('managed_data_changed', () => {
- this.updateManagedFields_();
- });
-
- this.addWebUIListener(
- 'threat-protection-info-updated',
- info => this.threatProtectionInfo_ = info);
-
- this.getExtensions_();
- // <if expr="chromeos">
- this.getDeviceReportingInfo_();
- this.getLocalTrustRootsInfo_();
- // </if>
- },
-
- /** @private */
- initBrowserReportingInfo_() {
- this.browserProxy_.initBrowserReportingInfo().then(
- reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo));
- },
+ });
- /**
- * @param {!Array<!management.BrowserReportingResponse>} reportingInfo
- * @private
- */
- onBrowserReportingInfoReceived_(reportingInfo) {
- const reportingInfoMap = reportingInfo.reduce((info, response) => {
- info[response.reportingType] = info[response.reportingType] || {
- icon: this.getIconForReportingType_(response.reportingType),
- messageIds: []
- };
- info[response.reportingType].messageIds.push(response.messageId);
- return info;
- }, {});
-
- const reportingTypeOrder = {
- [management.ReportingType.SECURITY]: 1,
- [management.ReportingType.EXTENSIONS]: 2,
- [management.ReportingType.USER]: 3,
- [management.ReportingType.USER_ACTIVITY]: 4,
- [management.ReportingType.DEVICE]: 5,
- };
-
- this.browserReportingInfo_ =
- Object.keys(reportingInfoMap)
- .sort((a, b) => reportingTypeOrder[a] - reportingTypeOrder[b])
- .map(reportingType => reportingInfoMap[reportingType]);
- },
-
- /** @private */
- getExtensions_() {
- this.browserProxy_.getExtensions().then(extensions => {
- this.extensions_ = extensions;
- });
- },
-
- /** @private */
- getThreatProtectionInfo_() {
- this.browserProxy_.getThreatProtectionInfo().then(info => {
- this.threatProtectionInfo_ = info;
- });
- },
-
- /**
- * @return {boolean} True if there is threat protection info to show.
- * @private
- */
- showThreatProtectionInfo_() {
- return !!this.threatProtectionInfo_ &&
- this.threatProtectionInfo_.info.length > 0;
- },
+ this.addWebUIListener(
+ 'threat-protection-info-updated',
+ info => this.threatProtectionInfo_ = info);
+ this.getExtensions_();
// <if expr="chromeos">
- /** @private */
- getLocalTrustRootsInfo_() {
- this.browserProxy_.getLocalTrustRootsInfo().then(trustRootsConfigured => {
- this.localTrustRoots_ = trustRootsConfigured ?
- loadTimeData.getString('managementTrustRootsConfigured') :
- '';
- });
- },
+ this.getDeviceReportingInfo_();
+ this.getLocalTrustRootsInfo_();
+ // </if>
+ },
- /** @private */
- getDeviceReportingInfo_() {
- this.browserProxy_.getDeviceReportingInfo().then(reportingInfo => {
- this.deviceReportingInfo_ = reportingInfo;
- });
- },
+ /** @private */
+ initBrowserReportingInfo_() {
+ this.browserProxy_.initBrowserReportingInfo().then(
+ reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo));
+ },
- /**
- * @return {boolean} True of there are device reporting info to show.
- * @private
- */
- showDeviceReportingInfo_() {
- return !!this.deviceReportingInfo_ &&
- this.deviceReportingInfo_.length > 0;
- },
+ /**
+ * @param {!Array<!BrowserReportingResponse>} reportingInfo
+ * @private
+ */
+ onBrowserReportingInfoReceived_(reportingInfo) {
+ const reportingInfoMap = reportingInfo.reduce((info, response) => {
+ info[response.reportingType] = info[response.reportingType] || {
+ icon: this.getIconForReportingType_(response.reportingType),
+ messageIds: []
+ };
+ info[response.reportingType].messageIds.push(response.messageId);
+ return info;
+ }, {});
+
+ const reportingTypeOrder = {
+ [ReportingType.SECURITY]: 1,
+ [ReportingType.EXTENSIONS]: 2,
+ [ReportingType.USER]: 3,
+ [ReportingType.USER_ACTIVITY]: 4,
+ [ReportingType.DEVICE]: 5,
+ };
+
+ this.browserReportingInfo_ =
+ Object.keys(reportingInfoMap)
+ .sort((a, b) => reportingTypeOrder[a] - reportingTypeOrder[b])
+ .map(reportingType => reportingInfoMap[reportingType]);
+ },
+
+ /** @private */
+ getExtensions_() {
+ this.browserProxy_.getExtensions().then(extensions => {
+ this.extensions_ = extensions;
+ });
+ },
+
+ /** @private */
+ getThreatProtectionInfo_() {
+ this.browserProxy_.getThreatProtectionInfo().then(info => {
+ this.threatProtectionInfo_ = info;
+ });
+ },
- /**
- * @param {management.DeviceReportingType} reportingType
- * @return {string} The associated icon.
- * @private
- */
- getIconForDeviceReportingType_(reportingType) {
- switch (reportingType) {
- case management.DeviceReportingType.SUPERVISED_USER:
- return 'management:supervised-user';
- case management.DeviceReportingType.DEVICE_ACTIVITY:
- return 'management:timelapse';
- case management.DeviceReportingType.STATISTIC:
- return 'management:bar-chart';
- case management.DeviceReportingType.DEVICE:
- return 'cr:computer';
- case management.DeviceReportingType.LOGS:
- return 'management:report';
- case management.DeviceReportingType.PRINT:
- return 'cr:print';
- case management.DeviceReportingType.CROSTINI:
- return 'management:linux';
- default:
- return 'cr:computer';
- }
- },
- // </if>
+ /**
+ * @return {boolean} True if there is threat protection info to show.
+ * @private
+ */
+ showThreatProtectionInfo_() {
+ return !!this.threatProtectionInfo_ &&
+ this.threatProtectionInfo_.info.length > 0;
+ },
+
+ // <if expr="chromeos">
+ /** @private */
+ getLocalTrustRootsInfo_() {
+ this.browserProxy_.getLocalTrustRootsInfo().then(trustRootsConfigured => {
+ this.localTrustRoots_ = trustRootsConfigured ?
+ loadTimeData.getString('managementTrustRootsConfigured') :
+ '';
+ });
+ },
+
+ /** @private */
+ getDeviceReportingInfo_() {
+ this.browserProxy_.getDeviceReportingInfo().then(reportingInfo => {
+ this.deviceReportingInfo_ = reportingInfo;
+ });
+ },
- /**
- * @return {boolean} True of there are browser reporting info to show.
- * @private
- */
- showBrowserReportingInfo_() {
- return !!this.browserReportingInfo_ &&
- this.browserReportingInfo_.length > 0;
- },
+ /**
+ * @return {boolean} True of there are device reporting info to show.
+ * @private
+ */
+ showDeviceReportingInfo_() {
+ return !!this.deviceReportingInfo_ && this.deviceReportingInfo_.length > 0;
+ },
- /**
- * @return {boolean} True of there are extension reporting info to show.
- * @private
- */
- showExtensionReportingInfo_() {
- return !!this.extensions_ && this.extensions_.length > 0;
- },
+ /**
+ * @param {DeviceReportingType} reportingType
+ * @return {string} The associated icon.
+ * @private
+ */
+ getIconForDeviceReportingType_(reportingType) {
+ switch (reportingType) {
+ case DeviceReportingType.SUPERVISED_USER:
+ return 'management:supervised-user';
+ case DeviceReportingType.DEVICE_ACTIVITY:
+ return 'management:timelapse';
+ case DeviceReportingType.STATISTIC:
+ return 'management:bar-chart';
+ case DeviceReportingType.DEVICE:
+ return 'cr:computer';
+ case DeviceReportingType.LOGS:
+ return 'management:report';
+ case DeviceReportingType.PRINT:
+ return 'cr:print';
+ case DeviceReportingType.CROSTINI:
+ return 'management:linux';
+ default:
+ return 'cr:computer';
+ }
+ },
+ // </if>
- /**
- * @param {management.ReportingType} reportingType
- * @returns {string} The associated icon.
- * @private
- */
- getIconForReportingType_(reportingType) {
- switch (reportingType) {
- case management.ReportingType.SECURITY:
- return 'cr:security';
- case management.ReportingType.DEVICE:
- return 'cr:computer';
- case management.ReportingType.EXTENSIONS:
- return 'cr:extension';
- case management.ReportingType.USER:
- return 'management:account-circle';
- case management.ReportingType.USER_ACTIVITY:
- return 'management:public';
- default:
- return 'cr:security';
- }
- },
+ /**
+ * @return {boolean} True of there are browser reporting info to show.
+ * @private
+ */
+ showBrowserReportingInfo_() {
+ return !!this.browserReportingInfo_ &&
+ this.browserReportingInfo_.length > 0;
+ },
- /**
- * 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)}`;
- },
+ /**
+ * @return {boolean} True of there are extension reporting info to show.
+ * @private
+ */
+ showExtensionReportingInfo_() {
+ return !!this.extensions_ && this.extensions_.length > 0;
+ },
- /** @private */
- onTapBack_() {
- if (history.length > 1) {
- history.back();
- } else {
- window.location.href = 'chrome://settings/help';
- }
- },
+ /**
+ * @param {ReportingType} reportingType
+ * @returns {string} The associated icon.
+ * @private
+ */
+ getIconForReportingType_(reportingType) {
+ switch (reportingType) {
+ case ReportingType.SECURITY:
+ return 'cr:security';
+ case ReportingType.DEVICE:
+ return 'cr:computer';
+ case ReportingType.EXTENSIONS:
+ return 'cr:extension';
+ case ReportingType.USER:
+ return 'management:account-circle';
+ case ReportingType.USER_ACTIVITY:
+ return 'management:public';
+ default:
+ return 'cr:security';
+ }
+ },
- /** @private */
- updateManagedFields_() {
- this.browserProxy_.getContextualManagedData().then(data => {
- this.managed_ = data.managed;
- this.extensionReportingSubtitle_ = data.extensionReportingTitle;
- this.subtitle_ = data.pageSubtitle;
- // <if expr="chromeos">
- this.customerLogo_ = data.customerLogo;
- this.managementOverview_ = data.overview;
- // </if>
- // <if expr="not chromeos">
- this.managementNoticeHtml_ = data.browserManagementNotice;
- // </if>
- });
- },
- });
-
- return {
- BrowserReportingData: BrowserReportingData,
- };
+ /**
+ * 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_() {
+ if (history.length > 1) {
+ history.back();
+ } else {
+ 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;
+ // <if expr="chromeos">
+ this.customerLogo_ = data.customerLogo;
+ this.managementOverview_ = data.overview;
+ // </if>
+ // <if expr="not chromeos">
+ this.managementNoticeHtml_ = data.browserManagementNotice;
+ // </if>
+ });
+ },
});
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/BUILD.gn b/chromium/chrome/browser/resources/media_router/BUILD.gn
index 7a2ca5ce91a..6afd405a48e 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/BUILD.gn
+++ b/chromium/chrome/browser/resources/media_router/BUILD.gn
@@ -6,10 +6,13 @@ import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
- ":viewer-toolbar-dropdown",
+ ":media_router_internals",
]
}
-js_library("viewer-toolbar-dropdown") {
- deps = []
+js_library("media_router_internals") {
+ deps = [
+ "//ui/webui/resources/js:cr.m",
+ "//ui/webui/resources/js:util.m",
+ ]
}
diff --git a/chromium/chrome/browser/resources/media_router/media_router_internals.html b/chromium/chrome/browser/resources/media_router/media_router_internals.html
index 09e1b94867f..751c30eae0d 100644
--- a/chromium/chrome/browser/resources/media_router/media_router_internals.html
+++ b/chromium/chrome/browser/resources/media_router/media_router_internals.html
@@ -3,9 +3,7 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="media_router_internals.css">
- <link rel="import" href="chrome://resources/html/cr.html">
- <link rel="import" href="chrome://resources/html/util.html">
- <script src="media_router_internals.js"></script>
+ <script type="module" src="media_router_internals.js"></script>
</head>
<body>
<div id="sink-status-div"></div>
diff --git a/chromium/chrome/browser/resources/media_router/media_router_internals.js b/chromium/chrome/browser/resources/media_router/media_router_internals.js
index 7f801e26ad8..28e32f80548 100644
--- a/chromium/chrome/browser/resources/media_router/media_router_internals.js
+++ b/chromium/chrome/browser/resources/media_router/media_router_internals.js
@@ -2,29 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Handles user events for the Media Router Internals UI.
-cr.define('media_router_internals', function() {
- 'use strict';
-
- /**
- * Initializes the Media Router Internals WebUI
- */
- function initialize() {
- // Notify the browser that the page has loaded, causing it to send media
- // router status.
- chrome.send('initialized');
- }
+import {sendWithPromise} from 'chrome://resources/js/cr.m.js';
+import {$} from 'chrome://resources/js/util.m.js';
- function setStatus(status) {
+// Handles user events for the Media Router Internals UI.
+document.addEventListener('DOMContentLoaded', function() {
+ sendWithPromise('getStatus').then(status => {
const jsonStatus = JSON.stringify(status, null, /* spacing level = */ 2);
$('sink-status-div').textContent = jsonStatus;
- }
-
- return {
- initialize: initialize,
- setStatus: setStatus,
- };
+ });
});
-
-document.addEventListener(
- 'DOMContentLoaded', media_router_internals.initialize);
diff --git a/chromium/chrome/browser/resources/ntp4/apps_page.js b/chromium/chrome/browser/resources/ntp4/apps_page.js
index 026b45813c5..460883b526e 100644
--- a/chromium/chrome/browser/resources/ntp4/apps_page.js
+++ b/chromium/chrome/browser/resources/ntp4/apps_page.js
@@ -105,7 +105,7 @@ cr.define('ntp', function() {
*/
appendMenuItem_: function(opt_textId) {
const button =
- /** @type {!HTMLButtonElement} */ (cr.doc.createElement('button'));
+ /** @type {!HTMLButtonElement} */ (document.createElement('button'));
this.menu.appendChild(button);
cr.ui.decorate(button, cr.ui.MenuItem);
if (opt_textId) {
@@ -248,7 +248,7 @@ cr.define('ntp', function() {
* @extends {HTMLDivElement}
*/
function App(appData) {
- const el = cr.doc.createElement('div');
+ const el = /** @type {!App} */ (document.createElement('div'));
el.__proto__ = App.prototype;
el.initialize(appData);
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 1e2b3cc2b3c..95c06095f56 100644
--- a/chromium/chrome/browser/resources/ntp4/incognito_and_guest_tab.css
+++ b/chromium/chrome/browser/resources/ntp4/incognito_and_guest_tab.css
@@ -11,7 +11,7 @@ body {
@media (prefers-color-scheme: dark) {
html {
- background: rgb(50, 54, 57);
+ background: rgb(53, 54, 58);
color: rgb(232, 234, 237); /* --google-grey-200 */
}
}
diff --git a/chromium/chrome/browser/resources/ntp4/incognito_tab.css b/chromium/chrome/browser/resources/ntp4/incognito_tab.css
index c2beff126d3..a5f3cbb6931 100644
--- a/chromium/chrome/browser/resources/ntp4/incognito_tab.css
+++ b/chromium/chrome/browser/resources/ntp4/incognito_tab.css
@@ -8,12 +8,16 @@ body {
margin: 0;
}
+[hidden] {
+ display: none !important;
+}
+
/** Typography -------------------------------------------------------------- */
.content {
/* 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);
+ background-color: rgb(53, 54, 58);
color: rgb(232, 234, 237); /* --google-grey-200 */
font-size: calc(100% - 2px);
line-height: calc(100% + 6px);
@@ -96,6 +100,34 @@ em {
}
}
+/** Cookie Controls --------------------------------------------------------- */
+
+#cookie-controls {
+ align-items: center;
+ background-color: rgb(60, 64, 67); /* --google-grey-800 */
+ border-radius: 4px;
+ box-sizing: border-box;
+ display: flex;
+ padding: 12px 20px;
+}
+
+#cookie-controls-description {
+ flex: 1;
+ padding-inline-end: 20px;
+}
+
+#cookie-controls-description em {
+ display: block;
+}
+
+#cookie-controls-toggle {
+ flex: none;
+}
+
+#cookie-controls-toggle:not(:defined) {
+ width: 34px;
+}
+
/** Layout ------------------------------------------------------------------ */
/* Align the content, icon, and title to to the center. */
@@ -167,7 +199,8 @@ h1 {
.icon,
h1,
#subtitle,
- .bulletpoints {
+ .bulletpoints,
+ #cookie-controls {
margin-bottom: 1.5rem;
}
@@ -209,7 +242,8 @@ h1 {
.learn-more-button,
.bulletpoints,
- .icon {
+ .icon,
+ #cookie-controls {
margin-bottom: 16px;
}
}
@@ -230,7 +264,8 @@ h1 {
}
.bulletpoints,
- .learn-more-button {
+ .learn-more-button,
+ #cookie-controls {
margin-bottom: 1.5rem;
}
@@ -248,7 +283,8 @@ h1 {
}
.bulletpoints,
- .learn-more-button {
+ .learn-more-button,
+ #cookie-controls {
margin-bottom: 1rem;
}
}
diff --git a/chromium/chrome/browser/resources/ntp4/incognito_tab.html b/chromium/chrome/browser/resources/ntp4/incognito_tab.html
index 888489f7ccb..48631cb04f8 100644
--- a/chromium/chrome/browser/resources/ntp4/incognito_tab.html
+++ b/chromium/chrome/browser/resources/ntp4/incognito_tab.html
@@ -30,10 +30,21 @@ document.write('<link id="incognitothemecss" rel="stylesheet" ' +
<div class="bulletpoints first">$i18nRaw{incognitoTabFeatures}</div>
<div class="bulletpoints">$i18nRaw{incognitoTabWarning}</div>
</div>
+ <div id="cookie-controls" $i18n{hideCookieControls}>
+ <div id="cookie-controls-description">
+ <em>$i18n{cookieControlsTitle}</em>
+ $i18n{cookieControlsDescription}
+ </div>
+ <cr-toggle id="cookie-controls-toggle"
+ aria-label="$i18n{cookieControlsTitle}"
+ $i18n{cookieControlsToggleChecked} dark></cr-toggle>
+ </div>
<a class="learn-more-button" href="$i18n{learnMoreLink}">$i18n{learnMore}</a>
</div>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/util.js"></script>
<script src="incognito_tab.js"></script>
+<!-- Lazy-load cr_toggle to avoid performance penalty introduced by loading Polymer -->
+<script type="module" src="chrome://resources/cr_elements/cr_toggle/cr_toggle.m.js" async></script>
</body>
</html>
diff --git a/chromium/chrome/browser/resources/ntp4/incognito_tab.js b/chromium/chrome/browser/resources/ntp4/incognito_tab.js
index bca80d57e69..aa7de31ab36 100644
--- a/chromium/chrome/browser/resources/ntp4/incognito_tab.js
+++ b/chromium/chrome/browser/resources/ntp4/incognito_tab.js
@@ -3,7 +3,25 @@
// found in the LICENSE file.
window.addEventListener('load', function() {
+ cr.addWebUIListener('theme-changed', themeData => {
+ document.documentElement.setAttribute(
+ 'hascustombackground', themeData.hasCustomBackground);
+ $('incognitothemecss').href =
+ 'chrome://theme/css/incognito_new_tab_theme.css?' + Date.now();
+ });
chrome.send('observeThemeChanges');
+
+ cr.addWebUIListener('cookie-controls-changed', checked => {
+ $('cookie-controls-toggle').checked = checked;
+ });
+ cr.addWebUIListener(
+ 'third-party-cookie-blocking-changed', shouldHideCookieControls => {
+ $('cookie-controls').hidden = shouldHideCookieControls;
+ });
+ $('cookie-controls-toggle').addEventListener('change', event => {
+ chrome.send('cookieControlsToggleChanged', [event.detail]);
+ });
+ chrome.send('observeCookieControlsSettingsChanges');
});
// Handle the bookmark bar, theme, and font size change requests
@@ -13,12 +31,4 @@ const ntp = {
setBookmarkBarAttached: function(attached) {
document.documentElement.setAttribute('bookmarkbarattached', attached);
},
-
- /** @param {!{hasCustomBackground: boolean}} themeData */
- themeChanged: function(themeData) {
- document.documentElement.setAttribute(
- 'hascustombackground', themeData.hasCustomBackground);
- $('incognitothemecss').href =
- 'chrome://theme/css/incognito_new_tab_theme.css?' + Date.now();
- },
};
diff --git a/chromium/chrome/browser/resources/ntp4/nav_dot.js b/chromium/chrome/browser/resources/ntp4/nav_dot.js
index 22109133114..8193fe15190 100644
--- a/chromium/chrome/browser/resources/ntp4/nav_dot.js
+++ b/chromium/chrome/browser/resources/ntp4/nav_dot.js
@@ -22,7 +22,7 @@ cr.define('ntp', function() {
* @implements {cr.ui.DragWrapperDelegate}
*/
function NavDot(page, title, titleIsEditable, animate) {
- const dot = cr.doc.createElement('li');
+ const dot = /** @type {!NavDot} */ (document.createElement('li'));
dot.__proto__ = NavDot.prototype;
dot.initialize(page, title, titleIsEditable, animate);
diff --git a/chromium/chrome/browser/resources/ntp4/new_tab.css b/chromium/chrome/browser/resources/ntp4/new_tab.css
index 132872957df..eba46bcfe5f 100644
--- a/chromium/chrome/browser/resources/ntp4/new_tab.css
+++ b/chromium/chrome/browser/resources/ntp4/new_tab.css
@@ -95,10 +95,9 @@ html[dir='rtl'] #attribution {
}
#footer {
- background-image: linear-gradient(
- rgba(242, 242, 242, 0.9), rgba(222, 222, 222, 0.9));
+ background-color: white;
bottom: 0;
- color: #7F7F7F;
+ color: #666;
font-size: 0.9em;
font-weight: bold;
overflow: hidden;
@@ -273,7 +272,7 @@ html[dir='rtl'] #footer.showing-trash-mode #trash.drag-target .lid {
#chrome-web-store-link {
-webkit-order: 3;
- color: inherit;
+ color: rgb(26, 115, 232);
cursor: pointer;
display: inline-block;
margin: 0;
@@ -291,10 +290,6 @@ html[dir='rtl'] #footer.showing-trash-mode #trash.drag-target .lid {
padding-inline-start: 15px;
}
-#chrome-web-store-link:hover {
- color: #666;
-}
-
html[dir='rtl'] #chrome-web-store-title {
background-position-x: left;
}
diff --git a/chromium/chrome/browser/resources/ntp4/new_tab.html b/chromium/chrome/browser/resources/ntp4/new_tab.html
index de19cad2443..2b60f4a75a6 100644
--- a/chromium/chrome/browser/resources/ntp4/new_tab.html
+++ b/chromium/chrome/browser/resources/ntp4/new_tab.html
@@ -80,7 +80,7 @@ document.write('<link id="themecss" rel="stylesheet" ' +
<div id="footer-border"></div>
<div id="footer-content">
<div id="logo-img">
- <img alt="" src="chrome://theme/IDR_PRODUCT_LOGO">
+ <img alt="" src="chrome://theme/IDR_PRODUCT_LOGO_32">
</div>
<ul id="dot-list">
diff --git a/chromium/chrome/browser/resources/ntp4/new_tab.js b/chromium/chrome/browser/resources/ntp4/new_tab.js
index 0be7cd9f7a7..d6f7b960b48 100644
--- a/chromium/chrome/browser/resources/ntp4/new_tab.js
+++ b/chromium/chrome/browser/resources/ntp4/new_tab.js
@@ -108,6 +108,10 @@ cr.define('ntp', function() {
startTime = Date.now();
+ cr.addWebUIListener('theme-changed', () => {
+ $('themecss').href =
+ 'chrome://theme/css/new_tab_theme.css?' + Date.now();
+ });
chrome.send('observeThemeChanges');
});
}
@@ -207,15 +211,6 @@ cr.define('ntp', function() {
}
}
- /**
- * Called when the theme has changed.
- * @param {Object=} opt_themeData Not used; only exists to match equivalent
- * function in incognito NTP.
- */
- function themeChanged(opt_themeData) {
- $('themecss').href = 'chrome://theme/css/new_tab_theme.css?' + Date.now();
- }
-
function setBookmarkBarAttached(attached) {
document.documentElement.setAttribute('bookmarkbarattached', attached);
}
@@ -390,7 +385,6 @@ cr.define('ntp', function() {
setAppToBeHighlighted: setAppToBeHighlighted,
setBookmarkBarAttached: setBookmarkBarAttached,
setFaviconDominantColor: setFaviconDominantColor,
- themeChanged: themeChanged,
updateLogin: updateLogin
};
});
diff --git a/chromium/chrome/browser/resources/ntp4/tile_page.js b/chromium/chrome/browser/resources/ntp4/tile_page.js
index f6de15ab41c..600fc1f09b4 100644
--- a/chromium/chrome/browser/resources/ntp4/tile_page.js
+++ b/chromium/chrome/browser/resources/ntp4/tile_page.js
@@ -41,7 +41,7 @@ cr.define('ntp', function() {
* @extends {HTMLDivElement}
*/
function Tile(contents) {
- const tile = cr.doc.createElement('div');
+ const tile = /** @type {!Tile} */ (document.createElement('div'));
tile.__proto__ = Tile.prototype;
tile.initialize(contents);
@@ -372,7 +372,7 @@ cr.define('ntp', function() {
* @implements {cr.ui.DragWrapperDelegate}
*/
function TilePage(gridValues) {
- const el = cr.doc.createElement('div');
+ const el = /** @type {!TilePage} */ (document.createElement('div'));
el.gridValues_ = gridValues;
el.__proto__ = TilePage.prototype;
el.initialize();
diff --git a/chromium/chrome/browser/resources/offline_pages/BUILD.gn b/chromium/chrome/browser/resources/offline_pages/BUILD.gn
index 83c60714a90..fe9c078c3a3 100644
--- a/chromium/chrome/browser/resources/offline_pages/BUILD.gn
+++ b/chromium/chrome/browser/resources/offline_pages/BUILD.gn
@@ -14,15 +14,13 @@ js_type_check("closure_compile") {
js_library("offline_internals") {
deps = [
":offline_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",
+ "//ui/webui/resources/js:load_time_data.m",
+ "//ui/webui/resources/js:util.m",
]
}
js_library("offline_internals_browser_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
}
diff --git a/chromium/chrome/browser/resources/offline_pages/offline_internals.html b/chromium/chrome/browser/resources/offline_pages/offline_internals.html
index d00c5decc19..95383662692 100644
--- a/chromium/chrome/browser/resources/offline_pages/offline_internals.html
+++ b/chromium/chrome/browser/resources/offline_pages/offline_internals.html
@@ -7,12 +7,7 @@
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
<link rel="stylesheet" href="offline_internals.css">
- <link rel="import" href="chrome://resources/html/cr.html">
- <script src="chrome://resources/js/load_time_data.js"></script>
- <script src="chrome://resources/js/util.js"></script>
- <script src="strings.js"></script>
- <script src="offline_internals_browser_proxy.js"></script>
- <script src="offline_internals.js"></script>
+ <script type="module" src="offline_internals.js"></script>
</head>
<body>
<h1>Offline Internals</h1>
diff --git a/chromium/chrome/browser/resources/offline_pages/offline_internals.js b/chromium/chrome/browser/resources/offline_pages/offline_internals.js
index a5ffaa3c6c2..fa4ddffd6aa 100644
--- a/chromium/chrome/browser/resources/offline_pages/offline_internals.js
+++ b/chromium/chrome/browser/resources/offline_pages/offline_internals.js
@@ -2,362 +2,359 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('offlineInternals', function() {
- 'use strict';
-
- /** @type {!Array<OfflinePage>} */
- let offlinePages = [];
-
- /** @type {!Array<SavePageRequest>} */
- let savePageRequests = [];
-
- /** @type {!offlineInternals.OfflineInternalsBrowserProxy} */
- const browserProxy =
- offlineInternals.OfflineInternalsBrowserProxyImpl.getInstance();
-
- /**
- * Fill stored pages table.
- * @param {!Array<OfflinePage>} pages An array object representing
- * stored offline pages.
- */
- function fillStoredPages(pages) {
- const storedPagesTable = $('stored-pages');
- storedPagesTable.textContent = '';
-
- const template = $('stored-pages-table-row');
- const td = template.content.querySelectorAll('td');
- for (let pageIndex = 0; pageIndex < pages.length; pageIndex++) {
- const page = pages[pageIndex];
- td[0].textContent = pageIndex + 1;
- const checkbox = td[1].querySelector('input');
- checkbox.setAttribute('value', page.id);
-
- const link = td[2].querySelector('a');
- link.setAttribute('href', page.onlineUrl);
- const maxUrlCharsPerLine = 50;
- if (page.onlineUrl.length > maxUrlCharsPerLine) {
- link.textContent = '';
- for (let i = 0; i < page.onlineUrl.length; i += maxUrlCharsPerLine) {
- link.textContent += page.onlineUrl.slice(i, i + maxUrlCharsPerLine);
- link.textContent += '\r\n';
- }
- } else {
- link.textContent = page.onlineUrl;
+import './strings.m.js';
+
+import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
+import {$} from 'chrome://resources/js/util.m.js';
+
+import {IsLogging, OfflineInternalsBrowserProxy, OfflineInternalsBrowserProxyImpl, OfflinePage, SavePageRequest} from './offline_internals_browser_proxy.js';
+
+/** @type {!Array<OfflinePage>} */
+let offlinePages = [];
+
+/** @type {!Array<SavePageRequest>} */
+let savePageRequests = [];
+
+/** @type {!OfflineInternalsBrowserProxy} */
+const browserProxy = OfflineInternalsBrowserProxyImpl.getInstance();
+
+/**
+ * Fill stored pages table.
+ * @param {!Array<OfflinePage>} pages An array object representing
+ * stored offline pages.
+ */
+function fillStoredPages(pages) {
+ const storedPagesTable = $('stored-pages');
+ storedPagesTable.textContent = '';
+
+ const template = $('stored-pages-table-row');
+ const td = template.content.querySelectorAll('td');
+ for (let pageIndex = 0; pageIndex < pages.length; pageIndex++) {
+ const page = pages[pageIndex];
+ td[0].textContent = pageIndex + 1;
+ const checkbox = td[1].querySelector('input');
+ checkbox.setAttribute('value', page.id);
+
+ const link = td[2].querySelector('a');
+ link.setAttribute('href', page.onlineUrl);
+ const maxUrlCharsPerLine = 50;
+ if (page.onlineUrl.length > maxUrlCharsPerLine) {
+ link.textContent = '';
+ for (let i = 0; i < page.onlineUrl.length; i += maxUrlCharsPerLine) {
+ link.textContent += page.onlineUrl.slice(i, i + maxUrlCharsPerLine);
+ link.textContent += '\r\n';
}
-
- td[3].textContent = page.namespace;
- td[4].textContent = Math.round(page.size / 1024);
-
- const row = document.importNode(template.content, true);
- storedPagesTable.appendChild(row);
- }
- offlinePages = pages;
- }
-
- /**
- * Fill requests table.
- * @param {!Array<SavePageRequest>} requests An array object representing
- * the request queue.
- */
- function fillRequestQueue(requests) {
- const requestQueueTable = $('request-queue');
- requestQueueTable.textContent = '';
-
- const template = $('request-queue-table-row');
- const td = template.content.querySelectorAll('td');
- for (const request of requests) {
- const checkbox = td[0].querySelector('input');
- checkbox.setAttribute('value', request.id);
-
- td[1].textContent = request.onlineUrl;
- td[2].textContent = new Date(request.creationTime);
- td[3].textContent = request.status;
- td[4].textContent = request.requestOrigin;
-
- const row = document.importNode(template.content, true);
- requestQueueTable.appendChild(row);
- }
- savePageRequests = requests;
- }
-
- /**
- * Fills the event logs section.
- * @param {!Array<string>} logs A list of log strings.
- */
- function fillEventLog(logs) {
- const element = $('logs');
- element.textContent = '';
- for (const log of logs) {
- const logItem = document.createElement('li');
- logItem.textContent = log;
- element.appendChild(logItem);
+ } else {
+ link.textContent = page.onlineUrl;
}
- }
- /**
- * Refresh all displayed information.
- */
- function refreshAll() {
- browserProxy.getStoredPages().then(fillStoredPages);
- browserProxy.getRequestQueue().then(fillRequestQueue);
- browserProxy.getNetworkStatus().then(function(networkStatus) {
- $('current-status').textContent = networkStatus;
- });
- browserProxy.getLimitlessPrefetchingEnabled().then(function(enabled) {
- $('limitless-prefetching-checkbox').checked = enabled;
- });
- browserProxy.getPrefetchTestingHeaderValue().then(function(value) {
- switch (value) {
- case 'ForceEnable':
- $('testing-header-enable').checked = true;
- break;
- case 'ForceDisable':
- $('testing-header-disable').checked = true;
- break;
- default:
- $('testing-header-default').checked = true;
- }
- });
- refreshLog();
- }
+ td[3].textContent = page.namespace;
+ td[4].textContent = Math.round(page.size / 1024);
- /**
- * Callback when pages are deleted.
- * @param {string} status The status of the request.
- */
- function pagesDeleted(status) {
- $('page-actions-info').textContent = status;
- browserProxy.getStoredPages().then(fillStoredPages);
+ const row = document.importNode(template.content, true);
+ storedPagesTable.appendChild(row);
}
-
- /**
- * Callback when requests are deleted.
- */
- function requestsDeleted(status) {
- $('request-queue-actions-info').textContent = status;
- browserProxy.getRequestQueue().then(fillRequestQueue);
+ offlinePages = pages;
+}
+
+/**
+ * Fill requests table.
+ * @param {!Array<SavePageRequest>} requests An array object representing
+ * the request queue.
+ */
+function fillRequestQueue(requests) {
+ const requestQueueTable = $('request-queue');
+ requestQueueTable.textContent = '';
+
+ const template = $('request-queue-table-row');
+ const td = template.content.querySelectorAll('td');
+ for (const request of requests) {
+ const checkbox = td[0].querySelector('input');
+ checkbox.setAttribute('value', request.id);
+
+ td[1].textContent = request.onlineUrl;
+ td[2].textContent = new Date(request.creationTime);
+ td[3].textContent = request.status;
+ td[4].textContent = request.requestOrigin;
+
+ const row = document.importNode(template.content, true);
+ requestQueueTable.appendChild(row);
}
-
- /**
- * Callback for prefetch actions.
- * @param {string} info The result of performing the prefetch actions.
- */
- function setPrefetchResult(info) {
- $('prefetch-actions-info').textContent = info;
+ savePageRequests = requests;
+}
+
+/**
+ * Fills the event logs section.
+ * @param {!Array<string>} logs A list of log strings.
+ */
+function fillEventLog(logs) {
+ const element = $('logs');
+ element.textContent = '';
+ for (const log of logs) {
+ const logItem = document.createElement('li');
+ logItem.textContent = log;
+ element.appendChild(logItem);
}
-
- /**
- * Error callback for prefetch actions.
- * @param {*} error The error that resulted from the prefetch call.
- */
- function prefetchResultError(error) {
- const errorText = error && error.message ? error.message : error;
-
- $('prefetch-actions-info').textContent = 'Error: ' + errorText;
- }
-
- /**
- * Downloads all the stored page and request queue information into a file.
- * Also translates all the fields representing datetime into human-readable
- * date strings.
- * TODO(chili): Create a CSV writer that can abstract out the line joining.
- */
- function dumpAsJson() {
- const json = JSON.stringify(
- {offlinePages: offlinePages, savePageRequests: savePageRequests},
- function(key, value) {
- return key.endsWith('Time') ? new Date(value).toString() : value;
- },
- 2);
-
- $('dump-box').value = json;
- $('dump-info').textContent = '';
- $('dump-modal').showModal();
- $('dump-box').select();
- }
-
- function closeDump() {
- $('dump-modal').close();
- $('dump-box').value = '';
- }
-
- function copyDump() {
- $('dump-box').select();
- document.execCommand('copy');
- $('dump-info').textContent = 'Copied to clipboard!';
- }
-
- /**
- * Updates the status strings.
- * @param {!IsLogging} logStatus Status of logging.
- */
- function updateLogStatus(logStatus) {
- $('model-checkbox').checked = logStatus.modelIsLogging;
- $('request-checkbox').checked = logStatus.queueIsLogging;
- $('prefetch-checkbox').checked = logStatus.prefetchIsLogging;
- }
-
- /**
- * Sets all checkboxes with a specific name to the same checked status as the
- * provided source checkbox.
- * @param {HTMLElement} source The checkbox controlling the checked
- * status.
- * @param {string} checkboxesName The name identifying the checkboxes to set.
- */
- function toggleAllCheckboxes(source, checkboxesName) {
- const checkboxes = document.getElementsByName(checkboxesName);
- for (const checkbox of checkboxes) {
- checkbox.checked = source.checked;
+}
+
+/**
+ * Refresh all displayed information.
+ */
+function refreshAll() {
+ browserProxy.getStoredPages().then(fillStoredPages);
+ browserProxy.getRequestQueue().then(fillRequestQueue);
+ browserProxy.getNetworkStatus().then(function(networkStatus) {
+ $('current-status').textContent = networkStatus;
+ });
+ browserProxy.getLimitlessPrefetchingEnabled().then(function(enabled) {
+ $('limitless-prefetching-checkbox').checked = enabled;
+ });
+ browserProxy.getPrefetchTestingHeaderValue().then(function(value) {
+ switch (value) {
+ case 'ForceEnable':
+ $('testing-header-enable').checked = true;
+ break;
+ case 'ForceDisable':
+ $('testing-header-disable').checked = true;
+ break;
+ default:
+ $('testing-header-default').checked = true;
}
+ });
+ refreshLog();
+}
+
+/**
+ * Callback when pages are deleted.
+ * @param {string} status The status of the request.
+ */
+function pagesDeleted(status) {
+ $('page-actions-info').textContent = status;
+ browserProxy.getStoredPages().then(fillStoredPages);
+}
+
+/**
+ * Callback when requests are deleted.
+ */
+function requestsDeleted(status) {
+ $('request-queue-actions-info').textContent = status;
+ browserProxy.getRequestQueue().then(fillRequestQueue);
+}
+
+/**
+ * Callback for prefetch actions.
+ * @param {string} info The result of performing the prefetch actions.
+ */
+function setPrefetchResult(info) {
+ $('prefetch-actions-info').textContent = info;
+}
+
+/**
+ * Error callback for prefetch actions.
+ * @param {*} error The error that resulted from the prefetch call.
+ */
+function prefetchResultError(error) {
+ const errorText = error && error.message ? error.message : error;
+
+ $('prefetch-actions-info').textContent = 'Error: ' + errorText;
+}
+
+/**
+ * Downloads all the stored page and request queue information into a file.
+ * Also translates all the fields representing datetime into human-readable
+ * date strings.
+ * TODO(chili): Create a CSV writer that can abstract out the line joining.
+ */
+function dumpAsJson() {
+ const json = JSON.stringify(
+ {offlinePages: offlinePages, savePageRequests: savePageRequests},
+ function(key, value) {
+ return key.endsWith('Time') ? new Date(value).toString() : value;
+ },
+ 2);
+
+ $('dump-box').value = json;
+ $('dump-info').textContent = '';
+ $('dump-modal').showModal();
+ $('dump-box').select();
+}
+
+function closeDump() {
+ $('dump-modal').close();
+ $('dump-box').value = '';
+}
+
+function copyDump() {
+ $('dump-box').select();
+ document.execCommand('copy');
+ $('dump-info').textContent = 'Copied to clipboard!';
+}
+
+/**
+ * Updates the status strings.
+ * @param {!IsLogging} logStatus Status of logging.
+ */
+function updateLogStatus(logStatus) {
+ $('model-checkbox').checked = logStatus.modelIsLogging;
+ $('request-checkbox').checked = logStatus.queueIsLogging;
+ $('prefetch-checkbox').checked = logStatus.prefetchIsLogging;
+}
+
+/**
+ * Sets all checkboxes with a specific name to the same checked status as the
+ * provided source checkbox.
+ * @param {HTMLElement} source The checkbox controlling the checked
+ * status.
+ * @param {string} checkboxesName The name identifying the checkboxes to set.
+ */
+function toggleAllCheckboxes(source, checkboxesName) {
+ const checkboxes = document.getElementsByName(checkboxesName);
+ for (const checkbox of checkboxes) {
+ checkbox.checked = source.checked;
}
-
- /**
- * Return the item ids for the selected checkboxes with a given name.
- * @param {string} checkboxesName The name identifying the checkboxes to
- * query.
- * @return {!Array<string>} An array of selected ids.
- */
- function getSelectedIdsFor(checkboxesName) {
- const checkboxes = document.querySelectorAll(
- `input[type="checkbox"][name="${checkboxesName}"]:checked`);
- return Array.from(checkboxes).map(c => c.value);
- }
-
- /**
- * Refreshes the logs.
- */
- function refreshLog() {
- browserProxy.getEventLogs().then(fillEventLog);
- browserProxy.getLoggingState().then(updateLogStatus);
- }
-
- /**
- * Calls scheduleNwake and indicates how long the scheduled delay will be.
- */
- function ensureBackgroundTaskScheduledWithDelay() {
- browserProxy.scheduleNwake()
- .then((result) => {
- // The delays in these messages should correspond to the scheduling
- // delays defined in PrefetchBackgroundTaskScheduler.java.
- if ($('limitless-prefetching-checkbox').checked) {
- setPrefetchResult(
- result +
- ' (Limitless mode enabled; background task scheduled to run' +
- ' in a few seconds.)');
- } else {
- setPrefetchResult(
- result +
- ' (Limitless mode disabled; background task scheduled to run' +
- ' in several minutes.)');
+}
+
+/**
+ * Return the item ids for the selected checkboxes with a given name.
+ * @param {string} checkboxesName The name identifying the checkboxes to
+ * query.
+ * @return {!Array<string>} An array of selected ids.
+ */
+function getSelectedIdsFor(checkboxesName) {
+ const checkboxes = document.querySelectorAll(
+ `input[type="checkbox"][name="${checkboxesName}"]:checked`);
+ return Array.from(checkboxes).map(c => c.value);
+}
+
+/**
+ * Refreshes the logs.
+ */
+function refreshLog() {
+ browserProxy.getEventLogs().then(fillEventLog);
+ browserProxy.getLoggingState().then(updateLogStatus);
+}
+
+/**
+ * Calls scheduleNwake and indicates how long the scheduled delay will be.
+ */
+function ensureBackgroundTaskScheduledWithDelay() {
+ browserProxy.scheduleNwake()
+ .then((result) => {
+ // The delays in these messages should correspond to the scheduling
+ // delays defined in PrefetchBackgroundTaskScheduler.java.
+ if ($('limitless-prefetching-checkbox').checked) {
+ setPrefetchResult(
+ result +
+ ' (Limitless mode enabled; background task scheduled to run' +
+ ' in a few seconds.)');
+ } else {
+ setPrefetchResult(
+ result +
+ ' (Limitless mode disabled; background task scheduled to run' +
+ ' in several minutes.)');
+ }
+ })
+ .catch(prefetchResultError);
+}
+
+function initialize() {
+ const incognito = loadTimeData.getBoolean('isIncognito');
+ ['delete-selected-pages', 'delete-selected-requests', 'model-checkbox',
+ 'request-checkbox', 'refresh']
+ .forEach(el => $(el).disabled = incognito);
+
+ $('delete-selected-pages').onclick = function() {
+ const pageIds = getSelectedIdsFor('stored');
+ browserProxy.deleteSelectedPages(pageIds).then(pagesDeleted);
+ };
+ $('delete-selected-requests').onclick = function() {
+ const requestIds = getSelectedIdsFor('requests');
+ browserProxy.deleteSelectedRequests(requestIds).then(requestsDeleted);
+ };
+ $('refresh').onclick = refreshAll;
+ $('dump').onclick = dumpAsJson;
+ $('close-dump').onclick = closeDump;
+ $('copy-to-clipboard').onclick = copyDump;
+ $('model-checkbox').onchange = (evt) => {
+ browserProxy.setRecordPageModel(evt.target.checked);
+ };
+ $('request-checkbox').onchange = (evt) => {
+ browserProxy.setRecordRequestQueue(evt.target.checked);
+ };
+ $('prefetch-checkbox').onchange = (evt) => {
+ browserProxy.setRecordPrefetchService(evt.target.checked);
+ };
+ $('refresh-logs').onclick = refreshLog;
+ $('add-to-queue').onclick = function() {
+ const saveUrls = $('url').value.split(',');
+ let counter = saveUrls.length;
+ $('save-url-state').textContent = '';
+ for (let i = 0; i < saveUrls.length; i++) {
+ browserProxy.addToRequestQueue(saveUrls[i]).then(function(state) {
+ if (state) {
+ $('save-url-state').textContent +=
+ saveUrls[i] + ' has been added to queue.\n';
+ $('url').value = '';
+ counter--;
+ if (counter == 0) {
+ browserProxy.getRequestQueue().then(fillRequestQueue);
}
- })
+ } else {
+ $('save-url-state').textContent +=
+ saveUrls[i] + ' failed to be added to queue.\n';
+ }
+ });
+ }
+ };
+ $('schedule-nwake').onclick = function() {
+ browserProxy.scheduleNwake()
+ .then(setPrefetchResult)
.catch(prefetchResultError);
- }
-
- function initialize() {
- const incognito = loadTimeData.getBoolean('isIncognito');
- ['delete-selected-pages', 'delete-selected-requests', 'model-checkbox',
- 'request-checkbox', 'refresh']
- .forEach(el => $(el).disabled = incognito);
-
- $('delete-selected-pages').onclick = function() {
- const pageIds = getSelectedIdsFor('stored');
- browserProxy.deleteSelectedPages(pageIds).then(pagesDeleted);
- };
- $('delete-selected-requests').onclick = function() {
- const requestIds = getSelectedIdsFor('requests');
- browserProxy.deleteSelectedRequests(requestIds).then(requestsDeleted);
- };
- $('refresh').onclick = refreshAll;
- $('dump').onclick = dumpAsJson;
- $('close-dump').onclick = closeDump;
- $('copy-to-clipboard').onclick = copyDump;
- $('model-checkbox').onchange = (evt) => {
- browserProxy.setRecordPageModel(evt.target.checked);
- };
- $('request-checkbox').onchange = (evt) => {
- browserProxy.setRecordRequestQueue(evt.target.checked);
- };
- $('prefetch-checkbox').onchange = (evt) => {
- browserProxy.setRecordPrefetchService(evt.target.checked);
- };
- $('refresh-logs').onclick = refreshLog;
- $('add-to-queue').onclick = function() {
- const saveUrls = $('url').value.split(',');
- let counter = saveUrls.length;
- $('save-url-state').textContent = '';
- for (let i = 0; i < saveUrls.length; i++) {
- browserProxy.addToRequestQueue(saveUrls[i]).then(function(state) {
- if (state) {
- $('save-url-state').textContent +=
- saveUrls[i] + ' has been added to queue.\n';
- $('url').value = '';
- counter--;
- if (counter == 0) {
- browserProxy.getRequestQueue().then(fillRequestQueue);
- }
- } else {
- $('save-url-state').textContent +=
- saveUrls[i] + ' failed to be added to queue.\n';
- }
- });
- }
- };
- $('schedule-nwake').onclick = function() {
- browserProxy.scheduleNwake()
- .then(setPrefetchResult)
- .catch(prefetchResultError);
- };
- $('cancel-nwake').onclick = function() {
- browserProxy.cancelNwake()
- .then(setPrefetchResult)
- .catch(prefetchResultError);
- };
- $('show-notification').onclick = function() {
- browserProxy.showPrefetchNotification().then(setPrefetchResult);
- };
- $('generate-page-bundle').onclick = function() {
- browserProxy.generatePageBundle($('generate-urls').value)
- .then(setPrefetchResult)
- .catch(prefetchResultError);
- };
- $('get-operation').onclick = function() {
- browserProxy.getOperation($('operation-name').value)
- .then(setPrefetchResult)
- .catch(prefetchResultError);
- };
- $('download-archive').onclick = function() {
- browserProxy.downloadArchive($('download-name').value);
- };
- $('toggle-all-stored').onclick = function() {
- toggleAllCheckboxes($('toggle-all-stored'), 'stored');
- };
- $('toggle-all-requests').onclick = function() {
- toggleAllCheckboxes($('toggle-all-requests'), 'requests');
- };
- $('limitless-prefetching-checkbox').onchange = (evt) => {
- browserProxy.setLimitlessPrefetchingEnabled(evt.target.checked);
- if (evt.target.checked) {
- ensureBackgroundTaskScheduledWithDelay();
- }
- };
- // Helper for setting prefetch testing header from a radio button.
- const setPrefetchTestingHeader = function(evt) {
- browserProxy.setPrefetchTestingHeaderValue(evt.target.value);
+ };
+ $('cancel-nwake').onclick = function() {
+ browserProxy.cancelNwake()
+ .then(setPrefetchResult)
+ .catch(prefetchResultError);
+ };
+ $('show-notification').onclick = function() {
+ browserProxy.showPrefetchNotification().then(setPrefetchResult);
+ };
+ $('generate-page-bundle').onclick = function() {
+ browserProxy.generatePageBundle($('generate-urls').value)
+ .then(setPrefetchResult)
+ .catch(prefetchResultError);
+ };
+ $('get-operation').onclick = function() {
+ browserProxy.getOperation($('operation-name').value)
+ .then(setPrefetchResult)
+ .catch(prefetchResultError);
+ };
+ $('download-archive').onclick = function() {
+ browserProxy.downloadArchive($('download-name').value);
+ };
+ $('toggle-all-stored').onclick = function() {
+ toggleAllCheckboxes($('toggle-all-stored'), 'stored');
+ };
+ $('toggle-all-requests').onclick = function() {
+ toggleAllCheckboxes($('toggle-all-requests'), 'requests');
+ };
+ $('limitless-prefetching-checkbox').onchange = (evt) => {
+ browserProxy.setLimitlessPrefetchingEnabled(evt.target.checked);
+ if (evt.target.checked) {
ensureBackgroundTaskScheduledWithDelay();
- };
- $('testing-header-default').onchange = setPrefetchTestingHeader;
- $('testing-header-enable').onchange = setPrefetchTestingHeader;
- $('testing-header-disable').onchange = setPrefetchTestingHeader;
- if (!incognito) {
- refreshAll();
}
- }
-
- // Return an object with all of the exports.
- return {
- initialize: initialize,
};
-});
+ // Helper for setting prefetch testing header from a radio button.
+ const setPrefetchTestingHeader = function(evt) {
+ browserProxy.setPrefetchTestingHeaderValue(evt.target.value);
+ ensureBackgroundTaskScheduledWithDelay();
+ };
+ $('testing-header-default').onchange = setPrefetchTestingHeader;
+ $('testing-header-enable').onchange = setPrefetchTestingHeader;
+ $('testing-header-disable').onchange = setPrefetchTestingHeader;
+ if (!incognito) {
+ refreshAll();
+ }
+}
-document.addEventListener('DOMContentLoaded', offlineInternals.initialize);
+document.addEventListener('DOMContentLoaded', initialize);
diff --git a/chromium/chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js b/chromium/chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js
index f9da3c8548b..d72e9235d6e 100644
--- a/chromium/chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js
+++ b/chromium/chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
+
/**
* @typedef {{
* onlineUrl: string,
@@ -16,7 +18,7 @@
* requestOrigin: string
* }}
*/
-let OfflinePage;
+export let OfflinePage;
/**
* @typedef {{
@@ -29,7 +31,7 @@ let OfflinePage;
* requestOrigin: string
* }}
*/
-let SavePageRequest;
+export let SavePageRequest;
/**
* @typedef {{
@@ -38,275 +40,262 @@ let SavePageRequest;
* prefetchIsLogging: boolean
* }}
*/
-let IsLogging;
-
-cr.define('offlineInternals', function() {
- /** @interface */
- function OfflineInternalsBrowserProxy() {}
-
- OfflineInternalsBrowserProxy.prototype = {
- /**
- * Gets current list of stored pages.
- * @return {!Promise<!Array<OfflinePage>>} A promise firing when the
- * list is fetched.
- */
- getStoredPages: function() {},
-
- /**
- * Gets current offline queue requests.
- * @return {!Promise<!Array<SavePageRequest>>} A promise firing when the
- * request queue is fetched.
- */
- getRequestQueue: function() {},
-
- /**
- * Deletes a set of pages from stored pages
- * @param {!Array<string>} ids A list of page IDs to delete.
- * @return {!Promise<!string>} A promise firing when the selected
- * pages are deleted.
- */
- deleteSelectedPages: function(ids) {},
-
- /**
- * Deletes a set of requests from the request queue
- * @param {!Array<string>} ids A list of request IDs to delete.
- * @return {!Promise<!string>} A promise firing when the selected
- * pages are deleted.
- */
- deleteSelectedRequests: function(ids) {},
-
- /**
- * Sets whether to record logs for stored pages.
- * @param {boolean} shouldLog True if logging should be enabled.
- */
- setRecordPageModel: function(shouldLog) {},
-
- /**
- * Sets whether to record logs for scheduled requests.
- * @param {boolean} shouldLog True if logging should be enabled.
- */
- setRecordRequestQueue: function(shouldLog) {},
-
- /**
- * Sets whether to record logs for prefetching.
- * @param {boolean} shouldLog True if logging should be enabled.
- */
- setRecordPrefetchService: function(shouldLog) {},
-
- /**
- * Sets whether limitless prefetching is enabled.
- * @param {boolean} enabled Whether to enable limitless prefetching.
- */
- setLimitlessPrefetchingEnabled: function(enabled) {},
-
- /**
- * Gets whether limitless prefetching is enabled.
- * @return {!Promise<boolean>} Whether limitless prefetching is enabled
- */
- getLimitlessPrefetchingEnabled: function() {},
-
- /**
- * Sets the value to be sent with the prefetch testing header for
- * GeneratePageBundle requests.
- * @param {string} value Value to send with X-Offline-Prefetch-Testing.
- */
- setPrefetchTestingHeaderValue: function(value) {},
-
- /**
- * Gets the value of the prefetch testing header to be sent with
- * GeneratePageBundle requests.
- * @return {!Promise<string>} Header value.
- */
- getPrefetchTestingHeaderValue: function() {},
-
- /**
- * Gets the currently recorded logs.
- * @return {!Promise<!Array<string>>} A promise firing when the
- * logs are retrieved.
- */
- getEventLogs: function() {},
-
- /**
- * Gets the state of logging (on/off).
- * @return {!Promise<!IsLogging>} A promise firing when the state
- * is retrieved.
- */
- getLoggingState: function() {},
-
- /**
- * Adds the given url to the background loader queue.
- * @param {string} url Url of the page to load later.
- * @return {!Promise<boolean>} A promise firing after added to queue.
- * Promise will return true if url has been successfully added.
- */
- addToRequestQueue: function(url) {},
-
- /**
- * Gets the current network status in string form.
- * @return {!Promise<string>} A promise firing when the network status
- * is retrieved.
- */
- getNetworkStatus: function() {},
-
- /**
- * Schedules the default NWake task. The returned Promise will reject if
- * there is an error while scheduling.
- * @return {!Promise<string>} A promise firing when the task has been
- * scheduled.
- */
- scheduleNwake: function() {},
-
- /**
- * Cancels NWake task.
- * @return {!Promise} A promise firing when the task has been cancelled. The
- * returned Promise will reject if there is an error.
- */
- cancelNwake: function() {},
-
- /**
- * Shows the prefetching notification with an example origin.
- * @return {!Promise<string>} A promise firing when the notification has
- * been shown.
- */
- showPrefetchNotification: function() {},
-
- /**
- * Sends and processes a request to generate page bundle.
- * @param {string} urls A list of comma-separated URLs.
- * @return {!Promise<string>} A string describing the result.
- */
- generatePageBundle: function(urls) {},
-
- /**
- * Sends and processes a request to get operation.
- * @param {string} name Name of operation.
- * @return {!Promise<string>} A string describing the result.
- */
- getOperation: function(name) {},
-
- /**
- * Downloads an archive.
- * @param {string} name Name of archive to download.
- */
- downloadArchive: function(name) {},
- };
+export let IsLogging;
+
+/** @interface */
+export class OfflineInternalsBrowserProxy {
+ /**
+ * Gets current list of stored pages.
+ * @return {!Promise<!Array<OfflinePage>>} A promise firing when the
+ * list is fetched.
+ */
+ getStoredPages() {}
+
+ /**
+ * Gets current offline queue requests.
+ * @return {!Promise<!Array<SavePageRequest>>} A promise firing when the
+ * request queue is fetched.
+ */
+ getRequestQueue() {}
+
+ /**
+ * Deletes a set of pages from stored pages
+ * @param {!Array<string>} ids A list of page IDs to delete.
+ * @return {!Promise<!string>} A promise firing when the selected
+ * pages are deleted.
+ */
+ deleteSelectedPages(ids) {}
+
+ /**
+ * Deletes a set of requests from the request queue
+ * @param {!Array<string>} ids A list of request IDs to delete.
+ * @return {!Promise<!string>} A promise firing when the selected
+ * pages are deleted.
+ */
+ deleteSelectedRequests(ids) {}
+
+ /**
+ * Sets whether to record logs for stored pages.
+ * @param {boolean} shouldLog True if logging should be enabled.
+ */
+ setRecordPageModel(shouldLog) {}
+
+ /**
+ * Sets whether to record logs for scheduled requests.
+ * @param {boolean} shouldLog True if logging should be enabled.
+ */
+ setRecordRequestQueue(shouldLog) {}
+
+ /**
+ * Sets whether to record logs for prefetching.
+ * @param {boolean} shouldLog True if logging should be enabled.
+ */
+ setRecordPrefetchService(shouldLog) {}
+
+ /**
+ * Sets whether limitless prefetching is enabled.
+ * @param {boolean} enabled Whether to enable limitless prefetching.
+ */
+ setLimitlessPrefetchingEnabled(enabled) {}
+
+ /**
+ * Gets whether limitless prefetching is enabled.
+ * @return {!Promise<boolean>} Whether limitless prefetching is enabled
+ */
+ getLimitlessPrefetchingEnabled() {}
+
+ /**
+ * Sets the value to be sent with the prefetch testing header for
+ * GeneratePageBundle requests.
+ * @param {string} value Value to send with X-Offline-Prefetch-Testing.
+ */
+ setPrefetchTestingHeaderValue(value) {}
+
+ /**
+ * Gets the value of the prefetch testing header to be sent with
+ * GeneratePageBundle requests.
+ * @return {!Promise<string>} Header value.
+ */
+ getPrefetchTestingHeaderValue() {}
+
+ /**
+ * Gets the currently recorded logs.
+ * @return {!Promise<!Array<string>>} A promise firing when the
+ * logs are retrieved.
+ */
+ getEventLogs() {}
+
+ /**
+ * Gets the state of logging (on/off).
+ * @return {!Promise<!IsLogging>} A promise firing when the state
+ * is retrieved.
+ */
+ getLoggingState() {}
+
+ /**
+ * Adds the given url to the background loader queue.
+ * @param {string} url Url of the page to load later.
+ * @return {!Promise<boolean>} A promise firing after added to queue.
+ * Promise will return true if url has been successfully added.
+ */
+ addToRequestQueue(url) {}
+
+ /**
+ * Gets the current network status in string form.
+ * @return {!Promise<string>} A promise firing when the network status
+ * is retrieved.
+ */
+ getNetworkStatus() {}
+
+ /**
+ * Schedules the default NWake task. The returned Promise will reject if
+ * there is an error while scheduling.
+ * @return {!Promise<string>} A promise firing when the task has been
+ * scheduled.
+ */
+ scheduleNwake() {}
+
+ /**
+ * Cancels NWake task.
+ * @return {!Promise} A promise firing when the task has been cancelled. The
+ * returned Promise will reject if there is an error.
+ */
+ cancelNwake() {}
+
+ /**
+ * Shows the prefetching notification with an example origin.
+ * @return {!Promise<string>} A promise firing when the notification has
+ * been shown.
+ */
+ showPrefetchNotification() {}
+
+ /**
+ * Sends and processes a request to generate page bundle.
+ * @param {string} urls A list of comma-separated URLs.
+ * @return {!Promise<string>} A string describing the result.
+ */
+ generatePageBundle(urls) {}
+
+ /**
+ * Sends and processes a request to get operation.
+ * @param {string} name Name of operation.
+ * @return {!Promise<string>} A string describing the result.
+ */
+ getOperation(name) {}
/**
- * @constructor
- * @implements {offlineInternals.OfflineInternalsBrowserProxy}
+ * Downloads an archive.
+ * @param {string} name Name of archive to download.
*/
- function OfflineInternalsBrowserProxyImpl() {}
- cr.addSingletonGetter(OfflineInternalsBrowserProxyImpl);
-
- OfflineInternalsBrowserProxyImpl.prototype = {
- /** @override */
- getStoredPages: function() {
- return cr.sendWithPromise('getStoredPages');
- },
-
- /** @override */
- getRequestQueue: function() {
- return cr.sendWithPromise('getRequestQueue');
- },
-
- /** @override */
- deleteSelectedPages: function(ids) {
- return cr.sendWithPromise('deleteSelectedPages', ids);
- },
-
- /** @override */
- deleteSelectedRequests: function(ids) {
- return cr.sendWithPromise('deleteSelectedRequests', ids);
- },
-
- /** @override */
- setRecordPageModel: function(shouldLog) {
- chrome.send('setRecordPageModel', [shouldLog]);
- },
-
- /** @override */
- setRecordRequestQueue: function(shouldLog) {
- chrome.send('setRecordRequestQueue', [shouldLog]);
- },
-
- /** @override */
- setRecordPrefetchService: function(shouldLog) {
- chrome.send('setRecordPrefetchService', [shouldLog]);
- },
-
- /** @override */
- setLimitlessPrefetchingEnabled: function(enabled) {
- chrome.send('setLimitlessPrefetchingEnabled', [enabled]);
- },
-
- /** @override */
- getLimitlessPrefetchingEnabled: function() {
- return cr.sendWithPromise('getLimitlessPrefetchingEnabled');
- },
-
- /** @override */
- setPrefetchTestingHeaderValue: function(value) {
- chrome.send('setPrefetchTestingHeader', [value]);
- },
-
- /** @override */
- getPrefetchTestingHeaderValue: function() {
- return cr.sendWithPromise('getPrefetchTestingHeader');
- },
-
- /** @override */
- getEventLogs: function() {
- return cr.sendWithPromise('getEventLogs');
- },
-
- /** @override */
- getLoggingState: function() {
- return cr.sendWithPromise('getLoggingState');
- },
-
- /** @override */
- addToRequestQueue: function(url) {
- return cr.sendWithPromise('addToRequestQueue', url);
- },
-
- /** @override */
- getNetworkStatus: function() {
- return cr.sendWithPromise('getNetworkStatus');
- },
-
- /** @override */
- scheduleNwake: function() {
- return cr.sendWithPromise('scheduleNwake');
- },
-
- /** @override */
- cancelNwake: function() {
- return cr.sendWithPromise('cancelNwake');
- },
-
- /** @override */
- showPrefetchNotification: function() {
- return cr.sendWithPromise('showPrefetchNotification');
- },
-
- /** @override */
- generatePageBundle: function(urls) {
- return cr.sendWithPromise('generatePageBundle', urls);
- },
-
- /** @override */
- getOperation: function(name) {
- return cr.sendWithPromise('getOperation', name);
- },
-
- /** @override */
- downloadArchive: function(name) {
- chrome.send('downloadArchive', [name]);
- },
- };
-
- return {
- OfflineInternalsBrowserProxy: OfflineInternalsBrowserProxy,
- OfflineInternalsBrowserProxyImpl: OfflineInternalsBrowserProxyImpl
- };
-});
+ downloadArchive(name) {}
+}
+
+/** @implements {OfflineInternalsBrowserProxy} */
+export class OfflineInternalsBrowserProxyImpl {
+ /** @override */
+ getStoredPages() {
+ return sendWithPromise('getStoredPages');
+ }
+
+ /** @override */
+ getRequestQueue() {
+ return sendWithPromise('getRequestQueue');
+ }
+
+ /** @override */
+ deleteSelectedPages(ids) {
+ return sendWithPromise('deleteSelectedPages', ids);
+ }
+
+ /** @override */
+ deleteSelectedRequests(ids) {
+ return sendWithPromise('deleteSelectedRequests', ids);
+ }
+
+ /** @override */
+ setRecordPageModel(shouldLog) {
+ chrome.send('setRecordPageModel', [shouldLog]);
+ }
+
+ /** @override */
+ setRecordRequestQueue(shouldLog) {
+ chrome.send('setRecordRequestQueue', [shouldLog]);
+ }
+
+ /** @override */
+ setRecordPrefetchService(shouldLog) {
+ chrome.send('setRecordPrefetchService', [shouldLog]);
+ }
+
+ /** @override */
+ setLimitlessPrefetchingEnabled(enabled) {
+ chrome.send('setLimitlessPrefetchingEnabled', [enabled]);
+ }
+
+ /** @override */
+ getLimitlessPrefetchingEnabled() {
+ return sendWithPromise('getLimitlessPrefetchingEnabled');
+ }
+
+ /** @override */
+ setPrefetchTestingHeaderValue(value) {
+ chrome.send('setPrefetchTestingHeader', [value]);
+ }
+
+ /** @override */
+ getPrefetchTestingHeaderValue() {
+ return sendWithPromise('getPrefetchTestingHeader');
+ }
+
+ /** @override */
+ getEventLogs() {
+ return sendWithPromise('getEventLogs');
+ }
+
+ /** @override */
+ getLoggingState() {
+ return sendWithPromise('getLoggingState');
+ }
+
+ /** @override */
+ addToRequestQueue(url) {
+ return sendWithPromise('addToRequestQueue', url);
+ }
+
+ /** @override */
+ getNetworkStatus() {
+ return sendWithPromise('getNetworkStatus');
+ }
+
+ /** @override */
+ scheduleNwake() {
+ return sendWithPromise('scheduleNwake');
+ }
+
+ /** @override */
+ cancelNwake() {
+ return sendWithPromise('cancelNwake');
+ }
+
+ /** @override */
+ showPrefetchNotification() {
+ return sendWithPromise('showPrefetchNotification');
+ }
+
+ /** @override */
+ generatePageBundle(urls) {
+ return sendWithPromise('generatePageBundle', urls);
+ }
+
+ /** @override */
+ getOperation(name) {
+ return sendWithPromise('getOperation', name);
+ }
+
+ /** @override */
+ downloadArchive(name) {
+ chrome.send('downloadArchive', [name]);
+ }
+}
+
+addSingletonGetter(OfflineInternalsBrowserProxyImpl);
diff --git a/chromium/chrome/browser/resources/omnibox/BUILD.gn b/chromium/chrome/browser/resources/omnibox/BUILD.gn
index 0465f914112..c3634a0f8f1 100644
--- a/chromium/chrome/browser/resources/omnibox/BUILD.gn
+++ b/chromium/chrome/browser/resources/omnibox/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/grit/grit_rule.gni")
js_type_check("closure_compile") {
deps = [
@@ -32,3 +33,23 @@ js_library("omnibox_output") {
]
externs_list = [ "$externs_path/pending.js" ]
}
+
+grit("resources") {
+ source = "resources.grd"
+
+ # The .grd contains references to generated files.
+ source_is_generated = true
+ outputs = [
+ "grit/omnibox_resources.h",
+ "omnibox_resources.pak",
+ ]
+ output_dir = "$root_gen_dir/chrome"
+ depfile_dir = target_gen_dir
+ grit_flags = [
+ "-E",
+ "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
+ ]
+ deps = [
+ "//chrome/browser/ui/webui/omnibox:mojo_bindings_js",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/omnibox/omnibox.html b/chromium/chrome/browser/resources/omnibox/omnibox.html
index 402bef06eb3..d5284f5df81 100644
--- a/chromium/chrome/browser/resources/omnibox/omnibox.html
+++ b/chromium/chrome/browser/resources/omnibox/omnibox.html
@@ -268,10 +268,9 @@
<span class="label">
all providers done = <span id="done"></span>
</span>
+ <span class="label">type = <span id="type"></span></span>
<span class="label">host = <span id="host"></span></span>
- <span class="label">
- has isTypedHost = <span id="is-typed-host"></span>
- </span>
+ <span class="label">is typed host = <span id="is-typed-host"></span></span>
</template>
<omnibox-input id="omnibox-input"></omnibox-input>
diff --git a/chromium/chrome/browser/resources/omnibox/omnibox.js b/chromium/chrome/browser/resources/omnibox/omnibox.js
index c5d0e722454..b27b8b8eb88 100644
--- a/chromium/chrome/browser/resources/omnibox/omnibox.js
+++ b/chromium/chrome/browser/resources/omnibox/omnibox.js
@@ -158,7 +158,6 @@ document.addEventListener('DOMContentLoaded', () => {
exportDelegate = new ExportDelegate(omniboxOutput, omniboxInput);
omniboxInput.addEventListener('query-inputs-changed', e => {
- omniboxOutput.updateQueryInputs(e.detail);
browserProxy.makeRequest(
e.detail.inputText, e.detail.resetAutocompleteController,
e.detail.cursorPosition, e.detail.zeroSuggest,
@@ -211,7 +210,6 @@ class ExportDelegate {
}
this.omniboxInput_.queryInputs = importData.queryInputs;
this.omniboxInput_.displayInputs = importData.displayInputs;
- this.omniboxOutput_.updateQueryInputs(importData.queryInputs);
this.omniboxOutput_.updateDisplayInputs(importData.displayInputs);
this.omniboxOutput_.setResponsesHistory(importData.responsesHistory);
return true;
diff --git a/chromium/chrome/browser/resources/omnibox/omnibox_output.js b/chromium/chrome/browser/resources/omnibox/omnibox_output.js
index 72184d02c97..53815c5ff76 100644
--- a/chromium/chrome/browser/resources/omnibox/omnibox_output.js
+++ b/chromium/chrome/browser/resources/omnibox/omnibox_output.js
@@ -8,6 +8,7 @@ cr.define('omnibox_output', function() {
* cursorPosition: number,
* time: number,
* done: boolean,
+ * type: string,
* host: string,
* isTypedHost: boolean,
* }}
@@ -31,19 +32,12 @@ cr.define('omnibox_output', function() {
this.responsesHistory = [];
/** @private {!Array<!OutputResultsGroup>} */
this.resultsGroups_ = [];
- /** @private {!QueryInputs} */
- this.queryInputs_ = /** @type {!QueryInputs} */ ({});
/** @private {!DisplayInputs} */
this.displayInputs_ = OmniboxInput.defaultDisplayInputs;
/** @private {string} */
this.filterText_ = '';
}
- /** @param {!QueryInputs} queryInputs */
- updateQueryInputs(queryInputs) {
- this.queryInputs_ = queryInputs;
- }
-
/** @param {!DisplayInputs} displayInputs */
updateDisplayInputs(displayInputs) {
this.displayInputs_ = displayInputs;
@@ -103,8 +97,7 @@ cr.define('omnibox_output', function() {
* @private @param {!mojom.OmniboxResponse} response
*/
createResultsGroup_(response) {
- const resultsGroup =
- OutputResultsGroup.create(response, this.queryInputs_.cursorPosition);
+ const resultsGroup = OutputResultsGroup.create(response);
this.resultsGroups_.push(resultsGroup);
this.$$('#contents').appendChild(resultsGroup);
@@ -190,12 +183,11 @@ cr.define('omnibox_output', function() {
class OutputResultsGroup extends OmniboxElement {
/**
* @param {!mojom.OmniboxResponse} resultsGroup
- * @param {number} cursorPosition
* @return {!OutputResultsGroup}
*/
- static create(resultsGroup, cursorPosition) {
+ static create(resultsGroup) {
const outputResultsGroup = new OutputResultsGroup();
- outputResultsGroup.setResultsGroup(resultsGroup, cursorPosition);
+ outputResultsGroup.setResultsGroup(resultsGroup);
return outputResultsGroup;
}
@@ -203,18 +195,16 @@ cr.define('omnibox_output', function() {
super('output-results-group-template');
}
- /**
- * @param {!mojom.OmniboxResponse} resultsGroup
- * @param {number} cursorPosition
- */
- setResultsGroup(resultsGroup, cursorPosition) {
+ /** @param {!mojom.OmniboxResponse} resultsGroup */
+ setResultsGroup(resultsGroup) {
/** @private {ResultsDetails} */
this.details_ = {
- cursorPosition: cursorPosition,
+ cursorPosition: resultsGroup.cursorPosition,
time: resultsGroup.timeSinceOmniboxStartedMs,
done: resultsGroup.done,
+ type: resultsGroup.type,
host: resultsGroup.host,
- isTypedHost: resultsGroup.isTypedHost
+ isTypedHost: resultsGroup.isTypedHost,
};
/** @type {!Array<!OutputHeader>} */
this.headers = COLUMNS.map(OutputHeader.create);
@@ -353,6 +343,7 @@ cr.define('omnibox_output', function() {
this.$$('#cursor-position').textContent = details.cursorPosition;
this.$$('#time').textContent = details.time;
this.$$('#done').textContent = details.done;
+ this.$$('#type').textContent = details.type;
this.$$('#host').textContent = details.host;
this.$$('#is-typed-host').textContent = details.isTypedHost;
}
diff --git a/chromium/chrome/browser/resources/omnibox/resources.grd b/chromium/chrome/browser/resources/omnibox/resources.grd
new file mode 100644
index 00000000000..d6011a893e8
--- /dev/null
+++ b/chromium/chrome/browser/resources/omnibox/resources.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/omnibox_resources.h" type="rc_header">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="omnibox_resources.pak" type="data_package" />
+ </outputs>
+ <release seq="1">
+ <includes>
+ <include name="IDR_OMNIBOX_HTML"
+ file="omnibox.html"
+ flattenhtml="true"
+ allowexternalscript="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OMNIBOX_CSS"
+ file="omnibox.css"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OMNIBOX_INPUT_CSS"
+ file="omnibox_input.css"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OUTPUT_RESULTS_GROUP_CSS"
+ file="output_results_group.css"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OMNIBOX_OUTPUT_COLUMN_WIDTHS_CSS"
+ file="omnibox_output_column_widths.css"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OMNIBOX_ELEMENT_JS"
+ file="omnibox_element.js"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OMNIBOX_INPUT_JS"
+ file="omnibox_input.js"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OMNIBOX_OUTPUT_JS"
+ file="omnibox_output.js"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OMNIBOX_JS"
+ file="omnibox.js"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_OMNIBOX_MOJO_JS"
+ file="${root_gen_dir}\chrome\browser\ui\webui\omnibox\omnibox.mojom-lite.js"
+ use_base_dir="false"
+ type="BINDATA"
+ compress="gzip" />
+ </includes>
+ </release>
+</grit>
diff --git a/chromium/chrome/browser/resources/pdf/BUILD.gn b/chromium/chrome/browser/resources/pdf/BUILD.gn
index 89a0223ca86..079381842d8 100644
--- a/chromium/chrome/browser/resources/pdf/BUILD.gn
+++ b/chromium/chrome/browser/resources/pdf/BUILD.gn
@@ -4,28 +4,19 @@
import("//third_party/closure_compiler/compile_js.gni")
-# TODO(dpapad): Add compile targets for all files, crbug.com/721073.
group("closure_compile") {
deps = [
":pdf_resources",
- "elements/viewer-bookmark:closure_compile",
- "elements/viewer-error-screen:closure_compile",
- "elements/viewer-form-warning:closure_compile",
- "elements/viewer-page-indicator:closure_compile",
- "elements/viewer-page-selector:closure_compile",
- "elements/viewer-password-screen:closure_compile",
- "elements/viewer-pdf-toolbar:closure_compile",
- "elements/viewer-toolbar-dropdown:closure_compile",
- "elements/viewer-zoom-toolbar:closure_compile",
+ "elements:closure_compile",
]
if (is_chromeos) {
- deps += [
- "elements/viewer-ink-host:closure_compile",
- "ink:closure_compile",
- ]
+ deps += [ "ink:closure_compile" ]
}
}
+js_library("annotation_tool") {
+}
+
js_library("browser_api") {
deps = [
"//ui/webui/resources/js:assert",
@@ -86,15 +77,53 @@ js_library("navigator") {
]
}
+js_library("toolbar_manager") {
+ deps = [
+ "elements:viewer-pdf-toolbar",
+ "elements:viewer-zoom-toolbar",
+ ]
+}
+
+js_library("controller") {
+ deps = [
+ ":annotation_tool",
+ ":viewport",
+ "elements:viewer-pdf-toolbar",
+ "//ui/webui/resources/js:load_time_data",
+ "//ui/webui/resources/js/cr:event_target",
+ ]
+}
+
+js_library("pdf_viewer") {
+ deps = [
+ ":controller",
+ ":navigator",
+ ":toolbar_manager",
+ ":viewport",
+ "elements:viewer-bookmark",
+ "elements:viewer-error-screen",
+ "elements:viewer-page-indicator",
+ "elements:viewer-password-screen",
+ "elements:viewer-pdf-toolbar",
+ "elements:viewer-zoom-toolbar",
+ "//ui/webui/resources/js:event_tracker",
+ "//ui/webui/resources/js:load_time_data",
+ ]
+ externs_list = [ "$externs_path/resources_private.js" ]
+}
+
js_type_check("pdf_resources") {
deps = [
":browser_api",
+ ":controller",
":gesture_detector",
":metrics",
":navigator",
":open_pdf_params_parser",
":pdf_fitting_type",
":pdf_scripting_api",
+ ":pdf_viewer",
+ ":toolbar_manager",
":viewport",
":viewport_scroller",
":zoom_manager",
diff --git a/chromium/chrome/browser/resources/pdf/annotation_tool.js b/chromium/chrome/browser/resources/pdf/annotation_tool.js
new file mode 100644
index 00000000000..5e887b048b7
--- /dev/null
+++ b/chromium/chrome/browser/resources/pdf/annotation_tool.js
@@ -0,0 +1,15 @@
+// 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 This file is not included in the build. Only used for type
+// checking purposes.
+
+/**
+ * @typedef {{
+ * tool: string,
+ * size: number,
+ * color: (string|null),
+ * }}
+ */
+let AnnotationTool;
diff --git a/chromium/chrome/browser/resources/pdf/controller.js b/chromium/chrome/browser/resources/pdf/controller.js
new file mode 100644
index 00000000000..ea790f32d0f
--- /dev/null
+++ b/chromium/chrome/browser/resources/pdf/controller.js
@@ -0,0 +1,494 @@
+// 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.
+
+'use strict';
+
+/** @typedef {{ type: string }} */
+let MessageData;
+
+/**
+ * @typedef {{
+ * dataToSave: Array,
+ * token: string,
+ * fileName: string
+ * }}
+ */
+let SaveDataMessageData;
+
+/**
+ * @typedef {{
+ * type: string,
+ * to: string,
+ * cc: string,
+ * bcc: string,
+ * subject: string,
+ * body: string,
+ * }}
+ */
+let EmailMessageData;
+
+/**
+ * @typedef {{
+ * type: string,
+ * url: string,
+ * grayscale: boolean,
+ * modifiable: boolean,
+ * pageNumbers: !Array<number>
+ * }}
+ */
+let PrintPreviewParams;
+
+// Note: Redefining this type here, to work around the fact that ink externs
+// are only available on Chrome OS, so the targets that contain them cannot be
+// built on other platforms.
+// TODO (rbpotter): Break InkController into its own file that is only included
+// on Chrome OS.
+
+/**
+ * @typedef {{
+ * setAnnotationTool: function(AnnotationTool):void,
+ * viewportChanged: function():void,
+ * saveDocument: function():!Promise,
+ * undo: function():void,
+ * redo: function():void,
+ * load: function(string, !ArrayBuffer):!Promise,
+ * viewport: !Viewport,
+ * }}
+ */
+let ViewerInkHostElement;
+
+/**
+ * Creates a cryptographically secure pseudorandom 128-bit token.
+ * @return {string} The generated token as a hex string.
+ */
+function createToken() {
+ const randomBytes = new Uint8Array(16);
+ return window.crypto.getRandomValues(randomBytes)
+ .map(b => b.toString(16).padStart(2, '0'))
+ .join('');
+}
+
+/** @abstract */
+class ContentController {
+ constructor() {}
+
+ beforeZoom() {}
+
+ afterZoom() {}
+
+ viewportChanged() {}
+
+ /** @abstract */
+ rotateClockwise() {}
+
+ /** @abstract */
+ rotateCounterclockwise() {}
+
+ /** Triggers printing of the current document. */
+ print() {}
+
+ /** Undo an edit action. */
+ undo() {}
+
+ /** Redo an edit action. */
+ redo() {}
+
+ /**
+ * Requests that the current document be saved.
+ * @param {boolean} requireResult whether a response is required, otherwise
+ * the controller may save the document to disk internally.
+ * @return {Promise<{fileName: string, dataToSave: ArrayBuffer}>}
+ * @abstract
+ */
+ save(requireResult) {}
+
+ /**
+ * Loads PDF document from `data` activates UI.
+ * @param {string} fileName
+ * @param {!ArrayBuffer} data
+ * @return {Promise<void>}
+ * @abstract
+ */
+ load(fileName, data) {}
+
+ /**
+ * Unloads the current document and removes the UI.
+ * @abstract
+ */
+ unload() {}
+}
+
+/**
+ * Controller for annotation mode, on Chrome OS only. Fires the following events
+ * from its event target:
+ * has-unsaved-changes: Fired to indicate there are ink annotations that have
+ * not been saved.
+ * set-annotation-undo-state: Contains information about whether undo or redo
+ * options are available.
+ */
+class InkController extends ContentController {
+ /** @param {!Viewport} viewport */
+ constructor(viewport) {
+ super();
+
+ /** @private {!Viewport} */
+ this.viewport_ = viewport;
+
+ /** @private {?ViewerInkHostElement} */
+ this.inkHost_ = null;
+
+ /** @private {!EventTarget} */
+ this.eventTarget_ = new cr.EventTarget();
+
+ /** @type {?AnnotationTool} */
+ this.tool_ = null;
+ }
+
+ /** @return {!EventTarget} */
+ getEventTarget() {
+ return this.eventTarget_;
+ }
+
+ /** @param {AnnotationTool} tool */
+ setAnnotationTool(tool) {
+ this.tool_ = tool;
+ if (this.inkHost_) {
+ this.inkHost_.setAnnotationTool(tool);
+ }
+ }
+
+ /** @override */
+ rotateClockwise() {
+ // TODO(dstockwell): implement rotation
+ }
+
+ /** @override */
+ rotateCounterclockwise() {
+ // TODO(dstockwell): implement rotation
+ }
+
+ /** @override */
+ viewportChanged() {
+ this.inkHost_.viewportChanged();
+ }
+
+ /** @override */
+ save(requireResult) {
+ return this.inkHost_.saveDocument();
+ }
+
+ /** @override */
+ undo() {
+ this.inkHost_.undo();
+ }
+
+ /** @override */
+ redo() {
+ this.inkHost_.redo();
+ }
+
+ /** @override */
+ load(filename, data) {
+ if (!this.inkHost_) {
+ const inkHost = document.createElement('viewer-ink-host');
+ $('content').appendChild(inkHost);
+ this.inkHost_ = /** @type {!ViewerInkHostElement} */ (inkHost);
+ this.inkHost_.viewport = this.viewport_;
+ inkHost.addEventListener('stroke-added', e => {
+ this.eventTarget_.dispatchEvent(new CustomEvent('has-unsaved-changes'));
+ });
+ inkHost.addEventListener('undo-state-changed', e => {
+ this.eventTarget_.dispatchEvent(
+ new CustomEvent('set-annotation-undo-state', {detail: e.detail}));
+ });
+ }
+ return this.inkHost_.load(filename, data);
+ }
+
+ /** @override */
+ unload() {
+ this.inkHost_.remove();
+ this.inkHost_ = null;
+ }
+}
+
+/**
+ * PDF plugin controller, responsible for communicating with the embedded plugin
+ * element. Dispatches a 'plugin-message' event containing the message from the
+ * plugin, if a message type not handled by this controller is received.
+ */
+class PluginController extends ContentController {
+ /**
+ * @param {!HTMLEmbedElement} plugin
+ * @param {!Viewport} viewport
+ * @param {function():boolean} getIsUserInitiatedCallback
+ * @param {function():?Promise} getLoadedCallback
+ */
+ constructor(plugin, viewport, getIsUserInitiatedCallback, getLoadedCallback) {
+ super();
+
+ /** @private {!HTMLEmbedElement} */
+ this.plugin_ = plugin;
+
+ /** @private {!Viewport} */
+ this.viewport_ = viewport;
+
+ /** @private {!function():boolean} */
+ this.getIsUserInitiatedCallback_ = getIsUserInitiatedCallback;
+
+ /** @private {!function():?Promise} */
+ this.getLoadedCallback_ = getLoadedCallback;
+
+ /** @private {!Map<string, PromiseResolver>} */
+ this.pendingTokens_ = new Map();
+ this.plugin_.addEventListener(
+ 'message', e => this.handlePluginMessage_(e), false);
+
+ /** @private {!EventTarget} */
+ this.eventTarget_ = new cr.EventTarget();
+ }
+
+ /** @return {!EventTarget} */
+ getEventTarget() {
+ return this.eventTarget_;
+ }
+
+ /**
+ * Notify the plugin to stop reacting to scroll events while zoom is taking
+ * place to avoid flickering.
+ * @override
+ */
+ beforeZoom() {
+ this.postMessage_({type: 'stopScrolling'});
+
+ if (this.viewport_.pinchPhase == Viewport.PinchPhase.PINCH_START) {
+ const position = this.viewport_.position;
+ const zoom = this.viewport_.getZoom();
+ const pinchPhase = this.viewport_.pinchPhase;
+ const layoutOptions = this.viewport_.getLayoutOptions();
+ this.postMessage_({
+ type: 'viewport',
+ userInitiated: true,
+ zoom: zoom,
+ layoutOptions: layoutOptions,
+ xOffset: position.x,
+ yOffset: position.y,
+ pinchPhase: pinchPhase
+ });
+ }
+ }
+
+ /**
+ * Notify the plugin of the zoom change and to continue reacting to scroll
+ * events.
+ * @override
+ */
+ afterZoom() {
+ const position = this.viewport_.position;
+ const zoom = this.viewport_.getZoom();
+ const layoutOptions = this.viewport_.getLayoutOptions();
+ const pinchVector = this.viewport_.pinchPanVector || {x: 0, y: 0};
+ const pinchCenter = this.viewport_.pinchCenter || {x: 0, y: 0};
+ const pinchPhase = this.viewport_.pinchPhase;
+
+ this.postMessage_({
+ type: 'viewport',
+ userInitiated: this.getIsUserInitiatedCallback_(),
+ zoom: zoom,
+ layoutOptions: layoutOptions,
+ xOffset: position.x,
+ yOffset: position.y,
+ pinchPhase: pinchPhase,
+ pinchX: pinchCenter.x,
+ pinchY: pinchCenter.y,
+ pinchVectorX: pinchVector.x,
+ pinchVectorY: pinchVector.y
+ });
+ }
+
+ /**
+ * Post a message to the PPAPI plugin. Some messages will cause an async reply
+ * to be received through handlePluginMessage_().
+ * @param {!MessageData} message Message to post.
+ * @private
+ */
+ postMessage_(message) {
+ this.plugin_.postMessage(message);
+ }
+
+ /** @override */
+ rotateClockwise() {
+ this.postMessage_({type: 'rotateClockwise'});
+ }
+
+ /** @override */
+ rotateCounterclockwise() {
+ this.postMessage_({type: 'rotateCounterclockwise'});
+ }
+
+ /** @override */
+ print() {
+ this.postMessage_({type: 'print'});
+ }
+
+ selectAll() {
+ this.postMessage_({type: 'selectAll'});
+ }
+
+ getSelectedText() {
+ this.postMessage_({type: 'getSelectedText'});
+ }
+
+ /** @param {!PrintPreviewParams} printPreviewParams */
+ resetPrintPreviewMode(printPreviewParams) {
+ this.postMessage_({
+ type: 'resetPrintPreviewMode',
+ url: printPreviewParams.url,
+ grayscale: printPreviewParams.grayscale,
+ // If the PDF isn't modifiable we send 0 as the page count so that no
+ // blank placeholder pages get appended to the PDF.
+ pageCount:
+ (printPreviewParams.modifiable ?
+ printPreviewParams.pageNumbers.length :
+ 0)
+ });
+ }
+
+ /** @param {string} newColor New color, in hex, for the PDF plugin. */
+ backgroundColorChanged(newColor) {
+ this.postMessage_({
+ type: 'backgroundColorChanged',
+ backgroundColor: newColor,
+ });
+ }
+
+ /**
+ * @param {string} url
+ * @param {number} index
+ */
+ loadPreviewPage(url, index) {
+ this.postMessage_({type: 'loadPreviewPage', url: url, index: index});
+ }
+
+ /** @param {string} password */
+ getPasswordComplete(password) {
+ this.postMessage_({type: 'getPasswordComplete', password: password});
+ }
+
+ /** @param {string} destination */
+ getNamedDestination(destination) {
+ this.postMessage_({
+ type: 'getNamedDestination',
+ namedDestination: destination,
+ });
+ }
+
+ /** @override */
+ save(requireResult) {
+ const resolver = new PromiseResolver();
+ const newToken = createToken();
+ this.pendingTokens_.set(newToken, resolver);
+ this.postMessage_({type: 'save', token: newToken, force: requireResult});
+ return resolver.promise;
+ }
+
+ /** @override */
+ async load(fileName, data) {
+ const url = URL.createObjectURL(new Blob([data]));
+ this.plugin_.removeAttribute('headers');
+ this.plugin_.setAttribute('stream-url', url);
+ this.plugin_.style.display = 'block';
+ try {
+ await this.getLoadedCallback_();
+ } finally {
+ URL.revokeObjectURL(url);
+ }
+ }
+
+ /** @override */
+ unload() {
+ this.plugin_.style.display = 'none';
+ }
+
+ /**
+ * An event handler for handling message events received from the plugin.
+ * @param {!Event} messageEvent a message event.
+ * @private
+ */
+ handlePluginMessage_(messageEvent) {
+ const messageData = /** @type {!MessageData} */ (messageEvent.data);
+ switch (messageData.type) {
+ case 'email':
+ const emailData = /** @type {!EmailMessageData} */ (messageData);
+ const href = 'mailto:' + emailData.to + '?cc=' + emailData.cc +
+ '&bcc=' + emailData.bcc + '&subject=' + emailData.subject +
+ '&body=' + emailData.body;
+ window.location.href = href;
+ break;
+ case 'goToPage':
+ this.viewport_.goToPage(
+ /** @type {{type: string, page: number}} */ (messageData).page);
+ break;
+ case 'setScrollPosition':
+ this.viewport_.scrollTo(/** @type {!PartialPoint} */ (messageData));
+ break;
+ case 'scrollBy':
+ this.viewport_.scrollBy(/** @type {!Point} */ (messageData));
+ break;
+ case 'saveData':
+ this.saveData_(/** @type {!SaveDataMessageData} */ (messageData));
+ break;
+ case 'consumeSaveToken':
+ const saveTokenData =
+ /** @type {{ type: string, token: string }} */ (messageData);
+ const resolver = this.pendingTokens_.get(saveTokenData.token);
+ assert(this.pendingTokens_.delete(saveTokenData.token));
+ resolver.resolve(null);
+ break;
+ default:
+ this.eventTarget_.dispatchEvent(
+ new CustomEvent('plugin-message', {detail: messageData}));
+ }
+ }
+
+ /**
+ * Handles the pdf file buffer received from the plugin.
+ *
+ * @param {!SaveDataMessageData} messageData data of the message event.
+ * @private
+ */
+ saveData_(messageData) {
+ assert(
+ loadTimeData.getBoolean('pdfFormSaveEnabled') ||
+ loadTimeData.getBoolean('pdfAnnotationsEnabled'));
+
+ // Verify a token that was created by this instance is included to avoid
+ // being spammed.
+ const resolver = this.pendingTokens_.get(messageData.token);
+ assert(this.pendingTokens_.delete(messageData.token));
+
+ if (!messageData.dataToSave) {
+ resolver.reject();
+ return;
+ }
+
+ // Verify the file size and the first bytes to make sure it's a PDF. Cap at
+ // 100 MB. This cap should be kept in sync with and is also enforced in
+ // pdf/out_of_process_instance.cc.
+ const MIN_FILE_SIZE = '%PDF1.0'.length;
+ const MAX_FILE_SIZE = 100 * 1000 * 1000;
+
+ const buffer = messageData.dataToSave;
+ const bufView = new Uint8Array(buffer);
+ assert(
+ bufView.length <= MAX_FILE_SIZE,
+ `File too large to be saved: ${bufView.length} bytes.`);
+ assert(bufView.length >= MIN_FILE_SIZE);
+ assert(
+ String.fromCharCode(bufView[0], bufView[1], bufView[2], bufView[3]) ==
+ '%PDF');
+
+ resolver.resolve(messageData);
+ }
+}
diff --git a/chromium/chrome/browser/resources/pdf/elements/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/BUILD.gn
new file mode 100644
index 00000000000..248059ae74f
--- /dev/null
+++ b/chromium/chrome/browser/resources/pdf/elements/BUILD.gn
@@ -0,0 +1,118 @@
+# 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")
+import("//tools/polymer/polymer.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":viewer-bookmark",
+ ":viewer-error-screen",
+ ":viewer-page-indicator",
+ ":viewer-page-selector",
+ ":viewer-password-screen",
+ ":viewer-pdf-toolbar",
+ ":viewer-toolbar-dropdown",
+ ":viewer-zoom-button",
+ ":viewer-zoom-toolbar",
+ ]
+ if (is_chromeos) {
+ deps += [
+ ":viewer-form-warning",
+ ":viewer-ink-host",
+ ":viewer-pen-options",
+ ]
+ }
+}
+
+js_library("viewer-bookmark") {
+ deps = [
+ "//third_party/polymer/v1_0/components-chromium/iron-a11y-keys-behavior:iron-a11y-keys-behavior-extracted",
+ ]
+}
+
+js_library("viewer-error-screen") {
+ deps = [
+ "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog",
+ ]
+}
+
+if (is_chromeos) {
+ js_library("viewer-form-warning") {
+ deps = [
+ "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog",
+ "//ui/webui/resources/js:promise_resolver",
+ ]
+ }
+
+ js_library("viewer-ink-host") {
+ deps = [
+ "//chrome/browser/resources/pdf:metrics",
+ "//chrome/browser/resources/pdf:viewport",
+ "//chrome/browser/resources/pdf/ink:ink_api",
+ ]
+ }
+}
+
+js_library("viewer-page-indicator") {
+ deps = [
+ "//ui/webui/resources/js:assert",
+ "//ui/webui/resources/js:util",
+ ]
+}
+
+js_library("viewer-page-selector") {
+ deps = [
+ "//ui/webui/resources/cr_elements/cr_input:cr_input",
+ ]
+}
+
+js_library("viewer-password-screen") {
+ deps = [
+ "//ui/webui/resources/cr_elements/cr_input:cr_input",
+ ]
+}
+
+js_library("viewer-pdf-toolbar") {
+ deps = [
+ ":viewer-bookmark",
+ ":viewer-page-selector",
+ ":viewer-toolbar-dropdown",
+ "..:annotation_tool",
+ ]
+ externs_list = [ "$externs_path/pending.js" ]
+}
+
+js_library("viewer-pen-options") {
+ externs_list = [ "$externs_path/pending_polymer.js" ]
+}
+
+js_library("viewer-toolbar-dropdown") {
+ deps = []
+}
+
+js_library("viewer-zoom-toolbar") {
+ deps = [
+ ":viewer-zoom-button",
+ "..:pdf_fitting_type",
+ "//ui/webui/resources/js:assert",
+ "//ui/webui/resources/js:util",
+ ]
+}
+
+js_library("viewer-zoom-button") {
+ deps = []
+}
+
+polymer_modulizer("shared-vars") {
+ js_file = "shared-vars.m.js"
+ html_file = "shared-vars.html"
+ html_type = "custom-style"
+}
+
+group("polymer3_elements") {
+ deps = [
+ ":shared-vars_module",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark.html
index 004aa1b1677..004aa1b1677 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark.html
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark.js
index f1cce48abaa..f25ebcef472 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark.js
@@ -7,8 +7,9 @@
*
* The bookmark may point at a location in the PDF or a URI.
* If it points at a location, |page| indicates which 0-based page it leads to.
- * Optionally, |y| is the y position in that page, in pixel coordinates.
- * If it points at an URI, |uri| is the target for that bookmark.
+ * Optionally, |x| is the x position in that page, |y| is the y position in that
+ * page, in pixel coordinates and |zoom| is the new zoom value. If it points at
+ * an URI, |uri| is the target for that bookmark.
*
* |children| is an array of the |Bookmark|s that are below this in a table of
* contents tree
@@ -16,7 +17,9 @@
* @typedef {{
* title: string,
* page: (number | undefined),
+ * x: (number | undefined),
* y: (number | undefined),
+ * zoom: (number | undefined),
* uri: (string | undefined),
* children: !Array<!Bookmark>
* }}
@@ -80,11 +83,15 @@ Polymer({
/** @private */
onClick_: function() {
- if (this.bookmark.hasOwnProperty('page')) {
- if (this.bookmark.hasOwnProperty('y')) {
+ if (this.bookmark.page != null) {
+ if (this.bookmark.zoom != null) {
+ this.fire('change-zoom', {zoom: this.bookmark.zoom});
+ }
+ if (this.bookmark.x != null &&
+ this.bookmark.y != null) {
this.fire('change-page-and-xy', {
page: this.bookmark.page,
- x: 0,
+ x: this.bookmark.x,
y: this.bookmark.y,
origin: 'bookmark'
});
@@ -92,7 +99,7 @@ Polymer({
this.fire(
'change-page', {page: this.bookmark.page, origin: 'bookmark'});
}
- } else if (this.bookmark.hasOwnProperty('uri')) {
+ } else if (this.bookmark.uri != null) {
this.fire('navigate', {uri: this.bookmark.uri, newtab: true});
}
},
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/BUILD.gn
deleted file mode 100644
index fa2b15b86f7..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/BUILD.gn
+++ /dev/null
@@ -1,17 +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 = [
- ":viewer-bookmark",
- ]
-}
-
-js_library("viewer-bookmark") {
- deps = [
- "//third_party/polymer/v1_0/components-chromium/iron-a11y-keys-behavior:iron-a11y-keys-behavior-extracted",
- ]
-}
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.html b/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen.html
index 25737d45127..25737d45127 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen.html
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.js b/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen.js
index 082220a4c92..082220a4c92 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen.js
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/BUILD.gn
deleted file mode 100644
index 3beeb5d21b0..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/BUILD.gn
+++ /dev/null
@@ -1,17 +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 = [
- ":viewer-error-screen",
- ]
-}
-
-js_library("viewer-error-screen") {
- deps = [
- "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog",
- ]
-}
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning/viewer-form-warning.html b/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning.html
index 1e9e1ee4f67..1e9e1ee4f67 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning/viewer-form-warning.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning.html
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning/viewer-form-warning.js b/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning.js
index 539eddd6b67..539eddd6b67 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning/viewer-form-warning.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-form-warning.js
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/viewer-ink-host.html b/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host.html
index 1a7a2ff73ea..1a7a2ff73ea 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/viewer-ink-host.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host.html
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/viewer-ink-host.js b/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host.js
index 285edf8a35d..285edf8a35d 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/viewer-ink-host.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host.js
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/BUILD.gn
deleted file mode 100644
index 32ca2b04311..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-ink-host/BUILD.gn
+++ /dev/null
@@ -1,19 +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 = [
- ":viewer-ink-host",
- ]
-}
-
-js_library("viewer-ink-host") {
- deps = [
- "//chrome/browser/resources/pdf:metrics",
- "//chrome/browser/resources/pdf:viewport",
- "//chrome/browser/resources/pdf/ink:ink_api",
- ]
-}
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.html b/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator.html
index 70ad2578685..70ad2578685 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator.html
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.js b/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator.js
index 50ad4f4cb49..50ad4f4cb49 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator.js
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/BUILD.gn
deleted file mode 100644
index aa1906c65e5..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-page-indicator/BUILD.gn
+++ /dev/null
@@ -1,18 +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 = [
- ":viewer-page-indicator",
- ]
-}
-
-js_library("viewer-page-indicator") {
- deps = [
- "//ui/webui/resources/js:assert",
- "//ui/webui/resources/js:util",
- ]
-}
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/viewer-page-selector.html b/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector.html
index e1fdc869efe..e1fdc869efe 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/viewer-page-selector.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector.html
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/viewer-page-selector.js b/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector.js
index b7999237a98..b7999237a98 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/viewer-page-selector.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector.js
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/BUILD.gn
deleted file mode 100644
index 725e3f96591..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-page-selector/BUILD.gn
+++ /dev/null
@@ -1,17 +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 = [
- ":viewer-page-selector",
- ]
-}
-
-js_library("viewer-page-selector") {
- deps = [
- "//ui/webui/resources/cr_elements/cr_input:cr_input",
- ]
-}
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.html b/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.html
index aebc16bf138..aebc16bf138 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.html
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.js b/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.js
index 5506ad2915c..5506ad2915c 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.js
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/BUILD.gn
deleted file mode 100644
index 5078ae7403f..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/BUILD.gn
+++ /dev/null
@@ -1,17 +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 = [
- ":viewer-password-screen",
- ]
-}
-
-js_library("viewer-password-screen") {
- deps = [
- "//ui/webui/resources/cr_elements/cr_input:cr_input",
- ]
-}
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.html
index e183debc86d..348e2215fed 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.html
@@ -4,13 +4,13 @@
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.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">
-<link rel="import" href="../viewer-bookmark/viewer-bookmark.html">
-<link rel="import" href="../viewer-page-selector/viewer-page-selector.html">
+<link rel="import" href="icons.html">
+<link rel="import" href="viewer-bookmark.html">
+<link rel="import" href="viewer-page-selector.html">
<if expr="chromeos">
-<link rel="import" href="../viewer-pen-options/viewer-pen-options.html">
+<link rel="import" href="viewer-pen-options.html">
</if>
-<link rel="import" href="../viewer-toolbar-dropdown/viewer-toolbar-dropdown.html">
+<link rel="import" href="viewer-toolbar-dropdown.html">
<dom-module id="viewer-pdf-toolbar">
<template>
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar.js
index afb87dfe6b7..07407cfee75 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar.js
@@ -1,6 +1,7 @@
// 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.
+
(function() {
Polymer({
is: 'viewer-pdf-toolbar',
@@ -24,7 +25,7 @@ Polymer({
reflectToAttribute: true,
},
- /** @type {?Object} */
+ /** @type {?AnnotationTool} */
annotationTool: {
type: Object,
value: null,
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/BUILD.gn
deleted file mode 100644
index fdc650f55b9..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/BUILD.gn
+++ /dev/null
@@ -1,20 +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.
-
-import("//third_party/closure_compiler/compile_js.gni")
-
-js_type_check("closure_compile") {
- deps = [
- ":viewer-pdf-toolbar",
- ]
-}
-
-js_library("viewer-pdf-toolbar") {
- deps = [
- "../viewer-bookmark:viewer-bookmark",
- "../viewer-page-selector:viewer-page-selector",
- "../viewer-toolbar-dropdown:viewer-toolbar-dropdown",
- ]
- externs_list = [ "$externs_path/pending.js" ]
-}
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.html
index dbf18b0bfda..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.html
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/viewer-pen-options.js b/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options.js
index 3970e0ff630..d63343404fb 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options/viewer-pen-options.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-pen-options.js
@@ -81,7 +81,7 @@ Polymer({
strings: Object,
},
- /** @type {Array<Animation>} */
+ /** @type {Array<!Animation>} */
expandAnimations_: null,
/** @param {Event} e */
@@ -103,7 +103,8 @@ Polymer({
/** @private */
updateExpandedStateAndFinishAnimations_: function() {
this.updateExpandedState_();
- for (const animation of this.expandAnimations_) {
+ for (const animation of /** @type {!Array<!Animation>} */ (
+ this.expandAnimations_)) {
animation.finish();
}
},
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.html b/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown.html
index 1ebf0df604f..1ebf0df604f 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown.html
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.js b/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown.js
index 00b2b676b45..191f4cfcfbf 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown.js
@@ -216,5 +216,4 @@ Polymer({
});
}
});
-
})();
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-button.html
index 000d098cfb3..000d098cfb3 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.html
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-button.html
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-button.js
index 2359900d83c..2359900d83c 100644
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-button.js
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.html
index e0f2bdd15ba..0807c5dfe64 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.html
@@ -1,7 +1,7 @@
<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="icons.html">
<link rel="import" href="viewer-zoom-button.html">
<dom-module id="viewer-zoom-toolbar">
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.js
index fe24ab64645..fe28ef8c96a 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.js
@@ -2,6 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+/**
+ * @typedef {{
+ * fittingType: !FittingType,
+ * userInitiated: boolean,
+ * }}
+ */
+let FitToChangedEvent;
+
(function() {
const FIT_TO_PAGE_BUTTON_STATE = 0;
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/BUILD.gn
deleted file mode 100644
index 4c75971c261..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/BUILD.gn
+++ /dev/null
@@ -1,25 +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.
-
-import("//third_party/closure_compiler/compile_js.gni")
-
-js_type_check("closure_compile") {
- deps = [
- ":viewer-zoom-button",
- ":viewer-zoom-toolbar",
- ]
-}
-
-js_library("viewer-zoom-toolbar") {
- deps = [
- ":viewer-zoom-button",
- "../..:pdf_fitting_type",
- "//ui/webui/resources/js:assert",
- "//ui/webui/resources/js:util",
- ]
-}
-
-js_library("viewer-zoom-button") {
- deps = []
-}
diff --git a/chromium/chrome/browser/resources/pdf/index.html b/chromium/chrome/browser/resources/pdf/index.html
index 06d219a6c7e..00d96432fd0 100644
--- a/chromium/chrome/browser/resources/pdf/index.html
+++ b/chromium/chrome/browser/resources/pdf/index.html
@@ -4,20 +4,20 @@
<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">
- <link rel="import" href="elements/viewer-password-screen/viewer-password-screen.html">
- <link rel="import" href="elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html">
- <link rel="import" href="elements/viewer-zoom-toolbar/viewer-zoom-toolbar.html">
+ <link rel="import" href="elements/viewer-error-screen.html">
+ <link rel="import" href="elements/viewer-page-indicator.html">
+ <link rel="import" href="elements/viewer-page-selector.html">
+ <link rel="import" href="elements/viewer-password-screen.html">
+ <link rel="import" href="elements/viewer-pdf-toolbar.html">
+ <link rel="import" href="elements/viewer-zoom-toolbar.html">
<link rel="import" href="elements/shared-vars.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/html/cr/event_target.html">
<link rel="import" href="chrome://resources/html/event_tracker.html">
<if expr="chromeos">
- <link rel="import" href="elements/viewer-ink-host/viewer-ink-host.html">
- <link rel="import" href="elements/viewer-form-warning/viewer-form-warning.html">
+ <link rel="import" href="elements/viewer-ink-host.html">
+ <link rel="import" href="elements/viewer-form-warning.html">
</if>
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
@@ -58,6 +58,7 @@
<script src="chrome://resources/js/promise_resolver.js"></script>
<script src="browser_api.js"></script>
<script src="metrics.js"></script>
+<script src="controller.js"></script>
<script src="pdf_viewer.js"></script>
<script src="main.js"></script>
</html>
diff --git a/chromium/chrome/browser/resources/pdf/ink/BUILD.gn b/chromium/chrome/browser/resources/pdf/ink/BUILD.gn
index 38908ee25a1..b1c2be215bd 100644
--- a/chromium/chrome/browser/resources/pdf/ink/BUILD.gn
+++ b/chromium/chrome/browser/resources/pdf/ink/BUILD.gn
@@ -11,6 +11,9 @@ js_type_check("closure_compile") {
}
js_library("ink_api") {
+ deps = [
+ "..:annotation_tool",
+ ]
externs_list = [
"//third_party/ink/build/ink_lib_externs.js",
"$externs_path/pending.js",
diff --git a/chromium/chrome/browser/resources/pdf/ink/ink_api.js b/chromium/chrome/browser/resources/pdf/ink/ink_api.js
index 04e0d56dcf6..99eed15d900 100644
--- a/chromium/chrome/browser/resources/pdf/ink/ink_api.js
+++ b/chromium/chrome/browser/resources/pdf/ink/ink_api.js
@@ -4,15 +4,6 @@
/**
* @typedef {{
- * tool: string,
- * size: number,
- * color: string,
- * }}
- */
-let AnnotationTool;
-
-/**
- * @typedef {{
* canUndo: boolean,
* canRedo: boolean,
* }}
@@ -88,7 +79,7 @@ class InkAPI {
}[tool.tool];
this.brush_.setShape(shape);
if (tool.tool != 'eraser') {
- this.brush_.setColor(tool.color);
+ this.brush_.setColor(/** @type {string} */ (tool.color));
}
this.brush_.setStrokeWidth(tool.size);
}
diff --git a/chromium/chrome/browser/resources/pdf/open_pdf_params_parser.js b/chromium/chrome/browser/resources/pdf/open_pdf_params_parser.js
index d4a502a135f..c33c46b6d75 100644
--- a/chromium/chrome/browser/resources/pdf/open_pdf_params_parser.js
+++ b/chromium/chrome/browser/resources/pdf/open_pdf_params_parser.js
@@ -10,15 +10,15 @@
*/
class OpenPdfParamsParser {
/**
- * @param {function(Object)} postMessageCallback
+ * @param {function(string):void} getNamedDestinationCallback
* Function called to fetch information for a named destination.
*/
- constructor(postMessageCallback) {
+ constructor(getNamedDestinationCallback) {
/** @private {!Array<!Object>} */
this.outstandingRequests_ = [];
- /** @private {!function(Object)} */
- this.postMessageCallback_ = postMessageCallback;
+ /** @private {!function(string):void} */
+ this.getNamedDestinationCallback_ = getNamedDestinationCallback;
}
/**
@@ -181,10 +181,7 @@ class OpenPdfParamsParser {
if (params.page === undefined && 'nameddest' in urlParams) {
this.outstandingRequests_.push({callback: callback, params: params});
- this.postMessageCallback_({
- type: 'getNamedDestination',
- namedDestination: urlParams['nameddest']
- });
+ this.getNamedDestinationCallback_(urlParams['nameddest']);
} else {
callback(params);
}
diff --git a/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js b/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js
index 0ab77f41f3f..5957e13c178 100644
--- a/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js
+++ b/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js
@@ -6,7 +6,7 @@
* Turn a dictionary received from postMessage into a key event.
*
* @param {Object} dict A dictionary representing the key event.
- * @return {Event} A key event.
+ * @return {!Event} A key event.
*/
function DeserializeKeyEvent(dict) {
const e = document.createEvent('Event');
@@ -53,66 +53,83 @@ const LoadState = {
* Create a new PDFScriptingAPI. This provides a scripting interface to
* the PDF viewer so that it can be customized by things like print preview.
*
- * @param {Window} window the window of the page containing the pdf viewer.
- * @param {Object} plugin the plugin element containing the pdf viewer.
- * @constructor
*/
-function PDFScriptingAPI(window, plugin) {
- this.loadState_ = LoadState.LOADING;
- this.pendingScriptingMessages_ = [];
- this.setPlugin(plugin);
+class PDFScriptingAPI {
+ /**
+ * @param {Window} window the window of the page containing the pdf viewer.
+ * @param {Object} plugin the plugin element containing the pdf viewer.
+ */
+ constructor(window, plugin) {
+ this.loadState_ = LoadState.LOADING;
+ this.pendingScriptingMessages_ = [];
+ this.setPlugin(plugin);
- window.addEventListener('message', event => {
- if (event.origin != 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai' &&
- event.origin != 'chrome://print') {
- console.error(
- 'Received message that was not from the extension: ' + event);
- return;
- }
- switch (event.data.type) {
- case 'viewport':
- /**
- * @type {{
- * pageX: number,
- * pageY: number,
- * pageWidth: number,
- * viewportWidth: number,
- * viewportHeight: number
- * }}
- */
- const viewportData = event.data;
- if (this.viewportChangedCallback_) {
- this.viewportChangedCallback_(
- viewportData.pageX, viewportData.pageY, viewportData.pageWidth,
- viewportData.viewportWidth, viewportData.viewportHeight);
- }
- break;
- case 'documentLoaded': {
- const data = /** @type {{load_state: LoadState}} */ (event.data);
- this.loadState_ = data.load_state;
- if (this.loadCallback_) {
- this.loadCallback_(this.loadState_ == LoadState.SUCCESS);
- }
- break;
+ /** @private {Function} */
+ this.viewportChangedCallback_;
+
+ /** @private {Function} */
+ this.loadCallback_;
+
+ /** @private {Function} */
+ this.selectedTextCallback_;
+
+ /** @private {Function} */
+ this.keyEventCallback_;
+
+ /** @private {Object} */
+ this.plugin_;
+
+ window.addEventListener('message', event => {
+ if (event.origin !=
+ 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai' &&
+ event.origin != 'chrome://print') {
+ console.error(
+ 'Received message that was not from the extension: ' + event);
+ return;
}
- case 'getSelectedTextReply': {
- const data = /** @type {{selectedText: string}} */ (event.data);
- if (this.selectedTextCallback_) {
- this.selectedTextCallback_(data.selectedText);
- this.selectedTextCallback_ = null;
+ switch (event.data.type) {
+ case 'viewport':
+ /**
+ * @type {{
+ * pageX: number,
+ * pageY: number,
+ * pageWidth: number,
+ * viewportWidth: number,
+ * viewportHeight: number
+ * }}
+ */
+ const viewportData = event.data;
+ if (this.viewportChangedCallback_) {
+ this.viewportChangedCallback_(
+ viewportData.pageX, viewportData.pageY, viewportData.pageWidth,
+ viewportData.viewportWidth, viewportData.viewportHeight);
+ }
+ break;
+ case 'documentLoaded': {
+ const data = /** @type {{load_state: LoadState}} */ (event.data);
+ this.loadState_ = data.load_state;
+ if (this.loadCallback_) {
+ this.loadCallback_(this.loadState_ == LoadState.SUCCESS);
+ }
+ break;
}
- break;
- }
- case 'sendKeyEvent':
- if (this.keyEventCallback_) {
- this.keyEventCallback_(DeserializeKeyEvent(event.data.keyEvent));
+ case 'getSelectedTextReply': {
+ const data = /** @type {{selectedText: string}} */ (event.data);
+ if (this.selectedTextCallback_) {
+ this.selectedTextCallback_(data.selectedText);
+ this.selectedTextCallback_ = null;
+ }
+ break;
}
- break;
- }
- }, false);
-}
+ case 'sendKeyEvent':
+ if (this.keyEventCallback_) {
+ this.keyEventCallback_(DeserializeKeyEvent(event.data.keyEvent));
+ }
+ break;
+ }
+ }, false);
+ }
-PDFScriptingAPI.prototype = {
/**
* Send a message to the extension. If messages try to get sent before there
* is a plugin element set, then we queue them up and send them later (this
@@ -121,13 +138,13 @@ PDFScriptingAPI.prototype = {
* @param {Object} message The message to send.
* @private
*/
- sendMessage_: function(message) {
+ sendMessage_(message) {
if (this.plugin_) {
this.plugin_.postMessage(message, '*');
} else {
this.pendingScriptingMessages_.push(message);
}
- },
+ }
/**
* Sets the plugin element containing the PDF viewer. The element will usually
@@ -135,7 +152,7 @@ PDFScriptingAPI.prototype = {
*
* @param {Object} plugin the plugin element containing the PDF viewer.
*/
- setPlugin: function(plugin) {
+ setPlugin(plugin) {
this.plugin_ = plugin;
if (this.plugin_) {
@@ -147,16 +164,16 @@ PDFScriptingAPI.prototype = {
this.sendMessage_(this.pendingScriptingMessages_.shift());
}
}
- },
+ }
/**
* Sets the callback which will be run when the PDF viewport changes.
*
* @param {Function} callback the callback to be called.
*/
- setViewportChangedCallback: function(callback) {
+ setViewportChangedCallback(callback) {
this.viewportChangedCallback_ = callback;
- },
+ }
/**
* Sets the callback which will be run when the PDF document has finished
@@ -164,20 +181,20 @@ PDFScriptingAPI.prototype = {
*
* @param {Function} callback the callback to be called.
*/
- setLoadCallback: function(callback) {
+ setLoadCallback(callback) {
this.loadCallback_ = callback;
if (this.loadState_ != LoadState.LOADING && this.loadCallback_) {
this.loadCallback_(this.loadState_ == LoadState.SUCCESS);
}
- },
+ }
/**
* Sets a callback that gets run when a key event is fired in the PDF viewer.
* @param {Function} callback the callback to be called with a key event.
*/
- setKeyEventCallback: function(callback) {
+ setKeyEventCallback(callback) {
this.keyEventCallback_ = callback;
- },
+ }
/**
* Resets the PDF viewer into print preview mode.
@@ -187,7 +204,7 @@ PDFScriptingAPI.prototype = {
* @param {Array<number>} pageNumbers an array of the page numbers.
* @param {boolean} modifiable whether or not the document is modifiable.
*/
- resetPrintPreviewMode: function(url, grayscale, pageNumbers, modifiable) {
+ resetPrintPreviewMode(url, grayscale, pageNumbers, modifiable) {
this.loadState_ = LoadState.LOADING;
this.sendMessage_({
type: 'resetPrintPreviewMode',
@@ -196,14 +213,14 @@ PDFScriptingAPI.prototype = {
pageNumbers: pageNumbers,
modifiable: modifiable
});
- },
+ }
/**
* Hide the toolbars after a delay.
*/
- hideToolbars: function() {
+ hideToolbars() {
this.sendMessage_({type: 'hideToolbars'});
- },
+ }
/**
* Load a page into the document while in print preview mode.
@@ -211,22 +228,22 @@ PDFScriptingAPI.prototype = {
* @param {string} url the url of the pdf page to load.
* @param {number} index the index of the page to load.
*/
- loadPreviewPage: function(url, index) {
+ loadPreviewPage(url, index) {
this.sendMessage_({type: 'loadPreviewPage', url: url, index: index});
- },
+ }
/** @param {boolean} darkMode Whether the page is in dark mode. */
- darkModeChanged: function(darkMode) {
+ darkModeChanged(darkMode) {
this.sendMessage_({type: 'darkModeChanged', darkMode: darkMode});
- },
+ }
/**
* Select all the text in the document. May only be called after document
* load.
*/
- selectAll: function() {
+ selectAll() {
this.sendMessage_({type: 'selectAll'});
- },
+ }
/**
* Get the selected text in the document. The callback will be called with the
@@ -236,40 +253,40 @@ PDFScriptingAPI.prototype = {
* @return {boolean} true if the function is successful, false if there is an
* outstanding request for selected text that has not been answered.
*/
- getSelectedText: function(callback) {
+ getSelectedText(callback) {
if (this.selectedTextCallback_) {
return false;
}
this.selectedTextCallback_ = callback;
this.sendMessage_({type: 'getSelectedText'});
return true;
- },
+ }
/**
* Print the document. May only be called after document load.
*/
- print: function() {
+ print() {
this.sendMessage_({type: 'print'});
- },
+ }
/**
* Send a key event to the extension.
*
* @param {Event} keyEvent the key event to send to the extension.
*/
- sendKeyEvent: function(keyEvent) {
+ sendKeyEvent(keyEvent) {
this.sendMessage_(
{type: 'sendKeyEvent', keyEvent: SerializeKeyEvent(keyEvent)});
- },
+ }
/**
* @param {number} scrollX The amount to horizontally scroll in pixels.
* @param {number} scrollY The amount to vertically scroll in pixels.
*/
- scrollPosition: function(scrollX, scrollY) {
+ scrollPosition(scrollX, scrollY) {
this.sendMessage_({type: 'scrollPosition', x: scrollX, y: scrollY});
- },
-};
+ }
+}
/**
* Creates a PDF viewer with a scripting interface. This is basically 1) an
diff --git a/chromium/chrome/browser/resources/pdf/pdf_viewer.js b/chromium/chrome/browser/resources/pdf/pdf_viewer.js
index 375663f029c..d85d80a2101 100644
--- a/chromium/chrome/browser/resources/pdf/pdf_viewer.js
+++ b/chromium/chrome/browser/resources/pdf/pdf_viewer.js
@@ -6,16 +6,64 @@
/**
* @typedef {{
- * dataToSave: Array,
- * token: string,
- * fileName: string
+ * source: Object,
+ * origin: string,
+ * data: !MessageData,
* }}
*/
-let SaveDataMessageData;
+let MessageObject;
/**
- * @return {number} Width of a scrollbar in pixels
+ * @typedef {{
+ * type: string,
+ * height: number,
+ * width: number,
+ * layoutOptions: (!LayoutOptions|undefined),
+ * pageDimensions: Array
+ * }}
+ */
+let DocumentDimensionsMessageData;
+
+/**
+ * @typedef {{
+ * type: string,
+ * url: string,
+ * disposition: !PdfNavigator.WindowOpenDisposition,
+ * }}
+ */
+let NavigateMessageData;
+
+/**
+ * @typedef {{
+ * type: string,
+ * page: number,
+ * x: number,
+ * y: number,
+ * zoom: number
+ * }}
+ */
+let DestinationMessageData;
+
+/**
+ * @typedef {{
+ * type: string,
+ * title: string,
+ * bookmarks: !Array<!Bookmark>,
+ * canSerializeDocument: boolean,
+ * }}
*/
+let MetadataMessageData;
+
+/**
+ * @typedef {{
+ * hasUnsavedChanges: (boolean|undefined),
+ * fileName: string,
+ * dataToSave: !ArrayBuffer
+ * }}
+ */
+let RequiredSaveResult;
+
+/** @return {number} Width of a scrollbar in pixels */
function getScrollbarWidth() {
const div = document.createElement('div');
div.style.visibility = 'hidden';
@@ -31,7 +79,6 @@ function getScrollbarWidth() {
/**
* Return the filename component of a URL, percent decoded if possible.
- *
* @param {string} url The URL to get the filename from.
* @return {string} The filename component.
*/
@@ -53,8 +100,7 @@ function getFilenameFromURL(url) {
/**
* Whether keydown events should currently be ignored. Events are ignored when
* an editable element has focus, to allow for proper editing controls.
- *
- * @param {HTMLElement} activeElement The currently selected DOM node.
+ * @param {Element} activeElement The currently selected DOM node.
* @return {boolean} True if keydown events should be ignored.
*/
function shouldIgnoreKeyEvents(activeElement) {
@@ -70,285 +116,341 @@ function shouldIgnoreKeyEvents(activeElement) {
}
/**
- * Creates a cryptographically secure pseudorandom 128-bit token.
- *
- * @return {string} The generated token as a hex string.
+ * Creates a new PDFViewer. There should only be one of these objects per
+ * document.
*/
-function createToken() {
- const randomBytes = new Uint8Array(16);
- return window.crypto.getRandomValues(randomBytes)
- .map(b => b.toString(16).padStart(2, '0'))
- .join('');
-}
+class PDFViewer {
+ /**
+ * @param {!BrowserApi} browserApi An object providing an API to the browser.
+ */
+ constructor(browserApi) {
+ /** @private {!BrowserApi} */
+ this.browserApi_ = browserApi;
-/**
- * The minimum number of pixels to offset the toolbar by from the bottom and
- * right side of the screen.
- */
-PDFViewer.MIN_TOOLBAR_OFFSET = 15;
+ /** @private {string} */
+ this.originalUrl_ = this.browserApi_.getStreamInfo().originalUrl;
-/**
- * The height of the toolbar along the top of the page. The document will be
- * shifted down by this much in the viewport.
- */
-PDFViewer.MATERIAL_TOOLBAR_HEIGHT = 56;
+ /** @private {string} */
+ this.javascript_ = this.browserApi_.getStreamInfo().javascript || 'block';
-/**
- * Minimum height for the material toolbar to show (px). Should match the media
- * query in index-material.css. If the window is smaller than this at load,
- * leave no space for the toolbar.
- */
-PDFViewer.TOOLBAR_WINDOW_MIN_HEIGHT = 250;
+ /** @private {!LoadState} */
+ this.loadState_ = LoadState.LOADING;
-/**
- * The background color used for print preview (--google-grey-refresh-300).
- */
-PDFViewer.PRINT_PREVIEW_BACKGROUND_COLOR = '0xFFDADCE0';
+ /** @private {?Object} */
+ this.parentWindow_ = null;
-/**
- * The background color used for print preview when dark mode is enabled
- * (--google-grey-refresh-700).
- */
-PDFViewer.PRINT_PREVIEW_DARK_BACKGROUND_COLOR = '0xFF5F6368';
+ /** @private {?string} */
+ this.parentOrigin_ = null;
-/**
- * The background color used for the regular viewer.
- */
-PDFViewer.BACKGROUND_COLOR = '0xFF525659';
+ /** @private {boolean} */
+ this.isFormFieldFocused_ = false;
-/**
- * Creates a new PDFViewer. There should only be one of these objects per
- * document.
- *
- * @param {!BrowserApi} browserApi An object providing an API to the browser.
- * @constructor
- */
-function PDFViewer(browserApi) {
- this.browserApi_ = browserApi;
- this.originalUrl_ = this.browserApi_.getStreamInfo().originalUrl;
- this.javascript_ = this.browserApi_.getStreamInfo().javascript || 'block';
- this.loadState_ = LoadState.LOADING;
- this.parentWindow_ = null;
- this.parentOrigin_ = null;
- this.isFormFieldFocused_ = false;
- this.beepCount_ = 0;
- this.delayedScriptingMessages_ = [];
- this.loaded_ = new PromiseResolver();
-
- this.isPrintPreview_ = location.origin === 'chrome://print';
- this.isPrintPreviewLoadingFinished_ = false;
- this.isUserInitiatedEvent_ = true;
-
- /** @private {boolean} */
- this.hasEnteredAnnotationMode_ = false;
-
- /** @private {boolean} */
- this.hadPassword_ = false;
-
- /** @private {boolean} */
- this.canSerializeDocument_ = false;
-
- PDFMetrics.record(PDFMetrics.UserAction.DOCUMENT_OPENED);
-
- // Parse open pdf parameters.
- this.paramsParser_ = new OpenPdfParamsParser(
- message => this.pluginController_.postMessage(message));
- const toolbarEnabled =
- this.paramsParser_.getUiUrlParams(this.originalUrl_).toolbar &&
- !this.isPrintPreview_;
-
- // The sizer element is placed behind the plugin element to cause scrollbars
- // to be displayed in the window. It is sized according to the document size
- // of the pdf and zoom level.
- this.sizer_ = $('sizer');
-
- if (this.isPrintPreview_) {
- this.pageIndicator_ = $('page-indicator');
- }
- this.passwordScreen_ = $('password-screen');
- this.passwordScreen_.addEventListener(
- 'password-submitted', e => this.onPasswordSubmitted_(e));
- this.errorScreen_ = $('error-screen');
- // Can only reload if we are in a normal tab.
- if (chrome.tabs && this.browserApi_.getStreamInfo().tabId != -1) {
- this.errorScreen_.reloadFn = () => {
- chrome.tabs.reload(this.browserApi_.getStreamInfo().tabId);
- };
- }
+ /** @private {number} */
+ this.beepCount_ = 0;
- // Create the viewport.
- const shortWindow = window.innerHeight < PDFViewer.TOOLBAR_WINDOW_MIN_HEIGHT;
- const topToolbarHeight =
- (toolbarEnabled) ? PDFViewer.MATERIAL_TOOLBAR_HEIGHT : 0;
- const defaultZoom =
- this.browserApi_.getZoomBehavior() == BrowserApi.ZoomBehavior.MANAGE ?
- this.browserApi_.getDefaultZoom() :
- 1.0;
- this.viewport_ = new Viewport(
- window, this.sizer_, getScrollbarWidth(), defaultZoom, topToolbarHeight);
- this.viewport_.setViewportChangedCallback(() => this.viewportChanged_());
- this.viewport_.setBeforeZoomCallback(
- () => this.currentController_.beforeZoom());
- this.viewport_.setAfterZoomCallback(
- () => this.currentController_.afterZoom());
- this.viewport_.setUserInitiatedCallback(
- userInitiated => this.setUserInitiated_(userInitiated));
- window.addEventListener('beforeunload', () => this.viewport_.resetTracker());
-
- // Create the plugin object dynamically so we can set its src. The plugin
- // element is sized to fill the entire window and is set to be fixed
- // positioning, acting as a viewport. The plugin renders into this viewport
- // according to the scroll position of the window.
- this.plugin_ = document.createElement('embed');
- // NOTE: The plugin's 'id' field must be set to 'plugin' since
- // chrome/renderer/printing/print_render_frame_helper.cc actually
- // references it.
- this.plugin_.id = 'plugin';
- this.plugin_.type = 'application/x-google-chrome-pdf';
-
- // Handle scripting messages from outside the extension that wish to interact
- // with it. We also send a message indicating that extension has loaded and
- // is ready to receive messages.
- window.addEventListener(
- 'message', message => this.handleScriptingMessage(message), false);
-
- this.plugin_.setAttribute('src', this.originalUrl_);
- this.plugin_.setAttribute(
- 'stream-url', this.browserApi_.getStreamInfo().streamUrl);
- let headers = '';
- for (const header in this.browserApi_.getStreamInfo().responseHeaders) {
- headers += header + ': ' +
- this.browserApi_.getStreamInfo().responseHeaders[header] + '\n';
- }
- this.plugin_.setAttribute('headers', headers);
+ /** @private {!Array} */
+ this.delayedScriptingMessages_ = [];
+
+ /** @private {!PromiseResolver} */
+ this.loaded_;
+
+ /** @private {boolean} */
+ this.initialLoadComplete_ = false;
+
+ /** @private {boolean} */
+ this.isPrintPreview_ = location.origin === 'chrome://print';
- this.plugin_.setAttribute('background-color', PDFViewer.BACKGROUND_COLOR);
- this.plugin_.setAttribute('top-toolbar-height', topToolbarHeight);
- this.plugin_.setAttribute('javascript', this.javascript_);
+ /** @private {boolean} */
+ this.isPrintPreviewLoadingFinished_ = false;
- if (this.browserApi_.getStreamInfo().embedded) {
+ /** @private {boolean} */
+ this.isUserInitiatedEvent_ = true;
+
+ /** @private {boolean} */
+ this.hasEnteredAnnotationMode_ = false;
+
+ /** @private {boolean} */
+ this.hadPassword_ = false;
+
+ /** @private {boolean} */
+ this.canSerializeDocument_ = false;
+
+ /** @private {!EventTracker} */
+ this.tracker_ = new EventTracker();
+
+ PDFMetrics.record(PDFMetrics.UserAction.DOCUMENT_OPENED);
+
+ // Parse open pdf parameters.
+ /** @private {!OpenPdfParamsParser} */
+ this.paramsParser_ = new OpenPdfParamsParser(
+ destination => this.pluginController_.getNamedDestination(destination));
+ const toolbarEnabled =
+ this.paramsParser_.getUiUrlParams(this.originalUrl_).toolbar &&
+ !this.isPrintPreview_;
+
+ // The sizer element is placed behind the plugin element to cause scrollbars
+ // to be displayed in the window. It is sized according to the document size
+ // of the pdf and zoom level.
+ this.sizer_ = /** @type {!HTMLDivElement} */ ($('sizer'));
+
+ /** @private {?ViewerPageIndicatorElement} */
+ this.pageIndicator_ = this.isPrintPreview_ ?
+ /** @type {!ViewerPageIndicatorElement} */ ($('page-indicator')) :
+ null;
+
+ /** @private {?ViewerPasswordScreenElement} */
+ this.passwordScreen_ =
+ /** @type {!ViewerPasswordScreenElement} */ ($('password-screen'));
+ this.passwordScreen_.addEventListener('password-submitted', e => {
+ this.onPasswordSubmitted_(
+ /** @type {!CustomEvent<{password: string}>} */ (e));
+ });
+
+ /** @private {?ViewerErrorScreenElement} */
+ this.errorScreen_ =
+ /** @type {!ViewerErrorScreenElement} */ ($('error-screen'));
+ // Can only reload if we are in a normal tab.
+ if (chrome.tabs && this.browserApi_.getStreamInfo().tabId != -1) {
+ this.errorScreen_.reloadFn = () => {
+ chrome.tabs.reload(this.browserApi_.getStreamInfo().tabId);
+ };
+ }
+
+ // Create the viewport.
+ const shortWindow =
+ window.innerHeight < PDFViewer.TOOLBAR_WINDOW_MIN_HEIGHT;
+ const topToolbarHeight =
+ (toolbarEnabled) ? PDFViewer.MATERIAL_TOOLBAR_HEIGHT : 0;
+ const defaultZoom =
+ this.browserApi_.getZoomBehavior() == BrowserApi.ZoomBehavior.MANAGE ?
+ this.browserApi_.getDefaultZoom() :
+ 1.0;
+
+ /** @private {!Viewport} */
+ this.viewport_ = new Viewport(
+ window, this.sizer_, getScrollbarWidth(), defaultZoom,
+ topToolbarHeight);
+ this.viewport_.setViewportChangedCallback(() => this.viewportChanged_());
+ this.viewport_.setBeforeZoomCallback(
+ () => this.currentController_.beforeZoom());
+ this.viewport_.setAfterZoomCallback(
+ () => this.currentController_.afterZoom());
+ this.viewport_.setUserInitiatedCallback(
+ userInitiated => this.setUserInitiated_(userInitiated));
+ window.addEventListener('beforeunload', () => this.resetTrackers_());
+
+ // Create the plugin object dynamically so we can set its src. The plugin
+ // element is sized to fill the entire window and is set to be fixed
+ // positioning, acting as a viewport. The plugin renders into this viewport
+ // according to the scroll position of the window.
+ /** @private {!HTMLEmbedElement} */
+ this.plugin_ =
+ /** @type {!HTMLEmbedElement} */ (document.createElement('embed'));
+
+ // NOTE: The plugin's 'id' field must be set to 'plugin' since
+ // chrome/renderer/printing/print_render_frame_helper.cc actually
+ // references it.
+ this.plugin_.id = 'plugin';
+ this.plugin_.type = 'application/x-google-chrome-pdf';
+
+ // Handle scripting messages from outside the extension that wish to
+ // interact with it. We also send a message indicating that extension has
+ // loaded and is ready to receive messages.
+ window.addEventListener('message', message => {
+ this.handleScriptingMessage(/** @type {!MessageObject} */ (message));
+ }, false);
+
+ this.plugin_.setAttribute('src', this.originalUrl_);
this.plugin_.setAttribute(
- 'top-level-url', this.browserApi_.getStreamInfo().tabUrl);
- } else {
- this.plugin_.setAttribute('full-frame', '');
- }
+ 'stream-url', this.browserApi_.getStreamInfo().streamUrl);
+ let headers = '';
+ for (const header in this.browserApi_.getStreamInfo().responseHeaders) {
+ headers += header + ': ' +
+ this.browserApi_.getStreamInfo().responseHeaders[header] + '\n';
+ }
+ this.plugin_.setAttribute('headers', headers);
- $('content').appendChild(this.plugin_);
-
- this.pluginController_ =
- new PluginController(this.plugin_, this, this.viewport_);
- this.inkController_ = new InkController(this, this.viewport_);
- this.currentController_ = this.pluginController_;
-
- // Setup the button event listeners.
- this.zoomToolbar_ = $('zoom-toolbar');
- this.zoomToolbar_.setIsPrintPreview(this.isPrintPreview_);
- this.zoomToolbar_.addEventListener(
- 'fit-to-changed', e => this.fitToChanged_(e));
- this.zoomToolbar_.addEventListener('zoom-in', () => this.viewport_.zoomIn());
- this.zoomToolbar_.addEventListener(
- 'zoom-out', () => this.viewport_.zoomOut());
-
- this.gestureDetector_ = new GestureDetector($('content'));
- this.gestureDetector_.addEventListener(
- 'pinchstart', e => this.onPinchStart_(e));
- this.sentPinchEvent_ = false;
- this.gestureDetector_.addEventListener(
- 'pinchupdate', e => this.onPinchUpdate_(e));
- this.gestureDetector_.addEventListener('pinchend', e => this.onPinchEnd_(e));
-
- if (toolbarEnabled) {
- this.toolbar_ = $('toolbar');
- this.toolbar_.hidden = false;
- this.toolbar_.addEventListener('save', () => this.save());
- this.toolbar_.addEventListener('print', () => this.print());
- this.toolbar_.addEventListener(
- 'undo', () => this.currentController_.undo());
- this.toolbar_.addEventListener(
- 'redo', () => this.currentController_.redo());
- this.toolbar_.addEventListener(
- 'rotate-right', () => this.rotateClockwise());
- this.toolbar_.addEventListener(
- 'annotation-mode-toggled', e => this.annotationModeToggled_(e));
- this.toolbar_.addEventListener(
- 'annotation-tool-changed',
- e => this.inkController_.setAnnotationTool(e.detail.value));
-
- this.toolbar_.docTitle = getFilenameFromURL(this.originalUrl_);
- }
+ this.plugin_.setAttribute('background-color', PDFViewer.BACKGROUND_COLOR);
+ this.plugin_.setAttribute('top-toolbar-height', topToolbarHeight);
+ this.plugin_.setAttribute('javascript', this.javascript_);
- document.body.addEventListener('change-page', e => {
- this.viewport_.goToPage(e.detail.page);
- if (e.detail.origin == 'bookmark') {
- PDFMetrics.record(PDFMetrics.UserAction.FOLLOW_BOOKMARK);
- } else if (e.detail.origin == 'pageselector') {
- PDFMetrics.record(PDFMetrics.UserAction.PAGE_SELECTOR_NAVIGATE);
+ if (this.browserApi_.getStreamInfo().embedded) {
+ this.plugin_.setAttribute(
+ 'top-level-url', this.browserApi_.getStreamInfo().tabUrl);
+ } else {
+ this.plugin_.setAttribute('full-frame', '');
}
- });
-
- document.body.addEventListener('change-page-and-xy', e => {
- const point = this.viewport_.convertPageToScreen(e.detail.page, e.detail);
- this.goToPageAndXY_(e.detail.origin, e.detail.page, point);
- });
-
- document.body.addEventListener('navigate', e => {
- const disposition = e.detail.newtab ?
- PdfNavigator.WindowOpenDisposition.NEW_BACKGROUND_TAB :
- PdfNavigator.WindowOpenDisposition.CURRENT_TAB;
- this.navigator_.navigate(e.detail.uri, disposition);
- });
-
- document.body.addEventListener('dropdown-opened', e => {
- if (e.detail == 'bookmarks') {
- PDFMetrics.record(PDFMetrics.UserAction.OPEN_BOOKMARKS_PANEL);
+
+ $('content').appendChild(this.plugin_);
+
+ /** @private {!PluginController} */
+ this.pluginController_ = new PluginController(
+ this.plugin_, this.viewport_, () => this.isUserInitiatedEvent_,
+ () => this.loaded);
+ this.tracker_.add(
+ this.pluginController_.getEventTarget(), 'plugin-message',
+ e => this.handlePluginMessage_(e));
+
+ /** @private {!InkController} */
+ this.inkController_ = new InkController(this.viewport_);
+ this.tracker_.add(
+ this.inkController_.getEventTarget(), 'stroke-added',
+ () => chrome.mimeHandlerPrivate.setShowBeforeUnloadDialog(true));
+ this.tracker_.add(
+ this.inkController_.getEventTarget(), 'set-annotation-undo-state',
+ e => this.setAnnotationUndoState_(e));
+
+ /** @private {!ContentController} */
+ this.currentController_ = this.pluginController_;
+
+ // Setup the button event listeners.
+ /** @private {!ViewerZoomToolbarElement} */
+ this.zoomToolbar_ =
+ /** @type {!ViewerZoomToolbarElement} */ ($('zoom-toolbar'));
+ this.zoomToolbar_.setIsPrintPreview(this.isPrintPreview_);
+ this.zoomToolbar_.addEventListener(
+ 'fit-to-changed',
+ e => this.fitToChanged_(
+ /** @type {!CustomEvent<FitToChangedEvent>}} */ (e)));
+ this.zoomToolbar_.addEventListener(
+ 'zoom-in', () => this.viewport_.zoomIn());
+ this.zoomToolbar_.addEventListener(
+ 'zoom-out', () => this.viewport_.zoomOut());
+
+ /** @private {!GestureDetector} */
+ this.gestureDetector_ = new GestureDetector(assert($('content')));
+ this.gestureDetector_.addEventListener(
+ 'pinchstart', e => this.onPinchStart_(e));
+ this.sentPinchEvent_ = false;
+ this.gestureDetector_.addEventListener(
+ 'pinchupdate', e => this.onPinchUpdate_(e));
+ this.gestureDetector_.addEventListener(
+ 'pinchend', e => this.onPinchEnd_(e));
+
+ /** @private {?ViewerPdfToolbarElement} */
+ this.toolbar_ = null;
+ if (toolbarEnabled) {
+ this.toolbar_ = /** @type {!ViewerPdfToolbarElement} */ ($('toolbar'));
+ this.toolbar_.hidden = false;
+ this.toolbar_.addEventListener('save', () => this.save_());
+ this.toolbar_.addEventListener('print', () => this.print_());
+ this.toolbar_.addEventListener(
+ 'undo', () => this.currentController_.undo());
+ this.toolbar_.addEventListener(
+ 'redo', () => this.currentController_.redo());
+ this.toolbar_.addEventListener(
+ 'rotate-right', () => this.rotateClockwise_());
+ this.toolbar_.addEventListener('annotation-mode-toggled', e => {
+ this.annotationModeToggled_(
+ /** @type {!CustomEvent<{value: boolean}>} */ (e));
+ });
+ this.toolbar_.addEventListener(
+ 'annotation-tool-changed',
+ e => this.inkController_.setAnnotationTool(e.detail.value));
+
+ this.toolbar_.docTitle = getFilenameFromURL(this.originalUrl_);
+ }
+
+ document.body.addEventListener('change-page', e => {
+ this.viewport_.goToPage(e.detail.page);
+ if (e.detail.origin == 'bookmark') {
+ PDFMetrics.record(PDFMetrics.UserAction.FOLLOW_BOOKMARK);
+ } else if (e.detail.origin == 'pageselector') {
+ PDFMetrics.record(PDFMetrics.UserAction.PAGE_SELECTOR_NAVIGATE);
+ }
+ });
+
+ document.body.addEventListener('change-zoom', e => {
+ this.viewport_.setZoom(e.detail.zoom);
+ });
+
+ document.body.addEventListener('change-page-and-xy', e => {
+ const point = this.viewport_.convertPageToScreen(e.detail.page, e.detail);
+ this.goToPageAndXY_(e.detail.origin, e.detail.page, point);
+ });
+
+ document.body.addEventListener('navigate', e => {
+ const disposition = e.detail.newtab ?
+ PdfNavigator.WindowOpenDisposition.NEW_BACKGROUND_TAB :
+ PdfNavigator.WindowOpenDisposition.CURRENT_TAB;
+ this.navigator_.navigate(e.detail.uri, disposition);
+ });
+
+ document.body.addEventListener('dropdown-opened', e => {
+ if (e.detail == 'bookmarks') {
+ PDFMetrics.record(PDFMetrics.UserAction.OPEN_BOOKMARKS_PANEL);
+ }
+ });
+
+ /** @private {!ToolbarManager} */
+ this.toolbarManager_ =
+ new ToolbarManager(window, this.toolbar_, this.zoomToolbar_);
+
+ // Set up the ZoomManager.
+ /** @private {!ZoomManager} */
+ this.zoomManager_ = ZoomManager.create(
+ this.browserApi_.getZoomBehavior(), () => this.viewport_.getZoom(),
+ zoom => this.browserApi_.setZoom(zoom),
+ this.browserApi_.getInitialZoom());
+ this.viewport_.setZoomManager(this.zoomManager_);
+ this.browserApi_.addZoomEventListener(
+ zoom => this.zoomManager_.onBrowserZoomChange(zoom));
+
+ // Setup the keyboard event listener.
+ document.addEventListener(
+ 'keydown',
+ e => this.handleKeyEvent_(/** @type {!KeyboardEvent} */ (e)));
+ document.addEventListener('mousemove', e => this.handleMouseEvent_(e));
+ document.addEventListener('mouseout', e => this.handleMouseEvent_(e));
+ document.addEventListener(
+ 'contextmenu', e => this.handleContextMenuEvent_(e));
+
+ const tabId = this.browserApi_.getStreamInfo().tabId;
+ /** @private {!PdfNavigator} */
+ this.navigator_ = new PdfNavigator(
+ this.originalUrl_, this.viewport_, this.paramsParser_,
+ new NavigatorDelegate(tabId));
+
+ /** @private {!ViewportScroller} */
+ this.viewportScroller_ =
+ new ViewportScroller(this.viewport_, this.plugin_, window);
+
+ /** @private {!Array<!Bookmark>} */
+ this.bookmarks_;
+
+ /** @private {!Point} */
+ this.lastViewportPosition_;
+
+ /** @private {boolean} */
+ this.reverseZoomToolbar_;
+
+ /** @private {boolean} */
+ this.inPrintPreviewMode_;
+
+ /** @private {boolean} */
+ this.dark_;
+
+ /** @private {!DocumentDimensionsMessageData} */
+ this.documentDimensions_;
+
+ // Request translated strings.
+ chrome.resourcesPrivate.getStrings(
+ chrome.resourcesPrivate.Component.PDF,
+ strings => this.handleStrings_(strings));
+
+ // Listen for save commands from the browser.
+ if (chrome.mimeHandlerPrivate && chrome.mimeHandlerPrivate.onSave) {
+ chrome.mimeHandlerPrivate.onSave.addListener(url => this.onSave_(url));
}
- });
-
- this.toolbarManager_ =
- new ToolbarManager(window, this.toolbar_, this.zoomToolbar_);
-
- // Set up the ZoomManager.
- this.zoomManager_ = ZoomManager.create(
- this.browserApi_.getZoomBehavior(), () => this.viewport_.getZoom(),
- zoom => this.browserApi_.setZoom(zoom),
- this.browserApi_.getInitialZoom());
- this.viewport_.setZoomManager(this.zoomManager_);
- this.browserApi_.addZoomEventListener(
- zoom => this.zoomManager_.onBrowserZoomChange(zoom));
-
- // Setup the keyboard event listener.
- document.addEventListener('keydown', e => this.handleKeyEvent_(e));
- document.addEventListener('mousemove', e => this.handleMouseEvent_(e));
- document.addEventListener('mouseout', e => this.handleMouseEvent_(e));
- document.addEventListener(
- 'contextmenu', e => this.handleContextMenuEvent_(e));
-
- const tabId = this.browserApi_.getStreamInfo().tabId;
- this.navigator_ = new PdfNavigator(
- this.originalUrl_, this.viewport_, this.paramsParser_,
- new NavigatorDelegate(tabId));
- this.viewportScroller_ =
- new ViewportScroller(this.viewport_, this.plugin_, window);
-
- // Request translated strings.
- chrome.resourcesPrivate.getStrings(
- 'pdf', strings => this.handleStrings_(strings));
-
- // Listen for save commands from the browser.
- if (chrome.mimeHandlerPrivate && chrome.mimeHandlerPrivate.onSave) {
- chrome.mimeHandlerPrivate.onSave.addListener(url => this.onSave(url));
}
-}
-PDFViewer.prototype = {
/**
* Handle key events. These may come from the user directly or via the
* scripting API.
- *
- * @param {KeyboardEvent} e the event to handle.
+ * @param {!KeyboardEvent} e the event to handle.
* @private
*/
- handleKeyEvent_: function(e) {
+ handleKeyEvent_(e) {
const position = this.viewport_.position;
// Certain scroll events may be sent from outside of the extension.
const fromScriptingAPI = e.fromScriptingAPI;
@@ -357,7 +459,7 @@ PDFViewer.prototype = {
return;
}
- this.toolbarManager_.hideToolbarsAfterTimeout(e);
+ this.toolbarManager_.hideToolbarsAfterTimeout();
const pageUpHandler = () => {
// Go to the previous page if we are fit-to-page or fit-to-height.
@@ -366,8 +468,8 @@ PDFViewer.prototype = {
// Since we do the movement of the page.
e.preventDefault();
} else if (fromScriptingAPI) {
- position.y -= this.viewport.size.height;
- this.viewport.position = position;
+ position.y -= this.viewport_.size.height;
+ this.viewport_.position = position;
}
};
const pageDownHandler = () => {
@@ -377,8 +479,8 @@ PDFViewer.prototype = {
// Since we do the movement of the page.
e.preventDefault();
} else if (fromScriptingAPI) {
- position.y += this.viewport.size.height;
- this.viewport.position = position;
+ position.y += this.viewport_.size.height;
+ this.viewport_.position = position;
}
};
@@ -416,14 +518,14 @@ PDFViewer.prototype = {
e.preventDefault();
} else if (fromScriptingAPI) {
position.x -= Viewport.SCROLL_INCREMENT;
- this.viewport.position = position;
+ this.viewport_.position = position;
}
}
return;
case 38: // Up arrow key.
if (fromScriptingAPI) {
position.y -= Viewport.SCROLL_INCREMENT;
- this.viewport.position = position;
+ this.viewport_.position = position;
}
return;
case 39: // Right arrow key.
@@ -437,19 +539,19 @@ PDFViewer.prototype = {
e.preventDefault();
} else if (fromScriptingAPI) {
position.x += Viewport.SCROLL_INCREMENT;
- this.viewport.position = position;
+ this.viewport_.position = position;
}
}
return;
case 40: // Down arrow key.
if (fromScriptingAPI) {
position.y += Viewport.SCROLL_INCREMENT;
- this.viewport.position = position;
+ this.viewport_.position = position;
}
return;
case 65: // 'a' key.
if (e.ctrlKey || e.metaKey) {
- this.pluginController_.postMessage({type: 'selectAll'});
+ this.pluginController_.selectAll();
// Since we do selection ourselves.
e.preventDefault();
}
@@ -462,7 +564,7 @@ PDFViewer.prototype = {
return;
case 219: // Left bracket key.
if (e.ctrlKey) {
- this.rotateCounterclockwise();
+ this.rotateCounterclockwise_();
}
return;
case 220: // Backslash key.
@@ -472,7 +574,7 @@ PDFViewer.prototype = {
return;
case 221: // Right bracket key.
if (e.ctrlKey) {
- this.rotateClockwise();
+ this.rotateClockwise_();
}
return;
}
@@ -487,42 +589,49 @@ PDFViewer.prototype = {
this.toolbarManager_.showToolbars();
}
}
- },
+ }
- handleMouseEvent_: function(e) {
+ handleMouseEvent_(e) {
if (e.type == 'mousemove') {
this.toolbarManager_.handleMouseMove(e);
} else if (e.type == 'mouseout') {
this.toolbarManager_.hideToolbarsForMouseOut();
}
- },
+ }
- handleContextMenuEvent_: function(e) {
+ /**
+ * @param {!Event} e The context menu event
+ * @private
+ */
+ handleContextMenuEvent_(e) {
// Stop Chrome from popping up the context menu on long press. We need to
// make sure the start event did not have 2 touches because we don't want
// to block two finger tap opening the context menu. We check for
// firesTouchEvents in order to not block the context menu on right click.
- if (e.sourceCapabilities.firesTouchEvents &&
+ const capabilities =
+ /** @type {{ sourceCapabilities: Object }} */ (e).sourceCapabilities;
+ if (capabilities.firesTouchEvents &&
!this.gestureDetector_.wasTwoFingerTouch()) {
e.preventDefault();
}
- },
+ }
/**
* Handles the annotation mode being toggled on or off.
- *
* @param {!CustomEvent<{value: boolean}>} e
* @private
*/
- annotationModeToggled_: async function(e) {
+ async annotationModeToggled_(e) {
const annotationMode = e.detail.value;
if (annotationMode) {
// Enter annotation mode.
assert(this.currentController_ == this.pluginController_);
// TODO(dstockwell): set plugin read-only, begin transition
- this.updateProgress(0);
+ this.updateProgress_(0);
// TODO(dstockwell): handle save failure
- const result = await this.pluginController_.save(true);
+ const saveResult = await this.pluginController_.save(true);
+ // Data always exists when save is called with requireResult = true.
+ const result = /** @type {!RequiredSaveResult} */ (saveResult);
if (result.hasUnsavedChanges) {
assert(!loadTimeData.getBoolean('pdfFormSaveEnabled'));
try {
@@ -530,25 +639,26 @@ PDFViewer.prototype = {
} catch (e) {
// The user aborted entering annotation mode. Revert to the plugin.
this.toolbar_.annotationMode = false;
- this.updateProgress(100);
+ this.updateProgress_(100);
return;
}
}
PDFMetrics.record(PDFMetrics.UserAction.ENTER_ANNOTATION_MODE);
this.hasEnteredAnnotationMode_ = true;
// TODO(dstockwell): feed real progress data from the Ink component
- this.updateProgress(50);
+ this.updateProgress_(50);
await this.inkController_.load(result.fileName, result.dataToSave);
- this.inkController_.setAnnotationTool(this.toolbar_.annotationTool);
+ this.inkController_.setAnnotationTool(
+ assert(this.toolbar_.annotationTool));
this.currentController_ = this.inkController_;
this.pluginController_.unload();
- this.updateProgress(100);
+ this.updateProgress_(100);
} else {
// Exit annotation mode.
PDFMetrics.record(PDFMetrics.UserAction.EXIT_ANNOTATION_MODE);
assert(this.currentController_ == this.inkController_);
// TODO(dstockwell): set ink read-only, begin transition
- this.updateProgress(0);
+ this.updateProgress_(0);
// This runs separately to allow other consumers of `loaded` to queue
// up after this task.
this.loaded.then(() => {
@@ -556,36 +666,33 @@ PDFViewer.prototype = {
this.inkController_.unload();
});
// TODO(dstockwell): handle save failure
- const result = await this.inkController_.save(true);
+ const saveResult = await this.inkController_.save(true);
+ // Data always exists when save is called with requireResult = true.
+ const result = /** @type {!RequiredSaveResult} */ (saveResult);
await this.pluginController_.load(result.fileName, result.dataToSave);
// Ensure the plugin gets the initial viewport.
this.pluginController_.afterZoom();
}
- },
+ }
/**
* Exits annotation mode if active.
- *
* @return {Promise<void>}
*/
- exitAnnotationMode_: async function() {
+ async exitAnnotationMode_() {
if (!this.toolbar_.annotationMode) {
return;
}
this.toolbar_.toggleAnnotation();
await this.loaded;
- },
+ }
/**
* Request to change the viewport fitting type.
- *
- * @param {!CustomEvent<{
- * fittingType: FittingType,
- * userInitiated: boolean
- * }>} e
+ * @param {!CustomEvent<FitToChangedEvent>} e
* @private
*/
- fitToChanged_: function(e) {
+ fitToChanged_(e) {
if (e.detail.fittingType == FittingType.FIT_TO_PAGE) {
this.viewport_.fitToPage();
this.toolbarManager_.forceHideTopToolbar();
@@ -599,15 +706,14 @@ PDFViewer.prototype = {
if (e.detail.userInitiated) {
PDFMetrics.recordFitTo(e.detail.fittingType);
}
- },
+ }
/**
* Sends a 'documentLoaded' message to the PDFScriptingAPI if the document has
* finished loading.
- *
* @private
*/
- sendDocumentLoadedMessage_: function() {
+ sendDocumentLoadedMessage_() {
if (this.loadState_ == LoadState.LOADING) {
return;
}
@@ -616,17 +722,16 @@ PDFViewer.prototype = {
}
this.sendScriptingMessage_(
{type: 'documentLoaded', load_state: this.loadState_});
- },
+ }
/**
* Handle open pdf parameters. This function updates the viewport as per
* the parameters mentioned in the url while opening pdf. The order is
* important as later actions can override the effects of previous actions.
- *
* @param {Object} params The open params passed in the URL.
* @private
*/
- handleURLParams_: function(params) {
+ handleURLParams_(params) {
if (params.zoom) {
this.viewport_.setZoom(params.zoom);
}
@@ -654,32 +759,42 @@ PDFViewer.prototype = {
}
this.isUserInitiatedEvent_ = true;
}
- },
+ }
/**
* Moves the viewport to a point in a page. Called back after a
* 'transformPagePointReply' is returned from the plugin.
- *
* @param {string} origin Identifier for the caller for logging purposes.
* @param {number} page The index of the page to go to. zero-based.
- * @param {Object} message Message received from the plugin containing the
+ * @param {Point} message Message received from the plugin containing the
* x and y to navigate to in screen coordinates.
* @private
*/
- goToPageAndXY_: function(origin, page, message) {
+ goToPageAndXY_(origin, page, message) {
this.viewport_.goToPageAndXY(page, message.x, message.y);
if (origin == 'bookmark') {
PDFMetrics.record(PDFMetrics.UserAction.FOLLOW_BOOKMARK);
}
- },
+ }
/**
- * @return {Promise} Resolved when the load state reaches LOADED,
- * rejects on FAILED.
+ * @return {?Promise} Resolved when the load state reaches LOADED,
+ * rejects on FAILED. Returns null if no promise has been created, which
+ * is the case for initial load of the PDF.
*/
get loaded() {
- return this.loaded_.promise;
- },
+ return this.loaded_ ? this.loaded_.promise : null;
+ }
+
+ /** @return {!Viewport} The viewport. Used for testing. */
+ get viewport() {
+ return this.viewport_;
+ }
+
+ /** @return {!Array<!Bookmark>} The bookmarks. Used for testing. */
+ get bookmarks() {
+ return this.bookmarks_;
+ }
/**
* Updates the load state and triggers completion of the `loaded`
@@ -691,26 +806,29 @@ PDFViewer.prototype = {
if (this.loadState_ == loadState) {
return;
}
+ assert(
+ loadState == LoadState.LOADING || this.loadState_ == LoadState.LOADING);
+ this.loadState_ = loadState;
+ if (!this.initialLoadComplete_) {
+ this.initialLoadComplete_ = true;
+ return;
+ }
if (loadState == LoadState.SUCCESS) {
- assert(this.loadState_ == LoadState.LOADING);
this.loaded_.resolve();
} else if (loadState == LoadState.FAILED) {
- assert(this.loadState_ == LoadState.LOADING);
this.loaded_.reject();
} else {
- assert(loadState == LoadState.LOADING);
this.loaded_ = new PromiseResolver();
}
- this.loadState_ = loadState;
- },
+ }
/**
* Update the loading progress of the document in response to a progress
* message being received from the content controller.
- *
* @param {number} progress the progress as a percentage.
+ * @private
*/
- updateProgress: function(progress) {
+ updateProgress_(progress) {
if (this.toolbar_) {
this.toolbar_.loadProgress = progress;
}
@@ -743,28 +861,26 @@ PDFViewer.prototype = {
} else {
this.setLoadState_(LoadState.LOADING);
}
- },
+ }
/** @private */
- sendBackgroundColorForPrintPreview_: function() {
- this.pluginController_.postMessage({
- type: 'backgroundColorChanged',
- backgroundColor: this.dark_ ?
- PDFViewer.PRINT_PREVIEW_DARK_BACKGROUND_COLOR :
- PDFViewer.PRINT_PREVIEW_BACKGROUND_COLOR,
- });
- },
+ sendBackgroundColorForPrintPreview_() {
+ this.pluginController_.backgroundColorChanged(
+ this.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.
- *
* @param {Object} strings Dictionary of translated strings
* @private
*/
- handleStrings_: function(strings) {
- document.documentElement.dir = strings.textdirection;
- document.documentElement.lang = strings.language;
+ handleStrings_(strings) {
+ const stringsDictionary =
+ /** @type {{ textdirection: string, language: string }} */ (strings);
+ document.documentElement.dir = stringsDictionary.textdirection;
+ document.documentElement.lang = stringsDictionary.language;
loadTimeData.data = strings;
const isNewPrintPreview = this.isPrintPreview_ &&
@@ -786,38 +902,34 @@ PDFViewer.prototype = {
if ($('form-warning')) {
$('form-warning').strings = strings;
}
- },
+ }
/**
* An event handler for handling password-submitted events. These are fired
* when an event is entered into the password screen.
- *
- * @param {Object} event a password-submitted event.
+ * @param {!CustomEvent<{password: string}>} event a password-submitted event.
* @private
*/
- onPasswordSubmitted_: function(event) {
- this.pluginController_.postMessage(
- {type: 'getPasswordComplete', password: event.detail.password});
- },
+ onPasswordSubmitted_(event) {
+ this.pluginController_.getPasswordComplete(event.detail.password);
+ }
/**
* A callback that sets |isUserInitiatedEvent_| to |userInitiated|.
- *
* @param {boolean} userInitiated The value to set |isUserInitiatedEvent_| to.
* @private
*/
- setUserInitiated_: function(userInitiated) {
+ setUserInitiated_(userInitiated) {
assert(this.isUserInitiatedEvent_ != userInitiated);
this.isUserInitiatedEvent_ = userInitiated;
- },
+ }
/**
* A callback that's called when an update to a pinch zoom is detected.
- *
* @param {!Object} e the pinch event.
* @private
*/
- onPinchUpdate_: function(e) {
+ onPinchUpdate_(e) {
// Throttle number of pinch events to one per frame.
if (!this.sentPinchEvent_) {
this.sentPinchEvent_ = true;
@@ -826,42 +938,39 @@ PDFViewer.prototype = {
this.viewport_.pinchZoom(e);
});
}
- },
+ }
/**
* A callback that's called when the end of a pinch zoom is detected.
- *
* @param {!Object} e the pinch event.
* @private
*/
- onPinchEnd_: function(e) {
+ onPinchEnd_(e) {
// Using rAF for pinch end prevents pinch updates scheduled by rAF getting
// sent after the pinch end.
window.requestAnimationFrame(() => {
this.viewport_.pinchZoomEnd(e);
});
- },
+ }
/**
* A callback that's called when the start of a pinch zoom is detected.
- *
* @param {!Object} e the pinch event.
* @private
*/
- onPinchStart_: function(e) {
+ onPinchStart_(e) {
// We also use rAF for pinch start, so that if there is a pinch end event
// scheduled by rAF, this pinch start will be sent after.
window.requestAnimationFrame(() => {
this.viewport_.pinchZoomStart(e);
});
- },
+ }
/**
* A callback that's called after the viewport changes.
- *
* @private
*/
- viewportChanged_: function() {
+ viewportChanged_() {
if (!this.documentDimensions_) {
return;
}
@@ -900,9 +1009,10 @@ PDFViewer.prototype = {
// TODO(raymes): Give pageIndicator_ the same API as toolbar_.
if (this.pageIndicator_) {
+ const lastIndex = this.pageIndicator_.index;
this.pageIndicator_.index = visiblePage;
if (this.documentDimensions_.pageDimensions.length > 1 &&
- hasScrollbars.vertical) {
+ hasScrollbars.vertical && lastIndex !== undefined) {
this.pageIndicator_.style.visibility = 'visible';
} else {
this.pageIndicator_.style.visibility = 'hidden';
@@ -921,16 +1031,15 @@ PDFViewer.prototype = {
viewportWidth: size.width,
viewportHeight: size.height
});
- },
+ }
/**
* Handle a scripting message from outside the extension (typically sent by
* PDFScriptingAPI in a page containing the extension) to interact with the
* plugin.
- *
- * @param {MessageObject} message the message to handle.
+ * @param {!MessageObject} message The message to handle.
*/
- handleScriptingMessage: function(message) {
+ handleScriptingMessage(message) {
if (this.parentWindow_ != message.source) {
this.parentWindow_ = message.source;
this.parentOrigin_ = message.origin;
@@ -953,30 +1062,38 @@ PDFViewer.prototype = {
switch (message.data.type.toString()) {
case 'getSelectedText':
+ this.pluginController_.getSelectedText();
+ break;
case 'print':
+ this.pluginController_.print();
+ break;
case 'selectAll':
- this.pluginController_.postMessage(message.data);
+ this.pluginController_.selectAll();
break;
}
- },
+ }
/**
* Handle scripting messages specific to print preview.
- *
- * @param {MessageObject} message the message to handle.
+ * @param {!MessageObject} message the message to handle.
* @return {boolean} true if the message was handled, false otherwise.
* @private
*/
- handlePrintPreviewScriptingMessage_: function(message) {
+ handlePrintPreviewScriptingMessage_(message) {
if (!this.isPrintPreview_) {
return false;
}
- switch (message.data.type.toString()) {
+ let messageData = message.data;
+ switch (messageData.type.toString()) {
case 'loadPreviewPage':
- this.pluginController_.postMessage(message.data);
+ messageData =
+ /** @type {{ url: string, index: number }} */ (messageData);
+ this.pluginController_.loadPreviewPage(
+ messageData.url, messageData.index);
return true;
case 'resetPrintPreviewMode':
+ messageData = /** @type {!PrintPreviewParams} */ (messageData);
this.setLoadState_(LoadState.LOADING);
if (!this.inPrintPreviewMode_) {
this.inPrintPreviewMode_ = true;
@@ -999,49 +1116,42 @@ PDFViewer.prototype = {
saveButton.parentNode.removeChild(saveButton);
}
- this.pageIndicator_.pageLabels = message.data.pageNumbers;
+ this.pageIndicator_.pageLabels = messageData.pageNumbers;
- this.pluginController_.postMessage({
- type: 'resetPrintPreviewMode',
- url: message.data.url,
- grayscale: message.data.grayscale,
- // If the PDF isn't modifiable we send 0 as the page count so that no
- // blank placeholder pages get appended to the PDF.
- pageCount:
- (message.data.modifiable ? message.data.pageNumbers.length : 0)
- });
+ this.pluginController_.resetPrintPreviewMode(messageData);
return true;
case 'sendKeyEvent':
- this.handleKeyEvent_(DeserializeKeyEvent(message.data.keyEvent));
+ this.handleKeyEvent_(/** @type {!KeyboardEvent} */ (DeserializeKeyEvent(
+ /** @type {{ keyEvent: Object }} */ (message.data).keyEvent)));
return true;
case 'hideToolbars':
this.toolbarManager_.resetKeyboardNavigationAndHideToolbars();
return true;
case 'darkModeChanged':
- this.dark_ = message.data.darkMode;
+ this.dark_ = /** @type {{darkMode: boolean}} */ (message.data).darkMode;
if (this.isPrintPreview_) {
this.sendBackgroundColorForPrintPreview_();
}
return true;
case 'scrollPosition':
const position = this.viewport_.position;
- position.y += message.data.y;
- position.x += message.data.x;
- this.viewport.position = position;
+ messageData = /** @type {{ x: number, y: number }} */ (message.data);
+ position.y += messageData.y;
+ position.x += messageData.x;
+ this.viewport_.position = position;
return true;
}
return false;
- },
+ }
/**
* Send a scripting message outside the extension (typically to
* PDFScriptingAPI in a page containing the extension).
- *
* @param {Object} message the message to send.
* @private
*/
- sendScriptingMessage_: function(message) {
+ sendScriptingMessage_(message) {
if (this.parentWindow_ && this.parentOrigin_) {
let targetOrigin;
// Only send data back to the embedder if it is from the same origin,
@@ -1057,34 +1167,73 @@ PDFViewer.prototype = {
}
this.parentWindow_.postMessage(message, targetOrigin);
}
- },
-
- /**
- * @type {Viewport} the viewport of the PDF viewer.
- */
- get viewport() {
- return this.viewport_;
- },
+ }
/**
- * Each bookmark is an Object containing a:
- * - title
- * - page (optional)
- * - array of children (themselves bookmarks)
- *
- * @type {Array} the top-level bookmarks of the PDF.
+ * @param {!CustomEvent<MessageData>} e
+ * @private
*/
- get bookmarks() {
- return this.bookmarks_;
- },
+ handlePluginMessage_(e) {
+ const data = e.detail;
+ switch (data.type.toString()) {
+ case 'beep':
+ this.handleBeep_();
+ return;
+ case 'documentDimensions':
+ this.setDocumentDimensions_(
+ /** @type {!DocumentDimensionsMessageData} */ (data));
+ return;
+ case 'getPassword':
+ this.handlePasswordRequest_();
+ return;
+ case 'getSelectedTextReply':
+ this.handleSelectedTextReply_(
+ /** @type {{ selectedText: string }} */ (data).selectedText);
+ return;
+ case 'loadProgress':
+ this.updateProgress_(
+ /** @type {{ progress: number }} */ (data).progress);
+ return;
+ case 'navigate':
+ const navigateData = /** @type {!NavigateMessageData} */ (data);
+ this.handleNavigate_(navigateData.url, navigateData.disposition);
+ return;
+ case 'navigateToDestination':
+ const destinationData = /** @type {!DestinationMessageData} */ (data);
+ this.handleNavigateToDestination_(
+ destinationData.page, destinationData.x, destinationData.y,
+ destinationData.zoom);
+ return;
+ case 'printPreviewLoaded':
+ this.handlePrintPreviewLoaded_();
+ return;
+ case 'metadata':
+ const metadata = /** @type {!MetadataMessageData} */ (data);
+ this.setDocumentMetadata_(
+ metadata.title, metadata.bookmarks, metadata.canSerializeDocument);
+ return;
+ case 'setIsSelecting':
+ this.setIsSelecting_(
+ /** @type {{ isSelecting: boolean }} */ (data).isSelecting);
+ return;
+ case 'getNamedDestinationReply':
+ this.paramsParser_.onNamedDestinationReceived(
+ /** @type {{ pageNumber: number }} */ (data).pageNumber);
+ return;
+ case 'formFocusChange':
+ this.isFormFieldFocused_ =
+ /** @type {{ focused: boolean }} */ (data).focused;
+ return;
+ }
+ assertNotReached('Unknown message type received: ' + data.type);
+ }
/**
* Sets document dimensions from the current controller.
- *
- * @param {{height: number, width: number, pageDimensions: Array}}
- * documentDimensions
+ * @param {!DocumentDimensionsMessageData} documentDimensions
+ * @private
*/
- setDocumentDimensions: function(documentDimensions) {
+ setDocumentDimensions_(documentDimensions) {
this.documentDimensions_ = documentDimensions;
this.isUserInitiatedEvent_ = false;
this.viewport_.setDocumentDimensions(this.documentDimensions_);
@@ -1098,20 +1247,22 @@ PDFViewer.prototype = {
if (this.toolbar_) {
this.toolbar_.docLength = this.documentDimensions_.pageDimensions.length;
}
- },
+ }
/**
* Handles a beep request from the current controller.
+ * @private
*/
- handleBeep: function() {
+ handleBeep_() {
// Beeps are annoying, so just track count for now.
this.beepCount_ += 1;
- },
+ }
/**
* Handles a password request from the current controller.
+ * @private
*/
- handlePasswordRequest: function() {
+ handlePasswordRequest_() {
// If the password screen isn't up, put it up. Otherwise we're
// responding to an incorrect password so deny it.
if (!this.passwordScreen_.active) {
@@ -1121,26 +1272,27 @@ PDFViewer.prototype = {
} else {
this.passwordScreen_.deny();
}
- },
+ }
/**
* Handles a selected text reply from the current controller.
* @param {string} selectedText
+ * @private
*/
- handleSelectedTextReply: function(selectedText) {
+ handleSelectedTextReply_(selectedText) {
this.sendScriptingMessage_({
type: 'getSelectedTextReply',
selectedText: selectedText,
});
- },
+ }
/**
* Handles a navigation request from the current controller.
- *
* @param {string} url
- * @param {string} disposition
+ * @param {!PdfNavigator.WindowOpenDisposition} disposition
+ * @private
*/
- handleNavigate: function(url, disposition) {
+ handleNavigate_(url, disposition) {
// If in print preview, always open a new tab.
if (this.isPrintPreview_) {
this.navigator_.navigate(
@@ -1148,24 +1300,48 @@ PDFViewer.prototype = {
} else {
this.navigator_.navigate(url, disposition);
}
- },
+ }
+
+ /**
+ * Handles an internal navigation request to a destination from the current
+ * controller.
+ *
+ * @param {number} page
+ * @param {number} x
+ * @param {number} y
+ * @param {number} zoom
+ * @private
+ */
+ handleNavigateToDestination_(page, x, y, zoom) {
+ if (zoom) {
+ this.viewport_.setZoom(zoom);
+ }
+
+ if (x || y) {
+ this.viewport_.goToPageAndXY(page, x ? x : 0, y ? y : 0);
+ } else {
+ this.viewport_.goToPage(page);
+ }
+ }
/**
* Handles a notification that print preview has loaded from the
* current controller.
+ * @private
*/
- handlePrintPreviewLoaded: function() {
+ handlePrintPreviewLoaded_() {
this.isPrintPreviewLoadingFinished_ = true;
this.sendDocumentLoadedMessage_();
- },
+ }
/**
* Sets document metadata from the current controller.
* @param {string} title
- * @param {Array} bookmarks
+ * @param {!Array<!Bookmark>} bookmarks
* @param {boolean} canSerializeDocument
+ * @private
*/
- setDocumentMetadata: function(title, bookmarks, canSerializeDocument) {
+ setDocumentMetadata_(title, bookmarks, canSerializeDocument) {
if (title) {
document.title = title;
} else {
@@ -1174,47 +1350,40 @@ PDFViewer.prototype = {
this.bookmarks_ = bookmarks;
if (this.toolbar_) {
this.toolbar_.docTitle = document.title;
- this.toolbar_.bookmarks = this.bookmarks;
+ this.toolbar_.bookmarks = this.bookmarks_;
}
this.canSerializeDocument_ = canSerializeDocument;
this.updateAnnotationAvailable_();
- },
+ }
/**
* Sets the is selecting flag from the current controller.
* @param {boolean} isSelecting
+ * @private
*/
- setIsSelecting: function(isSelecting) {
+ setIsSelecting_(isSelecting) {
this.viewportScroller_.setEnableScrolling(isSelecting);
- },
-
- /**
- * Sets the form field focused flag from the current controller.
- * @param {boolean} focused
- */
- setIsFormFieldFocused: function(focused) {
- this.isFormFieldFocused_ = focused;
- },
+ }
/**
* An event handler for when the browser tells the PDF Viewer to perform a
* save.
- *
* @param {string} streamUrl unique identifier for a PDF Viewer instance.
* @private
*/
- onSave: async function(streamUrl) {
+ async onSave_(streamUrl) {
if (streamUrl != this.browserApi_.getStreamInfo().streamUrl) {
return;
}
- this.save();
- },
+ this.save_();
+ }
/**
* Saves the current PDF document to disk.
+ * @private
*/
- save: async function() {
+ async save_() {
PDFMetrics.record(PDFMetrics.UserAction.SAVE);
if (this.hasEnteredAnnotationMode_) {
PDFMetrics.record(PDFMetrics.UserAction.SAVE_WITH_ANNOTATION);
@@ -1257,17 +1426,19 @@ PDFViewer.prototype = {
// Saving in Annotation mode is destructive: crbug.com/919364
this.exitAnnotationMode_();
- },
+ }
- print: async function() {
+ /** @private */
+ async print_() {
PDFMetrics.record(PDFMetrics.UserAction.PRINT);
await this.exitAnnotationMode_();
this.currentController_.print();
- },
+ }
/**
* Updates the toolbar's annotation available flag depending on current
* conditions.
+ * @private
*/
updateAnnotationAvailable_() {
if (!this.toolbar_) {
@@ -1284,408 +1455,67 @@ PDFViewer.prototype = {
annotationAvailable = false;
}
this.toolbar_.annotationAvailable = annotationAvailable;
- },
+ }
- rotateClockwise() {
+ /** @private */
+ rotateClockwise_() {
PDFMetrics.record(PDFMetrics.UserAction.ROTATE);
this.viewport_.rotateClockwise(1);
this.currentController_.rotateClockwise();
this.updateAnnotationAvailable_();
- },
+ }
- rotateCounterclockwise() {
+ /** @private */
+ rotateCounterclockwise_() {
PDFMetrics.record(PDFMetrics.UserAction.ROTATE);
this.viewport_.rotateClockwise(3);
this.currentController_.rotateCounterclockwise();
this.updateAnnotationAvailable_();
- },
-
- setHasUnsavedChanges: function() {
- // Warn the user if they attempt to close the window without saving.
- chrome.mimeHandlerPrivate.setShowBeforeUnloadDialog(true);
- },
-
- /** @param {UndoState} state */
- setAnnotationUndoState(state) {
- this.toolbar_.canUndoAnnotation = state.canUndo;
- this.toolbar_.canRedoAnnotation = state.canRedo;
- },
-};
-
-/** @abstract */
-class ContentController {
- constructor() {}
-
- /**
- * A callback that's called before the zoom changes.
- */
- beforeZoom() {}
-
- /**
- * A callback that's called after the zoom changes.
- */
- afterZoom() {}
-
- /**
- * Handles a change to the viewport.
- */
- viewportChanged() {}
-
- /**
- * Rotates the document 90 degrees in the clockwise direction.
- * @abstract
- */
- rotateClockwise() {}
-
- /**
- * Rotates the document 90 degrees in the counter clockwise direction.
- * @abstract
- */
- rotateCounterclockwise() {}
-
- /**
- * Triggers printing of the current document.
- */
- print() {}
-
- /**
- * Undo an edit action.
- */
- undo() {}
-
- /**
- * Redo an edit action.
- */
- redo() {}
-
- /**
- * Requests that the current document be saved.
- * @param {boolean} requireResult whether a response is required, otherwise
- * the controller may save the document to disk internally.
- * @return {Promise<{fileName: string, dataToSave: ArrayBuffer}}
- * @abstract
- */
- save(requireResult) {}
-
- /**
- * Loads PDF document from `data` activates UI.
- * @param {string} fileName
- * @param {ArrayBuffer} data
- * @return {Promise<void>}
- * @abstract
- */
- load(fileName, data) {}
-
- /**
- * Unloads the current document and removes the UI.
- * @abstract
- */
- unload() {}
-}
-
-class InkController extends ContentController {
- /**
- * @param {PDFViewer} viewer
- * @param {Viewport} viewport
- */
- constructor(viewer, viewport) {
- super();
- this.viewer_ = viewer;
- this.viewport_ = viewport;
-
- /** @type {ViewerInkHost} */
- this.inkHost_ = null;
}
- /** @param {AnnotationTool} tool */
- setAnnotationTool(tool) {
- this.tool_ = tool;
- if (this.inkHost_) {
- this.inkHost_.setAnnotationTool(tool);
- }
- }
-
- /** @override */
- rotateClockwise() {
- // TODO(dstockwell): implement rotation
- }
-
- /** @override */
- rotateCounterclockwise() {
- // TODO(dstockwell): implement rotation
- }
-
- /** @override */
- viewportChanged() {
- this.inkHost_.viewportChanged();
- }
-
- /** @override */
- save(requireResult) {
- return this.inkHost_.saveDocument();
- }
-
- /** @override */
- undo() {
- this.inkHost_.undo();
- }
-
- /** @override */
- redo() {
- this.inkHost_.redo();
- }
-
- /** @override */
- load(filename, data) {
- if (!this.inkHost_) {
- this.inkHost_ = document.createElement('viewer-ink-host');
- $('content').appendChild(this.inkHost_);
- this.inkHost_.viewport = this.viewport_;
- this.inkHost_.addEventListener('stroke-added', e => {
- this.viewer_.setHasUnsavedChanges();
- });
- this.inkHost_.addEventListener('undo-state-changed', e => {
- this.viewer_.setAnnotationUndoState(e.detail);
- });
- }
- return this.inkHost_.load(filename, data);
- }
-
- /** @override */
- unload() {
- this.inkHost_.remove();
- this.inkHost_ = null;
- }
-}
-
-class PluginController extends ContentController {
/**
- * @param {HTMLEmbedElement} plugin
- * @param {PDFViewer} viewer
- * @param {Viewport} viewport
- */
- constructor(plugin, viewer, viewport) {
- super();
- this.plugin_ = plugin;
- this.viewer_ = viewer;
- this.viewport_ = viewport;
-
- /** @private {!Map<string, PromiseResolver>} */
- this.pendingTokens_ = new Map();
- this.plugin_.addEventListener(
- 'message', e => this.handlePluginMessage_(e), false);
- }
-
- /**
- * Notify the plugin to stop reacting to scroll events while zoom is taking
- * place to avoid flickering.
- * @override
- */
- beforeZoom() {
- this.postMessage({type: 'stopScrolling'});
-
- if (this.viewport_.pinchPhase == Viewport.PinchPhase.PINCH_START) {
- const position = this.viewport_.position;
- const zoom = this.viewport_.getZoom();
- const pinchPhase = this.viewport_.pinchPhase;
- this.postMessage({
- type: 'viewport',
- userInitiated: true,
- zoom: zoom,
- xOffset: position.x,
- yOffset: position.y,
- pinchPhase: pinchPhase
- });
- }
- }
-
- /**
- * Notify the plugin of the zoom change and to continue reacting to scroll
- * events.
- * @override
- */
- afterZoom() {
- const position = this.viewport_.position;
- const zoom = this.viewport_.getZoom();
- const pinchVector = this.viewport_.pinchPanVector || {x: 0, y: 0};
- const pinchCenter = this.viewport_.pinchCenter || {x: 0, y: 0};
- const pinchPhase = this.viewport_.pinchPhase;
-
- this.postMessage({
- type: 'viewport',
- userInitiated: this.viewer_.isUserInitiatedEvent_,
- zoom: zoom,
- xOffset: position.x,
- yOffset: position.y,
- pinchPhase: pinchPhase,
- pinchX: pinchCenter.x,
- pinchY: pinchCenter.y,
- pinchVectorX: pinchVector.x,
- pinchVectorY: pinchVector.y
- });
- }
-
- // TODO(dstockwell): this method should be private, add controller APIs that
- // map to all of the existing usage. crbug.com/913279
- /**
- * Post a message to the PPAPI plugin. Some messages will cause an async reply
- * to be received through handlePluginMessage_().
- *
- * @param {Object} message Message to post.
+ * @param {!CustomEvent<{canUndo: boolean, canRedo: boolean}>} e
+ * @private
*/
- postMessage(message) {
- this.plugin_.postMessage(message);
- }
-
- /** @override */
- rotateClockwise() {
- this.postMessage({type: 'rotateClockwise'});
- }
-
- /** @override */
- rotateCounterclockwise() {
- this.postMessage({type: 'rotateCounterclockwise'});
- }
-
- /** @override */
- print() {
- this.postMessage({type: 'print'});
- }
-
- /** @override */
- save(requireResult) {
- const resolver = new PromiseResolver();
- const newToken = createToken();
- this.pendingTokens_.set(newToken, resolver);
- this.postMessage({type: 'save', token: newToken, force: requireResult});
- return resolver.promise;
+ setAnnotationUndoState_(e) {
+ this.toolbar_.canUndoAnnotation = e.detail.canUndo;
+ this.toolbar_.canRedoAnnotation = e.detail.canRedo;
}
- /** @override */
- async load(fileName, data) {
- const url = URL.createObjectURL(new Blob([data]));
- this.plugin_.removeAttribute('headers');
- this.plugin_.setAttribute('stream-url', url);
- this.plugin_.style.display = 'block';
- try {
- await this.viewer_.loaded;
- } finally {
- URL.revokeObjectURL(url);
- }
- }
-
- /** @override */
- unload() {
- this.plugin_.style.display = 'none';
- }
-
- /**
- * An event handler for handling message events received from the plugin.
- *
- * @param {MessageObject} message a message event.
- * @private
- */
- handlePluginMessage_(message) {
- switch (message.data.type.toString()) {
- case 'beep':
- this.viewer_.handleBeep();
- break;
- case 'documentDimensions':
- this.viewer_.setDocumentDimensions(message.data);
- break;
- case 'email':
- const href = 'mailto:' + message.data.to + '?cc=' + message.data.cc +
- '&bcc=' + message.data.bcc + '&subject=' + message.data.subject +
- '&body=' + message.data.body;
- window.location.href = href;
- break;
- case 'getPassword':
- this.viewer_.handlePasswordRequest();
- break;
- case 'getSelectedTextReply':
- this.viewer_.handleSelectedTextReply(message.data.selectedText);
- break;
- case 'goToPage':
- this.viewport_.goToPage(message.data.page);
- break;
- case 'loadProgress':
- this.viewer_.updateProgress(message.data.progress);
- break;
- case 'navigate':
- this.viewer_.handleNavigate(message.data.url, message.data.disposition);
- break;
- case 'printPreviewLoaded':
- this.viewer_.handlePrintPreviewLoaded();
- break;
- case 'setScrollPosition':
- this.viewport_.scrollTo(/** @type {!PartialPoint} */ (message.data));
- break;
- case 'scrollBy':
- this.viewport_.scrollBy(/** @type {!Point} */ (message.data));
- break;
- case 'metadata':
- this.viewer_.setDocumentMetadata(
- message.data.title, message.data.bookmarks,
- message.data.canSerializeDocument);
- break;
- case 'setIsSelecting':
- this.viewer_.setIsSelecting(message.data.isSelecting);
- break;
- case 'getNamedDestinationReply':
- this.viewer_.paramsParser_.onNamedDestinationReceived(
- message.data.pageNumber);
- break;
- case 'formFocusChange':
- this.viewer_.setIsFormFieldFocused(message.data.focused);
- break;
- case 'saveData':
- this.saveData_(message.data);
- break;
- case 'consumeSaveToken':
- const resolver = this.pendingTokens_.get(message.data.token);
- assert(this.pendingTokens_.delete(message.data.token));
- resolver.resolve(null);
- break;
+ /** @private */
+ resetTrackers_() {
+ this.viewport_.resetTracker();
+ if (this.tracker_) {
+ this.tracker_.removeAll();
}
}
+}
- /**
- * Handles the pdf file buffer received from the plugin.
- *
- * @param {SaveDataMessageData} messageData data of the message event.
- * @private
- */
- saveData_(messageData) {
- assert(
- loadTimeData.getBoolean('pdfFormSaveEnabled') ||
- loadTimeData.getBoolean('pdfAnnotationsEnabled'));
-
- // Verify a token that was created by this instance is included to avoid
- // being spammed.
- const resolver = this.pendingTokens_.get(messageData.token);
- assert(this.pendingTokens_.delete(messageData.token));
+/**
+ * The height of the toolbar along the top of the page. The document will be
+ * shifted down by this much in the viewport.
+ */
+PDFViewer.MATERIAL_TOOLBAR_HEIGHT = 56;
- if (!messageData.dataToSave) {
- resolver.reject();
- return;
- }
+/**
+ * Minimum height for the material toolbar to show (px). Should match the media
+ * query in index-material.css. If the window is smaller than this at load,
+ * leave no space for the toolbar.
+ */
+PDFViewer.TOOLBAR_WINDOW_MIN_HEIGHT = 250;
- // Verify the file size and the first bytes to make sure it's a PDF. Cap at
- // 100 MB. This cap should be kept in sync with and is also enforced in
- // pdf/out_of_process_instance.cc.
- const MIN_FILE_SIZE = '%PDF1.0'.length;
- const MAX_FILE_SIZE = 100 * 1000 * 1000;
+/**
+ * The background color used for print preview (--google-grey-refresh-300).
+ */
+PDFViewer.PRINT_PREVIEW_BACKGROUND_COLOR = '0xFFDADCE0';
- const buffer = messageData.dataToSave;
- const bufView = new Uint8Array(buffer);
- assert(
- bufView.length <= MAX_FILE_SIZE,
- `File too large to be saved: ${bufView.length} bytes.`);
- assert(bufView.length >= MIN_FILE_SIZE);
- assert(
- String.fromCharCode(bufView[0], bufView[1], bufView[2], bufView[3]) ==
- '%PDF');
+/**
+ * The background color used for print preview when dark mode is enabled
+ * (--google-grey-refresh-700).
+ */
+PDFViewer.PRINT_PREVIEW_DARK_BACKGROUND_COLOR = '0xFF5F6368';
- resolver.resolve(messageData);
- }
-}
+/**
+ * The background color used for the regular viewer.
+ */
+PDFViewer.BACKGROUND_COLOR = '0xFF525659';
diff --git a/chromium/chrome/browser/resources/pdf/toolbar_manager.js b/chromium/chrome/browser/resources/pdf/toolbar_manager.js
index 255bc3394f1..8a2b06c135c 100644
--- a/chromium/chrome/browser/resources/pdf/toolbar_manager.js
+++ b/chromium/chrome/browser/resources/pdf/toolbar_manager.js
@@ -20,10 +20,8 @@ const TOP_TOOLBAR_REVEAL_DISTANCE = 100;
const SIDE_TOOLBAR_REVEAL_DISTANCE_RIGHT = 150;
const SIDE_TOOLBAR_REVEAL_DISTANCE_BOTTOM = 250;
-
-
/**
- * @param {MouseEvent} e Event to test.
+ * @param {!MouseEvent} e Event to test.
* @return {boolean} True if the mouse is close to the top of the screen.
*/
function isMouseNearTopToolbar(e) {
@@ -31,7 +29,7 @@ function isMouseNearTopToolbar(e) {
}
/**
- * @param {MouseEvent} e Event to test.
+ * @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
@@ -47,47 +45,60 @@ function isMouseNearSideToolbar(e, window, reverse) {
return atSide && atBottom;
}
-/**
- * Constructs a Toolbar Manager, responsible for co-ordinating between multiple
- * toolbar elements.
- *
- * @param {Object} window The window containing the UI.
- * @param {Object} toolbar The top toolbar element.
- * @param {Object} zoomToolbar The zoom toolbar element.
- * @constructor
- */
-function ToolbarManager(window, toolbar, zoomToolbar) {
- this.window_ = window;
- this.toolbar_ = toolbar;
- this.zoomToolbar_ = zoomToolbar;
+/** Responsible for co-ordinating between multiple toolbar elements. */
+class ToolbarManager {
+ /**
+ * @param {!Window} window The window containing the UI.
+ * @param {?ViewerPdfToolbarElement} toolbar
+ * @param {!ViewerZoomToolbarElement} zoomToolbar
+ */
+ constructor(window, toolbar, zoomToolbar) {
+ /** @private {!Window} */
+ this.window_ = window;
- this.toolbarTimeout_ = null;
- this.isMouseNearTopToolbar_ = false;
- this.isMouseNearSideToolbar_ = false;
+ /** @private {?ViewerPdfToolbarElement} */
+ this.toolbar_ = toolbar;
- this.sideToolbarAllowedOnly_ = false;
- this.sideToolbarAllowedOnlyTimer_ = null;
+ /** @private {!ViewerZoomToolbarElement} */
+ this.zoomToolbar_ = zoomToolbar;
- this.keyboardNavigationActive = false;
+ /** @private {?number} */
+ this.toolbarTimeout_ = null;
- this.lastMovementTimestamp = null;
+ /** @private {boolean} */
+ this.isMouseNearTopToolbar_ = false;
- this.reverseSideToolbar_ = false;
+ /** @private {boolean} */
+ this.isMouseNearSideToolbar_ = false;
- this.window_.addEventListener('resize', this.resizeDropdowns_.bind(this));
- this.resizeDropdowns_();
+ /** @private {boolean} */
+ this.sideToolbarAllowedOnly_ = false;
- if (zoomToolbar.isPrintPreview()) {
- this.zoomToolbar_.addEventListener('keyboard-navigation-active', e => {
- this.keyboardNavigationActive = e.detail;
- });
- }
-}
+ /** @private {?number} */
+ this.sideToolbarAllowedOnlyTimer_ = null;
+
+ /** @private {boolean} */
+ this.keyboardNavigationActive = false;
+
+ /** @private {?number} */
+ this.lastMovementTimestamp = null;
-ToolbarManager.prototype = {
+ /** @private {boolean} */
+ this.reverseSideToolbar_ = false;
+
+ this.window_.addEventListener('resize', this.resizeDropdowns_.bind(this));
+ this.resizeDropdowns_();
+
+ if (zoomToolbar.isPrintPreview()) {
+ this.zoomToolbar_.addEventListener('keyboard-navigation-active', e => {
+ this.keyboardNavigationActive = e.detail;
+ });
+ }
+ }
- handleMouseMove: function(e) {
- this.isMouseNearTopToolbar_ = this.toolbar_ && isMouseNearTopToolbar(e);
+ /** @param {!MouseEvent} e */
+ handleMouseMove(e) {
+ this.isMouseNearTopToolbar_ = !!this.toolbar_ && isMouseNearTopToolbar(e);
this.isMouseNearSideToolbar_ =
isMouseNearSideToolbar(e, this.window_, this.reverseSideToolbar_);
@@ -123,17 +134,16 @@ ToolbarManager.prototype = {
}
}
this.hideToolbarsAfterTimeout();
- },
+ }
/**
* Whether a mousemove event is high enough velocity to reveal the toolbars.
- *
- * @param {MouseEvent} e Event to test.
+ * @param {!MouseEvent} e Event to test.
* @return {boolean} true if the event is a high velocity mousemove, false
* otherwise.
* @private
*/
- isHighVelocityMouseMove_: function(e) {
+ isHighVelocityMouseMove_(e) {
if (e.type == 'mousemove') {
if (this.lastMovementTimestamp == null) {
this.lastMovementTimestamp = this.getCurrentTimestamp_();
@@ -150,54 +160,51 @@ ToolbarManager.prototype = {
}
}
return false;
- },
+ }
/**
* Wrapper around Date.now() to make it easily replaceable for testing.
- *
* @return {number}
* @private
*/
- getCurrentTimestamp_: function() {
+ getCurrentTimestamp_() {
return Date.now();
- },
+ }
- /**
- * Display both UI toolbars.
- */
- showToolbars: function() {
+ /** Display both UI toolbars. */
+ showToolbars() {
if (this.toolbar_) {
this.toolbar_.show();
}
this.zoomToolbar_.show();
- },
+ }
/**
* Show toolbars and mark that navigation is being performed with
* tab/shift-tab. This disables toolbar hiding until the mouse is moved or
* escape is pressed.
*/
- showToolbarsForKeyboardNavigation: function() {
+ showToolbarsForKeyboardNavigation() {
this.keyboardNavigationActive = true;
this.showToolbars();
- },
+ }
/**
* Hide toolbars after a delay, regardless of the position of the mouse.
* Intended to be called when the mouse has moved out of the parent window.
*/
- hideToolbarsForMouseOut: function() {
+ hideToolbarsForMouseOut() {
this.isMouseNearTopToolbar_ = false;
this.isMouseNearSideToolbar_ = false;
this.hideToolbarsAfterTimeout();
- },
+ }
/**
* Check if the toolbars are able to be closed, and close them if they are.
* Toolbars may be kept open based on mouse/keyboard activity and active
* elements.
*/
- hideToolbarsIfAllowed: function() {
+ hideToolbarsIfAllowed() {
if (this.isMouseNearSideToolbar_ || this.isMouseNearTopToolbar_) {
return;
}
@@ -221,47 +228,44 @@ ToolbarManager.prototype = {
this.toolbar_.hide();
}
this.zoomToolbar_.hide();
- },
+ }
- /**
- * Hide the toolbar after the HIDE_TIMEOUT has elapsed.
- */
- hideToolbarsAfterTimeout: function() {
+ /** Hide the toolbars after the HIDE_TIMEOUT has elapsed. */
+ hideToolbarsAfterTimeout() {
if (this.toolbarTimeout_) {
this.window_.clearTimeout(this.toolbarTimeout_);
}
this.toolbarTimeout_ = this.window_.setTimeout(
this.hideToolbarsIfAllowed.bind(this), HIDE_TIMEOUT);
- },
+ }
/**
* Hide the 'topmost' layer of toolbars. Hides any dropdowns that are open, or
* hides the basic toolbars otherwise.
*/
- hideSingleToolbarLayer: function() {
+ hideSingleToolbarLayer() {
if (!this.toolbar_ || !this.toolbar_.hideDropdowns()) {
this.keyboardNavigationActive = false;
this.hideToolbarsIfAllowed();
}
- },
+ }
/**
* Clears the keyboard navigation state and hides the toolbars after a delay.
*/
- resetKeyboardNavigationAndHideToolbars: function() {
+ resetKeyboardNavigationAndHideToolbars() {
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.
- *
* The top toolbar can be immediately re-opened by moving the mouse to the top
* of the screen.
*/
- forceHideTopToolbar: function() {
+ forceHideTopToolbar() {
if (!this.toolbar_) {
return;
}
@@ -270,20 +274,19 @@ ToolbarManager.prototype = {
this.sideToolbarAllowedOnlyTimer_ = this.window_.setTimeout(() => {
this.sideToolbarAllowedOnlyTimer_ = null;
}, FORCE_HIDE_TIMEOUT);
- },
+ }
/** Reverse the position of the side toolbar. */
- reverseSideToolbar: function() {
+ reverseSideToolbar() {
this.reverseSideToolbar_ = true;
- },
+ }
/**
* Updates the size of toolbar dropdowns based on the positions of the rest of
* the UI.
- *
* @private
*/
- resizeDropdowns_: function() {
+ resizeDropdowns_() {
if (!this.toolbar_) {
return;
}
@@ -291,4 +294,4 @@ ToolbarManager.prototype = {
this.window_.innerHeight - this.zoomToolbar_.clientHeight;
this.toolbar_.setDropdownLowerBound(lowerBound);
}
-};
+}
diff --git a/chromium/chrome/browser/resources/pdf/viewport.js b/chromium/chrome/browser/resources/pdf/viewport.js
index 480664c014c..17986ae5d81 100644
--- a/chromium/chrome/browser/resources/pdf/viewport.js
+++ b/chromium/chrome/browser/resources/pdf/viewport.js
@@ -6,14 +6,21 @@
* @typedef {{
* width: number,
* height: number,
+ * layoutOptions: (!LayoutOptions|undefined),
* pageDimensions: Array<ViewportRect>,
* }}
*/
let DocumentDimensions;
+/** @typedef {{defaultPageOrientation: number}} */
+let LayoutOptions;
+
/** @typedef {{x: number, y: number}} */
let Point;
+/** @typedef {{x: (number|undefined), y: (number|undefined)}} */
+let PartialPoint;
+
/** @typedef {{width: number, height: number}} */
let Size;
@@ -279,6 +286,15 @@ class Viewport {
}
/**
+ * @return {!LayoutOptions|undefined} A dictionary carrying layout options
+ * from the plugin.
+ */
+ getLayoutOptions() {
+ return this.documentDimensions_ ? this.documentDimensions_.layoutOptions :
+ undefined;
+ }
+
+ /**
* @return {!ViewportRect} ViewportRect for the viewport given current zoom.
* @private
*/
@@ -605,7 +621,7 @@ class Viewport {
const bottom =
this.pageDimensions_[page].y + this.pageDimensions_[page].height;
- if (top <= y && bottom > y) {
+ if (top <= y && y <= bottom) {
return page;
}
@@ -1166,7 +1182,9 @@ class Viewport {
this.fittingType_ == FittingType.FIT_TO_HEIGHT);
}
- /** @param {!Point} point The position to which to scroll the viewport. */
+ /**
+ * @param {!PartialPoint} point The position to which to scroll the viewport.
+ */
scrollTo(point) {
let changed = false;
const newPosition = this.position;
diff --git a/chromium/chrome/browser/resources/pdf/viewport_scroller.js b/chromium/chrome/browser/resources/pdf/viewport_scroller.js
index bb8c187d478..ca16c9cf7d2 100644
--- a/chromium/chrome/browser/resources/pdf/viewport_scroller.js
+++ b/chromium/chrome/browser/resources/pdf/viewport_scroller.js
@@ -5,75 +5,61 @@
'use strict';
/**
- * The period of time in milliseconds to wait between updating the viewport
- * position by the scroll velocity.
- *
- * @private
- */
-ViewportScroller.DRAG_TIMER_INTERVAL_MS_ = 100;
-
-/**
- * The maximum drag scroll distance per DRAG_TIMER_INTERVAL in pixels.
- *
- * @private
- */
-ViewportScroller.MAX_DRAG_SCROLL_DISTANCE_ = 100;
-
-/**
* Creates a new ViewportScroller.
* A ViewportScroller scrolls the page in response to drag selection with the
* mouse.
*
- * @param {Object} viewport The viewport info of the page.
- * @param {Object} plugin The PDF plugin element.
- * @param {Object} window The window containing the viewer.
- * @constructor
*/
-function ViewportScroller(viewport, plugin, window) {
- this.viewport_ = viewport;
- this.plugin_ = plugin;
- this.window_ = window;
- this.mousemoveCallback_ = null;
- this.timerId_ = null;
- this.scrollVelocity_ = null;
- this.lastFrameTime_ = 0;
-}
+class ViewportScroller {
+ /**
+ * @param {Object} viewport The viewport info of the page.
+ * @param {Object} plugin The PDF plugin element.
+ * @param {Object} window The window containing the viewer.
+ */
+ constructor(viewport, plugin, window) {
+ this.viewport_ = viewport;
+ this.plugin_ = plugin;
+ this.window_ = window;
+ this.mousemoveCallback_ = null;
+ this.timerId_ = null;
+ this.scrollVelocity_ = null;
+ this.lastFrameTime_ = 0;
+ }
-ViewportScroller.prototype = {
/**
* Start scrolling the page by |scrollVelocity_| every
* |DRAG_TIMER_INTERVAL_MS_|.
*
* @private
*/
- startDragScrollTimer_: function() {
+ startDragScrollTimer_() {
if (this.timerId_ === null) {
this.timerId_ = this.window_.setInterval(
this.dragScrollPage_.bind(this),
ViewportScroller.DRAG_TIMER_INTERVAL_MS_);
this.lastFrameTime_ = Date.now();
}
- },
+ }
/**
* Stops the drag scroll timer if it is active.
*
* @private
*/
- stopDragScrollTimer_: function() {
+ stopDragScrollTimer_() {
if (this.timerId_ !== null) {
this.window_.clearInterval(this.timerId_);
this.timerId_ = null;
this.lastFrameTime_ = 0;
}
- },
+ }
/**
* Scrolls the viewport by the current scroll velocity.
*
* @private
*/
- dragScrollPage_: function() {
+ dragScrollPage_() {
const position = this.viewport_.position;
const currentFrameTime = Date.now();
const timeAdjustment = (currentFrameTime - this.lastFrameTime_) /
@@ -82,7 +68,7 @@ ViewportScroller.prototype = {
position.x += (this.scrollVelocity_.x * timeAdjustment);
this.viewport_.position = position;
this.lastFrameTime_ = currentFrameTime;
- },
+ }
/**
* Calculate the velocity to scroll while dragging using the distance of the
@@ -92,7 +78,7 @@ ViewportScroller.prototype = {
* @return {Object} Object with x and y direction scroll velocity.
* @private
*/
- calculateVelocity_: function(event) {
+ calculateVelocity_(event) {
const x =
Math.min(
Math.max(
@@ -106,7 +92,7 @@ ViewportScroller.prototype = {
ViewportScroller.MAX_DRAG_SCROLL_DISTANCE_) *
Math.sign(event.offsetY);
return {x: x, y: y};
- },
+ }
/**
* Handles mousemove events. It updates the scroll velocity and starts and
@@ -115,14 +101,14 @@ ViewportScroller.prototype = {
* @param {Object} event The mousemove event.
* @private
*/
- onMousemove_: function(event) {
+ onMousemove_(event) {
this.scrollVelocity_ = this.calculateVelocity_(event);
if (!this.scrollVelocity_.x && !this.scrollVelocity_.y) {
this.stopDragScrollTimer_();
} else if (!this.timerId_) {
this.startDragScrollTimer_();
}
- },
+ }
/**
* Sets whether to scroll the viewport when the mouse is outside the
@@ -130,7 +116,7 @@ ViewportScroller.prototype = {
*
* @param {boolean} isSelecting Represents selection status.
*/
- setEnableScrolling: function(isSelecting) {
+ setEnableScrolling(isSelecting) {
if (isSelecting) {
if (!this.mousemoveCallback_) {
this.mousemoveCallback_ = this.onMousemove_.bind(this);
@@ -145,4 +131,19 @@ ViewportScroller.prototype = {
}
}
}
-};
+}
+
+/**
+ * The period of time in milliseconds to wait between updating the viewport
+ * position by the scroll velocity.
+ *
+ * @private
+ */
+ViewportScroller.DRAG_TIMER_INTERVAL_MS_ = 100;
+
+/**
+ * The maximum drag scroll distance per DRAG_TIMER_INTERVAL in pixels.
+ *
+ * @private
+ */
+ViewportScroller.MAX_DRAG_SCROLL_DISTANCE_ = 100;
diff --git a/chromium/chrome/browser/resources/print_preview/BUILD.gn b/chromium/chrome/browser/resources/print_preview/BUILD.gn
index fe72fb197fb..0bb1822b6fe 100644
--- a/chromium/chrome/browser/resources/print_preview/BUILD.gn
+++ b/chromium/chrome/browser/resources/print_preview/BUILD.gn
@@ -77,9 +77,9 @@ js_type_check("print_preview_resources") {
js_library("print_preview_utils") {
deps = [
":dark_mode_behavior",
+ "//third_party/polymer/v1_0/components-chromium/iron-iconset-svg:iron-iconset-svg-extracted",
"//ui/webui/resources/js:util",
]
- externs_list = [ "$externs_path/pending.js" ]
}
js_library("metrics") {
@@ -127,6 +127,7 @@ js_library("cloud_print_interface_native") {
js_library("native_layer") {
deps = [
"data:destination",
+ "data:destination_match",
"data:measurement_system",
"//ui/webui/resources/js:cr",
]
diff --git a/chromium/chrome/browser/resources/print_preview/data/BUILD.gn b/chromium/chrome/browser/resources/print_preview/data/BUILD.gn
index 5ab503b223e..7f04cc61c7b 100644
--- a/chromium/chrome/browser/resources/print_preview/data/BUILD.gn
+++ b/chromium/chrome/browser/resources/print_preview/data/BUILD.gn
@@ -19,6 +19,7 @@ js_type_check("closure_compile") {
":measurement_system",
":model",
":printable_area",
+ ":scaling",
":size",
":state",
]
@@ -50,6 +51,7 @@ js_library("invitation_store") {
js_library("local_parsers") {
deps = [
":destination",
+ ":destination_match",
"..:native_layer",
"//ui/webui/resources/js:cr",
]
@@ -58,7 +60,6 @@ js_library("local_parsers") {
js_library("destination_match") {
deps = [
":destination",
- "..:native_layer",
"//ui/webui/resources/js:cr",
]
}
@@ -111,8 +112,10 @@ js_library("measurement_system") {
js_library("model") {
deps = [
":destination",
+ ":destination_match",
":document_info",
":margins",
+ ":scaling",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:promise_resolver",
]
@@ -126,6 +129,12 @@ js_library("printable_area") {
]
}
+js_library("scaling") {
+ deps = [
+ "//ui/webui/resources/js:cr",
+ ]
+}
+
js_library("size") {
deps = [
"//ui/webui/resources/js:cr",
diff --git a/chromium/chrome/browser/resources/print_preview/data/destination.js b/chromium/chrome/browser/resources/print_preview/data/destination.js
index 403becbf6d1..761891d5c01 100644
--- a/chromium/chrome/browser/resources/print_preview/data/destination.js
+++ b/chromium/chrome/browser/resources/print_preview/data/destination.js
@@ -95,6 +95,17 @@ cr.define('print_preview', function() {
let VendorCapabilitySelectOption;
/**
+ * Same as cloud_devices::printer::TypedValueVendorCapability::ValueType.
+ * @enum {string}
+ */
+ const VendorCapabilityValueType = {
+ BOOLEAN: 'BOOLEAN',
+ FLOAT: 'FLOAT',
+ INTEGER: 'INTEGER',
+ STRING: 'STRING',
+ };
+
+ /**
* Specifies a custom vendor capability.
* @typedef {{
* id: (string),
@@ -106,6 +117,7 @@ cr.define('print_preview', function() {
* }|undefined),
* typed_value_cap: ({
* default: (number | string | boolean | undefined),
+ * value_type: (print_preview.VendorCapabilityValueType | undefined),
* }|undefined),
* range_cap: ({
* default: (number),
@@ -219,14 +231,31 @@ cr.define('print_preview', function() {
};
/**
+ * Enumeration of background graphics printing mode restrictions used by
+ * Chromium.
+ * This has to coincide with |printing::BackgroundGraphicsModeRestriction| as
+ * defined in printing/backend/printing_restrictions.h
+ * @enum {number}
+ */
+ const BackgroundGraphicsModeRestriction = {
+ UNSET: 0,
+ ENABLED: 1,
+ DISABLED: 2,
+ };
+
+ /**
* Policies affecting a destination.
* @typedef {{
* allowedColorModes: ?print_preview.ColorModeRestriction,
* allowedDuplexModes: ?print_preview.DuplexModeRestriction,
* allowedPinMode: ?print_preview.PinModeRestriction,
+ * allowedBackgroundGraphicsMode:
+ * ?print_preview.BackgroundGraphicsModeRestriction,
* defaultColorMode: ?print_preview.ColorModeRestriction,
* defaultDuplexMode: ?print_preview.DuplexModeRestriction,
* defaultPinMode: ?print_preview.PinModeRestriction,
+ * defaultBackgroundGraphicsMode:
+ * ?print_preview.BackgroundGraphicsModeRestriction,
* }}
*/
let Policies;
@@ -821,6 +850,16 @@ cr.define('print_preview', function() {
this.policies.allowedPinModes :
null;
}
+
+ /**
+ * @return {?print_preview.BackgroundGraphicsModeRestriction} Background
+ * graphics mode allowed by policy.
+ */
+ get backgroundGraphicsPolicy() {
+ return this.policies && this.policies.allowedBackgroundGraphicsModes ?
+ this.policies.allowedBackgroundGraphicsModes :
+ null;
+ }
// </if>
/**
@@ -867,6 +906,14 @@ cr.define('print_preview', function() {
get defaultPinPolicy() {
return this.policies && this.policies.defaultPinMode;
}
+
+ /**
+ * @return {?print_preview.BackgroundGraphicsModeRestriction} Value of
+ * default background graphics setting given by policy.
+ */
+ get defaultBackgroundGraphicsPolicy() {
+ return this.policies && this.policies.defaultBackgroundGraphicsMode;
+ }
// </if>
/**
@@ -966,9 +1013,11 @@ cr.define('print_preview', function() {
makeRecentDestination: makeRecentDestination,
RecentDestination: RecentDestination,
VendorCapabilitySelectOption: VendorCapabilitySelectOption,
+ VendorCapabilityValueType: VendorCapabilityValueType,
VendorCapability: VendorCapability,
// <if expr="chromeos">
+ BackgroundGraphicsModeRestriction: BackgroundGraphicsModeRestriction,
ColorModeRestriction: ColorModeRestriction,
DuplexModeRestriction: DuplexModeRestriction,
PinModeRestriction: PinModeRestriction,
diff --git a/chromium/chrome/browser/resources/print_preview/data/destination_match.html b/chromium/chrome/browser/resources/print_preview/data/destination_match.html
index 35c9a62fc62..288ce95f4ce 100644
--- a/chromium/chrome/browser/resources/print_preview/data/destination_match.html
+++ b/chromium/chrome/browser/resources/print_preview/data/destination_match.html
@@ -1,5 +1,4 @@
<link rel="import" href="chrome://resources/html/cr.html">
-<link rel="import" href="../native_layer.html">
<link rel="import" href="destination.html">
<script src="destination_match.js"></script>
diff --git a/chromium/chrome/browser/resources/print_preview/data/destination_match.js b/chromium/chrome/browser/resources/print_preview/data/destination_match.js
index 9e3e9307f93..c147e002611 100644
--- a/chromium/chrome/browser/resources/print_preview/data/destination_match.js
+++ b/chromium/chrome/browser/resources/print_preview/data/destination_match.js
@@ -5,6 +5,19 @@
cr.define('print_preview', function() {
'use strict';
/**
+ * Printer types for capabilities and printer list requests.
+ * Must match PrinterType in printing/print_job_constants.h
+ * @enum {number}
+ */
+ const PrinterType = {
+ PRIVET_PRINTER: 0,
+ EXTENSION_PRINTER: 1,
+ PDF_PRINTER: 2,
+ LOCAL_PRINTER: 3,
+ CLOUD_PRINTER: 4
+ };
+
+ /**
* Converts DestinationOrigin to PrinterType.
* @param {!print_preview.DestinationOrigin} origin The printer's
* destination origin.
@@ -25,6 +38,19 @@ cr.define('print_preview', function() {
return print_preview.PrinterType.CLOUD_PRINTER;
};
+ /**
+ * @param {!print_preview.Destination} destination The destination to figure
+ * out the printer type of.
+ * @return {!print_preview.PrinterType} Map the destination to a PrinterType.
+ */
+ function getPrinterTypeForDestination(destination) {
+ if (destination.id ==
+ print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) {
+ return print_preview.PrinterType.PDF_PRINTER;
+ }
+ return print_preview.originToType(destination.origin);
+ }
+
class DestinationMatch {
/**
* A set of key parameters describing a destination used to determine
@@ -116,5 +142,10 @@ cr.define('print_preview', function() {
}
// Export
- return {originToType: originToType, DestinationMatch: DestinationMatch};
+ return {
+ DestinationMatch: DestinationMatch,
+ PrinterType: PrinterType,
+ getPrinterTypeForDestination: getPrinterTypeForDestination,
+ originToType: originToType,
+ };
});
diff --git a/chromium/chrome/browser/resources/print_preview/data/document_info.js b/chromium/chrome/browser/resources/print_preview/data/document_info.js
index 67ce1c952af..d85124d3a13 100644
--- a/chromium/chrome/browser/resources/print_preview/data/document_info.js
+++ b/chromium/chrome/browser/resources/print_preview/data/document_info.js
@@ -9,6 +9,7 @@ cr.exportPath('print_preview');
* hasCssMediaStyles: boolean,
* hasSelection: boolean,
* isModifiable: boolean,
+ * isPdf: boolean,
* isScalingDisabled: boolean,
* fitToPageScaling: number,
* pageCount: number,
@@ -48,6 +49,7 @@ Polymer({
hasCssMediaStyles: false,
hasSelection: false,
isModifiable: true,
+ isPdf: false,
isScalingDisabled: false,
fitToPageScaling: 100,
pageCount: 0,
@@ -113,13 +115,16 @@ Polymer({
/**
* Initializes the state of the data model.
* @param {boolean} isModifiable Whether the document is modifiable.
+ * @param {boolean} isPdf Whether the document is PDF.
* @param {string} title Title of the document.
* @param {boolean} hasSelection Whether the document has user-selected
* content.
*/
- init: function(isModifiable, title, hasSelection) {
+ init: function(isModifiable, isPdf, title, hasSelection) {
this.isInitialized_ = true;
this.set('documentSettings.isModifiable', isModifiable);
+ // TODO(crbug.com/702995): Remove once Flash is deprecated.
+ this.set('documentSettings.isPdf', isPdf);
this.set('documentSettings.title', title);
this.set('documentSettings.hasSelection', hasSelection);
},
@@ -154,7 +159,7 @@ Polymer({
Math.round(pageLayout.marginTop), Math.round(pageLayout.marginRight),
Math.round(pageLayout.marginBottom), Math.round(pageLayout.marginLeft));
- const o = print_preview.ticket_items.CustomMarginsOrientation;
+ const o = print_preview.CustomMarginsOrientation;
const pageSize = new print_preview.Size(
pageLayout.contentWidth + margins.get(o.LEFT) + margins.get(o.RIGHT),
pageLayout.contentHeight + margins.get(o.TOP) + margins.get(o.BOTTOM));
diff --git a/chromium/chrome/browser/resources/print_preview/data/local_parsers.html b/chromium/chrome/browser/resources/print_preview/data/local_parsers.html
index b6fe90e29d7..fed4e851ed9 100644
--- a/chromium/chrome/browser/resources/print_preview/data/local_parsers.html
+++ b/chromium/chrome/browser/resources/print_preview/data/local_parsers.html
@@ -1,5 +1,6 @@
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="../native_layer.html">
<link rel="import" href="destination.html">
+<link rel="import" href="destination_match.html">
<script src="local_parsers.js"></script>
diff --git a/chromium/chrome/browser/resources/print_preview/data/margins.js b/chromium/chrome/browser/resources/print_preview/data/margins.js
index 3facd5a82cd..ce38eb65947 100644
--- a/chromium/chrome/browser/resources/print_preview/data/margins.js
+++ b/chromium/chrome/browser/resources/print_preview/data/margins.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('print_preview.ticket_items', function() {
+cr.define('print_preview', function() {
'use strict';
/**
@@ -21,7 +21,7 @@ cr.define('print_preview.ticket_items', function() {
* printing/print_job_constants.h.
* @enum {number}
*/
- const MarginsTypeValue = {
+ const MarginsType = {
DEFAULT: 0,
NO_MARGINS: 1,
MINIMUM: 2,
@@ -30,7 +30,7 @@ cr.define('print_preview.ticket_items', function() {
return {
CustomMarginsOrientation: CustomMarginsOrientation,
- MarginsTypeValue: MarginsTypeValue,
+ MarginsType: MarginsType,
};
});
@@ -61,18 +61,14 @@ cr.define('print_preview', function() {
/**
* Backing store for the margin values in points.
* @type {!Object<
- * !print_preview.ticket_items.CustomMarginsOrientation, number>}
+ * !print_preview.CustomMarginsOrientation, number>}
* @private
*/
this.value_ = {};
- this.value_[print_preview.ticket_items.CustomMarginsOrientation.TOP] =
- top;
- this.value_[print_preview.ticket_items.CustomMarginsOrientation.RIGHT] =
- right;
- this.value_[print_preview.ticket_items.CustomMarginsOrientation.BOTTOM] =
- bottom;
- this.value_[print_preview.ticket_items.CustomMarginsOrientation.LEFT] =
- left;
+ this.value_[print_preview.CustomMarginsOrientation.TOP] = top;
+ this.value_[print_preview.CustomMarginsOrientation.RIGHT] = right;
+ this.value_[print_preview.CustomMarginsOrientation.BOTTOM] = bottom;
+ this.value_[print_preview.CustomMarginsOrientation.LEFT] = left;
}
/**
@@ -83,15 +79,14 @@ cr.define('print_preview', function() {
*/
static parse(state) {
return new print_preview.Margins(
- state[print_preview.ticket_items.CustomMarginsOrientation.TOP] || 0,
- state[print_preview.ticket_items.CustomMarginsOrientation.RIGHT] || 0,
- state[print_preview.ticket_items.CustomMarginsOrientation.BOTTOM] ||
- 0,
- state[print_preview.ticket_items.CustomMarginsOrientation.LEFT] || 0);
+ state[print_preview.CustomMarginsOrientation.TOP] || 0,
+ state[print_preview.CustomMarginsOrientation.RIGHT] || 0,
+ state[print_preview.CustomMarginsOrientation.BOTTOM] || 0,
+ state[print_preview.CustomMarginsOrientation.LEFT] || 0);
}
/**
- * @param {!print_preview.ticket_items.CustomMarginsOrientation}
+ * @param {!print_preview.CustomMarginsOrientation}
* orientation Specifies the margin value to get.
* @return {number} Value of the margin of the given orientation.
*/
@@ -100,7 +95,7 @@ cr.define('print_preview', function() {
}
/**
- * @param {!print_preview.ticket_items.CustomMarginsOrientation}
+ * @param {!print_preview.CustomMarginsOrientation}
* orientation Specifies the margin to set.
* @param {number} value Updated value of the margin in points to modify.
* @return {!print_preview.Margins} A new copy of |this| with the
@@ -110,10 +105,10 @@ cr.define('print_preview', function() {
const newValue = this.clone_();
newValue[orientation] = value;
return new Margins(
- newValue[print_preview.ticket_items.CustomMarginsOrientation.TOP],
- newValue[print_preview.ticket_items.CustomMarginsOrientation.RIGHT],
- newValue[print_preview.ticket_items.CustomMarginsOrientation.BOTTOM],
- newValue[print_preview.ticket_items.CustomMarginsOrientation.LEFT]);
+ newValue[print_preview.CustomMarginsOrientation.TOP],
+ newValue[print_preview.CustomMarginsOrientation.RIGHT],
+ newValue[print_preview.CustomMarginsOrientation.BOTTOM],
+ newValue[print_preview.CustomMarginsOrientation.LEFT]);
}
/**
diff --git a/chromium/chrome/browser/resources/print_preview/data/model.html b/chromium/chrome/browser/resources/print_preview/data/model.html
index c29628bb3fa..1fb0c92a112 100644
--- a/chromium/chrome/browser/resources/print_preview/data/model.html
+++ b/chromium/chrome/browser/resources/print_preview/data/model.html
@@ -3,7 +3,9 @@
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/promise_resolver.html">
<link rel="import" href="destination.html">
+<link rel="import" href="destination_match.html">
<link rel="import" href="document_info.html">
<link rel="import" href="margins.html">
+<link rel="import" href="scaling.html">
<script src="model.js"></script>
diff --git a/chromium/chrome/browser/resources/print_preview/data/model.js b/chromium/chrome/browser/resources/print_preview/data/model.js
index 4e5182375ae..bcdc1711aa4 100644
--- a/chromium/chrome/browser/resources/print_preview/data/model.js
+++ b/chromium/chrome/browser/resources/print_preview/data/model.js
@@ -30,8 +30,9 @@ cr.define('print_preview', function() {
* mediaSize: !print_preview.Setting,
* margins: !print_preview.Setting,
* dpi: !print_preview.Setting,
- * fitToPage: !print_preview.Setting,
* scaling: !print_preview.Setting,
+ * scalingType: !print_preview.Setting,
+ * scalingTypePdf: !print_preview.Setting,
* duplex: !print_preview.Setting,
* duplexShortEdge: !print_preview.Setting,
* cssBackground: !print_preview.Setting,
@@ -60,16 +61,17 @@ cr.define('print_preview', function() {
* width_microns: number,
* custom_display_name: (string | undefined),
* is_default: (boolean | undefined)} | undefined),
- * marginsType: (print_preview.ticket_items.MarginsTypeValue | undefined),
+ * marginsType: (print_preview.MarginsType | undefined),
* customMargins: (print_preview.MarginsSetting | undefined),
* isColorEnabled: (boolean | undefined),
* isDuplexEnabled: (boolean | undefined),
* isHeaderFooterEnabled: (boolean | undefined),
* isLandscapeEnabled: (boolean | undefined),
* isCollateEnabled: (boolean | undefined),
- * isFitToPageEnabled: (boolean | undefined),
* isCssBackgroundEnabled: (boolean | undefined),
* scaling: (string | undefined),
+ * scalingType: (print_preview.ScalingType | undefined),
+ * scalingTypePdf: (print_preview.ScalingType | undefined),
* vendor_options: (Object | undefined),
* isPinEnabled: (boolean | undefined),
* pinValue: (string | undefined)
@@ -147,8 +149,7 @@ cr.define('print_preview.Model', () => {
'use strict';
/**
- * Sticky setting names. Alphabetical except for fitToPage, which must be set
- * after scaling in updateFromStickySettings().
+ * Sticky setting names in alphabetical order.
* @type {!Array<string>}
*/
const STICKY_SETTING_NAMES = [
@@ -164,9 +165,9 @@ const STICKY_SETTING_NAMES = [
'layout',
'margins',
'mediaSize',
- 'customScaling',
'scaling',
- 'fitToPage',
+ 'scalingType',
+ 'scalingTypePdf',
'vendorItems',
];
// <if expr="chromeos">
@@ -188,9 +189,9 @@ Polymer({
/**
* Object containing current settings of Print Preview, for use by Polymer
* controls.
- * Initialize settings that are only available on some printers to
- * unavailable, and settings that are provided by PDF generation to
- * available.
+ * Initialize all settings to available so that more settings always stays
+ * in a collapsed state during startup, when document information and
+ * printer capabilities may arrive at slightly different times.
* @type {!print_preview.Settings}
*/
settings: {
@@ -242,7 +243,7 @@ Polymer({
value: true, /* color */
unavailableValue: false,
valid: true,
- available: false,
+ available: true,
setByPolicy: false,
setFromUi: false,
key: 'isColorEnabled',
@@ -255,16 +256,15 @@ Polymer({
height_microns: 279400,
},
valid: true,
- available: false,
+ available: true,
setByPolicy: false,
setFromUi: false,
key: 'mediaSize',
updatesPreview: true,
},
margins: {
- value: print_preview.ticket_items.MarginsTypeValue.DEFAULT,
- unavailableValue:
- print_preview.ticket_items.MarginsTypeValue.DEFAULT,
+ value: print_preview.MarginsType.DEFAULT,
+ unavailableValue: print_preview.MarginsType.DEFAULT,
valid: true,
available: true,
setByPolicy: false,
@@ -286,47 +286,47 @@ Polymer({
value: {},
unavailableValue: {},
valid: true,
- available: false,
+ available: true,
setByPolicy: false,
setFromUi: false,
key: 'dpi',
updatesPreview: false,
},
- fitToPage: {
- value: false,
- unavailableValue: false,
+ scaling: {
+ value: '100',
+ unavailableValue: '100',
valid: true,
available: true,
setByPolicy: false,
setFromUi: false,
- key: 'isFitToPageEnabled',
+ key: 'scaling',
updatesPreview: true,
},
- scaling: {
- value: '100',
- unavailableValue: '100',
+ scalingType: {
+ value: print_preview.ScalingType.DEFAULT,
+ unavailableValue: print_preview.ScalingType.DEFAULT,
valid: true,
available: true,
setByPolicy: false,
setFromUi: false,
- key: 'scaling',
+ key: 'scalingType',
updatesPreview: true,
},
- customScaling: {
- value: false,
- unavailableValue: false,
+ scalingTypePdf: {
+ value: print_preview.ScalingType.DEFAULT,
+ unavailableValue: print_preview.ScalingType.DEFAULT,
valid: true,
available: true,
setByPolicy: false,
setFromUi: false,
- key: 'customScaling',
+ key: 'scalingTypePdf',
updatesPreview: true,
},
duplex: {
value: true,
unavailableValue: false,
valid: true,
- available: false,
+ available: true,
setByPolicy: false,
setFromUi: false,
key: 'isDuplexEnabled',
@@ -386,7 +386,7 @@ Polymer({
value: {},
unavailableValue: {},
valid: true,
- available: false,
+ available: true,
setByPolicy: false,
setFromUi: false,
key: 'vendorOptions',
@@ -441,7 +441,7 @@ Polymer({
value: false,
unavailableValue: false,
valid: true,
- available: false,
+ available: true,
setByPolicy: false,
setFromUi: false,
key: 'isPinEnabled',
@@ -451,7 +451,7 @@ Polymer({
value: '',
unavailableValue: '',
valid: true,
- available: false,
+ available: true,
setByPolicy: false,
setFromUi: false,
key: 'pinValue',
@@ -484,8 +484,8 @@ Polymer({
observers: [
'updateSettingsFromDestination_(destination.capabilities)',
'updateSettingsAvailabilityFromDocumentSettings_(' +
- 'documentSettings.isModifiable, documentSettings.hasCssMediaStyles,' +
- 'documentSettings.hasSelection)',
+ 'documentSettings.isModifiable, documentSettings.isPdf,' +
+ 'documentSettings.hasCssMediaStyles, documentSettings.hasSelection)',
'updateHeaderFooterAvailable_(' +
'margins, settings.margins.value, ' +
'settings.customMargins.value, settings.mediaSize.value)',
@@ -706,11 +706,15 @@ Polymer({
const knownSizeToSaveAsPdf = isSaveAsPDF &&
(!this.documentSettings.isModifiable ||
this.documentSettings.hasCssMediaStyles);
- this.setSettingPath_('fitToPage.unavailableValue', !isSaveAsPDF);
+ const scalingAvailable = !knownSizeToSaveAsPdf &&
+ (this.documentSettings.isModifiable || this.documentSettings.isPdf);
+ this.setSettingPath_('scaling.available', scalingAvailable);
this.setSettingPath_(
- 'fitToPage.available',
- !knownSizeToSaveAsPdf && !this.documentSettings.isModifiable);
- this.setSettingPath_('scaling.available', !knownSizeToSaveAsPdf);
+ 'scalingType.available',
+ scalingAvailable && !this.documentSettings.isPdf);
+ this.setSettingPath_(
+ 'scalingTypePdf.available',
+ scalingAvailable && this.documentSettings.isPdf);
const caps = this.destination && this.destination.capabilities ?
this.destination.capabilities.printer :
null;
@@ -727,6 +731,9 @@ Polymer({
}
this.setSettingPath_(
+ 'pagesPerSheet.available',
+ this.documentSettings.isModifiable || this.documentSettings.isPdf);
+ this.setSettingPath_(
'margins.available', this.documentSettings.isModifiable);
this.setSettingPath_(
'customMargins.available', this.documentSettings.isModifiable);
@@ -784,22 +791,20 @@ Polymer({
// Otherwise, availability depends on the margins.
let available = false;
const marginsType =
- /** @type {!print_preview.ticket_items.MarginsTypeValue} */ (
+ /** @type {!print_preview.MarginsType} */ (
this.getSettingValue('margins'));
switch (marginsType) {
- case print_preview.ticket_items.MarginsTypeValue.DEFAULT:
+ case print_preview.MarginsType.DEFAULT:
available = !this.margins ||
- this.margins.get(
- print_preview.ticket_items.CustomMarginsOrientation.TOP) > 0 ||
- this.margins.get(
- print_preview.ticket_items.CustomMarginsOrientation.BOTTOM) > 0;
+ this.margins.get(print_preview.CustomMarginsOrientation.TOP) > 0 ||
+ this.margins.get(print_preview.CustomMarginsOrientation.BOTTOM) > 0;
break;
- case print_preview.ticket_items.MarginsTypeValue.NO_MARGINS:
+ case print_preview.MarginsType.NO_MARGINS:
break;
- case print_preview.ticket_items.MarginsTypeValue.MINIMUM:
+ case print_preview.MarginsType.MINIMUM:
available = true;
break;
- case print_preview.ticket_items.MarginsTypeValue.CUSTOM:
+ case print_preview.MarginsType.CUSTOM:
const margins = this.getSettingValue('customMargins');
available = margins.marginTop > 0 || margins.marginBottom > 0;
break;
@@ -1017,21 +1022,14 @@ Polymer({
},
applyStickySettings: function() {
- const defaultScaling = '100';
if (this.stickySettings_) {
STICKY_SETTING_NAMES.forEach(settingName => {
const setting = this.get(settingName, this.settings);
const value = this.stickySettings_[setting.key];
if (value != undefined) {
this.setSetting(settingName, value);
- } else if (
- settingName === 'customScaling' &&
- !!this.stickySettings_['scaling']) {
- // If users with an old set of sticky settings intentionally set a non
- // default value, set customScaling to true so the value is restored.
- // Otherwise, set to false with noSticky=true.
- const scalingIsDefault = this.stickySettings_['scaling'] === '100';
- this.setSetting(settingName, !scalingIsDefault, scalingIsDefault);
+ } else {
+ this.applyScalingStickySettings_(settingName);
}
});
}
@@ -1052,6 +1050,39 @@ Polymer({
this.fire('sticky-settings-changed', this.getStickySettings_());
},
+ /**
+ * Helper function for applyStickySettings(). Checks if the setting
+ * is a scaling setting and applies by applying the old types
+ * that rely on 'fitToPage' and 'customScaling'.
+ * @param {string} settingName Name of the setting being applied.
+ * @private
+ */
+ applyScalingStickySettings_: function(settingName) {
+ // TODO(dhoss): Remove checks for 'customScaling' and 'fitToPage'
+ if (settingName === 'scalingType' &&
+ 'customScaling' in this.stickySettings_) {
+ const isCustom = this.stickySettings_['customScaling'];
+ const scalingType = isCustom ? print_preview.ScalingType.CUSTOM :
+ print_preview.ScalingType.DEFAULT;
+ this.setSetting(settingName, scalingType);
+ } else if (settingName === 'scalingTypePdf') {
+ if ('isFitToPageEnabled' in this.stickySettings_) {
+ const isFitToPage = this.stickySettings_['isFitToPageEnabled'];
+ const scalingTypePdf = isFitToPage ?
+ print_preview.ScalingType.FIT_TO_PAGE :
+ this.getSetting('scalingType').value;
+ this.setSetting(settingName, scalingTypePdf);
+ } else if (
+ this.getSetting('scalingType').value ===
+ print_preview.ScalingType.CUSTOM) {
+ // In the event that 'isFitToPageEnabled' was not in the sticky
+ // settings, and 'scalingType' has been set to custom, we want
+ // 'scalingTypePdf' to match.
+ this.setSetting(settingName, print_preview.ScalingType.CUSTOM);
+ }
+ }
+ },
+
// <if expr="chromeos">
/**
* Restricts settings and applies defaults as defined by policy applicable to
@@ -1066,7 +1097,7 @@ Polymer({
// We want to set the value nevertheless so we call |this.set| directly.
this.set(
'settings.color.value',
- colorValue == print_preview.ColorModeRestriction.COLOR);
+ colorValue === print_preview.ColorModeRestriction.COLOR);
}
this.set('settings.color.setByPolicy', !!colorPolicy);
@@ -1093,7 +1124,7 @@ Polymer({
!!duplexPolicy && setDuplexTypeByPolicy);
const pinPolicy = this.destination.pinPolicy;
- if (pinPolicy == print_preview.PinModeRestriction.NO_PIN) {
+ if (pinPolicy === print_preview.PinModeRestriction.NO_PIN) {
this.set('settings.pin.available', false);
this.set('settings.pinValue.available', false);
}
@@ -1101,10 +1132,22 @@ Polymer({
if (pinValue) {
this.set(
'settings.pin.value',
- pinValue == print_preview.PinModeRestriction.PIN);
+ pinValue === print_preview.PinModeRestriction.PIN);
}
this.set('settings.pin.setByPolicy', !!pinPolicy);
+ const backgroundGraphicsPolicy = this.destination.backgroundGraphicsPolicy;
+ const backgroundGraphicsValue = backgroundGraphicsPolicy ?
+ backgroundGraphicsPolicy :
+ this.destination.defaultBackgroundGraphicsPolicy;
+ if (backgroundGraphicsValue) {
+ this.set(
+ 'settings.cssBackground.value',
+ backgroundGraphicsValue ===
+ print_preview.BackgroundGraphicsModeRestriction.ENABLED);
+ }
+ this.set('settings.cssBackground.setByPolicy', !!backgroundGraphicsPolicy);
+
this.updateManaged_();
},
// </if>
@@ -1113,8 +1156,8 @@ Polymer({
updateManaged_: function() {
let managedSettings = ['headerFooter'];
// <if expr="chromeos">
- managedSettings =
- managedSettings.concat(['color', 'duplex', 'duplexShortEdge', 'pin']);
+ managedSettings = managedSettings.concat(
+ ['color', 'cssBackground', 'duplex', 'duplexShortEdge', 'pin']);
// </if>
this.controlsManaged = managedSettings.some(settingName => {
const setting = this.getSetting(settingName);
@@ -1191,6 +1234,9 @@ Polymer({
vendor_id: (number | undefined)}}
*/
(this.getSettingValue('dpi'));
+ const scalingSettingKey = this.getSetting('scalingTypePdf').available ?
+ 'scalingTypePdf' :
+ 'scalingType';
const ticket = {
mediaSize: this.getSettingValue('mediaSize'),
pageCount: this.getSettingValue('pages').length,
@@ -1205,23 +1251,20 @@ Polymer({
shouldPrintBackgrounds: this.getSettingValue('cssBackground'),
shouldPrintSelectionOnly: false, // only used in print preview
previewModifiable: this.documentSettings.isModifiable,
- printToPDF: destination.id ==
- print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
printToGoogleDrive:
destination.id == print_preview.Destination.GooglePromotedId.DOCS,
- printWithCloudPrint: !destination.isLocal,
- printWithPrivet: destination.isPrivet,
- printWithExtension: destination.isExtension,
+ printerType: print_preview.getPrinterTypeForDestination(destination),
rasterizePDF: this.getSettingValue('rasterize'),
- scaleFactor: this.getSettingValue('customScaling') ?
+ scaleFactor: this.getSettingValue(scalingSettingKey) ===
+ print_preview.ScalingType.CUSTOM ?
parseInt(this.getSettingValue('scaling'), 10) :
100,
+ scalingType: this.getSettingValue(scalingSettingKey),
pagesPerSheet: this.getSettingValue('pagesPerSheet'),
dpiHorizontal: (dpi && 'horizontal_dpi' in dpi) ? dpi.horizontal_dpi : 0,
dpiVertical: (dpi && 'vertical_dpi' in dpi) ? dpi.vertical_dpi : 0,
dpiDefault: (dpi && 'is_default' in dpi) ? dpi.is_default : false,
deviceName: destination.id,
- fitToPageEnabled: this.getSettingValue('fitToPage'),
pageWidth: this.pageSize.width,
pageHeight: this.pageSize.height,
showSystemDialog: showSystemDialog,
@@ -1232,8 +1275,7 @@ Polymer({
ticket.cloudPrintID = destination.id;
}
- if (this.getSettingValue('margins') ==
- print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
+ if (this.getSettingValue('margins') == print_preview.MarginsType.CUSTOM) {
ticket.marginsCustom = this.getSettingValue('customMargins');
}
@@ -1252,6 +1294,9 @@ Polymer({
if (this.getSettingValue('pin')) {
ticket.pinValue = this.getSettingValue('pinValue');
}
+ if (destination.origin == print_preview.DestinationOrigin.CROS) {
+ ticket.advancedSettings = this.getSettingValue('vendorItems');
+ }
// </if>
return JSON.stringify(ticket);
diff --git a/chromium/chrome/browser/resources/welcome/shared/bookmark_proxy.html b/chromium/chrome/browser/resources/print_preview/data/scaling.html
index 0336d1ff108..cbaac092c4e 100644
--- a/chromium/chrome/browser/resources/welcome/shared/bookmark_proxy.html
+++ b/chromium/chrome/browser/resources/print_preview/data/scaling.html
@@ -1,2 +1,3 @@
<link rel="import" href="chrome://resources/html/cr.html">
-<script src="bookmark_proxy.js"></script> \ No newline at end of file
+
+<script src="scaling.js"></script>
diff --git a/chromium/chrome/browser/resources/print_preview/data/scaling.js b/chromium/chrome/browser/resources/print_preview/data/scaling.js
new file mode 100644
index 00000000000..49c8d5b912d
--- /dev/null
+++ b/chromium/chrome/browser/resources/print_preview/data/scaling.js
@@ -0,0 +1,24 @@
+// 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.
+
+cr.define('print_preview', function() {
+ 'use strict';
+
+ /**
+ * Must be kept in sync with the C++ ScalingType enum in
+ * printing/print_job_constants.h.
+ * @enum {number}
+ */
+ const ScalingType = {
+ DEFAULT: 0,
+ FIT_TO_PAGE: 1,
+ FIT_TO_PAPER: 2,
+ CUSTOM: 3,
+ };
+
+ // Export
+ return {
+ ScalingType: ScalingType,
+ };
+});
diff --git a/chromium/chrome/browser/resources/print_preview/native_layer.js b/chromium/chrome/browser/resources/print_preview/native_layer.js
index ddf522abeb6..8a5abc38989 100644
--- a/chromium/chrome/browser/resources/print_preview/native_layer.js
+++ b/chromium/chrome/browser/resources/print_preview/native_layer.js
@@ -37,6 +37,7 @@ cr.define('print_preview', function() {
* decimalDelimiter: string,
* unitType: !print_preview.MeasurementSystemUnitType,
* previewModifiable: boolean,
+ * previewIsPdf: boolean,
* documentTitle: string,
* documentHasSelection: boolean,
* shouldPrintSelectionOnly: boolean,
@@ -98,19 +99,6 @@ cr.define('print_preview', function() {
let ProvisionalDestinationInfo;
/**
- * Printer types for capabilities and printer list requests.
- * Should match PrinterType in print_preview_handler.h
- * @enum {number}
- */
- const PrinterType = {
- PRIVET_PRINTER: 0,
- EXTENSION_PRINTER: 1,
- PDF_PRINTER: 2,
- LOCAL_PRINTER: 3,
- CLOUD_PRINTER: 4
- };
-
- /**
* An interface to the native Chromium printing system layer.
*/
class NativeLayer {
@@ -329,7 +317,6 @@ cr.define('print_preview', function() {
NativeLayer: NativeLayer,
PreviewSettings: PreviewSettings,
PrinterSetupResponse: PrinterSetupResponse,
- PrinterType: PrinterType,
PrivetPrinterDescription: PrivetPrinterDescription,
ProvisionalDestinationInfo: ProvisionalDestinationInfo,
};
diff --git a/chromium/chrome/browser/resources/print_preview/polymer3/demo.js b/chromium/chrome/browser/resources/print_preview/polymer3/demo.js
index 39a1b1bc694..7e062bfa5e7 100644
--- a/chromium/chrome/browser/resources/print_preview/polymer3/demo.js
+++ b/chromium/chrome/browser/resources/print_preview/polymer3/demo.js
@@ -2,33 +2,68 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'chrome://resources/cr_components/managed_footnote/managed_footnote.m.js';
+import 'chrome://resources/cr_elements/action_link_css.m.js';
+import 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.m.js';
import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.m.js';
import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js';
import 'chrome://resources/cr_elements/cr_drawer/cr_drawer.m.js';
+import 'chrome://resources/cr_elements/cr_expand_button/cr_expand_button.m.js';
import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.m.js';
import 'chrome://resources/cr_elements/cr_input/cr_input.m.js';
+import 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.m.js';
+import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.m.js';
import 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.m.js';
import 'chrome://resources/cr_elements/cr_radio_group/cr_radio_group.m.js';
import 'chrome://resources/cr_elements/cr_search_field/cr_search_field.m.js';
import 'chrome://resources/cr_elements/cr_tabs/cr_tabs.m.js';
import 'chrome://resources/cr_elements/cr_toast/cr_toast.m.js';
import 'chrome://resources/cr_elements/cr_toggle/cr_toggle.m.js';
+import 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar.m.js';
import 'chrome://resources/cr_elements/icons.m.js';
import 'chrome://resources/cr_elements/md_select_css.m.js';
+import 'chrome://resources/cr_elements/policy/cr_tooltip_icon.m.js';
+import 'chrome://resources/js/action_link.js';
import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
+import '../strings.m.js';
+import * as crToastManager from 'chrome://resources/cr_elements/cr_toast/cr_toast_manager.m.js';
import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
class HelloPolymer3Element extends PolymerElement {
static get template() {
return html`
- <style include="md-select">
+ <style include="md-select action-link">
cr-toggle {
display: inline-block;
}
+
+ cr-icon-button {
+ --cr-icon-button-color: white;
+ }
+
+ .setting {
+ align-items: center;
+ display: flex;
+ }
+
+ div, cr-input, select, cr-checkbox {
+ margin-top: 20px;
+ }
</style>
+ <cr-toolbar id="toolbar" page-name="Polymer 3 Demo"
+ search-prompt="Search">
+ <cr-icon-button iron-icon="cr:more-vert" on-click="showActionMenu_">
+ </cr-icon-button>
+ </cr-toolbar>
+ <cr-action-menu>
+ <button class="dropdown-item">Hello</button>
+ <button class="dropdown-item">Action</button>
+ <button class="dropdown-item">Menu</button>
+ </cr-action-menu>
+
<cr-checkbox checked="{{checkboxChecked_}}">
[[checkboxChecked_]]
</cr-checkbox>
@@ -47,8 +82,6 @@ class HelloPolymer3Element extends PolymerElement {
<cr-input></cr-input>
- <cr-icon-button iron-icon="cr:more-vert"></cr-icon-button>
-
<div>
<cr-button on-click="onClick_">Show toast</cr-button>
<cr-toast><span>I am toasted</span></cr-toast>
@@ -86,14 +119,49 @@ class HelloPolymer3Element extends PolymerElement {
<div>
<cr-button on-click="showDialog_">Click to open dialog</cr-button>
- <cr-dialog id="dialog">
- <div slot="title">I am a dialog</div>
- </cr-dialog>
+ <cr-lazy-render id="dialog">
+ <template>
+ <cr-dialog>
+ <div slot="title">I am a dialog</div>
+ </cr-dialog>
+ </template>
+ </cr-lazy-render>
</div>
<div>
<cr-search-field label="test search field"></cr-search-field>
+ </div>
+
<div>
+ <cr-expand-button on-click="onExpand_">Expand</cr-expand-button>
+ <div hidden$="[[!expanded_]]">Expanded content</div>
+ </div>
+
+ <div class="setting">
+ <span>Some setting</span>
+ <cr-tooltip-icon tooltip-text="This setting is controlled by policy"
+ icon-class="cr20:domain"
+ icon-aria-label="This setting is controlled by policy">
+ </cr-tooltip-icon>
+ <cr-toggle disabled checked></cr-toggle>
+ </div>
+
+ <div>
+ <cr-link-row class="hr" label="Hello Link Row"></cr-link-row>
+ </div>
+
+ <a is="action-link">I am an action link</a>
+
+ <div>
+ <cr-toast-manager></cr-toast-manager>
+ <cr-button on-click="showToastWithManager_">
+ Show toast for 2s
+ </cr-button>
+ </div>
+
+ <div>
+ <managed-footnote></managed-footnote>
+ </div>
`;
}
@@ -106,6 +174,12 @@ class HelloPolymer3Element extends PolymerElement {
checkboxChecked_: Boolean,
/** @private */
+ expanded_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /** @private */
selectedSubpage_: {
type: Number,
value: 0,
@@ -116,6 +190,12 @@ class HelloPolymer3Element extends PolymerElement {
type: Array,
value: () => (['A', 'B']),
},
+
+ /** @private */
+ isFirst_: {
+ type: Boolean,
+ value: true,
+ },
};
}
@@ -131,7 +211,7 @@ class HelloPolymer3Element extends PolymerElement {
/** @private */
showDialog_() {
- this.shadowRoot.querySelector('cr-dialog').showModal();
+ this.shadowRoot.querySelector('#dialog').get().showModal();
}
/**
@@ -149,6 +229,28 @@ class HelloPolymer3Element extends PolymerElement {
isTabBSelected_() {
return this.selectedSubpage_ === 1;
}
+
+ /** @private */
+ onExpand_() {
+ this.expanded_ = !this.expanded_;
+ }
+
+ /**
+ * @param {!Event} e
+ * @private
+ */
+ showActionMenu_(e) {
+ this.shadowRoot.querySelector('cr-action-menu').showAt(e.target);
+ }
+
+ /** @private */
+ showToastWithManager_() {
+ const toastManager = crToastManager.getInstance();
+ toastManager.duration = 2000;
+ toastManager.show(
+ 'I am toasted ' + (this.isFirst_ ? 'first' : 'second'), false);
+ this.isFirst_ = !this.isFirst_;
+ }
} // class HelloPolymer3
customElements.define('hello-polymer3', HelloPolymer3Element);
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 41d460f7452..25005669658 100644
--- a/chromium/chrome/browser/resources/print_preview/print_preview_resources.grd
+++ b/chromium/chrome/browser/resources/print_preview/print_preview_resources.grd
@@ -145,6 +145,12 @@
<structure name="IDR_PRINT_PREVIEW_DATA_DOCUMENT_INFO_JS"
file="data/document_info.js"
type="chrome_html" />
+ <structure name="IDR_PRINT_PREVIEW_DATA_SCALING_HTML"
+ file="data/scaling.html"
+ type="chrome_html" />
+ <structure name="IDR_PRINT_PREVIEW_DATA_SCALING_JS"
+ file="data/scaling.js"
+ type="chrome_html" />
<structure name="IDR_PRINT_PREVIEW_DATA_SIZE_HTML"
file="data/size.html"
type="chrome_html" />
@@ -432,8 +438,8 @@
<structure name="IDR_PRINT_PREVIEW_UI_STRINGS_HTML"
file="ui/strings.html"
type="chrome_html" />
- <structure name="IDR_PRINT_PREVIEW_ICONS_HTML"
- file="icons.html"
+ <structure name="IDR_PRINT_PREVIEW_UI_ICONS_HTML"
+ file="ui/icons.html"
type="chrome_html" />
<if expr="not optimize_webui">
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 009f602c06e..cf7256fbce1 100644
--- a/chromium/chrome/browser/resources/print_preview/print_preview_utils.js
+++ b/chromium/chrome/browser/resources/print_preview/print_preview_utils.js
@@ -59,7 +59,7 @@ function observerDepsDefined(args) {
/**
* Returns background images (icon and dropdown arrow) for use in a md-select.
- * @param {!Polymer.IronIconsetSvg} iconset The iconset the icon is in.
+ * @param {!IronIconsetSvgElement} 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
diff --git a/chromium/chrome/browser/resources/print_preview/ui/BUILD.gn b/chromium/chrome/browser/resources/print_preview/ui/BUILD.gn
index 488bf4143ba..5b144bb14df 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/BUILD.gn
+++ b/chromium/chrome/browser/resources/print_preview/ui/BUILD.gn
@@ -151,10 +151,10 @@ js_library("destination_select") {
":select_behavior",
"..:print_preview_utils",
"../data:destination",
+ "//third_party/polymer/v1_0/components-chromium/iron-iconset-svg:iron-iconset-svg-extracted",
"//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) {
@@ -232,6 +232,7 @@ js_library("scaling_settings") {
deps = [
":number_settings_section",
":settings_behavior",
+ "../data:scaling",
]
}
@@ -246,8 +247,8 @@ js_library("duplex_settings") {
":select_behavior",
":settings_behavior",
"..:print_preview_utils",
+ "//third_party/polymer/v1_0/components-chromium/iron-iconset-svg:iron-iconset-svg-extracted",
]
- externs_list = [ "$externs_path/pending.js" ]
}
js_library("advanced_options_settings") {
@@ -317,6 +318,7 @@ js_library("preview_area") {
"../../pdf:pdf_scripting_api",
"../data:coordinate2d",
"../data:destination",
+ "../data:destination_match",
"../data:margins",
"../data:model",
"../data:printable_area",
@@ -376,6 +378,7 @@ js_library("destination_dialog") {
"//ui/webui/resources/js:i18n_behavior",
"//ui/webui/resources/js:list_property_update_behavior",
]
+ externs_list = [ "$externs_path/pending_polymer.js" ]
}
js_library("destination_list") {
diff --git a/chromium/chrome/browser/resources/print_preview/ui/advanced_options_settings.html b/chromium/chrome/browser/resources/print_preview/ui/advanced_options_settings.html
index 4cffcd9b8e9..ec2c7ba8213 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/advanced_options_settings.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/advanced_options_settings.html
@@ -10,6 +10,7 @@
<template>
<style include="print-preview-shared">
cr-button {
+ height: fit-content;
min-height: 32px;
text-align: center;
width: calc(100% - 2 * var(--print-preview-sidebar-margin));
diff --git a/chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.html b/chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.html
index 2dd7432984d..396e8525c4f 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.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/cr_checkbox/cr_checkbox.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/search_highlight_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
@@ -76,11 +77,16 @@
</select>
</div>
</template>
- <span hidden$="[[isCapabilityTypeSelect_(capability)]]">
+ <span hidden$="[[!isCapabilityTypeInput_(capability)]]">
<cr-input type="text" on-input="onUserInput_" spellcheck="false"
placeholder="[[getCapabilityPlaceholder_(capability)]]">
</cr-input>
</span>
+ <span hidden$="[[!isCapabilityTypeCheckbox_(capability)]]">
+ <cr-checkbox on-change="onCheckboxInput_"
+ checked="[[isChecked_(currentValue_)]]">
+ </cr-checkbox>
+ </span>
</div>
</template>
<script src="advanced_settings_item.js"></script>
diff --git a/chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.js b/chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.js
index 4b01e0ef35f..56450e98237 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/advanced_settings_item.js
@@ -67,6 +67,33 @@ Polymer({
},
/**
+ * @return {boolean} Whether the capability represented by this item is
+ * of type checkbox.
+ * @private
+ */
+ isCapabilityTypeCheckbox_: function() {
+ return this.capability.type == 'TYPED_VALUE' &&
+ this.capability.typed_value_cap.value_type == 'BOOLEAN';
+ },
+
+ /**
+ * @return {boolean} Whether the capability represented by this item is
+ * of type input.
+ * @private
+ */
+ isCapabilityTypeInput_: function() {
+ return !this.isCapabilityTypeSelect_() && !this.isCapabilityTypeCheckbox_();
+ },
+
+ /**
+ * @return {boolean} Whether the checkbox setting is checked.
+ * @private
+ */
+ isChecked_: function() {
+ return this.currentValue_ == 'true';
+ },
+
+ /**
* @param {!print_preview.VendorCapabilitySelectOption} option The option
* for a select capability.
* @return {boolean} Whether the option is selected.
@@ -137,6 +164,14 @@ Polymer({
},
/**
+ * @param {!Event} e Event containing the new value.
+ * @private
+ */
+ onCheckboxInput_: function(e) {
+ this.currentValue_ = e.target.checked ? 'true' : 'false';
+ },
+
+ /**
* @return {string} The current value of the setting, or the empty string if
* it is not set.
*/
diff --git a/chromium/chrome/browser/resources/print_preview/ui/app.html b/chromium/chrome/browser/resources/print_preview/ui/app.html
index 2e5816ecc93..d5ad5503a1a 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/app.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/app.html
@@ -73,7 +73,8 @@
cloud-print-error-message="[[cloudPrintErrorMessage_]]"
destination-state="{{destinationState_}}"
controls-managed="[[controlsManaged_]]" destination="{{destination_}}"
- error="{{error_}}" new-print-preview-layout="[[newPrintPreviewLayout_]]"
+ error="{{error_}}" is-pdf="[[documentSettings_.isPdf]]"
+ new-print-preview-layout="[[newPrintPreviewLayout_]]"
page-count="[[documentSettings_.pageCount]]"
settings="[[settings]]" state="[[state]]" on-focus="onSidebarFocus_"
<if expr="is_macosx">
diff --git a/chromium/chrome/browser/resources/print_preview/ui/app.js b/chromium/chrome/browser/resources/print_preview/ui/app.js
index 8f30d4e6358..ccd7ca5e5e7 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/app.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/app.js
@@ -266,8 +266,8 @@ Polymer({
settings.uiLocale);
}
this.$.documentInfo.init(
- settings.previewModifiable, settings.documentTitle,
- settings.documentHasSelection);
+ settings.previewModifiable, settings.previewIsPdf,
+ settings.documentTitle, settings.documentHasSelection);
this.$.model.setStickySettings(settings.serializedAppStateStr);
this.$.model.setPolicySettings(
settings.headerFooter, settings.isHeaderFooterManaged);
diff --git a/chromium/chrome/browser/resources/print_preview/ui/destination_dialog.html b/chromium/chrome/browser/resources/print_preview/ui/destination_dialog.html
index a941dae7276..a9f91768268 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/destination_dialog.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/destination_dialog.html
@@ -16,7 +16,7 @@
<link rel="import" href="chrome://resources/html/list_property_update_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="../icons.html">
+<link rel="import" href="icons.html">
<link rel="import" href="../metrics.html">
<link rel="import" href="../native_layer.html">
<link rel="import" href="../print_preview_utils.html">
@@ -166,7 +166,8 @@
</select>
</div>
<print-preview-search-box id="searchBox"
- label="$i18n{searchBoxPlaceholder}" search-query="{{searchQuery_}}">
+ label="$i18n{searchBoxPlaceholder}" search-query="{{searchQuery_}}"
+ autofocus>
</print-preview-search-box>
</div>
<div slot="body">
diff --git a/chromium/chrome/browser/resources/print_preview/ui/destination_dialog.js b/chromium/chrome/browser/resources/print_preview/ui/destination_dialog.js
index 5c30560c050..06dabe3874a 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/destination_dialog.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/destination_dialog.js
@@ -287,12 +287,6 @@ Polymer({
show: function() {
this.$.dialog.showModal();
- // Note: Manually focusing here instead of using autofocus, as it is
- // currently not possible to validate refocusing of the search input if
- // autofocus is used. See https://crbug.com/985637 and
- // https://crbug.com/985636. Autofocus can be restored when one or both of
- // these issues are resolved.
- this.$.searchBox.focus();
this.loadingDestinations_ = this.destinationStore === undefined ||
this.destinationStore.isPrintDestinationSearchInProgress;
this.metrics_.record(
diff --git a/chromium/chrome/browser/resources/print_preview/ui/destination_list_item.html b/chromium/chrome/browser/resources/print_preview/ui/destination_list_item.html
index 5e6056eb752..2a98fe8fd59 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/destination_list_item.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/destination_list_item.html
@@ -6,7 +6,7 @@
<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/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="../icons.html">
+<link rel="import" href="icons.html">
<link rel="import" href="../data/destination.html">
<link rel="import" href="highlight_utils.html">
<link rel="import" href="print_preview_vars_css.html">
diff --git a/chromium/chrome/browser/resources/print_preview/ui/destination_select.html b/chromium/chrome/browser/resources/print_preview/ui/destination_select.html
index 2b7cb3cec17..2438ba0e47b 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/destination_select.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/destination_select.html
@@ -7,7 +7,7 @@
<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="icons.html">
<link rel="import" href="../print_preview_utils.html">
<link rel="import" href="../data/destination.html">
<link rel="import" href="print_preview_shared_css.html">
diff --git a/chromium/chrome/browser/resources/print_preview/ui/destination_select.js b/chromium/chrome/browser/resources/print_preview/ui/destination_select.js
index 2c68355bd2a..d725445e819 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/destination_select.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/destination_select.js
@@ -76,7 +76,7 @@ Polymer({
}
// </if>
iconSetAndIcon = iconSetAndIcon || icon.split(':');
- const iconset = /** @type {!Polymer.IronIconsetSvg} */ (
+ const iconset = /** @type {!IronIconsetSvgElement} */ (
this.meta_.byKey(iconSetAndIcon[0]));
return getSelectDropdownBackground(iconset, iconSetAndIcon[1], this);
},
diff --git a/chromium/chrome/browser/resources/print_preview/ui/duplex_settings.html b/chromium/chrome/browser/resources/print_preview/ui/duplex_settings.html
index a1382d8bc8d..c1393ed1e50 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/duplex_settings.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/duplex_settings.html
@@ -6,7 +6,7 @@
<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="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">
diff --git a/chromium/chrome/browser/resources/print_preview/ui/duplex_settings.js b/chromium/chrome/browser/resources/print_preview/ui/duplex_settings.js
index 167c1fc7342..22b0820adf3 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/duplex_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/duplex_settings.js
@@ -81,7 +81,7 @@ Polymer({
getBackgroundImages_: function() {
const icon =
this.getSettingValue('duplexShortEdge') ? 'short-edge' : 'long-edge';
- const iconset = /** @type {!Polymer.IronIconsetSvg} */ (
+ const iconset = /** @type {!IronIconsetSvgElement} */ (
this.meta_.byKey('print-preview'));
return getSelectDropdownBackground(iconset, icon, this);
},
diff --git a/chromium/chrome/browser/resources/print_preview/ui/header.html b/chromium/chrome/browser/resources/print_preview/ui/header.html
index 8e92fdd887f..0b9152f23a7 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/header.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/header.html
@@ -6,7 +6,7 @@
<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="../data/state.html">
-<link rel="import" href="../icons.html">
+<link rel="import" href="icons.html">
<link rel="import" href="settings_behavior.html">
<link rel="import" href="print_preview_vars_css.html">
<link rel="import" href="strings.html">
diff --git a/chromium/chrome/browser/resources/print_preview/ui/header_new.html b/chromium/chrome/browser/resources/print_preview/ui/header_new.html
index 9983f9f2b24..6a16578d5b6 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/header_new.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/header_new.html
@@ -5,7 +5,7 @@
<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="../data/state.html">
-<link rel="import" href="../icons.html">
+<link rel="import" href="icons.html">
<link rel="import" href="settings_behavior.html">
<link rel="import" href="print_preview_vars_css.html">
<link rel="import" href="strings.html">
diff --git a/chromium/chrome/browser/resources/print_preview/icons.html b/chromium/chrome/browser/resources/print_preview/ui/icons.html
index 8cffcf206ad..1f5ce331dc9 100644
--- a/chromium/chrome/browser/resources/print_preview/icons.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/icons.html
@@ -7,20 +7,15 @@
<defs>
<!-- 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">
- <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>
+ <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"></path>
+ <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 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="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">
<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="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">
<path d="M-5-5h32v32H-5z">
</g>
diff --git a/chromium/chrome/browser/resources/print_preview/ui/margin_control.js b/chromium/chrome/browser/resources/print_preview/ui/margin_control.js
index 0e9dca3478f..97e8f1bfea2 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/margin_control.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/margin_control.js
@@ -138,7 +138,7 @@ Polymer({
*/
convertPixelsToPts: function(pixels) {
let pts;
- const Orientation = print_preview.ticket_items.CustomMarginsOrientation;
+ const Orientation = print_preview.CustomMarginsOrientation;
if (this.side == Orientation.TOP) {
pts = pixels - this.translateTransform.y + RADIUS_PX;
pts /= this.scaleTransform;
@@ -253,7 +253,7 @@ Polymer({
return;
}
- const Orientation = print_preview.ticket_items.CustomMarginsOrientation;
+ const Orientation = print_preview.CustomMarginsOrientation;
let x = this.translateTransform.x;
let y = this.translateTransform.y;
let width = null;
diff --git a/chromium/chrome/browser/resources/print_preview/ui/margin_control_container.js b/chromium/chrome/browser/resources/print_preview/ui/margin_control_container.js
index b507fc864bb..c675756de45 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/margin_control_container.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/margin_control_container.js
@@ -7,15 +7,13 @@ cr.define('print_preview', function() {
'use strict';
/**
- * @const {!Map<!print_preview.ticket_items.CustomMarginsOrientation, string>}
+ * @const {!Map<!print_preview.CustomMarginsOrientation, string>}
*/
const MARGIN_KEY_MAP = new Map([
- [print_preview.ticket_items.CustomMarginsOrientation.TOP, 'marginTop'],
- [print_preview.ticket_items.CustomMarginsOrientation.RIGHT, 'marginRight'],
- [
- print_preview.ticket_items.CustomMarginsOrientation.BOTTOM, 'marginBottom'
- ],
- [print_preview.ticket_items.CustomMarginsOrientation.LEFT, 'marginLeft']
+ [print_preview.CustomMarginsOrientation.TOP, 'marginTop'],
+ [print_preview.CustomMarginsOrientation.RIGHT, 'marginRight'],
+ [print_preview.CustomMarginsOrientation.BOTTOM, 'marginBottom'],
+ [print_preview.CustomMarginsOrientation.LEFT, 'marginLeft']
]);
/** @const {number} */
@@ -87,16 +85,16 @@ cr.define('print_preview', function() {
},
/**
- * @private {!Array<!print_preview.ticket_items.CustomMarginsOrientation>}
+ * @private {!Array<!print_preview.CustomMarginsOrientation>}
*/
marginSides_: {
type: Array,
notify: true,
value: [
- print_preview.ticket_items.CustomMarginsOrientation.TOP,
- print_preview.ticket_items.CustomMarginsOrientation.RIGHT,
- print_preview.ticket_items.CustomMarginsOrientation.BOTTOM,
- print_preview.ticket_items.CustomMarginsOrientation.LEFT,
+ print_preview.CustomMarginsOrientation.TOP,
+ print_preview.CustomMarginsOrientation.RIGHT,
+ print_preview.CustomMarginsOrientation.BOTTOM,
+ print_preview.CustomMarginsOrientation.LEFT,
],
},
@@ -138,8 +136,7 @@ cr.define('print_preview', function() {
*/
computeAvailable_: function() {
return this.previewLoaded && !!this.clipSize_ &&
- this.getSettingValue('margins') ==
- print_preview.ticket_items.MarginsTypeValue.CUSTOM &&
+ this.getSettingValue('margins') == print_preview.MarginsType.CUSTOM &&
!!this.pageSize;
},
@@ -150,7 +147,7 @@ cr.define('print_preview', function() {
// custom margins were reset.
const newMargins = {};
for (const side of Object.values(
- print_preview.ticket_items.CustomMarginsOrientation)) {
+ print_preview.CustomMarginsOrientation)) {
const key = print_preview.MARGIN_KEY_MAP.get(side);
newMargins[key] = this.documentMargins.get(side);
}
@@ -187,11 +184,9 @@ cr.define('print_preview', function() {
this.resetMargins_ = true;
const marginsSetting = this.getSetting('margins');
- if (marginsSetting.value ==
- print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
+ if (marginsSetting.value == print_preview.MarginsType.CUSTOM) {
// Set the margins value to default first.
- this.setSetting(
- 'margins', print_preview.ticket_items.MarginsTypeValue.DEFAULT);
+ this.setSetting('margins', print_preview.MarginsType.DEFAULT);
}
// Reset custom margins so that the sticky value is not restored for the
// new paper size.
@@ -218,16 +213,14 @@ cr.define('print_preview', function() {
},
/**
- * @param {!print_preview.ticket_items.CustomMarginsOrientation} orientation
+ * @param {!print_preview.CustomMarginsOrientation} orientation
* Orientation value to test.
* @return {boolean} Whether the given orientation is TOP or BOTTOM.
* @private
*/
isTopOrBottom_: function(orientation) {
- return orientation ==
- print_preview.ticket_items.CustomMarginsOrientation.TOP ||
- orientation ==
- print_preview.ticket_items.CustomMarginsOrientation.BOTTOM;
+ return orientation == print_preview.CustomMarginsOrientation.TOP ||
+ orientation == print_preview.CustomMarginsOrientation.BOTTOM;
},
/**
@@ -241,8 +234,7 @@ cr.define('print_preview', function() {
*/
posInPixelsToPts_: function(control, posInPixels) {
const side =
- /** @type {print_preview.ticket_items.CustomMarginsOrientation} */ (
- control.side);
+ /** @type {print_preview.CustomMarginsOrientation} */ (control.side);
return this.clipAndRoundValue_(
side,
control.convertPixelsToPts(
@@ -349,7 +341,7 @@ cr.define('print_preview', function() {
const x = control.offsetLeft;
const y = control.offsetTop;
const isTopOrBottom = this.isTopOrBottom_(
- /** @type {!print_preview.ticket_items.CustomMarginsOrientation} */ (
+ /** @type {!print_preview.CustomMarginsOrientation} */ (
control.side));
const position = {};
// Extra padding, in px, to ensure the full textbox will be visible and
@@ -395,8 +387,7 @@ cr.define('print_preview', function() {
*/
setMargin_: function(side, marginValue) {
const marginSide =
- /** @type {!print_preview.ticket_items.CustomMarginsOrientation} */ (
- side);
+ /** @type {!print_preview.CustomMarginsOrientation} */ (side);
const oldMargins = /** @type {print_preview.MarginsSetting} */ (
this.getSettingValue('customMargins'));
const key = print_preview.MARGIN_KEY_MAP.get(marginSide);
@@ -416,12 +407,11 @@ cr.define('print_preview', function() {
*/
clipAndRoundValue_: function(side, value) {
const marginSide =
- /** @type {!print_preview.ticket_items.CustomMarginsOrientation} */ (
- side);
+ /** @type {!print_preview.CustomMarginsOrientation} */ (side);
if (value < 0) {
return 0;
}
- const Orientation = print_preview.ticket_items.CustomMarginsOrientation;
+ const Orientation = print_preview.CustomMarginsOrientation;
let limit = 0;
const margins = this.getSettingValue('customMargins');
if (marginSide == Orientation.TOP) {
@@ -482,10 +472,9 @@ cr.define('print_preview', function() {
new print_preview.Coordinate2d(e.x, e.y);
this.marginStartPositionInPixels_ =
new print_preview.Coordinate2d(control.offsetLeft, control.offsetTop);
- this.dragging_ =
- this.isTopOrBottom_(
- /** @type {print_preview.ticket_items.CustomMarginsOrientation} */
- (control.side)) ?
+ this.dragging_ = this.isTopOrBottom_(
+ /** @type {print_preview.CustomMarginsOrientation} */
+ (control.side)) ?
'dragging-vertical' :
'dragging-horizontal';
this.listen(control, 'pointercancel', 'onPointerUp_');
diff --git a/chromium/chrome/browser/resources/print_preview/ui/margins_settings.html b/chromium/chrome/browser/resources/print_preview/ui/margins_settings.html
index f02aa28e304..a47ee58145f 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/margins_settings.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/margins_settings.html
@@ -19,16 +19,19 @@
settings.pagesPerSheet.value)]]"
value="{{selectedValue::change}}">
<!-- The order of these options must match the natural order of their
- values, which come from
- print_preview.ticket_items.MarginsTypeValue. -->
- <option value="[[MarginsValue.DEFAULT]]" selected>
+ values, which come from print_preview.MarginsType. -->
+ <option value="[[MarginsTypeEnum.DEFAULT]]" selected>
$i18n{defaultMargins}
</option>
- <option value="[[MarginsValue.NO_MARGINS]]">$i18n{noMargins}</option>
- <option value="[[MarginsValue.MINIMUM]]">
+ <option value="[[MarginsTypeEnum.NO_MARGINS]]">
+ $i18n{noMargins}
+ </option>
+ <option value="[[MarginsTypeEnum.MINIMUM]]">
$i18n{minimumMargins}
</option>
- <option value="[[MarginsValue.CUSTOM]]">$i18n{customMargins}</option>
+ <option value="[[MarginsTypeEnum.CUSTOM]]">
+ $i18n{customMargins}
+ </option>
</select>
</div>
</print-preview-settings-section>
diff --git a/chromium/chrome/browser/resources/print_preview/ui/margins_settings.js b/chromium/chrome/browser/resources/print_preview/ui/margins_settings.js
index 94732b721b3..cd4e0aec72a 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/margins_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/margins_settings.js
@@ -11,14 +11,14 @@ Polymer({
disabled: Boolean,
/** Mirroring the enum so that it can be used from HTML bindings. */
- MarginsValue: Object,
+ MarginsTypeEnum: Object,
},
observers: ['onMarginsSettingChange_(settings.margins.value)'],
/** @override */
ready: function() {
- this.MarginsValue = print_preview.ticket_items.MarginsTypeValue;
+ this.MarginsTypeEnum = print_preview.MarginsType;
},
/**
@@ -27,8 +27,7 @@ Polymer({
*/
onMarginsSettingChange_: function(newValue) {
this.selectedValue =
- /** @type {!print_preview.ticket_items.MarginsTypeValue} */ (newValue)
- .toString();
+ /** @type {!print_preview.MarginsType} */ (newValue).toString();
},
/** @param {string} value The new select value. */
diff --git a/chromium/chrome/browser/resources/print_preview/ui/pages_per_sheet_settings.js b/chromium/chrome/browser/resources/print_preview/ui/pages_per_sheet_settings.js
index d581eeedb72..9753375431a 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/pages_per_sheet_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/pages_per_sheet_settings.js
@@ -19,8 +19,7 @@ Polymer({
*/
onPagesPerSheetSettingChange_: function(newValue) {
this.selectedValue = /** @type {number} */ (newValue).toString();
- this.setSetting(
- 'margins', print_preview.ticket_items.MarginsTypeValue.DEFAULT);
+ this.setSetting('margins', print_preview.MarginsType.DEFAULT);
},
/** @param {string} value The new select value. */
diff --git a/chromium/chrome/browser/resources/print_preview/ui/pin_settings.js b/chromium/chrome/browser/resources/print_preview/ui/pin_settings.js
index e6c1c40346b..8e56e89d2c7 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/pin_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/pin_settings.js
@@ -66,7 +66,7 @@ Polymer({
/** @private */
onCollapseChanged_: function() {
if (this.pinEnabled_) {
- /** @type {!CrInputElement} */ (this.$.pinValue).inputElement.focus();
+ /** @type {!CrInputElement} */ (this.$.pinValue).focusInput();
}
},
diff --git a/chromium/chrome/browser/resources/print_preview/ui/preview_area.html b/chromium/chrome/browser/resources/print_preview/ui/preview_area.html
index ac0d828314d..2696ecfb2a9 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/preview_area.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/preview_area.html
@@ -10,6 +10,7 @@
<link rel="import" href="../dark_mode_behavior.html">
<link rel="import" href="../data/coordinate2d.html">
<link rel="import" href="../data/destination.html">
+<link rel="import" href="../data/destination_match.html">
<link rel="import" href="../data/margins.html">
<link rel="import" href="../data/model.html">
<link rel="import" href="../data/printable_area.html">
diff --git a/chromium/chrome/browser/resources/print_preview/ui/preview_area.js b/chromium/chrome/browser/resources/print_preview/ui/preview_area.js
index 71f038f3955..bee496891ac 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/preview_area.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/preview_area.js
@@ -529,13 +529,12 @@ Polymer({
*/
marginsValid_: function() {
const type = this.getSettingValue('margins');
- if (!Object.values(print_preview.ticket_items.MarginsTypeValue)
- .includes(type)) {
+ if (!Object.values(print_preview.MarginsType).includes(type)) {
// Unrecognized margins type.
return false;
}
- if (type !== print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
+ if (type !== print_preview.MarginsType.CUSTOM) {
return true;
}
@@ -567,11 +566,11 @@ Polymer({
// Margins
const newMarginsType = this.getSettingValue('margins');
if (newMarginsType !== lastTicket.marginsType &&
- newMarginsType !== print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
+ newMarginsType !== print_preview.MarginsType.CUSTOM) {
return true;
}
- if (newMarginsType === print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
+ if (newMarginsType === print_preview.MarginsType.CUSTOM) {
const customMargins =
/** @type {!print_preview.MarginsSetting} */ (
this.getSettingValue('customMargins'));
@@ -595,11 +594,10 @@ Polymer({
}
const customMarginsChanged =
- Object.values(print_preview.ticket_items.CustomMarginsOrientation)
- .some(side => {
- return this.margins.get(side) !==
- customMargins[print_preview.MARGIN_KEY_MAP.get(side)];
- });
+ Object.values(print_preview.CustomMarginsOrientation).some(side => {
+ return this.margins.get(side) !==
+ customMargins[print_preview.MARGIN_KEY_MAP.get(side)];
+ });
if (customMarginsChanged) {
return true;
}
@@ -608,28 +606,25 @@ Polymer({
// 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) ||
+ /** @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) {
+ this.isScalingChanged_(lastTicket)) {
return true;
}
// 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) {
+ this.getSettingValue('margins') === print_preview.MarginsType.DEFAULT) {
return true;
}
@@ -641,17 +636,13 @@ Polymer({
newValue.width_microns != lastTicket.mediaSize.width_microns ||
(this.destination.id !== lastTicket.deviceName &&
this.getSettingValue('margins') ===
- print_preview.ticket_items.MarginsTypeValue.MINIMUM)) {
+ print_preview.MarginsType.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)) {
+ if (print_preview.getPrinterTypeForDestination(this.destination) !==
+ lastTicket.printerType) {
return true;
}
@@ -664,13 +655,48 @@ Polymer({
/** @type {boolean} */ (this.getSettingValue('color')));
},
- /** @return {number} Scale factor. */
+ /** @return {number} Scale factor for print ticket. */
getScaleFactorForTicket_: function() {
- return this.getSettingValue('customScaling') ?
+ return this.getSettingValue(this.getScalingSettingKey_()) ===
+ print_preview.ScalingType.CUSTOM ?
parseInt(this.getSettingValue('scaling'), 10) :
100;
},
+ /** @return {string} Appropriate key for the scaling type setting. */
+ getScalingSettingKey_: function() {
+ return this.getSetting('scalingTypePdf').available ? 'scalingTypePdf' :
+ 'scalingType';
+ },
+
+ /**
+ * @param {Object} lastTicket Last print ticket.
+ * @return {boolean} Whether new scaling settings update the previewed
+ * document.
+ */
+ isScalingChanged_: function(lastTicket) {
+ // Preview always updates if the scale factor is changed.
+ if (this.getScaleFactorForTicket_() !== lastTicket.scaleFactor) {
+ return true;
+ }
+
+ // If both scale factors and type match, no scaling change happened.
+ const scalingType = this.getSettingValue(this.getScalingSettingKey_());
+ if (scalingType === lastTicket.scalingType) {
+ return false;
+ }
+
+ // Scaling doesn't always change because of a scalingType change. Changing
+ // between custom scaling with a scale factor of 100 and default scaling
+ // makes no difference.
+ const defaultToCustom = scalingType === print_preview.ScalingType.DEFAULT &&
+ lastTicket.scalingType === print_preview.ScalingType.CUSTOM;
+ const customToDefault = scalingType === print_preview.ScalingType.CUSTOM &&
+ lastTicket.scalingType === print_preview.ScalingType.DEFAULT;
+
+ return !defaultToCustom && !customToDefault;
+ },
+
/**
* @param {string} dpiField The field in dpi to retrieve.
* @return {number} Field value.
@@ -705,8 +731,8 @@ Polymer({
isFirstRequest: this.inFlightRequestId_ == 0,
requestID: this.inFlightRequestId_,
previewModifiable: this.documentModifiable,
- fitToPageEnabled: this.getSettingValue('fitToPage'),
scaleFactor: this.getScaleFactorForTicket_(),
+ scalingType: this.getSettingValue(this.getScalingSettingKey_()),
shouldPrintBackgrounds: this.getSettingValue('cssBackground'),
shouldPrintSelectionOnly: this.getSettingValue('selectionOnly'),
// NOTE: Even though the remaining fields don't directly relate to the
@@ -720,11 +746,7 @@ Polymer({
duplex: this.getSettingValue('duplex') ?
print_preview.DuplexMode.LONG_EDGE :
print_preview.DuplexMode.SIMPLEX,
- printToPDF: this.destination.id ==
- print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
- printWithCloudPrint: !this.destination.isLocal,
- printWithPrivet: this.destination.isPrivet,
- printWithExtension: this.destination.isExtension,
+ printerType: print_preview.getPrinterTypeForDestination(this.destination),
rasterizePDF: this.getSettingValue('rasterize'),
};
@@ -733,8 +755,7 @@ Polymer({
ticket.cloudPrintID = this.destination.id;
}
- if (this.getSettingValue('margins') ==
- print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
+ if (this.getSettingValue('margins') == print_preview.MarginsType.CUSTOM) {
ticket.marginsCustom = this.getSettingValue('customMargins');
}
this.lastTicket_ = ticket;
diff --git a/chromium/chrome/browser/resources/print_preview/ui/scaling_settings.html b/chromium/chrome/browser/resources/print_preview/ui/scaling_settings.html
index d4cd7a36b99..8da1200544a 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/scaling_settings.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/scaling_settings.html
@@ -2,6 +2,7 @@
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
+<link rel="import" href="../data/scaling.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">
@@ -20,10 +21,12 @@
<option value="[[ScalingValue.DEFAULT]]">
$i18n{optionDefaultScaling}
</option>
- <option value="[[ScalingValue.FIT_TO_PAGE]]"
- hidden$="[[!settings.fitToPage.available]]">
+ <option value="[[ScalingValue.FIT_TO_PAGE]]" hidden$="[[!isPdf]]">
$i18n{optionFitToPage}
</option>
+ <option value="[[ScalingValue.FIT_TO_PAPER]]" hidden$="[[!isPdf]]">
+ $i18n{optionFitToPaper}
+ </option>
<option value="[[ScalingValue.CUSTOM]]">
$i18n{optionCustomScaling}
</option>
diff --git a/chromium/chrome/browser/resources/print_preview/ui/scaling_settings.js b/chromium/chrome/browser/resources/print_preview/ui/scaling_settings.js
index 909562b33d3..500637a9ab2 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/scaling_settings.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/scaling_settings.js
@@ -4,20 +4,10 @@
cr.exportPath('print_preview');
-/** @enum {number} */
-const ScalingValue = {
- DEFAULT: 0,
- FIT_TO_PAGE: 1,
- CUSTOM: 2,
-};
-
/*
- * When fit to page is available, the checkbox and input interact as follows:
- * 1. When checkbox is checked, the fit to page scaling value is displayed in
- * the input. The error message is cleared if it was present.
- * 2. When checkbox is unchecked, the most recent valid scale value is restored.
- * 3. If the input is modified while the checkbox is checked, the checkbox will
- * be unchecked automatically, regardless of the validity of the new value.
+ * Fit to page and fit to paper options will only be displayed for PDF
+ * documents. If the custom option is selected, an additional input field will
+ * appear to enter the custom scale factor.
*/
Polymer({
is: 'print-preview-scaling-settings',
@@ -30,6 +20,8 @@ Polymer({
observer: 'onDisabledChanged_',
},
+ isPdf: Boolean,
+
/** @private {string} */
currentValue_: {
type: String,
@@ -39,8 +31,8 @@ Polymer({
/** @private {boolean} */
customSelected_: {
type: Boolean,
- computed: 'computeCustomSelected_(settings.customScaling.*, ' +
- 'settings.fitToPage.*)',
+ computed: 'computeCustomSelected_(settingKey_, ' +
+ 'settings.scalingType.*, settings.scalingTypePdf.*)',
},
/** @private {boolean} */
@@ -52,14 +44,23 @@ Polymer({
value: false,
},
+ /** @private {string} */
+ settingKey_: {
+ type: String,
+ computed: 'computeSettingKey_(isPdf)',
+ },
+
/** Mirroring the enum so that it can be used from HTML bindings. */
- ScalingValue: Object,
+ ScalingValue: {
+ type: Object,
+ value: print_preview.ScalingType,
+ },
},
observers: [
- 'onFitToPageSettingChange_(settings.fitToPage.value)',
+ 'onScalingTypeSettingChanged_(settingKey_, settings.scalingType.value, ' +
+ 'settings.scalingTypePdf.value)',
'onScalingSettingChanged_(settings.scaling.value)',
- 'onCustomScalingSettingChanged_(settings.customScaling.value)',
],
/** @private {string} */
@@ -81,28 +82,26 @@ Polymer({
*/
userSelectedCustomScaling_: false,
- /** @override */
- ready: function() {
- this.ScalingValue = ScalingValue;
- },
-
onProcessSelectChange: function(value) {
- if (value === ScalingValue.FIT_TO_PAGE.toString()) {
- this.setSetting('fitToPage', true);
- return;
- }
-
- const fitToPageAvailable = this.getSetting('fitToPage').available;
- if (fitToPageAvailable) {
- this.setSetting('fitToPage', false);
- }
- const isCustom = value === ScalingValue.CUSTOM.toString();
+ const isCustom = value === print_preview.ScalingType.CUSTOM.toString();
if (isCustom && !this.customScalingSettingSet_) {
this.userSelectedCustomScaling_ = true;
} else {
this.customScalingSettingSet_ = false;
}
- this.setSetting('customScaling', isCustom);
+
+ const valueAsNumber = parseInt(value, 10);
+ if (isCustom || value === print_preview.ScalingType.DEFAULT.toString()) {
+ this.setSetting('scalingType', valueAsNumber);
+ }
+ if (this.isPdf ||
+ this.getSetting('scalingTypePdf').value ===
+ print_preview.ScalingType.DEFAULT ||
+ this.getSetting('scalingTypePdf').value ===
+ print_preview.ScalingType.CUSTOM) {
+ this.setSetting('scalingTypePdf', valueAsNumber);
+ }
+
if (isCustom) {
this.setSetting('scaling', this.currentValue_);
}
@@ -117,48 +116,35 @@ Polymer({
}
},
- /** @private */
- onFitToPageSettingChange_: function() {
- if (!this.getSettingValue('fitToPage') ||
- !this.getSetting('fitToPage').available) {
- return;
- }
-
- this.updateScalingToValid_();
- this.selectedValue = ScalingValue.FIT_TO_PAGE.toString();
+ /**
+ * Updates the input string when scaling setting is set.
+ * @private
+ */
+ onScalingSettingChanged_: function() {
+ const value = /** @type {string} */ (this.getSetting('scaling').value);
+ this.lastValidScaling_ = value;
+ this.currentValue_ = value;
},
/** @private */
- onCustomScalingSettingChanged_: function() {
- if (this.getSettingValue('fitToPage') &&
- this.getSetting('fitToPage').available) {
+ onScalingTypeSettingChanged_: function() {
+ if (!this.settingKey_) {
return;
}
- const isCustom =
- /** @type {boolean} */ (this.getSetting('customScaling').value);
- if (!isCustom) {
+ const value = /** @type {!print_preview.ScalingType} */
+ (this.getSettingValue(this.settingKey_));
+ if (value !== print_preview.ScalingType.CUSTOM) {
this.updateScalingToValid_();
} else {
this.customScalingSettingSet_ = true;
}
- this.selectedValue = isCustom ? ScalingValue.CUSTOM.toString() :
- ScalingValue.DEFAULT.toString();
- },
-
- /**
- * Updates the input string when scaling setting is set.
- * @private
- */
- onScalingSettingChanged_: function() {
- const value = /** @type {string} */ (this.getSetting('scaling').value);
- this.lastValidScaling_ = value;
- this.currentValue_ = value;
+ this.selectedValue = value.toString();
},
/**
- * Updates scaling and fit to page settings based on the validity and current
- * value of the scaling input.
+ * Updates scaling settings based on the validity and current value of the
+ * scaling input.
* @private
*/
onInputChanged_: function() {
@@ -188,9 +174,17 @@ Polymer({
* @private
*/
computeCustomSelected_: function() {
- return /** @type {boolean} */ (this.getSettingValue('customScaling')) &&
- (!this.getSetting('fitToPage').available ||
- !(/** @type {boolean} */ (this.getSettingValue('fitToPage'))));
+ return !!this.settingKey_ &&
+ this.getSettingValue(this.settingKey_) ===
+ print_preview.ScalingType.CUSTOM;
+ },
+
+ /**
+ * @return {string} The key of the appropriate scaling setting.
+ * @private
+ */
+ computeSettingKey_: function() {
+ return this.isPdf ? 'scalingTypePdf' : 'scalingType';
},
/** @private */
diff --git a/chromium/chrome/browser/resources/print_preview/ui/sidebar.html b/chromium/chrome/browser/resources/print_preview/ui/sidebar.html
index 7e5739246aa..7fffd00a38c 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/sidebar.html
+++ b/chromium/chrome/browser/resources/print_preview/ui/sidebar.html
@@ -48,6 +48,11 @@
flex-direction: column;
}
+ :host([new-print-preview-layout]) {
+ border-inline-end: none;
+ border-inline-start: var(--print-preview-settings-border);
+ }
+
@media (prefers-color-scheme: dark) {
:host {
background-color: rgba(255, 255, 255, .04);
@@ -163,7 +168,7 @@
hidden$="[[!settings.dpi.available]]" class="settings-section">
</print-preview-dpi-settings>
<print-preview-scaling-settings settings="[[settings]]"
- disabled="[[controlsDisabled_]]"
+ disabled="[[controlsDisabled_]]" is-pdf="[[isPdf]]"
hidden$="[[!settings.scaling.available]]"
class="settings-section">
</print-preview-scaling-settings>
diff --git a/chromium/chrome/browser/resources/print_preview/ui/sidebar.js b/chromium/chrome/browser/resources/print_preview/ui/sidebar.js
index 687539f8323..fe77e9d7c44 100644
--- a/chromium/chrome/browser/resources/print_preview/ui/sidebar.js
+++ b/chromium/chrome/browser/resources/print_preview/ui/sidebar.js
@@ -47,6 +47,8 @@ Polymer({
notify: true,
},
+ isPdf: Boolean,
+
newPrintPreviewLayout: {
type: Boolean,
reflectToAttribute: true,
diff --git a/chromium/chrome/browser/resources/quota_internals/OWNERS b/chromium/chrome/browser/resources/quota_internals/OWNERS
index 597882cfcde..84d5cb66e1c 100644
--- a/chromium/chrome/browser/resources/quota_internals/OWNERS
+++ b/chromium/chrome/browser/resources/quota_internals/OWNERS
@@ -1 +1,4 @@
-tzik@chromium.org \ No newline at end of file
+file://storage/browser/quota/OWNERS
+
+# TEAM: storage-dev@chromium.org
+# COMPONENT: Blink>Storage>Quota
diff --git a/chromium/chrome/browser/resources/quota_internals/event_handler.js b/chromium/chrome/browser/resources/quota_internals/event_handler.js
index ef5d3c11bc4..e4594b73cab 100644
--- a/chromium/chrome/browser/resources/quota_internals/event_handler.js
+++ b/chromium/chrome/browser/resources/quota_internals/event_handler.js
@@ -378,7 +378,7 @@ function handleStatistics(event) {
for (const key in data) {
let entry = statistics[key];
if (!entry) {
- entry = cr.doc.createElement('tr');
+ entry = document.createElement('tr');
$('stat-entries').appendChild(entry);
statistics[key] = entry;
}
@@ -417,7 +417,7 @@ function updateDescription() {
const normalize = keyAndLabel[i][2] || stringToText_;
- const row = cr.doc.createElement('tr');
+ const row = document.createElement('tr');
row.innerHTML = '<td>' + label + '</td>' +
'<td>' + normalize(entry) + '</td>';
tbody.appendChild(row);
@@ -493,5 +493,5 @@ function onLoad() {
$('dump-button').addEventListener('click', dump, false);
}
-cr.doc.addEventListener('DOMContentLoaded', onLoad, false);
+document.addEventListener('DOMContentLoaded', onLoad, false);
})();
diff --git a/chromium/chrome/browser/resources/quota_internals/message_dispatcher.js b/chromium/chrome/browser/resources/quota_internals/message_dispatcher.js
index b1024b6ba38..a387094e4b9 100644
--- a/chromium/chrome/browser/resources/quota_internals/message_dispatcher.js
+++ b/chromium/chrome/browser/resources/quota_internals/message_dispatcher.js
@@ -63,7 +63,7 @@ cr.define('cr.quota', function() {
break;
}
if (target) {
- const event = cr.doc.createEvent('CustomEvent');
+ const event = document.createEvent('CustomEvent');
event.initCustomEvent('update', false, false, detail);
target.dispatchEvent(event);
}
diff --git a/chromium/chrome/browser/resources/reset_password/BUILD.gn b/chromium/chrome/browser/resources/reset_password/BUILD.gn
index d464dd90c25..322a3a80274 100644
--- a/chromium/chrome/browser/resources/reset_password/BUILD.gn
+++ b/chromium/chrome/browser/resources/reset_password/BUILD.gn
@@ -13,7 +13,6 @@ js_type_check("closure_compile") {
js_library("reset_password") {
deps = [
"//chrome/browser/ui/webui/reset_password:mojo_bindings_js_library_for_compile",
- "//ui/webui/resources/js:assert",
- "//ui/webui/resources/js:util",
+ "//ui/webui/resources/js:util.m",
]
}
diff --git a/chromium/chrome/browser/resources/reset_password/reset_password.html b/chromium/chrome/browser/resources/reset_password/reset_password.html
index fa9d646c670..a16273ef371 100644
--- a/chromium/chrome/browser/resources/reset_password/reset_password.html
+++ b/chromium/chrome/browser/resources/reset_password/reset_password.html
@@ -5,14 +5,7 @@
<meta name="viewport" content="width=device-width">
<title>$i18n{title}</title>
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
- <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/mojo/mojo/public/js/mojo_bindings_lite.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/util.js"></script>
- <script src="reset_password.mojom-lite.js"></script>
- <script src="reset_password.js"></script>
+ <script type="module" src="reset_password.js"></script>
<style>
html {
font-size: 125%;
diff --git a/chromium/chrome/browser/resources/reset_password/reset_password.js b/chromium/chrome/browser/resources/reset_password/reset_password.js
index b08c7c32875..886c65c4169 100644
--- a/chromium/chrome/browser/resources/reset_password/reset_password.js
+++ b/chromium/chrome/browser/resources/reset_password/reset_password.js
@@ -2,16 +2,20 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
-'use strict';
-/**
- * JavaScript for reset_password.html, served from chrome://reset-password/.
- */
-(function() {
+// Javascript for chrome://reset-password/ WebUI page.
+
+import 'chrome://resources/cr_elements/icons.m.js';
+import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
+import 'chrome://resources/polymer/v3_0/paper-styles/color.js';
+import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
+import './reset_password.mojom-lite.js';
+
+import {$} from 'chrome://resources/js/util.m.js';
/** @type {mojom.ResetPasswordHandlerRemote} */
let pageHandler;
-function initialize() {
+document.addEventListener('DOMContentLoaded', function() {
pageHandler = mojom.ResetPasswordHandler.getRemote();
/** @type {?HTMLElement} */
@@ -19,7 +23,4 @@ function initialize() {
resetPasswordButton.addEventListener('click', function() {
pageHandler.handlePasswordReset();
});
-}
-
-document.addEventListener('DOMContentLoaded', initialize);
-})();
+});
diff --git a/chromium/chrome/browser/resources/safety_tips/PRESUBMIT.py b/chromium/chrome/browser/resources/safety_tips/PRESUBMIT.py
index 012844a2057..e7eae89d2bf 100644
--- a/chromium/chrome/browser/resources/safety_tips/PRESUBMIT.py
+++ b/chromium/chrome/browser/resources/safety_tips/PRESUBMIT.py
@@ -24,18 +24,13 @@ def CheckVersionUpdatedInProto(input_api, output_api):
return []
contents = safety_tips_proto[0].ChangedContents()
- # Must not have any changes containing flagged_page:
- if ContainsLine(contents, 'flagged_page:'):
+ # Must not have any changes containing flagged_page or allowed_pattern:
+ if (ContainsLine(contents, 'flagged_page:') or
+ ContainsLine(contents, 'allowed_pattern:')):
return [output_api.PresubmitError(
'Do not check in the full safety_tips.asciipb proto. '
'Only increment |version_id|.')]
- # This proto should not contain any actually-flagged pages. ContainsLine
- # checks if any line *starts with* the given string.
- if ContainsLine(contents, 'flagged_page:'):
- return [output_api.PresubmitError(
- 'Remove entries from Chromium safety_tips.asciipb before submitting.')]
-
# It's enticing to do something fancy like checking whether the ID was in fact
# incremented or whether this is a whitespace-only or comment-only change.
# However, currently deleted lines don't show up in ChangedContents() and
diff --git a/chromium/chrome/browser/resources/safety_tips/gen_safety_tips_proto.py b/chromium/chrome/browser/resources/safety_tips/gen_safety_tips_proto.py
index e4ec99a4e3e..75f7e34655a 100755
--- a/chromium/chrome/browser/resources/safety_tips/gen_safety_tips_proto.py
+++ b/chromium/chrome/browser/resources/safety_tips/gen_safety_tips_proto.py
@@ -43,14 +43,22 @@ class SafetyTipsProtoGenerator(BinaryProtoGenerator):
def ValidatePb(self, opts, pb):
assert pb.version_id > 0
+
for flagged_page in pb.flagged_page:
assert flagged_page.pattern
assert flagged_page.type != safety_tips_pb2.FlaggedPage.UNKNOWN
- flagged_patterns = [page.pattern for page in pb.flagged_page]
+ for allowed_pattern in pb.allowed_pattern:
+ assert allowed_pattern.pattern
+
+ flagged_patterns = [p.pattern for p in pb.flagged_page]
assert sorted(flagged_patterns) == flagged_patterns, (
"Please sort flagged_page entries by pattern.")
+ allowed_patterns = [p.pattern for p in pb.allowed_pattern]
+ assert sorted(allowed_patterns) == allowed_patterns, (
+ "Please sort allowed_pattern entries by pattern.")
+
def ProcessPb(self, opts, pb):
binary_pb_str = pb.SerializeToString()
outfile = os.path.join(opts.outdir, opts.outbasename)
diff --git a/chromium/chrome/browser/resources/safety_tips/safety_tips.asciipb b/chromium/chrome/browser/resources/safety_tips/safety_tips.asciipb
index 64b7f997870..a1536bd796d 100644
--- a/chromium/chrome/browser/resources/safety_tips/safety_tips.asciipb
+++ b/chromium/chrome/browser/resources/safety_tips/safety_tips.asciipb
@@ -8,13 +8,20 @@
# locally, generate and push the protobuffer to the storage bucket but do not
# check in the changes.
-version_id: 4
+version_id: 5
# See chrome/browser/lookalikes/safety_tips.proto for the full format.
-# These entries must be sorted alphabetically by pattern.
+# flagged_page entries must be sorted alphabetically by pattern.
# Example entry:
# flagged_page {
-# pattern: "example.test/test-path-for-safety-tips/test.html"
-# type: BAD_REP
-#}
+# pattern: "bad.test/test-path-for-safety-tips/test.html"
+# type: BAD_REP
+# }
+
+# A page that's marked to not show a UI for any heuristic (including lookalike
+# or edit distance).
+# allowed_pattern entries must be sorted alphabetically by pattern.
+# allowed_pattern: {
+# pattern: "good.test/some/path.html"
+# }
diff --git a/chromium/chrome/browser/resources/sandbox_internals/BUILD.gn b/chromium/chrome/browser/resources/sandbox_internals/BUILD.gn
new file mode 100644
index 00000000000..121a5e8f54e
--- /dev/null
+++ b/chromium/chrome/browser/resources/sandbox_internals/BUILD.gn
@@ -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.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ if (is_win) {
+ deps = [
+ ":sandbox_internals_win",
+ ]
+ }
+ if (is_android || is_linux) {
+ deps = [
+ ":sandbox_internals",
+ ]
+ }
+}
+
+js_library("sandbox_internals") {
+ # Android & Linux both need _externs for type checks as they share a js file.
+ deps = [
+ ":sandbox_android_externs",
+ "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:load_time_data",
+ "//ui/webui/resources/js:util",
+ ]
+}
+
+js_library("sandbox_android_externs") {
+}
+
+js_library("sandbox_internals_win") {
+ deps = [
+ "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:util",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/sandbox_internals/OWNERS b/chromium/chrome/browser/resources/sandbox_internals/OWNERS
new file mode 100644
index 00000000000..058ee25caec
--- /dev/null
+++ b/chromium/chrome/browser/resources/sandbox_internals/OWNERS
@@ -0,0 +1,3 @@
+file://sandbox/OWNERS
+# COMPONENT: Internals>Sandbox
+# TEAM: security-dev@chromium.org
diff --git a/chromium/chrome/browser/resources/sandbox_internals/sandbox_android_externs.js b/chromium/chrome/browser/resources/sandbox_internals/sandbox_android_externs.js
new file mode 100644
index 00000000000..a6f170cf1c3
--- /dev/null
+++ b/chromium/chrome/browser/resources/sandbox_internals/sandbox_android_externs.js
@@ -0,0 +1,9 @@
+// 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 function is only exposed to the Android chrome://sandbox webui.
+ * @param {!function(!AndroidSandboxStatus)=} callback
+ */
+chrome.getAndroidSandboxStatus = function(callback) {};
diff --git a/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.html b/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.html
index 7f4816b4bbe..c5c269faa9c 100644
--- a/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.html
+++ b/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.html
@@ -30,10 +30,13 @@
}
</style>
<script src="chrome://resources/js/cr.js"></script>
- <if expr="not is_android">
+<if expr="is_linux">
<script src="chrome://resources/js/load_time_data.js"></script>
<script src="chrome://sandbox/strings.js"></script>
- </if>
+</if>
+<if expr="is_win">
+ <script src="chrome://resources/js/promise_resolver.js"></script>
+</if>
<script src="chrome://resources/js/util.js"></script>
<script src="sandbox_internals.js"></script>
</head>
@@ -42,7 +45,9 @@
<table id="sandbox-status">
</table>
-
<p id="evaluation"></p>
+<if expr="is_win">
+ <pre id="raw-info"></pre>
+</if>
</body>
</html>
diff --git a/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.js b/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.js
index ab15fb20587..dbee2331bc4 100644
--- a/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.js
+++ b/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals.js
@@ -2,6 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+/**
+ * @typedef {{
+ * seccompStatus: number,
+ * pid: string,
+ * uid: string,
+ * secontext: string,
+ * procStatus: string,
+ * androidBuildId: string
+ * }}
+ */
+let AndroidSandboxStatus;
+
(function() {
/**
* CSS classes for different statuses.
@@ -22,10 +34,10 @@ const StatusClass = {
* @return {Element} The newly added TR.
*/
function addStatusRow(name, value, cssClass) {
- const row = cr.doc.createElement('tr');
+ const row = document.createElement('tr');
- const nameCol = row.appendChild(cr.doc.createElement('td'));
- const valueCol = row.appendChild(cr.doc.createElement('td'));
+ const nameCol = row.appendChild(document.createElement('td'));
+ const valueCol = row.appendChild(document.createElement('td'));
nameCol.textContent = name;
valueCol.textContent = value;
@@ -52,7 +64,7 @@ function addGoodBadRow(name, result) {
/**
* Reports the overall sandbox status evaluation message.
- * @param {boolean}
+ * @param {boolean} result
*/
function setEvaluation(result) {
const message = result ? 'You are adequately sandboxed.' :
diff --git a/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals_win.js b/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals_win.js
new file mode 100644
index 00000000000..100b04e20f6
--- /dev/null
+++ b/chromium/chrome/browser/resources/sandbox_internals/sandbox_internals_win.js
@@ -0,0 +1,108 @@
+// 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.
+
+/**
+ * @typedef {{
+ * processId: number,
+ * processType: string,
+ * name: string,
+ * metricsName: string
+ * }}
+ */
+let BrowserHostProcess;
+
+/**
+ * @typedef {{
+ * processId: number
+ * }}
+ */
+let RendererHostProcess;
+
+/**
+ * This may have additional fields displayed in the JSON output.
+ * See //sandbox/win/src/sandbox_constants.cc for keys in policy.
+ * @typedef {{
+ * processIds: !Array<number>,
+ * lockdownLevel: string,
+ * desiredIntegrityLevel: string,
+ * platformMitigations: string
+ * }}
+ */
+let PolicyDiagnostic;
+
+/**
+ * @typedef {{
+ * browser: !Array<!BrowserHostProcess>,
+ * renderer: !Array<!RendererHostProcess>,
+ * policies: !Array<!PolicyDiagnostic>
+ * }}
+ */
+let SandboxDiagnostics;
+
+/**
+ * Adds a row to the sandbox-status table.
+ * @param {!Array<string>} args
+ */
+function addRow(args) {
+ const row = document.createElement('tr');
+ for (const text of args) {
+ const col = row.appendChild(document.createElement('td'));
+ col.textContent = text;
+ }
+ $('sandbox-status').appendChild(row);
+}
+
+/**
+ * Adds policy information for a process to the sandbox-status table.
+ * @param {number} pid
+ * @param {string} type
+ * @param {string} name
+ * @param {PolicyDiagnostic} policy
+ */
+function addRowForProcess(pid, type, name, policy) {
+ if (policy) {
+ addRow([
+ pid, type, name, policy.lockdownLevel, policy.desiredIntegrityLevel,
+ policy.platformMitigations
+ ]);
+ } else {
+ addRow([pid, type, name, 'Not Sandboxed', '', '']);
+ }
+}
+
+/** @param {!SandboxDiagnostics} results */
+function onGetSandboxDiagnostics(results) {
+ // Make it easy to look up policies.
+ /** @type {!Map<number,!PolicyDiagnostic>} */
+ const policies = new Map();
+ for (const policy of results.policies) {
+ // At present only one process per TargetPolicy object.
+ const pid = policy.processIds[0];
+ policies.set(pid, policy);
+ }
+
+ // Titles.
+ addRow(['Process', 'Type', 'Name', 'Sandbox', 'Intregity', 'Mitigations']);
+
+ // Browser Processes.
+ for (const process of results.browser) {
+ const pid = process.processId;
+ const name = process.name || process.metricsName;
+ addRowForProcess(pid, process.processType, name, policies.get(pid));
+ }
+
+ // Renderer Processes.
+ for (const process of results.renderer) {
+ const pid = process.processId;
+ addRowForProcess(pid, 'Renderer', '', policies.get(pid));
+ }
+
+ // Raw Diagnostics.
+ $('raw-info').textContent =
+ 'policies: ' + JSON.stringify(results.policies, null, 2);
+}
+
+document.addEventListener('DOMContentLoaded', () => {
+ cr.sendWithPromise('requestSandboxDiagnostics').then(onGetSandboxDiagnostics);
+});
diff --git a/chromium/chrome/browser/resources/settings/BUILD.gn b/chromium/chrome/browser/resources/settings/BUILD.gn
index 4ba0dd05e72..beba5017d3b 100644
--- a/chromium/chrome/browser/resources/settings/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/BUILD.gn
@@ -180,5 +180,5 @@ js_library("search_settings") {
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:search_highlight_utils",
]
- externs_list = [ "$externs_path/pending.js" ]
+ externs_list = [ "$externs_path/pending_polymer.js" ]
}
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 078fc8f2161..86bd1584a0c 100644
--- a/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.html
+++ b/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.html
@@ -22,10 +22,19 @@
<settings-animated-pages id="pages" current-route="{{currentRoute}}"
section="a11y" focus-config="[[focusConfig_]]">
<div route-path="default">
- <cr-link-row class="hr" id="captions" label="$i18n{captionsTitle}"
- on-click="onCaptionsClick_" external$="[[captionSettingsOpensExternally_]]">
+<if expr="chromeos">
+ <cr-link-row class="hr" id="subpage-trigger"
+ label="$i18n{manageAccessibilityFeatures}"
+ on-click="onManageSystemAccessibilityFeaturesTap_"
+ sub-label="$i18n{moreFeaturesLinkDescription}"
+ hidden="[[showOsSettings_]]" external>
</cr-link-row>
+</if>
<if expr="not chromeos">
+ <cr-link-row class="hr" id="captions" label="$i18n{captionsTitle}"
+ on-click="onCaptionsClick_"
+ external$="[[captionSettingsOpensExternally_]]">
+ </cr-link-row>
<settings-toggle-button
id="a11yImageLabels"
hidden$="[[!showAccessibilityLabelsSetting_]]"
@@ -36,7 +45,7 @@
</settings-toggle-button>
</if>
<if expr="chromeos">
- <template is="dom-if" if="[[pageVisibility.webstoreLink]]">
+ <template is="dom-if" if="[[showOsSettings_]]">
<settings-toggle-button
id="a11yImageLabels"
hidden$="[[!showAccessibilityLabelsSetting_]]"
@@ -58,7 +67,7 @@
</if>
<cr-link-row class="hr" label="$i18n{moreFeaturesLink}"
on-click="onMoreFeaturesLinkClick_" sub-label="$i18n{a11yWebStore}"
- hidden="[[pageVisibility.webstoreLink]]" external>
+ hidden="[[showOsSettings_]]" external>
</cr-link-row>
</div>
<if expr="not is_macosx">
@@ -73,7 +82,17 @@
</template>
</if>
<if expr="chromeos">
- <template is="dom-if" if="[[pageVisibility.webstoreLink]]">
+ <template is="dom-if" if="[[showCaptionSettings_]]">
+ <template is="dom-if" route-path="/manageAccessibility/captions">
+ <settings-subpage
+ associated-control="[[$$('#subpage-trigger')]]"
+ page-title="$i18n{captionsTitle}">
+ <settings-captions prefs="{{prefs}}">
+ </settings-captions>
+ </settings-subpage>
+ </template>
+ </template>
+ <template is="dom-if" if="[[showOsSettings_]]">
<template is="dom-if" route-path="/manageAccessibility">
<settings-subpage
associated-control="[[$$('#subpage-trigger')]]"
diff --git a/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.js b/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.js
index 31045680975..6b24c8fa880 100644
--- a/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.js
+++ b/chromium/chrome/browser/resources/settings/a11y_page/a11y_page.js
@@ -68,6 +68,17 @@ Polymer({
},
/**
+ * Whether to show OS settings.
+ * @private {boolean}
+ */
+ showOsSettings_: {
+ type: Boolean,
+ value: function() {
+ return loadTimeData.getBoolean('showOSSettings');
+ },
+ },
+
+ /**
* Whether the caption settings link opens externally.
* @private {boolean}
*/
@@ -86,20 +97,6 @@ Polymer({
return opensExternally;
},
},
-
- // <if expr="chromeos">
- /**
- * Whether to show experimental accessibility features.
- * Only used in Chrome OS.
- * @private {boolean}
- */
- showExperimentalFeatures_: {
- type: Boolean,
- value: function() {
- return loadTimeData.getBoolean('showExperimentalA11yFeatures');
- },
- },
- // </if>
},
/** @override */
@@ -136,6 +133,11 @@ Polymer({
onManageAccessibilityFeaturesTap_: function() {
settings.navigateTo(settings.routes.MANAGE_ACCESSIBILITY);
},
+
+ /** @private */
+ onManageSystemAccessibilityFeaturesTap_: function() {
+ window.location.href = 'chrome://os-settings/manageAccessibility';
+ },
// </if>
/** private */
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 7f290fc3df3..ccc488cb561 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
@@ -80,31 +80,35 @@
label="$i18n{screenMagnifierLabel}"
disabled="[[prefs.ash.docked_magnifier.enabled.value]]">
</settings-toggle-button>
- <div class="settings-box continuation">
- <div class="start sub-item settings-box-text">
- $i18n{screenMagnifierZoomLabel}
+ <template is="dom-if" if="[[prefs.settings.a11y.screen_magnifier.value]]">
+ <div class="settings-box continuation">
+ <div class="start sub-item settings-box-text">
+ $i18n{screenMagnifierZoomLabel}
+ </div>
+ <settings-dropdown-menu label="$i18n{screenMagnifierZoomLabel}"
+ pref="{{prefs.settings.a11y.screen_magnifier_scale}}"
+ menu-options="[[screenMagnifierZoomOptions_]]"
+ disabled="[[!prefs.settings.a11y.screen_magnifier.value]]">
+ </settings-dropdown-menu>
</div>
- <settings-dropdown-menu label="$i18n{screenMagnifierZoomLabel}"
- pref="{{prefs.settings.a11y.screen_magnifier_scale}}"
- menu-options="[[screenMagnifierZoomOptions_]]"
- disabled="[[!prefs.settings.a11y.screen_magnifier.value]]">
- </settings-dropdown-menu>
- </div>
+ </template>
<settings-toggle-button
pref="{{prefs.ash.docked_magnifier.enabled}}"
label="$i18n{dockedMagnifierLabel}"
disabled="[[prefs.settings.a11y.screen_magnifier.value]]">
</settings-toggle-button>
- <div class="settings-box continuation">
- <div class="start sub-item settings-box-text">
- $i18n{dockedMagnifierZoomLabel}
+ <template is="dom-if" if="[[prefs.ash.docked_magnifier.enabled.value]]">
+ <div class="settings-box continuation">
+ <div class="start sub-item settings-box-text">
+ $i18n{dockedMagnifierZoomLabel}
+ </div>
+ <settings-dropdown-menu label="$i18n{dockedMagnifierZoomLabel}"
+ pref="{{prefs.ash.docked_magnifier.scale}}"
+ menu-options="[[screenMagnifierZoomOptions_]]"
+ disabled="[[!prefs.ash.docked_magnifier.enabled.value]]">
+ </settings-dropdown-menu>
</div>
- <settings-dropdown-menu label="$i18n{dockedMagnifierZoomLabel}"
- pref="{{prefs.ash.docked_magnifier.scale}}"
- menu-options="[[screenMagnifierZoomOptions_]]"
- disabled="[[!prefs.ash.docked_magnifier.enabled.value]]">
- </settings-dropdown-menu>
- </div>
+ </template>
<cr-link-row class="hr" label="$i18n{displaySettingsTitle}"
on-click="onDisplayTap_" sub-label="$i18n{displaySettingsDescription}"
embedded></cr-link-row>
@@ -218,12 +222,14 @@
on-click="onMouseTap_" sub-label="$i18n{mouseSettingsDescription}"
embedded></cr-link-row>
- <h2>$i18n{audioHeading}</h2>
- <settings-toggle-button class="first"
+ <h2>$i18n{audioAndCaptionsHeading}</h2>
+ <cr-link-row class="first" label="$i18n{captionsTitle}"
+ on-click="onCaptionsClick_"></cr-link-row>
+ <settings-toggle-button
pref="{{prefs.settings.a11y.mono_audio}}"
label="$i18n{monoAudioLabel}">
</settings-toggle-button>
- <settings-toggle-button id="startupSoundEnabled" class="first"
+ <settings-toggle-button id="startupSoundEnabled"
pref=" "
on-change="toggleStartupSoundEnabled_"
label="$i18n{startupSoundLabel}">
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 5365829d90f..8828b4fee1a 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
@@ -98,17 +98,6 @@ Polymer({
},
},
- /**
- * Whether to show experimental accessibility features.
- * @private {boolean}
- */
- showExperimentalFeatures_: {
- type: Boolean,
- value: function() {
- return loadTimeData.getBoolean('showExperimentalA11yFeatures');
- },
- },
-
showExperimentalSwitchAccess_: {
type: Boolean,
value: function() {
@@ -206,6 +195,11 @@ Polymer({
},
/** @private */
+ onCaptionsClick_: function() {
+ settings.navigateTo(settings.routes.MANAGE_CAPTION_SETTINGS);
+ },
+
+ /** @private */
onSelectToSpeakSettingsTap_: function() {
chrome.send('showSelectToSpeakSettings');
},
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 d4781a4d1b7..cdb845116be 100644
--- a/chromium/chrome/browser/resources/settings/about_page/about_page.js
+++ b/chromium/chrome/browser/resources/settings/about_page/about_page.js
@@ -233,8 +233,8 @@ Polymer({
this.regulatoryInfo_ = info;
});
- this.aboutBrowserProxy_.getHasEndOfLife().then(result => {
- this.hasEndOfLife_ = result;
+ this.aboutBrowserProxy_.getEndOfLifeInfo().then(result => {
+ this.hasEndOfLife_ = !!result.hasEndOfLife;
});
this.aboutBrowserProxy_.getEnabledReleaseNotes().then(result => {
diff --git a/chromium/chrome/browser/resources/settings/about_page/about_page_browser_proxy.js b/chromium/chrome/browser/resources/settings/about_page/about_page_browser_proxy.js
index d1f1373396e..1d5eeb7273d 100644
--- a/chromium/chrome/browser/resources/settings/about_page/about_page_browser_proxy.js
+++ b/chromium/chrome/browser/resources/settings/about_page/about_page_browser_proxy.js
@@ -27,20 +27,19 @@ let ChannelInfo;
/**
* @typedef {{
- * arcVersion: string,
- * osFirmware: string,
- * osVersion: string,
+ * version: (string|undefined),
+ * size: (string|undefined),
* }}
*/
-let VersionInfo;
+let AboutPageUpdateInfo;
/**
* @typedef {{
- * version: (string|undefined),
- * size: (string|undefined),
+ * hasEndOfLife: (boolean|undefined),
+ * eolMessageWithMonthAndYear: (string|undefined),
* }}
*/
-let AboutPageUpdateInfo;
+let EndOfLifeInfo;
/**
* Enumeration of all possible browser channels.
@@ -200,18 +199,15 @@ cr.define('settings', function() {
/** @return {!Promise<!ChannelInfo>} */
getChannelInfo() {}
- /** @return {!Promise<!VersionInfo>} */
- getVersionInfo() {}
-
/** @return {!Promise<?RegulatoryInfo>} */
getRegulatoryInfo() {}
/**
* Checks if the device has reached end-of-life status and will no longer
* receive updates.
- * @return {!Promise<boolean>}
+ * @return {!Promise<!EndOfLifeInfo>}
*/
- getHasEndOfLife() {}
+ getEndOfLifeInfo() {}
/**
* Request TPM firmware update status from the browser. It results in one or
@@ -309,18 +305,13 @@ cr.define('settings', function() {
}
/** @override */
- getVersionInfo() {
- return cr.sendWithPromise('getVersionInfo');
- }
-
- /** @override */
getRegulatoryInfo() {
return cr.sendWithPromise('getRegulatoryInfo');
}
/** @override */
- getHasEndOfLife() {
- return cr.sendWithPromise('getHasEndOfLife');
+ getEndOfLifeInfo() {
+ return cr.sendWithPromise('getEndOfLifeInfo');
}
/** @override */
diff --git a/chromium/chrome/browser/resources/settings/about_page/channel_switcher_dialog.html b/chromium/chrome/browser/resources/settings/about_page/channel_switcher_dialog.html
index a974334455c..78ac464caad 100644
--- a/chromium/chrome/browser/resources/settings/about_page/channel_switcher_dialog.html
+++ b/chromium/chrome/browser/resources/settings/about_page/channel_switcher_dialog.html
@@ -19,7 +19,7 @@
<div slot="title">$i18n{aboutChangeChannel}</div>
<div slot="body">
<!-- TODO(dbeam): this can be policy-controlled. Show this in the UI.
- https://www.chromium.org/administrators/policy-list-3#ChromeOsReleaseChannel
+ https://cloud.google.com/docs/chrome-enterprise/policies/?policy=ChromeOsReleaseChannel
-->
<cr-radio-group on-selected-changed="onChannelSelectionChanged_">
<cr-radio-button name="[[browserChannelEnum_.STABLE]]">
diff --git a/chromium/chrome/browser/resources/settings/about_page/detailed_build_info.html b/chromium/chrome/browser/resources/settings/about_page/detailed_build_info.html
index 2369486bc71..fa1ae5f812e 100644
--- a/chromium/chrome/browser/resources/settings/about_page/detailed_build_info.html
+++ b/chromium/chrome/browser/resources/settings/about_page/detailed_build_info.html
@@ -24,15 +24,6 @@
width: 100%;
}
</style>
- <div class="settings-box two-line single-column">
- <div>$i18n{aboutPlatformLabel}</div>
- <div class="secondary" id="osVersion">[[versionInfo_.osVersion]]</div>
- </div>
- <div class="settings-box two-line single-column"
- hidden$="[[!shouldShowVersion_(versionInfo_.osFirmware)]]">
- <div>$i18n{aboutFirmwareLabel}</div>
- <div class="secondary" id="osFirmware">[[versionInfo_.osFirmware]]</div>
- </div>
<div class="settings-box two-line">
<div class="start">
<div>$i18n{aboutChannelLabel}</div>
@@ -57,29 +48,17 @@
</settings-channel-switcher-dialog>
</template>
</div>
- <div class="settings-box two-line single-column"
- hidden$="[[!shouldShowVersion_(versionInfo_.arcVersion)]]">
- <div>$i18n{aboutArcVersionLabel}</div>
- <div class="secondary" id="arcVersion">[[versionInfo_.arcVersion]]</div>
- </div>
- <div class="settings-box two-line single-column">
- <div>V8</div>
- <div class="secondary">$i18n{aboutJsEngineVersion}</div>
- </div>
- <div class="settings-box two-line single-column">
- <div>$i18n{aboutUserAgentLabel}</div>
- <div class="secondary">$i18n{aboutUserAgent}</div>
- </div>
- <div class="settings-box two-line single-column">
- <div>$i18n{aboutCommandLineLabel}</div>
- <div id="command-line" class="secondary">
- [[i18n('aboutCommandLine')]]
+ <div id="endOfLifeSectionContainer"
+ class="settings-box two-line single-column"
+ hidden="[[!eolMessageWithMonthAndYear]]">
+ <div>$i18n{aboutEndOfLifeTitle}</div>
+ <div class="secondary" inner-h-t-m-l="[[eolMessageWithMonthAndYear]]">
</div>
</div>
- <div class="settings-box two-line single-column">
- <div>$i18n{aboutBuildDateLabel}</div>
- <div class="secondary">$i18n{aboutBuildDate}</div>
- </div>
+ <cr-link-row class="hr" label="$i18n{aboutBuildDetailsTitle}"
+ on-click="onBuildDetailsTap_" external>
+ </cr-link-row>
+ <div class="hr"></div>
</template>
<script src="detailed_build_info.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/about_page/detailed_build_info.js b/chromium/chrome/browser/resources/settings/about_page/detailed_build_info.js
index 18ad3b217ed..ba47cf969b4 100644
--- a/chromium/chrome/browser/resources/settings/about_page/detailed_build_info.js
+++ b/chromium/chrome/browser/resources/settings/about_page/detailed_build_info.js
@@ -13,9 +13,6 @@ Polymer({
behaviors: [I18nBehavior],
properties: {
- /** @private {!VersionInfo} */
- versionInfo_: Object,
-
/** @private */
currentlyOnChannelText_: String,
@@ -24,17 +21,17 @@ Polymer({
/** @private */
canChangeChannel_: Boolean,
+
+ eolMessageWithMonthAndYear: {
+ type: String,
+ value: '',
+ },
},
/** @override */
ready: function() {
const browserProxy = settings.AboutPageBrowserProxyImpl.getInstance();
browserProxy.pageReady();
-
- browserProxy.getVersionInfo().then(versionInfo => {
- this.versionInfo_ = versionInfo;
- });
-
this.updateChannelInfo_();
},
@@ -51,15 +48,6 @@ Polymer({
},
/**
- * @param {string} version
- * @return {boolean}
- * @private
- */
- shouldShowVersion_: function(version) {
- return version.length > 0;
- },
-
- /**
* @param {boolean} canChangeChannel
* @return {string}
* @private
@@ -93,6 +81,15 @@ Polymer({
this.showChannelSwitcherDialog_ = true;
},
+ /**
+ * @param {!Event} e
+ * @private
+ */
+ onBuildDetailsTap_: function(e) {
+ e.preventDefault();
+ window.open('chrome://version');
+ },
+
/** @private */
onChannelSwitcherDialogClosed_: function() {
this.showChannelSwitcherDialog_ = false;
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 39116e40833..91ab92092e9 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
@@ -13,6 +13,11 @@
<link rel="import" href="android_apps_browser_proxy.html">
<link rel="import" href="android_apps_subpage.html">
+<!-- Changes to this file should be reflected in
+ ../chromeos/os_apps_page/os_apps_page.html.
+ TODO(crbug.com/1006152): This file should be deleted once the split-settings
+ flag has been removed. -->
+
<dom-module id="settings-android-apps-page">
<template>
<style include="settings-shared"></style>
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 b0d86e21b93..92340b7c23c 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
@@ -18,13 +18,21 @@
<template is="dom-if" if="[[androidAppsInfo.settingsAppAvailable]]" restamp>
<cr-link-row id="manageApps" icon-class="icon-external"
label="$i18n{androidAppsManageApps}"
- on-click="onManageAndroidAppsTap_">
+ on-click="onManageAndroidAppsTap_" external>
</cr-link-row>
</template>
- <template is="dom-if" if="[[allowRemove_(prefs.arc.enabled.*)]]">
- <cr-link-row id="remove" class="hr" on-click="onRemoveTap_"
- label="$i18n{androidAppsRemove}"></cr-link-row>
+ <!-- Use 'restamp' so tests can check if the row exists. -->
+ <template is="dom-if" if="[[allowRemove_(prefs.arc.enabled.*)]]" restamp>
+ <div id="remove" class="settings-box">
+ <div id="androidRemoveLabel" class="start">
+ $i18n{androidAppsRemove}
+ </div>
+ <cr-button on-click="onRemoveTap_"
+ aria-labelledby="androidRemoveLabel">
+ $i18n{androidAppsRemoveButton}
+ </cr-button>
+ </div>
</template>
<!-- Confirm disable android apps dialog -->
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.js b/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.js
index 2551cf3b191..582ae814c9e 100644
--- a/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.js
+++ b/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.js
@@ -339,7 +339,7 @@ Polymer({
},
/**
- * @see content::ZoomValuesEqual().
+ * @see blink::PageZoomValuesEqual().
* @param {number} zoom1
* @param {number} zoom2
* @return {boolean}
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 652a4aa59c3..ba786243f76 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js
+++ b/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js
@@ -13,16 +13,18 @@
*/
class AutofillManager {
/**
- * Add an observer to the list of addresses.
- * @param {function(!Array<!AutofillManager.AddressEntry>):void} listener
+ * Add an observer to the list of personal data.
+ * @param {function(!Array<!AutofillManager.AddressEntry>,
+ * !Array<!PaymentsManager.CreditCardEntry>):void} listener
*/
- addAddressListChangedListener(listener) {}
+ setPersonalDataManagerListener(listener) {}
/**
- * Remove an observer from the list of addresses.
- * @param {function(!Array<!AutofillManager.AddressEntry>):void} listener
+ * Remove an observer from the list of personal data.
+ * @param {function(!Array<!AutofillManager.AddressEntry>,
+ * !Array<!PaymentsManager.CreditCardEntry>):void} listener
*/
- removeAddressListChangedListener(listener) {}
+ removePersonalDataManagerListener(listener) {}
/**
* Request the list of addresses.
@@ -49,13 +51,13 @@ AutofillManager.AddressEntry;
*/
class AutofillManagerImpl {
/** @override */
- addAddressListChangedListener(listener) {
- chrome.autofillPrivate.onAddressListChanged.addListener(listener);
+ setPersonalDataManagerListener(listener) {
+ chrome.autofillPrivate.onPersonalDataChanged.addListener(listener);
}
/** @override */
- removeAddressListChangedListener(listener) {
- chrome.autofillPrivate.onAddressListChanged.removeListener(listener);
+ removePersonalDataManagerListener(listener) {
+ chrome.autofillPrivate.onPersonalDataChanged.removeListener(listener);
}
/** @override */
@@ -117,21 +119,30 @@ Polymer({
autofillManager_: null,
/**
- * @type {?function(!Array<!AutofillManager.AddressEntry>)}
+ * @type {?function(!Array<!AutofillManager.AddressEntry>,
+ * !Array<!PaymentsManager.CreditCardEntry>)}
* @private
*/
- setAddressesListener_: null,
+ setPersonalDataListener_: null,
/** @override */
attached: function() {
// Create listener functions.
/** @type {function(!Array<!AutofillManager.AddressEntry>)} */
- const setAddressesListener = list => {
- this.addresses = list;
+ const setAddressesListener = addressList => {
+ this.addresses = addressList;
+ };
+
+ /**
+ * @type {function(!Array<!AutofillManager.AddressEntry>,
+ * !Array<!PaymentsManager.CreditCardEntry>)}
+ */
+ const setPersonalDataListener = (addressList, cardList) => {
+ this.addresses = addressList;
};
// Remember the bound reference in order to detach.
- this.setAddressesListener_ = setAddressesListener;
+ this.setPersonalDataListener_ = setPersonalDataListener;
// Set the managers. These can be overridden by tests.
this.autofillManager_ = AutofillManagerImpl.getInstance();
@@ -140,7 +151,8 @@ Polymer({
this.autofillManager_.getAddressList(setAddressesListener);
// Listen for changes.
- this.autofillManager_.addAddressListChangedListener(setAddressesListener);
+ this.autofillManager_.setPersonalDataManagerListener(
+ setPersonalDataListener);
// Record that the user opened the address settings.
chrome.metricsPrivate.recordUserAction('AutofillAddressesViewed');
@@ -148,9 +160,12 @@ Polymer({
/** @override */
detached: function() {
- this.autofillManager_.removeAddressListChangedListener(
- /** @type {function(!Array<!AutofillManager.AddressEntry>)} */ (
- this.setAddressesListener_));
+ this.autofillManager_.removePersonalDataManagerListener(
+ /**
+ @type {function(!Array<!AutofillManager.AddressEntry>,
+ !Array<!PaymentsManager.CreditCardEntry>)}
+ */
+ (this.setPersonalDataListener_));
},
/**
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 847f192031d..922166b2951 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
@@ -50,8 +50,7 @@
}
</style>
<div class="list-item" focus-row-container>
- <div class="website-column no-min-width"
- title="[[item.entry.urls.link]]">
+ <div class="website-column no-min-width">
<site-favicon url="[[item.entry.urls.link]]"></site-favicon>
<a id="originUrl" target="_blank" class="no-min-width"
href="[[item.entry.urls.link]]"
@@ -64,14 +63,17 @@
</a>
</div>
<input id="username" class="username-column password-field"
- readonly tabindex="-1" value="[[item.entry.username]]">
+ aria-label="$i18n{editPasswordUsernameLabel}"
+ readonly value="[[item.entry.username]]"
+ focus-row-control focus-type="username">
<div class="password-column">
<template is="dom-if" if="[[!item.entry.federationText]]">
<input id="password" aria-label=$i18n{editPasswordPasswordLabel}
type="[[getPasswordInputType_(item.password)]]"
on-click="onReadonlyInputTap_" class="password-field" readonly
disabled$="[[!item.password]]"
- value="[[getPassword_(item.password)]]">
+ value="[[getPassword_(item.password)]]"
+ focus-row-control focus-type="passwordField">
<cr-icon-button id="showPasswordButton"
class$="[[getIconClass_(item.password)]]"
on-click="onShowPasswordButtonTap_"
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 58e376e7433..2f569d3e4dc 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html
@@ -10,12 +10,14 @@
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/list_property_update_behavior.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-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="../controls/settings_toggle_button.html">
<link rel="import" href="../controls/extension_controlled_indicator.html">
+<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../global_scroll_target_behavior.html">
+<link rel="import" href="../people_page/sync_browser_proxy.html">
<link rel="import" href="../prefs/prefs.html">
<link rel="import" href="../prefs/prefs_behavior.html">
<link rel="import" href="../settings_shared_css.html">
@@ -73,16 +75,6 @@
</extension-controlled-indicator>
</div>
</template>
- <settings-toggle-button id="passwordsLeakDetectionCheckbox"
- pref="{{prefs.profile.password_manager_leak_detection}}"
- checked="[[getCheckedLeakDetection_(
- userSignedIn_, prefs.profile.password_manager_leak_detection)]]"
- label="$i18n{passwordsLeakDetectionLabel}"
- sub-label="[[getPasswordsLeakDetectionSubLabel_(
- userSignedIn_, prefs.profile.password_manager_leak_detection)]]"
- hidden$="[[!passwordsLeakDetectionEnabled_]]"
- disabled="[[!userSignedIn_]]">
- </settings-toggle-button>
<settings-toggle-button id="autosigninCheckbox"
pref="{{prefs.credentials_enable_autosignin}}"
label="$i18n{passwordsAutosigninLabel}"
@@ -108,7 +100,8 @@
</div>
<div class="list-frame">
<div id="savedPasswordsHeaders" class="list-item column-header"
- hidden$="[[!hasSome_(savedPasswords, savedPasswords.splices)]]">
+ hidden$="[[!hasSome_(savedPasswords, savedPasswords.splices)]]"
+ aria-hidden="true">
<div class="website-column">$i18n{editPasswordWebsiteLabel}</div>
<div class="username-column">
$i18n{editPasswordUsernameLabel}
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js
index a98d69646d4..0eabb41138a 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js
+++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js
@@ -102,12 +102,6 @@ Polymer({
},
/** @private */
- passwordsLeakDetectionEnabled_: {
- type: Boolean,
- value: loadTimeData.getBoolean('passwordsLeakDetectionEnabled'),
- },
-
- /** @private */
showExportPasswords_: {
type: Boolean,
computed: 'hasPasswords_(savedPasswords.splices)',
@@ -125,23 +119,12 @@ Polymer({
/** @private */
showPasswordEditDialog_: Boolean,
- // <if expr="not chromeos">
- /** @private {Array<!settings.StoredAccount>} */
- storedAccounts_: Object,
- // </if>
-
/** @private {settings.SyncPrefs} */
syncPrefs_: Object,
/** @private {settings.SyncStatus} */
syncStatus_: Object,
- /** @private */
- userSignedIn_: {
- type: Boolean,
- computed: 'computeUserSignedIn_(syncStatus_, storedAccounts_)',
- },
-
/** Filter on the saved passwords and exceptions. */
filter: {
type: String,
@@ -266,13 +249,6 @@ Polymer({
syncBrowserProxy.getSyncStatus().then(syncStatusChanged);
this.addWebUIListener('sync-status-changed', syncStatusChanged);
- // <if expr="not chromeos">
- const storedAccountsChanged = storedAccounts => this.storedAccounts_ =
- storedAccounts;
- syncBrowserProxy.getStoredAccounts().then(storedAccountsChanged);
- this.addWebUIListener('stored-accounts-updated', storedAccountsChanged);
- // </if>
-
const syncPrefsChanged = syncPrefs => this.syncPrefs_ = syncPrefs;
syncBrowserProxy.sendSyncPrefsChanged();
this.addWebUIListener('sync-prefs-changed', syncPrefsChanged);
@@ -363,24 +339,6 @@ Polymer({
},
/**
- * @return {boolean}
- * @private
- */
- computeUserSignedIn_: function() {
- return (!!this.syncStatus_ && !!this.syncStatus_.signedIn) ||
- (!!this.storedAccounts_ && this.storedAccounts_.length > 0);
- },
-
- /**
- * @return {boolean}
- * @private
- */
- getCheckedLeakDetection_: function() {
- return this.userSignedIn_ &&
- !!this.getPref('profile.password_manager_leak_detection').value;
- },
-
- /**
* @param {string} filter
* @return {!Array<!PasswordManagerProxy.UiEntryWithPassword>}
* @private
@@ -396,20 +354,6 @@ Polymer({
},
/**
- * @return {string}
- * @private
- */
- getPasswordsLeakDetectionSubLabel_: function() {
- if (this.userSignedIn_) {
- return this.i18n('passwordsLeakDetectionSignedInDescription');
- }
- if (this.getPref('profile.password_manager_leak_detection').value) {
- return this.i18n('passwordsLeakDetectionSignedOutEnabledDescription');
- }
- return this.i18n('passwordsLeakDetectionSignedOutDisabledDescription');
- },
-
- /**
* @param {string} filter
* @return {function(!chrome.passwordsPrivate.ExceptionEntry): boolean}
* @private
@@ -426,7 +370,9 @@ Polymer({
onMenuRemovePasswordTap_: function() {
this.passwordManager_.removeSavedPassword(
this.activePassword.item.entry.id);
- cr.toastManager.getInstance().show(this.i18n('passwordDeleted'), false);
+ cr.toastManager.getInstance().show(
+ this.i18n('passwordDeleted'),
+ /* showUndo */ true);
/** @type {CrActionMenuElement} */ (this.$.menu).close();
},
@@ -544,6 +490,6 @@ Polymer({
showImportOrExportPasswords_: function(
showExportPasswords, showImportPasswords) {
return showExportPasswords || showImportPasswords;
- }
+ },
});
})();
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 5836b23e617..2109d3395fd 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html
+++ b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html
@@ -42,6 +42,20 @@
pref="{{prefs.autofill.credit_card_enabled}}">
</settings-toggle-button>
<template is="dom-if"
+ if="[[shouldShowFidoToggle_(
+ prefs.autofill.credit_card_enabled.value,
+ userIsFidoVerifiable_)]]">
+ <settings-toggle-button
+ class="settings-box first"
+ id="autofillCreditCardFIDOAuthToggle"
+ aria-label="$i18n{creditCards}" no-extension-indicator
+ label="$i18n{enableCreditCardFIDOAuthLabel}"
+ sub-label="$i18n{enableCreditCardFIDOAuthSublabel}"
+ pref="{{prefs.autofill.credit_card_fido_auth_enabled}}"
+ on-change="setFIDOAuthenticationEnabledState_">
+ </settings-toggle-button>
+ </template>
+ <template is="dom-if"
if="[[prefs.autofill.credit_card_enabled.extensionId]]">
<div class="settings-box continuation">
<extension-controlled-indicator class="start"
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 03d51d23ebf..0c71a4b46c6 100644
--- a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js
+++ b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js
@@ -13,16 +13,18 @@
*/
class PaymentsManager {
/**
- * Add an observer to the list of credit cards.
- * @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener
+ * Add an observer to the list of personal data.
+ * @param {function(!Array<!AutofillManager.AddressEntry>,
+ * !Array<!PaymentsManager.CreditCardEntry>):void} listener
*/
- addCreditCardListChangedListener(listener) {}
+ setPersonalDataManagerListener(listener) {}
/**
- * Remove an observer from the list of credit cards.
- * @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener
+ * Remove an observer from the list of personal data.
+ * @param {function(!Array<!AutofillManager.AddressEntry>,
+ * !Array<!PaymentsManager.CreditCardEntry>):void} listener
*/
- removeCreditCardListChangedListener(listener) {}
+ removePersonalDataManagerListener(listener) {}
/**
* Request the list of credit cards.
@@ -51,6 +53,11 @@ class PaymentsManager {
* Logs that the server cards edit link was clicked.
*/
logServerCardLinkClicked() {}
+
+ /**
+ * Enables FIDO authentication for card unmasking.
+ */
+ setCreditCardFIDOAuthEnabledState(enabled) {}
}
/** @typedef {chrome.autofillPrivate.CreditCardEntry} */
@@ -62,13 +69,13 @@ PaymentsManager.CreditCardEntry;
*/
class PaymentsManagerImpl {
/** @override */
- addCreditCardListChangedListener(listener) {
- chrome.autofillPrivate.onCreditCardListChanged.addListener(listener);
+ setPersonalDataManagerListener(listener) {
+ chrome.autofillPrivate.onPersonalDataChanged.addListener(listener);
}
/** @override */
- removeCreditCardListChangedListener(listener) {
- chrome.autofillPrivate.onCreditCardListChanged.removeListener(listener);
+ removePersonalDataManagerListener(listener) {
+ chrome.autofillPrivate.onPersonalDataChanged.removeListener(listener);
}
/** @override */
@@ -100,6 +107,11 @@ class PaymentsManagerImpl {
logServerCardLinkClicked() {
chrome.autofillPrivate.logServerCardLinkClicked();
}
+
+ /** @override */
+ setCreditCardFIDOAuthEnabledState(enabled) {
+ chrome.autofillPrivate.setCreditCardFIDOAuthEnabledState(enabled);
+ }
}
cr.addSingletonGetter(PaymentsManagerImpl);
@@ -126,6 +138,18 @@ Polymer({
},
/**
+ * Set to true if user can be verified through FIDO authentication.
+ * @private
+ */
+ userIsFidoVerifiable_: {
+ type: Boolean,
+ value: function() {
+ return loadTimeData.getBoolean(
+ 'fidoAuthenticationAvailableForAutofill');
+ },
+ },
+
+ /**
* The model for any credit card related action menus or dialogs.
* @private {?chrome.autofillPrivate.CreditCardEntry}
*/
@@ -170,21 +194,39 @@ Polymer({
PaymentsManager_: null,
/**
- * @type {?function(!Array<!PaymentsManager.CreditCardEntry>)}
+ * @type {?function(!Array<!AutofillManager.AddressEntry>,
+ * !Array<!PaymentsManager.CreditCardEntry>)}
* @private
*/
- setCreditCardsListener_: null,
+ setPersonalDataListener_: null,
/** @override */
attached: function() {
// Create listener function.
/** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */
- const setCreditCardsListener = list => {
- this.creditCards = list;
+ const setCreditCardsListener = cardList => {
+ this.creditCards = cardList;
+ };
+
+ // Update |userIsFidoVerifiable_| based on the availability of a platform
+ // authenticator.
+ if (window.PublicKeyCredential) {
+ window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
+ .then(r => {
+ this.userIsFidoVerifiable_ = this.userIsFidoVerifiable_ && r;
+ });
+ }
+
+ /**
+ * @type {function(!Array<!AutofillManager.AddressEntry>,
+ * !Array<!PaymentsManager.CreditCardEntry>)}
+ */
+ const setPersonalDataListener = (addressList, cardList) => {
+ this.creditCards = cardList;
};
// Remember the bound reference in order to detach.
- this.setCreditCardsListener_ = setCreditCardsListener;
+ this.setPersonalDataListener_ = setPersonalDataListener;
// Set the managers. These can be overridden by tests.
this.paymentsManager_ = PaymentsManagerImpl.getInstance();
@@ -193,8 +235,8 @@ Polymer({
this.paymentsManager_.getCreditCardList(setCreditCardsListener);
// Listen for changes.
- this.paymentsManager_.addCreditCardListChangedListener(
- setCreditCardsListener);
+ this.paymentsManager_.setPersonalDataManagerListener(
+ setPersonalDataListener);
// Record that the user opened the payments settings.
chrome.metricsPrivate.recordUserAction('AutofillCreditCardsViewed');
@@ -202,9 +244,12 @@ Polymer({
/** @override */
detached: function() {
- this.paymentsManager_.removeCreditCardListChangedListener(
- /** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */ (
- this.setCreditCardsListener_));
+ this.paymentsManager_.removePersonalDataManagerListener(
+ /**
+ @type {function(!Array<!AutofillManager.AddressEntry>,
+ !Array<!PaymentsManager.CreditCardEntry>)}
+ */
+ (this.setPersonalDataListener_));
},
/**
@@ -311,6 +356,25 @@ Polymer({
},
/**
+ * @param {boolean} creditCardEnabled
+ * @return {boolean} Whether or not the user is verifiable through FIDO
+ * authentication.
+ * @private
+ */
+ shouldShowFidoToggle_: function(creditCardEnabled, userIsFidoVerifiable) {
+ return creditCardEnabled && userIsFidoVerifiable;
+ },
+
+ /**
+ * Listens for the enable-authentication event, and calls the private API.
+ * @private
+ */
+ setFIDOAuthenticationEnabledState_: function() {
+ this.paymentsManager_.setCreditCardFIDOAuthEnabledState(
+ this.$$('#autofillCreditCardFIDOAuthToggle').checked);
+ },
+
+ /**
* @param {!Array<!PaymentsManager.CreditCardEntry>} creditCards
* @param {boolean} creditCardEnabled
* @return {boolean} Whether to show the migration button.
diff --git a/chromium/chrome/browser/resources/settings/basic_page/BUILD.gn b/chromium/chrome/browser/resources/settings/basic_page/BUILD.gn
index ab89a35dd33..5cbc3c1c317 100644
--- a/chromium/chrome/browser/resources/settings/basic_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/basic_page/BUILD.gn
@@ -23,5 +23,5 @@ js_library("basic_page") {
"//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:web_ui_listener_behavior",
]
- externs_list = [ "$externs_path/pending.js" ]
+ externs_list = [ "$externs_path/pending_polymer.js" ]
}
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 46deb873d7d..7c40d63c9d1 100644
--- a/chromium/chrome/browser/resources/settings/basic_page/basic_page.html
+++ b/chromium/chrome/browser/resources/settings/basic_page/basic_page.html
@@ -119,8 +119,7 @@
$i18nRaw{osSettingsBannerText}
</div>
<cr-icon-button class="icon-clear"
- id="hideOSSettings"
- aria-label="$i18n{clear}"
+ title="$i18n{close}"
on-click="onOSSettingsBannerClosed_">
</cr-icon-button>
</div>
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 f2f0131a77c..f12eb098ddc 100644
--- a/chromium/chrome/browser/resources/settings/basic_page/basic_page.js
+++ b/chromium/chrome/browser/resources/settings/basic_page/basic_page.js
@@ -153,11 +153,6 @@ Polymer({
this.showChangePassword = visibility;
});
- if (loadTimeData.getBoolean('passwordProtectionAvailable')) {
- settings.ChangePasswordBrowserProxyImpl.getInstance()
- .initializeChangePasswordHandler();
- }
-
if (settings.AndroidAppsBrowserProxyImpl) {
this.addWebUIListener(
'android-apps-info-update', this.androidAppsInfoUpdate_.bind(this));
diff --git a/chromium/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn b/chromium/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn
index b883f4e20f1..75b6aea70fc 100644
--- a/chromium/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn
@@ -7,10 +7,12 @@ import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
":os_a11y_page",
+ "../../a11y_page:captions_subpage",
"../../a11y_page:externs",
"../../a11y_page:manage_a11y_page",
"../../a11y_page:switch_access_subpage",
"../../a11y_page:tts_subpage",
+ "../../appearance_page:fonts_browser_proxy",
]
}
diff --git a/chromium/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn b/chromium/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn
index b54af0ac04f..664cc90da69 100644
--- a/chromium/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn
@@ -13,8 +13,13 @@ js_type_check("closure_compile") {
js_library("os_apps_page") {
deps = [
"../../:route",
+ "../../android_apps_page:android_apps_browser_proxy",
+ "../../android_apps_page:android_apps_subpage",
+ "../../prefs:prefs_behavior",
"../../settings_page:settings_animated_pages",
"app_management_page",
+ "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:i18n_behavior",
]
externs_list = [ "$externs_path/metrics_private.js" ]
diff --git a/chromium/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn b/chromium/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn
index c9841d1a9d7..b0e0b80ace2 100644
--- a/chromium/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn
@@ -19,11 +19,9 @@ js_type_check("closure_compile") {
":fake_page_handler",
":main_view",
":permission_item",
- ":permission_toggle",
":pin_to_shelf_item",
":pwa_permission_view",
":reducers",
- ":router",
":store",
":store_client",
":toggle_row",
@@ -62,7 +60,6 @@ js_library("app_management_page") {
":actions",
":browser_proxy",
":main_view",
- ":router",
":store",
":store_client",
]
@@ -75,6 +72,7 @@ js_library("app_permission_view") {
":dom_switch",
":pwa_permission_view",
":store_client",
+ "../../..:route",
]
}
@@ -133,14 +131,8 @@ js_library("main_view") {
js_library("permission_item") {
deps = [
":fake_page_handler",
- ":permission_toggle",
":store_client",
- ":util",
- ]
-}
-
-js_library("permission_toggle") {
- deps = [
+ ":toggle_row",
":util",
]
}
@@ -171,14 +163,6 @@ js_library("reducers") {
]
}
-js_library("router") {
- deps = [
- ":actions",
- ":constants",
- ":store_client",
- ]
-}
-
js_library("store") {
deps = [
":reducers",
@@ -218,6 +202,7 @@ js_library("uninstall_button") {
":util",
"//ui/webui/resources/cr_elements/cr_button:cr_button",
"//ui/webui/resources/cr_elements/policy:cr_tooltip_icon",
+ "//ui/webui/resources/js:i18n_behavior",
]
}
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
index 058863d4b69..6aa19594fe9 100644
--- a/chromium/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn
@@ -18,7 +18,7 @@ js_library("os_settings_ui") {
"../os_settings_main:os_settings_main",
"../os_toolbar",
"//ui/webui/resources/cr_elements:cr_container_shadow_behavior",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
+ "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_strings",
"//ui/webui/resources/cr_elements/cr_drawer:cr_drawer",
"//ui/webui/resources/cr_elements/cr_toolbar:cr_toolbar_search_field",
"//ui/webui/resources/cr_elements/policy:cr_policy_indicator_behavior",
diff --git a/chromium/chrome/browser/resources/settings/controls/controlled_button.html b/chromium/chrome/browser/resources/settings/controls/controlled_button.html
index af328098f62..79fb7d2e405 100644
--- a/chromium/chrome/browser/resources/settings/controls/controlled_button.html
+++ b/chromium/chrome/browser/resources/settings/controls/controlled_button.html
@@ -42,7 +42,7 @@
}
</style>
- <cr-button class$="[[getClass_(actionButton)]]"
+ <cr-button class$="[[actionClass_]]"
disabled="[[!buttonEnabled_(enforced_, disabled)]]">
[[label]]
</cr-button>
diff --git a/chromium/chrome/browser/resources/settings/controls/controlled_button.js b/chromium/chrome/browser/resources/settings/controls/controlled_button.js
index 43f07fd36c0..e751237cab2 100644
--- a/chromium/chrome/browser/resources/settings/controls/controlled_button.js
+++ b/chromium/chrome/browser/resources/settings/controls/controlled_button.js
@@ -11,11 +11,6 @@ Polymer({
],
properties: {
- actionButton: {
- type: Boolean,
- value: false,
- },
-
endJustified: {
type: Boolean,
value: false,
@@ -31,6 +26,12 @@ Polymer({
},
/** @private */
+ actionClass_: {
+ type: String,
+ value: ''
+ },
+
+ /** @private */
enforced_: {
type: Boolean,
computed: 'isPrefEnforced(pref.*)',
@@ -38,6 +39,18 @@ Polymer({
},
},
+ /** @override */
+ attached: function() {
+ if (this.classList.contains('action-button')) {
+ this.actionClass_ = 'action-button';
+ }
+ },
+
+ /** Focus on the inner cr-button. */
+ focus: function() {
+ this.$$('cr-button').focus();
+ },
+
/**
* @param {!Event} e
* @private
@@ -49,15 +62,6 @@ Polymer({
},
/**
- * @param {!boolean} actionButton
- * @return {string} Class of the cr-button.
- * @private
- */
- getClass_: function(actionButton) {
- return actionButton ? 'action-button' : '';
- },
-
- /**
* @param {!boolean} enforced
* @param {!boolean} disabled
* @return {boolean} True if the button should be enabled.
diff --git a/chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.html b/chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.html
index 4a0026ee454..810fd0b8b00 100644
--- a/chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.html
+++ b/chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.html
@@ -13,13 +13,16 @@
}
#passwordPrompt {
- padding: 0;
+ padding-bottom: 20px;
+ padding-inline-end: 0;
+ padding-inline-start: 0;
}
</style>
<cr-dialog id="dialog" close-text="$i18n{close}">
<div slot="title">$i18n{passwordPromptTitle}</div>
<div slot="body">
- <div id="passwordPrompt" class="settings-box first line-only">
+ <div id="passwordPrompt" class="settings-box first"
+ hidden="[[!passwordPromptText]]">
[[passwordPromptText]]
</div>
<cr-input id="passwordInput" type="password"
diff --git a/chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.js b/chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.js
index 2fc160bfb77..574dd209c16 100644
--- a/chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.js
+++ b/chromium/chrome/browser/resources/settings/controls/password_prompt_dialog.js
@@ -34,6 +34,7 @@ Polymer({
passwordPromptText: {
type: String,
notify: true,
+ value: '',
},
/**
diff --git a/chromium/chrome/browser/resources/settings/device_page/BUILD.gn b/chromium/chrome/browser/resources/settings/device_page/BUILD.gn
index d7d0c1e13fd..1826cc4de8d 100644
--- a/chromium/chrome/browser/resources/settings/device_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/device_page/BUILD.gn
@@ -12,7 +12,6 @@ js_type_check("closure_compile") {
":display_layout",
":display_overscan_dialog",
":drag_behavior",
- ":drive_cache_dialog",
":keyboard",
":layout_behavior",
":night_light_slider",
@@ -148,10 +147,3 @@ js_library("storage") {
"//ui/webui/resources/js/cr/ui:focus_without_ink",
]
}
-
-js_library("drive_cache_dialog") {
- deps = [
- "//ui/webui/resources/js:i18n_behavior",
- ]
- externs_list = [ "$externs_path/chrome_send.js" ]
-}
diff --git a/chromium/chrome/browser/resources/settings/device_page/display.html b/chromium/chrome/browser/resources/settings/device_page/display.html
index 5b906f084eb..cee6fafa793 100644
--- a/chromium/chrome/browser/resources/settings/device_page/display.html
+++ b/chromium/chrome/browser/resources/settings/device_page/display.html
@@ -241,12 +241,13 @@
pref="{{prefs.ash.night_light.enabled}}"
sub-label="$i18n{displayNightLightText}">
</settings-toggle-button>
+
<div id="nightLightSettingsDiv"
class="settings-box continuation start layout vertical">
<!-- Color temperature slider -->
<div id="nightLightTemperatureDiv"
class="settings-box indented continuation"
- disabled$="[[!prefs.ash.night_light.enabled.value]]">
+ hidden$="[[!prefs.ash.night_light.enabled.value]]">
<div class="start text-area" id="colorTemperatureLabel">
$i18n{displayNightLightTemperatureLabel}
</div>
@@ -254,8 +255,7 @@
aria-labelledby="colorTemperatureLabel" min="0" max="100"
scale="100" label-min="$i18n{displayNightLightTempSliderMinLabel}"
label-max="$i18n{displayNightLightTempSliderMaxLabel}"
- pref="{{prefs.ash.night_light.color_temperature}}"
- disabled$="[[!prefs.ash.night_light.enabled.value]]">
+ pref="{{prefs.ash.night_light.color_temperature}}">
</settings-slider>
</div>
<!-- Schedule settings -->
@@ -278,7 +278,7 @@
</div>
<!-- Custom schedule slider -->
<iron-collapse id="nightLightCustomScheduleCollapse"
- opened="[[shouldOpenCustomScheduleCollapse_]]">
+ opened="[[shouldOpenCustomScheduleCollapse_]]">
<div class="settings-box indented continuation">
<div class="start text-area layout vertical">
<div class="settings-box continuation self-stretch">
diff --git a/chromium/chrome/browser/resources/settings/device_page/drive_cache_dialog.html b/chromium/chrome/browser/resources/settings/device_page/drive_cache_dialog.html
deleted file mode 100644
index 00e43a44464..00000000000
--- a/chromium/chrome/browser/resources/settings/device_page/drive_cache_dialog.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.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="../settings_shared_css.html">
-
-<dom-module id="settings-drive-cache-dialog">
- <template>
- <style include="settings-shared"></style>
- <cr-dialog id="dialog" close-text="$i18n{close}">
- <div slot="title">
- $i18n{storageClearDriveCacheDialogTitle}
- </div>
- <div slot="body">
- <span>$i18n{storageClearDriveCacheDialogDescription}</span>
- </div>
- <div slot="button-container">
- <cr-button id="cancelButton" class="cancel-button"
- on-click="onCancelTap_">
- $i18n{cancel}
- </cr-button>
- <cr-button id="deleteButton" class="action-button"
- on-click="onDeleteTap_">
- $i18n{storageDeleteAllButtonTitle}
- </cr-button>
- </div>
- </cr-dialog>
- </template>
- <script src="drive_cache_dialog.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/device_page/drive_cache_dialog.js b/chromium/chrome/browser/resources/settings/device_page/drive_cache_dialog.js
deleted file mode 100644
index fd63087ec6a..00000000000
--- a/chromium/chrome/browser/resources/settings/device_page/drive_cache_dialog.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.
-
-/**
- * @fileoverview
- * 'settings-drive-cache-dialog' is the dialog to delete Google Drive temporary
- * offline files.
- */
-Polymer({
- is: 'settings-drive-cache-dialog',
-
- behaviors: [
- I18nBehavior,
- ],
-
- open: function() {
- this.$.dialog.showModal();
- },
-
- /** @private */
- onCancelTap_: function() {
- this.$.dialog.cancel();
- },
-
- /** @private */
- onDeleteTap_: function() {
- chrome.send('clearDriveCache');
- this.$.dialog.close();
- },
-});
diff --git a/chromium/chrome/browser/resources/settings/device_page/keyboard.js b/chromium/chrome/browser/resources/settings/device_page/keyboard.js
index 4c189aa6727..a636592e369 100644
--- a/chromium/chrome/browser/resources/settings/device_page/keyboard.js
+++ b/chromium/chrome/browser/resources/settings/device_page/keyboard.js
@@ -155,7 +155,7 @@ Polymer({
onShowLanguageInputTap_: function() {
settings.navigateTo(
- settings.routes.LANGUAGES,
+ settings.routes.LANGUAGES_DETAILS,
/* dynamicParams */ null, /* removeSearch */ true);
},
diff --git a/chromium/chrome/browser/resources/settings/device_page/pointers.html b/chromium/chrome/browser/resources/settings/device_page/pointers.html
index fff070da29c..6a628f2f5b2 100644
--- a/chromium/chrome/browser/resources/settings/device_page/pointers.html
+++ b/chromium/chrome/browser/resources/settings/device_page/pointers.html
@@ -46,7 +46,7 @@
<template is="dom-if" if="[[allowDisableAcceleration_]]">
<settings-toggle-button id="mouseAcceleration"
pref="{{prefs.settings.mouse.acceleration}}"
- label="$i18n{pointerAccelerationLabel}">
+ label="$i18n{mouseAccelerationLabel}">
</settings-toggle-button>
</template>
<div class="settings-box">
@@ -75,7 +75,7 @@
<template is="dom-if" if="[[allowDisableAcceleration_]]">
<settings-toggle-button id="touchpadAcceleration"
pref="{{prefs.settings.touchpad.acceleration}}"
- label="$i18n{pointerAccelerationLabel}">
+ label="$i18n{touchpadAccelerationLabel}">
</settings-toggle-button>
</template>
<div class="settings-box">
diff --git a/chromium/chrome/browser/resources/settings/device_page/storage.html b/chromium/chrome/browser/resources/settings/device_page/storage.html
index f0a518e2572..6526d4f1fb1 100644
--- a/chromium/chrome/browser/resources/settings/device_page/storage.html
+++ b/chromium/chrome/browser/resources/settings/device_page/storage.html
@@ -8,7 +8,6 @@
<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="drive_cache_dialog.html">
<link rel="import" href="storage_external.html">
<link rel="import" href="../prefs/prefs.html">
<link rel="import" href="../route.html">
@@ -201,20 +200,6 @@
<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_]]" >
- <div class="start">
- $i18n{storageItemDriveCache}
- <div id="driveCacheSize" class="secondary">
- $i18n{storageSizeComputing}
- </div>
- </div>
- <cr-icon-button class="icon-delete-gray" id="deleteButton"
- aria-label="$i18n{storageItemDriveCache}"
- aria-describedby="driveSizeCache"></cr-icon-button>
- </div>
- </template>
<cr-link-row id="browsingDataSize" class="hr" on-click="onBrowsingDataTap_"
label="$i18n{storageItemBrowsingData}"
sub-label="$i18n{storageSizeComputing}" external></cr-link-row>
@@ -238,10 +223,6 @@
on-click="onExternalStoragePreferencesTap_"
label="$i18n{storageExternal}"></cr-link-row>
</template>
-
- <settings-drive-cache-dialog id="storageDriveCache"
- on-close="onCloseDriveCacheDialog_">
- </settings-drive-cache-dialog>
</template>
<script src="storage.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/device_page/storage.js b/chromium/chrome/browser/resources/settings/device_page/storage.js
index 2717462da66..ae7598fdbba 100644
--- a/chromium/chrome/browser/resources/settings/device_page/storage.js
+++ b/chromium/chrome/browser/resources/settings/device_page/storage.js
@@ -37,12 +37,6 @@ Polymer({
behaviors: [settings.RouteObserverBehavior, WebUIListenerBehavior],
properties: {
- /** @private */
- driveEnabled_: {
- type: Boolean,
- value: false,
- },
-
androidEnabled: Boolean,
/** @private */
@@ -68,12 +62,6 @@ Polymer({
}
},
- /** @private */
- hasDriveCache_: {
- type: Boolean,
- value: false,
- },
-
/** @private {settings.StorageSizeStat} */
sizeStat_: Object,
},
@@ -94,9 +82,6 @@ Polymer({
'storage-downloads-size-changed',
this.handleDownloadsSizeChanged_.bind(this));
this.addWebUIListener(
- 'storage-drive-cache-size-changed',
- this.handleDriveCacheSizeChanged_.bind(this));
- this.addWebUIListener(
'storage-browsing-data-size-changed',
this.handleBrowsingDataSizeChanged_.bind(this));
this.addWebUIListener(
@@ -111,9 +96,6 @@ Polymer({
this.handleOtherUsersSizeChanged_.bind(this));
}
this.addWebUIListener(
- 'storage-drive-enabled-changed',
- this.handleDriveEnabledChanged_.bind(this));
- this.addWebUIListener(
'storage-android-running-changed',
this.handleAndroidRunningChanged_.bind(this));
},
@@ -146,18 +128,6 @@ Polymer({
},
/**
- * Handler for tapping the "Offline files" item.
- * @param {!Event} e
- * @private
- */
- onDriveCacheTap_: function(e) {
- e.preventDefault();
- if (this.hasDriveCache_) {
- this.$.storageDriveCache.open();
- }
- },
-
- /**
* Handler for tapping the "Browsing data" item.
* @private
*/
@@ -221,19 +191,6 @@ Polymer({
},
/**
- * @param {string} size Formatted string representing the size of Offline
- * files.
- * @param {boolean} hasCache True if the device has at least one offline file.
- * @private
- */
- handleDriveCacheSizeChanged_: function(size, hasCache) {
- if (this.driveEnabled_) {
- this.$$('#driveCacheSize').textContent = size;
- this.hasDriveCache_ = hasCache;
- }
- },
-
- /**
* @param {string} size Formatted string representing the size of Browsing
* data.
* @private
@@ -275,14 +232,6 @@ Polymer({
},
/**
- * @param {boolean} enabled True if Google Drive is enabled.
- * @private
- */
- handleDriveEnabledChanged_: function(enabled) {
- this.driveEnabled_ = enabled;
- },
-
- /**
* @param {boolean} running True if Android (ARC) is running.
* @private
*/
@@ -362,9 +311,4 @@ Polymer({
return '';
}
},
-
- /** @private */
- onCloseDriveCacheDialog_: function() {
- cr.ui.focusWithoutInk(assert(this.$$('#deleteButton')));
- },
});
diff --git a/chromium/chrome/browser/resources/settings/device_page/storage_external.html b/chromium/chrome/browser/resources/settings/device_page/storage_external.html
index 922c2613d1f..da2d3cafc7d 100644
--- a/chromium/chrome/browser/resources/settings/device_page/storage_external.html
+++ b/chromium/chrome/browser/resources/settings/device_page/storage_external.html
@@ -15,7 +15,7 @@
</style>
<div class="settings-box first">
<span>
- $i18n{storageAndroidAppsExternalDrivesNote}
+ $i18nRaw{storageAndroidAppsExternalDrivesNote}
</span>
</div>
<h2>$i18n{storageExternalStorageListHeader}</h2>
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 131565b3c41..52053aae4d7 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
@@ -58,12 +58,9 @@
<div class="label">
$i18n{googleAssistantEnableHotword}
</div>
- <div class="secondary label" hidden="[[!hotwordDefaultOn_]]">
+ <div class="secondary label">
$i18n{googleAssistantEnableHotwordWithoutDspDescription}
</div>
- <div class="secondary label" hidden="[[hotwordDefaultOn_]]">
- $i18n{googleAssistantEnableHotwordDescription}
- </div>
</div>
<template is="dom-if" if="[[hotwordEnforced_]]" restamp>
<cr-policy-pref-indicator id="hotword-policy-pref-indicator"
@@ -87,7 +84,7 @@
</select>
</div>
<template is="dom-if" if="[[shouldShowVoiceMatchSettings_]]">
- <div class="settings-box">
+ <div class="settings-box continuation embedded">
<div class="start text-area settings-box-text">
<div class="label">
$i18n{googleAssistantVoiceSettings}
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 559d65184d1..5237e0168f7 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
@@ -15,8 +15,8 @@ const DspHotwordState = {
/**
* Indicates user's activity control consent status.
*
- * Note: This should be kept in sync with ash::mojom::ConsentStatus in
- * ash/public/mojom/voice_interaction_controller.mojom
+ * Note: This should be kept in sync with ConsentStatus in
+ * chromeos/services/assistant/public/cpp/assistant_prefs.h
* @enum {number}
*/
const ConsentStatus = {
@@ -97,12 +97,6 @@ Polymer({
},
/** @private */
- hotwordDefaultOn_: {
- type: Boolean,
- value: false,
- },
-
- /** @private */
dspHotwordState_: {
type: DspHotwordState,
}
@@ -166,20 +160,17 @@ Polymer({
this.setPrefValue('settings.voice_interaction.hotword.enabled', true);
this.setPrefValue(
'settings.voice_interaction.hotword.always_on', false);
- this.hotwordDefaultOn_ = true;
this.browserProxy_.syncVoiceModelStatus();
break;
case DspHotwordState.ALWAYS_ON:
this.setPrefValue('settings.voice_interaction.hotword.enabled', true);
this.setPrefValue('settings.voice_interaction.hotword.always_on', true);
- this.hotwordDefaultOn_ = false;
this.browserProxy_.syncVoiceModelStatus();
break;
case DspHotwordState.OFF:
this.setPrefValue('settings.voice_interaction.hotword.enabled', false);
this.setPrefValue(
'settings.voice_interaction.hotword.always_on', false);
- this.hotwordDefaultOn_ = false;
break;
default:
console.error('Invalid Dsp hotword settings state');
@@ -205,6 +196,7 @@ Polymer({
this.refreshDspHotwordState_();
this.shouldShowVoiceMatchSettings_ =
+ !loadTimeData.getBoolean('voiceMatchDisabled') &&
this.getPref('settings.voice_interaction.hotword.enabled.value') &&
(this.getPref(
'settings.voice_interaction.activity_control.consent_status.value') ==
@@ -220,14 +212,11 @@ Polymer({
/** @private */
refreshDspHotwordState_: function() {
if (!this.getPref('settings.voice_interaction.hotword.enabled.value')) {
- this.hotwordDefaultOn_ = false;
this.dspHotwordState_ = DspHotwordState.OFF;
} else if (this.getPref(
'settings.voice_interaction.hotword.always_on.value')) {
- this.hotwordDefaultOn_ = false;
this.dspHotwordState_ = DspHotwordState.ALWAYS_ON;
} else {
- this.hotwordDefaultOn_ = true;
this.dspHotwordState_ = DspHotwordState.DEFAULT_ON;
}
diff --git a/chromium/chrome/browser/resources/settings/icons.html b/chromium/chrome/browser/resources/settings/icons.html
index ad722128231..595f018d907 100644
--- a/chromium/chrome/browser/resources/settings/icons.html
+++ b/chromium/chrome/browser/resources/settings/icons.html
@@ -74,6 +74,7 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html.
<g id="pdf"><path d="M7 11.5h1v-1H7v1zM19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-9.5 8.5c0 .83-.67 1.5-1.5 1.5H7v2H5.5V9H8c.83 0 1.5.67 1.5 1.5v1zm10-1H17v1h1.5V13H17v2h-1.5V9h4v1.5zm-5 3c0 .83-.67 1.5-1.5 1.5h-2.5V9H13c.83 0 1.5.67 1.5 1.5v3zm-2.5 0h1v-3h-1v3z"></path><path fill="none" d="M0 0h24v24H0z"></path></g>
<g id="palette"><path d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path></g>
<g id="payment-handler"><path d="M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"></path></g>
+ <g id="insecure-content"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></g>
<g id="photo"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"></path></g>
<g id="power-settings-new"><path d="M13 3h-2v10h2V3zm4.83 2.17l-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83z"></path></g>
<g id="protocol-handler"><path d="M21.72 11.33l-6.644-7.035a.97.97 0 0 0-1.38-.01l-1.67 1.72-1.617-1.712a.97.97 0 0 0-1.38-.01l-6.737 6.935c-.187.191-.29.447-.292.719-.002.272.099.529.28.722l6.644 7.034a.949.949 0 0 0 1.38.011l1.671-1.718 1.615 1.71a.949.949 0 0 0 1.381.01l6.74-6.935a1.054 1.054 0 0 0 .01-1.44zM6.947 12.464l3.657 3.785-.974.98-5.273-5.456 5.349-5.378.929.962-3.677 3.7a.998.998 0 0 0-.292.702 1 1 0 0 0 .28.705zm7.35 4.768l-.931-.963 3.68-3.7a1.012 1.012 0 0 0 .007-1.407l-3.656-3.784.974-.98 5.273 5.456-5.348 5.378z"></path></g>
diff --git a/chromium/chrome/browser/resources/settings/internet_page/BUILD.gn b/chromium/chrome/browser/resources/settings/internet_page/BUILD.gn
index 7b8a8fa0718..5aa49429248 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/internet_page/BUILD.gn
@@ -28,7 +28,6 @@ js_library("internet_page") {
"//chromeos/services/network_config/public/mojom:mojom_js_library_for_compile",
"//ui/webui/resources/cr_components/chromeos/network:mojo_interface_provider",
"//ui/webui/resources/cr_elements/chromeos/network:cr_network_listener_behavior",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:i18n_behavior",
"//ui/webui/resources/js:web_ui_listener_behavior",
@@ -51,7 +50,6 @@ js_library("internet_config") {
deps = [
"..:route",
"//ui/webui/resources/cr_components/chromeos/network:network_config",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
"//ui/webui/resources/cr_elements/cr_dialog:cr_dialog",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:i18n_behavior",
@@ -67,7 +65,6 @@ js_library("internet_detail_page") {
":tether_connection_dialog",
"..:route",
"//ui/webui/resources/cr_elements/chromeos/network:cr_network_listener_behavior",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
"//ui/webui/resources/cr_elements/policy:cr_policy_network_behavior_mojo",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:i18n_behavior",
@@ -82,7 +79,6 @@ js_library("internet_detail_page") {
js_library("internet_known_networks_page") {
deps = [
"//ui/webui/resources/cr_elements/chromeos/network:cr_network_listener_behavior",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
"//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu",
"//ui/webui/resources/cr_elements/policy:cr_policy_network_behavior_mojo",
"//ui/webui/resources/js:assert",
@@ -122,7 +118,6 @@ js_library("network_proxy_section") {
js_library("network_summary") {
deps = [
"//ui/webui/resources/cr_elements/chromeos/network:cr_network_listener_behavior",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js/chromeos:onc_mojo",
]
@@ -131,7 +126,7 @@ js_library("network_summary") {
js_library("network_summary_item") {
deps = [
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
+ "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_strings",
"//ui/webui/resources/cr_elements/policy:cr_policy_network_behavior_mojo",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:i18n_behavior",
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_config.html b/chromium/chrome/browser/resources/settings/internet_page/internet_config.html
index df873613ea5..65ef26edeee 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_config.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_config.html
@@ -1,7 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_components/chromeos/network/network_config.html">
-<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html">
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
@@ -23,13 +22,11 @@
<cr-dialog id="dialog" close-text="$i18n{close}">
<div slot="title">
- [[getDialogTitle_(managedProperties_, showConnect)]]
+ [[getDialogTitle_(name, type, showConnect)]]
</div>
<div slot="body">
<network-config id="networkConfig" class="flex"
- networking-private="[[networkingPrivate]]"
- global-policy="[[globalPolicy]]"
- managed-properties="{{managedProperties_}}"
+ guid="[[guid]]" name="{{name}}" type="{{type}}"
enable-connect="{{enableConnect_}}" enable-save="{{enableSave_}}"
share-allow-enable="[[shareAllowEnable_]]"
share-default="[[shareDefault_]]"
diff --git a/chromium/chrome/browser/resources/settings/internet_page/internet_config.js b/chromium/chrome/browser/resources/settings/internet_page/internet_config.js
index 0b3760d0477..d5bd42d5da2 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_config.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_config.js
@@ -12,15 +12,6 @@ Polymer({
behaviors: [I18nBehavior],
properties: {
- /**
- * Interface for networkingPrivate calls, passed from internet_page.
- * @type {NetworkingPrivate}
- */
- networkingPrivate: Object,
-
- /** @type {!chrome.networkingPrivate.GlobalPolicy|undefined} */
- globalPolicy: Object,
-
/** @private */
shareAllowEnable_: {
type: Boolean,
@@ -44,13 +35,14 @@ Polymer({
guid: String,
/**
- * The type of network to be configured.
- * @type {!chrome.networkingPrivate.NetworkType}
+ * The type of network to be configured as a string. May be set initially or
+ * updated by network-config.
*/
type: String,
/**
- * The name of network (for display while the network details are fetched).
+ * The name of the network. May be set initially or updated by
+ * network-config.
*/
name: String,
@@ -66,14 +58,6 @@ Polymer({
enableSave_: Boolean,
/**
- * The current properties if an existing network is being configured, or
- * a minimal subset for a new network. Note: network-config may modify
- * this (specifically .name).
- * @private {!chrome.networkingPrivate.ManagedProperties}
- */
- managedProperties_: Object,
-
- /**
* Set by network-config when a configuration error occurs.
* @private
*/
@@ -89,14 +73,6 @@ Polymer({
dialog.showModal();
}
- // Set managedProperties for new configurations and for existing
- // configurations until the current properties are loaded.
- assert(this.type && this.type != CrOnc.Type.ALL);
- this.managedProperties_ = {
- GUID: this.guid,
- Name: {Active: this.name},
- Type: this.type,
- };
this.$.networkConfig.init();
},
@@ -113,7 +89,6 @@ Polymer({
*/
onClose_: function(event) {
this.close();
- event.stopPropagation();
},
/**
@@ -121,18 +96,10 @@ Polymer({
* @private
*/
getDialogTitle_: function() {
- // If no properties are available yet, wait until they are set as part of
- // open().
- if (!this.managedProperties_) {
- return '';
- }
-
- const name = /** @type {string} */ (
- CrOnc.getActiveValue(this.managedProperties_.Name));
- if (name && !this.showConnect) {
- return this.i18n('internetConfigName', HTMLEscape(name));
+ if (this.name && !this.showConnect) {
+ return this.i18n('internetConfigName', HTMLEscape(this.name));
}
- const type = this.i18n('OncType' + this.managedProperties_.Type);
+ const type = this.i18n('OncType' + this.type);
return this.i18n('internetJoinType', type);
},
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 c78ca56e50b..2d27c7dc86d 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
@@ -8,7 +8,6 @@
<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/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_button/cr_button.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_toggle/cr_toggle.html">
@@ -68,10 +67,15 @@
paper-spinner-lite {
@apply --cr-icon-height-width;
}
+
.warning {
color: var(--cr-secondary-text-color);
margin-inline-start: var(--settings-controlled-by-spacing);
}
+
+ #mac-address-container {
+ border-top: none;
+ }
</style>
<!-- Title section: Icon + name + connection state. -->
<div id="titleDiv" class="settings-box first">
@@ -83,9 +87,9 @@
<div id="networkState" class="title settings-box-text"
connected$="[[isConnectedState_(managedProperties_)]]"
error$="[[isConnectionErrorState_(
- managedProperties_, outOfRange_)]]">
+ managedProperties_, outOfRange_, deviceState_)]]">
[[getStateText_(managedProperties_, propertiesReceived_,
- outOfRange_)]]
+ outOfRange_, deviceState_)]]
</div>
<template is="dom-if"
if="[[isPolicySource(managedProperties_.source))]]">
@@ -118,17 +122,18 @@
</cr-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_"
+ <controlled-button id="connect" class="action-button"
+ on-click="onConnectTap_"
hidden$="[[!showConnect_(managedProperties_, globalPolicy,
- managedNetworkAvailable)]]"
+ managedNetworkAvailable, deviceState_)]]"
disabled="[[!enableConnect_(managedProperties_, defaultNetwork,
propertiesReceived_, outOfRange_, globalPolicy,
- managedNetworkAvailable)]]"
+ managedNetworkAvailable, deviceState_)]]"
label="$i18n{networkButtonConnect}"
pref="[[getFakeVpnConfigPrefForEnforcement_(managedProperties_,
prefs.vpn_config_allowed)]]">
</controlled-button>
- <controlled-button id="disconnect" action-button
+ <controlled-button id="disconnect" class="action-button"
on-click="onDisconnectTap_"
hidden$="[[!showDisconnect_(managedProperties_)]]"
label="$i18n{networkButtonDisconnect}"
@@ -324,6 +329,7 @@
<!-- MAC Address. -->
<div class="settings-box two-line single-column stretch indented"
+ id="mac-address-container"
hidden$="[[!deviceState_.macAddress]]">
<div>$i18n{OncMacAddress}</div>
<div class="secondary">[[deviceState_.macAddress]]</div>
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 3dd71d9ff20..7c15915a2c8 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
@@ -104,12 +104,6 @@ Polymer({
},
/**
- * Interface for networkingPrivate calls, passed from internet_page.
- * @type {NetworkingPrivate}
- */
- networkingPrivate: Object,
-
- /**
* The network AutoConnect state as a fake preference object.
* @private {!chrome.settingsPrivate.PrefObject|undefined}
*/
@@ -205,12 +199,7 @@ Polymer({
/** @private {settings.InternetPageBrowserProxy} */
browserProxy_: null,
- /**
- * This UI will use both the networkingPrivate extension API and the
- * networkConfig mojo API until we provide all of the required functionality
- * in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api.
- * @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote}
- */
+ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfig_: null,
/** @override */
@@ -355,10 +344,9 @@ Polymer({
if (!this.didSetFocus_) {
// Focus a button once the initial state is set.
this.didSetFocus_ = true;
- const button = this.$$('#titleDiv .action-button:not([hidden])') ||
- this.$$('#titleDiv cr-button:not([hidden])');
+ const button = this.$$('#titleDiv .action-button:not([hidden])');
if (button) {
- setTimeout(() => button.focus());
+ Polymer.RenderStatus.afterNextRender(this, () => button.focus());
}
}
@@ -389,7 +377,7 @@ Polymer({
if (!this.propertiesReceived_) {
return;
}
- const config = {};
+ const config = this.getDefaultConfigProperties_();
config.autoConnect = {value: !!this.autoConnectPref_.value};
this.setMojoNetworkProperties_(config);
},
@@ -441,7 +429,7 @@ Polymer({
if (!this.propertiesReceived_) {
return;
}
- const config = {};
+ const config = this.getDefaultConfigProperties_();
config.priority = {value: this.preferNetwork_ ? 1 : 0};
this.setMojoNetworkProperties_(config);
},
@@ -451,7 +439,7 @@ Polymer({
const filter = {
filter: mojom.FilterType.kVisible,
networkType: mojom.NetworkType.kAll,
- limit: mojom.kNoLimit,
+ limit: mojom.NO_LIMIT,
};
this.networkConfig_.getNetworkState(this.guid).then(response => {
if (response.result) {
@@ -522,10 +510,25 @@ Polymer({
this.close();
return;
}
+
const managedProperties = OncMojo.getDefaultManagedProperties(
networkState.type, networkState.guid, networkState.name);
managedProperties.connectable = networkState.connectable;
managedProperties.connectionState = networkState.connectionState;
+ switch (networkState.type) {
+ case mojom.NetworkType.kCellular:
+ managedProperties.typeProperties.cellular.signalStrength =
+ networkState.typeState.cellular.signalStrength;
+ break;
+ case mojom.NetworkType.kTether:
+ managedProperties.typeProperties.tether.signalStrength =
+ networkState.typeState.tether.signalStrength;
+ break;
+ case mojom.NetworkType.kWiFi:
+ managedProperties.typeProperties.wifi.signalStrength =
+ networkState.typeState.wifi.signalStrength;
+ break;
+ }
this.managedProperties_ = managedProperties;
this.propertiesReceived_ = true;
@@ -544,6 +547,14 @@ Polymer({
},
/**
+ * @return {!mojom.ConfigProperties}
+ * @private
+ */
+ getDefaultConfigProperties_: function() {
+ return OncMojo.getDefaultConfigProperties(this.managedProperties_.type);
+ },
+
+ /**
* @param {!mojom.ConfigProperties} config
* @private
*/
@@ -565,15 +576,17 @@ Polymer({
* @param {!mojom.ManagedProperties} managedProperties
* @param {boolean} propertiesReceived
* @param {boolean} outOfRange
+ * @param {?OncMojo.DeviceStateProperties} deviceState
* @return {string} The text to display for the network connection state.
* @private
*/
- getStateText_: function(managedProperties, propertiesReceived, outOfRange) {
+ getStateText_: function(
+ managedProperties, propertiesReceived, outOfRange, deviceState) {
if (!managedProperties || !propertiesReceived) {
return '';
}
- if (outOfRange) {
+ if (this.isOutOfRangeOrNotEnabled_(outOfRange, deviceState)) {
return managedProperties.type == mojom.NetworkType.kTether ?
this.i18n('tetherPhoneOutOfRange') :
this.i18n('networkOutOfRange');
@@ -581,11 +594,11 @@ Polymer({
if (managedProperties.type == mojom.NetworkType.kCellular &&
!managedProperties.connectable) {
- if (managedProperties.cellular.homeProvider &&
- managedProperties.cellular.homeProvider.name) {
+ if (managedProperties.typeProperties.cellular.homeProvider &&
+ managedProperties.typeProperties.cellular.homeProvider.name) {
return this.i18n(
'cellularContactSpecificCarrier',
- managedProperties.cellular.homeProvider.name);
+ managedProperties.typeProperties.cellular.homeProvider.name);
}
return this.i18n('cellularContactDefaultCarrier');
}
@@ -614,11 +627,11 @@ Polymer({
if (!this.isCellular_(managedProperties)) {
return '';
}
- if (!managedProperties.cellular.allowRoaming) {
+ if (!managedProperties.typeProperties.cellular.allowRoaming) {
return this.i18n('networkAllowDataRoamingDisabled');
}
- return managedProperties.cellular.roamingState == 'Roaming' ?
+ return managedProperties.typeProperties.cellular.roamingState == 'Roaming' ?
this.i18n('networkAllowDataRoamingEnabledRoaming') :
this.i18n('networkAllowDataRoamingEnabledHome');
},
@@ -636,11 +649,13 @@ Polymer({
/**
* @param {!mojom.ManagedProperties|undefined} managedProperties
* @param {boolean} outOfRange
+ * @param {?OncMojo.DeviceStateProperties} deviceState
* @return {boolean} True if the network shown cannot initiate a connection.
* @private
*/
- isConnectionErrorState_: function(managedProperties, outOfRange) {
- if (outOfRange) {
+ isConnectionErrorState_: function(
+ managedProperties, outOfRange, deviceState) {
+ if (this.isOutOfRangeOrNotEnabled_(outOfRange, deviceState)) {
return true;
}
@@ -710,7 +725,8 @@ Polymer({
this.isPolicySource(managedProperties.source)) {
return false;
}
- const hexSsid = OncMojo.getActiveString(managedProperties.wifi.hexSsid);
+ const hexSsid =
+ OncMojo.getActiveString(managedProperties.typeProperties.wifi.hexSsid);
return !!globalPolicy.allowOnlyPolicyNetworksToConnect ||
(!!globalPolicy.allowOnlyPolicyNetworksToConnectIfAvailable &&
!!managedNetworkAvailable) ||
@@ -722,11 +738,12 @@ Polymer({
* @param {!mojom.ManagedProperties} managedProperties
* @param {!mojom.GlobalPolicy} globalPolicy
* @param {boolean} managedNetworkAvailable
+ * @param {?OncMojo.DeviceStateProperties} deviceState
* @return {boolean}
* @private
*/
showConnect_: function(
- managedProperties, globalPolicy, managedNetworkAvailable) {
+ managedProperties, globalPolicy, managedNetworkAvailable, deviceState) {
if (!managedProperties) {
return false;
}
@@ -741,15 +758,24 @@ Polymer({
if (this.isArcVpn_(managedProperties)) {
return false;
}
+
if (managedProperties.connectionState !=
mojom.ConnectionStateType.kNotConnected) {
return false;
}
+
+ if (deviceState &&
+ deviceState.deviceState !=
+ chromeos.networkConfig.mojom.DeviceStateType.kEnabled) {
+ return false;
+ }
+
// Cellular is not configurable, so we always show the connect button, and
// disable it if 'connectable' is false.
if (managedProperties.type == mojom.NetworkType.kCellular) {
return true;
}
+
// If 'connectable' is false we show the configure button.
return managedProperties.connectable &&
managedProperties.type != mojom.NetworkType.kEthernet;
@@ -801,7 +827,8 @@ Polymer({
if (!this.isCellular_(managedProperties)) {
return false;
}
- const activation = managedProperties.cellular.activationState;
+ const activation =
+ managedProperties.typeProperties.cellular.activationState;
return activation == mojom.ActivationStateType.kNotActivated ||
activation == mojom.ActivationStateType.kPartiallyActivated;
},
@@ -828,7 +855,8 @@ Polymer({
return false;
}
if (type == mojom.NetworkType.kWiFi &&
- managedProperties.wifi.security == mojom.SecurityType.kNone) {
+ managedProperties.typeProperties.wifi.security ==
+ mojom.SecurityType.kNone) {
return false;
}
if (type == mojom.NetworkType.kWiFi &&
@@ -916,18 +944,20 @@ Polymer({
return false;
}
- const paymentPortal = managedProperties.cellular.paymentPortal;
+ const paymentPortal =
+ managedProperties.typeProperties.cellular.paymentPortal;
if (!paymentPortal || !paymentPortal.url) {
return false;
}
// Only show for connected networks or LTE networks with a valid MDN.
if (!this.isConnectedState_(managedProperties)) {
- const technology = managedProperties.cellular.networkTechnology;
+ const technology =
+ managedProperties.typeProperties.cellular.networkTechnology;
if (technology != 'LTE' && technology != 'LTEAdvanced') {
return false;
}
- if (!managedProperties.cellular.mdn) {
+ if (!managedProperties.typeProperties.cellular.mdn) {
return false;
}
}
@@ -942,14 +972,16 @@ Polymer({
* @param {boolean} outOfRange
* @param {!mojom.GlobalPolicy} globalPolicy
* @param {boolean} managedNetworkAvailable
+ * @param {?OncMojo.DeviceStateProperties} deviceState
* @return {boolean} Whether or not to enable the network connect button.
* @private
*/
enableConnect_: function(
managedProperties, defaultNetwork, propertiesReceived, outOfRange,
- globalPolicy, managedNetworkAvailable) {
+ globalPolicy, managedNetworkAvailable, deviceState) {
if (!this.showConnect_(
- managedProperties, globalPolicy, managedNetworkAvailable)) {
+ managedProperties, globalPolicy, managedNetworkAvailable,
+ deviceState)) {
return false;
}
if (!propertiesReceived || outOfRange) {
@@ -1017,7 +1049,7 @@ Polymer({
/** @private */
onConnectTap_: function() {
if (this.managedProperties_.type == mojom.NetworkType.kTether &&
- (!this.managedProperties_.tether.hasConnectedToHost)) {
+ (!this.managedProperties_.typeProperties.tether.hasConnectedToHost)) {
this.showTetherDialog_();
return;
}
@@ -1054,9 +1086,13 @@ Polymer({
/** @private */
onForgetTap_: function() {
- this.networkingPrivate.forgetNetwork(this.guid);
- // A forgotten network no longer has a valid GUID, close the subpage.
- this.close();
+ this.networkConfig_.forgetNetwork(this.guid).then(response => {
+ if (!response.success) {
+ console.error('Froget network failed for: ' + this.guid);
+ }
+ // A forgotten network no longer has a valid GUID, close the subpage.
+ this.close();
+ });
},
/** @private */
@@ -1102,8 +1138,9 @@ Polymer({
return loadTimeData.getBoolean('showHiddenNetworkWarning') &&
!!this.autoConnectPref_ && !!this.autoConnectPref_.value &&
!!this.managedProperties_ &&
- !!this.managedProperties_.type == mojom.NetworkType.kWiFi &&
- !!OncMojo.getActiveValue(this.managedProperties_.wifi.hiddenSsid);
+ this.managedProperties_.type == mojom.NetworkType.kWiFi &&
+ !!OncMojo.getActiveValue(
+ this.managedProperties_.typeProperties.wifi.hiddenSsid);
},
/**
@@ -1120,7 +1157,7 @@ Polymer({
}
const field = e.detail.field;
const value = e.detail.value;
- const config = {};
+ const config = this.getDefaultConfigProperties_();
const valueType = typeof value;
if (valueType != 'string' && valueType != 'number' &&
valueType != 'boolean' && !Array.isArray(value)) {
@@ -1130,10 +1167,17 @@ Polymer({
return;
}
OncMojo.setConfigProperty(config, field, value);
- // Ensure any required configuration properties are also set.
- if (this.managedProperties_.vpn && config.vpn &&
- config.vpn.type === undefined) {
- config.vpn.type = this.managedProperties_.vpn.type;
+ // Ensure that any required configuration properties for partial
+ // configurations are set.
+ const vpnConfig = config.typeConfig.vpn;
+ if (vpnConfig) {
+ vpnConfig.type = this.managedProperties_.typeProperties.vpn.type;
+ if (vpnConfig.openVpn && vpnConfig.openVpn.saveCredentials == undefined) {
+ vpnConfig.openVpn.saveCredentials = false;
+ }
+ if (vpnConfig.l2tp && vpnConfig.l2tp.saveCredentials == undefined) {
+ vpnConfig.l2tp.saveCredentials = false;
+ }
}
this.setMojoNetworkProperties_(config);
},
@@ -1146,8 +1190,9 @@ Polymer({
if (!this.propertiesReceived_) {
return;
}
+ const config = this.getDefaultConfigProperties_();
const apn = event.detail;
- const config = {cellular: {apn: apn}};
+ config.typeConfig.cellular = {apn: apn};
this.setMojoNetworkProperties_(config);
},
@@ -1180,7 +1225,9 @@ Polymer({
if (!this.propertiesReceived_) {
return;
}
- this.setMojoNetworkProperties_({proxySettings: event.detail});
+ const config = this.getDefaultConfigProperties_();
+ config.proxySettings = event.detail;
+ this.setMojoNetworkProperties_(config);
},
/**
@@ -1226,7 +1273,7 @@ Polymer({
return this.isArcVpn_(managedProperties) && this.prefs.arc &&
this.prefs.arc.vpn && this.prefs.arc.vpn.always_on &&
this.prefs.arc.vpn.always_on.vpn_package &&
- OncMojo.getActiveValue(managedProperties.vpn.host) ===
+ OncMojo.getActiveValue(managedProperties.typeProperties.vpn.host) ===
this.prefs.arc.vpn.always_on.vpn_package.value;
},
@@ -1289,7 +1336,8 @@ Polymer({
*/
hasVisibleFields_: function(fields) {
for (let i = 0; i < fields.length; ++i) {
- const value = this.get(fields[i], this.managedProperties_);
+ const key = OncMojo.getManagedPropertyKey(fields[i]);
+ const value = this.get(key, this.managedProperties_);
if (value !== undefined && value !== '') {
return true;
}
@@ -1316,39 +1364,44 @@ Polymer({
}
/** @type {!Array<string>} */ const fields = [];
- const type = this.managedProperties_.type;
- if (type == mojom.NetworkType.kCellular) {
- fields.push('cellular.activationState', 'cellular.servingOperator.name');
- if (this.managedProperties_.restrictedConnectivity) {
- fields.push('restrictedConnectivity');
- }
- } else if (type == mojom.NetworkType.kTether) {
- fields.push(
- 'tether.batteryPercentage', 'tether.signalStrength',
- 'tether.carrier');
- } else if (type == mojom.NetworkType.kVPN) {
- const vpnType = this.managedProperties_.vpn.type;
- switch (vpnType) {
- case mojom.VpnType.kExtension:
- fields.push('vpn.providerName');
- break;
- case mojom.VpnType.kArc:
- fields.push('vpn.type');
- fields.push('vpn.providerName');
- break;
- case mojom.VpnType.kOpenVPN:
- fields.push(
- 'vpn.type', 'vpn.host', 'vpn.openVpn.username',
- 'vpn.openVpn.extraHosts');
- break;
- case mojom.VpnType.kL2TPIPsec:
- fields.push('vpn.type', 'vpn.host', 'vpn.l2tp.username');
- break;
- }
- } else if (type == mojom.NetworkType.kWiFi) {
- if (this.managedProperties_.restrictedConnectivity) {
- fields.push('restrictedConnectivity');
- }
+ switch (this.managedProperties_.type) {
+ case mojom.NetworkType.kCellular:
+ fields.push(
+ 'cellular.activationState', 'cellular.servingOperator.name');
+ if (this.managedProperties_.restrictedConnectivity) {
+ fields.push('restrictedConnectivity');
+ }
+ break;
+ case mojom.NetworkType.kTether:
+ fields.push(
+ 'tether.batteryPercentage', 'tether.signalStrength',
+ 'tether.carrier');
+ break;
+ case mojom.NetworkType.kVPN:
+ const vpnType = this.managedProperties_.typeProperties.vpn.type;
+ switch (vpnType) {
+ case mojom.VpnType.kExtension:
+ fields.push('vpn.providerName');
+ break;
+ case mojom.VpnType.kArc:
+ fields.push('vpn.type');
+ fields.push('vpn.providerName');
+ break;
+ case mojom.VpnType.kOpenVPN:
+ fields.push(
+ 'vpn.type', 'vpn.host', 'vpn.openVpn.username',
+ 'vpn.openVpn.extraHosts');
+ break;
+ case mojom.VpnType.kL2TPIPsec:
+ fields.push('vpn.type', 'vpn.host', 'vpn.l2tp.username');
+ break;
+ }
+ break;
+ case mojom.NetworkType.kWiFi:
+ if (this.managedProperties_.restrictedConnectivity) {
+ fields.push('restrictedConnectivity');
+ }
+ break;
}
return fields;
},
@@ -1368,7 +1421,7 @@ Polymer({
/** @dict */ const editFields = {};
const type = this.managedProperties_.type;
if (type == mojom.NetworkType.kVPN) {
- const vpnType = this.managedProperties_.vpn.type;
+ const vpnType = this.managedProperties_.typeProperties.vpn.type;
if (vpnType != mojom.VpnType.kExtension) {
editFields['vpn.host'] = 'String';
}
@@ -1391,15 +1444,19 @@ Polymer({
/** @type {!Array<string>} */ const fields = [];
const type = this.managedProperties_.type;
- if (type == mojom.NetworkType.kCellular) {
- fields.push(
- 'cellular.family', 'cellular.networkTechnology',
- 'cellular.servingOperator.code');
- } else if (type == mojom.NetworkType.kWiFi) {
- fields.push(
- 'wifi.ssid', 'wifi.bssid', 'wifi.signalStrength', 'wifi.security',
- 'wifi.eap.outer', 'wifi.eap.inner', 'wifi.eap.subjectMatch',
- 'wifi.eap.identity', 'wifi.eap.anonymousIdentity', 'wifi.frequency');
+ switch (type) {
+ case mojom.NetworkType.kCellular:
+ fields.push(
+ 'cellular.family', 'cellular.networkTechnology',
+ 'cellular.servingOperator.code');
+ break;
+ case mojom.NetworkType.kWiFi:
+ fields.push(
+ 'wifi.ssid', 'wifi.bssid', 'wifi.signalStrength', 'wifi.security',
+ 'wifi.eap.outer', 'wifi.eap.inner', 'wifi.eap.subjectMatch',
+ 'wifi.eap.identity', 'wifi.eap.anonymousIdentity',
+ 'wifi.frequency');
+ break;
}
return fields;
},
@@ -1520,7 +1577,7 @@ Polymer({
showCellularChooseNetwork_: function(managedProperties) {
return !!managedProperties &&
managedProperties.type == mojom.NetworkType.kCellular &&
- managedProperties.cellular.supportNetworkScan;
+ managedProperties.typeProperties.cellular.supportNetworkScan;
},
/**
@@ -1543,7 +1600,7 @@ Polymer({
showCellularSim_: function(managedProperties) {
return !!managedProperties &&
managedProperties.type == mojom.NetworkType.kCellular &&
- managedProperties.cellular.family != 'CDMA';
+ managedProperties.typeProperties.cellular.family != 'CDMA';
},
/**
@@ -1554,7 +1611,7 @@ Polymer({
isArcVpn_: function(managedProperties) {
return !!managedProperties &&
managedProperties.type == mojom.NetworkType.kVPN &&
- managedProperties.vpn.type == mojom.VpnType.kArc;
+ managedProperties.typeProperties.vpn.type == mojom.VpnType.kArc;
},
/**
@@ -1565,7 +1622,7 @@ Polymer({
isThirdPartyVpn_: function(managedProperties) {
return !!managedProperties &&
managedProperties.type == mojom.NetworkType.kVPN &&
- managedProperties.vpn.type == mojom.VpnType.kExtension;
+ managedProperties.typeProperties.vpn.type == mojom.VpnType.kExtension;
},
/**
@@ -1608,5 +1665,18 @@ Polymer({
}
return true;
},
+
+ /**
+ * @param {boolean} outOfRange
+ * @param {?OncMojo.DeviceStateProperties} deviceState
+ * @return {boolean}
+ * @private
+ */
+ isOutOfRangeOrNotEnabled_: function(outOfRange, deviceState) {
+ return outOfRange ||
+ (!!deviceState &&
+ deviceState.deviceState !=
+ chromeos.networkConfig.mojom.DeviceStateType.kEnabled);
+ },
});
})();
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 2e42c952c87..3351442766d 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
@@ -18,20 +18,14 @@ Polymer({
properties: {
/**
* The type of networks to list.
- * @type {CrOnc.Type}
+ * @type {chromeos.networkConfig.mojom.NetworkType|undefined}
*/
networkType: {
- type: String,
+ type: Number,
observer: 'networkTypeChanged_',
},
/**
- * Interface for networkingPrivate calls, passed from internet_page.
- * @type {NetworkingPrivate}
- */
- networkingPrivate: Object,
-
- /**
* List of all network state data for the network type.
* @private {!Array<!OncMojo.NetworkStateProperties>}
*/
@@ -60,12 +54,7 @@ Polymer({
/** @private {string} */
selectedGuid_: '',
- /**
- * This UI will use both the networkingPrivate extension API and the
- * networkConfig mojo API until we provide all of the required functionality
- * in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api.
- * @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote}
- */
+ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfig_: null,
/** @override */
@@ -90,13 +79,13 @@ Polymer({
* @private
*/
refreshNetworks_: function() {
- if (!this.networkType) {
+ if (this.networkType === undefined) {
return;
}
const filter = {
filter: chromeos.networkConfig.mojom.FilterType.kConfigured,
- limit: chromeos.networkConfig.mojom.kNoLimit,
- networkType: OncMojo.getNetworkTypeFromString(this.networkType),
+ limit: chromeos.networkConfig.mojom.NO_LIMIT,
+ networkType: this.networkType,
};
this.networkConfig_.getNetworkStateList(filter).then(response => {
this.networkStateList_ = response.result;
@@ -201,19 +190,29 @@ Polymer({
/** @private */
onRemovePreferredTap_: function() {
- this.setProperties_({priority: {value: 0}});
+ assert(this.networkType !== undefined);
+ const config = OncMojo.getDefaultConfigProperties(this.networkType);
+ config.priority = {value: 0};
+ this.setProperties_(config);
/** @type {!CrActionMenuElement} */ (this.$.dotsMenu).close();
},
/** @private */
onAddPreferredTap_: function() {
- this.setProperties_({priority: {value: 1}});
+ assert(this.networkType !== undefined);
+ const config = OncMojo.getDefaultConfigProperties(this.networkType);
+ config.priority = {value: 1};
+ this.setProperties_(config);
/** @type {!CrActionMenuElement} */ (this.$.dotsMenu).close();
},
/** @private */
onForgetTap_: function() {
- this.networkingPrivate.forgetNetwork(this.selectedGuid_);
+ this.networkConfig_.forgetNetwork(this.selectedGuid_).then(response => {
+ if (!response.success) {
+ console.error('Froget network failed for: ' + this.selectedGuid_);
+ }
+ });
/** @type {!CrActionMenuElement} */ (this.$.dotsMenu).close();
},
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 10eeff05b0a..f9b99636a51 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_page.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_page.html
@@ -1,7 +1,7 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_components/chromeos/network/mojo_interface_provider.html">
-<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.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_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">
@@ -49,13 +49,12 @@
</cr-expand-button>
<template is="dom-if" if="[[addConnectionExpanded_]]">
<div class="list-frame vertical-list">
- <template is="dom-if"
- if="[[deviceIsEnabled_(deviceStates, 'WiFi')]]">
+ <template is="dom-if" if="[[wifiIsEnabled_(deviceStates)]]">
<div actionable class="list-item" on-click="onAddWiFiTap_">
<div class="start settings-box-text">
$i18n{internetAddWiFi}
</div>
- <cr-icon-button class$="[[getAddNetworkClass_('WiFi')]]"
+ <cr-icon-button class="icon-add-wifi"
aria-label="$i18n{internetAddWiFi}"></cr-icon-button>
</div>
</template>
@@ -63,7 +62,7 @@
<div class="start settings-box-text">
$i18n{internetAddVPN}
</div>
- <cr-icon-button class$="[[getAddNetworkClass_('VPN')]]"
+ <cr-icon-button class="icon-add-circle"
aria-label="$i18n{internetAddVPN}"></cr-icon-button>
</div>
<template is="dom-repeat" items="[[vpnProviders_]]">
@@ -96,7 +95,6 @@
<settings-internet-detail-page prefs="{{prefs}}"
default-network="[[defaultNetwork]]"
global-policy="[[globalPolicy_]]"
- networking-private="[[networkingPrivate]]"
managed-network-available="[[managedNetworkAvailable]]">
</settings-internet-detail-page>
</settings-subpage>
@@ -105,8 +103,7 @@
<template is="dom-if" route-path="/knownNetworks" no-search restamp>
<settings-subpage page-title="$i18n{internetKnownNetworksPageTitle}">
<settings-internet-known-networks-page
- network-type="[[knownNetworksType_]]"
- networking-private="[[networkingPrivate]]">
+ network-type="[[knownNetworksType_]]">
</settings-internet-known-networks-page>
</settings-subpage>
</template>
@@ -128,10 +125,10 @@
</settings-animated-pages>
- <internet-config id="configDialog"
- networking-private="[[networkingPrivate]]"
- global-policy="[[globalPolicy_]]">
- </internet-config>
+ <template is="dom-if" if="[[showInternetConfig_]]" restamp>
+ <internet-config id="configDialog" on-close="onInternetConfigClose_">
+ </internet-config>
+ </template>
</template>
<script src="internet_page.js"></script>
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 1737c822b40..8f2b2d7b745 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_page.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_page.js
@@ -22,14 +22,6 @@ Polymer({
],
properties: {
- /**
- * Interface for networkingPrivate calls. May be overriden by tests.
- * @type {NetworkingPrivate}
- */
- networkingPrivate: {
- type: Object,
- value: chrome.networkingPrivate,
- },
/** Preferences state. */
prefs: {
@@ -65,16 +57,18 @@ Polymer({
showSpinner_: Boolean,
/**
- * The network type for the networks subpage. Used in the subpage header.
+ * The network type for the networks subpage when shown.
+ * @type {chromeos.networkConfig.mojom.NetworkType}
* @private
*/
- subpageType_: String,
+ subpageType_: Number,
/**
- * The network type for the known networks subpage.
+ * The network type for the known networks subpage when shown.
+ * @type {chromeos.networkConfig.mojom.NetworkType}
* @private
*/
- knownNetworksType_: String,
+ knownNetworksType_: Number,
/**
* Whether the 'Add connection' section is expanded.
@@ -109,6 +103,12 @@ Polymer({
}
},
+ /** @private {boolean} */
+ showInternetConfig_: {
+ type: Boolean,
+ value: false,
+ },
+
/** @private {!Map<string, Element>} */
focusConfig_: {
type: Object,
@@ -118,8 +118,11 @@ Polymer({
},
},
- /** @private {string} Type of last detail page visited. */
- detailType_: '',
+ /**
+ * Type of last detail page visited
+ * @private {chromeos.networkConfig.mojom.NetworkType|undefined}
+ */
+ detailType_: undefined,
// Element event listeners
listeners: {
@@ -134,12 +137,7 @@ Polymer({
/** @private {?settings.InternetPageBrowserProxy} */
browserProxy_: null,
- /**
- * This UI will use both the networkingPrivate extension API and the
- * networkConfig mojo API until we provide all of the required functionality
- * in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api.
- * @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote}
- */
+ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfig_: null,
/** @override */
@@ -170,7 +168,7 @@ Polymer({
const queryParams = settings.getQueryParameters();
const type = queryParams.get('type');
if (type) {
- this.subpageType_ = type;
+ this.subpageType_ = OncMojo.getNetworkTypeFromString(type);
}
} else if (route == settings.routes.KNOWN_NETWORKS) {
// Handle direct navigation to the known networks page,
@@ -178,7 +176,7 @@ Polymer({
const queryParams = settings.getQueryParameters();
const type = queryParams.get('type');
if (type) {
- this.knownNetworksType_ = type;
+ this.knownNetworksType_ = OncMojo.getNetworkTypeFromString(type);
}
} else if (
route != settings.routes.INTERNET && route != settings.routes.BASIC) {
@@ -201,9 +199,9 @@ Polymer({
if (subPage) {
element = subPage.$$('#networkList');
}
- } else if (this.detailType_) {
- const rowForDetailType =
- this.$$('network-summary').$$(`#${this.detailType_}`);
+ } else if (this.detailType_ !== undefined) {
+ const oncType = OncMojo.getNetworkTypeString(this.detailType_);
+ const rowForDetailType = this.$$('network-summary').$$(`#${oncType}`);
// 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
@@ -219,7 +217,7 @@ Polymer({
}
},
- /** CrosNetworkConfigObserver impl */
+ /** CrNetworkListenerBehavior override */
onVpnProvidersChanged: function() {
this.networkConfig_.getVpnProviders().then(response => {
const providers = response.providers;
@@ -246,33 +244,48 @@ Polymer({
* @private
*/
onShowConfig_: function(event) {
+ const type = OncMojo.getNetworkTypeFromString(event.detail.type);
if (!event.detail.guid) {
// New configuration
- this.showConfig_(true /* configAndConnect */, event.detail.type);
+ this.showConfig_(true /* configAndConnect */, type);
} else {
this.showConfig_(
- false /* configAndConnect */, event.detail.type, event.detail.guid,
+ false /* configAndConnect */, type, event.detail.guid,
event.detail.name);
}
},
/**
* @param {boolean} configAndConnect
- * @param {string} type
+ * @param {chromeos.networkConfig.mojom.NetworkType} type
* @param {?string=} opt_guid
* @param {?string=} opt_name
* @private
*/
showConfig_: function(configAndConnect, type, opt_guid, opt_name) {
- assert(type != CrOnc.Type.CELLULAR && type != CrOnc.Type.TETHER);
- const configDialog =
- /** @type {!InternetConfigElement} */ (this.$.configDialog);
- configDialog.type =
- /** @type {chrome.networkingPrivate.NetworkType} */ (type);
- configDialog.guid = opt_guid || '';
- configDialog.name = opt_name || '';
- configDialog.showConnect = configAndConnect;
- configDialog.open();
+ assert(
+ type != chromeos.networkConfig.mojom.NetworkType.kCellular &&
+ type != chromeos.networkConfig.mojom.NetworkType.kTether);
+ if (this.showInternetConfig_) {
+ return;
+ }
+ this.showInternetConfig_ = true;
+ // Async call to ensure dialog is stamped.
+ setTimeout(() => {
+ const configDialog =
+ /** @type {!InternetConfigElement} */ (this.$$('#configDialog'));
+ assert(!!configDialog);
+ configDialog.type = OncMojo.getNetworkTypeString(type);
+ configDialog.guid = opt_guid || '';
+ configDialog.name = opt_name || '';
+ configDialog.showConnect = configAndConnect;
+ configDialog.open();
+ });
+ },
+
+ /** @private */
+ onInternetConfigClose_: function() {
+ this.showInternetConfig_ = false;
},
/**
@@ -281,11 +294,10 @@ Polymer({
*/
onShowDetail_: function(event) {
const networkState = event.detail;
- const oncType = OncMojo.getNetworkTypeString(networkState.type);
- this.detailType_ = oncType;
+ this.detailType_ = networkState.type;
const params = new URLSearchParams;
params.append('guid', networkState.guid);
- params.append('type', oncType);
+ params.append('type', OncMojo.getNetworkTypeString(networkState.type));
params.append('name', OncMojo.getNetworkStateDisplayName(networkState));
settings.navigateTo(settings.routes.NETWORK_DETAIL, params);
},
@@ -306,39 +318,31 @@ Polymer({
// The shared Cellular/Tether subpage is referred to as "Mobile".
// TODO(khorimoto): Remove once Cellular/Tether are split into their own
// sections.
- if (this.subpageType_ == CrOnc.Type.CELLULAR ||
- this.subpageType_ == CrOnc.Type.TETHER) {
+ if (this.subpageType_ == mojom.NetworkType.kCellular ||
+ this.subpageType_ == mojom.NetworkType.kTether) {
return this.i18n('OncTypeMobile');
}
- return this.i18n('OncType' + this.subpageType_);
- },
-
- /**
- * @param {string} type
- * @return {string}
- * @private
- */
- getAddNetworkClass_: function(type) {
- return type == CrOnc.Type.WI_FI ? 'icon-add-wifi' : 'icon-add-circle';
+ return this.i18n(
+ 'OncType' + OncMojo.getNetworkTypeString(this.subpageType_));
},
/**
- * @param {string} subpageType
+ * @param {chromeos.networkConfig.mojom.NetworkType} subpageType
* @param {!Object<!OncMojo.DeviceStateProperties>|undefined} deviceStates
* @return {!OncMojo.DeviceStateProperties|undefined}
* @private
*/
getDeviceState_: function(subpageType, deviceStates) {
- if (!subpageType) {
+ if (subpageType === undefined) {
return undefined;
}
// If both Tether and Cellular are enabled, use the Cellular device state
// when directly navigating to the Tether page.
- if (subpageType == CrOnc.Type.TETHER &&
+ if (subpageType == mojom.NetworkType.kTether &&
this.deviceStates[mojom.NetworkType.kCellular]) {
- subpageType = CrOnc.Type.CELLULAR;
+ subpageType = mojom.NetworkType.kCellular;
}
- return deviceStates[OncMojo.getNetworkTypeFromString(subpageType)];
+ return deviceStates[subpageType];
},
/**
@@ -356,7 +360,8 @@ Polymer({
* @private
*/
onDeviceStatesChanged_: function(newValue, oldValue) {
- const wifiDeviceState = this.getDeviceState_(CrOnc.Type.WI_FI, newValue);
+ const wifiDeviceState =
+ this.getDeviceState_(mojom.NetworkType.kWiFi, newValue);
let managedNetworkAvailable = false;
if (wifiDeviceState) {
managedNetworkAvailable = !!wifiDeviceState.managedNetworkAvailable;
@@ -366,9 +371,7 @@ Polymer({
this.managedNetworkAvailable = managedNetworkAvailable;
}
- if (this.detailType_ &&
- !this.deviceStates[OncMojo.getNetworkTypeFromString(
- this.detailType_)]) {
+ 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
@@ -385,22 +388,26 @@ Polymer({
* @private
*/
onShowKnownNetworks_: function(event) {
- const oncType = OncMojo.getNetworkTypeString(event.detail);
- this.detailType_ = oncType;
- this.knownNetworksType_ = oncType;
+ const type = event.detail;
+ this.detailType_ = type;
+ this.knownNetworksType_ = type;
const params = new URLSearchParams;
- params.append('type', oncType);
+ params.append('type', OncMojo.getNetworkTypeString(type));
settings.navigateTo(settings.routes.KNOWN_NETWORKS, params);
},
/** @private */
onAddWiFiTap_: function() {
- this.showConfig_(true /* configAndConnect */, CrOnc.Type.WI_FI);
+ this.showConfig_(
+ true /* configAndConnect */,
+ chromeos.networkConfig.mojom.NetworkType.kWiFi);
},
/** @private */
onAddVPNTap_: function() {
- this.showConfig_(true /* configAndConnect */, CrOnc.Type.VPN);
+ this.showConfig_(
+ true /* configAndConnect */,
+ chromeos.networkConfig.mojom.NetworkType.kVPN);
},
/**
@@ -417,11 +424,10 @@ Polymer({
* @private
*/
showNetworksSubpage_: function(type) {
- const oncType = OncMojo.getNetworkTypeString(type);
- this.detailType_ = oncType;
+ this.detailType_ = type;
const params = new URLSearchParams;
- params.append('type', oncType);
- this.subpageType_ = oncType;
+ params.append('type', OncMojo.getNetworkTypeString(type));
+ this.subpageType_ = type;
settings.navigateTo(settings.routes.INTERNET_NETWORKS, params);
},
@@ -452,14 +458,13 @@ Polymer({
/**
* @param {!Array<!OncMojo.DeviceStateProperties>} deviceStates
- * @param {string} type
* @return {boolean}
* @private
*/
- deviceIsEnabled_: function(deviceStates, type) {
- const device = deviceStates[OncMojo.getNetworkTypeFromString(type)];
- return !!device &&
- device.deviceState ==
+ wifiIsEnabled_: function(deviceStates) {
+ const wifi = deviceStates[mojom.NetworkType.kWiFi];
+ return !!wifi &&
+ wifi.deviceState ==
chromeos.networkConfig.mojom.DeviceStateType.kEnabled;
},
@@ -497,15 +502,15 @@ Polymer({
*/
onNetworkConnect_: function(event) {
const networkState = event.detail.networkState;
- const oncType = OncMojo.getNetworkTypeString(networkState.type);
+ const type = networkState.type;
const displayName = OncMojo.getNetworkStateDisplayName(networkState);
if (!event.detail.bypassConnectionDialog &&
- networkState.type == mojom.NetworkType.kTether &&
- !networkState.tether.hasConnectedToHost) {
+ type == mojom.NetworkType.kTether &&
+ !networkState.typeState.tether.hasConnectedToHost) {
const params = new URLSearchParams;
params.append('guid', networkState.guid);
- params.append('type', oncType);
+ params.append('type', OncMojo.getNetworkTypeString(type));
params.append('name', displayName);
params.append('showConfigure', true.toString());
@@ -513,10 +518,10 @@ Polymer({
return;
}
- const isMobile = OncMojo.networkTypeIsMobile(networkState.type);
+ const isMobile = OncMojo.networkTypeIsMobile(type);
if (!isMobile && (!networkState.connectable || !!networkState.errorState)) {
this.showConfig_(
- true /* configAndConnect */, oncType, networkState.guid, displayName);
+ true /* configAndConnect */, type, networkState.guid, displayName);
return;
}
@@ -532,7 +537,7 @@ Polymer({
case mojom.StartConnectResult.kNotConfigured:
if (!isMobile) {
this.showConfig_(
- true /* configAndConnect */, oncType, networkState.guid,
+ true /* configAndConnect */, type, networkState.guid,
displayName);
}
return;
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 9996d3b6538..8ce6c994e2f 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/internet_subpage.js
@@ -120,12 +120,7 @@ Polymer({
/** @private {settings.InternetPageBrowserProxy} */
browserProxy_: null,
- /**
- * This UI will use both the networkingPrivate extension API and the
- * networkConfig mojo API until we provide all of the required functionality
- * in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api.
- * @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote}
- */
+ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfig_: null,
/** @override */
@@ -275,7 +270,7 @@ Polymer({
}
const filter = {
filter: chromeos.networkConfig.mojom.FilterType.kVisible,
- limit: chromeos.networkConfig.mojom.kNoLimit,
+ limit: chromeos.networkConfig.mojom.NO_LIMIT,
networkType: this.deviceState.type,
};
this.networkConfig_.getNetworkStateList(filter).then(response => {
@@ -298,7 +293,7 @@ Polymer({
this.tetherDeviceState) {
const filter = {
filter: chromeos.networkConfig.mojom.FilterType.kVisible,
- limit: chromeos.networkConfig.mojom.kNoLimit,
+ limit: chromeos.networkConfig.mojom.NO_LIMIT,
networkType: mojom.NetworkType.kTether,
};
this.networkConfig_.getNetworkStateList(filter).then(response => {
@@ -314,7 +309,7 @@ Polymer({
const thirdPartyVpns = {};
networkStates.forEach(state => {
assert(state.type == mojom.NetworkType.kVPN);
- switch (state.vpn.type) {
+ switch (state.typeState.vpn.type) {
case mojom.VpnType.kL2TPIPsec:
case mojom.VpnType.kOpenVPN:
builtinNetworkStates.push(state);
@@ -326,7 +321,7 @@ Polymer({
}
// Otherwise Arc VPNs are treated the same as Extension VPNs.
case mojom.VpnType.kExtension:
- const providerId = state.vpn.providerId;
+ const providerId = state.typeState.vpn.providerId;
thirdPartyVpns[providerId] = thirdPartyVpns[providerId] || [];
thirdPartyVpns[providerId].push(state);
break;
@@ -354,7 +349,7 @@ Polymer({
for (const vpnList of Object.values(thirdPartyVpns)) {
assert(vpnList.length > 0);
// All vpns in the list will have the same type and provider id.
- const vpn = vpnList[0].vpn;
+ const vpn = vpnList[0].typeState.vpn;
const provider = {
type: vpn.type,
providerId: vpn.providerId,
@@ -584,7 +579,8 @@ Polymer({
(!!this.globalPolicy.allowOnlyPolicyNetworksToConnectIfAvailable &&
!!this.deviceState && !!this.deviceState.managedNetworkAvailable) ||
(!!this.globalPolicy.blockedHexSsids &&
- this.globalPolicy.blockedHexSsids.includes(state.wifi.hexSsid));
+ this.globalPolicy.blockedHexSsids.includes(
+ state.typeState.wifi.hexSsid));
},
/**
diff --git a/chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.html b/chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.html
index a061a6e92ab..f44b433b079 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.html
+++ b/chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.html
@@ -1,7 +1,6 @@
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_components/chromeos/network/network_proxy.html">
-<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html">
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
diff --git a/chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.js b/chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.js
index 3827c8cbf37..f04803663de 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/network_proxy_section.js
@@ -60,12 +60,12 @@ Polymer({
},
/**
- * @return {!OncMojo.ManagedProperty|undefined}
+ * @return {!mojom.ManagedString|undefined}
* @private
*/
getProxySettingsTypeProperty_: function() {
- return /** @type {!OncMojo.ManagedProperty|undefined} */ (
- this.get('proxySettings.type', this.managedProperties));
+ const proxySettings = this.managedProperties.proxySettings;
+ return proxySettings ? proxySettings.type : undefined;
},
/**
diff --git a/chromium/chrome/browser/resources/settings/internet_page/network_summary.js b/chromium/chrome/browser/resources/settings/internet_page/network_summary.js
index ac6a45c2d31..bc02417ee3e 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/network_summary.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/network_summary.js
@@ -149,7 +149,7 @@ Polymer({
getNetworkStates_: function(deviceStateList) {
const filter = {
filter: chromeos.networkConfig.mojom.FilterType.kVisible,
- limit: chromeos.networkConfig.mojom.kNoLimit,
+ limit: chromeos.networkConfig.mojom.NO_LIMIT,
networkType: mojom.NetworkType.kAll,
};
this.networkConfig_.getNetworkStateList(filter).then(response => {
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 5b26c96577a..4c6312d3dc0 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,7 +2,7 @@
<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/chromeos/network/cr_onc_types.html">
+<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_strings.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">
diff --git a/chromium/chrome/browser/resources/settings/internet_page/network_summary_item.js b/chromium/chrome/browser/resources/settings/internet_page/network_summary_item.js
index 09cbcd3965e..7b26f618a41 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/network_summary_item.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/network_summary_item.js
@@ -132,7 +132,12 @@ Polymer({
const connectionState = networkState.connectionState;
const name = OncMojo.getNetworkStateDisplayName(networkState);
if (OncMojo.connectionStateIsConnected(connectionState)) {
- return name;
+ // Ethernet networks always have the display name 'Ethernet' so we use the
+ // state text 'Connected' to avoid repeating the label in the sublabel.
+ // See http://crbug.com/989907 for details.
+ return networkState.type == mojom.NetworkType.kEthernet ?
+ CrOncStrings.networkListItemConnected :
+ name;
}
if (connectionState == mojom.ConnectionStateType.kConnecting) {
return name ?
@@ -282,14 +287,22 @@ Polymer({
const type = deviceState.type;
if (type == mojom.NetworkType.kTether ||
(type == mojom.NetworkType.kCellular && this.tetherDeviceState)) {
- // The "Mobile data" subpage should always be shown if Tether networks are
+ // The "Mobile data" subpage should always be shown if Tether is
// available, even if there are currently no associated networks.
return true;
}
- const minlen =
- (type == mojom.NetworkType.kWiFi || type == mojom.NetworkType.kVPN) ?
- 1 :
- 2;
+ let minlen;
+ if (type == mojom.NetworkType.kVPN) {
+ // VPN subpage provides provider info so show if there are any networks.
+ minlen = 1;
+ } else if (type == mojom.NetworkType.kWiFi) {
+ // WiFi subpage includes 'Known Networks' so always show, even if the
+ // technology is still enabling / scanning, or none are visible.
+ minlen = 0;
+ } else {
+ // By default, only show the subpage if there are 2+ networks
+ minlen = 2;
+ }
return networkStateList.length >= minlen;
},
diff --git a/chromium/chrome/browser/resources/settings/internet_page/tether_connection_dialog.js b/chromium/chrome/browser/resources/settings/internet_page/tether_connection_dialog.js
index 5a7c6beff6f..cce1a1de45c 100644
--- a/chromium/chrome/browser/resources/settings/internet_page/tether_connection_dialog.js
+++ b/chromium/chrome/browser/resources/settings/internet_page/tether_connection_dialog.js
@@ -79,27 +79,20 @@ Polymer({
* @private
*/
getBatteryPercentageAsString_: function(managedProperties) {
- const percentage = this.get('tether.batteryPercentage', managedProperties);
- if (percentage === undefined) {
- return '';
- }
- return percentage.toString();
+ return managedProperties.typeProperties.tether.batteryPercentage.toString();
},
/**
* Retrieves an image that corresponds to signal strength of the tether host.
* Custom icons are used here instead of a <cr-network-icon> because this
* dialog uses a special color scheme.
- *
* @param {!mojom.ManagedProperties} managedProperties
* @return {string} The name of the icon to be used to represent the network's
- * signal strength.
+ * signal strength.
*/
getSignalStrengthIconName_: function(managedProperties) {
- let signalStrength = this.get('tether.signalStrength', managedProperties);
- if (signalStrength === undefined) {
- signalStrength = 4;
- }
+ const signalStrength =
+ managedProperties.typeProperties.tether.signalStrength;
return 'os-settings:signal-cellular-' +
Math.min(4, Math.max(signalStrength, 0)) + '-bar';
},
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 c3732a62e48..a6905ca7fbf 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
@@ -56,9 +56,12 @@
scroll-target="[[subpageScrollTarget]]">
<template>
<div class="list-item">
- <div class="word text-elide">[[item]]</div>
+ <div id$="word[[index]]" class="word text-elide">[[item]]</div>
<cr-icon-button class="icon-clear" on-click="onRemoveWordTap_"
- tabindex$="[[tabIndex]]"></cr-icon-button>
+ tabindex$="[[tabIndex]]"
+ title="$i18n{deleteDictionaryWordButton}"
+ aria-describedby$="word[[index]]">
+ </cr-icon-button>
</div>
</template>
</iron-list>
diff --git a/chromium/chrome/browser/resources/settings/manifest.json b/chromium/chrome/browser/resources/settings/manifest.json
index c7a72e04e30..acbaa3c103e 100644
--- a/chromium/chrome/browser/resources/settings/manifest.json
+++ b/chromium/chrome/browser/resources/settings/manifest.json
@@ -1,5 +1,5 @@
{
- "name": "Settings",
+ "name": "$i18nRaw{name}",
"display": "standalone",
"icons": [
{
diff --git a/chromium/chrome/browser/resources/settings/multidevice_page/BUILD.gn b/chromium/chrome/browser/resources/settings/multidevice_page/BUILD.gn
index 7818234969e..a35e2871de8 100644
--- a/chromium/chrome/browser/resources/settings/multidevice_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/multidevice_page/BUILD.gn
@@ -109,7 +109,6 @@ if (is_chromeos) {
":multidevice_feature_behavior",
"..:route",
"//ui/webui/resources/cr_elements/chromeos/network:cr_network_listener_behavior",
- "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
"//ui/webui/resources/js/chromeos:onc_mojo",
]
externs_list = [ "$externs_path/networking_private.js" ]
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 2e75dd98bd0..55a72bcb020 100644
--- a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.html
+++ b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_subpage.html
@@ -31,10 +31,6 @@
#feature-items-container {
@apply --settings-list-frame-padding;
}
-
- #forget-device-container {
- border-top: var(--cr-separator-line);
- }
</style>
<div class="settings-box first">
<div id="status-text-container"
@@ -99,11 +95,17 @@
</template>
</div>
</template>
- <div id="forget-device-container">
- <cr-link-row id="forget-device" class="hr"
- on-click="handleForgetDeviceClick_"
- label="$i18n{multideviceForgetDevice}"
- sub-label="$i18n{multideviceForgetDeviceSummary}"></cr-link-row>
+ <div class="settings-box two-line">
+ <div id="forget-device-label" class="start">
+ $i18n{multideviceForgetDevice}
+ <div class="secondary">
+ $i18n{multideviceForgetDeviceSummary}
+ </div>
+ </div>
+ <cr-button on-click="handleForgetDeviceClick_"
+ aria-labelledby="forgetDeviceLabel">
+ $i18n{multideviceForgetDeviceDisconnect}
+ </cr-button>
</div>
<cr-dialog id="forgetDeviceDialog">
<div slot="title">$i18n{multideviceForgetDevice}</div>
@@ -120,7 +122,7 @@
<cr-button id="confirmButton"
class="action-button"
on-click="onForgetDeviceDialogConfirmClick_">
- $i18n{confirm}
+ $i18n{multideviceForgetDeviceDisconnect}
</cr-button>
</div>
</cr-dialog>
diff --git a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.html b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.html
index 326a4c50e00..4809023c3b1 100644
--- a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.html
+++ b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.html
@@ -1,6 +1,5 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_icon.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_listener_behavior.html">
<link rel="import" href="chrome://resources/html/chromeos/onc_mojo.html">
diff --git a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.js b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.js
index fe69ece9bc2..d9ab5429c4c 100644
--- a/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.js
+++ b/chromium/chrome/browser/resources/settings/multidevice_page/multidevice_tether_item.js
@@ -165,6 +165,6 @@ Polymer({
* @private
*/
getTetherNetworkUrlSearchParams_: function() {
- return new URLSearchParams('type=' + CrOnc.Type.TETHER);
+ return new URLSearchParams('type=Tether');
},
});
diff --git a/chromium/chrome/browser/resources/settings/os_settings_manifest.json b/chromium/chrome/browser/resources/settings/os_settings_manifest.json
index b5aa51b98e5..adbabe2f7bb 100644
--- a/chromium/chrome/browser/resources/settings/os_settings_manifest.json
+++ b/chromium/chrome/browser/resources/settings/os_settings_manifest.json
@@ -1,5 +1,5 @@
{
- "name": "Settings",
+ "name": "$i18nRaw{name}",
"display": "standalone",
"icons": [
{
diff --git a/chromium/chrome/browser/resources/settings/os_settings_resources.grd b/chromium/chrome/browser/resources/settings/os_settings_resources.grd
index 8338d49eb90..9d683c7b298 100644
--- a/chromium/chrome/browser/resources/settings/os_settings_resources.grd
+++ b/chromium/chrome/browser/resources/settings/os_settings_resources.grd
@@ -121,12 +121,6 @@
<structure name="IDR_OS_SETTINGS_APP_MANAGEMENT_PAGE_PERMISSION_ITEM_HTML"
file="chromeos/os_apps_page/app_management_page/permission_item.html"
type="chrome_html" />
- <structure name="IDR_OS_SETTINGS_APP_MANAGEMENT_PAGE_PERMISSION_TOGGLE_JS"
- file="chromeos/os_apps_page/app_management_page/permission_toggle.js"
- type="chrome_html" />
- <structure name="IDR_OS_SETTINGS_APP_MANAGEMENT_PAGE_PERMISSION_TOGGLE_HTML"
- file="chromeos/os_apps_page/app_management_page/permission_toggle.html"
- type="chrome_html" />
<structure name="IDR_OS_SETTINGS_APP_MANAGEMENT_PAGE_PIN_TO_SHELF_ITEM_JS"
file="chromeos/os_apps_page/app_management_page/pin_to_shelf_item.js"
type="chrome_html" />
@@ -157,12 +151,6 @@
<structure name="IDR_OS_SETTINGS_APP_MANAGEMENT_PAGE_CHROME_APP_PERMISSION_VIEW_HTML"
file="chromeos/os_apps_page/app_management_page/chrome_app_permission_view.html"
type="chrome_html" />
- <structure name="IDR_OS_SETTINGS_APP_MANAGEMENT_PAGE_ROUTER_JS"
- file="chromeos/os_apps_page/app_management_page/router.js"
- type="chrome_html" />
- <structure name="IDR_OS_SETTINGS_APP_MANAGEMENT_PAGE_ROUTER_HTML"
- file="chromeos/os_apps_page/app_management_page/router.html"
- type="chrome_html" />
<structure name="IDR_OS_SETTINGS_APP_MANAGEMENT_PAGE_ICONS_HTML"
file="chromeos/os_apps_page/app_management_page/icons.html"
type="chrome_html" />
@@ -172,6 +160,18 @@
<structure name="IDR_OS_SETTINGS_APP_MANAGEMENT_PAGE_APP_UNINSTALL_BUTTON_HTML"
file="chromeos/os_apps_page/app_management_page/uninstall_button.html"
type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CAPTIONS_SUBPAGE_JS"
+ file="a11y_page/captions_subpage.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CAPTIONS_SUBPAGE_HTML"
+ file="a11y_page/captions_subpage.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_MANAGE_A11Y_PAGE_JS"
file="a11y_page/manage_a11y_page.js"
type="chrome_html" />
@@ -517,12 +517,6 @@
<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" />
@@ -775,11 +769,17 @@
<structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_ENTRY_JS"
file="printing_page/cups_printers_entry.js"
type="chrome_html" />
- <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_ENTRY_LIST_HTML"
- file="printing_page/cups_printers_entry_list.html"
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_ENTRY_LIST_BEHAVIOR_HTML"
+ file="printing_page/cups_printers_entry_list_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_ENTRY_LIST_BEHAVIOR_JS"
+ file="printing_page/cups_printers_entry_list_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_ENTRY_MANAGER_HTML"
+ file="printing_page/cups_printers_entry_manager.html"
type="chrome_html" />
- <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_ENTRY_LIST_JS"
- file="printing_page/cups_printers_entry_list.js"
+ <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_ENTRY_MANAGER_JS"
+ file="printing_page/cups_printers_entry_manager.js"
type="chrome_html" />
<structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_LIST_HTML"
file="printing_page/cups_printers_list.html"
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 3addbf6027c..f5d9d8bc29f 100644
--- a/chromium/chrome/browser/resources/settings/people_page/account_manager.html
+++ b/chromium/chrome/browser/resources/settings/people_page/account_manager.html
@@ -4,6 +4,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_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/policy/cr_policy_indicator.html">
+<link rel="import" href="chrome://resources/cr_elements/policy/cr_tooltip_icon.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">
@@ -44,8 +45,17 @@
margin-inline-start: 60px;
}
- #account-list-header {
- padding-bottom: 8px;
+ .secondary-accounts-policy-indicator {
+ margin-inline-end: 12px;
+ }
+
+ .settings-box.user-message {
+ align-items: flex-end;
+ }
+
+ #account-list-header > h2 {
+ padding-bottom: 12px;
+ padding-top: 12px;
}
cr-policy-indicator {
@@ -54,7 +64,8 @@
}
#add-account-button {
- margin-top: var(--add-account-margin-top);
+ margin-bottom: 12px;
+ margin-top: 12px;
}
#add-account-icon {
@@ -88,6 +99,11 @@
.management-status {
color: var(--cr-secondary-text-color);
}
+
+ .tooltip-primary-account {
+ margin-inline-end: 12px;
+ margin-inline-start: 12px;
+ }
</style>
<div class="settings-box first">
@@ -99,14 +115,21 @@
</span>
</div>
+ <div id="settings-box-user-message" class="settings-box first user-message"
+ hidden="[[isSecondaryGoogleAccountSigninAllowed_()]]">
+ <cr-policy-pref-indicator class="secondary-accounts-policy-indicator"
+ pref=
+ "[[prefs.account_manager.secondary_google_account_signin_allowed]]">
+ </cr-policy-pref-indicator>
+ <div id="user-message-text" class="secondary">
+ [[getSecondaryAccountsDisabledUserMessage_()]]
+ </div>
+ </div>
+
<div class="settings-box first">
<div id="account-list-header" class="flex">
<h2>$i18n{accountListHeader}</h2>
</div>
- <cr-policy-indicator
- hidden="[[isSecondaryGoogleAccountSigninAllowed_()]]"
- indicator-type="userPolicy">
- </cr-policy-indicator>
<cr-button disabled="[[!isSecondaryGoogleAccountSigninAllowed_()]]"
id="add-account-button" on-tap="addAccount_">
<div id="add-account-icon"></div>
@@ -152,6 +175,11 @@
<!-- If this is the Device Account, display the management status -->
<template is="dom-if" if="[[item.isDeviceAccount]]">
+ <cr-tooltip-icon icon-class="cr:info-outline"
+ class="tooltip-primary-account"
+ tooltip-text="$i18n{accountManagerPrimaryAccountTooltip}"
+ icon-aria-label="$i18n{accountManagerPrimaryAccountTooltip}">
+ </cr-tooltip-icon>
<span class="management-status">
[[getManagementLabel_(item)]]
</span>
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 8613c1262a3..e5cecdcd17f 100644
--- a/chromium/chrome/browser/resources/settings/people_page/account_manager.js
+++ b/chromium/chrome/browser/resources/settings/people_page/account_manager.js
@@ -70,6 +70,17 @@ Polymer({
},
/**
+ * @return {string} 'Secondary Accounts disabled' message depending on
+ * account type
+ * @private
+ */
+ getSecondaryAccountsDisabledUserMessage_: function() {
+ return loadTimeData.getBoolean('isChild')
+ ? this.i18n('accountManagerSecondaryAccountsDisabledChildText')
+ : this.i18n('accountManagerSecondaryAccountsDisabledText');
+ },
+
+ /**
* @param {string} iconUrl
* @return {string} A CSS image-set for multiple scale factors.
* @private
diff --git a/chromium/chrome/browser/resources/settings/people_page/setup_pin_dialog.html b/chromium/chrome/browser/resources/settings/people_page/setup_pin_dialog.html
index ec1fb7827e3..093bace2c14 100644
--- a/chromium/chrome/browser/resources/settings/people_page/setup_pin_dialog.html
+++ b/chromium/chrome/browser/resources/settings/people_page/setup_pin_dialog.html
@@ -13,6 +13,10 @@
<style include="settings-shared">
#pinKeyboardDiv {
justify-content: center;
+ };
+
+ #pinKeyboard {
+ --cr-input-placeholder-letter-spacing: normal;
}
</style>
<cr-dialog id="dialog" on-close="close"
@@ -28,7 +32,8 @@
on-set-pin-done="onSetPinDone_"
set-modes="{{setModes}}"
quick-unlock-private="[[quickUnlockPrivate]]"
- write-uma="[[writeUma_]]">
+ write-uma="[[writeUma_]]"
+ enable-placeholder>
</setup-pin-keyboard>
</div>
</div>
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 fd28dad676a..e65b7efd44b 100644
--- a/chromium/chrome/browser/resources/settings/people_page/sync_page.js
+++ b/chromium/chrome/browser/resources/settings/people_page/sync_page.js
@@ -506,7 +506,10 @@ Polymer({
case settings.PageStatus.PASSPHRASE_FAILED:
if (this.pageStatus_ == this.pages_.CONFIGURE && this.syncPrefs &&
this.syncPrefs.passphraseRequired) {
- this.$$('#existingPassphraseInput').invalid = true;
+ const passphraseInput = /** @type {!CrInputElement} */ (
+ this.$$('#existingPassphraseInput'));
+ passphraseInput.invalid = true;
+ passphraseInput.focusInput();
}
return;
}
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 f6ba5eba5bd..dbc871abac2 100644
--- a/chromium/chrome/browser/resources/settings/people_page/user_list.html
+++ b/chromium/chrome/browser/resources/settings/people_page/user_list.html
@@ -47,8 +47,10 @@
<div class="user layout horizontal center two-line">
<img class="user-icon" src="[[getProfilePictureUrl_(item)]]">
<div class="flex layout vertical user-info no-min-width">
- <div class="text-elide">[[getUserName_(item)]]</div>
- <div class="secondary text-elide"
+ <div class="text-elide" title="[[getTooltip_(item)]]">
+ [[getUserName_(item)]]
+ </div>
+ <div class="secondary text-elide" title="[[item.displayEmail]]"
hidden$="[[!shouldShowEmail_(item)]]">
[[item.displayEmail]]
</div>
diff --git a/chromium/chrome/browser/resources/settings/people_page/user_list.js b/chromium/chrome/browser/resources/settings/people_page/user_list.js
index 66786887296..066f71f607c 100644
--- a/chromium/chrome/browser/resources/settings/people_page/user_list.js
+++ b/chromium/chrome/browser/resources/settings/people_page/user_list.js
@@ -123,4 +123,14 @@ Polymer({
shouldShowEmail_: function(user) {
return !user.isSupervised && user.name != user.displayEmail;
},
+
+ /**
+ * Use this function to prevent tooltips from displaying for user names. We
+ * only want to display tooltips for email addresses.
+ * @param {chrome.usersPrivate.User} user
+ * @private
+ */
+ getTooltip_: function(user) {
+ return !this.shouldShowEmail_(user) ? user.displayEmail : '';
+ },
});
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 e1caa97fc46..cbcbc0b24d5 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
@@ -10,17 +10,17 @@
<dom-module id="settings-users-add-user-dialog">
<template>
<style include="settings-shared">
- cr-input {
- width: var(--settings-input-max-width);
- --cr-input-error-display: none;
+ cr-dialog::part(dialog) {
+ width: 320px;
}
</style>
<cr-dialog id="dialog" close-text="$i18n{close}">
<div slot="title">$i18n{addUsers}</div>
<div slot="body">
<cr-input id="addUserInput" label="$i18n{addUsersEmail}"
- invalid="[[shouldShowError_(isEmail_, isEmpty_)]]"
- on-value-changed="onInput_" autofocus>
+ invalid="[[shouldShowError_(errorCode_)]]"
+ on-value-changed="onInput_"
+ error-message="[[getErrorString_(errorCode_)]]" autofocus>
</cr-input>
</div>
<div slot="button-container">
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 3721024821d..a68a908b4b6 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
@@ -29,11 +29,26 @@ const EMAIL_REGEX = new RegExp(
'^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)@' +
'([A-Za-z0-9\-]{2,63}\\..+)\\s*$');
+/** @enum {number} */
+const UserAddError = {
+ NO_ERROR: 0,
+ INVALID_EMAIL: 1,
+ USER_EXISTS: 2,
+};
+
Polymer({
is: 'settings-users-add-user-dialog',
+ behaviors: [I18nBehavior],
+
properties: {
/** @private */
+ errorCode_: {
+ type: Number,
+ value: UserAddError.NO_ERROR,
+ },
+
+ /** @private */
isEmail_: {
type: Boolean,
value: false,
@@ -46,6 +61,8 @@ Polymer({
},
},
+ usersPrivate_: chrome.usersPrivate,
+
open: function() {
this.$.addUserInput.value = '';
this.onInput_();
@@ -74,11 +91,20 @@ Polymer({
userEmail = emailMatches[1] + '@' + emailMatches[2];
}
- chrome.usersPrivate.addWhitelistedUser(
- userEmail,
- /* callback */ function(success) {});
- this.$.addUserInput.value = '';
- this.$.dialog.close();
+ this.usersPrivate_.isWhitelistedUser(userEmail, doesUserExist => {
+ if (doesUserExist) {
+ // This user email had been saved previously
+ this.errorCode_ = UserAddError.USER_EXISTS;
+ return;
+ }
+
+ this.$.dialog.close();
+ this.usersPrivate_.addWhitelistedUser(
+ userEmail,
+ /* callback */ function(success) {});
+
+ this.$.addUserInput.value = '';
+ });
},
/**
@@ -99,6 +125,13 @@ Polymer({
const input = this.$.addUserInput.value;
this.isEmail_ = NAME_ONLY_REGEX.test(input) || EMAIL_REGEX.test(input);
this.isEmpty_ = input.length == 0;
+
+ if (!this.isEmail_ && !this.isEmpty_) {
+ this.errorCode_ = UserAddError.INVALID_EMAIL;
+ return;
+ }
+
+ this.errorCode_ = UserAddError.NO_ERROR;
},
/**
@@ -106,7 +139,20 @@ Polymer({
* @return {boolean}
*/
shouldShowError_: function() {
- return !this.isEmail_ && !this.isEmpty_;
+ return this.errorCode_ != UserAddError.NO_ERROR;
+ },
+
+ /**
+ * @private
+ * @return {string}
+ */
+ getErrorString_: function(errorCode_) {
+ if (errorCode_ == UserAddError.USER_EXISTS) {
+ return this.i18n('userExistsError');
+ }
+ //TODO errorString for UserAddError.INVALID_EMAIL crbug/1007481
+
+ return '';
},
});
diff --git a/chromium/chrome/browser/resources/settings/printing_page/BUILD.gn b/chromium/chrome/browser/resources/settings/printing_page/BUILD.gn
index e7619959244..00b021d9f12 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/printing_page/BUILD.gn
@@ -21,7 +21,8 @@ js_type_check("closure_compile") {
":cups_printers",
":cups_printers_browser_proxy",
":cups_printers_entry",
- ":cups_printers_entry_list",
+ ":cups_printers_entry_list_behavior",
+ ":cups_printers_entry_manager",
":cups_printers_list",
":cups_saved_printers",
":printing_browser_proxy",
@@ -82,6 +83,10 @@ if (is_chromeos) {
deps = [
":cups_printer_types",
":cups_printers_browser_proxy",
+ ":cups_printers_entry",
+ ":cups_printers_entry_list_behavior",
+ ":cups_printers_entry_manager",
+ "//ui/webui/resources/js:list_property_update_behavior",
"//ui/webui/resources/js:web_ui_listener_behavior",
]
}
@@ -102,6 +107,7 @@ if (is_chromeos) {
deps = [
":cups_nearby_printers",
":cups_printers_browser_proxy",
+ ":cups_printers_entry_manager",
":cups_saved_printers",
"..:route",
"//ui/webui/resources/cr_components/chromeos/network:mojo_interface_provider",
@@ -128,14 +134,22 @@ if (is_chromeos) {
]
}
- js_library("cups_printers_entry_list") {
+ js_library("cups_printers_entry_list_behavior") {
deps = [
":cups_printer_types",
- ":cups_printers_browser_proxy",
"//ui/webui/resources/js:list_property_update_behavior",
]
}
+ js_library("cups_printers_entry_manager") {
+ deps = [
+ ":cups_printer_types",
+ ":cups_printers_browser_proxy",
+ "//ui/webui/resources/js:assert",
+ "//ui/webui/resources/js:cr",
+ ]
+ }
+
js_library("cups_printers_list") {
deps = [
":cups_printers_browser_proxy",
@@ -149,7 +163,11 @@ if (is_chromeos) {
deps = [
":cups_printer_types",
":cups_printers_browser_proxy",
+ ":cups_printers_entry",
+ ":cups_printers_entry_list_behavior",
+ ":cups_printers_entry_manager",
"//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu",
+ "//ui/webui/resources/js:list_property_update_behavior",
"//ui/webui/resources/js:web_ui_listener_behavior",
]
}
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 7c9a314bf87..f19b1047748 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
@@ -78,7 +78,8 @@
<template>
<style include="cups-printer-shared"></style>
<add-printer-dialog>
- <div slot="dialog-title">$i18n{addPrintersManuallyTitle}</div>
+ <div slot="dialog-title">
+ $i18n{addPrintersManuallyTitle}
<div id="general-error-container" hidden="[[!errorText_]]">
<div id="general-error">
<iron-icon id="general-error-icon" icon="cr:warning"></iron-icon>
@@ -87,6 +88,7 @@
</div>
</div>
</div>
+ </div>
<div slot="dialog-body">
<div class="settings-box first two-line">
<cr-input class="printer-name-input" autofocus
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 7f78d1dfb77..6b2ceffcc92 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
@@ -445,7 +445,7 @@ Polymer({
.getNetworkStateList({
filter: chromeos.networkConfig.mojom.FilterType.kActive,
networkType: chromeos.networkConfig.mojom.NetworkType.kAll,
- limit: chromeos.networkConfig.mojom.kNoLimit,
+ limit: chromeos.networkConfig.mojom.NO_LIMIT,
})
.then((responseParams) => {
this.onActiveNetworksChanged(responseParams.result);
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.html b/chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.html
index 7d6bf1824d2..da0573be5ea 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.html
@@ -1,26 +1,39 @@
<link rel="import" href="chrome://resources/html/polymer.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/iron-list/iron-list.html">
<link rel="import" href="cups_printer_types.html">
<link rel="import" href="cups_printers_browser_proxy.html">
-<link rel="import" href="cups_printers_entry_list.html">
+<link rel="import" href="cups_printers_entry_list_behavior.html">
+<link rel="import" href="cups_printers_entry.html">
+<link rel="import" href="cups_printers_entry_manager.html">
<link rel="import" href="../settings_shared_css.html">
<dom-module id="settings-cups-nearby-printers">
<template>
- <style include="settings-shared">
- #noPrinterMessage {
- margin-inline-start: 60px;
+ <style include="cups-printer-shared">
+ :host {
+ display: flex;
+ flex-direction: column;
+ }
+
+ #no-search-results {
margin-top: 20px;
}
</style>
- <settings-cups-printers-entry-list printers="[[nearbyPrinters_]]"
- search-term="[[searchTerm]]">
- </settings-cups-printers-entry-list>
- <div class="secondary" id="noPrinterMessage"
- hidden="[[!shouldShowNoNearbyPrinterMessage_(searchTerm,
- nearbyPrinters_)]]">
- $i18n{noPrinterNearbyMessage}
+
+ <iron-list class="list-frame vertical-list flex-auto" id="printerEntryList"
+ items="[[filteredPrinters_]]">
+ <template>
+ <settings-cups-printers-entry printer-entry="[[item]]">
+ </settings-cups-printers-entry>
+ </template>
+ </iron-list>
+ <div id="no-search-results"
+ hidden="[[!showNoSearchResultsMessage_(searchTerm,
+ filteredPrinters_.*)]]">
+ $i18n{noSearchResults}
</div>
</template>
<script src="cups_nearby_printers.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.js b/chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.js
index aa4912c4010..f4020c2e390 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_nearby_printers.js
@@ -9,20 +9,16 @@
Polymer({
is: 'settings-cups-nearby-printers',
- behaviors: [WebUIListenerBehavior],
+ // ListPropertyUpdateBehavior is used in CupsPrintersEntryListBehavior.
+ behaviors: [
+ CupsPrintersEntryListBehavior,
+ ListPropertyUpdateBehavior,
+ WebUIListenerBehavior,
+ ],
properties: {
/**
- * @type {!Array<!PrinterListEntry>}
- * @private
- */
- nearbyPrinters_: {
- type: Array,
- value: () => [],
- },
-
- /**
- * Search term for filtering |nearbyPrinters_|.
+ * Search term for filtering |nearbyPrinters|.
* @type {string}
*/
searchTerm: {
@@ -30,6 +26,12 @@ Polymer({
value: '',
},
+ /** @type {?CupsPrinterInfo} */
+ activePrinter: {
+ type: Object,
+ notify: true,
+ },
+
/**
* @type {number}
* @private
@@ -39,48 +41,47 @@ Polymer({
value: -1,
},
- /** @type {?CupsPrinterInfo} */
- activePrinter: {
- type: Object,
- notify: true,
+ /**
+ * List of printers filtered through a search term.
+ * @type {!Array<!PrinterListEntry>}
+ * @private
+ */
+ filteredPrinters_: {
+ type: Array,
+ value: () => [],
},
},
listeners: {
'add-automatic-printer': 'onAddAutomaticPrinter_',
+ 'query-discovered-printer': 'onQueryDiscoveredPrinter_',
},
- /** @override */
- attached: function() {
- settings.CupsPrintersBrowserProxyImpl.getInstance()
- .startDiscoveringPrinters();
- this.addWebUIListener(
- 'on-nearby-printers-changed', this.onNearbyPrintersChanged_.bind(this));
- },
+ observers: [
+ 'onSearchOrPrintersChanged_(nearbyPrinters.*, searchTerm)'
+ ],
/**
- * @param {!Array<!CupsPrinterInfo>} automaticPrinters
- * @param {!Array<!CupsPrinterInfo>} discoveredPrinters
+ * Redoes the search whenever |searchTerm| or |nearbyPrinters| changes.
* @private
*/
- onNearbyPrintersChanged_: function(automaticPrinters, discoveredPrinters) {
- if (!automaticPrinters && !discoveredPrinters) {
+ onSearchOrPrintersChanged_: function() {
+ if (!this.nearbyPrinters) {
return;
}
-
- const printers = /** @type{!Array<!PrinterListEntry>} */ ([]);
-
- for (const printer of automaticPrinters) {
- printers.push({printerInfo: printer,
- printerType: PrinterType.AUTOMATIC});
- }
-
- for (const printer of discoveredPrinters) {
- printers.push({printerInfo: printer,
- printerType: PrinterType.DISCOVERED});
- }
-
- this.nearbyPrinters_ = printers;
+ // Filter printers through |searchTerm|. If |searchTerm| is empty,
+ // |filteredPrinters_| is just |nearbyPrinters|.
+ const updatedPrinters = this.searchTerm ?
+ this.nearbyPrinters.filter(
+ item => settings.printing.matchesSearchTerm(
+ item.printerInfo,this.searchTerm)) :
+ this.nearbyPrinters.slice();
+
+ updatedPrinters.sort(settings.printing.sortPrinters);
+
+ this.updateList(
+ 'filteredPrinters_', printer => printer.printerInfo.printerId,
+ updatedPrinters);
},
/**
@@ -100,18 +101,38 @@ Polymer({
},
/**
+ * @param {!CustomEvent<{item: !PrinterListEntry}>} e
+ * @private
+ */
+ onQueryDiscoveredPrinter_: function(e) {
+ const item = e.detail.item;
+ this.setActivePrinter_(item);
+
+ // This is a workaround to ensure type safety on the params of the casted
+ // function. We do this because the closure compiler does not work well with
+ // rejected js promises.
+ const queryDiscoveredPrinterFailed = /** @type {!Function}) */(
+ this.onQueryDiscoveredPrinterFailed_.bind(this));
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .addDiscoveredPrinter(item.printerInfo.printerId)
+ .then(
+ this.onQueryDiscoveredPrinterSucceeded_.bind(this,
+ item.printerInfo.printerName),
+ queryDiscoveredPrinterFailed);
+ },
+
+ /**
* Retrieves the index of |item| in |nearbyPrinters_| and sets that printer as
* the active printer.
* @param {!PrinterListEntry} item
* @private
*/
setActivePrinter_: function(item) {
- this.activePrinterListEntryIndex_ =
- this.nearbyPrinters_.findIndex(
- printer => printer.printerInfo == item.printerInfo);
+ this.activePrinterListEntryIndex_ = this.nearbyPrinters.findIndex(
+ printer => printer.printerInfo.printerId == item.printerInfo.printerId);
this.activePrinter =
- this.get(['nearbyPrinters_', this.activePrinterListEntryIndex_])
+ this.get(['nearbyPrinters', this.activePrinterListEntryIndex_])
.printerInfo;
},
@@ -140,10 +161,32 @@ Polymer({
},
/**
- * @return {boolean} Returns true if noPrinterMessage should be visible.
+ * Handler for queryDiscoveredPrinter success.
+ * @param {string} printerName
+ * @param {!PrinterSetupResult} result
+ * @private
+ */
+ onQueryDiscoveredPrinterSucceeded_: function(printerName, result) {
+ this.fire(
+ 'show-cups-printer-toast',
+ {resultCode: result, printerName: printerName});
+ },
+
+ /**
+ * Handler for queryDiscoveredPrinter failure.
+ * @param {!CupsPrinterInfo} printer
+ * @private
+ */
+ onQueryDiscoveredPrinterFailed_: function(printer) {
+ this.fire('open-manufacturer-model-dialog-for-specified-printer',
+ {item: /** @type {CupsPrinterInfo} */(printer)});
+ },
+
+ /**
+ * @return {boolean} Returns true if the no search message should be visible.
* @private
*/
- shouldShowNoNearbyPrinterMessage_: function() {
- return !this.searchTerm && !this.nearbyPrinters_.length;
+ showNoSearchResultsMessage_: function() {
+ return !!this.searchTerm && !this.filteredPrinters_.length;
}
}); \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.js b/chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.js
index 15542cb8d1c..46b1be62226 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printer_dialog_util.js
@@ -141,6 +141,40 @@ cr.define('settings.printing', function() {
}
}
+ /**
+ * We sort by printer type, which is based off of a maintained list in
+ * cups_printers_types.js. If the types are the same, we sort alphabetically.
+ * @param {!PrinterListEntry} first
+ * @param {!PrinterListEntry} second
+ * @return {number}
+ */
+ function sortPrinters(first, second) {
+ if (first.printerType == second.printerType) {
+ return settings.printing.alphabeticalSort(
+ first.printerInfo, second.printerInfo);
+ }
+
+ return first.printerType - second.printerType;
+ }
+
+ /**
+ * @param {!CupsPrinterInfo} printer
+ * @param {string} searchTerm
+ * @return {boolean} True if the printer has |searchTerm| in its name.
+ */
+ function matchesSearchTerm(printer, searchTerm) {
+ return printer.printerName.toLowerCase().includes(searchTerm.toLowerCase());
+ }
+
+ /**
+ * @param {!PrinterListEntry} first
+ * @param {!PrinterListEntry} second
+ * @return {boolean}
+ */
+ function arePrinterIdsEqual(first, second) {
+ return first.printerInfo.printerId == second.printerInfo.printerId;
+ }
+
return {
isNetworkProtocol: isNetworkProtocol,
isNameAndAddressValid: isNameAndAddressValid,
@@ -148,5 +182,8 @@ cr.define('settings.printing', function() {
getBaseName: getBaseName,
alphabeticalSort: alphabeticalSort,
getErrorText: getErrorText,
+ sortPrinters: sortPrinters,
+ matchesSearchTerm: matchesSearchTerm,
+ arePrinterIdsEqual: arePrinterIdsEqual,
};
});
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 cda0410aaa6..68ee364dca0 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
@@ -68,6 +68,10 @@
width: 100%;
}
+ .flex-auto {
+ flex: 1 1 auto;
+ }
+
.list-item {
background: none;
border: none;
@@ -109,6 +113,10 @@
font-size: 10px;
margin-inline-start: 5px;
}
+
+ #no-search-results {
+ text-align: center;
+ }
</style>
</template>
</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers.html b/chromium/chrome/browser/resources/settings/printing_page/cups_printers.html
index 6777282b161..c5b866a04bc 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printers.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers.html
@@ -16,6 +16,7 @@
<link rel="import" href="cups_add_printer_dialog.html">
<link rel="import" href="cups_edit_printer_dialog.html">
<link rel="import" href="cups_printer_shared_css.html">
+<link rel="import" href="cups_printers_entry_manager.html">
<link rel="import" href="cups_printers_list.html">
<link rel="import" href="cups_saved_printers.html">
<link rel="import" href="cups_nearby_printers.html">
@@ -142,7 +143,6 @@
<settings-cups-saved-printers id="savedPrinters"
active-printer="{{activePrinter}}"
- saved-printers="[[savedPrinters_]]"
search-term="[[searchTerm]]">
</settings-cups-saved-printers>
</div>
@@ -197,7 +197,7 @@
</settings-cups-edit-printer-dialog>
</template>
- <cr-toast id="errorToast" duration="3000">
+ <cr-toast id="errorToast" duration="3000" role="alert">
<div class="error-message" id="addPrinterDoneMessage">
[[addPrinterResultText_]]
</div>
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 21109350ab6..ece618460ad 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printers.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers.js
@@ -81,11 +81,16 @@ Polymer({
/** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfig_: null,
+ /** @private {settings.printing.CupsPrintersEntryManager} */
+ entryManager_: null,
+
/** @override */
created: function() {
this.networkConfig_ =
network_config.MojoInterfaceProviderImpl.getInstance()
.getMojoServiceRemote();
+ this.entryManager_ =
+ settings.printing.CupsPrintersEntryManager.getInstance();
},
/** @override */
@@ -94,7 +99,7 @@ Polymer({
.getNetworkStateList({
filter: chromeos.networkConfig.mojom.FilterType.kActive,
networkType: chromeos.networkConfig.mojom.NetworkType.kAll,
- limit: chromeos.networkConfig.mojom.kNoLimit,
+ limit: chromeos.networkConfig.mojom.NO_LIMIT,
})
.then((responseParams) => {
this.onActiveNetworksChanged(responseParams.result);
@@ -110,7 +115,6 @@ Polymer({
this.updateCupsPrintersList_();
},
-
/**
* settings.RouteObserverBehavior
* @param {!settings.Route} route
@@ -119,10 +123,14 @@ Polymer({
currentRouteChanged: function(route) {
if (route != settings.routes.CUPS_PRINTERS) {
cr.removeWebUIListener('on-printers-changed');
+ this.entryManager_.removeWebUIListeners();
return;
}
+
+ this.entryManager_.addWebUIListeners();
cr.addWebUIListener(
'on-printers-changed', this.onPrintersChanged_.bind(this));
+ this.updateCupsPrintersList_();
},
/**
@@ -148,17 +156,15 @@ Polymer({
* }>} event
* @private
*/
- openResultToast_: function(event) {
+ openResultToast_: function(event) {
const printerName = event.detail.printerName;
switch (event.detail.resultCode) {
case PrinterSetupResult.SUCCESS:
- this.updateCupsPrintersList_();
this.addPrinterResultText_ =
loadTimeData.getStringF('printerAddedSuccessfulMessage',
printerName);
break;
case PrinterSetupResult.EDIT_SUCCESS:
- this.updateCupsPrintersList_();
this.addPrinterResultText_ =
loadTimeData.getStringF('printerEditedSuccessfulMessage',
printerName);
@@ -203,6 +209,7 @@ Polymer({
printer => /** @type {!PrinterListEntry} */({
printerInfo: printer,
printerType: PrinterType.SAVED}));
+ this.entryManager_.setSavedPrintersList(this.savedPrinters_);
} else {
this.printers = cupsPrintersList.printerList;
}
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.html b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.html
index c8df839a0ee..8d7c6b5145c 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.html
@@ -29,7 +29,7 @@
<template is="dom-if"
if="[[isDiscoveredPrinter_(printerEntry.printerType)]]">
<cr-button id="setupPrinterButton"
- on-click="onOpenManufacturerModelDialogTap_">
+ on-click="onAddDiscoveredPrinterTap_">
$i18n{setupPrinter}
</cr-button>
</template>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.js b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.js
index fe225dcf9fa..5734b7717ae 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry.js
@@ -33,9 +33,8 @@ Polymer({
});
},
- onOpenManufacturerModelDialogTap_: function(e) {
- this.fire('open-manufacturer-model-dialog-for-specified-printer',
- {item: this.printerEntry.printerInfo});
+ onAddDiscoveredPrinterTap_: function(e) {
+ this.fire('query-discovered-printer', {item: this.printerEntry});
},
onAddAutomaticPrinterTap_: function() {
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list.html b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list.html
deleted file mode 100644
index bf9fbaf1f9f..00000000000
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/html/list_property_update_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
-<link rel="import" href="cups_printer_dialog_util.html">
-<link rel="import" href="cups_printer_types.html">
-<link rel="import" href="cups_printers_browser_proxy.html">
-<link rel="import" href="cups_printers_entry.html">
-<link rel="import" href="../settings_shared_css.html">
-
-<dom-module id="settings-cups-printers-entry-list">
- <template>
- <style include="settings-shared">
- :host {
- display: flex;
- flex-direction: column;
- }
-
- iron-list {
- flex: 1 1 auto;
- }
-
- #no-search-results {
- margin-top: 20px;
- text-align: center;
- }
-
- </style>
- <iron-list class="list-frame vertical-list" id="printerEntryList"
- items="[[filteredPrinters_]]">
- <template>
- <settings-cups-printers-entry printer-entry="[[item]]">
- </settings-cups-printers-entry>
- </template>
- </iron-list>
- <div id="no-search-results"
- hidden="[[!showNoSearchResultsMessage_]]">
- $i18n{noSearchResults}
- </div>
- </template>
- <script src="cups_printers_entry_list.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list.js b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list.js
deleted file mode 100644
index 3fe5f69bd12..00000000000
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list.js
+++ /dev/null
@@ -1,110 +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.
-
-/**
- * @fileoverview 'settings-cups-printers-entry-list' is a component for a list
- * of PrinterListEntry's.
- */
-Polymer({
- is: 'settings-cups-printers-entry-list',
-
- behaviors: [
- ListPropertyUpdateBehavior,
- ],
-
- properties: {
- /**
- * List of printers.
- * @type {!Array<!PrinterListEntry>}
- */
- printers: {
- type: Array,
- value: () => [],
- },
-
- /**
- * List of printers filtered through a search term.
- * @type {!Array<!PrinterListEntry>}
- * @private
- */
- filteredPrinters_: {
- type: Array,
- value: () => [],
- },
-
- /**
- * Search term for filtering |printers|.
- * @type {string}
- */
- searchTerm: {
- type: String,
- value: '',
- },
-
- /**
- * Whether to show the no search results message.
- * @type {boolean}
- * @private
- */
- showNoSearchResultsMessage_: {
- type: Boolean,
- value: false,
- },
- },
-
- observers: [
- 'onSearchChanged_(printers.*, searchTerm)'
- ],
-
- /**
- * Redoes the search whenever |searchTerm| or |printers| changes.
- * @private
- */
- onSearchChanged_: function() {
- if (!this.printers) {
- return;
- }
- // Filter printers through |searchTerm|. If |searchTerm| is empty,
- // |filteredPrinters_| is just |printers|.
- const updatedPrinters = this.searchTerm ?
- this.printers.filter(
- item =>this.matchesSearchTerm_(item.printerInfo,this.searchTerm)) :
- this.printers.slice();
-
- updatedPrinters.sort(this.sortPrinters_);
-
- this.updateList('filteredPrinters_', printer => printer.printerInfo,
- updatedPrinters);
-
- this.showNoSearchResultsMessage_ =
- !!this.searchTerm && !this.filteredPrinters_.length;
- },
-
-
- /**
- * @param {!PrinterListEntry} first
- * @param {!PrinterListEntry} second
- * @return {number}
- * @private
- */
- sortPrinters_: function(first, second) {
- if (first.printerType == second.printerType) {
- return settings.printing.alphabeticalSort(
- first.printerInfo, second.printerInfo);
- }
-
- // PrinterType sort order maintained in cups_printer_types.js
- return first.printerType - second.printerType;
- },
-
- /**
- * @param {!CupsPrinterInfo} printer
- * @param {string} searchTerm
- * @return {boolean} True if the printer has |searchTerm| in its name.
- * @private
- */
- matchesSearchTerm_: function(printer, searchTerm) {
- return printer.printerName.toLowerCase().includes(searchTerm.toLowerCase());
- }
-});
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list_behavior.html b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list_behavior.html
new file mode 100644
index 00000000000..6f30319498f
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list_behavior.html
@@ -0,0 +1,2 @@
+<link rel="import" href="cups_printer_types.html">
+<script src="cups_printers_entry_list_behavior.js"></script> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list_behavior.js b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list_behavior.js
new file mode 100644
index 00000000000..59588b24629
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_list_behavior.js
@@ -0,0 +1,98 @@
+// 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 Polymer behavior for observing CupsPrintersEntryManager events.
+ * Use this behavior if you want to receive a dynamically updated list of both
+ * saved and nearby printers.
+ */
+
+/** @polymerBehavior */
+const CupsPrintersEntryListBehavior = {
+ properties: {
+ /** @private {!settings.printing.CupsPrintersEntryManager} */
+ entryManager_: Object,
+
+ /** @type {!Array<!PrinterListEntry>} */
+ savedPrinters: {
+ type: Array,
+ value: () => [],
+ },
+
+ /** @type {!Array<!PrinterListEntry>} */
+ nearbyPrinters: {
+ type: Array,
+ value: () => [],
+ },
+ },
+
+ /** @override */
+ created: function() {
+ this.entryManager_ =
+ settings.printing.CupsPrintersEntryManager.getInstance();
+ },
+
+ /** @override */
+ attached: function() {
+ this.entryManager_.addOnSavedPrintersChangedListener(
+ this.onSavedPrintersChanged_.bind(this));
+ this.entryManager_.addOnNearbyPrintersChangedListener(
+ this.onNearbyPrintersChanged_.bind(this));
+
+ // Initialize saved and nearby printers list.
+ this.onSavedPrintersChanged_(
+ this.entryManager_.savedPrinters, [] /* printerAdded */,
+ [] /* printerRemoved */);
+ this.onNearbyPrintersChanged_(this.entryManager_.nearbyPrinters);
+ },
+
+ /** @override */
+ detached: function() {
+ this.entryManager_.removeOnSavedPrintersChangedListener(
+ this.onSavedPrintersChanged_.bind(this));
+ this.entryManager_.removeOnNearbyPrintersChangedListener(
+ this.onNearbyPrintersChanged_.bind(this));
+ },
+
+ /**
+ * Non-empty params indicate the applicable change to be notified.
+ * @param {!Array<!PrinterListEntry>} savedPrinters
+ * @param {!Array<!PrinterListEntry>} addedPrinters
+ * @param {!Array<!PrinterListEntry>} removedPrinters
+ * @private
+ */
+ onSavedPrintersChanged_: function(
+ savedPrinters, addedPrinters, removedPrinters) {
+ this.updateList(
+ 'savedPrinters', printer => printer.printerInfo.printerId,
+ savedPrinters);
+
+ assert(!(addedPrinters.length && removedPrinters.length));
+
+ if (addedPrinters.length) {
+ this.onSavedPrintersAdded(addedPrinters);
+ } else if (removedPrinters.length) {
+ this.onSavedPrintersRemoved(removedPrinters);
+ }
+ },
+
+ /**
+ * @param {!Array<!PrinterListEntry>} printerList
+ * @private
+ */
+ onNearbyPrintersChanged_: function(printerList) {
+ this.updateList(
+ 'nearbyPrinters', printer => printer.printerInfo.printerId,
+ printerList);
+ },
+
+ // CupsPrintersEntryListBehavior methods. Override these in the
+ // implementations.
+
+ /** @param{!Array<!PrinterListEntry>} addedPrinters */
+ onSavedPrintersAdded: function(addedPrinters) {},
+
+ /** @param{!Array<!PrinterListEntry>} removedPrinters */
+ onSavedPrintersRemoved: function(removedPrinters) {},
+}; \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_manager.html b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_manager.html
new file mode 100644
index 00000000000..d8e4aac3867
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_manager.html
@@ -0,0 +1,5 @@
+<link rel="import" href="chrome://resources/html/assert.html">
+<link rel="import" href="chrome://resources/html/cr.html">
+<link rel="import" href="cups_printer_types.html">
+<link rel="import" href="cups_printers_browser_proxy.html">
+<script src="cups_printers_entry_manager.js"></script> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_manager.js b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_manager.js
new file mode 100644
index 00000000000..86908fbb3c3
--- /dev/null
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_printers_entry_manager.js
@@ -0,0 +1,182 @@
+// 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 which provides the client with metadata about a change
+ * to a list of saved printers. The first parameter is the updated list of
+ * printers after the change, the second parameter is the newly-added printer
+ * (if it exists), and the third parameter is the newly-removed printer
+ * (if it exists).
+ * @typedef {!function(!Array<!PrinterListEntry>, !Array<!PrinterListEntry>,
+ * !Array<!PrinterListEntry>): void}
+ */
+let PrintersListWithDeltasCallback;
+
+/**
+ * Function which provides the client with a list that contains the nearby
+ * printers list. The parameter is the updated list of printers after any
+ * changes.
+ * @typedef {function(!Array<!PrinterListEntry>): void}
+ */
+let PrintersListCallback;
+
+cr.define('settings.printing', function() {
+ /**
+ * Finds the printers that are in |firstArr| but not in |secondArr|.
+ * @param {!Array<!PrinterListEntry>} firstArr
+ * @param {!Array<!PrinterListEntry>} secondArr
+ * @return {!Array<!PrinterListEntry>}
+ * @private
+ */
+ function findDifference_(firstArr, secondArr) {
+ return firstArr.filter((firstArrEntry) => {
+ return !secondArr.some(
+ p => p.printerInfo.printerId == firstArrEntry.printerInfo.printerId);
+ });
+ }
+
+ /**
+ * Class for managing printer entries. Holds both Saved and Nearby printers
+ * and notifies observers of any applicable changes to either printer lists.
+ */
+ class CupsPrintersEntryManager {
+ constructor() {
+ /** @private {!Array<!PrinterListEntry>} */
+ this.savedPrinters_ = [];
+
+ /** @private {!Array<!PrinterListEntry>} */
+ this.nearbyPrinters_ = [];
+
+ /** @private {!Array<PrintersListWithDeltasCallback>} */
+ this.onSavedPrintersChangedListeners_ = [];
+
+ /** @type {!Array<PrintersListCallback>} */
+ this.onNearbyPrintersChangedListeners_ = [];
+ }
+
+ addWebUIListeners() {
+ // TODO(1005905): Add on-printers-changed listener here once legacy code
+ // is removed.
+ cr.addWebUIListener(
+ 'on-nearby-printers-changed', this.setNearbyPrintersList.bind(this));
+ settings.CupsPrintersBrowserProxyImpl.getInstance()
+ .startDiscoveringPrinters();
+ }
+
+ removeWebUIListeners() {
+ cr.removeWebUIListener('on-nearby-printers-changed');
+ }
+
+ /** @return {!Array<!PrinterListEntry>} */
+ get savedPrinters() {
+ return this.savedPrinters_;
+ }
+
+ /** @return {!Array<!PrinterListEntry>} */
+ get nearbyPrinters() {
+ return this.nearbyPrinters_;
+ }
+
+ /** @param {PrintersListWithDeltasCallback} listener */
+ addOnSavedPrintersChangedListener(listener) {
+ this.onSavedPrintersChangedListeners_.push(listener);
+ }
+
+ /** @param {PrintersListWithDeltasCallback} listener */
+ removeOnSavedPrintersChangedListener(listener) {
+ this.onSavedPrintersChangedListeners_ =
+ this.onSavedPrintersChangedListeners_.filter(lis => lis != listener);
+ }
+
+ /** @param {PrintersListCallback} listener */
+ addOnNearbyPrintersChangedListener(listener) {
+ this.onNearbyPrintersChangedListeners_.push(listener);
+ }
+
+ /** @param {PrintersListCallback} listener */
+ removeOnNearbyPrintersChangedListener(listener) {
+ this.onNearbyPrintersChangedListeners_ =
+ this.onNearbyPrintersChangedListeners_.filter(lis => lis != listener);
+ }
+
+ /**
+ * Sets the saved printers list and notifies observers of any applicable
+ * changes.
+ * @param {!Array<!PrinterListEntry>} printerList
+ */
+ setSavedPrintersList(printerList) {
+ if (printerList.length > this.savedPrinters_.length) {
+ const diff = findDifference_(printerList, this.savedPrinters_);
+ this.savedPrinters_ = printerList;
+ this.notifyOnSavedPrintersChangedListeners_(
+ this.savedPrinters_, diff, [] /* printersRemoved */);
+ return;
+ }
+
+ if (printerList.length < this.savedPrinters_.length) {
+ const diff = findDifference_(this.savedPrinters_, printerList);
+ this.savedPrinters_ = printerList;
+ this.notifyOnSavedPrintersChangedListeners_(
+ this.savedPrinters_, [] /* printersAdded */, diff);
+ return;
+ }
+
+ this.savedPrinters_ = printerList;
+ this.notifyOnSavedPrintersChangedListeners_(
+ this.savedPrinters_, [] /* printersAdded */,
+ [] /* printersRemoved */);
+ }
+
+ /**
+ * Sets the nearby printers list and notifies observers of any applicable
+ * changes.
+ * @param {!Array<!CupsPrinterInfo>} automaticPrinters
+ * @param {!Array<!CupsPrinterInfo>} discoveredPrinters
+ */
+ setNearbyPrintersList(automaticPrinters, discoveredPrinters) {
+ if (!automaticPrinters && !discoveredPrinters) {
+ return;
+ }
+
+ this.nearbyPrinters_ = [];
+
+ for (const printer of automaticPrinters) {
+ this.nearbyPrinters_.push(
+ {printerInfo: printer, printerType: PrinterType.AUTOMATIC});
+ }
+
+ for (const printer of discoveredPrinters) {
+ this.nearbyPrinters_.push(
+ {printerInfo: printer, printerType: PrinterType.DISCOVERED});
+ }
+
+ this.notifyOnNearbyPrintersChangedListeners_();
+ }
+
+ /**
+ * Non-empty/null fields indicate the applicable change to be notified.
+ * @param {!Array<!PrinterListEntry>} savedPrinters
+ * @param {!Array<!PrinterListEntry>} addedPrinter
+ * @param {!Array<!PrinterListEntry>} removedPrinter
+ * @private
+ */
+ notifyOnSavedPrintersChangedListeners_(
+ savedPrinters, addedPrinter, removedPrinter) {
+ this.onSavedPrintersChangedListeners_.forEach(
+ listener => listener(savedPrinters, addedPrinter, removedPrinter));
+ }
+
+ /** @private */
+ notifyOnNearbyPrintersChangedListeners_() {
+ this.onNearbyPrintersChangedListeners_.forEach(
+ listener => listener(this.nearbyPrinters_));
+ }
+ }
+
+ cr.addSingletonGetter(CupsPrintersEntryManager);
+
+ return {
+ CupsPrintersEntryManager: CupsPrintersEntryManager,
+ };
+}); \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.html b/chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.html
index 1bb09c08fc0..c89d0230a99 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.html
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.html
@@ -1,14 +1,52 @@
<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/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/iron-flex-layout/iron-flex-layout-classes.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
<link rel="import" href="cups_printer_types.html">
<link rel="import" href="cups_printers_browser_proxy.html">
-<link rel="import" href="cups_printers_entry_list.html">
+<link rel="import" href="cups_printers_entry_list_behavior.html">
+<link rel="import" href="cups_printers_entry.html">
<link rel="import" href="../settings_shared_css.html">
<dom-module id="settings-cups-saved-printers">
<template>
+ <style include="cups-printer-shared iron-flex iron-flex-alignment
+ iron-flex-factors">
+ :host {
+ display: flex;
+ flex-direction: column;
+ }
+
+ #no-search-results {
+ margin-bottom: 20px;
+ }
+
+ /** Height of iron list row entry. */
+ #show-more-container {
+ min-height: var(--settings-row-min-height);
+ }
+
+ /** Border line that is the same size as a list entry's border. */
+ #show-more-line-separator {
+ border-bottom: var(--cr-separator-line);
+ left: 60px;
+ position: relative;
+ right: 20px;
+ width: 596px;
+ }
+
+ #show-more-icon {
+ --cr-icon-button-margin-end: 0;
+ }
+
+ #show-more-text {
+ flex: 1;
+ }
+ </style>
+
<cr-action-menu>
<button id="editButton" class="dropdown-item" on-click="onEditTap_">
$i18n{editPrinter}
@@ -18,10 +56,32 @@
</button>
</cr-action-menu>
- <style include="settings-shared"></style>
- <settings-cups-printers-entry-list printers="[[savedPrinters]]"
- search-term="[[searchTerm]]">
- </settings-cups-printers-entry-list>
+ <iron-list class="list-frame vertical-list flex-auto" id="printerEntryList"
+ items="[[filteredPrinters_]]">
+ <template>
+ <settings-cups-printers-entry printer-entry="[[item]]">
+ </settings-cups-printers-entry>
+ </template>
+ </iron-list>
+ <template is="dom-if" id="show-more-button-section"
+ if="[[shouldPrinterListBeCollapsed_(searchTerm, savedPrinters.*,
+ newPrinters_.*, hasShowMoreBeenTapped_)]]" restamp>
+ <div id="show-more-line-separator"></div>
+ <div class="list-frame layout horizontal" id="show-more-container">
+ <div id="show-more-text">$i18n{showMorePrinters}</div>
+ <cr-icon-button class="action-button" id="show-more-icon"
+ iron-icon="cr:expand-more"
+ on-click="onShowMoreTap_"
+ title=$i18n{showMorePrinters}>
+ </cr-icon-button>
+ </div>
+ </template>
+
+ <div id="no-search-results"
+ hidden="[[!showNoSearchResultsMessage_(searchTerm,
+ filteredPrinters_.*)]]">
+ $i18n{noSearchResults}
+ </div>
</template>
<script src="cups_saved_printers.js"></script>
</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.js b/chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.js
index 85ef694f1ec..948bc0526ab 100644
--- a/chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.js
+++ b/chromium/chrome/browser/resources/settings/printing_page/cups_saved_printers.js
@@ -2,6 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+(function() {
+
+// If the Show more button is visible, the minimum number of printers we show
+// is 3.
+const kMinVisiblePrinters = 3;
+
+/**
+ * Move a printer's position in |printerArr| from |fromIndex| to |toIndex|.
+ * @param {!Array<!PrinterListEntry>} printerArr
+ * @param {number} fromIndex
+ * @param {number} toIndex
+ */
+function moveEntryInPrinters(printerArr, fromIndex, toIndex) {
+ const element = printerArr[fromIndex];
+ printerArr.splice(fromIndex, 1);
+ printerArr.splice(toIndex, 0, element);
+}
+
/**
* @fileoverview 'settings-cups-saved-printers' is a list container for Saved
* Printers.
@@ -9,16 +27,14 @@
Polymer({
is: 'settings-cups-saved-printers',
+ // ListPropertyUpdateBehavior is used in CupsPrintersEntryListBehavior.
behaviors: [
- WebUIListenerBehavior,
+ CupsPrintersEntryListBehavior,
+ ListPropertyUpdateBehavior,
+ WebUIListenerBehavior,
],
properties: {
- /** @type {!Array<!PrinterListEntry>} */
- savedPrinters: {
- type: Array,
- },
-
/**
* Search term for filtering |savedPrinters|.
* @type {string}
@@ -28,6 +44,12 @@ Polymer({
value: '',
},
+ /** @type {?CupsPrinterInfo} */
+ activePrinter: {
+ type: Object,
+ notify: true,
+ },
+
/**
* @type {number}
* @private
@@ -37,10 +59,36 @@ Polymer({
value: -1,
},
- /** @type {?CupsPrinterInfo} */
- activePrinter: {
- type: Object,
- notify: true,
+ /**
+ * List of printers filtered through a search term.
+ * @type {!Array<!PrinterListEntry>}
+ * @private
+ */
+ filteredPrinters_: {
+ type: Array,
+ value: () => [],
+ },
+
+ /**
+ * Array of new PrinterListEntry's that were added during this session.
+ * @type {!Array<!PrinterListEntry>}
+ * @private
+ */
+ newPrinters_: {
+ type: Array,
+ value: () => [],
+ },
+
+ /**
+ * Keeps track of whether the user has tapped the Show more button. A search
+ * term will expand the collapsed list, so we need to keep track of whether
+ * the list expanded because of a search term or because the user tapped on
+ * the Show more button.
+ * @private
+ */
+ hasShowMoreBeenTapped_: {
+ type: Boolean,
+ value: false,
},
},
@@ -48,23 +96,50 @@ Polymer({
'open-action-menu': 'onOpenActionMenu_',
},
+ observers: [
+ 'onSearchOrPrintersChanged_(savedPrinters.*, searchTerm,' +
+ 'hasShowMoreBeenTapped_, newPrinters_.*)'
+ ],
+
/** @private {settings.CupsPrintersBrowserProxy} */
browserProxy_: null,
+ /**
+ * The number of printers we display if hidden printers are allowed.
+ * kMinVisiblePrinters is the default value and we never show fewer printers
+ * if the Show more button is visible.
+ */
+ visiblePrinterCounter_: kMinVisiblePrinters,
+
/** @override */
created: function() {
this.browserProxy_ = settings.CupsPrintersBrowserProxyImpl.getInstance();
},
/**
+ * Redoes the search whenever |searchTerm| or |savedPrinters| changes.
+ * @private
+ */
+ onSearchOrPrintersChanged_: function() {
+ if (!this.savedPrinters) {
+ return;
+ }
+
+ const updatedPrinters = this.getVisiblePrinters_();
+
+ this.updateList(
+ 'filteredPrinters_', printer => printer.printerInfo.printerId,
+ updatedPrinters);
+ },
+
+ /**
* @param {!CustomEvent<{target: !HTMLElement, item: !PrinterListEntry}>} e
* @private
*/
onOpenActionMenu_: function(e) {
const item = /** @type {!PrinterListEntry} */(e.detail.item);
- this.activePrinterListEntryIndex_ =
- this.savedPrinters.findIndex(
- printer => printer.printerInfo == item.printerInfo);
+ this.activePrinterListEntryIndex_ = this.savedPrinters.findIndex(
+ printer => printer.printerInfo.printerId == item.printerInfo.printerId);
this.activePrinter =
this.get(['savedPrinters', this.activePrinterListEntryIndex_])
.printerInfo;
@@ -90,7 +165,131 @@ Polymer({
},
/** @private */
+ onShowMoreTap_: function() {
+ this.hasShowMoreBeenTapped_ = true;
+ },
+
+ /**
+ * Gets the printers to be shown in the UI. These printers are filtered
+ * by the search term, alphabetically sorted (if applicable), and are the
+ * printers not hidden by the Show more section.
+ * @return {!Array<!PrinterListEntry>} Returns only the visible printers.
+ * @private
+ */
+ getVisiblePrinters_: function() {
+ // Filter printers through |searchTerm|. If |searchTerm| is empty,
+ // |filteredPrinters_| is just |savedPrinters|.
+ const updatedPrinters = this.searchTerm ?
+ this.savedPrinters.filter(
+ item => settings.printing.matchesSearchTerm(
+ item.printerInfo, this.searchTerm)) :
+ this.savedPrinters.slice();
+
+ updatedPrinters.sort(settings.printing.sortPrinters);
+
+ this.moveNewlyAddedPrinters_(updatedPrinters, 0 /* toIndex */);
+
+ if (this.shouldPrinterListBeCollapsed_()) {
+ // If the Show more button is visible, we only display the first
+ // N < |visiblePrinterCounter_| printers and the rest are hidden.
+ return updatedPrinters.filter(
+ (printer, idx) => idx < this.visiblePrinterCounter_);
+ }
+ return updatedPrinters;
+ },
+
+ /** @private */
closeActionMenu_: function() {
this.$$('cr-action-menu').close();
+ },
+
+ /**
+ * @return {boolean} Returns true if the no search message should be visible.
+ * @private
+ */
+ showNoSearchResultsMessage_: function() {
+ return !!this.searchTerm && !this.filteredPrinters_.length;
+ },
+
+ /** @param{!Array<!PrinterListEntry>} addedPrinters */
+ onSavedPrintersAdded: function(addedPrinters) {
+ const currArr = this.newPrinters_.slice();
+ for (const printer of addedPrinters) {
+ this.visiblePrinterCounter_++;
+ currArr.push(printer);
+ }
+
+ this.set('newPrinters_', currArr);
+ },
+
+ /** @param{!Array<!PrinterListEntry>} removedPrinters */
+ onSavedPrintersRemoved: function(removedPrinters) {
+ const currArr = this.newPrinters_.slice();
+ for (const printer of removedPrinters) {
+ const newPrinterRemovedIdx = currArr.findIndex(
+ p => p.printerInfo.printerId == printer.printerInfo.printerId);
+ // If the removed printer is a recently added printer, remove it from
+ // |currArr|.
+ if (newPrinterRemovedIdx > -1) {
+ currArr.splice(newPrinterRemovedIdx, 1);
+ }
+
+ this.visiblePrinterCounter_ = Math.max(
+ kMinVisiblePrinters, --this.visiblePrinterCounter_);
+ }
+
+ this.set('newPrinters_', currArr);
+ },
+
+ /**
+ * Keeps track of whether the Show more button should be visible which means
+ * that the printer list is collapsed. There are two ways a collapsed list
+ * may be expanded: the Show more button is tapped or if there is a search
+ * term.
+ * @return {boolean} True if the printer list should be collapsed.
+ * @private
+ */
+ shouldPrinterListBeCollapsed_: function() {
+ // If |searchTerm| is set, never collapse the list.
+ if (this.searchTerm) {
+ return false;
+ }
+
+ // If |hasShowMoreBeenTapped_| is set to true, never collapse the list.
+ if (this.hasShowMoreBeenTapped_) {
+ return false;
+ }
+
+ // If the total number of saved printers does not exceed the number of
+ // visible printers, there is no need for the list to be collapsed.
+ if (this.savedPrinters.length - this.visiblePrinterCounter_ < 1) {
+ return false;
+ }
+
+ return true;
+ },
+
+ /**
+ * Moves printers that are in |newPrinters_| to position |toIndex| of
+ * |printerArr|. This moves all recently added printers to the top of the
+ * printer list.
+ * @param {!Array<!PrinterListEntry>} printerArr
+ * @param {number} toIndex
+ * @private
+ */
+ moveNewlyAddedPrinters_: function(printerArr, toIndex) {
+ if (!this.newPrinters_.length) {
+ return;
+ }
+
+ // We have newly added printers, move them to the top of the list.
+ for (const printer of this.newPrinters_) {
+ const idx = printerArr.findIndex(
+ p => p.printerInfo.printerId == printer.printerInfo.printerId);
+ if (idx > -1) {
+ moveEntryInPrinters(printerArr, idx, toIndex);
+ }
+ }
}
});
+})();
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 491eff1b6aa..34d663a378f 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.html
+++ b/chromium/chrome/browser/resources/settings/privacy_page/personalization_options.html
@@ -2,10 +2,12 @@
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.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="../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.html">
<link rel="import" href="../prefs/prefs_behavior.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
@@ -43,10 +45,23 @@
label="$i18n{safeBrowsingEnableProtection}"
sub-label="$i18n{safeBrowsingEnableProtectionDesc}">
</settings-toggle-button>
+ <settings-toggle-button id="passwordsLeakDetectionCheckbox"
+ pref="{{prefs.profile.password_manager_leak_detection}}"
+ checked="[[getCheckedLeakDetection_(
+ userSignedIn_, passwordsLeakDetectionAvailable_)]]"
+ label="$i18n{passwordsLeakDetectionLabel}"
+ sub-label="[[getPasswordsLeakDetectionSubLabel_(
+ userSignedIn_, passwordsLeakDetectionAvailable_)]]"
+ hidden$="[[!passwordsLeakDetectionEnabled_]]"
+ disabled="[[getDisabledLeakDetection_(
+ userSignedIn_, prefs.*)]]">
+ </settings-toggle-button>
<settings-toggle-button
pref="{{prefs.safebrowsing.scout_reporting_enabled}}"
+ checked="[[getCheckedExtendedSafeBrowsing_(prefs.*)]]"
label="$i18n{safeBrowsingEnableExtendedReporting}"
- sub-label="$i18n{safeBrowsingEnableExtendedReportingDesc}">
+ sub-label="$i18n{safeBrowsingEnableExtendedReportingDesc}"
+ disabled="[[getDisabledExtendedSafeBrowsing_(prefs.*)]]">
</settings-toggle-button>
<if expr="_google_chrome">
<if expr="chromeos">
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 f3a7ad0b10b..5d066a1dee6 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: [
+ I18nBehavior,
PrefsBehavior,
WebUIListenerBehavior,
],
@@ -34,6 +35,29 @@ Polymer({
/** @type {settings.SyncStatus} */
syncStatus: Object,
+ // <if expr="not chromeos">
+ /** @private {Array<!settings.StoredAccount>} */
+ storedAccounts_: Object,
+ // </if>
+
+ /** @private */
+ userSignedIn_: {
+ type: Boolean,
+ computed: 'computeUserSignedIn_(syncStatus, storedAccounts_)',
+ },
+
+ /** @private */
+ passwordsLeakDetectionAvailable_: {
+ type: Boolean,
+ computed: 'computePasswordsLeakDetectionAvailable_(prefs.*)',
+ },
+
+ /** @private */
+ passwordsLeakDetectionEnabled_: {
+ type: Boolean,
+ value: loadTimeData.getBoolean('passwordsLeakDetectionEnabled'),
+ },
+
// <if expr="_google_chrome and not chromeos">
// TODO(dbeam): make a virtual.* pref namespace and set/get this normally
// (but handled differently in C++).
@@ -61,6 +85,84 @@ Polymer({
this.addWebUIListener('metrics-reporting-change', setMetricsReportingPref);
this.browserProxy_.getMetricsReporting().then(setMetricsReportingPref);
// </if>
+ // <if expr="not chromeos">
+ const storedAccountsChanged = storedAccounts => this.storedAccounts_ =
+ storedAccounts;
+ const syncBrowserProxy = settings.SyncBrowserProxyImpl.getInstance();
+ syncBrowserProxy.getStoredAccounts().then(storedAccountsChanged);
+ this.addWebUIListener('stored-accounts-updated', storedAccountsChanged);
+ // </if>
+
+ // Even though we already set checked="[[getCheckedLeakDetection_(...)]]"
+ // in the DOM, this might be overridden within prefValueChanged_ of
+ // SettingsBooleanControlBehaviorImpl which gets invoked once we navigate to
+ // sync_page.html. Re-computing the checked value here once fixes this
+ // problem.
+ this.$.passwordsLeakDetectionCheckbox.checked =
+ this.getCheckedLeakDetection_();
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ computeUserSignedIn_: function() {
+ return (!!this.syncStatus && !!this.syncStatus.signedIn) ?
+ !this.syncStatus.hasError :
+ (!!this.storedAccounts_ && this.storedAccounts_.length > 0);
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ computePasswordsLeakDetectionAvailable_: function() {
+ return !!this.getPref('profile.password_manager_leak_detection').value &&
+ !!this.getPref('safebrowsing.enabled').value;
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ getCheckedLeakDetection_: function() {
+ return this.userSignedIn_ && this.passwordsLeakDetectionAvailable_;
+ },
+
+ /**
+ * @return {string}
+ * @private
+ */
+ getPasswordsLeakDetectionSubLabel_: function() {
+ if (!this.userSignedIn_ && this.passwordsLeakDetectionAvailable_) {
+ return this.i18n('passwordsLeakDetectionSignedOutEnabledDescription');
+ }
+ return '';
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ getDisabledLeakDetection_: function() {
+ return !this.userSignedIn_ || !this.getPref('safebrowsing.enabled').value;
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ getCheckedExtendedSafeBrowsing_: function() {
+ return !!this.getPref('safebrowsing.enabled').value &&
+ !!this.getPref('safebrowsing.scout_reporting_enabled').value;
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ getDisabledExtendedSafeBrowsing_: function() {
+ return !this.getPref('safebrowsing.enabled').value;
},
// <if expr="_google_chrome and not chromeos">
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 1ad29354d5c..9b9618c956d 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.html
+++ b/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.html
@@ -303,6 +303,23 @@
</category-setting-exceptions>
</settings-subpage>
</template>
+ <template is="dom-if" if="[[enableInsecureContentContentSetting_]]">
+ <template is="dom-if" route-path="/content/insecureContent" no-search>
+ <settings-subpage
+ page-title="$i18n{siteSettingsCategoryInsecureContent}"
+ search-label="$i18n{siteSettingsAllSitesSearch}"
+ search-term="{{searchFilter_}}">
+ <div class="settings-box first">
+ $i18n{siteSettingsInsecureContentBlock}
+ </div>
+ <category-setting-exceptions
+ category="[[ContentSettingsTypes.MIXEDSCRIPT]]"
+ block-header="$i18n{siteSettingsBlock}"
+ search-filter="[[searchFilter_]]">
+ </category-setting-exceptions>
+ </settings-subpage>
+ </template>
+ </template>
<template is="dom-if" route-path="/content/location" no-search>
<settings-subpage page-title="$i18n{siteSettingsCategoryLocation}"
search-label="$i18n{siteSettingsAllSitesSearch}"
@@ -664,7 +681,7 @@
</settings-subpage>
</template>
</template>
- <template is="dom-if" if="[[enableBluetoothScanningContentSetting_]]">
+ <template is="dom-if" if="[[enableExperimentalWebPlatformFeatures_]]">
<template is="dom-if" route-path="/content/bluetoothScanning" no-search>
<settings-subpage page-title="$i18n{siteSettingsBluetoothScanning}"
search-label="$i18n{siteSettingsAllSitesSearch}"
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 57b42d06dee..a7b63fd525e 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.js
+++ b/chromium/chrome/browser/resources/settings/privacy_page/privacy_page.js
@@ -136,10 +136,10 @@ Polymer({
},
/** @private */
- enableBluetoothScanningContentSetting_: {
+ enableInsecureContentContentSetting_: {
type: Boolean,
value: function() {
- return loadTimeData.getBoolean('enableBluetoothScanningContentSetting');
+ return loadTimeData.getBoolean('enableInsecureContentContentSetting');
}
},
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.html b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.html
index 7569eead29a..e1d92c209a0 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.html
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.html
@@ -27,12 +27,20 @@
padding-inline-end: 12px;
}
+ .list-item .name {
+ word-break: break-word;
+ }
+
.name {
flex: 3;
}
- #dialog::part(body-container) {
- overflow-y: hidden;
+ .icon-placeholder {
+ width: var(--cr-icon-ripple-size);
+ }
+
+ #outer {
+ padding: 0 var(--cr-section-padding);
}
</style>
@@ -51,40 +59,53 @@
<div id="pinPrompt">
<p>$i18n{securityKeysBioEnrollmentPinPrompt}</p>
- <settings-security-keys-pin-field id="pin">
+ <settings-security-keys-pin-field
+ id="pin" label="$i18n{securityKeysPIN}">
</settings-security-keys-pin-field>
</div>
<div id="enrollments">
<div class="settings-box first">
- <p class="start" hidden="[[hasSome_(enrollments_)]]">
- $i18n{securityKeysBioEnrollmentNoEnrollments}</p>
- <p class="start" hidden="[[!hasSome_(enrollments_)]]">
- $i18n{securityKeysBioEnrollmentLabel}</p>
+ <h2 class="start">$i18n{securityKeysBioEnrollmentLabel}</h2>
<cr-button id="addButton" on-click="addButtonClick_"
- hidden="[[!addButtonVisible_]]"
class="secondary-button header-aligned-button">
$i18n{add}
</cr-button>
</div>
- <div id="container">
- <iron-list id="enrollmentList" items="[[enrollments_]]"
- class="cr-separators">
- <template>
- <div class="list-item">
- <iron-icon icon="cr-fingerprint-icon:enrollment-done">
- </iron-icon>
- <div class="name" aria-label="[[item.name]]">
- [[item.name]]
+
+
+ <div id="outer">
+ <div id="header" class="list-item column-header"
+ hidden="[[!hasSome_(enrollments_)]]">
+ <div class="name">
+ $i18n{securityKeysBioEnrollmentNameLabel}
+ </div>
+ <div class="icon-placeholder"></div>
+ </div>
+
+ <div id="container" hidden="[[!hasSome_(enrollments_)]]">
+ <iron-list id="enrollmentList" items="[[enrollments_]]"
+ class="cr-separators">
+ <template>
+ <div class="list-item">
+ <iron-icon icon="cr-fingerprint-icon:enrollment-done">
+ </iron-icon>
+ <div class="name" aria-label="[[item.name]]">
+ [[item.name]]
+ </div>
+ <cr-icon-button class="icon-clear"
+ aria-label="i18n{securityKeysBioEnrollmentDelete}"
+ on-click="deleteEnrollment_"
+ disabled="[[deleteInProgress_]]">
+ </cr-icon-button>
</div>
- <cr-icon-button class="icon-clear"
- aria-label="i18n{securityKeysBioEnrollmentDelete}"
- on-click="deleteEnrollment_"
- disabled="[[deleteInProgress_]]">
- </cr-icon-button>
- </div>
- </template>
- </iron-list>
+ </template>
+ </iron-list>
+ </div>
+
+ <p hidden="[[hasSome_(enrollments_)]]">
+ $i18n{securityKeysBioEnrollmentNoEnrollments}
+ </p>
</div>
</div>
@@ -93,18 +114,31 @@
<cr-fingerprint-progress-arc id="arc"></cr-fingerprint-progress-arc>
</div>
+ <div id="chooseName">
+ <p>$i18n{securityKeysBioEnrollmentChooseName}</p>
+ <cr-input type="text" id="enrollmentName"
+ value="{{recentEnrollmentName_}}"
+ label="$i18n{securityKeysBioEnrollmentNameLabel}"
+ on-input="onEnrollmentNameInput_"
+ spellcheck="false">
+ </cr-input>
+ </div>
+
<div id="error">[[errorMsg_]]</div>
</iron-pages>
</div>
<div slot="button-container">
- <cr-button id="cancelButton" class="cancel-button"
- on-click="cancel_" hidden="[[!cancelButtonVisible_]]">
+ <cr-button id="cancelButton" class="cancel-button" on-click="cancel_"
+ hidden="[[!cancelButtonVisible_]]"
+ disabled="[[cancelButtonDisabled_]]">
$i18n{cancel}
</cr-button>
- <cr-button id="okButton" class="action-button"
- on-click="okButtonClick_" hidden="[[!okButtonVisible_]]">
- $i18n{ok}
+ <cr-button id="confirmButton" class="action-button"
+ hidden="[[!confirmButtonVisible_]]"
+ disabled="[[confirmButtonDisabled_]]"
+ on-click="confirmButtonClick_">
+ $i18n{continue}
</cr-button>
<cr-button id="doneButton" class="action-button"
on-click="done_" hidden="[[!doneButtonVisible_]]">
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.js b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.js
index 1f251c65aa4..43253425f32 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.js
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_bio_enroll_dialog.js
@@ -20,12 +20,18 @@ Polymer({
properties: {
/** @private */
- addButtonVisible_: Boolean,
+ cancelButtonDisabled_: Boolean,
/** @private */
cancelButtonVisible_: Boolean,
/** @private */
+ confirmButtonDisabled_: Boolean,
+
+ /** @private */
+ confirmButtonVisible_: Boolean,
+
+ /** @private */
deleteInProgress_: Boolean,
/**
@@ -48,14 +54,17 @@ Polymer({
enrollments_: Array,
/** @private */
- okButtonVisible_: Boolean,
+ recentEnrollmentName_: String,
},
/** @private {?settings.SecurityKeysBioEnrollProxyImpl} */
browserProxy_: null,
- /** @private */
- maxSamples_: Number,
+ /** @private {number} */
+ maxSamples_: -1,
+
+ /** @private {string} */
+ recentEnrollmentId_: '',
/** @override */
attached: function() {
@@ -65,8 +74,9 @@ Polymer({
this.addWebUIListener(
'security-keys-bio-enroll-status', this.onEnrolling_.bind(this));
this.browserProxy_ = settings.SecurityKeysBioEnrollProxyImpl.getInstance();
- this.browserProxy_.startBioEnroll().then(
- this.collectPIN_.bind(this), () => {});
+ this.browserProxy_.startBioEnroll().then(() => {
+ this.collectPIN_();
+ });
},
/** @private */
@@ -87,17 +97,17 @@ Polymer({
/** @private */
submitPIN_: function() {
if (!this.$.pin.validate()) {
+ this.confirmButtonDisabled_ = false;
return;
}
- this.browserProxy_.providePIN(this.$.pin.value).then((retries) => {
+ this.browserProxy_.providePIN(this.$.pin.value).then(retries => {
+ this.confirmButtonDisabled_ = false;
if (retries != null) {
this.$.pin.showIncorrectPINError(retries);
return;
}
-
- this.browserProxy_.enumerateEnrollments().then(
- this.onEnrollments_.bind(this));
- }, () => {});
+ this.showEnrollmentsPage_();
+ });
},
/**
@@ -114,33 +124,39 @@ Polymer({
dialogPageChanged_: function() {
switch (this.dialogPage_) {
case 'initial':
- this.addButtonVisible_ = false;
this.cancelButtonVisible_ = true;
- this.okButtonVisible_ = false;
+ this.cancelButtonDisabled = false;
+ this.confirmButtonVisible_ = false;
this.doneButtonVisible_ = false;
break;
case 'pinPrompt':
- this.addButtonVisible_ = false;
this.cancelButtonVisible_ = true;
- this.okButtonVisible_ = true;
+ this.cancelButtonDisabled = false;
+ this.confirmButtonVisible_ = true;
+ this.confirmButtonDisabled_ = false;
this.doneButtonVisible_ = false;
break;
case 'enrollments':
- this.addButtonVisible_ = true;
this.cancelButtonVisible_ = false;
- this.okButtonVisible_ = false;
+ this.confirmButtonVisible_ = false;
this.doneButtonVisible_ = true;
break;
case 'enroll':
- this.addButtonVisible_ = false;
this.cancelButtonVisible_ = true;
- this.okButtonVisible_ = false;
+ this.cancelButtonDisabled = false;
+ this.confirmButtonVisible_ = false;
+ this.doneButtonVisible_ = false;
+ break;
+ case 'chooseName':
+ this.cancelButtonVisible_ = false;
+ this.confirmButtonVisible_ = true;
+ this.confirmButtonDisabled_ = !this.recentEnrollmentName_.length;
this.doneButtonVisible_ = false;
+ this.$.enrollmentName.focus();
break;
case 'error':
- this.addButtonVisible_ = false;
this.cancelButtonVisible_ = false;
- this.okButtonVisible_ = false;
+ this.confirmButtonVisible_ = false;
this.doneButtonVisible_ = true;
break;
default:
@@ -155,12 +171,15 @@ Polymer({
this.maxSamples_ = -1; // Reset maxSamples_ before enrolling starts.
this.$.arc.reset();
- this.cancelButtonVisible_ = true;
- this.okButtonVisible_ = false;
+
+ this.recentEnrollmentId_ = '';
+ this.recentEnrollmentName_ = '';
this.dialogPage_ = 'enroll';
- this.browserProxy_.startEnrolling().then(
- this.onEnrolling_.bind(this), () => {});
+
+ this.browserProxy_.startEnrolling().then(response => {
+ this.onEnrolling_(response);
+ });
},
/**
@@ -168,6 +187,11 @@ Polymer({
* @param {!EnrollmentStatus} response
*/
onEnrolling_: function(response) {
+ if (response.code == Ctap2Status.ERR_KEEPALIVE_CANCEL) {
+ this.showEnrollmentsPage_();
+ return;
+ }
+
if (this.maxSamples_ == -1 && response.status != null) {
if (response.status == 0) {
// If the first sample is valid, remaining is one less than max samples
@@ -186,21 +210,37 @@ Polymer({
100 - (100 * response.remaining / this.maxSamples_),
response.remaining == 0);
if (response.remaining == 0) {
+ assert(response.enrollment);
+ this.recentEnrollmentId_ = response.enrollment.id;
+ this.recentEnrollmentName_ = response.enrollment.name;
this.cancelButtonVisible_ = false;
- this.okButtonVisible_ = true;
+ this.confirmButtonVisible_ = true;
+ this.confirmButtonDisabled_ = false;
+ this.$.confirmButton.focus();
}
this.fire('bio-enroll-dialog-ready-for-testing');
},
/** @private */
- okButtonClick_: function() {
+ confirmButtonClick_: function() {
+ // Disable |confirmButton| while PIN verification or template enumeration is
+ // pending. Resetting |dialogPage_| will re-enable it.
+ this.confirmButtonDisabled_ = true;
switch (this.dialogPage_) {
case 'pinPrompt':
this.submitPIN_();
break;
case 'enroll':
- this.browserProxy_.enumerateEnrollments().then(
- this.onEnrollments_.bind(this), () => {});
+ assert(!!this.recentEnrollmentId_.length);
+ this.dialogPage_ = 'chooseName';
+ break;
+ case 'chooseName':
+ this.browserProxy_
+ .renameEnrollment(
+ this.recentEnrollmentId_, this.recentEnrollmentName_)
+ .then(enrollments => {
+ this.onEnrollments_(enrollments);
+ });
break;
default:
assertNotReached();
@@ -208,24 +248,27 @@ Polymer({
},
/** @private */
+ showEnrollmentsPage_: function() {
+ this.browserProxy_.enumerateEnrollments().then(enrollments => {
+ this.onEnrollments_(enrollments);
+ });
+ },
+
+ /** @private */
cancel_: function() {
if (this.dialogPage_ == 'enroll') {
- this.browserProxy_.cancelEnrollment().then(
- this.cancelEnroll_.bind(this), () => {});
+ // Cancel an ongoing enrollment. Will cause the pending
+ // enumerateEnrollments() promise to be resolved and proceed to the
+ // enrollments page.
+ this.cancelButtonDisabled_ = true;
+ this.browserProxy_.cancelEnrollment();
} else {
+ // On any other screen, simply close the dialog.
this.done_();
}
},
/** @private */
- cancelEnroll_: function() {
- // Cancelling from the enrolling screen redirects to the enrollments
- // list, so request another enumeration to display.
- this.browserProxy_.enumerateEnrollments().then(
- this.onEnrollments_.bind(this), () => {});
- },
-
- /** @private */
done_: function() {
this.$.dialog.close();
},
@@ -268,6 +311,11 @@ Polymer({
this.deleteInProgress_ = false;
this.onEnrollments_(enrollments);
});
- }
+ },
+
+ /** @private */
+ onEnrollmentNameInput_: function() {
+ this.confirmButtonDisabled_ = !this.recentEnrollmentName_.length;
+ },
});
})();
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
index 00a55d9f52d..ba01514b632 100644
--- 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
@@ -5,6 +5,16 @@
cr.exportPath('settings');
/**
+ * Ctap2Status contains a subset of CTAP2 status codes. See
+ * device::CtapDeviceResponseCode for the full list.
+ * @enum{number}
+ */
+const Ctap2Status = {
+ OK: 0x0,
+ ERR_KEEPALIVE_CANCEL: 0x2D,
+};
+
+/**
* Credential represents a CTAP2 resident credential enumerated from a security
* key.
*
@@ -28,15 +38,19 @@ let Credential;
/**
* EnrollmentStatus represents the current status of an enrollment suboperation,
- * where 'remaining' indicates the number of samples left, 'status' indicates
- * the last enrollment status, and 'code' indicates the CtapDeviceResponseCode.
+ * where 'remaining' is the number of samples left, 'status' is the last
+ * enrollment status, 'code' indicates the final CtapDeviceResponseCode of the
+ * operation, and 'enrollment' contains the new Enrollment.
+ *
* For each enrollment sample, 'status' is set - when the enrollment operation
- * reaches an end state, 'code' is set. A 'code' of CtapDeviceResponseCode 0
- * indicates successful enrollment.
+ * reaches an end state, 'code' and, if successful, 'enrollment' are set. |OK|
+ * indicates successful enrollment. A code of |ERR_KEEPALIVE_CANCEL| indicates
+ * user-initated cancellation.
*
* @typedef {{status: ?number,
- * code: ?number,
- * remaining: number}}
+ * code: ?Ctap2Status,
+ * remaining: number,
+ * enrollment: ?Enrollment}}
* @see chrome/browser/ui/webui/settings/settings_security_key_handler.cc
*/
let EnrollmentStatus;
@@ -197,9 +211,6 @@ cr.define('settings', function() {
* Cancel an ongoing enrollment suboperation. This can safely be called at
* any time and only has an impact when the authenticator is currently
* sampling.
- *
- * @return {!Promise} resolves when the ongoing enrollment suboperation has
- * been cancelled.
*/
cancelEnrollment() {}
@@ -211,6 +222,15 @@ cr.define('settings', function() {
*/
deleteEnrollment(id) {}
+ /**
+ * Renames the enrollment with the given ID.
+ *
+ * @param {string} id
+ * @param {string} name
+ * @return {!Promise<!Array<!Enrollment>>} The updated list of enrollments.
+ */
+ renameEnrollment(id, name) {}
+
/** Cancels all outstanding operations. */
close() {}
}
@@ -303,7 +323,7 @@ cr.define('settings', function() {
/** @override */
cancelEnrollment() {
- return cr.sendWithPromise('securityKeyBioEnrollCancel');
+ return chrome.send('securityKeyBioEnrollCancel');
}
/** @override */
@@ -312,6 +332,11 @@ cr.define('settings', function() {
}
/** @override */
+ renameEnrollment(id, name) {
+ return cr.sendWithPromise('securityKeyBioEnrollRename', id, name);
+ }
+
+ /** @override */
close() {
return chrome.send('securityKeyBioEnrollClose');
}
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.html b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.html
index 0045f54d6a2..070ed2d6abb 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.html
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.html
@@ -69,7 +69,8 @@
<div id="pinPrompt">
<p>$i18nRaw{securityKeysCredentialManagementPinPrompt}</p>
- <settings-security-keys-pin-field id="pin">
+ <settings-security-keys-pin-field
+ id="pin" label="$i18n{securityKeysPIN}">
</settings-security-keys-pin-field>
</div>
@@ -92,9 +93,9 @@
</div>
<div class="user">[[formatUser_(item)]]</div>
<cr-checkbox on-change="checkedCredentialsChanged_"
- data-id$="[[item.id]]"
- checked="[[credentialIsChecked_(item.id)]]"
- disabled="[[deleteInProgress_]]"></cr-checkbox>
+ data-id$="[[item.id]]"
+ checked="[[credentialIsChecked_(item.id)]]"
+ disabled="[[deleteInProgress_]]"></cr-checkbox>
</div>
</template>
</iron-list>
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.js b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.js
index 146f22674b3..062c329e254 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.js
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.js
@@ -98,7 +98,9 @@ Polymer({
if (!this.$.pin.validate()) {
return;
}
+ this.confirmButtonDisabled_ = true;
this.browserProxy_.providePIN(this.$.pin.value).then((retries) => {
+ this.confirmButtonDisabled_ = false;
if (retries != null) {
this.$.pin.showIncorrectPINError(retries);
this.collectPin_();
@@ -258,9 +260,11 @@ Polymer({
assert(this.credentials_ && this.credentials_.length > 0);
assert(this.checkedCredentialIds_.size > 0);
+ this.confirmButtonDisabled_ = true;
this.deleteInProgress_ = true;
this.browserProxy_.deleteCredentials(Array.from(this.checkedCredentialIds_))
.then((err) => {
+ this.confirmButtonDisabled_ = false;
this.deleteInProgress_ = false;
this.onError_(err);
});
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.html b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.html
index bd62a4001c0..f185cba1363 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.html
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.html
@@ -3,6 +3,7 @@
<link rel="import" href="chrome://resources/html/i18n_behavior.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/polymer/v1_0/iron-a11y-announcer/iron-a11y-announcer.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../settings_shared_css.html">
diff --git a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.js b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.js
index abace08a7e0..72159d830d7 100644
--- a/chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.js
+++ b/chromium/chrome/browser/resources/settings/privacy_page/security_keys_pin_field.js
@@ -18,7 +18,10 @@ Polymer({
label: String,
/** The validation error label of the input field. */
- error: String,
+ error: {
+ type: String,
+ observer: 'errorChanged_',
+ },
/** The value of the input field. */
value: String,
@@ -32,6 +35,10 @@ Polymer({
/** @override */
attached: function() {
+ Polymer.RenderStatus.afterNextRender(this, function() {
+ Polymer.IronA11yAnnouncer.requestAvailability();
+ });
+
this.inputVisible_ = false;
},
@@ -158,4 +165,11 @@ Polymer({
return '';
},
+
+ /** @private */
+ errorChanged_: function() {
+ // Make screen readers announce changes to the PIN validation error
+ // label.
+ this.fire('iron-announce', {text: this.error});
+ },
});
diff --git a/chromium/chrome/browser/resources/settings/route.js b/chromium/chrome/browser/resources/settings/route.js
index 244cb3be580..091bb933e2e 100644
--- a/chromium/chrome/browser/resources/settings/route.js
+++ b/chromium/chrome/browser/resources/settings/route.js
@@ -13,6 +13,8 @@
* ACCOUNT_MANAGER: (undefined|!settings.Route),
* ADVANCED: (undefined|!settings.Route),
* ADDRESSES: (undefined|!settings.Route),
+ * APP_MANAGEMENT: (undefined|!settings.Route),
+ * APP_MANAGEMENT_DETAIL: (undefined|!settings.Route),
* APPS: (undefined|!settings.Route),
* ANDROID_APPS: (undefined|!settings.Route),
* ANDROID_APPS_DETAILS: (undefined|!settings.Route),
@@ -58,6 +60,7 @@
* LANGUAGES_DETAILS: (undefined|!settings.Route),
* LOCK_SCREEN: (undefined|!settings.Route),
* MANAGE_ACCESSIBILITY: (undefined|!settings.Route),
+ * MANAGE_CAPTION_SETTINGS: (undefined|!settings.Route),
* MANAGE_PROFILE: (undefined|!settings.Route),
* MANAGE_SWITCH_ACCESS_SETTINGS: (undefined|!settings.Route),
* MANAGE_TTS_SETTINGS: (undefined|!settings.Route),
@@ -95,6 +98,7 @@
* SITE_SETTINGS_FLASH: (undefined|!settings.Route),
* SITE_SETTINGS_HANDLERS: (undefined|!settings.Route),
* SITE_SETTINGS_IMAGES: (undefined|!settings.Route),
+ * SITE_SETTINGS_MIXEDSCRIPT: (undefined|!settings.Route),
* SITE_SETTINGS_JAVASCRIPT: (undefined|!settings.Route),
* SITE_SETTINGS_SENSORS: (undefined|!settings.Route),
* SITE_SETTINGS_SOUND: (undefined|!settings.Route),
@@ -326,6 +330,10 @@ cr.define('settings', function() {
r.SITE_SETTINGS_DATA_DETAILS =
r.SITE_SETTINGS_SITE_DATA.createChild('/cookies/detail');
r.SITE_SETTINGS_IMAGES = r.SITE_SETTINGS.createChild('images');
+ if (loadTimeData.getBoolean('enableInsecureContentContentSetting')) {
+ r.SITE_SETTINGS_MIXEDSCRIPT =
+ r.SITE_SETTINGS.createChild('insecureContent');
+ }
r.SITE_SETTINGS_JAVASCRIPT = r.SITE_SETTINGS.createChild('javascript');
r.SITE_SETTINGS_SOUND = r.SITE_SETTINGS.createChild('sound');
r.SITE_SETTINGS_SENSORS = r.SITE_SETTINGS.createChild('sensors');
@@ -352,7 +360,7 @@ cr.define('settings', function() {
r.SITE_SETTINGS_PAYMENT_HANDLER =
r.SITE_SETTINGS.createChild('paymentHandler');
}
- if (loadTimeData.getBoolean('enableBluetoothScanningContentSetting')) {
+ if (loadTimeData.getBoolean('enableExperimentalWebPlatformFeatures')) {
r.SITE_SETTINGS_BLUETOOTH_SCANNING =
r.SITE_SETTINGS.createChild('bluetoothScanning');
}
@@ -453,7 +461,10 @@ cr.define('settings', function() {
r.FINGERPRINT = r.LOCK_SCREEN.createChild('/lockScreen/fingerprint');
}
- if (loadTimeData.valueExists('androidAppsVisible') &&
+ // Show Android Apps page in the browser if split settings is turned off.
+ if (!loadTimeData.getBoolean('isOSSettings') &&
+ loadTimeData.getBoolean('showOSSettings') &&
+ loadTimeData.valueExists('androidAppsVisible') &&
loadTimeData.getBoolean('androidAppsVisible')) {
r.ANDROID_APPS = r.BASIC.createSection('/androidApps', 'androidApps');
r.ANDROID_APPS_DETAILS =
@@ -524,13 +535,21 @@ cr.define('settings', function() {
r.RESET = r.ADVANCED.createSection('/reset', 'reset');
}
+ const showAppManagement = loadTimeData.valueExists('showAppManagement') &&
+ loadTimeData.getBoolean('showAppManagement');
+ const showAndroidApps = loadTimeData.valueExists('androidAppsVisible') &&
+ loadTimeData.getBoolean('androidAppsVisible');
// Apps
- if (loadTimeData.valueExists('showApps') &&
- loadTimeData.getBoolean('showApps')) {
+ if (showAppManagement || showAndroidApps) {
r.APPS = r.BASIC.createSection('/apps', 'apps');
- r.APP_MANAGEMENT = r.APPS.createChild('/app-management');
- r.APP_MANAGEMENT_DETAIL =
- r.APP_MANAGEMENT.createChild('/app-management/detail');
+ if (showAppManagement) {
+ r.APP_MANAGEMENT = r.APPS.createChild('/app-management');
+ r.APP_MANAGEMENT_DETAIL =
+ r.APP_MANAGEMENT.createChild('/app-management/detail');
+ }
+ if (showAndroidApps) {
+ r.ANDROID_APPS_DETAILS = r.APPS.createChild('/androidAppsDetails');
+ }
}
} else {
assert(r.ADVANCED, 'ADVANCED route should exist');
@@ -573,6 +592,9 @@ cr.define('settings', function() {
}
r.MANAGE_TTS_SETTINGS =
r.MANAGE_ACCESSIBILITY.createChild('/manageAccessibility/tts');
+
+ r.MANAGE_CAPTION_SETTINGS =
+ r.MANAGE_ACCESSIBILITY.createChild('/manageAccessibility/captions');
}
// </if>
@@ -727,12 +749,16 @@ cr.define('settings', function() {
* Initialize the route and query params from the URL.
*/
initializeRouteFromUrl() {
- this.recordMetrics(window.location.pathname);
-
assert(!this.initializeRouteFromUrlCalled_);
this.initializeRouteFromUrlCalled_ = true;
const route = this.getRouteForPath(window.location.pathname);
+
+ // Record all correct paths entered on the settings page, and
+ // as all incorrect paths are routed to the main settings page,
+ // record all incorrect paths as hitting the main settings page.
+ this.recordMetrics(route ? route.path : this.routes_.BASIC.path);
+
// Never allow direct navigation to ADVANCED.
if (route && route != this.routes_.ADVANCED) {
this.currentRoute = route;
@@ -751,6 +777,7 @@ cr.define('settings', function() {
assert(!urlPath.startsWith('chrome://'));
assert(!urlPath.startsWith('settings'));
assert(urlPath.startsWith('/'));
+ assert(!urlPath.match(/\?/g));
chrome.metricsPrivate.recordSparseHashable(
'WebUI.Settings.PathVisited', urlPath);
}
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 83d8b346ed4..4469b4298cc 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
@@ -41,7 +41,10 @@
<div class="list-item" focus-row-container>
<div id="name-column">
- <site-favicon favicon-url="[[engine.iconURL]]"></site-favicon>
+ <site-favicon
+ favicon-url="[[engine.iconURL]]"
+ url="[[engine.url]]">
+ </site-favicon>
<div>[[engine.displayName]]</div>
</div>
<div id="keyword-column"><div>[[engine.keyword]]</div></div>
diff --git a/chromium/chrome/browser/resources/settings/search_settings.js b/chromium/chrome/browser/resources/settings/search_settings.js
index a98f501303f..60facec8de0 100644
--- a/chromium/chrome/browser/resources/settings/search_settings.js
+++ b/chromium/chrome/browser/resources/settings/search_settings.js
@@ -149,11 +149,15 @@ cr.define('settings', function() {
let associatedControl = null;
// Find corresponding SETTINGS-SECTION parent and make it visible.
let parent = node;
- while (parent && parent.nodeName !== 'SETTINGS-SECTION') {
+ while (parent.nodeName !== 'SETTINGS-SECTION') {
parent = parent.nodeType == Node.DOCUMENT_FRAGMENT_NODE ?
parent.host :
parent.parentNode;
- if (parent && parent.nodeName == 'SETTINGS-SUBPAGE') {
+ if (!parent) {
+ // |node| wasn't inside a SETTINGS-SECTION.
+ return null;
+ }
+ if (parent.nodeName == 'SETTINGS-SUBPAGE') {
// TODO(dpapad): Cast to SettingsSubpageElement here.
associatedControl = assert(
parent.associatedControl,
@@ -161,9 +165,7 @@ cr.define('settings', function() {
parent.pageTitle + ', but was not found.');
}
}
- if (parent) {
- parent.hiddenBySearch = false;
- }
+ parent.hiddenBySearch = false;
// Need to add the search bubble after the parent SETTINGS-SECTION has
// become visible, otherwise |offsetWidth| returns zero.
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 4dabc3f833b..0bcf8487656 100644
--- a/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.html
+++ b/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.html
@@ -176,7 +176,8 @@
<iron-icon icon="settings:power-settings-new"></iron-icon>
$i18n{onStartup}
</a>
- <cr-button id="advancedButton" aria-active-attribute="aria-expanded"
+ <cr-button id="advancedButton"
+ aria-expanded$="[[boolToString_(advancedOpened)]]"
on-click="onAdvancedButtonToggle_"
hidden="[[!pageVisibility.advancedSettings]]">
<span>$i18n{advancedPageTitle}</span>
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 38bce70ccb4..c604ae4bcbf 100644
--- a/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.js
+++ b/chromium/chrome/browser/resources/settings/settings_menu/settings_menu.js
@@ -27,12 +27,12 @@ Polymer({
/** @param {!settings.Route} newRoute */
currentRouteChanged: function(newRoute) {
- const currentPath = newRoute.path;
-
// Focus the initially selected path.
const anchors = this.root.querySelectorAll('a');
for (let i = 0; i < anchors.length; ++i) {
- if (anchors[i].getAttribute('href') == currentPath) {
+ const anchorRoute =
+ settings.router.getRouteForPath(anchors[i].getAttribute('href'));
+ if (anchorRoute && anchorRoute.contains(newRoute)) {
this.setSelectedUrl_(anchors[i].href);
return;
}
@@ -95,4 +95,13 @@ Polymer({
chrome.metricsPrivate.recordUserAction(
'SettingsMenu_ExtensionsLinkClicked');
},
+
+ /**
+ * @param {boolean} bool
+ * @return {string}
+ * @private
+ */
+ boolToString_: function(bool) {
+ return bool.toString();
+ },
});
diff --git a/chromium/chrome/browser/resources/settings/settings_page/BUILD.gn b/chromium/chrome/browser/resources/settings/settings_page/BUILD.gn
index f6f20fe035e..ac38ed67f66 100644
--- a/chromium/chrome/browser/resources/settings/settings_page/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/settings_page/BUILD.gn
@@ -33,7 +33,7 @@ js_library("settings_animated_pages") {
"//ui/webui/resources/js:util",
"//ui/webui/resources/js/cr/ui:focus_without_ink",
]
- externs_list = [ "$externs_path/pending.js" ]
+ externs_list = [ "$externs_path/pending_polymer.js" ]
}
js_library("settings_section") {
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 c48064bcaf2..b4ea404e35f 100644
--- a/chromium/chrome/browser/resources/settings/settings_page/settings_subpage.html
+++ b/chromium/chrome/browser/resources/settings/settings_page/settings_subpage.html
@@ -75,7 +75,7 @@
<cr-icon-button class="icon-arrow-back" id="closeButton"
on-click="onTapBack_" aria-label="$i18n{back}"></cr-icon-button>
<template is="dom-if" if="[[titleIcon]]">
- <img id="title-icon" src="[[titleIcon]]">
+ <img id="title-icon" src="[[titleIcon]]" aria-hidden="true">
</template>
<h1 class="cr-title-text">[[pageTitle]]</h1>
<slot name="subpage-title-extra"></slot>
diff --git a/chromium/chrome/browser/resources/settings/settings_resources.grd b/chromium/chrome/browser/resources/settings/settings_resources.grd
index 14f631a9af7..ea0b1a1026a 100644
--- a/chromium/chrome/browser/resources/settings/settings_resources.grd
+++ b/chromium/chrome/browser/resources/settings/settings_resources.grd
@@ -563,12 +563,6 @@
<structure name="IDR_SETTINGS_DEVICE_DISPLAY_OVERSCAN_DIALOG_JS"
file="device_page/display_overscan_dialog.js"
type="chrome_html" />
- <structure name="IDR_SETTINGS_DEVICE_DRIVE_CACHE_DIALOG_HTML"
- file="device_page/drive_cache_dialog.html"
- type="chrome_html" />
- <structure name="IDR_SETTINGS_DEVICE_DRIVE_CACHE_DIALOG_JS"
- file="device_page/drive_cache_dialog.js"
- type="chrome_html" />
<structure name="IDR_SETTINGS_DEVICE_KEYBOARD_HTML"
file="device_page/keyboard.html"
type="chrome_html" />
@@ -987,11 +981,17 @@
<structure name="IDR_SETTINGS_CUPS_PRINTERS_ENTRY_JS"
file="printing_page/cups_printers_entry.js"
type="chrome_html" />
- <structure name="IDR_SETTINGS_CUPS_PRINTERS_ENTRY_LIST_HTML"
- file="printing_page/cups_printers_entry_list.html"
+ <structure name="IDR_SETTINGS_CUPS_PRINTERS_ENTRY_LIST_BEHAVIOR_HTML"
+ file="printing_page/cups_printers_entry_list_behavior.html"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_CUPS_PRINTERS_ENTRY_LIST_BEHAVIOR_JS"
+ file="printing_page/cups_printers_entry_list_behavior.js"
+ type="chrome_html" />
+ <structure name="IDR_SETTINGS_CUPS_PRINTERS_ENTRY_MANAGER_HTML"
+ file="printing_page/cups_printers_entry_manager.html"
type="chrome_html" />
- <structure name="IDR_SETTINGS_CUPS_PRINTERS_ENTRY_LIST_JS"
- file="printing_page/cups_printers_entry_list.js"
+ <structure name="IDR_SETTINGS_CUPS_PRINTERS_ENTRY_MANAGER_JS"
+ file="printing_page/cups_printers_entry_manager.js"
type="chrome_html" />
<structure name="IDR_SETTINGS_CUPS_PRINTERS_LIST_HTML"
file="printing_page/cups_printers_list.html"
diff --git a/chromium/chrome/browser/resources/settings/settings_ui/BUILD.gn b/chromium/chrome/browser/resources/settings/settings_ui/BUILD.gn
index ae564bee278..8cbb5556ae7 100644
--- a/chromium/chrome/browser/resources/settings/settings_ui/BUILD.gn
+++ b/chromium/chrome/browser/resources/settings/settings_ui/BUILD.gn
@@ -17,7 +17,7 @@ js_library("settings_ui") {
"../prefs",
"../settings_main: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/chromeos/network:cr_onc_strings",
"//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",
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 286257d15ea..5f25212f6be 100644
--- a/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.html
+++ b/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.html
@@ -21,7 +21,7 @@
<link rel="import" href="../settings_vars_css.html">
<if expr="chromeos">
-<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html">
+<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_strings.html">
</if>
<dom-module id="settings-ui">
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 fdbbef286d5..f3b8d60d861 100644
--- a/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.js
+++ b/chromium/chrome/browser/resources/settings/settings_ui/settings_ui.js
@@ -152,8 +152,12 @@ Polymer({
loadTimeData.getString('networkListItemConnectingTo'),
networkListItemInitializing:
loadTimeData.getString('networkListItemInitializing'),
+ networkListItemNotAvailable:
+ loadTimeData.getString('networkListItemNotAvailable'),
networkListItemScanning:
loadTimeData.getString('networkListItemScanning'),
+ networkListItemSimCardLocked:
+ loadTimeData.getString('networkListItemSimCardLocked'),
networkListItemNotConnected:
loadTimeData.getString('networkListItemNotConnected'),
networkListItemNoNetwork:
diff --git a/chromium/chrome/browser/resources/settings/site_favicon.js b/chromium/chrome/browser/resources/settings/site_favicon.js
index e905bd54e35..b6d516d0e71 100644
--- a/chromium/chrome/browser/resources/settings/site_favicon.js
+++ b/chromium/chrome/browser/resources/settings/site_favicon.js
@@ -17,7 +17,7 @@ Polymer({
/** @private */
getBackgroundImage_: function() {
- let backgroundImage = 'none';
+ let backgroundImage = cr.icon.getFavicon('');
if (this.faviconUrl) {
const url = this.ensureUrlHasScheme_(this.faviconUrl);
backgroundImage = cr.icon.getFavicon(url);
diff --git a/chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.html b/chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.html
index 938cfebaeac..6b38253df50 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.html
@@ -30,6 +30,10 @@
contentSetting)]]">
$i18n{incognitoSiteOnly}
</cr-checkbox>
+ <cr-checkbox id="thirdParties"
+ hidden$="[[shouldHideThirdPartyCookieCheckbox_(category)]]">
+ $i18n{siteSettingsCookiesThirdPartyExceptionLabel}
+ </cr-checkbox>
</div>
<div slot="button-container">
<cr-button class="cancel-button" on-click="onCancelTap_">
diff --git a/chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.js b/chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.js
index 973e15fca05..a9962dde633 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/add_site_dialog.js
@@ -86,9 +86,18 @@ Polymer({
*/
onSubmit_: function() {
assert(!this.$.add.disabled);
+ let primaryPattern = this.site_;
+ let secondaryPattern = settings.SITE_EXCEPTION_WILDCARD;
+
+ if (this.$.thirdParties.checked) {
+ primaryPattern = settings.SITE_EXCEPTION_WILDCARD;
+ secondaryPattern = this.site_;
+ }
+
this.browserProxy.setCategoryPermissionForPattern(
- this.site_, this.site_, this.category, this.contentSetting,
+ primaryPattern, secondaryPattern, this.category, this.contentSetting,
this.$.incognito.checked);
+
this.$.dialog.close();
},
@@ -104,4 +113,13 @@ Polymer({
this.$.incognito.checked = false;
}
},
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ shouldHideThirdPartyCookieCheckbox_: function() {
+ return this.category !== settings.ContentSettingsTypes.COOKIES ||
+ !loadTimeData.getBoolean('showImprovedCookieControlsForThirdParties');
+ },
});
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 554bc6992dc..a3e2d3277eb 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
@@ -103,6 +103,7 @@ Polymer({
case settings.ContentSettingsTypes.BACKGROUND_SYNC:
case settings.ContentSettingsTypes.IMAGES:
case settings.ContentSettingsTypes.JAVASCRIPT:
+ case settings.ContentSettingsTypes.MIXEDSCRIPT:
case settings.ContentSettingsTypes.SOUND:
case settings.ContentSettingsTypes.SENSORS:
case settings.ContentSettingsTypes.PAYMENT_HANDLER:
@@ -176,10 +177,22 @@ Polymer({
if (update.source !== undefined &&
update.source != ContentSettingProvider.PREFERENCE) {
basePref.enforcement = chrome.settingsPrivate.Enforcement.ENFORCED;
- basePref.controlledBy =
- update.source == ContentSettingProvider.EXTENSION ?
- chrome.settingsPrivate.ControlledBy.EXTENSION :
- chrome.settingsPrivate.ControlledBy.USER_POLICY;
+ switch (update.source) {
+ case ContentSettingProvider.POLICY:
+ basePref.controlledBy =
+ chrome.settingsPrivate.ControlledBy.DEVICE_POLICY;
+ break;
+ case ContentSettingProvider.SUPERVISED_USER:
+ basePref.controlledBy = chrome.settingsPrivate.ControlledBy.PARENT;
+ break;
+ case ContentSettingProvider.EXTENSION:
+ basePref.controlledBy = chrome.settingsPrivate.ControlledBy.EXTENSION;
+ break;
+ default:
+ basePref.controlledBy =
+ chrome.settingsPrivate.ControlledBy.USER_POLICY;
+ break;
+ }
}
const prefValue = this.computeIsSettingEnabled(update.setting);
diff --git a/chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.html b/chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.html
index 01d7cb15355..6fb8781c59a 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.html
@@ -1,7 +1,9 @@
<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="constants.html">
<link rel="import" href="site_list.html">
+<link rel="import" href="site_settings_prefs_browser_proxy.html">
<dom-module id="category-setting-exceptions">
<template>
@@ -9,7 +11,7 @@
category="[[category]]"
category-subtype="[[ContentSetting.BLOCK]]"
category-header="[[blockHeader]]"
- read-only-list="[[readOnlyList]]"
+ read-only-list="[[getReadOnlyList_(readOnlyList, defaultManaged_)]]"
search-filter="[[searchFilter]]"
hidden$="[[!showBlockSiteList_]]">
</site-list>
@@ -17,14 +19,14 @@
category="[[category]]"
category-subtype="[[ContentSetting.SESSION_ONLY]]"
category-header="$i18n{siteSettingsSessionOnly}"
- read-only-list="[[readOnlyList]]"
+ read-only-list="[[getReadOnlyList_(readOnlyList, defaultManaged_)]]"
search-filter="[[searchFilter]]">
</site-list>
<site-list
category="[[category]]"
category-subtype="[[ContentSetting.ALLOW]]"
category-header="$i18n{siteSettingsAllow}"
- read-only-list="[[readOnlyList]]"
+ read-only-list="[[getReadOnlyList_(readOnlyList, defaultManaged_)]]"
search-filter="[[searchFilter]]"
hidden$="[[!showAllowSiteList_]]">
</site-list>
diff --git a/chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.js b/chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.js
index 212204450a9..44997259653 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/category_setting_exceptions.js
@@ -10,6 +10,8 @@
Polymer({
is: 'category-setting-exceptions',
+ behaviors: [SiteSettingsBehavior, WebUIListenerBehavior],
+
properties: {
/**
@@ -30,6 +32,12 @@ Polymer({
},
/**
+ * True if the default value is managed by a policy.
+ * @private
+ */
+ defaultManaged_: Boolean,
+
+ /**
* The heading text for the blocked exception list.
*/
blockHeader: String,
@@ -54,9 +62,15 @@ Polymer({
},
},
+ observers: [
+ 'updateDefaultManaged_(category)',
+ ],
+
/** @override */
ready: function() {
this.ContentSetting = settings.ContentSetting;
+ this.addWebUIListener(
+ 'contentSettingCategoryChanged', this.updateDefaultManaged_.bind(this));
},
/**
@@ -69,4 +83,32 @@ Polymer({
return this.category !=
settings.ContentSettingsTypes.NATIVE_FILE_SYSTEM_WRITE;
},
+
+ /**
+ * Updates whether or not the default value is managed by a policy.
+ * @private
+ */
+ updateDefaultManaged_: function() {
+ if (this.category === undefined) {
+ return;
+ }
+
+ this.browserProxy.getDefaultValueForContentType(this.category)
+ .then(update => {
+ this.defaultManaged_ =
+ update.source === settings.SiteSettingSource.POLICY;
+ });
+ },
+
+ /**
+ * Returns true if this list is explicitly marked as readonly by a consumer
+ * of this component or if the default value for these exceptions are managed
+ * by a policy. User should not be able to set exceptions to managed default
+ * values.
+ * @return {boolean}
+ * @private
+ */
+ getReadOnlyList_: function() {
+ return this.readOnlyList || this.defaultManaged_;
+ }
});
diff --git a/chromium/chrome/browser/resources/settings/site_settings/constants.js b/chromium/chrome/browser/resources/settings/site_settings/constants.js
index a7cf78b84ad..f073aa9b3db 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/constants.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/constants.js
@@ -36,6 +36,7 @@ settings.ContentSettingsTypes = {
CLIPBOARD: 'clipboard',
SENSORS: 'sensors',
PAYMENT_HANDLER: 'payment-handler',
+ MIXEDSCRIPT: 'mixed-script',
BLUETOOTH_SCANNING: 'bluetooth-scanning',
NATIVE_FILE_SYSTEM_WRITE: 'native-file-system-write',
};
@@ -121,3 +122,10 @@ settings.SortMethod = {
MOST_VISITED: 'most-visited',
STORAGE: 'data-stored',
};
+
+/**
+ * String representation of the wildcard used for universal
+ * match for SiteExceptions.
+ * @type {string}
+ */
+settings.SITE_EXCEPTION_WILDCARD = '*';
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 9fc485db610..f1a028c92b5 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_data.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_data.html
@@ -44,7 +44,7 @@
</cr-button>
<cr-button disabled$="[[isLoading_]]" id="removeThirdPartyCookies"
on-click="onRemoveThirdPartyCookiesTap_"
- hidden$="[[!enableRemovingAllThirdPartyCookies_]]">
+ hidden$="[[!showRemoveThirdPartyCookies_(sites.length, filter)]]">
$i18n{siteSettingsCookieRemoveAllThirdParty}
</cr-button>
</div>
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 644aedc4ac0..cd6370aa91c 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_data.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_data.js
@@ -75,15 +75,6 @@ Polymer({
/** @private */
listBlurred_: Boolean,
-
- /** @private */
- enableRemovingAllThirdPartyCookies_: {
- type: Boolean,
- value: function() {
- return loadTimeData.getBoolean('enableRemovingAllThirdPartyCookies') &&
- (this.sites.length > 0);
- }
- },
},
/** @private {settings.LocalDataBrowserProxy} */
@@ -287,4 +278,13 @@ Polymer({
new URLSearchParams('site=' + event.model.item.site));
this.lastSelected_ = event.model;
},
+
+ /**
+ * @private
+ * @return {boolean}
+ */
+ showRemoveThirdPartyCookies_: function() {
+ return loadTimeData.getBoolean('enableRemovingAllThirdPartyCookies') &&
+ this.sites.length > 0 && this.filter.length == 0;
+ },
});
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 1472652cc9e..fb24557a8e0 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_details.html
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_details.html
@@ -207,13 +207,20 @@
icon="settings:payment-handler" id="paymentHandler"
label="$i18n{siteSettingsPaymentHandler}">
</site-details-permission>
- <template is="dom-if" if="[[enableBluetoothScanningContentSetting_]]">
+ <template is="dom-if" if="[[enableExperimentalWebPlatformFeatures_]]">
<site-details-permission
category="{{ContentSettingsTypes.BLUETOOTH_SCANNING}}"
icon="settings:bluetooth-scanning" id="bluetoothScanning"
label="$i18n{siteSettingsBluetoothScanning}">
</site-details-permission>
</template>
+ <template is="dom-if" if="[[enableInsecureContentContentSetting_]]">
+ <site-details-permission
+ category="{{ContentSettingsTypes.MIXEDSCRIPT}}"
+ icon="settings:insecure-content" id="mixed-script"
+ label="$i18n{siteSettingsInsecureContent}">
+ </site-details-permission>
+ </template>
</div>
<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 875533a5f19..df765e0e3af 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_details.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_details.js
@@ -63,19 +63,19 @@ Polymer({
},
/** @private */
- enableBluetoothScanningContentSetting_: {
+ enableNativeFileSystemWriteContentSetting_: {
type: Boolean,
value: function() {
- return loadTimeData.getBoolean('enableBluetoothScanningContentSetting');
+ return loadTimeData.getBoolean(
+ 'enableNativeFileSystemWriteContentSetting');
}
},
/** @private */
- enableNativeFileSystemWriteContentSetting_: {
+ enableInsecureContentContentSetting_: {
type: Boolean,
value: function() {
- return loadTimeData.getBoolean(
- 'enableNativeFileSystemWriteContentSetting');
+ return loadTimeData.getBoolean('enableInsecureContentContentSetting');
}
},
},
@@ -185,7 +185,9 @@ Polymer({
exceptionList.forEach((exception, i) => {
// |exceptionList| should be in the same order as
// |categoryList|.
- permissionsMap[categoryList[i]].site = exception;
+ if (permissionsMap[categoryList[i]]) {
+ permissionsMap[categoryList[i]].site = exception;
+ }
});
// The displayName won't change, so just use the first
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 f296bf59503..da644580de1 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
@@ -36,16 +36,17 @@
<site-favicon url="[[model.origin]]"></site-favicon>
<div class="middle no-min-width">
<div class="text-elide">
- <span class="url-directionality">[[model.displayName]]</span>
+ <span class="url-directionality">[[computeDisplayName_(model)]]
+ </span>
</div>
<!-- This div must not contain extra whitespace. -->
<div class="secondary text-elide"
- id="siteDescription">[[siteDescription_]]</div>
+ id="siteDescription">[[computeSiteDescription_(model)]]</div>
</div>
<template is="dom-if" if="[[allowNavigateToSiteDetail_]]">
<cr-icon-button class="subpage-arrow"
- aria-label$="[[model.displayName]]"
+ aria-label$="[[computeDisplayName_(model)]]"
aria-describedby="siteDescription" focus-row-control
focus-type="site-details"></cr-icon-button>
<div class="separator"></div>
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_list_entry.js b/chromium/chrome/browser/resources/settings/site_settings/site_list_entry.js
index fda7071af91..b296f31a34a 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_list_entry.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_list_entry.js
@@ -55,12 +55,6 @@ Polymer({
},
/** @private */
- siteDescription_: {
- type: String,
- computed: 'computeSiteDescription_(model)',
- },
-
- /** @private */
showPolicyPrefIndicator_: {
type: Boolean,
computed: 'computeShowPolicyPrefIndicator_(model)',
@@ -126,34 +120,59 @@ Polymer({
},
/**
+ * Returns the appropriate display name to show for the exception.
+ * This can, for example, be the website that is affected itself,
+ * or the website whose third parties are also affected.
+ * @return {string}
+ */
+ computeDisplayName_: function() {
+ if (this.model.embeddingOrigin &&
+ this.model.category === settings.ContentSettingsTypes.COOKIES &&
+ this.model.origin.trim() == settings.SITE_EXCEPTION_WILDCARD) {
+ return this.model.embeddingOrigin;
+ }
+ return this.model.displayName;
+ },
+
+ /**
* Returns the appropriate site description to display. This can, for example,
* be blank, an 'embedded on <site>' or 'Current incognito session' (or a
* mix of the last two).
- * @return {string} The site description.
+ * @return {string}
*/
computeSiteDescription_: function() {
- let displayName = '';
+ let description = '';
+
if (this.model.embeddingOrigin) {
- displayName = loadTimeData.getStringF(
- 'embeddedOnHost', this.sanitizePort(this.model.embeddingOrigin));
+ if (this.model.category === settings.ContentSettingsTypes.COOKIES &&
+ this.model.origin.trim() == settings.SITE_EXCEPTION_WILDCARD) {
+ description =
+ loadTimeData.getString(
+ 'siteSettingsCookiesThirdPartyExceptionLabel');
+ } else {
+ description = loadTimeData.getStringF(
+ 'embeddedOnHost', this.sanitizePort(this.model.embeddingOrigin));
+ }
} else if (this.category == settings.ContentSettingsTypes.GEOLOCATION) {
- displayName = loadTimeData.getString('embeddedOnAnyHost');
+ description = loadTimeData.getString('embeddedOnAnyHost');
}
// <if expr="chromeos">
if (this.model.category === settings.ContentSettingsTypes.NOTIFICATIONS &&
this.model.showAndroidSmsNote) {
- displayName = loadTimeData.getString('androidSmsNote');
+ description = loadTimeData.getString('androidSmsNote');
}
// </if>
if (this.model.incognito) {
- if (displayName.length > 0) {
- return loadTimeData.getStringF('embeddedIncognitoSite', displayName);
+ if (description.length > 0) {
+ description =
+ loadTimeData.getStringF('embeddedIncognitoSite', description);
+ } else {
+ description = loadTimeData.getString('incognitoSite');
}
- return loadTimeData.getString('incognitoSite');
}
- return displayName;
+ return description;
},
/**
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 af45a352e33..545c49afcba 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
@@ -196,17 +196,20 @@ const SiteSettingsBehaviorImpl = {
settings.ContentSettingsTypes.SERIAL_PORTS,
'enableExperimentalWebPlatformFeatures');
addOrRemoveSettingWithFlag(
+ settings.ContentSettingsTypes.BLUETOOTH_SCANNING,
+ 'enableExperimentalWebPlatformFeatures');
+ addOrRemoveSettingWithFlag(
settings.ContentSettingsTypes.ADS,
'enableSafeBrowsingSubresourceFilter');
addOrRemoveSettingWithFlag(
settings.ContentSettingsTypes.PAYMENT_HANDLER,
'enablePaymentHandlerContentSetting');
addOrRemoveSettingWithFlag(
- settings.ContentSettingsTypes.BLUETOOTH_SCANNING,
- 'enableBluetoothScanningContentSetting');
- addOrRemoveSettingWithFlag(
settings.ContentSettingsTypes.NATIVE_FILE_SYSTEM_WRITE,
'enableNativeFileSystemWriteContentSetting');
+ addOrRemoveSettingWithFlag(
+ settings.ContentSettingsTypes.MIXEDSCRIPT,
+ 'enableInsecureContentContentSetting');
return this.contentTypes_.slice(0);
},
diff --git a/chromium/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js b/chromium/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js
index 267e480c034..2b826c3b5a2 100644
--- a/chromium/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js
+++ b/chromium/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js
@@ -14,8 +14,16 @@
* @enum {string}
*/
const ContentSettingProvider = {
+ POLICY: 'policy',
+ SUPERVISED_USER: 'supervised_user',
EXTENSION: 'extension',
+ INSTALLED_WEBAPP_PROVIDER: 'installed_webapp_provider',
+ NOTIFICATION_ANDROID: 'notification_android',
+ EPHEMERAL: 'ephemeral',
PREFERENCE: 'preference',
+ DEFAULT: 'default',
+ TESTS: 'tests',
+ TESTS_OTHER: 'tests_other'
};
/**
@@ -426,12 +434,9 @@ cr.define('settings', function() {
/** @override */
setCategoryPermissionForPattern(
primaryPattern, secondaryPattern, contentType, value, incognito) {
- // TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin
- // pattern. Look into removing this parameter from site_settings_handler.
- // Ignoring the |secondaryPattern| and using '' instead is a quick-fix.
chrome.send(
'setCategoryPermissionForPattern',
- [primaryPattern, '', contentType, value, incognito]);
+ [primaryPattern, secondaryPattern, contentType, value, incognito]);
}
/** @override */
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 a2adc7f829b..3db16d2d4f1 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
@@ -247,7 +247,16 @@
'$i18nPolymer{siteSettingsPaymentHandlerBlock}')]]"></cr-link-row>
</template>
- <template is="dom-if" if="[[enableBluetoothScanningContentSetting_]]">
+ <template is="dom-if" if="[[enableInsecureContentContentSetting_]]">
+ <cr-link-row class="hr two-line" data-route="SITE_SETTINGS_MIXEDSCRIPT"
+ label="$i18n{siteSettingsInsecureContent}"
+ on-click="onTapNavigate_"
+ start-icon="settings:insecure-content"
+ sub-label="$i18n{siteSettingsInsecureContentBlock}"
+ </cr-link-row>
+ </template>
+
+ <template is="dom-if" if="[[enableExperimentalWebPlatformFeatures_]]">
<cr-link-row class="hr two-line"
data-route="SITE_SETTINGS_BLUETOOTH_SCANNING"
id="bluetooth-scanning" label="$i18n{siteSettingsBluetoothScanning}"
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 25bee399e1c..588b6d078aa 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
@@ -60,10 +60,10 @@ Polymer({
},
/** @private */
- enableBluetoothScanningContentSetting_: {
+ enableInsecureContentContentSetting_: {
type: Boolean,
value: function() {
- return loadTimeData.getBoolean('enableBluetoothScanningContentSetting');
+ return loadTimeData.getBoolean('enableInsecureContentContentSetting');
}
},
@@ -130,7 +130,7 @@ Polymer({
pairs.push([R.SITE_SETTINGS_SERIAL_PORTS, 'serial-ports']);
}
- if (this.enableBluetoothScanningContentSetting_) {
+ if (this.enableExperimentalWebPlatformFeatures_) {
pairs.push([R.SITE_SETTINGS_BLUETOOTH_SCANNING, 'bluetooth-scanning']);
}
@@ -140,6 +140,10 @@ Polymer({
]);
}
+ if (this.enableInsecureContentContentSetting_) {
+ pairs.push([R.SITE_SETTINGS_MIXEDSCRIPT, 'mixed-script']);
+ }
+
pairs.forEach(([route, id]) => {
this.focusConfig.set(route.path, () => this.async(() => {
cr.ui.focusWithoutInk(assert(this.$$(`#${id}`)));
diff --git a/chromium/chrome/browser/resources/signin/BUILD.gn b/chromium/chrome/browser/resources/signin/BUILD.gn
new file mode 100644
index 00000000000..0dbc17e4c9c
--- /dev/null
+++ b/chromium/chrome/browser/resources/signin/BUILD.gn
@@ -0,0 +1,18 @@
+# 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("//tools/polymer/polymer.gni")
+
+group("polymer3_elements") {
+ deps = [
+ ":signin_shared_css_module",
+ "sync_confirmation:polymer3_elements",
+ ]
+}
+
+polymer_modulizer("signin_shared_css") {
+ html_file = "signin_shared_css.html"
+ js_file = "signin_shared_css.js"
+ html_type = "v3-ready"
+}
diff --git a/chromium/chrome/browser/resources/signin/signin_email_confirmation/signin_email_confirmation.html b/chromium/chrome/browser/resources/signin/signin_email_confirmation/signin_email_confirmation.html
index b0ce42afce4..2cb6a34e89b 100644
--- a/chromium/chrome/browser/resources/signin/signin_email_confirmation/signin_email_confirmation.html
+++ b/chromium/chrome/browser/resources/signin/signin_email_confirmation/signin_email_confirmation.html
@@ -7,7 +7,7 @@
<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/polymer/v1_0/paper-styles/color.html">
- <link rel="import" href="signin_shared_css.html">
+ <link rel="import" href="signin_shared_old_css.html">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/load_time_data.html">
diff --git a/chromium/chrome/browser/resources/signin/signin_error/signin_error.html b/chromium/chrome/browser/resources/signin/signin_error/signin_error.html
index 8510d635a75..251e1fa5b6d 100644
--- a/chromium/chrome/browser/resources/signin/signin_error/signin_error.html
+++ b/chromium/chrome/browser/resources/signin/signin_error/signin_error.html
@@ -5,13 +5,18 @@
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
- <link rel="import" href="signin_shared_css.html">
+ <link rel="import" href="signin_shared_old_css.html">
+ <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">
<link rel="import" href="chrome://resources/html/load_time_data.html">
<link rel="import" href="chrome://resources/html/util.html">
<custom-style>
<style include="signin-dialog-shared">
+ html {
+ background: var(--md-background-color);
+ }
+
.details {
line-height: 20px;
margin-bottom: 8px;
diff --git a/chromium/chrome/browser/resources/signin/signin_shared_css.html b/chromium/chrome/browser/resources/signin/signin_shared_css.html
index 8267ae51398..79227224ba7 100644
--- a/chromium/chrome/browser/resources/signin/signin_shared_css.html
+++ b/chromium/chrome/browser/resources/signin/signin_shared_css.html
@@ -1,45 +1,41 @@
-<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(--cr-link-color);
- text-decoration: none;
- }
+<template>
+ <style>
+ a {
+ color: var(--cr-link-color);
+ text-decoration: none;
+ }
- body {
- margin: 0;
- padding: 0;
- }
+ body {
+ margin: 0;
+ padding: 0;
+ }
- .container {
- color: var(--cr-primary-text-color);
- width: 448px;
- }
+ .container {
+ color: var(--cr-primary-text-color);
+ width: 448px;
+ }
- .top-title-bar {
- align-items: center;
- border-bottom: var(--cr-separator-line);
- display: flex;
- font-size: 16px;
- height: 52px;
- padding: 0 24px;
- }
+ .top-title-bar {
+ align-items: center;
+ border-bottom: var(--cr-separator-line);
+ display: flex;
+ font-size: 16px;
+ height: 52px;
+ padding: 0 24px;
+ }
- .action-container {
- display: flex;
- justify-content: flex-end;
- padding: 16px;
- }
+ .action-container {
+ display: flex;
+ justify-content: flex-end;
+ padding: 16px;
+ }
<if expr="is_macosx or is_linux">
- .action-container {
- flex-flow: row-reverse;
- justify-content: flex-start;
- }
+ .action-container {
+ flex-flow: row-reverse;
+ justify-content: flex-start;
+ }
</if>
- </style>
- </template>
-</dom-module>
+ </style>
+</template>
diff --git a/chromium/chrome/browser/resources/signin/signin_shared_css.js b/chromium/chrome/browser/resources/signin/signin_shared_css.js
new file mode 100644
index 00000000000..ce2743cab1f
--- /dev/null
+++ b/chromium/chrome/browser/resources/signin/signin_shared_css.js
@@ -0,0 +1,11 @@
+/* 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://resources/cr_elements/shared_vars_css.m.js';
+
+import 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+const styleElement = document.createElement('dom-module');
+styleElement.setAttribute('assetpath', 'chrome://resources/');
+styleElement.innerHTML = `{__html_template__}`;
+styleElement.register('signin-dialog-shared');
diff --git a/chromium/chrome/browser/resources/signin/signin_shared_old_css.html b/chromium/chrome/browser/resources/signin/signin_shared_old_css.html
new file mode 100644
index 00000000000..8267ae51398
--- /dev/null
+++ b/chromium/chrome/browser/resources/signin/signin_shared_old_css.html
@@ -0,0 +1,45 @@
+<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(--cr-link-color);
+ text-decoration: none;
+ }
+
+ body {
+ margin: 0;
+ padding: 0;
+ }
+
+ .container {
+ color: var(--cr-primary-text-color);
+ width: 448px;
+ }
+
+ .top-title-bar {
+ align-items: center;
+ border-bottom: var(--cr-separator-line);
+ display: flex;
+ font-size: 16px;
+ height: 52px;
+ padding: 0 24px;
+ }
+
+ .action-container {
+ display: flex;
+ justify-content: flex-end;
+ padding: 16px;
+ }
+
+<if expr="is_macosx or is_linux">
+ .action-container {
+ flex-flow: row-reverse;
+ justify-content: flex-start;
+ }
+</if>
+ </style>
+ </template>
+</dom-module>
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/BUILD.gn b/chromium/chrome/browser/resources/signin/sync_confirmation/BUILD.gn
index 6f36b5e3c54..4492e543319 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/BUILD.gn
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/BUILD.gn
@@ -3,8 +3,23 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/polymer/polymer.gni")
-js_type_check("closure_compile") {
+group("closure_compile") {
+ deps = [
+ ":closure_compile_polymer2",
+ ":closure_compile_polymer3",
+ ]
+}
+
+js_type_check("closure_compile_polymer2") {
+ deps = [
+ ":sync_disabled_confirmation",
+ ]
+}
+
+js_type_check("closure_compile_polymer3") {
+ is_polymer3 = true
deps = [
":sync_confirmation",
":sync_confirmation_app",
@@ -15,25 +30,46 @@ js_type_check("closure_compile") {
js_library("sync_confirmation") {
deps = [
":sync_confirmation_browser_proxy",
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
}
js_library("sync_confirmation_app") {
deps = [
":sync_confirmation_browser_proxy",
- "//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:load_time_data",
- "//ui/webui/resources/js:web_ui_listener_behavior",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/js:assert.m",
+ "//ui/webui/resources/js:load_time_data.m",
+ "//ui/webui/resources/js:web_ui_listener_behavior.m",
]
}
js_library("sync_confirmation_browser_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
externs_list = [
"$externs_path/chrome_send.js",
"$externs_path/metrics_private.js",
]
}
+
+js_library("sync_disabled_confirmation") {
+ deps = [
+ "//ui/webui/resources/js:assert",
+ "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:util",
+ ]
+}
+
+group("polymer3_elements") {
+ deps = [
+ ":sync_confirmation_app_module",
+ ]
+}
+
+polymer_modulizer("sync_confirmation_app") {
+ html_file = "sync_confirmation_app.html"
+ js_file = "sync_confirmation_app.js"
+ html_type = "v3-ready"
+}
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 52d93830335..328bfda7c42 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.html
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
- <link rel="import" href="sync_confirmation_app.html"></link>
+ <script type="module" src="sync_confirmation_app.js"></script>
<style>
body {
margin: 0;
@@ -21,7 +21,5 @@
<sync-confirmation-app></sync-confirmation-app>
</body>
<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>
+ <script type="module" src="sync_confirmation.js"></script>
</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 31aa325f3ef..04c560fac17 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.js
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation.js
@@ -2,31 +2,27 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
-cr.define('sync.confirmation', function() {
- 'use strict';
+import {addWebUIListener} from 'chrome://resources/js/cr.m.js';
- function initialize() {
- const syncConfirmationBrowserProxy =
- sync.confirmation.SyncConfirmationBrowserProxyImpl.getInstance();
- // Prefer using |document.body.offsetHeight| instead of
- // |document.body.scrollHeight| as it returns the correct height of the
- // even when the page zoom in Chrome is different than 100%.
- syncConfirmationBrowserProxy.initializedWithSize(
- [document.body.offsetHeight]);
- // The web dialog size has been initialized, so reset the body width to
- // auto. This makes sure that the body only takes up the viewable width,
- // e.g. when there is a scrollbar.
- document.body.style.width = 'auto';
- }
+import {SyncConfirmationBrowserProxyImpl} from './sync_confirmation_browser_proxy.js';
- function clearFocus() {
- document.activeElement.blur();
- }
+function initialize() {
+ addWebUIListener('clear-focus', clearFocus);
+ const syncConfirmationBrowserProxy =
+ SyncConfirmationBrowserProxyImpl.getInstance();
+ // Prefer using |document.body.offsetHeight| instead of
+ // |document.body.scrollHeight| as it returns the correct height of the
+ // even when the page zoom in Chrome is different than 100%.
+ syncConfirmationBrowserProxy.initializedWithSize(
+ [document.body.offsetHeight]);
+ // The web dialog size has been initialized, so reset the body width to
+ // auto. This makes sure that the body only takes up the viewable width,
+ // e.g. when there is a scrollbar.
+ document.body.style.width = 'auto';
+}
- return {
- clearFocus: clearFocus,
- initialize: initialize,
- };
-});
+function clearFocus() {
+ document.activeElement.blur();
+}
-document.addEventListener('DOMContentLoaded', sync.confirmation.initialize);
+document.addEventListener('DOMContentLoaded', initialize);
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.html b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.html
index fffc18a7d60..818fad1c1fc 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.html
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.html
@@ -1,169 +1,152 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
-<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/web_ui_listener_behavior.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
-<link rel="import" href="signin_shared_css.html">
-<link rel="import" href="sync_confirmation_browser_proxy.html">
-
-<script src="chrome://sync-confirmation/strings.js"></script>
-
-<dom-module id="sync-confirmation-app">
- <template>
- <style include="signin-dialog-shared">
- :host {
- color: var(--cr-primary-text-color);
- display: block;
- }
-
- cr-button {
- padding-inline-end: 16px;
- padding-inline-start: 16px;
- }
-
- .action-container {
- bottom: 0;
- box-sizing: border-box;
- position: absolute;
- width: 100%;
- }
-
- cr-button:not(.action-button) {
- margin-inline-start: 8px;
- }
+<style include="signin-dialog-shared">
+ :host {
+ color: var(--cr-primary-text-color);
+ display: block;
+ }
+
+ cr-button {
+ padding-inline-end: 16px;
+ padding-inline-start: 16px;
+ }
+
+ .action-container {
+ bottom: 0;
+ box-sizing: border-box;
+ position: absolute;
+ width: 100%;
+ }
+
+ cr-button:not(.action-button) {
+ margin-inline-start: 8px;
+ }
<if expr="is_macosx or is_linux">
- /* This works together with the button-flip in signin-dialog-shared. */
- cr-button:not(.action-button) {
- margin-inline-end: 8px;
- margin-inline-start: 0;
- }
+ /* This works together with the button-flip in signin-dialog-shared. */
+ cr-button:not(.action-button) {
+ margin-inline-end: 8px;
+ margin-inline-start: 0;
+ }
</if>
- #illustration-container {
- height: 168px;
- margin-bottom: 32px;
- position: relative;
- width: 100%;
- }
-
- #illustration {
- background: url(./images/sync_confirmation_illustration.svg);
- background-size: 100% 100%;
- height: 100%;
- position: absolute;
- top: 0;
- width: 100%;
- }
-
- @media (prefers-color-scheme: dark) {
- #illustration {
- background-image:
- url(./images/sync_confirmation_illustration_dark.svg);
- }
- }
-
- #illustration-container > img {
- border-radius: 50%;
- height: 68px;
- left: 0;
- margin: auto;
- position: absolute;
- right: 0;
- top: 96px;
- width: 68px;
- }
-
- .heading {
- font-weight: normal;
- margin-bottom: 32px;
- padding: 0 24px;
- text-align: center;
- }
-
- #content-container {
- /* Saves space for button row. */
- padding-bottom: 96px;
- position: relative;
- width: 100%;
- }
-
- .message-container {
- line-height: 20px;
- margin-bottom: 16px;
- padding: 0 24px;
- }
-
- .secondary {
- color: var(--cr-secondary-text-color);
- }
-
- @media (prefers-color-scheme: light) {
- #grey-banner {
- background: var(--paper-grey-50);
- height: 128px;
- top: 0;
- width: 100%;
- }
- }
-
- #footer {
- margin-bottom: 0;
- padding-top: 12px;
- }
-
- #settingsButton {
- left: 16px;
- position: absolute;
- }
-
- :host-context([dir='rtl']) #settingsButton {
- left: auto;
- right: 16px;
- }
- </style>
-
- <!--
- Use the 'consent-description' attribute to annotate all the UI elements
- that are part of the text the user reads before consenting to the Sync
- data collection . Similarly, use 'consent-confirmation' on UI elements on
- which user clicks to indicate consent.
- -->
-
- <div id="illustration-container">
- <div id="grey-banner"></div>
- <div id="illustration"></div>
- <img src="[[accountImageSrc_]]">
+ #illustration-container {
+ height: 168px;
+ margin-bottom: 32px;
+ position: relative;
+ width: 100%;
+ }
+
+ #illustration {
+ background: url(./images/sync_confirmation_illustration.svg);
+ background-size: 100% 100%;
+ height: 100%;
+ position: absolute;
+ top: 0;
+ width: 100%;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ #illustration {
+ background-image:
+ url(./images/sync_confirmation_illustration_dark.svg);
+ }
+ }
+
+ #illustration-container > img {
+ border-radius: 50%;
+ height: 68px;
+ left: 0;
+ margin: auto;
+ position: absolute;
+ right: 0;
+ top: 96px;
+ width: 68px;
+ }
+
+ .heading {
+ font-weight: normal;
+ margin-bottom: 32px;
+ padding: 0 24px;
+ text-align: center;
+ }
+
+ #content-container {
+ /* Saves space for button row. */
+ padding-bottom: 96px;
+ position: relative;
+ width: 100%;
+ }
+
+ .message-container {
+ line-height: 20px;
+ margin-bottom: 16px;
+ padding: 0 24px;
+ }
+
+ .secondary {
+ color: var(--cr-secondary-text-color);
+ }
+
+ @media (prefers-color-scheme: light) {
+ #grey-banner {
+ background: var(--paper-grey-50);
+ height: 128px;
+ top: 0;
+ width: 100%;
+ }
+ }
+
+ #footer {
+ margin-bottom: 0;
+ padding-top: 12px;
+ }
+
+ #settingsButton {
+ left: 16px;
+ position: absolute;
+ }
+
+ :host-context([dir='rtl']) #settingsButton {
+ left: auto;
+ right: 16px;
+ }
+</style>
+
+<!--
+ Use the 'consent-description' attribute to annotate all the UI elements
+ that are part of the text the user reads before consenting to the Sync
+ data collection . Similarly, use 'consent-confirmation' on UI elements on
+ which user clicks to indicate consent.
+-->
+
+<div id="illustration-container">
+ <div id="grey-banner"></div>
+ <div id="illustration"></div>
+ <img src="[[accountImageSrc_]]">
+</div>
+<div id="content-container">
+ <h1 id="syncConfirmationHeading" class="heading" consent-description>
+ $i18n{syncConfirmationTitle}
+ </h1>
+ <div class="message-container">
+ <div consent-description>$i18n{syncConfirmationSyncInfoTitle}</div>
+ <div class="secondary" consent-description>
+ $i18n{syncConfirmationSyncInfoDesc}
</div>
- <div id="content-container">
- <h1 id="syncConfirmationHeading" class="heading" consent-description>
- $i18n{syncConfirmationTitle}
- </h1>
- <div class="message-container">
- <div consent-description>$i18n{syncConfirmationSyncInfoTitle}</div>
- <div class="secondary" consent-description>
- $i18n{syncConfirmationSyncInfoDesc}
- </div>
- </div>
- <div id="footer" class="message-container secondary">
- $i18n{syncConfirmationSettingsInfo}
- </div>
- <div class="action-container">
- <cr-button class="action-button" id="confirmButton"
- on-click="onConfirm_" consent-confirmation>
- $i18n{syncConfirmationConfirmLabel}
- </cr-button>
- <cr-button on-click="onUndo_">
- $i18n{syncConfirmationUndoLabel}
- </cr-button>
- <cr-button id="settingsButton" on-click="onGoToSettings_"
- consent-confirmation>
- $i18n{syncConfirmationSettingsLabel}
- </cr-button>
- </div>
- </div>
- </template>
- <script src="sync_confirmation_app.js"></script>
-</dom-module>
+ </div>
+ <div id="footer" class="message-container secondary">
+ $i18n{syncConfirmationSettingsInfo}
+ </div>
+ <div class="action-container">
+ <cr-button class="action-button" id="confirmButton"
+ on-click="onConfirm_" consent-confirmation>
+ $i18n{syncConfirmationConfirmLabel}
+ </cr-button>
+ <cr-button on-click="onUndo_">
+ $i18n{syncConfirmationUndoLabel}
+ </cr-button>
+ <cr-button id="settingsButton" on-click="onGoToSettings_"
+ consent-confirmation>
+ $i18n{syncConfirmationSettingsLabel}
+ </cr-button>
+ </div>
+</div>
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.js b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.js
index 57f29b847a5..2e9c4aa7af8 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.js
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.js
@@ -2,9 +2,23 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
+import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
+import 'chrome://resources/polymer/v3_0/paper-styles/color.js';
+import './strings.m.js';
+import './signin_shared_css.js';
+
+import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js';
+import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
+import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js';
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {SyncConfirmationBrowserProxy, SyncConfirmationBrowserProxyImpl} from './sync_confirmation_browser_proxy.js';
+
Polymer({
is: 'sync-confirmation-app',
+ _template: html`{__html_template__}`,
+
behaviors: [
WebUIListenerBehavior,
],
@@ -19,7 +33,7 @@ Polymer({
},
},
- /** @private {?sync.confirmation.SyncConfirmationBrowserProxy} */
+ /** @private {?SyncConfirmationBrowserProxy} */
syncConfirmationBrowserProxy_: null,
/** @private {?function(Event)} */
@@ -28,7 +42,7 @@ Polymer({
/** @override */
attached: function() {
this.syncConfirmationBrowserProxy_ =
- sync.confirmation.SyncConfirmationBrowserProxyImpl.getInstance();
+ SyncConfirmationBrowserProxyImpl.getInstance();
this.boundKeyDownHandler_ = this.onKeyDown_.bind(this);
// This needs to be bound to document instead of "this" because the dialog
// window opens initially, the focus level is only on document, so the key
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_browser_proxy.html b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_browser_proxy.html
deleted file mode 100644
index 636a6b9e214..00000000000
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_browser_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="sync_confirmation_browser_proxy.js"></script> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_browser_proxy.js b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_browser_proxy.js
index c5cb104af72..b98c5ee1fe9 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_browser_proxy.js
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_browser_proxy.js
@@ -6,75 +6,69 @@
* @fileoverview A helper object used by the sync confirmation dialog to
* interact with the browser.
*/
+import {addSingletonGetter} from 'chrome://resources/js/cr.m.js';
-cr.define('sync.confirmation', function() {
- /** @interface */
- class SyncConfirmationBrowserProxy {
- /**
- * Called when the user confirms the Sync Confirmation dialog.
- * @param {!Array<string>} description Strings that the user was presented
- * with in the UI.
- * @param {string} confirmation Text of the element that the user
- * clicked on.
- */
- confirm(description, confirmation) {}
+/** @interface */
+export class SyncConfirmationBrowserProxy {
+ /**
+ * Called when the user confirms the Sync Confirmation dialog.
+ * @param {!Array<string>} description Strings that the user was presented
+ * with in the UI.
+ * @param {string} confirmation Text of the element that the user
+ * clicked on.
+ */
+ confirm(description, confirmation) {}
- /**
- * Called when the user undoes the Sync confirmation.
- */
- undo() {}
+ /**
+ * Called when the user undoes the Sync confirmation.
+ */
+ undo() {}
- /**
- * Called when the user clicks on the Settings link in
- * the Sync Confirmation dialog.
- * @param {!Array<string>} description Strings that the user was presented
- * with in the UI.
- * @param {string} confirmation Text of the element that the user
- * clicked on.
- */
- goToSettings(description, confirmation) {}
+ /**
+ * Called when the user clicks on the Settings link in
+ * the Sync Confirmation dialog.
+ * @param {!Array<string>} description Strings that the user was presented
+ * with in the UI.
+ * @param {string} confirmation Text of the element that the user
+ * clicked on.
+ */
+ goToSettings(description, confirmation) {}
- /** @param {!Array<number>} height */
- initializedWithSize(height) {}
+ /** @param {!Array<number>} height */
+ initializedWithSize(height) {}
- /**
- * Called when the WebUIListener for "account-image-changed" was added.
- */
- requestAccountImage() {}
- }
-
- /** @implements {sync.confirmation.SyncConfirmationBrowserProxy} */
- class SyncConfirmationBrowserProxyImpl {
- /** @override */
- confirm(description, confirmation) {
- chrome.send('confirm', [description, confirmation]);
- }
+ /**
+ * Called when the WebUIListener for "account-image-changed" was added.
+ */
+ requestAccountImage() {}
+}
- /** @override */
- undo() {
- chrome.send('undo');
- }
+/** @implements {SyncConfirmationBrowserProxy} */
+export class SyncConfirmationBrowserProxyImpl {
+ /** @override */
+ confirm(description, confirmation) {
+ chrome.send('confirm', [description, confirmation]);
+ }
- /** @override */
- goToSettings(description, confirmation) {
- chrome.send('goToSettings', [description, confirmation]);
- }
+ /** @override */
+ undo() {
+ chrome.send('undo');
+ }
- /** @override */
- initializedWithSize(height) {
- chrome.send('initializedWithSize', height);
- }
+ /** @override */
+ goToSettings(description, confirmation) {
+ chrome.send('goToSettings', [description, confirmation]);
+ }
- /** @override */
- requestAccountImage() {
- chrome.send('accountImageRequest');
- }
+ /** @override */
+ initializedWithSize(height) {
+ chrome.send('initializedWithSize', height);
}
- cr.addSingletonGetter(SyncConfirmationBrowserProxyImpl);
+ /** @override */
+ requestAccountImage() {
+ chrome.send('accountImageRequest');
+ }
+}
- return {
- SyncConfirmationBrowserProxy: SyncConfirmationBrowserProxy,
- SyncConfirmationBrowserProxyImpl: SyncConfirmationBrowserProxyImpl,
- };
-});
+addSingletonGetter(SyncConfirmationBrowserProxyImpl);
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.html b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.html
index 74e05238e9e..059bc92e3b9 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.html
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.html
@@ -8,11 +8,10 @@
background-color: var(--md-background-color);
}
</style>
- </custom-style>
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
- <link rel="import" href="signin_shared_css.html">
+ <link rel="import" href="signin_shared_old_css.html">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<custom-style>
<style include="signin-dialog-shared">
diff --git a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.js b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.js
index 12307c5704b..97f494ac9b6 100644
--- a/chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.js
+++ b/chromium/chrome/browser/resources/signin/sync_confirmation/sync_disabled_confirmation.js
@@ -43,6 +43,7 @@ cr.define('sync.confirmation', function() {
}
function initialize() {
+ cr.addWebUIListener('clear-focus', clearFocus);
document.addEventListener('keydown', onKeyDown);
$('confirmButton').addEventListener('click', onConfirm);
$('undoButton').addEventListener('click', onUndo);
@@ -67,11 +68,7 @@ cr.define('sync.confirmation', function() {
}
}
- // TODO(tangltom): clearFocus is 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.
- return {clearFocus: clearFocus, initialize: initialize};
+ return {initialize: initialize};
});
document.addEventListener('DOMContentLoaded', sync.confirmation.initialize);
diff --git a/chromium/chrome/browser/resources/supervised_user_error_page_resources.grdp b/chromium/chrome/browser/resources/supervised_user_error_page_resources.grdp
index efdd213ea9f..b54e9e755cf 100644
--- a/chromium/chrome/browser/resources/supervised_user_error_page_resources.grdp
+++ b/chromium/chrome/browser/resources/supervised_user_error_page_resources.grdp
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
- <include name="IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML" file="supervised_user/supervised_user_error_page/resources/supervised_user_block_interstitial.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML" file="supervised_user/supervised_user_error_page/resources/supervised_user_block_interstitial.html" flattenhtml="true" type="BINDATA" compress="brotli" />
</grit-part>
diff --git a/chromium/chrome/browser/resources/tab_strip/BUILD.gn b/chromium/chrome/browser/resources/tab_strip/BUILD.gn
index ece86c1ad36..f6b804866d5 100644
--- a/chromium/chrome/browser/resources/tab_strip/BUILD.gn
+++ b/chromium/chrome/browser/resources/tab_strip/BUILD.gn
@@ -7,13 +7,18 @@ import("//tools/polymer/polymer.gni")
js_type_check("closure_compile") {
deps = [
+ ":alert_indicator",
":custom_element",
":tab",
":tab_list",
+ ":tab_strip_embedder_proxy",
":tabs_api_proxy",
]
}
+js_library("alert_indicator") {
+}
+
js_library("custom_element") {
}
@@ -28,26 +33,31 @@ js_library("tab") {
deps = [
"//ui/webui/resources/js:icon.m",
]
- externs_list = [ "$externs_path/chrome.js" ]
}
js_library("tab_list") {
- deps = [
- ":types",
- ]
- externs_list = [ "$externs_path/chrome.js" ]
}
-js_library("types") {
+js_library("tab_strip_embedder_proxy") {
+ deps = [
+ "//ui/webui/resources/js:cr.m",
+ ]
}
group("tab_strip_modules") {
deps = [
+ ":alert_indicator_module",
":tab_list_module",
":tab_module",
]
}
+polymer_modulizer("alert_indicator") {
+ js_file = "alert_indicator.js"
+ html_file = "alert_indicator.html"
+ html_type = "v3-ready"
+}
+
polymer_modulizer("tab") {
js_file = "tab.js"
html_file = "tab.html"
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicator.html b/chromium/chrome/browser/resources/tab_strip/alert_indicator.html
new file mode 100644
index 00000000000..5a4e4c7481c
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicator.html
@@ -0,0 +1,77 @@
+<style>
+ @keyframes fade-in {
+ 0% { opacity: 0; }
+ 100% { opacity: 1; }
+ }
+
+ @keyframes fade-out {
+ 0% { opacity: 1; }
+ 100% { opacity: 0; }
+ }
+
+ :host {
+ -webkit-mask: center / contain no-repeat;
+ animation: fade-in 200ms ease-in forwards;
+ background-color: currentColor;
+ display: block;
+ height: 100%;
+ opacity: 0;
+ width: 16px;
+ }
+
+ :host([fade-out]) {
+ animation: fade-out 1000ms ease-in;
+ }
+
+ :host([alert-state='pip']) {
+ -webkit-mask-image: url(alert_indicators/picture_in_picture_alt.svg);
+ background-color: var(--tabstrip-indicator-pip-color);
+ }
+
+ :host([alert-state='serial']) {
+ -webkit-mask-image: url(alert_indicators/serial_port.svg);
+ }
+
+ :host([alert-state='muted']) {
+ -webkit-mask-image: url(alert_indicators/tab_audio_muting_rounded.svg);
+ }
+
+ :host([alert-state='audio']) {
+ -webkit-mask-image: url(alert_indicators/tab_audio_rounded.svg);
+ }
+
+ :host([alert-state='bluetooth']) {
+ -webkit-mask-image: url(alert_indicators/tab_bluetooth_connected.svg);
+ }
+
+ :host([alert-state='capturing']) {
+ -webkit-mask-image:
+ url(alert_indicators/tab_media_capturing_with_arrow.svg);
+ background-color: var(--tabstrip-indicator-capturing-color);
+ }
+
+ :host([alert-state='recording']) {
+ -webkit-mask-image: url(alert_indicators/tab_media_recording.svg);
+ background-color: var(--tabstrip-indicator-recording-color);
+ }
+
+ :host([alert-state='usb']) {
+ -webkit-mask-image: url(alert_indicators/tab_usb_connected.svg);
+ -webkit-mask-size: 20px;
+ }
+
+ :host([alert-state='vr']) {
+ -webkit-mask-image: url(alert_indicators/vr_headset.svg);
+ }
+
+ :host([alert-state='capturing']),
+ :host([alert-state='recording']) {
+ animation:
+ fade-in 200ms ease-in 0,
+ fade-out 1000ms ease-in 200ms,
+ fade-in 200ms ease-in 1200s,
+ fade-out 1000ms ease-in 1400ms,
+ fade-in 200ms ease-in 2400ms;
+ animation-fill-mode: forwards;
+ }
+</style>
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicator.js b/chromium/chrome/browser/resources/tab_strip/alert_indicator.js
new file mode 100644
index 00000000000..2d41eab42f6
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicator.js
@@ -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 {CustomElement} from './custom_element.js';
+
+export class AlertIndicatorElement extends CustomElement {
+ static get template() {
+ return `{__html_template__}`;
+ }
+
+ /** @override */
+ remove() {
+ this.toggleAttribute('fade-out', true);
+ this.addEventListener('animationend', () => super.remove(), {once: true});
+ }
+}
+
+customElements.define('tabstrip-alert-indicator', AlertIndicatorElement);
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicators/picture_in_picture_alt.svg b/chromium/chrome/browser/resources/tab_strip/alert_indicators/picture_in_picture_alt.svg
new file mode 100644
index 00000000000..7ef00c31419
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicators/picture_in_picture_alt.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M 16 14 H 0 V 2 h 16 v 12 Z M 1 13 h 14 V 3 H 1 v 10 Z M 8 8 h 6 v 4 H 8 Z" /></svg>
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicators/serial_port.svg b/chromium/chrome/browser/resources/tab_strip/alert_indicators/serial_port.svg
new file mode 100644
index 00000000000..1bf89c75d27
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicators/serial_port.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M 22 9 V 7 h -2 V 5 c 0 -1.1 -0.9 -2 -2 -2 H 4 c -1.1 0 -2 0.9 -2 2 v 14 c 0 1.1 0.9 2 2 2 h 14 c 1.1 0 2 -0.9 2 -2 v -2 h 2 v -2 h -2 v -2 h 2 v -2 h -2 V 9 h 2 Z m -4 10 H 4 V 5 h 14 v 14 Z M 6 13 h 5 v 4 H 6 Z m 6 -6 h 4 v 3 h -4 Z M 6 7 h 5 v 5 H 6 Z m 6 4 h 4 v 6 h -4 Z" /></svg>
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_audio_muting_rounded.svg b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_audio_muting_rounded.svg
new file mode 100644
index 00000000000..3da0244cbe4
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_audio_muting_rounded.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path d="M 8.5 6 C 8.5 5.02 7.93 4.17 7.11 3.76 L 7.11 4.99 L 8.47 6.35 C 8.49 6.24 8.5 6.12 8.5 6 Z M 9.89 6 C 9.89 6.52 9.78 7.01 9.59 7.47 L 10.43 8.31 C 10.79 7.62 11 6.83 11 6 C 11 3.62 9.34 1.63 7.11 1.13 L 7.11 2.27 C 8.72 2.75 9.89 4.24 9.89 6 Z M 1.71 1 L 1 1.71 L 3.63 4.33 L 1 4.33 L 1 7.67 L 3.22 7.67 L 6 10.44 L 6 6.71 L 8.36 9.07 C 7.99 9.36 7.57 9.58 7.11 9.72 L 7.11 10.87 C 7.88 10.69 8.57 10.34 9.16 9.86 L 10.29 11 L 11 10.29 L 6 5.29 L 1.71 1 Z M 6 1.56 L 4.84 2.72 L 6 3.88 L 6 1.56 Z" /></svg>
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_audio_rounded.svg b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_audio_rounded.svg
new file mode 100644
index 00000000000..a09790ea5ed
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_audio_rounded.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path d="M 1 4.29 L 1 7.71 L 3.22 7.71 L 6 10.56 L 6 1.44 L 3.22 4.29 L 1 4.29 Z M 8.5 6 C 8.5 4.99 7.93 4.12 7.11 3.7 L 7.11 8.29 C 7.93 7.88 8.5 7.01 8.5 6 Z M 7.11 1 L 7.11 2.17 C 8.72 2.66 9.89 4.19 9.89 6 C 9.89 7.81 8.72 9.34 7.11 9.83 L 7.11 11 C 9.34 10.48 11 8.44 11 6 C 11 3.56 9.34 1.52 7.11 1 Z" /></svg>
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_bluetooth_connected.svg b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_bluetooth_connected.svg
new file mode 100644
index 00000000000..7b55099bb99
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_bluetooth_connected.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M 16.8 2 h -1.4 v 10.63 L 8.97 6.2 L 7 8.17 L 14.83 16 L 7 23.83 L 8.97 25.8 l 6.43 -6.43 V 30 h 1.4 l 7.99 -7.99 L 18.77 16 l 6.02 -6.01 L 16.8 2 Z M 18 7 l 3 3 l -3 3 l 0.2 -5.64 L 18 7 Z m 3 15.01 L 18 25 v -6 l 2.83 3.01 H 21 Z" /></svg>
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_media_capturing_with_arrow.svg b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_media_capturing_with_arrow.svg
new file mode 100644
index 00000000000..55d264b73a5
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_media_capturing_with_arrow.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M 0 2 L 16 2 L 16 14 L 0 14 L 0 2 Z M 1 3 L 1 13 L 15 13 L 15 3 L 1 3 Z M 2 4 L 14 4 L 14 12 L 2 12 L 2 4 Z M 7.92 9 L 7.92 11 L 11.5 8 L 7.92 5 L 7.92 7 C 5.14 7 4.38 9 4 11 C 4.93 9.6 5.88 8.96 7.92 9 Z" /></svg>
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_media_recording.svg b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_media_recording.svg
new file mode 100644
index 00000000000..d9ffeafa73a
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_media_recording.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill-rule="evenodd"><path d="M 16 28 c 6.63 0 12 -5.37 12 -12 C 28 9.37 22.63 4 16 4 C 9.37 4 4 9.37 4 16 c 0 6.63 5.37 12 12 12 Z m 0 -2 c 5.52 0 10 -4.48 10 -10 C 26 10.48 21.52 6 16 6 C 10.48 6 6 10.48 6 16 c 0 5.52 4.48 10 10 10 Z m 0 -2 c 4.42 0 8 -3.58 8 -8 c 0 -4.42 -3.58 -8 -8 -8 c -4.42 0 -8 3.58 -8 8 c 0 4.42 3.58 8 8 8 Z" /></svg>
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_usb_connected.svg b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_usb_connected.svg
new file mode 100644
index 00000000000..c378a79e433
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicators/tab_usb_connected.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M 19 16 h 1 v 2 h -3 v -8 h 2 l -3 -4 l -3 4 h 2 v 8 h -3 v -2 c 0.85 -0.53 1.34 -1.23 1 -2 c 0.34 -1.27 -0.64 -2.25 -2 -2 c -1.02 -0.25 -2 0.73 -2 2 c 0 0.77 0.49 1.47 1 2 v 2 c 0.18 0.99 1.06 1.87 2 2 h 3 v 3 c -0.59 0.26 -1.07 0.98 -1 2 c -0.07 1.03 0.91 2 2 2 c 1.29 0 2.27 -0.97 2 -2 c 0.27 -1.02 -0.21 -1.74 -1 -2 v -3 h 3 c 1.14 -0.13 2.01 -1.01 2 -2 v -2 h 1 v -4 h -4 v 4 Z" /></svg>
diff --git a/chromium/chrome/browser/resources/tab_strip/alert_indicators/vr_headset.svg b/chromium/chrome/browser/resources/tab_strip/alert_indicators/vr_headset.svg
new file mode 100644
index 00000000000..47d8a07244e
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/alert_indicators/vr_headset.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M 17.4 5.57 A 2.12 2.12 0 0 0 15.94 5 H 4.06 c -0.55 0 -1.07 0.2 -1.46 0.56 c -0.39 0.37 -0.6 0.85 -0.6 1.36 v 6.14 c 0 0.52 0.21 1 0.6 1.36 c 0.39 0.37 0.91 0.56 1.46 0.56 h 2.85 c 0.37 0 0.74 -0.09 1.06 -0.28 c 0.32 -0.18 0.58 -0.43 0.76 -0.74 l 0.81 -1.4 a 0.48 0.48 0 0 1 0.13 -0.62 a 0.56 0.56 0 0 1 0.67 0 c 0.2 0.15 0.25 0.41 0.13 0.62 l 0.81 1.4 c 0.18 0.3 0.44 0.56 0.76 0.74 c 0.32 0.18 0.68 0.28 1.06 0.28 h 2.85 c 0.55 0 1.07 -0.2 1.46 -0.56 c 0.39 -0.36 0.6 -0.85 0.6 -1.36 V 6.93 c 0 -0.51 -0.21 -1 -0.6 -1.36 Z M 6.5 11.5 c -1.11 0 -2 -0.9 -2 -2 c 0 -1.1 0.9 -2 2 -2 c 1.1 0 2 0.9 2 2 c 0 1.1 -0.89 2 -2 2 Z m 7 0 c -1.11 0 -2 -0.9 -2 -2 c 0 -1.1 0.9 -2 2 -2 c 1.1 0 2 0.9 2 2 c 0 1.1 -0.89 2 -2 2 Z" /></svg>
diff --git a/chromium/chrome/browser/resources/tab_strip/tab.html b/chromium/chrome/browser/resources/tab_strip/tab.html
index 1e715432804..85517760d2d 100644
--- a/chromium/chrome/browser/resources/tab_strip/tab.html
+++ b/chromium/chrome/browser/resources/tab_strip/tab.html
@@ -1,38 +1,170 @@
<style>
:host {
- border-radius: var(--tabstrip-card-border-radius);
- box-shadow: var(--tabstrip-elevation-box-shadow);
+ --tabstrip-tab-title-height: 40px;
+ --tabstrip-tab-transition-duration: 250ms;
+
cursor: pointer;
+ height: var(--tabstrip-tab-height);
+ position: relative;
+ width: var(--tabstrip-tab-width);
+ }
+
+ #dragImage {
+ background: var(--tabstrip-tab-background-color);
+ border-radius: var(--tabstrip-tab-border-radius);
+ box-shadow: 0 0 0 1px var(--tabstrip-tab-separator-color);
+ color: var(--tabstrip-tab-text-color);
display: flex;
flex-direction: column;
- height: 230px;
+ height: 100%;
overflow: hidden;
- width: 280px;
+ width: 100%;
}
- :host([active]) {
- box-shadow: 0 0 0 2px var(--tabstrip-focus-color);
+ :host([active]) #dragImage {
+ box-shadow: 0 0 0 2px var(--tabstrip-tab-active-border-color);
outline: none;
}
#title {
align-items: center;
- background: var(--tabstrip-card-background-color);
- border-block-end: 1px solid var(--tabstrip-separator-color);
+ border-block-end: 1px solid var(--tabstrip-tab-separator-color);
box-sizing: border-box;
display: flex;
- height: 40px;
+ height: var(--tabstrip-tab-title-height);
justify-content: center;
margin: 0;
- padding-inline-end: 4px;
- padding-inline-start: 12px;
+ overflow: hidden;
}
- #favicon {
+ #faviconContainer {
+ --favicon-size: 16px;
flex-shrink: 0;
- height: 16px;
+ height: var(--favicon-size);
margin-inline-end: 8px;
- width: 16px;
+ margin-inline-start: 12px;
+ max-width: var(--favicon-size);
+ position: relative;
+ /* When transitioning to the default visible state, the margin and max-width
+ * transitions should finish first, then the opacity should be set to 1.
+ * This prevents the favicon and loading spinners from looking cropped
+ * while the element transitions. */
+ transition: margin var(--tabstrip-tab-transition-duration),
+ max-width var(--tabstrip-tab-transition-duration),
+ opacity 0ms linear var(--tabstrip-tab-transition-duration);
+ width: var(--favicon-size);
+ }
+
+ :host([hide-icon_]) #faviconContainer {
+ margin-inline-end: 0;
+ max-width: 0;
+ opacity: 0;
+ /* When transitioning to the hidden state, set opacity immediately to 0
+ * while transitioning the other values normally. */
+ transition: margin var(--tabstrip-tab-transition-duration),
+ max-width var(--tabstrip-tab-transition-duration),
+ opacity 0ms;
+ }
+
+ :host([pinned_]) #faviconContainer {
+ margin: 0;
+ }
+
+ #progressSpinner,
+ #favicon,
+ #crashedIcon {
+ height: var(--favicon-size);
+ left: 50%;
+ position: absolute;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ width: var(--favicon-size);
+ }
+
+ #progressSpinner {
+ -webkit-mask:
+ url(chrome://resources/images/throbber_small.svg)
+ center/contain no-repeat;
+ display: none;
+ }
+
+ #favicon {
+ background-size: contain;
+ transition: border-radius var(--tabstrip-tab-transition-duration);
+ }
+
+ #crashedIcon {
+ -webkit-mask:
+ url(chrome://theme/IDR_CRASH_SAD_FAVICON@2x)
+ center/contain no-repeat;
+ background-color: currentColor;
+ opacity: 0;
+ transform: translate(-50%, 100%);
+ }
+
+ #blocked {
+ background: var(--tabstrip-tab-blocked-color);
+ border: solid 1px var(--tabstrip-tab-background-color);
+ border-radius: 50%;
+ bottom: 0;
+ display: none;
+ height: 6px;
+ position: absolute;
+ right: 0;
+ transform: translate(50%, 50%);
+ width: 6px;
+ }
+
+ :host([waiting_]) #progressSpinner,
+ :host([loading_]) #progressSpinner {
+ display: block;
+ }
+
+ :host([loading_]) #favicon {
+ border-radius: 50%;
+ height: calc(var(--favicon-size) - 6px);
+ overflow: hidden;
+ width: calc(var(--favicon-size) - 6px);
+ }
+
+ :host([waiting_]) #progressSpinner {
+ background-color: var(--tabstrip-tab-waiting-spinning-color);
+ transform: /* Center first, then flip horizontally. */
+ translate(-50%, -50%) scaleX(-1);
+ }
+
+ :host([waiting_]) #favicon {
+ display: none;
+ }
+
+ :host([loading_]) #progressSpinner {
+ background-color: var(--tabstrip-tab-loading-spinning-color);
+ }
+
+ :host([crashed_]) #favicon {
+ opacity: 0;
+ transform: translate(-50%, 100%);
+ transition:
+ opacity var(--tabstrip-tab-transition-duration),
+ transform var(--tabstrip-tab-transition-duration);
+ }
+
+ :host([crashed_]) #crashedIcon {
+ opacity: 1;
+ transform: translate(-50%, -50%);
+ transition:
+ opacity var(--tabstrip-tab-transition-duration),
+ transform var(--tabstrip-tab-transition-duration);
+ /* Wait until transition for #favicon finishes. */
+ transition-delay: var(--tabstrip-tab-transition-duration);
+ }
+
+ :host([blocked_]) #blocked {
+ display: block;
+ }
+
+ :host([active][blocked_]) #blocked {
+ display: none;
}
#titleText {
@@ -48,62 +180,100 @@
align-items: center;
background-color: transparent;
border: 0;
+ color: inherit;
+ cursor: pointer;
display: flex;
flex-shrink: 0;
- height: 32px;
+ height: 100%;
justify-content: center;
margin-inline-start: auto;
padding: 0;
position: relative;
- width: 32px;
+ width: 36px;
}
#closeIcon {
- background:
- url(chrome://resources/images/icon_clear.svg) center/contain no-repeat;
+ -webkit-mask:
+ url(chrome://resources/images/icon_clear.svg)center/contain no-repeat;
+ background-color: currentColor;
display: block;
- height: 24px;
+ height: 18px;
position: relative;
- width: 24px;
+ width: 18px;
}
#thumbnail {
- background: var(--tabstrip-card-background-color);
+ align-items: center;
+ background: var(--tabstrip-tab-background-color);
+ display: flex;
flex: 1;
+ justify-content: center;
}
#thumbnailImg {
- height: 100%;
- object-fit: contain;
+ height: calc(var(--tabstrip-tab-height) - var(--tabstrip-tab-title-height));
+ object-fit: cover;
+ pointer-events: none;
+ width: var(--tabstrip-tab-width);
+ }
+
+ #thumbnailImg:not([src]) {
+ display: none;
+ pointer-events: none;
width: 100%;
}
/* Pinned tab styles */
- :host([pinned]) {
- height: 50px;
- width: 50px;
+ :host([pinned_]) {
+ height: var(--tabstrip-pinned-tab-size);
+ width: var(--tabstrip-pinned-tab-size);
}
- :host([pinned]) #title {
+ :host([pinned_]) #title {
border-block-end: 0;
height: 100%;
}
- :host([pinned]) #titleText,
- :host([pinned]) #close,
- :host([pinned]) #thumbnail {
+ :host([pinned_]) #titleText,
+ :host([pinned_]) #close,
+ :host([pinned_]) #thumbnail {
display: none;
}
+
+ :host([dragging_]) #dragPlaceholder {
+ background: var(--tabstrip-tab-background-color);
+ border-radius: var(--tabstrip-tab-border-radius);
+ height: 100%;
+ opacity: 0.5;
+ width: 100%;
+ }
+
+ /* When being dragged, the contents of the drag image needs to be off-screen
+ * with nothing else on top or below obscuring it. */
+ :host([dragging_]) #dragImage {
+ box-shadow: none;
+ position: absolute;
+ top: -999px;
+ }
</style>
-<header id="title">
- <span id="favicon"></span>
- <h2 id="titleText"></h2>
- <button id="close">
- <span id="closeIcon"></span>
- </button>
-</header>
+<div id="dragPlaceholder"></div>
+
+<div id="dragImage">
+ <header id="title">
+ <div id="faviconContainer">
+ <div id="progressSpinner"></div>
+ <div id="favicon"></div>
+ <div id="crashedIcon"></div>
+ <div id="blocked"></div>
+ </div>
+ <h2 id="titleText"></h2>
+ <button id="close">
+ <span id="closeIcon"></span>
+ </button>
+ </header>
-<div id="thumbnail">
- <img id="thumbnailImg">
+ <div id="thumbnail">
+ <img id="thumbnailImg">
+ </div>
</div>
diff --git a/chromium/chrome/browser/resources/tab_strip/tab.js b/chromium/chrome/browser/resources/tab_strip/tab.js
index 0b16488f0ca..a6908f2018a 100644
--- a/chromium/chrome/browser/resources/tab_strip/tab.js
+++ b/chromium/chrome/browser/resources/tab_strip/tab.js
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import {getFavicon, getFaviconForPageURL} from 'chrome://resources/js/icon.m.js';
+import {assert} from 'chrome://resources/js/assert.m.js';
+import {getFavicon} from 'chrome://resources/js/icon.m.js';
import {CustomElement} from './custom_element.js';
-import {TabsApiProxy} from './tabs_api_proxy.js';
+import {TabStripEmbedderProxy} from './tab_strip_embedder_proxy.js';
+import {TabData, TabNetworkState, TabsApiProxy} from './tabs_api_proxy.js';
export const DEFAULT_ANIMATION_DURATION = 125;
@@ -22,6 +24,11 @@ export class TabElement extends CustomElement {
/** @type {!HTMLElement} */ (this.shadowRoot.querySelector('#close'));
/** @private {!HTMLElement} */
+ this.dragImage_ =
+ /** @type {!HTMLElement} */ (
+ this.shadowRoot.querySelector('#dragImage'));
+
+ /** @private {!HTMLElement} */
this.faviconEl_ =
/** @type {!HTMLElement} */ (this.shadowRoot.querySelector('#favicon'));
@@ -34,54 +41,79 @@ export class TabElement extends CustomElement {
this.thumbnail_ =
/** @type {!Image} */ (this.shadowRoot.querySelector('#thumbnailImg'));
- /** @private {!Tab} */
+ /** @private {!TabData} */
this.tab_;
/** @private {!TabsApiProxy} */
this.tabsApi_ = TabsApiProxy.getInstance();
+ /** @private {!TabStripEmbedderProxy} */
+ this.embedderApi_ = TabStripEmbedderProxy.getInstance();
+
/** @private {!HTMLElement} */
this.titleTextEl_ = /** @type {!HTMLElement} */ (
this.shadowRoot.querySelector('#titleText'));
this.addEventListener('click', this.onClick_.bind(this));
+ this.addEventListener('contextmenu', this.onContextMenu_.bind(this));
this.closeButtonEl_.addEventListener('click', this.onClose_.bind(this));
}
- /** @return {!Tab} */
+ /** @return {!TabData} */
get tab() {
return this.tab_;
}
- /** @param {!Tab} tab */
+ /** @param {!TabData} tab */
set tab(tab) {
+ assert(this.tab_ !== tab);
this.toggleAttribute('active', tab.active);
- this.toggleAttribute('pinned', tab.pinned);
+ this.toggleAttribute('hide-icon_', !tab.showIcon);
+ this.toggleAttribute(
+ 'waiting_',
+ !tab.shouldHideThrobber &&
+ tab.networkState === TabNetworkState.WAITING);
+ this.toggleAttribute(
+ 'loading_',
+ !tab.shouldHideThrobber &&
+ tab.networkState === TabNetworkState.LOADING);
+ this.toggleAttribute('pinned_', tab.pinned);
+ this.toggleAttribute('blocked_', tab.blocked);
+ this.setAttribute('draggable', tab.pinned);
+ this.toggleAttribute('crashed_', tab.crashed);
if (!this.tab_ || this.tab_.title !== tab.title) {
this.titleTextEl_.textContent = tab.title;
}
- if (tab.favIconUrl &&
- (!this.tab_ || this.tab_.favIconUrl !== tab.favIconUrl)) {
- this.faviconEl_.style.backgroundImage = getFavicon(tab.favIconUrl);
- } else if (!this.tab_ || this.tab_.url !== tab.url) {
- this.faviconEl_.style.backgroundImage =
- getFaviconForPageURL(tab.url, false);
+ if (tab.networkState === TabNetworkState.WAITING ||
+ (tab.networkState === TabNetworkState.LOADING &&
+ tab.isDefaultFavicon)) {
+ this.faviconEl_.style.backgroundImage = 'none';
+ } else if (tab.favIconUrl) {
+ this.faviconEl_.style.backgroundImage = `url(${tab.favIconUrl})`;
+ } else {
+ this.faviconEl_.style.backgroundImage = getFavicon('');
}
// Expose the ID to an attribute to allow easy querySelector use
this.setAttribute('data-tab-id', tab.id);
if (!this.tab_ || this.tab_.id !== tab.id) {
- // Request thumbnail updates
- chrome.send('addTrackedTab', [tab.id]);
+ this.tabsApi_.trackThumbnailForTab(tab.id);
}
this.tab_ = Object.freeze(tab);
}
/**
+ * @return {!HTMLElement}
+ */
+ getDragImage() {
+ return this.dragImage_;
+ }
+
+ /**
* @param {string} imgData
*/
updateThumbnail(imgData) {
@@ -95,6 +127,19 @@ export class TabElement extends CustomElement {
}
this.tabsApi_.activateTab(this.tab_.id);
+ this.embedderApi_.closeContainer();
+ }
+
+ /** @private */
+ onContextMenu_(event) {
+ event.preventDefault();
+
+ if (!this.tab_) {
+ return;
+ }
+
+ this.embedderApi_.showTabContextMenu(
+ this.tab_.id, event.clientX, event.clientY);
}
/**
@@ -111,6 +156,13 @@ export class TabElement extends CustomElement {
}
/**
+ * @param {boolean} dragging
+ */
+ setDragging(dragging) {
+ this.toggleAttribute('dragging_', dragging);
+ }
+
+ /**
* @return {!Promise}
*/
slideIn() {
diff --git a/chromium/chrome/browser/resources/tab_strip/tab_list.html b/chromium/chrome/browser/resources/tab_strip/tab_list.html
index 680c562aa68..1b6056cd4d3 100644
--- a/chromium/chrome/browser/resources/tab_strip/tab_list.html
+++ b/chromium/chrome/browser/resources/tab_strip/tab_list.html
@@ -1,36 +1,28 @@
<style>
:host {
+ background: var(--tabstrip-background-color);
+ box-sizing: border-box;
display: flex;
+ min-width: fit-content;
padding: 16px;
- width: fit-content;
+ width: 100%;
}
#pinnedTabsContainer {
+ /* 4 pinned tabs should fit in the same space vertically as 1 unpinned
+ * tab. 30px is subtracted from the height of an unpinned tab as there
+ * are three 10px gaps to separate each of the 4 pinned tabs. */
+ --tabstrip-pinned-tab-size: calc((var(--tabstrip-tab-height) - 30px) / 4);
+
display: grid;
- grid-auto-columns: 50px;
+ grid-auto-columns: var(--tabstrip-pinned-tab-size);
grid-auto-flow: column;
grid-gap: 10px;
- grid-template-rows: repeat(4, 50px);
+ grid-template-rows: repeat(4, var(--tabstrip-pinned-tab-size));
margin-inline-end: 16px;
}
- #pinnedTabsContainer[empty] {
- display: none;
- }
-
- .ghost-pinned-tab {
- background: var(--tabstrip-card-background-color);
- border-radius: var(--tabstrip-card-border-radius);
- box-shadow: var(--tabstrip-elevation-box-shadow);
- opacity: 0.5;
- }
-
- /* The #pinnedTabsContainer can only fit a maximum of 4 pinned tabs. The
- * ghost-pinned-tab elements are meant to add as placeholders if there
- * are not enough actual pinned tabs to fill an entire column. Therefore,
- * all ghost-pinned-tabs after the 4 * nth element should be hidden. */
- .ghost-pinned-tab:nth-child(4n + 1),
- .ghost-pinned-tab:nth-child(4n + 1) ~ .ghost-pinned-tab {
+ #pinnedTabsContainer:empty {
display: none;
}
@@ -43,9 +35,5 @@
}
</style>
-<div id="pinnedTabsContainer" empty>
- <div class="ghost-pinned-tab"></div>
- <div class="ghost-pinned-tab"></div>
- <div class="ghost-pinned-tab"></div>
-</div>
+<div id="pinnedTabsContainer"></div>
<div id="tabsContainer"></div>
diff --git a/chromium/chrome/browser/resources/tab_strip/tab_list.js b/chromium/chrome/browser/resources/tab_strip/tab_list.js
index dd72aec77bd..4d747e65f62 100644
--- a/chromium/chrome/browser/resources/tab_strip/tab_list.js
+++ b/chromium/chrome/browser/resources/tab_strip/tab_list.js
@@ -4,12 +4,29 @@
import './tab.js';
+import {assert} from 'chrome://resources/js/assert.m.js';
import {addWebUIListener} from 'chrome://resources/js/cr.m.js';
+
import {CustomElement} from './custom_element.js';
import {TabElement} from './tab.js';
-import {TabsApiProxy} from './tabs_api_proxy.js';
-
-const GHOST_PINNED_TAB_COUNT = 3;
+import {TabStripEmbedderProxy} from './tab_strip_embedder_proxy.js';
+import {TabData, TabsApiProxy} from './tabs_api_proxy.js';
+
+/**
+ * The amount of padding to leave between the edge of the screen and the active
+ * tab when auto-scrolling. This should leave some room to show the previous or
+ * next tab to afford to users that there more tabs if the user scrolls.
+ * @const {number}
+ */
+const SCROLL_PADDING = 32;
+
+/**
+ * @param {!Element} element
+ * @return {boolean}
+ */
+function isTabElement(element) {
+ return element.tagName === 'TABSTRIP-TAB';
+}
class TabListElement extends CustomElement {
static get template() {
@@ -28,27 +45,45 @@ class TabListElement extends CustomElement {
*/
this.animationPromises = Promise.resolve();
+ /**
+ * The TabElement that is currently being dragged.
+ * @private {!TabElement|undefined}
+ */
+ this.draggedItem_;
+
/** @private {!Element} */
this.pinnedTabsContainerElement_ =
/** @type {!Element} */ (
this.shadowRoot.querySelector('#pinnedTabsContainer'));
+ /** @private {!Element} */
+ this.scrollingParent_ = document.documentElement;
+
+ /** @private {!TabStripEmbedderProxy} */
+ this.tabStripEmbedderProxy_ = TabStripEmbedderProxy.getInstance();
+
/** @private {!TabsApiProxy} */
this.tabsApi_ = TabsApiProxy.getInstance();
- /** @private {!Object} */
- this.tabsApiHandler_ = this.tabsApi_.callbackRouter;
-
/** @private {!Element} */
this.tabsContainerElement_ =
/** @type {!Element} */ (
this.shadowRoot.querySelector('#tabsContainer'));
- /** @private {number} */
- this.windowId_;
+ addWebUIListener('theme-changed', () => this.fetchAndUpdateColors_());
+ this.tabStripEmbedderProxy_.observeThemeChanges();
addWebUIListener(
'tab-thumbnail-updated', this.tabThumbnailUpdated_.bind(this));
+
+ this.addEventListener(
+ 'dragstart', (e) => this.onDragStart_(/** @type {!DragEvent} */ (e)));
+ this.addEventListener(
+ 'dragend', (e) => this.onDragEnd_(/** @type {!DragEvent} */ (e)));
+ this.addEventListener(
+ 'dragover', (e) => this.onDragOver_(/** @type {!DragEvent} */ (e)));
+ document.addEventListener(
+ 'visibilitychange', () => this.moveOrScrollToActiveTab_());
}
/**
@@ -60,33 +95,23 @@ class TabListElement extends CustomElement {
}
connectedCallback() {
- this.tabsApi_.getCurrentWindow().then((currentWindow) => {
- this.windowId_ = currentWindow.id;
-
- // TODO(johntlee): currentWindow.tabs is guaranteed to be defined because
- // `populate: true` is passed in as part of the arguments to the API.
- // Once the closure compiler is able to type `assert` to return a truthy
- // type even when being used with modules, the conditionals should be
- // replaced with `assert` (b/138729777).
- if (currentWindow.tabs) {
- for (const tab of currentWindow.tabs) {
- if (tab) {
- this.onTabCreated_(tab);
- }
- }
- }
-
- this.tabsApiHandler_.onActivated.addListener(
- this.onTabActivated_.bind(this));
- this.tabsApiHandler_.onCreated.addListener(this.onTabCreated_.bind(this));
- this.tabsApiHandler_.onMoved.addListener(this.onTabMoved_.bind(this));
- this.tabsApiHandler_.onRemoved.addListener(this.onTabRemoved_.bind(this));
- this.tabsApiHandler_.onUpdated.addListener(this.onTabUpdated_.bind(this));
+ this.fetchAndUpdateColors_();
+ this.tabsApi_.getTabs().then(tabs => {
+ tabs.forEach(tab => this.onTabCreated_(tab));
+ this.moveOrScrollToActiveTab_();
+
+ addWebUIListener('tab-created', tab => this.onTabCreated_(tab));
+ addWebUIListener(
+ 'tab-moved', (tabId, newIndex) => this.onTabMoved_(tabId, newIndex));
+ addWebUIListener('tab-removed', tabId => this.onTabRemoved_(tabId));
+ addWebUIListener('tab-updated', tab => this.onTabUpdated_(tab));
+ addWebUIListener(
+ 'tab-active-changed', tabId => this.onTabActivated_(tabId));
});
}
/**
- * @param {!Tab} tab
+ * @param {!TabData} tab
* @return {!TabElement}
* @private
*/
@@ -106,6 +131,24 @@ class TabListElement extends CustomElement {
this.shadowRoot.querySelector(`tabstrip-tab[data-tab-id="${tabId}"]`));
}
+ /** @private */
+ fetchAndUpdateColors_() {
+ this.tabStripEmbedderProxy_.getColors().then(colors => {
+ for (const [cssVariable, rgbaValue] of Object.entries(colors)) {
+ this.style.setProperty(cssVariable, rgbaValue);
+ }
+ });
+ }
+
+ /**
+ * @return {?TabElement}
+ * @private
+ */
+ getActiveTab_() {
+ return /** @type {?TabElement} */ (
+ this.shadowRoot.querySelector('tabstrip-tab[active]'));
+ }
+
/**
* @param {!TabElement} tabElement
* @param {number} index
@@ -121,111 +164,207 @@ class TabListElement extends CustomElement {
} else {
// Pinned tabs are in their own container, so the index of non-pinned
// tabs need to be offset by the number of pinned tabs
- const offsetIndex = index -
- (this.pinnedTabsContainerElement_.childElementCount -
- GHOST_PINNED_TAB_COUNT);
+ const offsetIndex =
+ index - this.pinnedTabsContainerElement_.childElementCount;
this.tabsContainerElement_.insertBefore(
tabElement, this.tabsContainerElement_.childNodes[offsetIndex]);
}
+ }
+
+ /** @private */
+ moveOrScrollToActiveTab_() {
+ const activeTab = this.getActiveTab_();
+ if (!activeTab) {
+ return;
+ }
- this.updatePinnedTabsState_();
+ if (!this.tabStripEmbedderProxy_.isVisible() && !activeTab.tab.pinned &&
+ this.tabsContainerElement_.firstChild !== activeTab) {
+ this.tabsApi_.moveTab(
+ activeTab.tab.id, this.pinnedTabsContainerElement_.childElementCount);
+ } else {
+ this.scrollToTab_(activeTab);
+ }
}
/**
- * @param {!TabActivatedInfo} activeInfo
+ * @param {!DragEvent} event
* @private
*/
- onTabActivated_(activeInfo) {
- if (activeInfo.windowId !== this.windowId_) {
+ onDragEnd_(event) {
+ if (!this.draggedItem_) {
return;
}
- const previouslyActiveTab =
- this.shadowRoot.querySelector('tabstrip-tab[active]');
- if (previouslyActiveTab) {
- previouslyActiveTab.tab = /** @type {!Tab} */ (
- Object.assign({}, previouslyActiveTab.tab, {active: false}));
+ this.draggedItem_.setDragging(false);
+ this.draggedItem_ = undefined;
+ }
+
+ /**
+ * @param {!DragEvent} event
+ * @private
+ */
+ onDragOver_(event) {
+ event.preventDefault();
+ const dragOverItem = event.path.find((pathItem) => {
+ return pathItem !== this.draggedItem_ && isTabElement(pathItem);
+ });
+
+ if (!dragOverItem || !this.draggedItem_ || !dragOverItem.tab.pinned) {
+ return;
}
- const newlyActiveTab = this.findTabElement_(activeInfo.tabId);
- newlyActiveTab.tab = /** @type {!Tab} */ (
- Object.assign({}, newlyActiveTab.tab, {active: true}));
+ event.dataTransfer.dropEffect = 'move';
+
+ const dragOverIndex =
+ Array.from(dragOverItem.parentNode.children).indexOf(dragOverItem);
+ this.tabsApi_.moveTab(this.draggedItem_.tab.id, dragOverIndex);
}
/**
- * @param {!Tab} tab
+ * @param {!DragEvent} event
* @private
*/
- onTabCreated_(tab) {
- if (tab.windowId !== this.windowId_) {
+ onDragStart_(event) {
+ const draggedItem = event.path[0];
+ if (!isTabElement(draggedItem)) {
return;
}
- const tabElement = this.createTabElement_(tab);
- this.insertTabOrMoveTo_(tabElement, tab.index);
- this.addAnimationPromise_(tabElement.slideIn());
+ assert(draggedItem.tab.pinned);
+ this.draggedItem_ = /** @type {!TabElement} */ (draggedItem);
+ this.draggedItem_.setDragging(true);
+ event.dataTransfer.effectAllowed = 'move';
+ event.dataTransfer.setDragImage(
+ this.draggedItem_.getDragImage(),
+ event.pageX - this.draggedItem_.offsetLeft,
+ event.pageY - this.draggedItem_.offsetTop);
}
/**
* @param {number} tabId
- * @param {!TabMovedInfo} moveInfo
* @private
*/
- onTabMoved_(tabId, moveInfo) {
- if (moveInfo.windowId !== this.windowId_) {
- return;
+ onTabActivated_(tabId) {
+ // There may be more than 1 TabElement marked as active if other events
+ // have updated a Tab to have an active state. For example, if a
+ // tab is created with an already active state, there may be 2 active
+ // TabElements: the newly created tab and the previously active tab.
+ this.shadowRoot.querySelectorAll('tabstrip-tab[active]')
+ .forEach((previouslyActiveTab) => {
+ if (previouslyActiveTab.tab.id !== tabId) {
+ previouslyActiveTab.tab = /** @type {!TabData} */ (
+ Object.assign({}, previouslyActiveTab.tab, {active: false}));
+ }
+ });
+
+ const newlyActiveTab = this.findTabElement_(tabId);
+ if (newlyActiveTab) {
+ newlyActiveTab.tab = /** @type {!TabData} */ (
+ Object.assign({}, newlyActiveTab.tab, {active: true}));
+ this.moveOrScrollToActiveTab_();
}
+ }
- const movedTab = this.findTabElement_(tabId);
- if (movedTab) {
- this.insertTabOrMoveTo_(movedTab, moveInfo.toIndex);
+ /**
+ * @param {!TabData} tab
+ * @private
+ */
+ onTabCreated_(tab) {
+ const tabElement = this.createTabElement_(tab);
+
+ if (tab.active && !tab.pinned &&
+ tab.index !== this.pinnedTabsContainerElement_.childElementCount) {
+ // Newly created active tabs should first be moved to the very beginning
+ // of the tab strip to enforce the tab strip's most recently used ordering
+ this.tabsApi_
+ .moveTab(tab.id, this.pinnedTabsContainerElement_.childElementCount)
+ .then(() => {
+ this.insertTabOrMoveTo_(
+ tabElement, this.pinnedTabsContainerElement_.childElementCount);
+ this.addAnimationPromise_(tabElement.slideIn());
+ });
+ } else {
+ this.insertTabOrMoveTo_(tabElement, tab.index);
+ this.addAnimationPromise_(tabElement.slideIn());
}
}
/**
* @param {number} tabId
- * @param {!WindowRemoveInfo} removeInfo
+ * @param {number} newIndex
* @private
*/
- onTabRemoved_(tabId, removeInfo) {
- if (removeInfo.windowId !== this.windowId_) {
- return;
+ onTabMoved_(tabId, newIndex) {
+ const movedTab = this.findTabElement_(tabId);
+ if (movedTab) {
+ this.insertTabOrMoveTo_(movedTab, newIndex);
+ if (movedTab.tab.active) {
+ this.scrollToTab_(movedTab);
+ }
}
+ }
+ /**
+ * @param {number} tabId
+ * @private
+ */
+ onTabRemoved_(tabId) {
const tabElement = this.findTabElement_(tabId);
if (tabElement) {
- this.addAnimationPromise_(new Promise(async resolve => {
- await tabElement.slideOut();
- this.updatePinnedTabsState_();
- resolve();
- }));
+ this.addAnimationPromise_(tabElement.slideOut());
}
}
/**
- * @param {number} tabId
- * @param {!Tab} changeInfo
- * @param {!Tab} tab
+ * @param {!TabData} tab
* @private
*/
- onTabUpdated_(tabId, changeInfo, tab) {
- if (tab.windowId !== this.windowId_) {
+ onTabUpdated_(tab) {
+ const tabElement = this.findTabElement_(tab.id);
+ if (!tabElement) {
return;
}
- const tabElement = this.findTabElement_(tabId);
- if (tabElement) {
- tabElement.tab = tab;
+ const previousTab = tabElement.tab;
+ tabElement.tab = tab;
- if (changeInfo.pinned !== undefined) {
- // If the tab is being pinned or unpinned, we need to move it to its new
- // location
- this.insertTabOrMoveTo_(tabElement, tab.index);
+ if (previousTab.pinned !== tab.pinned) {
+ // If the tab is being pinned or unpinned, we need to move it to its new
+ // location
+ this.insertTabOrMoveTo_(tabElement, tab.index);
+ if (tab.active) {
+ this.scrollToTab_(tabElement);
}
}
}
/**
+ * @param {!TabElement} tabElement
+ * @private
+ */
+ scrollToTab_(tabElement) {
+ this.animationPromises.then(() => {
+ const screenLeft = this.scrollingParent_.scrollLeft;
+ const screenRight = screenLeft + this.scrollingParent_.offsetWidth;
+
+ if (screenLeft > tabElement.offsetLeft) {
+ // If the element's left is to the left of the visible screen, scroll
+ // such that the element's left edge is aligned with the screen's edge
+ this.scrollingParent_.scrollLeft =
+ tabElement.offsetLeft - SCROLL_PADDING;
+ } else if (screenRight < tabElement.offsetLeft + tabElement.offsetWidth) {
+ // If the element's right is to the right of the visible screen, scroll
+ // such that the element's right edge is aligned with the screen's right
+ // edge.
+ this.scrollingParent_.scrollLeft = tabElement.offsetLeft +
+ tabElement.offsetWidth - this.scrollingParent_.offsetWidth +
+ SCROLL_PADDING;
+ }
+ });
+ }
+
+ /**
* @param {number} tabId
* @param {string} imgData
* @private
@@ -236,14 +375,6 @@ class TabListElement extends CustomElement {
tab.updateThumbnail(imgData);
}
}
-
- /** @private */
- updatePinnedTabsState_() {
- this.pinnedTabsContainerElement_.toggleAttribute(
- 'empty',
- this.pinnedTabsContainerElement_.childElementCount ===
- GHOST_PINNED_TAB_COUNT);
- }
}
customElements.define('tabstrip-tab-list', TabListElement);
diff --git a/chromium/chrome/browser/resources/tab_strip/tab_strip.html b/chromium/chrome/browser/resources/tab_strip/tab_strip.html
index 088f0ea0097..20b58a70a3c 100644
--- a/chromium/chrome/browser/resources/tab_strip/tab_strip.html
+++ b/chromium/chrome/browser/resources/tab_strip/tab_strip.html
@@ -13,30 +13,15 @@
--google-blue-300-rgb: 138, 180, 248;
--google-blue-500-rgb: 66, 133, 244;
- --tabstrip-background-color: rgb(var(--google-grey-50-rgb));
- --tabstrip-card-background-color: white;
- --tabstrip-card-border-radius: 8px;
- --tabstrip-elevation-box-shadow:
- 0 0 0 1px rgb(var(--google-grey-300-rgb));
- --tabstrip-focus-color: rgb(var(--google-blue-500-rgb));
- --tabstrip-primary-text-color: rgb(var(--google-grey-900-rgb));
- --tabstrip-separator-color: rgb(var(--google-grey-300-rgb));
- }
-
- @media (prefers-color-scheme: dark) {
- html {
- --tabstrip-background-color: rgba(var(--google-grey-900-rgb));
- --tabstrip-card-background-color: rgba(255, 255, 255, 0.04);
- --tabstrip-elevation-box-shadow: none;
- --tabstrip-focus-color: rgb(var(--google-blue-300-rgb));
- --tabstrip-primary-text-color: rgb(var(--google-grey-200-rgb));
- --tabstrip-separator-color: rgb(255, 255, 255, 0.1);
- }
+ --tabstrip-background-color: $i18n{frameColor};
+ --tabstrip-tab-height: 216px;
+ --tabstrip-tab-width: 288px;
+ --tabstrip-tab-border-radius: 8px;
+ --tabstrip-tab-active-border-color: rgb(var(--google-blue-500-rgb));
}
body {
background: var(--tabstrip-background-color);
- color: var(--tabstrip-primary-text-color);
margin: 0;
padding: 0;
}
diff --git a/chromium/chrome/browser/resources/tab_strip/tab_strip_embedder_proxy.js b/chromium/chrome/browser/resources/tab_strip/tab_strip_embedder_proxy.js
new file mode 100644
index 00000000000..6852de8b29f
--- /dev/null
+++ b/chromium/chrome/browser/resources/tab_strip/tab_strip_embedder_proxy.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.
+
+import {addSingletonGetter, addWebUIListener, sendWithPromise} from 'chrome://resources/js/cr.m.js';
+
+export class TabStripEmbedderProxy {
+ /** @return {boolean} */
+ isVisible() {
+ return document.visibilityState === 'visible';
+ }
+
+ /**
+ * @return {!Promise<!Object<string, string>>} Object with CSS variables
+ * as keys and rgba strings as values
+ */
+ getColors() {
+ return sendWithPromise('getThemeColors');
+ }
+
+ observeThemeChanges() {
+ chrome.send('observeThemeChanges');
+ }
+
+ /**
+ * @param {number} tabId
+ * @param {number} locationX
+ * @param {number} locationY
+ */
+ showTabContextMenu(tabId, locationX, locationY) {
+ chrome.send('showTabContextMenu', [tabId, locationX, locationY]);
+ }
+
+ closeContainer() {
+ chrome.send('closeContainer');
+ }
+}
+
+addSingletonGetter(TabStripEmbedderProxy);
diff --git a/chromium/chrome/browser/resources/tab_strip/tab_strip_resources.grd b/chromium/chrome/browser/resources/tab_strip/tab_strip_resources.grd
index 72257fd7930..97074dac942 100644
--- a/chromium/chrome/browser/resources/tab_strip/tab_strip_resources.grd
+++ b/chromium/chrome/browser/resources/tab_strip/tab_strip_resources.grd
@@ -39,6 +39,66 @@
use_base_dir="false"
type="chrome_html"
compress="gzip"/>
+ <structure
+ name="IDR_TAB_STRIP_ALERT_INDICATOR_JS"
+ file="${root_gen_dir}/chrome/browser/resources/tab_strip/alert_indicator.js"
+ use_base_dir="false"
+ type="chrome_html"
+ compress="gzip"/>
+ <structure
+ name="IDR_TAB_STRIP_EMBEDDER_PROXY_JS"
+ file="tab_strip_embedder_proxy.js"
+ type="chrome_html"
+ compress="gzip"/>
</structures>
+
+ <includes>
+ <!-- Alert indicators -->
+ <include
+ name="IDR_TAB_STRIP_PICTURE_IN_PICTURE_ALT_SVG"
+ file="alert_indicators/picture_in_picture_alt.svg"
+ type="BINDATA"
+ compress="gzip" />
+ <include
+ name="IDR_TAB_STRIP_SERIAL_PORT_SVG"
+ file="alert_indicators/serial_port.svg"
+ type="BINDATA"
+ compress="gzip" />
+ <include
+ name="IDR_TAB_STRIP_TAB_AUDIO_MUTING_ROUNDED_SVG"
+ file="alert_indicators/tab_audio_muting_rounded.svg"
+ type="BINDATA"
+ compress="gzip" />
+ <include
+ name="IDR_TAB_STRIP_TAB_AUDIO_ROUNDED_SVG"
+ file="alert_indicators/tab_audio_rounded.svg"
+ type="BINDATA"
+ compress="gzip" />
+ <include
+ name="IDR_TAB_STRIP_TAB_BLUETOOTH_CONNECTED_SVG"
+ file="alert_indicators/tab_bluetooth_connected.svg"
+ type="BINDATA"
+ compress="gzip" />
+ <include
+ name="IDR_TAB_STRIP_TAB_MEDIA_CAPTURING_WITH_ARROW_SVG"
+ file="alert_indicators/tab_media_capturing_with_arrow.svg"
+ type="BINDATA"
+ compress="gzip" />
+ <include
+ name="IDR_TAB_STRIP_TAB_MEDIA_RECORING_SVG"
+ file="alert_indicators/tab_media_recording.svg"
+ type="BINDATA"
+ compress="gzip" />
+ <include
+ name="IDR_TAB_STRIP_TAB_USB_CONNECTED_SVG"
+ file="alert_indicators/tab_usb_connected.svg"
+ type="BINDATA"
+ compress="gzip" />
+ <include
+ name="IDR_TAB_STRIP_VR_HEADSET_SVG"
+ file="alert_indicators/vr_headset.svg"
+ type="BINDATA"
+ compress="gzip" />
+ </includes>
</release>
</grit>
diff --git a/chromium/chrome/browser/resources/tab_strip/tabs_api_proxy.js b/chromium/chrome/browser/resources/tab_strip/tabs_api_proxy.js
index 9ce6ad61f28..34b13b9f75f 100644
--- a/chromium/chrome/browser/resources/tab_strip/tabs_api_proxy.js
+++ b/chromium/chrome/browser/resources/tab_strip/tabs_api_proxy.js
@@ -2,23 +2,46 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import {addSingletonGetter} from 'chrome://resources/js/cr.m.js';
+import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
-export class TabsApiProxy {
- constructor() {
- /** @type {!Object<string, !ChromeEvent>} */
- this.callbackRouter = {
- onActivated: chrome.tabs.onActivated,
- onCreated: chrome.tabs.onCreated,
- onMoved: chrome.tabs.onMoved,
- onRemoved: chrome.tabs.onRemoved,
- onUpdated: chrome.tabs.onUpdated,
- };
- }
+/**
+ * Must be kept in sync with TabNetworkState from
+ * //chrome/browser/ui/tabs/tab_network_state.h.
+ * @enum {number}
+ */
+export const TabNetworkState = {
+ NONE: 0,
+ WAITING: 1,
+ LOADING: 2,
+ ERROR: 3,
+};
+
+/**
+ * @typedef {{
+ * active: boolean,
+ * blocked: boolean,
+ * crashed: boolean,
+ * favIconUrl: (string|undefined),
+ * id: number,
+ * index: number,
+ * isDefaultFavicon: boolean,
+ * networkState: !TabNetworkState,
+ * pinned: boolean,
+ * shouldHideThrobber: boolean,
+ * showIcon: boolean,
+ * title: string,
+ * url: string,
+ * }}
+ */
+export let TabData;
+
+/** @typedef {!Tab} */
+let ExtensionsApiTab;
+export class TabsApiProxy {
/**
* @param {number} tabId
- * @return {!Promise<!Tab>}
+ * @return {!Promise<!ExtensionsApiTab>}
*/
activateTab(tabId) {
return new Promise(resolve => {
@@ -27,18 +50,10 @@ export class TabsApiProxy {
}
/**
- * @return {!Promise<!ChromeWindow>}
+ * @return {!Promise<!Array<!TabData>>}
*/
- getCurrentWindow() {
- const options = {
- populate: true, // populate window data with tabs data
- windowTypes: ['normal'], // prevent devtools from being returned
- };
- return new Promise(resolve => {
- chrome.windows.getCurrent(options, currentWindow => {
- resolve(currentWindow);
- });
- });
+ getTabs() {
+ return sendWithPromise('getTabs');
}
/**
@@ -54,7 +69,7 @@ export class TabsApiProxy {
/**
* @param {number} tabId
* @param {number} newIndex
- * @return {!Promise<!Tab>}
+ * @return {!Promise<!ExtensionsApiTab>}
*/
moveTab(tabId, newIndex) {
return new Promise(resolve => {
@@ -63,6 +78,13 @@ export class TabsApiProxy {
});
});
}
+
+ /**
+ * @param {number} tabId
+ */
+ trackThumbnailForTab(tabId) {
+ chrome.send('addTrackedTab', [tabId]);
+ }
}
addSingletonGetter(TabsApiProxy);
diff --git a/chromium/chrome/browser/resources/tab_strip/types.js b/chromium/chrome/browser/resources/tab_strip/types.js
deleted file mode 100644
index 6496711a0da..00000000000
--- a/chromium/chrome/browser/resources/tab_strip/types.js
+++ /dev/null
@@ -1,32 +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.
-
-/**
- * @fileoverview Closure typedefs for Tab Strip.
- */
-
-/**
- * @typedef {{
- * tabId: number,
- * windowId: number,
- * }}
- */
-let TabActivatedInfo;
-
-/**
- * @typedef {{
- * fromIndex: number,
- * toIndex: number,
- * windowId: number,
- * }}
- */
-let TabMovedInfo;
-
-/**
- * @typedef {{
- * isWindowClosing: boolean,
- * windowId: number,
- * }}
- */
-let WindowRemoveInfo;
diff --git a/chromium/chrome/browser/resources/usb_internals/BUILD.gn b/chromium/chrome/browser/resources/usb_internals/BUILD.gn
index d4d21445df1..d7812aa300e 100644
--- a/chromium/chrome/browser/resources/usb_internals/BUILD.gn
+++ b/chromium/chrome/browser/resources/usb_internals/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/grit/grit_rule.gni")
js_type_check("closure_compile") {
deps = [
@@ -37,3 +38,23 @@ js_library("descriptor_panel") {
"//ui/webui/resources/js:cr",
]
}
+
+grit("resources") {
+ source = "resources.grd"
+
+ # The .grd contains references to generated files.
+ source_is_generated = true
+ outputs = [
+ "grit/usb_internals_resources.h",
+ "usb_internals_resources.pak",
+ ]
+ output_dir = "$root_gen_dir/chrome"
+ depfile_dir = target_gen_dir
+ grit_flags = [
+ "-E",
+ "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
+ ]
+ deps = [
+ "//chrome/browser/ui/webui/usb_internals:mojo_bindings_js",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/usb_internals/resources.grd b/chromium/chrome/browser/resources/usb_internals/resources.grd
new file mode 100644
index 00000000000..48bc89841bd
--- /dev/null
+++ b/chromium/chrome/browser/resources/usb_internals/resources.grd
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="0"
+ current_release="1"
+ output_all_resource_defines="false">
+ <outputs>
+ <output filename="grit/usb_internals_resources.h" type="rc_header">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="usb_internals_resources.pak" type="data_package" />
+ </outputs>
+ <release seq="1">
+ <includes>
+ <include name="IDR_USB_INTERNALS_CSS"
+ file="usb_internals.css"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_USB_INTERNALS_DESCRIPTOR_PANEL_JS"
+ file="descriptor_panel.js"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_USB_INTERNALS_DEVICES_PAGE_JS"
+ file="devices_page.js"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_USB_INTERNALS_HTML"
+ file="usb_internals.html"
+ flattenhtml="true"
+ allowexternalscript="true"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_USB_INTERNALS_JS"
+ file="usb_internals.js"
+ type="BINDATA"
+ compress="gzip" />
+ <include name="IDR_USB_INTERNALS_MOJOM_LITE_JS"
+ file="${root_gen_dir}\chrome\browser\ui\webui\usb_internals\usb_internals.mojom-lite.js"
+ use_base_dir="false"
+ type="BINDATA"
+ compress="gzip" />
+ </includes>
+ </release>
+</grit>
diff --git a/chromium/chrome/browser/resources/user_manager/shared_styles.html b/chromium/chrome/browser/resources/user_manager/shared_styles.html
index 3bc6fc49a49..9d3367b9e81 100644
--- a/chromium/chrome/browser/resources/user_manager/shared_styles.html
+++ b/chromium/chrome/browser/resources/user_manager/shared_styles.html
@@ -39,8 +39,8 @@
@media (prefers-color-scheme: dark) {
.product-logo {
content: -webkit-image-set(
- url(../../../app/theme/default_100_percent/%DISTRIBUTION%/product_logo_white.png) 1x,
- url(../../../app/theme/default_200_percent/%DISTRIBUTION%/product_logo_white.png) 2x);
+ url(../../../../components/resources/default_100_percent/%DISTRIBUTION%/product_logo_white.png) 1x,
+ url(../../../../components/resources/default_200_percent/%DISTRIBUTION%/product_logo_white.png) 2x);
}
}
</style>
diff --git a/chromium/chrome/browser/resources/vr/OWNERS b/chromium/chrome/browser/resources/vr/OWNERS
index 33672fa4bbe..f8d52f36333 100644
--- a/chromium/chrome/browser/resources/vr/OWNERS
+++ b/chromium/chrome/browser/resources/vr/OWNERS
@@ -1,3 +1,5 @@
+alcooper@chromium.org
+bialpio@chromium.org
cjgrant@chromium.org
tiborg@chromium.org
diff --git a/chromium/chrome/browser/resources/webapks/BUILD.gn b/chromium/chrome/browser/resources/webapks/BUILD.gn
index 6e4c0a57cda..2a502903daa 100644
--- a/chromium/chrome/browser/resources/webapks/BUILD.gn
+++ b/chromium/chrome/browser/resources/webapks/BUILD.gn
@@ -12,9 +12,8 @@ js_type_check("closure_compile") {
js_library("about_webapks") {
deps = [
- "//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:load_time_data",
- "//ui/webui/resources/js:util",
+ "//ui/webui/resources/js:cr.m",
+ "//ui/webui/resources/js:util.m",
]
externs_list = [ "$externs_path/chrome_send.js" ]
}
diff --git a/chromium/chrome/browser/resources/webapks/about_webapks.html b/chromium/chrome/browser/resources/webapks/about_webapks.html
index f09ce2c5d08..4e91c526f30 100644
--- a/chromium/chrome/browser/resources/webapks/about_webapks.html
+++ b/chromium/chrome/browser/resources/webapks/about_webapks.html
@@ -11,12 +11,8 @@ about:webapks template page
<title>About WebAPKs</title>
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
<link rel="stylesheet" href="about_webapks.css">
- <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="chrome://webapks/webapks.js"></script>
- <script src="chrome://webapks/strings.js"></script>
+ <script type="module" src="webapks.js"></script>
</head>
<body>
diff --git a/chromium/chrome/browser/resources/webapks/about_webapks.js b/chromium/chrome/browser/resources/webapks/about_webapks.js
index b21be02901e..10bc849c424 100644
--- a/chromium/chrome/browser/resources/webapks/about_webapks.js
+++ b/chromium/chrome/browser/resources/webapks/about_webapks.js
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import './strings.m.js';
+
+import {addWebUIListener} from 'chrome://resources/js/cr.m.js';
+import {$, createElementWithClassName} from 'chrome://resources/js/util.m.js';
+
/**
* @typedef {{
* name: string,
@@ -54,17 +59,6 @@ function createElementWithTextAndClass(text, type, className) {
}
/**
- * Callback from the backend with the information of a WebAPK to display.
- * This will be called once per WebAPK.
- *
- * @param {!WebApkInfo} webApkInfo Object with information about an
- * installed WebAPK.
- */
-function returnWebApkInfo(webApkInfo) {
- addWebApk(webApkInfo);
-}
-
-/**
* @param {HTMLElement} webApkList List of elements which contain WebAPK
* attributes.
* @param {string} label Text that identifies the new element.
@@ -96,7 +90,7 @@ function addWebApkButton(webApkList, text, callback) {
/**
* Adds a new entry to the page with the information of a WebAPK.
*
- * @param {WebApkInfo} webApkInfo Information about an installed WebAPK.
+ * @param {!WebApkInfo} webApkInfo Information about an installed WebAPK.
*/
function addWebApk(webApkInfo) {
/** @type {HTMLElement} */ const webApkList = $('webapk-list');
@@ -160,5 +154,8 @@ function addWebApk(webApkInfo) {
}
document.addEventListener('DOMContentLoaded', function() {
+ // Add a WebUI listener for the 'web-apk-info' event emmitted from the
+ // backend. This will be triggered once per WebAPK.
+ addWebUIListener('web-apk-info', addWebApk);
chrome.send('requestWebApksInfo');
});
diff --git a/chromium/chrome/browser/resources/welcome/BUILD.gn b/chromium/chrome/browser/resources/welcome/BUILD.gn
index ad2a0c5b1a2..f82bd8f077e 100644
--- a/chromium/chrome/browser/resources/welcome/BUILD.gn
+++ b/chromium/chrome/browser/resources/welcome/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/polymer/polymer.gni")
group("closure_compile") {
deps = [
@@ -14,6 +15,11 @@ group("closure_compile") {
}
js_type_check("welcome_files") {
+ is_polymer3 = true
+ closure_flags = default_closure_args + [
+ "js_module_root=../../chrome/browser/resources/welcome/",
+ "js_module_root=./gen/chrome/browser/resources/welcome/",
+ ]
deps = [
":landing_view",
":signin_view",
@@ -26,13 +32,14 @@ js_library("landing_view") {
":landing_view_proxy",
":navigation_behavior",
":welcome_browser_proxy",
- "//ui/webui/resources/js:load_time_data",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/js:load_time_data.m",
]
}
js_library("landing_view_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
externs_list = [ "$externs_path/metrics_private.js" ]
}
@@ -42,19 +49,21 @@ js_library("signin_view") {
":navigation_behavior",
":signin_view_proxy",
":welcome_browser_proxy",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
]
}
js_library("signin_view_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
externs_list = [ "$externs_path/metrics_private.js" ]
}
js_library("navigation_behavior") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/js:assert.m",
]
}
@@ -65,14 +74,45 @@ js_library("welcome_app") {
"./set_as_default/:nux_set_as_default_proxy",
"./shared:bookmark_proxy",
"./shared:nux_types",
- "//ui/webui/resources/cr_elements/cr_view_manager:cr_view_manager",
- "//ui/webui/resources/js:load_time_data",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/cr_elements/cr_view_manager:cr_view_manager.m",
+ "//ui/webui/resources/js:load_time_data.m",
]
}
js_library("welcome_browser_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
externs_list = [ "$externs_path/chrome_send.js" ]
}
+
+polymer_modulizer("welcome_app") {
+ js_file = "welcome_app.js"
+ html_file = "welcome_app.html"
+ html_type = "v3-ready"
+}
+
+polymer_modulizer("landing_view") {
+ js_file = "landing_view.js"
+ html_file = "landing_view.html"
+ html_type = "v3-ready"
+}
+
+polymer_modulizer("signin_view") {
+ js_file = "signin_view.js"
+ html_file = "signin_view.html"
+ html_type = "v3-ready"
+}
+
+group("polymer3_elements") {
+ deps = [
+ ":landing_view_module",
+ ":signin_view_module",
+ ":welcome_app_module",
+ "./google_apps:nux_google_apps_module",
+ "./ntp_background:nux_ntp_background_module",
+ "./set_as_default:nux_set_as_default_module",
+ "./shared:polymer3_elements",
+ ]
+}
diff --git a/chromium/chrome/browser/resources/welcome/google_apps/BUILD.gn b/chromium/chrome/browser/resources/welcome/google_apps/BUILD.gn
index 6566c5e490b..f6f678ed905 100644
--- a/chromium/chrome/browser/resources/welcome/google_apps/BUILD.gn
+++ b/chromium/chrome/browser/resources/welcome/google_apps/BUILD.gn
@@ -3,8 +3,14 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/polymer/polymer.gni")
js_type_check("closure_compile") {
+ closure_flags = default_closure_args + [
+ "js_module_root=../../chrome/browser/resources/welcome/",
+ "js_module_root=gen/chrome/browser/resources/welcome/",
+ ]
+ is_polymer3 = true
deps = [
":google_app_proxy",
":google_apps_metrics_proxy",
@@ -20,16 +26,17 @@ js_library("nux_google_apps") {
"../shared:bookmark_proxy",
"../shared:nux_types",
"../shared:step_indicator",
- "//third_party/polymer/v1_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer-extracted",
- "//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:i18n_behavior",
- "//ui/webui/resources/js:util",
+ "//third_party/polymer/v3_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/js:cr.m",
+ "//ui/webui/resources/js:i18n_behavior.m",
+ "//ui/webui/resources/js:util.m",
]
}
js_library("google_app_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
externs_list = [ "$externs_path/chrome_send.js" ]
}
@@ -39,3 +46,9 @@ js_library("google_apps_metrics_proxy") {
"../shared:module_metrics_proxy",
]
}
+
+polymer_modulizer("nux_google_apps") {
+ js_file = "nux_google_apps.js"
+ html_file = "nux_google_apps.html"
+ html_type = "v3-ready"
+}
diff --git a/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.html b/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.html
deleted file mode 100644
index 3c50ce8ea88..00000000000
--- a/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="google_app_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js b/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js
index b4edc677e8a..63d890d8cf6 100644
--- a/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js
@@ -2,69 +2,65 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
+import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
+import {BookmarkListItem} from '../shared/nux_types.js';
+
+/**
+ * NuxGoogleAppsSelections enum.
+ * These values are persisted to logs and should not be renumbered or
+ * re-used.
+ * See tools/metrics/histograms/enums.xml.
+ * @enum {number}
+ */
+const NuxGoogleAppsSelections = {
+ GMAIL_DEPRECATED: 0,
+ YOU_TUBE: 1,
+ MAPS: 2,
+ TRANSLATE: 3,
+ NEWS: 4,
+ CHROME_WEB_STORE: 5,
+};
+
+/** @interface */
+export class GoogleAppProxy {
/**
- * NuxGoogleAppsSelections enum.
- * These values are persisted to logs and should not be renumbered or
- * re-used.
- * See tools/metrics/histograms/enums.xml.
- * @enum {number}
+ * Google app IDs are local to the list of Google apps, so their icon must
+ * be cached by the handler that provided the IDs.
+ * @param {number} appId
*/
- const NuxGoogleAppsSelections = {
- GMAIL_DEPRECATED: 0,
- YOU_TUBE: 1,
- MAPS: 2,
- TRANSLATE: 3,
- NEWS: 4,
- CHROME_WEB_STORE: 5,
- };
+ cacheBookmarkIcon(appId) {}
- /** @interface */
- class GoogleAppProxy {
- /**
- * Google app IDs are local to the list of Google apps, so their icon must
- * be cached by the handler that provided the IDs.
- * @param {number} appId
- */
- cacheBookmarkIcon(appId) {}
+ /**
+ * Returns a promise for an array of Google apps.
+ * @return {!Promise<!Array<!BookmarkListItem>>}
+ */
+ getAppList() {}
- /**
- * Returns a promise for an array of Google apps.
- * @return {!Promise<!Array<!welcome.BookmarkListItem>>}
- */
- getAppList() {}
+ /**
+ * @param {number} providerId This should match one of the histogram enum
+ * value for NuxGoogleAppsSelections.
+ */
+ recordProviderSelected(providerId) {}
+}
- /**
- * @param {number} providerId This should match one of the histogram enum
- * value for NuxGoogleAppsSelections.
- */
- recordProviderSelected(providerId) {}
+/** @implements {GoogleAppProxy} */
+export class GoogleAppProxyImpl {
+ /** @override */
+ cacheBookmarkIcon(appId) {
+ chrome.send('cacheGoogleAppIcon', [appId]);
}
- /** @implements {welcome.GoogleAppProxy} */
- class GoogleAppProxyImpl {
- /** @override */
- cacheBookmarkIcon(appId) {
- chrome.send('cacheGoogleAppIcon', [appId]);
- }
-
- /** @override */
- getAppList() {
- return cr.sendWithPromise('getGoogleAppsList');
- }
-
- /** @override */
- recordProviderSelected(providerId) {
- chrome.metricsPrivate.recordEnumerationValue(
- 'FirstRun.NewUserExperience.GoogleAppsSelection', providerId,
- Object.keys(NuxGoogleAppsSelections).length);
- }
+ /** @override */
+ getAppList() {
+ return sendWithPromise('getGoogleAppsList');
}
- cr.addSingletonGetter(GoogleAppProxyImpl);
+ /** @override */
+ recordProviderSelected(providerId) {
+ chrome.metricsPrivate.recordEnumerationValue(
+ 'FirstRun.NewUserExperience.GoogleAppsSelection', providerId,
+ Object.keys(NuxGoogleAppsSelections).length);
+ }
+}
- return {
- GoogleAppProxy: GoogleAppProxy,
- GoogleAppProxyImpl: GoogleAppProxyImpl,
- };
-});
+addSingletonGetter(GoogleAppProxyImpl);
diff --git a/chromium/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.html b/chromium/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.html
deleted file mode 100644
index 222483c7329..00000000000
--- a/chromium/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<link rel="import" href="../shared/module_metrics_proxy.html">
-<script src="google_apps_metrics_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.js b/chromium/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.js
index 77886462fcd..529d4d63222 100644
--- a/chromium/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/google_apps/google_apps_metrics_proxy.js
@@ -2,18 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
- class GoogleAppsMetricsProxyImpl extends welcome.ModuleMetricsProxyImpl {
- constructor() {
- super(
- 'FirstRun.NewUserExperience.GoogleAppsInteraction',
- welcome.NuxGoogleAppsInteractions);
- }
- }
+import {addSingletonGetter} from 'chrome://resources/js/cr.m.js';
+import {ModuleMetricsProxyImpl, NuxGoogleAppsInteractions} from '../shared/module_metrics_proxy.js';
- cr.addSingletonGetter(GoogleAppsMetricsProxyImpl);
+export class GoogleAppsMetricsProxyImpl extends ModuleMetricsProxyImpl {
+ constructor() {
+ super(
+ 'FirstRun.NewUserExperience.GoogleAppsInteraction',
+ NuxGoogleAppsInteractions);
+ }
+}
- return {
- GoogleAppsMetricsProxyImpl: GoogleAppsMetricsProxyImpl,
- };
-});
+addSingletonGetter(GoogleAppsMetricsProxyImpl);
diff --git a/chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.html b/chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.html
index fd03465f37a..c5f78a599b2 100644
--- a/chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.html
+++ b/chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.html
@@ -1,214 +1,190 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_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.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/polymer/v1_0/iron-a11y-announcer/iron-a11y-announcer.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-<link rel="import" href="../navigation_behavior.html">
-<link rel="import" href="../shared/animations_css.html">
-<link rel="import" href="../shared/bookmark_proxy.html">
-<link rel="import" href="../shared/chooser_shared_css.html">
-<link rel="import" href="../shared/i18n_setup.html">
-<link rel="import" href="../shared/step_indicator.html">
-<link rel="import" href="google_app_proxy.html">
-<link rel="import" href="google_apps_metrics_proxy.html">
-
-<dom-module id="nux-google-apps">
- <template>
- <style include="animations chooser-shared-css">
- .apps-ask {
- text-align: center;
- }
-
- .chrome-logo {
- content: url(../images/module_icons/google_light.svg);
- height: 38px;
- margin: auto;
- margin-bottom: 16px;
- width: 42px;
- }
-
- @media (prefers-color-scheme: dark) {
- .chrome-logo {
- content: url(../images/module_icons/google_dark.svg);
- }
- }
-
- h1 {
- color: var(--cr-primary-text-color);
- font-size: 1.5rem;
- font-weight: 500;
- margin: 0;
- margin-bottom: 48px;
- outline: none;
- }
-
- #appChooser {
- 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://theme/IDS_WELCOME_GMAIL@1x) 1x,
- url(chrome://theme/IDS_WELCOME_GMAIL@2x) 2x);
- }
-
- .youtube {
- content: -webkit-image-set(
- url(chrome://theme/IDS_WELCOME_YOUTUBE@1x) 1x,
- url(chrome://theme/IDS_WELCOME_YOUTUBE@2x) 2x);
- }
-
- .maps {
- content: -webkit-image-set(
- url(chrome://theme/IDS_WELCOME_MAPS@1x) 1x,
- url(chrome://theme/IDS_WELCOME_MAPS@2x) 2x);
- }
-
- .translate {
- content: -webkit-image-set(
- url(chrome://theme/IDS_WELCOME_TRANSLATE@1x) 1x,
- url(chrome://theme/IDS_WELCOME_TRANSLATE@2x) 2x);
- }
-
- .news {
- content: -webkit-image-set(
- url(chrome://theme/IDS_WELCOME_NEWS@1x) 1x,
- url(chrome://theme/IDS_WELCOME_NEWS@2x) 2x);
- }
-
- .search {
- content: -webkit-image-set(
- url(chrome://theme/IDS_WELCOME_SEARCH@1x) 1x,
- url(chrome://theme/IDS_WELCOME_SEARCH@2x) 2x);
- }
- </style>
- <div class="apps-ask">
- <div class="chrome-logo" alt=""></div>
- <h1 tabindex="-1">$i18n{googleAppsDescription}</h1>
- <div id="appChooser">
- <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">
- <cr-button id="noThanksButton" on-click="onNoThanksClicked_">
- $i18n{skip}
- </cr-button>
- <step-indicator model="[[indicatorModel]]"></step-indicator>
- <cr-button class="action-button" disabled$="[[!hasAppsSelected_]]"
- on-click="onGetStartedClicked_">
- $i18n{next}
- <iron-icon icon="cr:chevron-right"></iron-icon>
- </cr-button>
- </div>
- </div>
+<style include="animations chooser-shared-css">
+ .apps-ask {
+ text-align: center;
+ }
+
+ .chrome-logo {
+ content: url(../images/module_icons/google_light.svg);
+ height: 38px;
+ margin: auto;
+ margin-bottom: 16px;
+ width: 42px;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ .chrome-logo {
+ content: url(../images/module_icons/google_dark.svg);
+ }
+ }
+
+ h1 {
+ color: var(--cr-primary-text-color);
+ font-size: 1.5rem;
+ font-weight: 500;
+ margin: 0;
+ margin-bottom: 48px;
+ outline: none;
+ }
+
+ #appChooser {
+ 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://theme/IDS_WELCOME_GMAIL@1x) 1x,
+ url(chrome://theme/IDS_WELCOME_GMAIL@2x) 2x);
+ }
+
+ .youtube {
+ content: -webkit-image-set(
+ url(chrome://theme/IDS_WELCOME_YOUTUBE@1x) 1x,
+ url(chrome://theme/IDS_WELCOME_YOUTUBE@2x) 2x);
+ }
+
+ .maps {
+ content: -webkit-image-set(
+ url(chrome://theme/IDS_WELCOME_MAPS@1x) 1x,
+ url(chrome://theme/IDS_WELCOME_MAPS@2x) 2x);
+ }
+
+ .translate {
+ content: -webkit-image-set(
+ url(chrome://theme/IDS_WELCOME_TRANSLATE@1x) 1x,
+ url(chrome://theme/IDS_WELCOME_TRANSLATE@2x) 2x);
+ }
+
+ .news {
+ content: -webkit-image-set(
+ url(chrome://theme/IDS_WELCOME_NEWS@1x) 1x,
+ url(chrome://theme/IDS_WELCOME_NEWS@2x) 2x);
+ }
+
+ .search {
+ content: -webkit-image-set(
+ url(chrome://theme/IDS_WELCOME_SEARCH@1x) 1x,
+ url(chrome://theme/IDS_WELCOME_SEARCH@2x) 2x);
+ }
+</style>
+<div class="apps-ask">
+ <div class="chrome-logo" alt=""></div>
+ <h1 tabindex="-1">$i18n{googleAppsDescription}</h1>
+ <div id="appChooser">
+ <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>
- </template>
- <script src="nux_google_apps.js"></script>
-</dom-module>
+
+ <div class="button-bar">
+ <cr-button id="noThanksButton" on-click="onNoThanksClicked_">
+ $i18n{skip}
+ </cr-button>
+ <step-indicator model="[[indicatorModel]]"></step-indicator>
+ <cr-button class="action-button" disabled$="[[!hasAppsSelected_]]"
+ on-click="onGetStartedClicked_">
+ $i18n{next}
+ <iron-icon icon="cr:chevron-right"></iron-icon>
+ </cr-button>
+ </div>
+ </div>
+</div>
diff --git a/chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.js b/chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.js
index 8452574c807..fd25a48c78f 100644
--- a/chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.js
+++ b/chromium/chrome/browser/resources/welcome/google_apps/nux_google_apps.js
@@ -2,7 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.exportPath('welcome');
+import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
+import 'chrome://resources/cr_elements/icons.m.js';
+import 'chrome://resources/cr_elements/shared_vars_css.m.js';
+import 'chrome://resources/js/cr.m.js';
+import 'chrome://resources/js/util.m.js';
+import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
+import '../shared/animations_css.js';
+import '../shared/chooser_shared_css.js';
+import '../shared/step_indicator.js';
+import '../strings.m.js';
+
+import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
+import {isRTL} from 'chrome://resources/js/util.m.js';
+import {IronA11yAnnouncer} from 'chrome://resources/polymer/v3_0/iron-a11y-announcer/iron-a11y-announcer.js';
+import {afterNextRender, html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {navigateTo, navigateToNextStep, NavigationBehavior, Routes} from '../navigation_behavior.js';
+import {BookmarkBarManager, BookmarkProxy, BookmarkProxyImpl} from '../shared/bookmark_proxy.js';
+import {ModuleMetricsManager} from '../shared/module_metrics_proxy.js';
+import {BookmarkListItem, stepIndicatorModel} from '../shared/nux_types.js';
+
+import {GoogleAppProxy, GoogleAppProxyImpl} from './google_app_proxy.js';
+import {GoogleAppsMetricsProxyImpl} from './google_apps_metrics_proxy.js';
/**
* @typedef {{
@@ -14,29 +36,31 @@ cr.exportPath('welcome');
* selected: boolean,
* }}
*/
-welcome.AppItem;
+let AppItem;
/**
* @typedef {{
- * item: !welcome.AppItem,
+ * item: !AppItem,
* set: function(string, boolean):void
* }}
*/
-welcome.AppItemModel;
+let AppItemModel;
const KEYBOARD_FOCUSED = 'keyboard-focused';
Polymer({
is: 'nux-google-apps',
- behaviors: [welcome.NavigationBehavior, I18nBehavior],
+ _template: html`{__html_template__}`,
+
+ behaviors: [NavigationBehavior, I18nBehavior],
properties: {
- /** @type {welcome.stepIndicatorModel} */
+ /** @type {stepIndicatorModel} */
indicatorModel: Object,
/**
- * @type {!Array<!welcome.AppItem>}
+ * @type {!Array<!AppItem>}
* @private
*/
appList_: Array,
@@ -48,19 +72,19 @@ Polymer({
},
},
- /** @private {welcome.GoogleAppProxy} */
+ /** @private {GoogleAppProxy} */
appProxy_: null,
- /** @private {?welcome.ModuleMetricsManager} */
+ /** @private {?ModuleMetricsManager} */
metricsManager_: null,
- /** @private */
+ /** @private {boolean} */
finalized_: false,
- /** @private {welcome.BookmarkProxy} */
+ /** @private {BookmarkProxy} */
bookmarkProxy_: null,
- /** @private {welcome.BookmarkBarManager} */
+ /** @private {BookmarkBarManager} */
bookmarkBarManager_: null,
/** @private {boolean} */
@@ -68,18 +92,16 @@ Polymer({
/** @override */
ready: function() {
- this.appProxy_ = welcome.GoogleAppProxyImpl.getInstance();
- this.metricsManager_ = new welcome.ModuleMetricsManager(
- welcome.GoogleAppsMetricsProxyImpl.getInstance());
- this.bookmarkProxy_ = welcome.BookmarkProxyImpl.getInstance();
- this.bookmarkBarManager_ = welcome.BookmarkBarManager.getInstance();
+ this.appProxy_ = GoogleAppProxyImpl.getInstance();
+ this.metricsManager_ = new ModuleMetricsManager(
+ GoogleAppsMetricsProxyImpl.getInstance());
+ this.bookmarkProxy_ = BookmarkProxyImpl.getInstance();
+ this.bookmarkBarManager_ = BookmarkBarManager.getInstance();
},
/** @override */
attached: function() {
- Polymer.RenderStatus.afterNextRender(this, () => {
- Polymer.IronA11yAnnouncer.requestAvailability();
- });
+ afterNextRender(this, () => IronA11yAnnouncer.requestAvailability());
},
onRouteEnter: function() {
@@ -164,7 +186,7 @@ Polymer({
/**
* Handle toggling the apps selected.
- * @param {!{model: !welcome.AppItemModel}} e
+ * @param {!{model: !AppItemModel}} e
* @private
*/
onAppClick_: function(e) {
@@ -214,14 +236,14 @@ Polymer({
}
});
this.metricsManager_.recordGetStarted();
- welcome.navigateToNextStep();
+ navigateToNextStep();
},
/** @private */
onNoThanksClicked_: function() {
this.cleanUp_();
this.metricsManager_.recordNoThanks();
- welcome.navigateToNextStep();
+ navigateToNextStep();
},
/**
@@ -235,7 +257,7 @@ Polymer({
this.appList_.forEach(app => this.updateBookmark_(app));
} else {
this.appProxy_.getAppList().then(list => {
- this.appList_ = /** @type(!Array<!welcome.AppItem>) */ (list);
+ this.appList_ = /** @type(!Array<!AppItem>) */ (list);
this.appList_.forEach((app, index) => {
// Default select first few items.
app.selected = index < 3;
@@ -248,7 +270,7 @@ Polymer({
},
/**
- * @param {!welcome.AppItem} item
+ * @param {!AppItem} item
* @private
*/
updateBookmark_: function(item) {
diff --git a/chromium/chrome/browser/resources/welcome/landing_view.html b/chromium/chrome/browser/resources/welcome/landing_view.html
index 2ae537dc474..3446ebd2092 100644
--- a/chromium/chrome/browser/resources/welcome/landing_view.html
+++ b/chromium/chrome/browser/resources/welcome/landing_view.html
@@ -1,43 +1,26 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<style include="animations action-link-style splash-pages-shared-css">
+ onboarding-background {
+ --animation-delay: 275ms;
+ }
-<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
-<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">
+ h1 {
+ outline: none;
+ }
-<dom-module id="landing-view">
- <template>
- <style include="animations action-link-style splash-pages-shared-css">
- onboarding-background {
- --animation-delay: 275ms;
- }
-
- h1 {
- outline: none;
- }
-
- .action-button,
- .action-link {
- --animation-delay: 150ms;
- }
- </style>
- <div id="container">
- <onboarding-background class="fade-in"></onboarding-background>
- <h2 class="fade-in">$i18n{landingDescription}</h2>
- <h1 class="fade-in" tabindex="-1">$i18n{landingTitle}</h1>
- <cr-button class="action-button fade-in" on-click="onNewUserClick_">
- $i18n{landingNewUser}
- </cr-button>
- <button class="action-link fade-in" on-click="onExistingUserClick_">
- <span hidden$="[[!signinAllowed_]]">$i18n{landingExistingUser}</span>
- <span hidden$="[[signinAllowed_]]">$i18n{skip}</span>
- </button>
- </div>
- </template>
- <script src="landing_view.js"></script>
-</dom-module>
+ .action-button,
+ .action-link {
+ --animation-delay: 150ms;
+ }
+</style>
+<div id="container">
+ <onboarding-background class="fade-in"></onboarding-background>
+ <h2 class="fade-in">$i18n{landingDescription}</h2>
+ <h1 class="fade-in" tabindex="-1">$i18n{landingTitle}</h1>
+ <cr-button class="action-button fade-in" on-click="onNewUserClick_">
+ $i18n{landingNewUser}
+ </cr-button>
+ <button class="action-link fade-in" on-click="onExistingUserClick_">
+ <span hidden$="[[!signinAllowed_]]">$i18n{landingExistingUser}</span>
+ <span hidden$="[[signinAllowed_]]">$i18n{skip}</span>
+ </button>
+</div>
diff --git a/chromium/chrome/browser/resources/welcome/landing_view.js b/chromium/chrome/browser/resources/welcome/landing_view.js
index 94f6d4ad5e7..785bb5ea99a 100644
--- a/chromium/chrome/browser/resources/welcome/landing_view.js
+++ b/chromium/chrome/browser/resources/welcome/landing_view.js
@@ -2,10 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
+import 'chrome://resources/polymer/v3_0/paper-styles/color.js';
+import './shared/action_link_style_css.js';
+import './shared/onboarding_background.js';
+import './shared/splash_pages_shared_css.js';
+import '../strings.m.js';
+
+import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {LandingViewProxy, LandingViewProxyImpl} from './landing_view_proxy.js';
+import {navigateTo, navigateToNextStep, NavigationBehavior, Routes} from './navigation_behavior.js';
+import {WelcomeBrowserProxyImpl} from './welcome_browser_proxy.js';
+
Polymer({
is: 'landing-view',
- behaviors: [welcome.NavigationBehavior],
+ _template: html`{__html_template__}`,
+
+ behaviors: [NavigationBehavior],
properties: {
/** @private */
@@ -15,7 +31,7 @@ Polymer({
}
},
- /** @private {?welcome.LandingViewProxy} */
+ /** @private {?LandingViewProxy} */
landingViewProxy_: null,
/** @private {boolean} */
@@ -23,7 +39,7 @@ Polymer({
/** @override */
ready() {
- this.landingViewProxy_ = welcome.LandingViewProxyImpl.getInstance();
+ this.landingViewProxy_ = LandingViewProxyImpl.getInstance();
},
onRouteEnter: function() {
@@ -45,10 +61,10 @@ Polymer({
this.finalized_ = true;
this.landingViewProxy_.recordExistingUser();
if (this.signinAllowed_) {
- welcome.WelcomeBrowserProxyImpl.getInstance().handleActivateSignIn(
+ WelcomeBrowserProxyImpl.getInstance().handleActivateSignIn(
'chrome://welcome/returning-user');
} else {
- welcome.navigateTo(welcome.Routes.RETURNING_USER, 1);
+ navigateTo(Routes.RETURNING_USER, 1);
}
},
@@ -56,6 +72,6 @@ Polymer({
onNewUserClick_: function() {
this.finalized_ = true;
this.landingViewProxy_.recordNewUser();
- welcome.navigateTo(welcome.Routes.NEW_USER, 1);
+ navigateTo(Routes.NEW_USER, 1);
}
});
diff --git a/chromium/chrome/browser/resources/welcome/landing_view_proxy.html b/chromium/chrome/browser/resources/welcome/landing_view_proxy.html
deleted file mode 100644
index 84eb5be238e..00000000000
--- a/chromium/chrome/browser/resources/welcome/landing_view_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="landing_view_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/landing_view_proxy.js b/chromium/chrome/browser/resources/welcome/landing_view_proxy.js
index 1ccfbec4ef1..99e9819839e 100644
--- a/chromium/chrome/browser/resources/welcome/landing_view_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/landing_view_proxy.js
@@ -2,74 +2,69 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
- const NUX_LANDING_PAGE_INTERACTION_METRIC_NAME =
- 'FirstRun.NewUserExperience.LandingPageInteraction';
+import {addSingletonGetter} from 'chrome://resources/js/cr.m.js';
- /**
- * NuxLandingPageInteractions enum.
- * These values are persisted to logs and should not be renumbered or re-used.
- * See tools/metrics/histograms/enums.xml.
- * @enum {number}
- */
- const NuxLandingPageInteractions = {
- PageShown: 0,
- NavigatedAway: 1,
- NewUser: 2,
- ExistingUser: 3,
- };
+const NUX_LANDING_PAGE_INTERACTION_METRIC_NAME =
+ 'FirstRun.NewUserExperience.LandingPageInteraction';
- const NUX_LANDING_PAGE_INTERACTIONS_COUNT =
- Object.keys(NuxLandingPageInteractions).length;
+/**
+ * NuxLandingPageInteractions enum.
+ * These values are persisted to logs and should not be renumbered or re-used.
+ * See tools/metrics/histograms/enums.xml.
+ * @enum {number}
+ */
+const NuxLandingPageInteractions = {
+ PageShown: 0,
+ NavigatedAway: 1,
+ NewUser: 2,
+ ExistingUser: 3,
+};
- /** @interface */
- class LandingViewProxy {
- recordPageShown() {}
+const NUX_LANDING_PAGE_INTERACTIONS_COUNT =
+ Object.keys(NuxLandingPageInteractions).length;
- recordNavigatedAway() {}
+/** @interface */
+export class LandingViewProxy {
+ recordPageShown() {}
- recordNewUser() {}
+ recordNavigatedAway() {}
- recordExistingUser() {}
- }
+ recordNewUser() {}
- /** @implements {welcome.LandingViewProxy} */
- class LandingViewProxyImpl {
- /** @override */
- recordPageShown() {
- this.recordInteraction_(NuxLandingPageInteractions.PageShown);
- }
+ recordExistingUser() {}
+}
- /** @override */
- recordNavigatedAway() {
- this.recordInteraction_(NuxLandingPageInteractions.NavigatedAway);
- }
+/** @implements {LandingViewProxy} */
+export class LandingViewProxyImpl {
+ /** @override */
+ recordPageShown() {
+ this.recordInteraction_(NuxLandingPageInteractions.PageShown);
+ }
- /** @override */
- recordNewUser() {
- this.recordInteraction_(NuxLandingPageInteractions.NewUser);
- }
+ /** @override */
+ recordNavigatedAway() {
+ this.recordInteraction_(NuxLandingPageInteractions.NavigatedAway);
+ }
- /** @override */
- recordExistingUser() {
- this.recordInteraction_(NuxLandingPageInteractions.ExistingUser);
- }
+ /** @override */
+ recordNewUser() {
+ this.recordInteraction_(NuxLandingPageInteractions.NewUser);
+ }
- /**
- * @param {number} interaction
- * @private
- */
- recordInteraction_(interaction) {
- chrome.metricsPrivate.recordEnumerationValue(
- NUX_LANDING_PAGE_INTERACTION_METRIC_NAME, interaction,
- NUX_LANDING_PAGE_INTERACTIONS_COUNT);
- }
+ /** @override */
+ recordExistingUser() {
+ this.recordInteraction_(NuxLandingPageInteractions.ExistingUser);
}
- cr.addSingletonGetter(LandingViewProxyImpl);
+ /**
+ * @param {number} interaction
+ * @private
+ */
+ recordInteraction_(interaction) {
+ chrome.metricsPrivate.recordEnumerationValue(
+ NUX_LANDING_PAGE_INTERACTION_METRIC_NAME, interaction,
+ NUX_LANDING_PAGE_INTERACTIONS_COUNT);
+ }
+}
- return {
- LandingViewProxy: LandingViewProxy,
- LandingViewProxyImpl: LandingViewProxyImpl,
- };
-});
+addSingletonGetter(LandingViewProxyImpl);
diff --git a/chromium/chrome/browser/resources/welcome/navigation_behavior.html b/chromium/chrome/browser/resources/welcome/navigation_behavior.html
deleted file mode 100644
index 1488b4d3f79..00000000000
--- a/chromium/chrome/browser/resources/welcome/navigation_behavior.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<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">
-
-<script src="navigation_behavior.js"></script> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/navigation_behavior.js b/chromium/chrome/browser/resources/welcome/navigation_behavior.js
index 5e10ba646d0..c2c9445216d 100644
--- a/chromium/chrome/browser/resources/welcome/navigation_behavior.js
+++ b/chromium/chrome/browser/resources/welcome/navigation_behavior.js
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import {assert} from 'chrome://resources/js/assert.m.js';
+import {afterNextRender} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
/**
* @fileoverview The NavigationBehavior is in charge of manipulating and
* watching window.history.state changes. The page is using the history
@@ -12,183 +15,172 @@
* or popping history state without actually changing the path.
*/
-cr.define('welcome', function() {
- 'use strict';
+/**
+ * Valid route pathnames.
+ * @enum {string}
+ */
+export const Routes = {
+ LANDING: 'landing',
+ NEW_USER: 'new-user',
+ RETURNING_USER: 'returning-user',
+};
- /**
- * Valid route pathnames.
- * @enum {string}
- */
- const Routes = {
- LANDING: 'landing',
- NEW_USER: 'new-user',
- RETURNING_USER: 'returning-user',
- };
+/**
+ * Regular expression that captures the leading slash, the content and the
+ * trailing slash in three different groups.
+ * @const {!RegExp}
+ */
+const CANONICAL_PATH_REGEX = /(^\/)([\/-\w]+)(\/$)/;
+const path = location.pathname.replace(CANONICAL_PATH_REGEX, '$1$2');
+
+// Sets up history state based on the url path, unless it's already set (e.g.
+// when user uses browser-back button to get back on chrome://welcome/...).
+if (!history.state || !history.state.route || !history.state.step) {
+ switch (path) {
+ case `/${Routes.NEW_USER}`:
+ history.replaceState({route: Routes.NEW_USER, step: 1}, '', path);
+ break;
+ case `/${Routes.RETURNING_USER}`:
+ history.replaceState({route: Routes.RETURNING_USER, step: 1}, '', path);
+ break;
+ default:
+ history.replaceState(
+ {route: Routes.LANDING, step: Routes.LANDING}, '', '/');
+ }
+}
- /**
- * Regular expression that captures the leading slash, the content and the
- * trailing slash in three different groups.
- * @const {!RegExp}
- */
- const CANONICAL_PATH_REGEX = /(^\/)([\/-\w]+)(\/$)/;
- const path = location.pathname.replace(CANONICAL_PATH_REGEX, '$1$2');
-
- // Sets up history state based on the url path, unless it's already set (e.g.
- // when user uses browser-back button to get back on chrome://welcome/...).
- if (!history.state || !history.state.route || !history.state.step) {
- switch (path) {
- case `/${Routes.NEW_USER}`:
- history.replaceState({route: Routes.NEW_USER, step: 1}, '', path);
- break;
- case `/${Routes.RETURNING_USER}`:
- history.replaceState({route: Routes.RETURNING_USER, step: 1}, '', path);
- break;
- default:
- history.replaceState(
- {route: Routes.LANDING, step: Routes.LANDING}, '', '/');
+/** @type {!Set<!PolymerElement>} */
+const routeObservers = new Set();
+
+/** @type {?PolymerElement} */
+let currentRouteElement;
+
+// Notifies all the elements that extended NavigationBehavior.
+function notifyObservers() {
+ if (currentRouteElement) {
+ (/** @type {{onRouteExit: Function}} */ (currentRouteElement))
+ .onRouteExit();
+ currentRouteElement = null;
+ }
+
+ const route = /** @type {!Routes} */ (history.state.route);
+ const step = history.state.step;
+ routeObservers.forEach(observer => {
+ (/** @type {{onRouteChange: Function}} */ (observer))
+ .onRouteChange(route, step);
+
+ // Modules are only attached to DOM if they're for the current route, so
+ // as long as the id of an element matches up to the current step, it
+ // means that element is for the current route.
+ if (observer.id == `step-${step}`) {
+ currentRouteElement = observer;
}
+ });
+
+ // If currentRouteElement is not null, it means there was a new route.
+ if (currentRouteElement) {
+ (/** @type {{onRouteEnter: Function}} */ (currentRouteElement))
+ .onRouteEnter();
+ (/** @type {{updateFocusForA11y: Function}} */ (currentRouteElement))
+ .updateFocusForA11y();
+ }
+}
+
+// Notifies all elements when browser history is popped.
+window.addEventListener('popstate', notifyObservers);
+
+// Notify the active element before unload.
+window.addEventListener('beforeunload', () => {
+ if (currentRouteElement) {
+ (/** @type {{onRouteUnload: Function}} */ (currentRouteElement))
+ .onRouteUnload();
}
+});
- /** @type {!Set<!PolymerElement>} */
- const routeObservers = new Set();
+export function navigateToNextStep() {
+ history.pushState(
+ {
+ route: history.state.route,
+ step: history.state.step + 1,
+ },
+ '', `/${history.state.route}`);
+ notifyObservers();
+}
- /** @type {?PolymerElement} */
- let currentRouteElement;
+/**
+ * @param {!Routes} route
+ * @param {number} step
+ */
+export function navigateTo(route, step) {
+ assert([
+ Routes.LANDING,
+ Routes.NEW_USER,
+ Routes.RETURNING_USER,
+ ].includes(route));
+
+ history.pushState(
+ {
+ route: route,
+ step: step,
+ },
+ '', '/' + (route === Routes.LANDING ? '' : route));
+ notifyObservers();
+}
- // Notifies all the elements that extended NavigationBehavior.
- function notifyObservers() {
- if (currentRouteElement) {
- (/** @type {{onRouteExit: Function}} */ (currentRouteElement))
- .onRouteExit();
- currentRouteElement = null;
- }
+/**
+ * Elements can override onRoute(Change|Enter|Exit) to handle route changes.
+ * Order of hooks being called:
+ * 1) onRouteExit() on the old route
+ * 2) onRouteChange() on all subscribed routes
+ * 3) onRouteEnter() on the new route
+ *
+ * @polymerBehavior
+ */
+export const NavigationBehavior = {
+ /** @override */
+ attached: function() {
+ assert(!routeObservers.has(this));
+ routeObservers.add(this);
- const route = /** @type {!welcome.Routes} */ (history.state.route);
+ const route = /** @type {!Routes} */ (history.state.route);
const step = history.state.step;
- routeObservers.forEach(observer => {
- (/** @type {{onRouteChange: Function}} */ (observer))
- .onRouteChange(route, step);
-
- // Modules are only attached to DOM if they're for the current route, so
- // as long as the id of an element matches up to the current step, it
- // means that element is for the current route.
- if (observer.id == `step-${step}`) {
- currentRouteElement = observer;
- }
- });
-
- // If currentRouteElement is not null, it means there was a new route.
- if (currentRouteElement) {
- (/** @type {{onRouteEnter: Function}} */ (currentRouteElement))
- .onRouteEnter();
- (/** @type {{updateFocusForA11y: Function}} */ (currentRouteElement))
- .updateFocusForA11y();
- }
- }
- // Notifies all elements when browser history is popped.
- window.addEventListener('popstate', notifyObservers);
+ // history state was set when page loaded, so when the element first
+ // attaches, call the route-change handler to initialize first.
+ this.onRouteChange(route, step);
+
+ // Modules are only attached to DOM if they're for the current route, so
+ // as long as the id of an element matches up to the current step, it
+ // means that element is for the current route.
+ if (this.id == `step-${step}`) {
+ currentRouteElement = this;
+ this.onRouteEnter();
+ this.updateFocusForA11y();
+ }
+ },
- // Notify the active element before unload.
- window.addEventListener('beforeunload', () => {
- if (currentRouteElement) {
- (/** @type {{onRouteUnload: Function}} */ (currentRouteElement))
- .onRouteUnload();
+ /** Called to update focus when progressing through the modules. */
+ updateFocusForA11y: function() {
+ const header = this.$$('h1');
+ if (header) {
+ afterNextRender(this, () => header.focus());
}
- });
+ },
- function navigateToNextStep() {
- history.pushState(
- {
- route: history.state.route,
- step: history.state.step + 1,
- },
- '', `/${history.state.route}`);
- notifyObservers();
- }
+ /** @override */
+ detached: function() {
+ assert(routeObservers.delete(this));
+ },
/**
- * @param {!welcome.Routes} route
+ * @param {!Routes} route
* @param {number} step
*/
- function navigateTo(route, step) {
- assert([
- Routes.LANDING,
- Routes.NEW_USER,
- Routes.RETURNING_USER,
- ].includes(route));
-
- history.pushState(
- {
- route: route,
- step: step,
- },
- '', '/' + (route === Routes.LANDING ? '' : route));
- notifyObservers();
- }
+ onRouteChange: function(route, step) {},
- /**
- * Elements can override onRoute(Change|Enter|Exit) to handle route changes.
- * Order of hooks being called:
- * 1) onRouteExit() on the old route
- * 2) onRouteChange() on all subscribed routes
- * 3) onRouteEnter() on the new route
- *
- * @polymerBehavior
- */
- const NavigationBehavior = {
- /** @override */
- attached: function() {
- assert(!routeObservers.has(this));
- routeObservers.add(this);
-
- const route = /** @type {!welcome.Routes} */ (history.state.route);
- const step = history.state.step;
-
- // history state was set when page loaded, so when the element first
- // attaches, call the route-change handler to initialize first.
- this.onRouteChange(route, step);
-
- // Modules are only attached to DOM if they're for the current route, so
- // as long as the id of an element matches up to the current step, it
- // means that element is for the current route.
- if (this.id == `step-${step}`) {
- currentRouteElement = this;
- this.onRouteEnter();
- this.updateFocusForA11y();
- }
- },
-
- /** Called to update focus when progressing through the modules. */
- updateFocusForA11y: function() {
- const header = this.$$('h1');
- if (header) {
- Polymer.RenderStatus.afterNextRender(this, () => header.focus());
- }
- },
-
- /** @override */
- detached: function() {
- assert(routeObservers.delete(this));
- },
-
- /**
- * @param {!welcome.Routes} route
- * @param {number} step
- */
- onRouteChange: function(route, step) {},
-
- onRouteEnter: function() {},
-
- onRouteExit: function() {},
-
- onRouteUnload: function() {},
- };
-
- return {
- NavigationBehavior: NavigationBehavior,
- navigateTo: navigateTo,
- navigateToNextStep: navigateToNextStep,
- Routes: Routes,
- };
-});
+ onRouteEnter: function() {},
+
+ onRouteExit: function() {},
+
+ onRouteUnload: function() {},
+};
diff --git a/chromium/chrome/browser/resources/welcome/ntp_background/BUILD.gn b/chromium/chrome/browser/resources/welcome/ntp_background/BUILD.gn
index 32399f99cf3..09daeacfd15 100644
--- a/chromium/chrome/browser/resources/welcome/ntp_background/BUILD.gn
+++ b/chromium/chrome/browser/resources/welcome/ntp_background/BUILD.gn
@@ -3,8 +3,13 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
-
+import("//tools/polymer/polymer.gni")
js_type_check("closure_compile") {
+ is_polymer3 = true
+ closure_flags = default_closure_args + [
+ "js_module_root=../../chrome/browser/resources/welcome/",
+ "js_module_root=gen/chrome/browser/resources/welcome/",
+ ]
deps = [
":ntp_background_metrics_proxy",
":ntp_background_proxy",
@@ -12,27 +17,36 @@ js_type_check("closure_compile") {
]
}
-js_library("nux_ntp_background") {
+js_library("ntp_background_proxy") {
deps = [
":ntp_background_metrics_proxy",
- ":ntp_background_proxy",
- "../:navigation_behavior",
- "../shared:nux_types",
- "//ui/webui/resources/js:cr",
- "//ui/webui/resources/js:i18n_behavior",
- "//ui/webui/resources/js:util",
+ "//ui/webui/resources/js:cr.m",
]
+ externs_list = [ "$externs_path/chrome_send.js" ]
}
-js_library("ntp_background_proxy") {
+js_library("ntp_background_metrics_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "../shared:module_metrics_proxy",
+ "//ui/webui/resources/js:cr.m",
]
- externs_list = [ "$externs_path/chrome_send.js" ]
}
-js_library("ntp_background_metrics_proxy") {
+polymer_modulizer("nux_ntp_background") {
+ js_file = "nux_ntp_background.js"
+ html_file = "nux_ntp_background.html"
+ html_type = "v3-ready"
+}
+
+js_library("nux_ntp_background") {
deps = [
- "../shared:module_metrics_proxy",
+ ":ntp_background_metrics_proxy",
+ ":ntp_background_proxy",
+ "../:navigation_behavior",
+ "../shared:nux_types",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/js:cr.m",
+ "//ui/webui/resources/js:i18n_behavior.m",
+ "//ui/webui/resources/js:util.m",
]
}
diff --git a/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.html b/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.html
deleted file mode 100644
index a5bbfe09db6..00000000000
--- a/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<link rel="import" href="../shared/module_metrics_proxy.html">
-<script src="ntp_background_metrics_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.js b/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.js
index dcdb0ffe959..114e5610e9b 100644
--- a/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_metrics_proxy.js
@@ -2,22 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
- class NtpBackgroundMetricsProxyImpl extends welcome.ModuleMetricsProxyImpl {
- constructor() {
- super(
- 'FirstRun.NewUserExperience.NtpBackgroundInteraction',
- welcome.NuxNtpBackgroundInteractions);
- }
+import {addSingletonGetter} from 'chrome://resources/js/cr.m.js';
+import {ModuleMetricsProxyImpl, NuxNtpBackgroundInteractions} from '../shared/module_metrics_proxy.js';
- getInteractions() {
- return this.interactions_;
- }
+export class NtpBackgroundMetricsProxyImpl extends ModuleMetricsProxyImpl {
+ constructor() {
+ super(
+ 'FirstRun.NewUserExperience.NtpBackgroundInteraction',
+ NuxNtpBackgroundInteractions);
}
- cr.addSingletonGetter(NtpBackgroundMetricsProxyImpl);
+ getInteractions() {
+ return this.interactions_;
+ }
+}
- return {
- NtpBackgroundMetricsProxyImpl: NtpBackgroundMetricsProxyImpl,
- };
-});
+addSingletonGetter(NtpBackgroundMetricsProxyImpl);
diff --git a/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.html b/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.html
deleted file mode 100644
index a15c5167582..00000000000
--- a/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="ntp_background_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.js b/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.js
index 17b8ee697bd..6f86f160d4b 100644
--- a/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/ntp_background/ntp_background_proxy.js
@@ -2,100 +2,96 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
+import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
+import {NtpBackgroundMetricsProxyImpl} from './ntp_background_metrics_proxy.js';
+
+/**
+ * @typedef {{
+ * id: number,
+ * imageUrl: string,
+ * thumbnailClass: string,
+ * title: string,
+ * }}
+ */
+export let NtpBackgroundData;
+
+/** @interface */
+export class NtpBackgroundProxy {
+ /** @return {!Promise} */
+ clearBackground() {}
+
+ /** @return {!Promise<!Array<!NtpBackgroundData>>} */
+ getBackgrounds() {}
+
/**
- * @typedef {{
- * id: number,
- * imageUrl: string,
- * thumbnailClass: string,
- * title: string,
- * }}
+ * @param {string} url
+ * @return {!Promise<void>}
*/
- let NtpBackgroundData;
+ preloadImage(url) {}
+
+ recordBackgroundImageFailedToLoad() {}
- /** @interface */
- class NtpBackgroundProxy {
- clearBackground() {}
+ /** @param {number} loadTime */
+ recordBackgroundImageLoadTime(loadTime) {}
- /** @return {!Promise<!Array<!welcome.NtpBackgroundData>>} */
- getBackgrounds() {}
+ recordBackgroundImageNeverLoaded() {}
- /**
- * @param {string} url
- * @return {!Promise<void>}
- */
- preloadImage(url) {}
+ /** @param {number} id */
+ setBackground(id) {}
+}
+
+/** @implements {NtpBackgroundProxy} */
+export class NtpBackgroundProxyImpl {
+ /** @override */
+ clearBackground() {
+ return sendWithPromise('clearBackground');
+ }
- recordBackgroundImageFailedToLoad() {}
+ /** @override */
+ getBackgrounds() {
+ return sendWithPromise('getBackgrounds');
+ }
- /** @param {number} loadTime */
- recordBackgroundImageLoadTime(loadTime) {}
+ /** @override */
+ preloadImage(url) {
+ return new Promise((resolve, reject) => {
+ const preloadedImage = new Image();
+ preloadedImage.onerror = reject;
+ preloadedImage.onload = resolve;
+ preloadedImage.src = url;
+ });
+ }
- recordBackgroundImageNeverLoaded() {}
+ /** @override */
+ recordBackgroundImageFailedToLoad() {
+ const ntpInteractions =
+ NtpBackgroundMetricsProxyImpl.getInstance().getInteractions();
+ chrome.metricsPrivate.recordEnumerationValue(
+ 'FirstRun.NewUserExperience.NtpBackgroundInteraction',
+ ntpInteractions.BackgroundImageFailedToLoad,
+ Object.keys(ntpInteractions).length);
+ }
- /** @param {number} id */
- setBackground(id) {}
+ /** @override */
+ recordBackgroundImageLoadTime(loadTime) {
+ chrome.metricsPrivate.recordTime(
+ 'FirstRun.NewUserExperience.NtpBackgroundLoadTime', loadTime);
}
- /** @implements {welcome.NtpBackgroundProxy} */
- class NtpBackgroundProxyImpl {
- /** @override */
- clearBackground() {
- return cr.sendWithPromise('clearBackground');
- }
-
- /** @override */
- getBackgrounds() {
- return cr.sendWithPromise('getBackgrounds');
- }
-
- /** @override */
- preloadImage(url) {
- return new Promise((resolve, reject) => {
- const preloadedImage = new Image();
- preloadedImage.onerror = reject;
- preloadedImage.onload = resolve;
- preloadedImage.src = url;
- });
- }
-
- /** @override */
- recordBackgroundImageFailedToLoad() {
- const ntpInteractions =
- welcome.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 =
- welcome.NtpBackgroundMetricsProxyImpl.getInstance().getInteractions();
- chrome.metricsPrivate.recordEnumerationValue(
- 'FirstRun.NewUserExperience.NtpBackgroundInteraction',
- ntpInteractions.BackgroundImageNeverLoaded,
- Object.keys(ntpInteractions).length);
- }
-
- /** @override */
- setBackground(id) {
- chrome.send('setBackground', [id]);
- }
+ /** @override */
+ recordBackgroundImageNeverLoaded() {
+ const ntpInteractions =
+ NtpBackgroundMetricsProxyImpl.getInstance().getInteractions();
+ chrome.metricsPrivate.recordEnumerationValue(
+ 'FirstRun.NewUserExperience.NtpBackgroundInteraction',
+ ntpInteractions.BackgroundImageNeverLoaded,
+ Object.keys(ntpInteractions).length);
}
- cr.addSingletonGetter(NtpBackgroundProxyImpl);
+ /** @override */
+ setBackground(id) {
+ chrome.send('setBackground', [id]);
+ }
+}
- return {
- NtpBackgroundData: NtpBackgroundData,
- NtpBackgroundProxy: NtpBackgroundProxy,
- NtpBackgroundProxyImpl: NtpBackgroundProxyImpl,
- };
-});
+addSingletonGetter(NtpBackgroundProxyImpl);
diff --git a/chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.html b/chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.html
index c6d03b9a488..f5b6ac423ee 100644
--- a/chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.html
+++ b/chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.html
@@ -1,213 +1,190 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_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.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/polymer/v1_0/iron-icon/iron-icon.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/step_indicator.html">
-<link rel="import" href="ntp_background_metrics_proxy.html">
-<link rel="import" href="ntp_background_proxy.html">
-
-<dom-module id="nux-ntp-background">
- <template>
- <style include="animations chooser-shared-css">
- :host {
- text-align: center;
- }
-
- #backgroundPreview {
- background-position: center center;
- background-repeat: no-repeat;
- background-size: cover;
- bottom: 0;
- left: 0;
- opacity: 0;
- position: fixed;
- right: 0;
- top: 0;
- transition: background 300ms, opacity 400ms;
- }
-
- #backgroundPreview.active {
- opacity: 1;
- }
-
- #backgroundPreview::before {
- /* Copied from browser/resources/local_ntp/custom_backgrounds.js */
- 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: '';
- display: block;
- height: 100%;
- width: 100%;
- }
-
- .content {
- /* Put a non-static position on the content so that it can have a
- * higher stacking level than its previous sibling,
- * the #backgroundPreview element. */
- position: relative;
- }
-
- .ntp-background-logo {
- content: url(../images/module_icons/wallpaper_light.svg);
- height: 39px;
- margin: auto;
- margin-bottom: 16px;
- width: 44px;
- }
-
- @media (prefers-color-scheme: dark) {
- .ntp-background-logo {
- content: url(../images/module_icons/wallpaper_dark.svg);
- }
- }
-
- h1 {
- color: var(--cr-primary-text-color);
- font-size: 1.5rem;
- font-weight: 500;
- margin: 0;
- margin-bottom: 46px;
- outline: none;
- transition: color 400ms;
- }
-
- #backgroundPreview.active + .content h1 {
- color: white;
- }
-
- .ntp-backgrounds-grid {
- display: grid;
- grid-gap: 32px;
- grid-template-columns: repeat(3, 176px);
- grid-template-rows: repeat(2, 176px);
- width: 592px;
- }
-
- .option {
- align-items: stretch;
- border-radius: 4px;
- display: flex;
- height: 100%;
- overflow: hidden;
- padding: 0;
- text-align: start;
- transition: border-color 400ms, box-shadow 500ms;
- width: 100%;
- }
-
- #backgroundPreview.active + .content .option {
- border-color: var(--google-grey-refresh-700);
- }
-
- /* Remove outline when button is focused using the mouse. */
- .option:focus:not(.keyboard-focused) {
- outline: none;
- }
-
- .ntp-background-thumbnail {
- background-color: var(--cr-card-background-color);
- background-position: center center;
- background-repeat: no-repeat;
- background-size: cover;
- flex: 1;
- }
-
- .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;
- }
-
- .option[active] .option-name {
- background: var(--cr-checked-color);
- color: var(--cr-card-background-color);
- }
-
- .button-bar {
- margin-top: 56px;
- }
-
- #skipButton {
- background-color: var(--cr-card-background-color)
- }
-
- #skipButton:hover {
- background-image:
- linear-gradient(var(--hover-bg-color), var(--hover-bg-color));
- }
-
- /* Wallpaper Thumbnails */
- .art {
- background-image: url(../images/ntp_thumbnails/art.jpg);
- }
-
- .cityscape {
- background-image: url(../images/ntp_thumbnails/cityscape.jpg);
- }
-
- .earth {
- background-image: url(../images/ntp_thumbnails/earth.jpg);
- }
-
- .geometric-shapes {
- background-image: url(../images/ntp_thumbnails/geometric_shapes.jpg);
- }
-
- .landscape {
- background-image: url(../images/ntp_thumbnails/landscape.jpg);
- }
- </style>
- <div
- id="backgroundPreview"
- on-transitionend="onBackgroundPreviewTransitionEnd_">
- </div>
-
- <div class="content">
- <div class="ntp-background-logo"></div>
- <h1 tabindex="-1">$i18n{ntpBackgroundDescription}</h1>
-
- <div class="ntp-backgrounds-grid slide-in">
- <template is="dom-repeat" items="[[backgrounds_]]">
- <button
- active$="[[isSelectedBackground_(item, selectedBackground_)]]"
- class="option"
- on-click="onBackgroundClick_"
- on-keyup="onBackgroundKeyUp_"
- on-pointerdown="onBackgroundPointerDown_">
- <div
- class$="ntp-background-thumbnail [[item.thumbnailClass]]">
- </div>
- <div class="option-name">[[item.title]]</div>
- </button>
- </template>
- </div>
-
- <div class="button-bar">
- <cr-button id="skipButton" on-click="onSkipClicked_">
- $i18n{skip}
- </cr-button>
- <step-indicator model="[[indicatorModel]]"></step-indicator>
- <cr-button class="action-button" on-click="onNextClicked_">
- $i18n{next}
- <iron-icon icon="cr:chevron-right"></iron-icon>
- </cr-button>
- </div>
- </div>
- </template>
-
- <script src="nux_ntp_background.js"></script>
-</dom-module>
+<style include="animations chooser-shared-css">
+ :host {
+ text-align: center;
+ }
+
+ #backgroundPreview {
+ background-position: center center;
+ background-repeat: no-repeat;
+ background-size: cover;
+ bottom: 0;
+ left: 0;
+ opacity: 0;
+ position: fixed;
+ right: 0;
+ top: 0;
+ transition: background 300ms, opacity 400ms;
+ }
+
+ #backgroundPreview.active {
+ opacity: 1;
+ }
+
+ #backgroundPreview::before {
+ /* Copied from browser/resources/local_ntp/custom_backgrounds.js */
+ 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: '';
+ display: block;
+ height: 100%;
+ width: 100%;
+ }
+
+ .content {
+ /* Put a non-static position on the content so that it can have a
+ * higher stacking level than its previous sibling,
+ * the #backgroundPreview element. */
+ position: relative;
+ }
+
+ .ntp-background-logo {
+ content: url(../images/module_icons/wallpaper_light.svg);
+ height: 39px;
+ margin: auto;
+ margin-bottom: 16px;
+ width: 44px;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ .ntp-background-logo {
+ content: url(../images/module_icons/wallpaper_dark.svg);
+ }
+ }
+
+ h1 {
+ color: var(--cr-primary-text-color);
+ font-size: 1.5rem;
+ font-weight: 500;
+ margin: 0;
+ margin-bottom: 46px;
+ outline: none;
+ transition: color 400ms;
+ }
+
+ #backgroundPreview.active + .content h1 {
+ color: white;
+ }
+
+ .ntp-backgrounds-grid {
+ display: grid;
+ grid-gap: 32px;
+ grid-template-columns: repeat(3, 176px);
+ grid-template-rows: repeat(2, 176px);
+ width: 592px;
+ }
+
+ .option {
+ align-items: stretch;
+ border-radius: 4px;
+ display: flex;
+ height: 100%;
+ overflow: hidden;
+ padding: 0;
+ text-align: start;
+ transition: border-color 400ms, box-shadow 500ms;
+ width: 100%;
+ }
+
+ #backgroundPreview.active + .content .option {
+ border-color: var(--google-grey-refresh-700);
+ }
+
+ /* Remove outline when button is focused using the mouse. */
+ .option:focus:not(.keyboard-focused) {
+ outline: none;
+ }
+
+ .ntp-background-thumbnail {
+ background-color: var(--cr-card-background-color);
+ background-position: center center;
+ background-repeat: no-repeat;
+ background-size: cover;
+ flex: 1;
+ }
+
+ .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;
+ }
+
+ .option[active] .option-name {
+ background: var(--cr-checked-color);
+ color: var(--cr-card-background-color);
+ }
+
+ .button-bar {
+ margin-top: 56px;
+ }
+
+ #skipButton {
+ background-color: var(--cr-card-background-color)
+ }
+
+ #skipButton:hover {
+ background-image:
+ linear-gradient(var(--hover-bg-color), var(--hover-bg-color));
+ }
+
+ /* Wallpaper Thumbnails */
+ .art {
+ background-image: url(../images/ntp_thumbnails/art.jpg);
+ }
+
+ .cityscape {
+ background-image: url(../images/ntp_thumbnails/cityscape.jpg);
+ }
+
+ .earth {
+ background-image: url(../images/ntp_thumbnails/earth.jpg);
+ }
+
+ .geometric-shapes {
+ background-image: url(../images/ntp_thumbnails/geometric_shapes.jpg);
+ }
+
+ .landscape {
+ background-image: url(../images/ntp_thumbnails/landscape.jpg);
+ }
+</style>
+<div
+ id="backgroundPreview"
+ on-transitionend="onBackgroundPreviewTransitionEnd_">
+</div>
+
+<div class="content">
+ <div class="ntp-background-logo"></div>
+ <h1 tabindex="-1">$i18n{ntpBackgroundDescription}</h1>
+
+ <div class="ntp-backgrounds-grid slide-in">
+ <template is="dom-repeat" items="[[backgrounds_]]">
+ <button
+ active$="[[isSelectedBackground_(item, selectedBackground_)]]"
+ class="option"
+ on-click="onBackgroundClick_"
+ on-keyup="onBackgroundKeyUp_"
+ on-pointerdown="onBackgroundPointerDown_">
+ <div
+ class$="ntp-background-thumbnail [[item.thumbnailClass]]">
+ </div>
+ <div class="option-name">[[item.title]]</div>
+ </button>
+ </template>
+ </div>
+
+ <div class="button-bar">
+ <cr-button id="skipButton" on-click="onSkipClicked_">
+ $i18n{skip}
+ </cr-button>
+ <step-indicator model="[[indicatorModel]]"></step-indicator>
+ <cr-button class="action-button" on-click="onNextClicked_">
+ $i18n{next}
+ <iron-icon icon="cr:chevron-right"></iron-icon>
+ </cr-button>
+ </div>
+</div>
diff --git a/chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.js b/chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.js
index 1af8a41fe97..b255441592f 100644
--- a/chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.js
+++ b/chromium/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.js
@@ -2,28 +2,51 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
+import 'chrome://resources/cr_elements/icons.m.js';
+import 'chrome://resources/cr_elements/shared_vars_css.m.js';
+import 'chrome://resources/js/cr.m.js';
+import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
+import '../shared/animations_css.js';
+import '../shared/chooser_shared_css.js';
+import '../shared/step_indicator.js';
+import '../strings.m.js';
+
+import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
+import {isRTL} from 'chrome://resources/js/util.m.js';
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {navigateTo, navigateToNextStep, NavigationBehavior, Routes} from '../navigation_behavior.js';
+import {ModuleMetricsManager} from '../shared/module_metrics_proxy.js';
+import {stepIndicatorModel} from '../shared/nux_types.js';
+
+import {NtpBackgroundMetricsProxyImpl} from './ntp_background_metrics_proxy.js';
+import {NtpBackgroundData, NtpBackgroundProxy, NtpBackgroundProxyImpl} from './ntp_background_proxy.js';
+
const KEYBOARD_FOCUSED_CLASS = 'keyboard-focused';
Polymer({
is: 'nux-ntp-background',
+ _template: html`{__html_template__}`,
+
behaviors: [
I18nBehavior,
- welcome.NavigationBehavior,
+ NavigationBehavior,
],
properties: {
- /** @type {welcome.stepIndicatorModel} */
+ /** @type {stepIndicatorModel} */
indicatorModel: Object,
- /** @private {?welcome.NtpBackgroundData} */
+ /** @private {?NtpBackgroundData} */
selectedBackground_: {
observer: 'onSelectedBackgroundChange_',
type: Object,
},
},
- /** @private {?Array<!welcome.NtpBackgroundData>} */
+ /** @private {?Array<!NtpBackgroundData>} */
backgrounds_: null,
/** @private */
@@ -32,17 +55,17 @@ Polymer({
/** @private {boolean} */
imageIsLoading_: false,
- /** @private {?welcome.ModuleMetricsManager} */
+ /** @private {?ModuleMetricsManager} */
metricsManager_: null,
- /** @private {?welcome.NtpBackgroundProxy} */
+ /** @private {?NtpBackgroundProxy} */
ntpBackgroundProxy_: null,
/** @override */
ready: function() {
- this.ntpBackgroundProxy_ = welcome.NtpBackgroundProxyImpl.getInstance();
- this.metricsManager_ = new welcome.ModuleMetricsManager(
- welcome.NtpBackgroundMetricsProxyImpl.getInstance());
+ this.ntpBackgroundProxy_ = NtpBackgroundProxyImpl.getInstance();
+ this.metricsManager_ =
+ new ModuleMetricsManager(NtpBackgroundMetricsProxyImpl.getInstance());
},
onRouteEnter: function() {
@@ -98,7 +121,7 @@ Polymer({
},
/**
- * @param {!welcome.NtpBackgroundData} background
+ * @param {!NtpBackgroundData} background
* @private
*/
isSelectedBackground_: function(background) {
@@ -144,7 +167,7 @@ Polymer({
},
/**
- * @param {!{model: !{item: !welcome.NtpBackgroundData}}} e
+ * @param {!{model: !{item: !NtpBackgroundData}}} e
* @private
*/
onBackgroundClick_: function(e) {
@@ -217,14 +240,14 @@ Polymer({
this.ntpBackgroundProxy_.clearBackground();
}
this.metricsManager_.recordGetStarted();
- welcome.navigateToNextStep();
+ navigateToNextStep();
},
/** @private */
onSkipClicked_: function() {
this.finalized_ = true;
this.metricsManager_.recordNoThanks();
- welcome.navigateToNextStep();
+ navigateToNextStep();
if (this.hasValidSelectedBackground_()) {
this.fire('iron-announce', {text: this.i18n('ntpBackgroundReset')});
diff --git a/chromium/chrome/browser/resources/welcome/set_as_default/BUILD.gn b/chromium/chrome/browser/resources/welcome/set_as_default/BUILD.gn
index e633bc817e4..0c82491a12e 100644
--- a/chromium/chrome/browser/resources/welcome/set_as_default/BUILD.gn
+++ b/chromium/chrome/browser/resources/welcome/set_as_default/BUILD.gn
@@ -3,8 +3,14 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/polymer/polymer.gni")
js_type_check("closure_compile") {
+ is_polymer3 = true
+ closure_flags = default_closure_args + [
+ "js_module_root=../../chrome/browser/resources/welcome/",
+ "js_module_root=gen/chrome/browser/resources/welcome/",
+ ]
deps = [
":nux_set_as_default",
]
@@ -15,18 +21,21 @@ js_library("nux_set_as_default") {
":nux_set_as_default_proxy",
"../:navigation_behavior",
"../shared:nux_types",
- "//ui/webui/resources/js:load_time_data",
- "//ui/webui/resources/js:web_ui_listener_behavior",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/js:load_time_data.m",
+ "//ui/webui/resources/js:web_ui_listener_behavior.m",
]
}
js_library("nux_set_as_default_proxy") {
deps = [
- "../shared:nux_types",
- "//ui/webui/resources/js:cr",
- ]
- externs_list = [
- "$externs_path/chrome_send.js",
- "$externs_path/metrics_private.js",
+ "//ui/webui/resources/js:cr.m",
]
+ externs_list = [ "$externs_path/metrics_private.js" ]
+}
+
+polymer_modulizer("nux_set_as_default") {
+ js_file = "nux_set_as_default.js"
+ html_file = "nux_set_as_default.html"
+ html_type = "v3-ready"
}
diff --git a/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.html b/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.html
index 53688f8c549..c7f2b065ef4 100644
--- a/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.html
+++ b/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.html
@@ -1,104 +1,84 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<style include="animations">
+ .container {
+ text-align: center;
+ }
-<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.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="../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">
-<if expr="is_win">
-<link rel="import" href="chrome://resources/cr_elements/icons.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
-</if>
-
-<dom-module id="nux-set-as-default">
- <template>
- <style include="animations">
- .container {
- text-align: center;
- }
-
- .logo {
- content: url(../images/module_icons/set_default_light.svg);
- display: inline-block;
- height: 38px;
- margin-bottom: 16px;
- width: 42px;
- }
+ .logo {
+ content: url(../images/module_icons/set_default_light.svg);
+ display: inline-block;
+ height: 38px;
+ margin-bottom: 16px;
+ width: 42px;
+ }
- @media (prefers-color-scheme: dark) {
- .logo {
- content: url(../images/module_icons/set_default_dark.svg);
- }
- }
+ @media (prefers-color-scheme: dark) {
+ .logo {
+ content: url(../images/module_icons/set_default_dark.svg);
+ }
+ }
- .illustration {
- content: url(../images/set_default_light.svg);
- margin: auto;
- width: 454px;
- }
+ .illustration {
+ content: url(../images/set_default_light.svg);
+ margin: auto;
+ width: 454px;
+ }
- @media (prefers-color-scheme: dark) {
- .illustration {
- content: url(../images/set_default_dark.svg);
- }
- }
+ @media (prefers-color-scheme: dark) {
+ .illustration {
+ content: url(../images/set_default_dark.svg);
+ }
+ }
- h1 {
- color: var(--cr-primary-text-color);
- font-size: 1.5rem;
- font-weight: 500;
- line-height: 2.5rem;
- margin: 0;
- outline: none;
- }
+ h1 {
+ color: var(--cr-primary-text-color);
+ font-size: 1.5rem;
+ font-weight: 500;
+ line-height: 2.5rem;
+ margin: 0;
+ outline: none;
+ }
- h2 {
- color: var(--cr-secondary-text-color);
- font-size: 1.25rem;
- font-weight: unset;
- line-height: 1.875rem;
- margin: auto;
- margin-bottom: 48px;
- margin-top: 16px;
- max-width: 400px;
- }
+ h2 {
+ color: var(--cr-secondary-text-color);
+ font-size: 1.25rem;
+ font-weight: unset;
+ line-height: 1.875rem;
+ margin: auto;
+ margin-bottom: 48px;
+ margin-top: 16px;
+ max-width: 400px;
+ }
- .button-bar {
- display: flex;
- justify-content: space-between;
- margin-top: 64px;
- }
+ .button-bar {
+ display: flex;
+ justify-content: space-between;
+ margin-top: 64px;
+ }
<if expr="is_win">
- iron-icon[icon='cr:open-in-new'] {
- height: 20px;
- margin-inline-start: 6px;
- margin-inline-end: -10px;
- width: 20px;
- }
+ iron-icon[icon='cr:open-in-new'] {
+ height: 20px;
+ margin-inline-start: 6px;
+ margin-inline-end: -10px;
+ width: 20px;
+ }
</if>
- </style>
- <div class="container">
- <div class="logo"></div>
- <h1 tabindex="-1">$i18n{setDefaultHeader}</h1>
- <h2>$i18n{setDefaultSubHeader}</h2>
- <div class="illustration slide-in" aria-hidden="true"></div>
- <div class="button-bar">
- <cr-button id="decline-button" on-click="onDeclineClick_">
- $i18n{skip}
- </cr-button>
- <step-indicator model="[[indicatorModel]]"></step-indicator>
- <cr-button class="action-button" on-click="onSetDefaultClick_">
- $i18n{setDefaultConfirm}
+</style>
+<div class="container">
+ <div class="logo"></div>
+ <h1 tabindex="-1">$i18n{setDefaultHeader}</h1>
+ <h2>$i18n{setDefaultSubHeader}</h2>
+ <div class="illustration slide-in" aria-hidden="true"></div>
+ <div class="button-bar">
+ <cr-button id="decline-button" on-click="onDeclineClick_">
+ $i18n{skip}
+ </cr-button>
+ <step-indicator model="[[indicatorModel]]"></step-indicator>
+ <cr-button class="action-button" on-click="onSetDefaultClick_">
+ $i18n{setDefaultConfirm}
<if expr="is_win">
- <iron-icon icon="cr:open-in-new" hidden="[[!isWin10]]"></iron-icon>
+ <iron-icon icon="cr:open-in-new" hidden="[[!isWin10]]"></iron-icon>
</if>
- </cr-button>
- </div>
- </div>
- </template>
- <script src="nux_set_as_default.js"></script>
-</dom-module>
+ </cr-button>
+ </div>
+</div>
diff --git a/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.js b/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.js
index 37e69a2de97..c2be7a3c5ee 100644
--- a/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.js
+++ b/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.js
@@ -2,16 +2,37 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
+import 'chrome://resources/cr_elements/shared_vars_css.m.js';
+// <if expr="is_win">
+import 'chrome://resources/cr_elements/icons.m.js';
+import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
+// </if>
+import '../shared/animations_css.js';
+import '../shared/step_indicator.js';
+import '../strings.m.js';
+
+import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
+import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js';
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {navigateTo, navigateToNextStep, NavigationBehavior, Routes} from '../navigation_behavior.js';
+import {DefaultBrowserInfo, stepIndicatorModel} from '../shared/nux_types.js';
+
+import {NuxSetAsDefaultProxy, NuxSetAsDefaultProxyImpl} from './nux_set_as_default_proxy.js';
+
Polymer({
is: 'nux-set-as-default',
+ _template: html`{__html_template__}`,
+
behaviors: [
WebUIListenerBehavior,
- welcome.NavigationBehavior,
+ NavigationBehavior,
],
properties: {
- /** @type {welcome.stepIndicatorModel} */
+ /** @type {stepIndicatorModel} */
indicatorModel: Object,
// <if expr="is_win">
@@ -22,15 +43,18 @@ Polymer({
// </if>
},
- /** @private {welcome.NuxSetAsDefaultProxy} */
+ /** @private {NuxSetAsDefaultProxy} */
browserProxy_: null,
/** @private {boolean} */
finalized_: false,
+ /** @private {!Function} */
+ navigateToNextStep_: navigateToNextStep,
+
/** @override */
ready: function() {
- this.browserProxy_ = welcome.NuxSetAsDefaultProxyImpl.getInstance();
+ this.browserProxy_ = NuxSetAsDefaultProxyImpl.getInstance();
this.addWebUIListener(
'browser-default-state-changed',
@@ -80,7 +104,7 @@ Polymer({
/**
* Automatically navigate to the next onboarding step once default changed.
- * @param {!welcome.DefaultBrowserInfo} status
+ * @param {!DefaultBrowserInfo} status
* @private
*/
onDefaultBrowserChange_: function(status) {
@@ -105,7 +129,6 @@ Polymer({
/** @private */
finished_: function() {
this.finalized_ = true;
-
- welcome.navigateToNextStep();
+ this.navigateToNextStep_();
},
});
diff --git a/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.html b/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.html
deleted file mode 100644
index b1dcbde23a5..00000000000
--- a/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="nux_set_as_default_proxy.js"></script> \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.js b/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.js
index e7668ffa467..33266dac325 100644
--- a/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/set_as_default/nux_set_as_default_proxy.js
@@ -2,100 +2,95 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
- const NUX_SET_AS_DEFAULT_INTERACTION_METRIC_NAME =
- 'FirstRun.NewUserExperience.SetAsDefaultInteraction';
+import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
+import {DefaultBrowserInfo} from '../shared/nux_types.js';
- /**
- * NuxSetAsDefaultInteractions enum.
- * These values are persisted to logs and should not be renumbered or re-used.
- * See tools/metrics/histograms/enums.xml.
- * @enum {number}
- */
- const NuxSetAsDefaultInteractions = {
- PageShown: 0,
- NavigatedAway: 1,
- Skip: 2,
- ClickSetDefault: 3,
- SuccessfullySetDefault: 4,
- NavigatedAwayThroughBrowserHistory: 5,
- };
+const NUX_SET_AS_DEFAULT_INTERACTION_METRIC_NAME =
+ 'FirstRun.NewUserExperience.SetAsDefaultInteraction';
- const NUX_SET_AS_DEFAULT_INTERACTIONS_COUNT =
- Object.keys(NuxSetAsDefaultInteractions).length;
+/**
+ * NuxSetAsDefaultInteractions enum.
+ * These values are persisted to logs and should not be renumbered or re-used.
+ * See tools/metrics/histograms/enums.xml.
+ * @enum {number}
+ */
+const NuxSetAsDefaultInteractions = {
+ PageShown: 0,
+ NavigatedAway: 1,
+ Skip: 2,
+ ClickSetDefault: 3,
+ SuccessfullySetDefault: 4,
+ NavigatedAwayThroughBrowserHistory: 5,
+};
- /** @interface */
- class NuxSetAsDefaultProxy {
- /** @return {!Promise<!welcome.DefaultBrowserInfo>} */
- requestDefaultBrowserState() {}
- setAsDefault() {}
- recordPageShown() {}
- recordNavigatedAway() {}
- recordNavigatedAwayThroughBrowserHistory() {}
- recordSkip() {}
- recordBeginSetDefault() {}
- recordSuccessfullySetDefault() {}
- }
+const NUX_SET_AS_DEFAULT_INTERACTIONS_COUNT =
+ Object.keys(NuxSetAsDefaultInteractions).length;
- /** @implements {welcome.NuxSetAsDefaultProxy} */
- class NuxSetAsDefaultProxyImpl {
- /** @override */
- requestDefaultBrowserState() {
- return cr.sendWithPromise('requestDefaultBrowserState');
- }
+/** @interface */
+export class NuxSetAsDefaultProxy {
+ /** @return {!Promise<!DefaultBrowserInfo>} */
+ requestDefaultBrowserState() {}
+ setAsDefault() {}
+ recordPageShown() {}
+ recordNavigatedAway() {}
+ recordNavigatedAwayThroughBrowserHistory() {}
+ recordSkip() {}
+ recordBeginSetDefault() {}
+ recordSuccessfullySetDefault() {}
+}
- /** @override */
- setAsDefault() {
- chrome.send('setAsDefaultBrowser');
- }
+/** @implements {NuxSetAsDefaultProxy} */
+export class NuxSetAsDefaultProxyImpl {
+ /** @override */
+ requestDefaultBrowserState() {
+ return sendWithPromise('requestDefaultBrowserState');
+ }
- /** @override */
- recordPageShown() {
- this.recordInteraction_(NuxSetAsDefaultInteractions.PageShown);
- }
+ /** @override */
+ setAsDefault() {
+ chrome.send('setAsDefaultBrowser');
+ }
- /** @override */
- recordNavigatedAway() {
- this.recordInteraction_(NuxSetAsDefaultInteractions.NavigatedAway);
- }
+ /** @override */
+ recordPageShown() {
+ this.recordInteraction_(NuxSetAsDefaultInteractions.PageShown);
+ }
- /** @override */
- recordNavigatedAwayThroughBrowserHistory() {
- this.recordInteraction_(
- NuxSetAsDefaultInteractions.NavigatedAwayThroughBrowserHistory);
- }
+ /** @override */
+ recordNavigatedAway() {
+ this.recordInteraction_(NuxSetAsDefaultInteractions.NavigatedAway);
+ }
- /** @override */
- recordSkip() {
- this.recordInteraction_(NuxSetAsDefaultInteractions.Skip);
- }
+ /** @override */
+ recordNavigatedAwayThroughBrowserHistory() {
+ this.recordInteraction_(
+ NuxSetAsDefaultInteractions.NavigatedAwayThroughBrowserHistory);
+ }
- /** @override */
- recordBeginSetDefault() {
- this.recordInteraction_(NuxSetAsDefaultInteractions.ClickSetDefault);
- }
+ /** @override */
+ recordSkip() {
+ this.recordInteraction_(NuxSetAsDefaultInteractions.Skip);
+ }
- /** @override */
- recordSuccessfullySetDefault() {
- this.recordInteraction_(
- NuxSetAsDefaultInteractions.SuccessfullySetDefault);
- }
+ /** @override */
+ recordBeginSetDefault() {
+ this.recordInteraction_(NuxSetAsDefaultInteractions.ClickSetDefault);
+ }
- /**
- * @param {number} interaction
- * @private
- */
- recordInteraction_(interaction) {
- chrome.metricsPrivate.recordEnumerationValue(
- NUX_SET_AS_DEFAULT_INTERACTION_METRIC_NAME, interaction,
- NUX_SET_AS_DEFAULT_INTERACTIONS_COUNT);
- }
+ /** @override */
+ recordSuccessfullySetDefault() {
+ this.recordInteraction_(NuxSetAsDefaultInteractions.SuccessfullySetDefault);
}
- cr.addSingletonGetter(NuxSetAsDefaultProxyImpl);
+ /**
+ * @param {number} interaction
+ * @private
+ */
+ recordInteraction_(interaction) {
+ chrome.metricsPrivate.recordEnumerationValue(
+ NUX_SET_AS_DEFAULT_INTERACTION_METRIC_NAME, interaction,
+ NUX_SET_AS_DEFAULT_INTERACTIONS_COUNT);
+ }
+}
- return {
- NuxSetAsDefaultProxy: NuxSetAsDefaultProxy,
- NuxSetAsDefaultProxyImpl: NuxSetAsDefaultProxyImpl,
- };
-});
+addSingletonGetter(NuxSetAsDefaultProxyImpl);
diff --git a/chromium/chrome/browser/resources/welcome/shared/BUILD.gn b/chromium/chrome/browser/resources/welcome/shared/BUILD.gn
index 9a06f4194e1..9ebc573c885 100644
--- a/chromium/chrome/browser/resources/welcome/shared/BUILD.gn
+++ b/chromium/chrome/browser/resources/welcome/shared/BUILD.gn
@@ -3,8 +3,14 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
+import("//tools/polymer/polymer.gni")
js_type_check("closure_compile") {
+ is_polymer3 = true
+ closure_flags = default_closure_args + [
+ "js_module_root=../../chrome/browser/resources/welcome/",
+ "js_module_root=gen/chrome/browser/resources/welcome/",
+ ]
deps = [
":bookmark_proxy",
":module_metrics_proxy",
@@ -15,7 +21,7 @@ js_type_check("closure_compile") {
js_library("bookmark_proxy") {
deps = [
- "//ui/webui/resources/js:cr",
+ "//ui/webui/resources/js:cr.m",
]
externs_list = [
"$externs_path/chrome_extensions.js",
@@ -24,17 +30,69 @@ js_library("bookmark_proxy") {
}
js_library("module_metrics_proxy") {
- deps = [
- "//ui/webui/resources/js:cr",
- ]
externs_list = [ "$externs_path/metrics_private.js" ]
}
js_library("nux_types") {
+}
+
+js_library("step_indicator") {
deps = [
- "//ui/webui/resources/js:cr",
+ ":nux_types",
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
]
}
-js_library("step_indicator") {
+polymer_modulizer("animations_css") {
+ js_file = "animations_css.js"
+ html_file = "animations_css.html"
+ html_type = "v3-ready"
+}
+
+polymer_modulizer("chooser_shared_css") {
+ js_file = "chooser_shared_css.js"
+ html_file = "chooser_shared_css.html"
+ html_type = "v3-ready"
+}
+
+polymer_modulizer("navi_colors_css") {
+ js_file = "navi_colors_css.js"
+ html_file = "navi_colors_css.html"
+ html_type = "v3-ready"
+}
+
+polymer_modulizer("action_link_style_css") {
+ js_file = "action_link_style_css.js"
+ html_file = "action_link_style_css.html"
+ html_type = "v3-ready"
+}
+
+polymer_modulizer("splash_pages_shared_css") {
+ js_file = "splash_pages_shared_css.js"
+ html_file = "splash_pages_shared_css.html"
+ html_type = "v3-ready"
+}
+
+polymer_modulizer("onboarding_background") {
+ js_file = "onboarding_background.js"
+ html_file = "onboarding_background.html"
+ html_type = "v3-ready"
+}
+
+polymer_modulizer("step_indicator") {
+ js_file = "step_indicator.js"
+ html_file = "step_indicator.html"
+ html_type = "v3-ready"
+}
+
+group("polymer3_elements") {
+ deps = [
+ ":action_link_style_css_module",
+ ":animations_css_module",
+ ":chooser_shared_css_module",
+ ":navi_colors_css_module",
+ ":onboarding_background_module",
+ ":splash_pages_shared_css_module",
+ ":step_indicator_module",
+ ]
}
diff --git a/chromium/chrome/browser/resources/welcome/shared/action_link_style.js b/chromium/chrome/browser/resources/welcome/shared/action_link_style.js
deleted file mode 100644
index b4e52c4ba58..00000000000
--- a/chromium/chrome/browser/resources/welcome/shared/action_link_style.js
+++ /dev/null
@@ -1,9 +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 Initiates focus-outline-manager for this document so that
- * action-link style can take advantage of it.
- */
-cr.ui.FocusOutlineManager.forDocument(document); \ No newline at end of file
diff --git a/chromium/chrome/browser/resources/welcome/shared/action_link_style_css.html b/chromium/chrome/browser/resources/welcome/shared/action_link_style_css.html
index 96d00fb8bcc..90f5c2ce76e 100644
--- a/chromium/chrome/browser/resources/welcome/shared/action_link_style_css.html
+++ b/chromium/chrome/browser/resources/welcome/shared/action_link_style_css.html
@@ -1,34 +1,24 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<template>
+ <style>
+ button.action-link {
+ -webkit-appearance: none;
+ background: none;
+ border: none;
+ color: var(--cr-link-color);
+ cursor: pointer;
+ display: inline-block;
+ font-family: inherit;
+ text-decoration: none;
+ }
-<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="chrome://resources/html/cr/ui/focus_outline_manager.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
+ button.action-link[disabled] {
+ color: var(--paper-grey-600);
+ cursor: default;
+ opacity: 0.65;
+ }
-<dom-module id="action-link-style">
- <template>
- <style>
- button.action-link {
- -webkit-appearance: none;
- background: none;
- border: none;
- color: var(--cr-link-color);
- cursor: pointer;
- display: inline-block;
- font-family: inherit;
- text-decoration: none;
- }
-
- button.action-link[disabled] {
- color: var(--paper-grey-600);
- cursor: default;
- opacity: 0.65;
- }
-
- :host-context(html:not(.focus-outline-visible)) button.action-link {
- outline: none;
- }
- </style>
- </template>
-</dom-module>
-
-<script src="action_link_style.js"></script>
+ :host-context(html:not(.focus-outline-visible)) button.action-link {
+ outline: none;
+ }
+ </style>
+</template>
diff --git a/chromium/chrome/browser/resources/welcome/shared/action_link_style_css.js b/chromium/chrome/browser/resources/welcome/shared/action_link_style_css.js
new file mode 100644
index 00000000000..c6259334546
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/shared/action_link_style_css.js
@@ -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 'chrome://resources/cr_elements/shared_vars_css.m.js';
+import 'chrome://resources/polymer/v3_0/paper-styles/color.js';
+import 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {FocusOutlineManager} from 'chrome://resources/js/cr/ui/focus_outline_manager.m.js';
+
+const styleElement = document.createElement('dom-module');
+styleElement.innerHTML = `{__html_template__}`;
+styleElement.register('action-link-style');
+
+// Initiate focus-outline-manager for this document so that action-link style
+// can take advantage of it.
+FocusOutlineManager.forDocument(document);
diff --git a/chromium/chrome/browser/resources/welcome/shared/animations_css.html b/chromium/chrome/browser/resources/welcome/shared/animations_css.html
index c79bd5443f6..268c0300275 100644
--- a/chromium/chrome/browser/resources/welcome/shared/animations_css.html
+++ b/chromium/chrome/browser/resources/welcome/shared/animations_css.html
@@ -1,39 +1,35 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<template>
+ <style>
+ @keyframes fade-in {
+ 0% { opacity: 0; }
+ 100% { opacity: 1; }
+ }
-<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); }
+ }
- @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;
+ }
- .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);
+ }
- .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>
+ :host-context(html[dir='rtl']) .slide-in {
+ --slide-in-length: -40px;
+ }
+ </style>
+</template>
diff --git a/chromium/chrome/browser/resources/welcome/shared/animations_css.js b/chromium/chrome/browser/resources/welcome/shared/animations_css.js
new file mode 100644
index 00000000000..5cdea0a637f
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/shared/animations_css.js
@@ -0,0 +1,9 @@
+// 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://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+const styleElement = document.createElement('dom-module');
+styleElement.innerHTML = `{__html_template__}`;
+styleElement.register('animations');
diff --git a/chromium/chrome/browser/resources/welcome/shared/bookmark_proxy.js b/chromium/chrome/browser/resources/welcome/shared/bookmark_proxy.js
index 42bf8060736..c90508462a0 100644
--- a/chromium/chrome/browser/resources/welcome/shared/bookmark_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/shared/bookmark_proxy.js
@@ -2,91 +2,85 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
+import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
+
+/**
+ * @typedef {{
+ * parentId: string,
+ * title: string,
+ * url: string,
+ * }}
+ */
+let bookmarkData;
+
+/** @interface */
+export class BookmarkProxy {
/**
- * @typedef {{
- * parentId: string,
- * title: string,
- * url: string,
- * }}
+ * @param {!bookmarkData} data
+ * @param {!Function} callback
*/
- let bookmarkData;
+ addBookmark(data, callback) {}
- /** @interface */
- class BookmarkProxy {
- /**
- * @param {!bookmarkData} data
- * @param {!Function} callback
- */
- addBookmark(data, callback) {}
+ /** @param {string} id ID provided by callback when bookmark was added. */
+ removeBookmark(id) {}
- /** @param {string} id ID provided by callback when bookmark was added. */
- removeBookmark(id) {}
+ /** @param {boolean} show */
+ toggleBookmarkBar(show) {}
- /** @param {boolean} show */
- toggleBookmarkBar(show) {}
+ /** @return {!Promise<boolean>} */
+ isBookmarkBarShown() {}
+}
- /** @return {!Promise<boolean>} */
- isBookmarkBarShown() {}
+/** @implements {BookmarkProxy} */
+export class BookmarkProxyImpl {
+ /** @override */
+ addBookmark(data, callback) {
+ chrome.bookmarks.create(data, callback);
}
- /** @implements {welcome.BookmarkProxy} */
- class BookmarkProxyImpl {
- /** @override */
- addBookmark(data, callback) {
- chrome.bookmarks.create(data, callback);
- }
-
- /** @override */
- removeBookmark(id) {
- chrome.bookmarks.remove(id);
- }
-
- /** @override */
- toggleBookmarkBar(show) {
- chrome.send('toggleBookmarkBar', [show]);
- }
-
- /** @override */
- isBookmarkBarShown() {
- return cr.sendWithPromise('isBookmarkBarShown');
- }
+ /** @override */
+ removeBookmark(id) {
+ chrome.bookmarks.remove(id);
}
- cr.addSingletonGetter(BookmarkProxyImpl);
-
- // Wrapper for bookmark proxy to keep some additional states.
- class BookmarkBarManager {
- constructor() {
- /** @private {welcome.BookmarkProxy} */
- this.proxy_ = BookmarkProxyImpl.getInstance();
-
- /** @private {boolean} */
- this.isBarShown_ = false;
-
- /** @type {!Promise} */
- this.initialized = this.proxy_.isBookmarkBarShown().then(shown => {
- this.isBarShown_ = shown;
- });
- }
-
- /** @return {boolean} */
- getShown() {
- return this.isBarShown_;
- }
-
- /** @param {boolean} show */
- setShown(show) {
- this.isBarShown_ = show;
- this.proxy_.toggleBookmarkBar(show);
- }
+ /** @override */
+ toggleBookmarkBar(show) {
+ chrome.send('toggleBookmarkBar', [show]);
}
- cr.addSingletonGetter(BookmarkBarManager);
+ /** @override */
+ isBookmarkBarShown() {
+ return sendWithPromise('isBookmarkBarShown');
+ }
+}
+
+addSingletonGetter(BookmarkProxyImpl);
+
+// Wrapper for bookmark proxy to keep some additional states.
+export class BookmarkBarManager {
+ constructor() {
+ /** @private {BookmarkProxy} */
+ this.proxy_ = BookmarkProxyImpl.getInstance();
+
+ /** @private {boolean} */
+ this.isBarShown_ = false;
+
+ /** @type {!Promise} */
+ this.initialized = this.proxy_.isBookmarkBarShown().then(shown => {
+ this.isBarShown_ = shown;
+ });
+ }
+
+ /** @return {boolean} */
+ getShown() {
+ return this.isBarShown_;
+ }
+
+ /** @param {boolean} show */
+ setShown(show) {
+ this.isBarShown_ = show;
+ this.proxy_.toggleBookmarkBar(show);
+ }
+}
- return {
- BookmarkProxy: BookmarkProxy,
- BookmarkProxyImpl: BookmarkProxyImpl,
- BookmarkBarManager: BookmarkBarManager,
- };
-});
+addSingletonGetter(BookmarkBarManager);
diff --git a/chromium/chrome/browser/resources/welcome/shared/chooser_shared_css.html b/chromium/chrome/browser/resources/welcome/shared/chooser_shared_css.html
index 52b75a13193..d7346722deb 100644
--- a/chromium/chrome/browser/resources/welcome/shared/chooser_shared_css.html
+++ b/chromium/chrome/browser/resources/welcome/shared/chooser_shared_css.html
@@ -1,43 +1,35 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<template>
+ <style include="navi-colors-css">
+ .option {
+ background: var(--cr-card-background-color);
+ border: 1px solid var(--navi-border-color);
+ color: var(--cr-primary-text-color);
+ cursor: pointer;
+ flex-direction: column;
+ }
-<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
-<link rel="import" href="navi_colors_css.html">
+ .option:hover {
+ box-shadow: var(--navi-option-box-shadow);
+ }
-<dom-module id="chooser-shared-css">
- <template>
- <style include="navi-colors-css">
- .option {
- background: var(--cr-card-background-color);
- border: 1px solid var(--navi-border-color);
- color: var(--cr-primary-text-color);
- cursor: pointer;
- flex-direction: column;
- }
+ .option-name {
+ font-size: .875rem;
+ }
- .option:hover {
- box-shadow: var(--navi-option-box-shadow);
- }
+ .button-bar {
+ display: flex;
+ justify-content: space-between;
+ }
- .option-name {
- font-size: .875rem;
- }
+ :host-context([dir=rtl]) iron-icon[icon='cr:chevron-right'] {
+ transform: scaleX(-1);
+ }
- .button-bar {
- display: flex;
- justify-content: space-between;
- }
-
- :host-context([dir=rtl]) iron-icon[icon='cr:chevron-right'] {
- transform: scaleX(-1);
- }
-
- iron-icon[icon='cr:chevron-right'] {
- height: 1.25rem;
- margin-inline-end: -.625rem;
- margin-inline-start: .375rem;
- width: 1.25rem;
- }
- </style>
- </template>
-</dom-module>
+ iron-icon[icon='cr:chevron-right'] {
+ height: 1.25rem;
+ margin-inline-end: -.625rem;
+ margin-inline-start: .375rem;
+ width: 1.25rem;
+ }
+ </style>
+</template>
diff --git a/chromium/chrome/browser/resources/welcome/shared/chooser_shared_css.js b/chromium/chrome/browser/resources/welcome/shared/chooser_shared_css.js
new file mode 100644
index 00000000000..6f2044bc1d3
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/shared/chooser_shared_css.js
@@ -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.
+
+import 'chrome://resources/cr_elements/shared_vars_css.m.js';
+import 'chrome://resources/cr_elements/md_select_css.m.js';
+import './navi_colors_css.js';
+
+import 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+const styleElement = document.createElement('dom-module');
+styleElement.innerHTML = `{__html_template__}`;
+styleElement.register('chooser-shared-css');
diff --git a/chromium/chrome/browser/resources/welcome/shared/i18n_setup.html b/chromium/chrome/browser/resources/welcome/shared/i18n_setup.html
deleted file mode 100644
index c505b2c1365..00000000000
--- a/chromium/chrome/browser/resources/welcome/shared/i18n_setup.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<script src="chrome://resources/js/load_time_data.js"></script>
-<script src="../strings.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/shared/module_metrics_proxy.html b/chromium/chrome/browser/resources/welcome/shared/module_metrics_proxy.html
deleted file mode 100644
index 5c10f79489a..00000000000
--- a/chromium/chrome/browser/resources/welcome/shared/module_metrics_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="module_metrics_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/shared/module_metrics_proxy.js b/chromium/chrome/browser/resources/welcome/shared/module_metrics_proxy.js
index d6a437b7163..75819f2e515 100644
--- a/chromium/chrome/browser/resources/welcome/shared/module_metrics_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/shared/module_metrics_proxy.js
@@ -2,241 +2,228 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
+/**
+ * NuxNtpBackgroundInteractions enum.
+ * These values are persisted to logs and should not be renumbered or
+ * re-used.
+ * See tools/metrics/histograms/enums.xml.
+ * @enum {number}
+ */
+export const NuxNtpBackgroundInteractions = {
+ PageShown: 0,
+ DidNothingAndNavigatedAway: 1,
+ DidNothingAndChoseSkip: 2,
+ DidNothingAndChoseNext: 3,
+ ChoseAnOptionAndNavigatedAway: 4,
+ ChoseAnOptionAndChoseSkip: 5,
+ ChoseAnOptionAndChoseNext: 6,
+ NavigatedAwayThroughBrowserHistory: 7,
+ BackgroundImageFailedToLoad: 8,
+ BackgroundImageNeverLoaded: 9,
+};
+
+/**
+ * NuxGoogleAppsInteractions enum.
+ * These values are persisted to logs and should not be renumbered or
+ * re-used.
+ * See tools/metrics/histograms/enums.xml.
+ * @enum {number}
+ */
+export const NuxGoogleAppsInteractions = {
+ PageShown: 0,
+ NotUsed_DEPRECATED: 1,
+ GetStarted_DEPRECATED: 2,
+ DidNothingAndNavigatedAway: 3,
+ DidNothingAndChoseSkip: 4,
+ ChoseAnOptionAndNavigatedAway: 5,
+ ChoseAnOptionAndChoseSkip: 6,
+ ChoseAnOptionAndChoseNext: 7,
+ ClickedDisabledNextButtonAndNavigatedAway: 8,
+ ClickedDisabledNextButtonAndChoseSkip: 9,
+ ClickedDisabledNextButtonAndChoseNext: 10,
+ DidNothingAndChoseNext: 11,
+ NavigatedAwayThroughBrowserHistory: 12,
+};
+
+/** @interface */
+class ModuleMetricsProxy {
+ recordPageShown() {}
+
+ recordDidNothingAndNavigatedAway() {}
+
+ recordDidNothingAndChoseSkip() {}
+
+ recordDidNothingAndChoseNext() {}
+
+ recordChoseAnOptionAndNavigatedAway() {}
+
+ recordChoseAnOptionAndChoseSkip() {}
+
+ recordChoseAnOptionAndChoseNext() {}
+
+ recordClickedDisabledNextButtonAndNavigatedAway() {}
+
+ recordClickedDisabledNextButtonAndChoseSkip() {}
+
+ recordClickedDisabledNextButtonAndChoseNext() {}
+
+ recordNavigatedAwayThroughBrowserHistory() {}
+}
+
+/** @implements {ModuleMetricsProxy} */
+export class ModuleMetricsProxyImpl {
/**
- * NuxNtpBackgroundInteractions enum.
- * These values are persisted to logs and should not be renumbered or
- * re-used.
- * See tools/metrics/histograms/enums.xml.
- * @enum {number}
+ * @param {string} histogramName The histogram that will record the module
+ * navigation metrics.
*/
- const NuxNtpBackgroundInteractions = {
- PageShown: 0,
- DidNothingAndNavigatedAway: 1,
- DidNothingAndChoseSkip: 2,
- DidNothingAndChoseNext: 3,
- ChoseAnOptionAndNavigatedAway: 4,
- ChoseAnOptionAndChoseSkip: 5,
- ChoseAnOptionAndChoseNext: 6,
- NavigatedAwayThroughBrowserHistory: 7,
- BackgroundImageFailedToLoad: 8,
- BackgroundImageNeverLoaded: 9,
- };
-
- /**
- * NuxGoogleAppsInteractions enum.
- * These values are persisted to logs and should not be renumbered or
- * re-used.
- * See tools/metrics/histograms/enums.xml.
- * @enum {number}
- */
- const NuxGoogleAppsInteractions = {
- PageShown: 0,
- NotUsed_DEPRECATED: 1,
- GetStarted_DEPRECATED: 2,
- DidNothingAndNavigatedAway: 3,
- DidNothingAndChoseSkip: 4,
- ChoseAnOptionAndNavigatedAway: 5,
- ChoseAnOptionAndChoseSkip: 6,
- ChoseAnOptionAndChoseNext: 7,
- ClickedDisabledNextButtonAndNavigatedAway: 8,
- ClickedDisabledNextButtonAndChoseSkip: 9,
- ClickedDisabledNextButtonAndChoseNext: 10,
- DidNothingAndChoseNext: 11,
- NavigatedAwayThroughBrowserHistory: 12,
- };
-
- /** @interface */
- class ModuleMetricsProxy {
- recordPageShown() {}
-
- recordDidNothingAndNavigatedAway() {}
-
- recordDidNothingAndChoseSkip() {}
-
- recordDidNothingAndChoseNext() {}
-
- recordChoseAnOptionAndNavigatedAway() {}
-
- recordChoseAnOptionAndChoseSkip() {}
-
- recordChoseAnOptionAndChoseNext() {}
-
- recordClickedDisabledNextButtonAndNavigatedAway() {}
-
- recordClickedDisabledNextButtonAndChoseSkip() {}
-
- recordClickedDisabledNextButtonAndChoseNext() {}
-
- recordNavigatedAwayThroughBrowserHistory() {}
+ constructor(histogramName, interactions) {
+ /** @private {string} */
+ this.interactionMetric_ = histogramName;
+ this.interactions_ = interactions;
}
- /** @implements {welcome.ModuleMetricsProxy} */
- class ModuleMetricsProxyImpl {
- /**
- * @param {string} histogramName The histogram that will record the module
- * navigation metrics.
- */
- constructor(histogramName, interactions) {
- /** @private {string} */
- this.interactionMetric_ = histogramName;
- this.interactions_ = interactions;
- }
-
- /** @override */
- recordPageShown() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_, this.interactions_.PageShown,
- Object.keys(this.interactions_).length);
- }
-
- /** @override */
- recordDidNothingAndNavigatedAway() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_,
- this.interactions_.DidNothingAndNavigatedAway,
- Object.keys(this.interactions_).length);
- }
-
- /** @override */
- recordDidNothingAndChoseSkip() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_, this.interactions_.DidNothingAndChoseSkip,
- Object.keys(this.interactions_).length);
- }
+ /** @override */
+ recordPageShown() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_, this.interactions_.PageShown,
+ Object.keys(this.interactions_).length);
+ }
- /** @override */
- recordDidNothingAndChoseNext() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_, this.interactions_.DidNothingAndChoseNext,
- Object.keys(this.interactions_).length);
- }
+ /** @override */
+ recordDidNothingAndNavigatedAway() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_, this.interactions_.DidNothingAndNavigatedAway,
+ Object.keys(this.interactions_).length);
+ }
- /** @override */
- recordChoseAnOptionAndNavigatedAway() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_,
- this.interactions_.ChoseAnOptionAndNavigatedAway,
- Object.keys(this.interactions_).length);
- }
+ /** @override */
+ recordDidNothingAndChoseSkip() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_, this.interactions_.DidNothingAndChoseSkip,
+ Object.keys(this.interactions_).length);
+ }
- /** @override */
- recordChoseAnOptionAndChoseSkip() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_, this.interactions_.ChoseAnOptionAndChoseSkip,
- Object.keys(this.interactions_).length);
- }
+ /** @override */
+ recordDidNothingAndChoseNext() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_, this.interactions_.DidNothingAndChoseNext,
+ Object.keys(this.interactions_).length);
+ }
- /** @override */
- recordChoseAnOptionAndChoseNext() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_, this.interactions_.ChoseAnOptionAndChoseNext,
- Object.keys(this.interactions_).length);
- }
+ /** @override */
+ recordChoseAnOptionAndNavigatedAway() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_,
+ this.interactions_.ChoseAnOptionAndNavigatedAway,
+ Object.keys(this.interactions_).length);
+ }
- /** @override */
- recordClickedDisabledNextButtonAndNavigatedAway() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_,
- this.interactions_.ClickedDisabledNextButtonAndNavigatedAway,
- Object.keys(this.interactions_).length);
- }
+ /** @override */
+ recordChoseAnOptionAndChoseSkip() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_, this.interactions_.ChoseAnOptionAndChoseSkip,
+ Object.keys(this.interactions_).length);
+ }
- /** @override */
- recordClickedDisabledNextButtonAndChoseSkip() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_,
- this.interactions_.ClickedDisabledNextButtonAndChoseSkip,
- Object.keys(this.interactions_).length);
- }
+ /** @override */
+ recordChoseAnOptionAndChoseNext() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_, this.interactions_.ChoseAnOptionAndChoseNext,
+ Object.keys(this.interactions_).length);
+ }
- /** @override */
- recordClickedDisabledNextButtonAndChoseNext() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_,
- this.interactions_.ClickedDisabledNextButtonAndChoseNext,
- Object.keys(this.interactions_).length);
- }
+ /** @override */
+ recordClickedDisabledNextButtonAndNavigatedAway() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_,
+ this.interactions_.ClickedDisabledNextButtonAndNavigatedAway,
+ Object.keys(this.interactions_).length);
+ }
- /** @override */
- recordNavigatedAwayThroughBrowserHistory() {
- chrome.metricsPrivate.recordEnumerationValue(
- this.interactionMetric_,
- this.interactions_.NavigatedAwayThroughBrowserHistory,
- Object.keys(this.interactions_).length);
- }
+ /** @override */
+ recordClickedDisabledNextButtonAndChoseSkip() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_,
+ this.interactions_.ClickedDisabledNextButtonAndChoseSkip,
+ Object.keys(this.interactions_).length);
}
- class ModuleMetricsManager {
- /** @param {welcome.ModuleMetricsProxy} metricsProxy */
- constructor(metricsProxy) {
- this.metricsProxy_ = metricsProxy;
-
- this.options_ = {
- didNothing: {
- andNavigatedAway: metricsProxy.recordDidNothingAndNavigatedAway,
- andChoseSkip: metricsProxy.recordDidNothingAndChoseSkip,
- andChoseNext: metricsProxy.recordDidNothingAndChoseNext,
- },
- choseAnOption: {
- andNavigatedAway: metricsProxy.recordChoseAnOptionAndNavigatedAway,
- andChoseSkip: metricsProxy.recordChoseAnOptionAndChoseSkip,
- andChoseNext: metricsProxy.recordChoseAnOptionAndChoseNext,
- },
- clickedDisabledNextButton: {
- andNavigatedAway:
- metricsProxy.recordClickedDisabledNextButtonAndNavigatedAway,
- andChoseSkip:
- metricsProxy.recordClickedDisabledNextButtonAndChoseSkip,
- andChoseNext:
- metricsProxy.recordClickedDisabledNextButtonAndChoseNext,
- },
- };
-
- this.firstPart = this.options_.didNothing;
- }
+ /** @override */
+ recordClickedDisabledNextButtonAndChoseNext() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_,
+ this.interactions_.ClickedDisabledNextButtonAndChoseNext,
+ Object.keys(this.interactions_).length);
+ }
- recordPageInitialized() {
- this.metricsProxy_.recordPageShown();
- this.firstPart = this.options_.didNothing;
- }
+ /** @override */
+ recordNavigatedAwayThroughBrowserHistory() {
+ chrome.metricsPrivate.recordEnumerationValue(
+ this.interactionMetric_,
+ this.interactions_.NavigatedAwayThroughBrowserHistory,
+ Object.keys(this.interactions_).length);
+ }
+}
+
+export class ModuleMetricsManager {
+ /** @param {ModuleMetricsProxy} metricsProxy */
+ constructor(metricsProxy) {
+ this.metricsProxy_ = metricsProxy;
+
+ this.options_ = {
+ didNothing: {
+ andNavigatedAway: metricsProxy.recordDidNothingAndNavigatedAway,
+ andChoseSkip: metricsProxy.recordDidNothingAndChoseSkip,
+ andChoseNext: metricsProxy.recordDidNothingAndChoseNext,
+ },
+ choseAnOption: {
+ andNavigatedAway: metricsProxy.recordChoseAnOptionAndNavigatedAway,
+ andChoseSkip: metricsProxy.recordChoseAnOptionAndChoseSkip,
+ andChoseNext: metricsProxy.recordChoseAnOptionAndChoseNext,
+ },
+ clickedDisabledNextButton: {
+ andNavigatedAway:
+ metricsProxy.recordClickedDisabledNextButtonAndNavigatedAway,
+ andChoseSkip: metricsProxy.recordClickedDisabledNextButtonAndChoseSkip,
+ andChoseNext: metricsProxy.recordClickedDisabledNextButtonAndChoseNext,
+ },
+ };
+
+ this.firstPart = this.options_.didNothing;
+ }
- recordClickedOption() {
- // Only overwrite this.firstPart if it's not overwritten already
- if (this.firstPart == this.options_.didNothing) {
- this.firstPart = this.options_.choseAnOption;
- }
- }
+ recordPageInitialized() {
+ this.metricsProxy_.recordPageShown();
+ this.firstPart = this.options_.didNothing;
+ }
- recordClickedDisabledButton() {
- // Only overwrite this.firstPart if it's not overwritten already
- if (this.firstPart == this.options_.didNothing) {
- this.firstPart = this.options_.clickedDisabledNextButton;
- }
+ recordClickedOption() {
+ // Only overwrite this.firstPart if it's not overwritten already
+ if (this.firstPart == this.options_.didNothing) {
+ this.firstPart = this.options_.choseAnOption;
}
+ }
- recordNoThanks() {
- this.firstPart.andChoseSkip.call(this.metricsProxy_);
+ recordClickedDisabledButton() {
+ // Only overwrite this.firstPart if it's not overwritten already
+ if (this.firstPart == this.options_.didNothing) {
+ this.firstPart = this.options_.clickedDisabledNextButton;
}
+ }
- recordGetStarted() {
- this.firstPart.andChoseNext.call(this.metricsProxy_);
- }
+ recordNoThanks() {
+ this.firstPart.andChoseSkip.call(this.metricsProxy_);
+ }
- recordNavigatedAway() {
- this.firstPart.andNavigatedAway.call(this.metricsProxy_);
- }
+ recordGetStarted() {
+ this.firstPart.andChoseNext.call(this.metricsProxy_);
+ }
- recordBrowserBackOrForward() {
- this.metricsProxy_.recordNavigatedAwayThroughBrowserHistory();
- }
+ recordNavigatedAway() {
+ this.firstPart.andNavigatedAway.call(this.metricsProxy_);
}
- return {
- ModuleMetricsManager: ModuleMetricsManager,
- ModuleMetricsProxyImpl: ModuleMetricsProxyImpl,
- ModuleMetricsProxy: ModuleMetricsProxy,
- NuxGoogleAppsInteractions: NuxGoogleAppsInteractions,
- NuxNtpBackgroundInteractions: NuxNtpBackgroundInteractions,
- };
-});
+ recordBrowserBackOrForward() {
+ this.metricsProxy_.recordNavigatedAwayThroughBrowserHistory();
+ }
+}
diff --git a/chromium/chrome/browser/resources/welcome/shared/navi_colors_css.html b/chromium/chrome/browser/resources/welcome/shared/navi_colors_css.html
index 99846f3120f..403ee035ba4 100644
--- a/chromium/chrome/browser/resources/welcome/shared/navi_colors_css.html
+++ b/chromium/chrome/browser/resources/welcome/shared/navi_colors_css.html
@@ -1,51 +1,44 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<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-color:
+ rgba(var(--google-blue-600-rgb), .5);
+ --navi-step-indicator-color: var(--google-grey-200);
+ --navi-wallpaper-text-color: var(--google-grey-refresh-700);
+ }
-<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
-
-<dom-module id="navi-colors-css">
- <template>
- <style>
+ @media (prefers-color-scheme: dark) {
: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-color:
- rgba(var(--google-blue-600-rgb), .5);
- --navi-step-indicator-color: var(--google-grey-200);
- --navi-wallpaper-text-color: var(--google-grey-refresh-700);
- }
-
- @media (prefers-color-scheme: dark) {
- :host {
- --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-color: var(--google-blue-refresh-300);
- --navi-step-indicator-color: var(--google-grey-refresh-500);
- --navi-wallpaper-text-color: var(--google-grey-200);
- }
+ --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-color: 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>
+ }
+ </style>
+</template>
diff --git a/chromium/chrome/browser/resources/welcome/shared/navi_colors_css.js b/chromium/chrome/browser/resources/welcome/shared/navi_colors_css.js
new file mode 100644
index 00000000000..f803f2d1757
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/shared/navi_colors_css.js
@@ -0,0 +1,12 @@
+// 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://resources/cr_elements/shared_vars_css.m.js';
+import 'chrome://resources/cr_elements/md_select_css.m.js';
+
+import 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+const styleElement = document.createElement('dom-module');
+styleElement.innerHTML = `{__html_template__}`;
+styleElement.register('navi-colors-css');
diff --git a/chromium/chrome/browser/resources/welcome/shared/nux_types.js b/chromium/chrome/browser/resources/welcome/shared/nux_types.js
index d8fd86dfc57..3c8be494718 100644
--- a/chromium/chrome/browser/resources/welcome/shared/nux_types.js
+++ b/chromium/chrome/browser/resources/welcome/shared/nux_types.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.exportPath('welcome');
-
/**
* @typedef {{
* id: number,
@@ -12,7 +10,7 @@ cr.exportPath('welcome');
* url: string,
* }}
*/
-welcome.BookmarkListItem;
+export let BookmarkListItem;
/**
* @typedef {{
@@ -20,7 +18,7 @@ welcome.BookmarkListItem;
* active: number,
* }}
*/
-welcome.stepIndicatorModel;
+export let stepIndicatorModel;
/**
* TODO(hcarmona): somehow reuse from
@@ -32,4 +30,4 @@ welcome.stepIndicatorModel;
* isUnknownError: boolean,
* }};
*/
-welcome.DefaultBrowserInfo;
+export let DefaultBrowserInfo;
diff --git a/chromium/chrome/browser/resources/welcome/shared/onboarding_background.html b/chromium/chrome/browser/resources/welcome/shared/onboarding_background.html
index 643c8eff8ee..e51c6d933b4 100644
--- a/chromium/chrome/browser/resources/welcome/shared/onboarding_background.html
+++ b/chromium/chrome/browser/resources/welcome/shared/onboarding_background.html
@@ -1,187 +1,180 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<dom-module id="onboarding-background">
- <template>
- <style>
- @keyframes blue-circle-anim-x {
- 50% {
- animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transform: translateX(44px);
- }
- }
-
- @keyframes blue-circle-anim-y {
- 50% {
- animation-timing-function: cubic-bezier(0.55, 0, 0.2, 1);
- transform: translateY(17px);
- }
- }
-
- @keyframes green-rectangle-anim {
- 100% {
- transform: rotate(360deg);
- }
- }
-
- @keyframes red-triangle-anim {
- 50% {
- animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transform: translateY(25px) rotate(-53deg);
- }
- }
-
- @keyframes yellow-semicircle-anim {
- 40% {
- animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transform: translateY(40px) rotate(-1deg);
- }
- }
-
- @keyframes grey-rounded-rectangle-anim {
- 65% {
- animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transform: translateY(-48px) rotate(-75deg);
- }
- }
-
- :host {
- bottom: 0;
- left: 0;
- margin: auto;
- overflow: hidden;
- position: absolute;
- right: 0;
- top: 0;
- z-index: -1;
- }
-
- /* The container is necessary in order for :host to hide overflowing SVGs
- correctly without disturbing their positions. */
- #container {
- height: 100%;
- left: 50%;
- min-height: 700px;
- min-width: 1024px;
- position: absolute;
- top: 50%;
- transform: translate(-50%, -50%);
- width: 100%;
- }
-
- img,
- span {
- position: absolute;
- }
-
- #blue-circle-container {
- animation: blue-circle-anim-x 9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
- left: calc(13% - 50px); /* Relative to #yellow-dots. */
- top: calc(18% - 26px); /* Relative to #yellow-dots. */
- }
-
- #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;
- 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;
- }
-
- @media (prefers-color-scheme: dark) {
- #grey-oval {
- mix-blend-mode: screen;
- }
- }
- </style>
- <div id="container">
- <!-- Using span as container for an :after element that actually contains
- 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>
- <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>
-</dom-module>
+<style>
+ @keyframes blue-circle-anim-x {
+ 50% {
+ animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
+ transform: translateX(44px);
+ }
+ }
+
+ @keyframes blue-circle-anim-y {
+ 50% {
+ animation-timing-function: cubic-bezier(0.55, 0, 0.2, 1);
+ transform: translateY(17px);
+ }
+ }
+
+ @keyframes green-rectangle-anim {
+ 100% {
+ transform: rotate(360deg);
+ }
+ }
+
+ @keyframes red-triangle-anim {
+ 50% {
+ animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
+ transform: translateY(25px) rotate(-53deg);
+ }
+ }
+
+ @keyframes yellow-semicircle-anim {
+ 40% {
+ animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
+ transform: translateY(40px) rotate(-1deg);
+ }
+ }
+
+ @keyframes grey-rounded-rectangle-anim {
+ 65% {
+ animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
+ transform: translateY(-48px) rotate(-75deg);
+ }
+ }
+
+ :host {
+ bottom: 0;
+ left: 0;
+ margin: auto;
+ overflow: hidden;
+ position: absolute;
+ right: 0;
+ top: 0;
+ z-index: -1;
+ }
+
+ /* The container is necessary in order for :host to hide overflowing SVGs
+ correctly without disturbing their positions. */
+ #container {
+ height: 100%;
+ left: 50%;
+ min-height: 700px;
+ min-width: 1024px;
+ position: absolute;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ width: 100%;
+ }
+
+ img,
+ span {
+ position: absolute;
+ }
+
+ #blue-circle-container {
+ animation: blue-circle-anim-x 9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
+ left: calc(13% - 50px); /* Relative to #yellow-dots. */
+ top: calc(18% - 26px); /* Relative to #yellow-dots. */
+ }
+
+ #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;
+ 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;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ #grey-oval {
+ mix-blend-mode: screen;
+ }
+ }
+</style>
+<div id="container">
+ <!-- Using span as container for an :after element that actually contains
+ 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>
+ <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>
diff --git a/chromium/chrome/browser/resources/welcome/shared/onboarding_background.js b/chromium/chrome/browser/resources/welcome/shared/onboarding_background.js
index 12358fa84c5..98f2999cd60 100644
--- a/chromium/chrome/browser/resources/welcome/shared/onboarding_background.js
+++ b/chromium/chrome/browser/resources/welcome/shared/onboarding_background.js
@@ -6,6 +6,11 @@
* @fileoverview This element contains a set of SVGs that together acts as an
* animated and responsive background for any page that contains it.
*/
+
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
Polymer({
is: 'onboarding-background',
-}); \ No newline at end of file
+
+ _template: html`{__html_template__}`,
+});
diff --git a/chromium/chrome/browser/resources/welcome/shared/splash_pages_shared_css.html b/chromium/chrome/browser/resources/welcome/shared/splash_pages_shared_css.html
index 3d662b4dac4..8d2c1b78f0d 100644
--- a/chromium/chrome/browser/resources/welcome/shared/splash_pages_shared_css.html
+++ b/chromium/chrome/browser/resources/welcome/shared/splash_pages_shared_css.html
@@ -1,55 +1,48 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<template>
+ <style include="navi-colors-css">
+ #container {
+ align-items: center;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ margin: auto;
+ min-height: 100%;
+ min-width: 800px;
+ position: relative;
+ }
-<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="navi_colors_css.html">
+ h1 {
+ color: var(--cr-primary-text-color);
+ font-size: 4rem;
+ margin-bottom: 40px;
+ margin-top: 16px;
+ text-align: center;
+ }
-<dom-module id="splash-pages-shared-css">
- <template>
- <style include="navi-colors-css">
- #container {
- align-items: center;
- display: flex;
- flex-direction: column;
- justify-content: center;
- margin: auto;
- min-height: 100%;
- min-width: 800px;
- position: relative;
- }
+ h2 {
+ color: var(--cr-secondary-text-color);
+ font-size: 1.5rem;
+ font-weight: 500;
+ line-height: 2.25rem;
+ margin: 0;
+ opacity: 0.8;
+ text-align: center;
+ }
- h1 {
- color: var(--cr-primary-text-color);
- font-size: 4rem;
- margin-bottom: 40px;
- margin-top: 16px;
- text-align: center;
- }
+ cr-button {
+ font-size: 1rem;
+ height: 3rem;
+ padding-bottom: 12px;
+ padding-top: 12px;
+ text-align: center;
+ white-space: nowrap;
+ width: 256px;
+ }
- h2 {
- color: var(--cr-secondary-text-color);
- font-size: 1.5rem;
- font-weight: 500;
- line-height: 2.25rem;
- margin: 0;
- opacity: 0.8;
- text-align: center;
- }
-
- cr-button {
- font-size: 1rem;
- height: 3rem;
- padding-bottom: 12px;
- padding-top: 12px;
- text-align: center;
- white-space: nowrap;
- width: 256px;
- }
-
- .action-link {
- font-size: 1rem;
- font-weight: 500;
- margin-top: 24px;
- }
- </style>
- </template>
-</dom-module>
+ .action-link {
+ font-size: 1rem;
+ font-weight: 500;
+ margin-top: 24px;
+ }
+ </style>
+</template>
diff --git a/chromium/chrome/browser/resources/welcome/shared/splash_pages_shared_css.js b/chromium/chrome/browser/resources/welcome/shared/splash_pages_shared_css.js
new file mode 100644
index 00000000000..896d7adc612
--- /dev/null
+++ b/chromium/chrome/browser/resources/welcome/shared/splash_pages_shared_css.js
@@ -0,0 +1,12 @@
+// 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://resources/cr_elements/shared_vars_css.m.js';
+import './navi_colors_css.js';
+
+import 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+const styleElement = document.createElement('dom-module');
+styleElement.innerHTML = `{__html_template__}`;
+styleElement.register('splash-pages-shared-css');
diff --git a/chromium/chrome/browser/resources/welcome/shared/step_indicator.html b/chromium/chrome/browser/resources/welcome/shared/step_indicator.html
index 4123eb53301..4caec81cbe7 100644
--- a/chromium/chrome/browser/resources/welcome/shared/step_indicator.html
+++ b/chromium/chrome/browser/resources/welcome/shared/step_indicator.html
@@ -1,32 +1,22 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<style include="navi-colors-css">
+ :host {
+ align-items: center;
+ display: flex;
+ }
-<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-<link rel="import" href="navi_colors_css.html">
+ span {
+ background: var(--navi-step-indicator-color);
+ border-radius: 50%;
+ display: inline-block;
+ height: 8px;
+ margin: 0 4px;
+ width: 8px;
+ }
-<dom-module id="step-indicator">
- <template>
- <style include="navi-colors-css">
- :host {
- align-items: center;
- display: flex;
- }
-
- span {
- background: var(--navi-step-indicator-color);
- border-radius: 50%;
- display: inline-block;
- height: 8px;
- margin: 0 4px;
- width: 8px;
- }
-
- span.active {
- background: var(--navi-step-indicator-active-color);
- }
- </style>
- <template is="dom-repeat" items="[[dots_]]">
- <span class$="[[getActiveClass_(index, model.active)]]"></span>
- </template>
- </template>
- <script src="step_indicator.js"></script>
-</dom-module>
+ span.active {
+ background: var(--navi-step-indicator-active-color);
+ }
+</style>
+<template is="dom-repeat" items="[[dots_]]">
+ <span class$="[[getActiveClass_(index, model.active)]]"></span>
+</template>
diff --git a/chromium/chrome/browser/resources/welcome/shared/step_indicator.js b/chromium/chrome/browser/resources/welcome/shared/step_indicator.js
index 4af45dc89f1..8d4b45c0ff5 100644
--- a/chromium/chrome/browser/resources/welcome/shared/step_indicator.js
+++ b/chromium/chrome/browser/resources/welcome/shared/step_indicator.js
@@ -6,11 +6,20 @@
* @fileoverview This element contains a set of SVGs that together acts as an
* animated and responsive background for any page that contains it.
*/
+import 'chrome://resources/cr_elements/shared_vars_css.m.js';
+import './navi_colors_css.js';
+
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {stepIndicatorModel} from './nux_types.js';
+
Polymer({
is: 'step-indicator',
+ _template: html`{__html_template__}`,
+
properties: {
- /** @type {welcome.stepIndicatorModel} */
+ /** @type {stepIndicatorModel} */
model: Object,
/** @private */
diff --git a/chromium/chrome/browser/resources/welcome/signin_view.html b/chromium/chrome/browser/resources/welcome/signin_view.html
index d5fc11e623e..61fa2673b8c 100644
--- a/chromium/chrome/browser/resources/welcome/signin_view.html
+++ b/chromium/chrome/browser/resources/welcome/signin_view.html
@@ -1,38 +1,20 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<style include="animations action-link-style splash-pages-shared-css">
+ onboarding-background {
+ --animation-delay: 150ms;
+ }
-<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.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">
-<link rel="import" href="signin_view_proxy.html">
-<link rel="import" href="welcome_browser_proxy.html">
-
-<dom-module id="signin-view">
- <template>
- <style include="animations action-link-style splash-pages-shared-css">
- onboarding-background {
- --animation-delay: 150ms;
- }
-
- h1 {
- outline: none;
- }
- </style>
- <div id="container">
- <onboarding-background class="fade-in"></onboarding-background>
- <h2>$i18n{signInSubHeader}</h2>
- <h1 tabindex="-1">$i18n{signInHeader}</h1>
- <cr-button class="action-button" on-click="onSignInClick_">
- $i18n{signIn}
- </cr-button>
- <button class="action-link" on-click="onNoThanksClick_">
- $i18n{noThanks}
- </button>
- </div>
- </template>
- <script src="signin_view.js"></script>
-</dom-module>
+ h1 {
+ outline: none;
+ }
+</style>
+<div id="container">
+ <onboarding-background class="fade-in"></onboarding-background>
+ <h2>$i18n{signInSubHeader}</h2>
+ <h1 tabindex="-1">$i18n{signInHeader}</h1>
+ <cr-button class="action-button" on-click="onSignInClick_">
+ $i18n{signIn}
+ </cr-button>
+ <button class="action-link" on-click="onNoThanksClick_">
+ $i18n{noThanks}
+ </button>
+</div>
diff --git a/chromium/chrome/browser/resources/welcome/signin_view.js b/chromium/chrome/browser/resources/welcome/signin_view.js
index 15096824fc1..b0c8befc300 100644
--- a/chromium/chrome/browser/resources/welcome/signin_view.js
+++ b/chromium/chrome/browser/resources/welcome/signin_view.js
@@ -2,24 +2,40 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
+import 'chrome://resources/polymer/v3_0/paper-styles/color.js';
+import './shared/action_link_style_css.js';
+import './shared/animations_css.js';
+import './shared/onboarding_background.js';
+import './shared/splash_pages_shared_css.js';
+import '../strings.m.js';
+
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {navigateTo, navigateToNextStep, NavigationBehavior, Routes} from './navigation_behavior.js';
+import {SigninViewProxy, SigninViewProxyImpl} from './signin_view_proxy.js';
+import {WelcomeBrowserProxy, WelcomeBrowserProxyImpl} from './welcome_browser_proxy.js';
+
Polymer({
is: 'signin-view',
- behaviors: [welcome.NavigationBehavior],
+ _template: html`{__html_template__}`,
+
+ behaviors: [NavigationBehavior],
/** @private {boolean} */
finalized_: false,
- /** @private {?welcome.WelcomeBrowserProxy} */
+ /** @private {?WelcomeBrowserProxy} */
welcomeBrowserProxy_: null,
- /** @private {?welcome.SigninViewProxy} */
+ /** @private {?SigninViewProxy} */
signinViewProxy_: null,
/** @override */
ready: function() {
- this.welcomeBrowserProxy_ = welcome.WelcomeBrowserProxyImpl.getInstance();
- this.signinViewProxy_ = welcome.SigninViewProxyImpl.getInstance();
+ this.welcomeBrowserProxy_ = WelcomeBrowserProxyImpl.getInstance();
+ this.signinViewProxy_ = SigninViewProxyImpl.getInstance();
},
onRouteEnter: function() {
diff --git a/chromium/chrome/browser/resources/welcome/signin_view_proxy.html b/chromium/chrome/browser/resources/welcome/signin_view_proxy.html
deleted file mode 100644
index 5d26af4e3f0..00000000000
--- a/chromium/chrome/browser/resources/welcome/signin_view_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="signin_view_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/signin_view_proxy.js b/chromium/chrome/browser/resources/welcome/signin_view_proxy.js
index 0e731b9df18..43266ea4036 100644
--- a/chromium/chrome/browser/resources/welcome/signin_view_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/signin_view_proxy.js
@@ -2,79 +2,74 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
- const NUX_SIGNIN_VIEW_INTERACTION_METRIC_NAME =
- 'FirstRun.NewUserExperience.SignInInterstitialInteraction';
+import {addSingletonGetter} from 'chrome://resources/js/cr.m.js';
- /**
- * NuxSignInInterstitialInteractions enum.
- * These values are persisted to logs and should not be renumbered or re-used.
- * See tools/metrics/histograms/enums.xml.
- * @enum {number}
- */
- const NuxSignInInterstitialInteractions = {
- PageShown: 0,
- NavigatedAway: 1,
- Skip: 2,
- SignIn: 3,
- NavigatedAwayThroughBrowserHistory: 4,
- };
+const NUX_SIGNIN_VIEW_INTERACTION_METRIC_NAME =
+ 'FirstRun.NewUserExperience.SignInInterstitialInteraction';
- const NUX_SIGNIN_VIEW_INTERACTIONS_COUNT =
- Object.keys(NuxSignInInterstitialInteractions).length;
+/**
+ * NuxSignInInterstitialInteractions enum.
+ * These values are persisted to logs and should not be renumbered or re-used.
+ * See tools/metrics/histograms/enums.xml.
+ * @enum {number}
+ */
+const NuxSignInInterstitialInteractions = {
+ PageShown: 0,
+ NavigatedAway: 1,
+ Skip: 2,
+ SignIn: 3,
+ NavigatedAwayThroughBrowserHistory: 4,
+};
- /** @interface */
- class SigninViewProxy {
- recordPageShown() {}
- recordNavigatedAway() {}
- recordNavigatedAwayThroughBrowserHistory() {}
- recordSkip() {}
- recordSignIn() {}
- }
+const NUX_SIGNIN_VIEW_INTERACTIONS_COUNT =
+ Object.keys(NuxSignInInterstitialInteractions).length;
- /** @implements {welcome.SigninViewProxy} */
- class SigninViewProxyImpl {
- /** @override */
- recordPageShown() {
- this.recordInteraction_(NuxSignInInterstitialInteractions.PageShown);
- }
+/** @interface */
+export class SigninViewProxy {
+ recordPageShown() {}
+ recordNavigatedAway() {}
+ recordNavigatedAwayThroughBrowserHistory() {}
+ recordSkip() {}
+ recordSignIn() {}
+}
- /** @override */
- recordNavigatedAway() {
- this.recordInteraction_(NuxSignInInterstitialInteractions.NavigatedAway);
- }
+/** @implements {SigninViewProxy} */
+export class SigninViewProxyImpl {
+ /** @override */
+ recordPageShown() {
+ this.recordInteraction_(NuxSignInInterstitialInteractions.PageShown);
+ }
- /** @override */
- recordNavigatedAwayThroughBrowserHistory() {
- this.recordInteraction_(
- NuxSignInInterstitialInteractions.NavigatedAwayThroughBrowserHistory);
- }
+ /** @override */
+ recordNavigatedAway() {
+ this.recordInteraction_(NuxSignInInterstitialInteractions.NavigatedAway);
+ }
- /** @override */
- recordSkip() {
- this.recordInteraction_(NuxSignInInterstitialInteractions.Skip);
- }
+ /** @override */
+ recordNavigatedAwayThroughBrowserHistory() {
+ this.recordInteraction_(
+ NuxSignInInterstitialInteractions.NavigatedAwayThroughBrowserHistory);
+ }
- /** @override */
- recordSignIn() {
- this.recordInteraction_(NuxSignInInterstitialInteractions.SignIn);
- }
+ /** @override */
+ recordSkip() {
+ this.recordInteraction_(NuxSignInInterstitialInteractions.Skip);
+ }
- /**
- * @param {number} interaction
- * @private
- */
- recordInteraction_(interaction) {
- chrome.metricsPrivate.recordEnumerationValue(
- NUX_SIGNIN_VIEW_INTERACTION_METRIC_NAME, interaction,
- NUX_SIGNIN_VIEW_INTERACTIONS_COUNT);
- }
+ /** @override */
+ recordSignIn() {
+ this.recordInteraction_(NuxSignInInterstitialInteractions.SignIn);
}
- cr.addSingletonGetter(SigninViewProxyImpl);
+ /**
+ * @param {number} interaction
+ * @private
+ */
+ recordInteraction_(interaction) {
+ chrome.metricsPrivate.recordEnumerationValue(
+ NUX_SIGNIN_VIEW_INTERACTION_METRIC_NAME, interaction,
+ NUX_SIGNIN_VIEW_INTERACTIONS_COUNT);
+ }
+}
- return {
- SigninViewProxy: SigninViewProxy,
- SigninViewProxyImpl: SigninViewProxyImpl,
- };
-});
+addSingletonGetter(SigninViewProxyImpl);
diff --git a/chromium/chrome/browser/resources/welcome/welcome.html b/chromium/chrome/browser/resources/welcome/welcome.html
index e2a37c5b0a1..88145e7cae9 100644
--- a/chromium/chrome/browser/resources/welcome/welcome.html
+++ b/chromium/chrome/browser/resources/welcome/welcome.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>$i18n{headerText}</title>
- <link rel="import" href="welcome_app.html">
+ <script type="module" src="welcome_app.js"></script>
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
</head>
@@ -16,7 +16,7 @@
}
</style>
<welcome-app></welcome-app>
- <script src="/welcome.js"></script>
+ <script type="module" src="welcome.js"></script>
<link rel="stylesheet" href="chrome://welcome/welcome.css">
</body>
</html>
diff --git a/chromium/chrome/browser/resources/welcome/welcome.js b/chromium/chrome/browser/resources/welcome/welcome.js
index 2e78a6476da..198e3658e74 100644
--- a/chromium/chrome/browser/resources/welcome/welcome.js
+++ b/chromium/chrome/browser/resources/welcome/welcome.js
@@ -7,9 +7,10 @@
* it's included more than once, which can happen when an include is misspelled.
*/
-cr.exportPath('welcome');
+import {assert} from 'chrome://resources/js/assert.m.js';
+
assert(
- !welcome.defaultResourceLoaded,
+ !window.defaultResourceLoaded,
'welcome.js run twice. You probably have an invalid import.');
/** Global defined when the main welcome script runs. */
-welcome.defaultResourceLoaded = true;
+window.defaultResourceLoaded = true;
diff --git a/chromium/chrome/browser/resources/welcome/welcome_app.html b/chromium/chrome/browser/resources/welcome/welcome_app.html
index a520eaaaf11..21e0477f9c7 100644
--- a/chromium/chrome/browser/resources/welcome/welcome_app.html
+++ b/chromium/chrome/browser/resources/welcome/welcome_app.html
@@ -1,50 +1,29 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
+<style include="cr-hidden-style">
+ #viewManager {
+ display: flex;
+ font-size: 100%;
+ margin: 0;
+ min-height: 100vh;
+ }
-<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/assert.html">
-<link rel="import" href="google_apps/nux_google_apps.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">
-<link rel="import" href="set_as_default/nux_set_as_default.html">
-<link rel="import" href="set_as_default/nux_set_as_default_proxy.html">
-<link rel="import" href="shared/bookmark_proxy.html">
-<link rel="import" href="shared/i18n_setup.html">
-<link rel="import" href="signin_view.html">
+ #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;
+ margin: auto;
+ position: unset;
+ right: initial;
+ top: initial;
+ }
-<dom-module id="welcome-app">
- <template>
- <style include="cr-hidden-style">
- #viewManager {
- display: flex;
- font-size: 100%;
- margin: 0;
- min-height: 100vh;
- }
-
- #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;
- margin: auto;
- position: unset;
- 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>
+ 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>
diff --git a/chromium/chrome/browser/resources/welcome/welcome_app.js b/chromium/chrome/browser/resources/welcome/welcome_app.js
index 9830c921b2a..029129172ef 100644
--- a/chromium/chrome/browser/resources/welcome/welcome_app.js
+++ b/chromium/chrome/browser/resources/welcome/welcome_app.js
@@ -2,6 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'chrome://resources/cr_elements/cr_toast/cr_toast.m.js';
+import 'chrome://resources/cr_elements/cr_view_manager/cr_view_manager.m.js';
+import 'chrome://resources/cr_elements/hidden_style_css.m.js';
+import './google_apps/nux_google_apps.js';
+import './landing_view.js';
+import './ntp_background/nux_ntp_background.js';
+import './set_as_default/nux_set_as_default.js';
+import './signin_view.js';
+import '../strings.m.js';
+
+import {assert} from 'chrome://resources/js/assert.m.js';
+import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
+import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
+
+import {navigateTo, navigateToNextStep, NavigationBehavior, Routes} from './navigation_behavior.js';
+import {NuxSetAsDefaultProxyImpl} from './set_as_default/nux_set_as_default_proxy.js';
+import {BookmarkBarManager} from './shared/bookmark_proxy.js';
+import {WelcomeBrowserProxyImpl} from './welcome_browser_proxy.js';
+
/**
* The strings contained in the arrays should be valid DOM-element tag names.
* @typedef {{
@@ -31,9 +50,11 @@ const MODULES_NEEDING_INDICATOR =
Polymer({
is: 'welcome-app',
- behaviors: [welcome.NavigationBehavior],
+ _template: html`{__html_template__}`,
+
+ behaviors: [NavigationBehavior],
- /** @private {?welcome.Routes} */
+ /** @private {?Routes} */
currentRoute_: null,
/** @private {NuxOnboardingModules} */
@@ -65,7 +86,7 @@ Polymer({
},
/**
- * @param {welcome.Routes} route
+ * @param {Routes} route
* @param {number} step
* @private
*/
@@ -74,7 +95,7 @@ Polymer({
// If the specified step doesn't exist, that means there are no more
// steps. In that case, replace this page with NTP.
if (!this.$$(`#step-${step}`)) {
- welcome.WelcomeBrowserProxyImpl.getInstance().goToNewTabPage(
+ WelcomeBrowserProxyImpl.getInstance().goToNewTabPage(
/* replace */ true);
} else { // Otherwise, go to the chosen step of that route.
// At this point, views are ready to be shown.
@@ -94,7 +115,7 @@ Polymer({
this.currentRoute_ = route;
},
- /** @param {welcome.Routes} route */
+ /** @param {Routes} route */
initializeModules: function(route) {
// Remove all views except landing.
this.$.viewManager
@@ -102,7 +123,7 @@ Polymer({
.forEach(element => element.remove());
// If it is on landing route, end here.
- if (route == welcome.Routes.LANDING) {
+ if (route == Routes.LANDING) {
return Promise.resolve();
}
@@ -111,7 +132,7 @@ Polymer({
/** @type {!Promise} */
const defaultBrowserPromise =
- welcome.NuxSetAsDefaultProxyImpl.getInstance()
+ NuxSetAsDefaultProxyImpl.getInstance()
.requestDefaultBrowserState()
.then((status) => {
if (status.isDefault || !status.canBeDefault) {
@@ -128,7 +149,7 @@ Polymer({
return Promise
.all([
defaultBrowserPromise,
- welcome.BookmarkBarManager.getInstance().initialized,
+ BookmarkBarManager.getInstance().initialized,
])
.then(([canSetDefault]) => {
modules = modules.filter(module => {
diff --git a/chromium/chrome/browser/resources/welcome/welcome_browser_proxy.html b/chromium/chrome/browser/resources/welcome/welcome_browser_proxy.html
deleted file mode 100644
index 24f332053f2..00000000000
--- a/chromium/chrome/browser/resources/welcome/welcome_browser_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="import" href="chrome://resources/html/cr.html">
-<script src="welcome_browser_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/welcome/welcome_browser_proxy.js b/chromium/chrome/browser/resources/welcome/welcome_browser_proxy.js
index f549f22e255..bf8146fd786 100644
--- a/chromium/chrome/browser/resources/welcome/welcome_browser_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/welcome_browser_proxy.js
@@ -2,57 +2,52 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import {addSingletonGetter} from 'chrome://resources/js/cr.m.js';
+
/**
* @fileoverview A helper object used by the welcome page to interact with
* the browser.
*/
-cr.define('welcome', function() {
- /** @interface */
- class WelcomeBrowserProxy {
- /** @param {?string} redirectUrl the URL to go to, after signing in. */
- handleActivateSignIn(redirectUrl) {}
+/** @interface */
+export class WelcomeBrowserProxy {
+ /** @param {?string} redirectUrl the URL to go to, after signing in. */
+ handleActivateSignIn(redirectUrl) {}
- handleUserDecline() {}
+ handleUserDecline() {}
- /** @param {boolean=} replace */
- goToNewTabPage(replace) {}
+ /** @param {boolean=} replace */
+ goToNewTabPage(replace) {}
- /** @param {string} url */
- goToURL(url) {}
- }
+ /** @param {string} url */
+ goToURL(url) {}
+}
- /** @implements {welcome.WelcomeBrowserProxy} */
- class WelcomeBrowserProxyImpl {
- /** @override */
- handleActivateSignIn(redirectUrl) {
- chrome.send('handleActivateSignIn', redirectUrl ? [redirectUrl] : []);
- }
-
- /** @override */
- handleUserDecline() {
- chrome.send('handleUserDecline');
- }
+/** @implements {WelcomeBrowserProxy} */
+export class WelcomeBrowserProxyImpl {
+ /** @override */
+ handleActivateSignIn(redirectUrl) {
+ chrome.send('handleActivateSignIn', redirectUrl ? [redirectUrl] : []);
+ }
- /** @override */
- goToNewTabPage(replace) {
- if (replace) {
- window.location.replace('chrome://newtab');
- } else {
- window.location.assign('chrome://newtab');
- }
- }
+ /** @override */
+ handleUserDecline() {
+ chrome.send('handleUserDecline');
+ }
- /** @override */
- goToURL(url) {
- window.location.assign(url);
+ /** @override */
+ goToNewTabPage(replace) {
+ if (replace) {
+ window.location.replace('chrome://newtab');
+ } else {
+ window.location.assign('chrome://newtab');
}
}
- cr.addSingletonGetter(WelcomeBrowserProxyImpl);
+ /** @override */
+ goToURL(url) {
+ window.location.assign(url);
+ }
+}
- return {
- WelcomeBrowserProxy: WelcomeBrowserProxy,
- WelcomeBrowserProxyImpl: WelcomeBrowserProxyImpl,
- };
-});
+addSingletonGetter(WelcomeBrowserProxyImpl);
diff --git a/chromium/chrome/browser/resources/welcome/welcome_resources.grd b/chromium/chrome/browser/resources/welcome/welcome_resources.grd
index cc67d33b906..5a9e022c50c 100644
--- a/chromium/chrome/browser/resources/welcome/welcome_resources.grd
+++ b/chromium/chrome/browser/resources/welcome/welcome_resources.grd
@@ -42,132 +42,79 @@
file="images/background_svgs/yellow_semicircle.svg"
compress="gzip"
type="BINDATA" />
+
+ <!-- Generated Polymer 3 elements -->
+ <include name="IDR_WELCOME_APP_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/welcome_app.js"
+ use_base_dir="false" type="BINDATA" compress="gzip" preprocess="true"/>
+ <include name="IDR_GOOGLE_APPS_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/google_apps/nux_google_apps.js"
+ use_base_dir="false" type="BINDATA" compress="gzip" preprocess="true"/>
+ <include name="IDR_SET_AS_DEFAULT_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.js"
+ use_base_dir="false" type="BINDATA" compress="gzip" preprocess="true"/>
+ <include name="IDR_WELCOME_LANDING_VIEW_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/landing_view.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
+ <include name="IDR_WELCOME_SIGNIN_VIEW_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/signin_view.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
+ <include name="IDR_NTP_BACKGROUND_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/ntp_background/nux_ntp_background.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
+ <include name="IDR_WELCOME_SHARED_STEP_INDICATOR_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/shared/step_indicator.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
+ <include name="IDR_WELCOME_SHARED_ONBOARDING_BACKGROUND_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/shared/onboarding_background.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
+
+
+ <!-- Generated style files -->
+ <include name="IDR_WELCOME_SHARED_ANIMATIONS_CSS_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/shared/animations_css.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
+ <include name="IDR_WELCOME_SHARED_CHOOSER_SHARED_CSS_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/shared/chooser_shared_css.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
+ <include name="IDR_WELCOME_SHARED_NAVI_COLORS_CSS_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/shared/navi_colors_css.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
+ <include name="IDR_WELCOME_SHARED_ACTION_LINK_STYLE_CSS_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/shared/action_link_style_css.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
+ <include name="IDR_WELCOME_SHARED_SPLASH_PAGES_SHARED_CSS_JS"
+ file="${root_gen_dir}/chrome/browser/resources/welcome/shared/splash_pages_shared_css.js"
+ use_base_dir="false" type="BINDATA" compress="gzip"/>
</includes>
<structures>
- <structure name="IDR_WELCOME_LANDING_VIEW_HTML"
- file="landing_view.html"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
- <structure name="IDR_WELCOME_LANDING_VIEW_JS"
- file="landing_view.js"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
- <structure name="IDR_WELCOME_LANDING_VIEW_PROXY_HTML"
- file="landing_view_proxy.html"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
<structure name="IDR_WELCOME_LANDING_VIEW_PROXY_JS"
file="landing_view_proxy.js"
type="chrome_html"
compress="gzip"
preprocess="true"/>
- <structure name="IDR_WELCOME_NAVIGATION_BEHAVIOR_HTML"
- file="navigation_behavior.html"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
<structure name="IDR_WELCOME_NAVIGATION_BEHAVIOR_JS"
file="navigation_behavior.js"
type="chrome_html"
compress="gzip"
preprocess="true"/>
- <structure name="IDR_WELCOME_SHARED_ACTION_LINK_STYLE_JS"
- file="shared/action_link_style.js"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_ACTION_LINK_STYLE_CSS_HTML"
- file="shared/action_link_style_css.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_ANIMATIONS_CSS"
- file="shared/animations_css.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_BOOKMARK_PROXY_HTML"
- file="shared/bookmark_proxy.html"
- compress="gzip"
- type="chrome_html" />
<structure name="IDR_WELCOME_SHARED_BOOKMARK_PROXY_JS"
file="shared/bookmark_proxy.js"
compress="gzip"
type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_CHOOSER_SHARED_CSS"
- file="shared/chooser_shared_css.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_I18N_SETUP_HTML"
- file="shared/i18n_setup.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_MODULE_METRICS_PROXY_HTML"
- file="shared/module_metrics_proxy.html"
- compress="gzip"
- type="chrome_html" />
<structure name="IDR_WELCOME_SHARED_MODULE_METRICS_PROXY_JS"
file="shared/module_metrics_proxy.js"
compress="gzip"
type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_NAVI_COLORS_CSS"
- file="shared/navi_colors_css.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_ONBOARDING_BACKGROUND_HTML"
- file="shared/onboarding_background.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_ONBOARDING_BACKGROUND_JS"
- file="shared/onboarding_background.js"
+ <structure name="IDR_WELCOME_SHARED_NUX_TYPES_JS"
+ file="shared/nux_types.js"
compress="gzip"
type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_STEP_INDICATOR_HTML"
- file="shared/step_indicator.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_STEP_INDICATOR_JS"
- file="shared/step_indicator.js"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SHARED_SPLASH_PAGES_SHARED_CSS"
- file="shared/splash_pages_shared_css.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_WELCOME_SIGNIN_VIEW_HTML"
- file="signin_view.html"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
- <structure name="IDR_WELCOME_SIGNIN_VIEW_JS"
- file="signin_view.js"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
- <structure name="IDR_WELCOME_SIGNIN_VIEW_PROXY_HTML"
- file="signin_view_proxy.html"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
<structure name="IDR_WELCOME_SIGNIN_VIEW_PROXY_JS"
file="signin_view_proxy.js"
type="chrome_html"
compress="gzip"
preprocess="true"/>
- <structure name="IDR_WELCOME_APP_HTML"
- file="welcome_app.html"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
- <structure name="IDR_WELCOME_APP_JS"
- file="welcome_app.js"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
- <structure name="IDR_WELCOME_BROWSER_PROXY_HTML"
- file="welcome_browser_proxy.html"
- compress="gzip"
- type="chrome_html"/>
<structure name="IDR_WELCOME_BROWSER_PROXY_JS"
file="welcome_browser_proxy.js"
compress="gzip"
@@ -189,70 +136,26 @@
preprocess="true"/>
<!-- Google apps-->
- <structure name="IDR_GOOGLE_APPS_HTML"
- file="google_apps/nux_google_apps.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_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"
- compress="gzip"
- type="chrome_html" />
<structure name="IDR_GOOGLE_APP_PROXY_JS"
file="google_apps/google_app_proxy.js"
compress="gzip"
type="chrome_html" />
- <structure name="IDR_SET_AS_DEFAULT_HTML"
- file="set_as_default/nux_set_as_default.html"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
- <structure name="IDR_SET_AS_DEFAULT_JS"
- file="set_as_default/nux_set_as_default.js"
- type="chrome_html"
- compress="gzip"
- preprocess="true"/>
- <structure name="IDR_SET_AS_DEFAULT_PROXY_HTML"
- file="set_as_default/nux_set_as_default_proxy.html"
+ <structure name="IDR_GOOGLE_APPS_METRICS_PROXY_JS"
+ file="google_apps/google_apps_metrics_proxy.js"
compress="gzip"
type="chrome_html" />
+
+ <!-- Set as default-->
<structure name="IDR_SET_AS_DEFAULT_PROXY_JS"
file="set_as_default/nux_set_as_default_proxy.js"
compress="gzip"
type="chrome_html" />
- <structure name="IDR_GOOGLE_APPS_METRICS_PROXY_HTML"
- file="google_apps/google_apps_metrics_proxy.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_GOOGLE_APPS_METRICS_PROXY_JS"
- file="google_apps/google_apps_metrics_proxy.js"
- compress="gzip"
- type="chrome_html" />
<!-- NTP background-->
- <structure name="IDR_NTP_BACKGROUND_HTML"
- file="ntp_background/nux_ntp_background.html"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_NTP_BACKGROUND_JS"
- file="ntp_background/nux_ntp_background.js"
- compress="gzip"
- type="chrome_html" />
- <structure name="IDR_NTP_BACKGROUND_PROXY_HTML"
- file="ntp_background/ntp_background_proxy.html"
- compress="gzip"
- type="chrome_html" />
<structure name="IDR_NTP_BACKGROUND_PROXY_JS"
file="ntp_background/ntp_background_proxy.js"
compress="gzip"
type="chrome_html" />
- <structure name="IDR_NTP_BACKGROUND_METRICS_PROXY_HTML"
- file="ntp_background/ntp_background_metrics_proxy.html"
- compress="gzip"
- type="chrome_html" />
<structure name="IDR_NTP_BACKGROUND_METRICS_PROXY_JS"
file="ntp_background/ntp_background_metrics_proxy.js"
compress="gzip"
diff --git a/chromium/chrome/browser/safe_browsing/BUILD.gn b/chromium/chrome/browser/safe_browsing/BUILD.gn
index 3599895eb5c..8d5bdf42806 100644
--- a/chromium/chrome/browser/safe_browsing/BUILD.gn
+++ b/chromium/chrome/browser/safe_browsing/BUILD.gn
@@ -137,6 +137,8 @@ jumbo_static_library("safe_browsing") {
"client_side_detection_service.h",
"client_side_model_loader.cc",
"client_side_model_loader.h",
+ "cloud_content_scanning/deep_scanning_dialog_delegate.cc",
+ "cloud_content_scanning/deep_scanning_dialog_delegate.h",
"download_protection/binary_fcm_service.cc",
"download_protection/binary_fcm_service.h",
"download_protection/binary_upload_service.cc",
@@ -157,6 +159,8 @@ jumbo_static_library("safe_browsing") {
"download_protection/download_protection_service.h",
"download_protection/download_protection_util.cc",
"download_protection/download_protection_util.h",
+ "download_protection/download_reporter.cc",
+ "download_protection/download_reporter.h",
"download_protection/download_url_sb_client.cc",
"download_protection/download_url_sb_client.h",
"download_protection/file_analyzer.cc",
@@ -252,18 +256,6 @@ jumbo_static_library("safe_browsing") {
"//components/safe_browsing:buildflags",
"//components/safe_browsing/android:safe_browsing_mobile",
]
- } else if (safe_browsing_mode == 3) {
- sources += [
- "android/file_type_policies.cc",
- "android/services_delegate_android.cc",
- "android/services_delegate_android.h",
- "telemetry/android/android_telemetry_service.cc",
- "telemetry/android/android_telemetry_service.h",
- ]
- deps += [
- "//chrome/android:jni_headers",
- "//components/safe_browsing/db:db",
- ]
}
}
}
diff --git a/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_mac_browsertest.cc b/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_mac_browsertest.cc
index f78aa4f7593..8bf74d31846 100644
--- a/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_mac_browsertest.cc
+++ b/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_mac_browsertest.cc
@@ -12,14 +12,15 @@
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/mock_render_process_host.h"
+#include "mojo/public/cpp/bindings/remote.h"
class SpellCheckHostChromeImplMacBrowserTest : public InProcessBrowserTest {
public:
void SetUpOnMainThread() override {
content::BrowserContext* context = browser()->profile();
renderer_.reset(new content::MockRenderProcessHost(context));
- SpellCheckHostChromeImpl::Create(renderer_->GetID(),
- mojo::MakeRequest(&spell_check_host_));
+ SpellCheckHostChromeImpl::Create(
+ renderer_->GetID(), spell_check_host_.BindNewPipeAndPassReceiver());
}
void TearDownOnMainThread() override { renderer_.reset(); }
@@ -41,7 +42,7 @@ class SpellCheckHostChromeImplMacBrowserTest : public InProcessBrowserTest {
protected:
std::unique_ptr<content::MockRenderProcessHost> renderer_;
- spellcheck::mojom::SpellCheckHostPtr spell_check_host_;
+ mojo::Remote<spellcheck::mojom::SpellCheckHost> spell_check_host_;
bool received_result_ = false;
std::vector<SpellCheckResult> result_;
diff --git a/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc b/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc
index 9ceeb4deedc..a47d8d9de41 100644
--- a/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc
+++ b/chromium/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc
@@ -16,18 +16,20 @@
#include "components/spellcheck/common/spellcheck_features.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/mock_render_process_host.h"
+#include "mojo/public/cpp/bindings/remote.h"
class SpellCheckHostChromeImplWinBrowserTest : public InProcessBrowserTest {
public:
+ SpellCheckHostChromeImplWinBrowserTest() {
+ feature_list_.InitAndEnableFeature(spellcheck::kWinUseBrowserSpellChecker);
+ }
+
void SetUpOnMainThread() override {
content::BrowserContext* context = browser()->profile();
renderer_.reset(new content::MockRenderProcessHost(context));
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(spellcheck::kWinUseBrowserSpellChecker);
-
- SpellCheckHostChromeImpl::Create(renderer_->GetID(),
- mojo::MakeRequest(&spell_check_host_));
+ SpellCheckHostChromeImpl::Create(
+ renderer_->GetID(), spell_check_host_.BindNewPipeAndPassReceiver());
}
void TearDownOnMainThread() override { renderer_.reset(); }
@@ -57,8 +59,9 @@ class SpellCheckHostChromeImplWinBrowserTest : public InProcessBrowserTest {
}
protected:
+ base::test::ScopedFeatureList feature_list_;
std::unique_ptr<content::MockRenderProcessHost> renderer_;
- spellcheck::mojom::SpellCheckHostPtr spell_check_host_;
+ mojo::Remote<spellcheck::mojom::SpellCheckHost> spell_check_host_;
bool received_result_ = false;
std::vector<SpellCheckResult> result_;
@@ -71,9 +74,6 @@ IN_PROC_BROWSER_TEST_F(SpellCheckHostChromeImplWinBrowserTest,
if (base::win::GetVersion() < base::win::Version::WIN8)
return;
- base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(spellcheck::kWinUseBrowserSpellChecker);
-
spellcheck_platform::SetLanguage(
"en-US", base::BindOnce(&SpellCheckHostChromeImplWinBrowserTest::
SetLanguageCompletionCallback,
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc b/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc
index 3c08eeab629..250ccd8e35d 100644
--- a/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc
+++ b/chromium/chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc
@@ -112,7 +112,7 @@ void SpellcheckLanguageBlacklistPolicyHandler::SortBlacklistedLanguages(
// 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();
+ base::span<const base::Value> blacklisted_languages = value->GetList();
for (const base::Value& language : blacklisted_languages) {
std::string current_language =
spellcheck::GetCorrespondingSpellCheckLanguage(
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc b/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc
index c451930d32d..8d968add0e8 100644
--- a/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc
+++ b/chromium/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc
@@ -85,7 +85,7 @@ void SpellcheckLanguagePolicyHandler::SortForcedLanguages(
return;
// Separate the valid languages from the unknown / unsupported languages.
- const base::Value::ListStorage& forced_languages = value->GetList();
+ base::span<const base::Value> forced_languages = value->GetList();
for (const base::Value& language : forced_languages) {
std::string current_language =
spellcheck::GetCorrespondingSpellCheckLanguage(
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chromium/chrome/browser/spellchecker/spellcheck_service_browsertest.cc
index ec0665d4487..f79e976770b 100644
--- a/chromium/chrome/browser/spellchecker/spellcheck_service_browsertest.cc
+++ b/chromium/chrome/browser/spellchecker/spellcheck_service_browsertest.cc
@@ -38,6 +38,7 @@
#include "content/public/test/test_utils.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
using content::BrowserContext;
using content::RenderProcessHost;
@@ -231,14 +232,14 @@ class SpellcheckServiceHostBrowserTest : public SpellcheckServiceBrowserTest {
SpellcheckServiceHostBrowserTest() = default;
void RequestDictionary() {
- spellcheck::mojom::SpellCheckHostPtr interface;
+ mojo::Remote<spellcheck::mojom::SpellCheckHost> interface;
RequestSpellCheckHost(&interface);
interface->RequestDictionary();
}
void NotifyChecked() {
- spellcheck::mojom::SpellCheckHostPtr interface;
+ mojo::Remote<spellcheck::mojom::SpellCheckHost> interface;
RequestSpellCheckHost(&interface);
const bool misspelt = true;
@@ -248,7 +249,7 @@ class SpellcheckServiceHostBrowserTest : public SpellcheckServiceBrowserTest {
}
void CallSpellingService() {
- spellcheck::mojom::SpellCheckHostPtr interface;
+ mojo::Remote<spellcheck::mojom::SpellCheckHost> interface;
RequestSpellCheckHost(&interface);
base::UTF8ToUTF16("hello", 5, &word_);
@@ -265,9 +266,10 @@ class SpellcheckServiceHostBrowserTest : public SpellcheckServiceBrowserTest {
}
private:
- void RequestSpellCheckHost(spellcheck::mojom::SpellCheckHostPtr* interface) {
+ void RequestSpellCheckHost(
+ mojo::Remote<spellcheck::mojom::SpellCheckHost>* interface) {
SpellCheckHostChromeImpl::Create(GetRenderer()->GetID(),
- mojo::MakeRequest(interface));
+ interface->BindNewPipeAndPassReceiver());
}
void SpellingServiceDone(bool success,
diff --git a/chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc b/chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc
index 5441a4be28d..813bccf79ba 100644
--- a/chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc
+++ b/chromium/chrome/browser/spellchecker/spelling_service_client_unittest.cc
@@ -26,7 +26,6 @@
#include "content/public/test/browser_task_environment.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"
@@ -147,8 +146,8 @@ class SpellingServiceClientTest
// 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|.)
-using Redirects =
- std::vector<std::pair<net::RedirectInfo, network::ResourceResponseHead>>;
+using Redirects = std::vector<
+ std::pair<net::RedirectInfo, network::mojom::URLResponseHeadPtr>>;
TEST_P(SpellingServiceClientTest, RequestTextCheck) {
auto test_case = GetParam();
@@ -169,19 +168,20 @@ TEST_P(SpellingServiceClientTest, RequestTextCheck) {
client_.test_url_loader_factory()->ClearResponses();
net::HttpStatusCode http_status = test_case.response_status;
- network::ResourceResponseHead head;
+ auto head = network::mojom::URLResponseHead::New();
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 = base::MakeRefCounted<net::HttpResponseHeaders>(
+ head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(
net::HttpUtil::AssembleRawHeaders(headers));
- head.mime_type = "application/json";
+ 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(),
+ expected_request_url, std::move(head), test_case.response_data, status,
+ Redirects(),
network::TestURLLoaderFactory::ResponseProduceFlags::
kSendHeadersOnNetworkError);
diff --git a/chromium/chrome/browser/ssl/BUILD.gn b/chromium/chrome/browser/ssl/BUILD.gn
index f5175c8b157..b731b9fb1ed 100644
--- a/chromium/chrome/browser/ssl/BUILD.gn
+++ b/chromium/chrome/browser/ssl/BUILD.gn
@@ -8,5 +8,6 @@ proto_library("proto") {
sources = [
"cert_logger.proto",
"ssl_error_assistant.proto",
+ "tls_deprecation_config.proto",
]
}
diff --git a/chromium/chrome/browser/subresource_filter/BUILD.gn b/chromium/chrome/browser/subresource_filter/BUILD.gn
new file mode 100644
index 00000000000..f838a1cbdfa
--- /dev/null
+++ b/chromium/chrome/browser/subresource_filter/BUILD.gn
@@ -0,0 +1,64 @@
+# 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.
+
+# TODO(csharrison): Move subresource_filter_browsertests here.
+
+if (is_android) {
+ import("//build/config/android/rules.gni")
+
+ generate_jni("jni_headers") {
+ sources = [
+ "../../android/javatests/src/org/chromium/chrome/browser/subresource_filter/TestRulesetPublisher.java",
+ ]
+ }
+
+ android_library("subresource_filter_java_test_support") {
+ testonly = true
+ java_files = [ "../../android/javatests/src/org/chromium/chrome/browser/subresource_filter/TestRulesetPublisher.java" ]
+ deps = [
+ "//base:base_java",
+ ]
+ }
+
+ android_library("subresource_filter_javatests") {
+ testonly = true
+ java_files = [ "../../android/javatests/src/org/chromium/chrome/browser/subresource_filter/SubresourceFilterTest.java" ]
+ deps = [
+ ":subresource_filter_java_test_support",
+ "//base:base_java_test_support",
+ "//chrome/android:chrome_java",
+ "//chrome/android:chrome_test_java",
+ "//chrome/test/android:chrome_java_test_support",
+ "//components/safe_browsing/android:safe_browsing_java",
+ "//content/public/test/android:content_java_test_support",
+ "//net/android:net_java_test_support",
+ "//third_party/android_support_test_runner:rules_java",
+ "//third_party/android_support_test_runner:runner_java",
+ "//third_party/junit",
+ ]
+ }
+}
+
+source_set("test_support") {
+ testonly = true
+ sources = [
+ "test_ruleset_publisher.cc",
+ "test_ruleset_publisher.h",
+ ]
+ deps = [
+ "//chrome/browser",
+ "//components/subresource_filter/content/browser:browser",
+ "//components/subresource_filter/core/browser:browser",
+ "//components/subresource_filter/core/common:test_support",
+ "//net",
+ "//services/network/public/mojom",
+ "//testing/gtest:gtest",
+ "//third_party/protobuf:protobuf_lite",
+ ]
+
+ if (is_android) {
+ sources += [ "android_test_ruleset_publisher.cc" ]
+ deps += [ ":jni_headers" ]
+ }
+}
diff --git a/chromium/chrome/browser/supervised_user/supervised_user_error_page/BUILD.gn b/chromium/chrome/browser/supervised_user/supervised_user_error_page/BUILD.gn
index f6a564d99e3..997f2b5eb09 100644
--- a/chromium/chrome/browser/supervised_user/supervised_user_error_page/BUILD.gn
+++ b/chromium/chrome/browser/supervised_user/supervised_user_error_page/BUILD.gn
@@ -16,7 +16,9 @@ static_library("supervised_user_error_page") {
"//base",
"//chrome/app:generated_resources",
"//chrome/browser:resources_grit",
+ "//components/signin/public/base",
"//ui/base",
+ "//url",
]
}
diff --git a/chromium/chrome/browser/touch_to_fill/BUILD.gn b/chromium/chrome/browser/touch_to_fill/BUILD.gn
new file mode 100644
index 00000000000..3647ba71f18
--- /dev/null
+++ b/chromium/chrome/browser/touch_to_fill/BUILD.gn
@@ -0,0 +1,37 @@
+# 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.
+if (is_android) {
+ import("//build/config/android/config.gni")
+ import("//build/config/android/rules.gni")
+}
+
+group("touch_to_fill") {
+ public_deps = [
+ ":factory",
+ ":public",
+ ]
+}
+
+source_set("factory") {
+ if (is_android) {
+ sources = [
+ "touch_to_fill_view_factory.cc",
+ "touch_to_fill_view_factory.h",
+ ]
+
+ deps = [
+ "//chrome/browser/touch_to_fill/android",
+ ]
+ }
+
+ public_deps = [
+ ":public",
+ ]
+}
+
+source_set("public") {
+ sources = [
+ "touch_to_fill_view.h",
+ ]
+}
diff --git a/chromium/chrome/browser/touch_to_fill/android/BUILD.gn b/chromium/chrome/browser/touch_to_fill/android/BUILD.gn
new file mode 100644
index 00000000000..c4499882fdc
--- /dev/null
+++ b/chromium/chrome/browser/touch_to_fill/android/BUILD.gn
@@ -0,0 +1,87 @@
+# 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/config/android/rules.gni")
+import("//chrome/android/features/android_library_factory_tmpl.gni")
+
+source_set("android") {
+ visibility = [ "//chrome/browser/touch_to_fill:factory" ]
+
+ sources = [
+ "touch_to_fill_view_impl.cc",
+ "touch_to_fill_view_impl.h",
+ ]
+
+ deps = [
+ ":jni_headers",
+ "//ui/gfx",
+ ]
+}
+
+generate_jni("jni_headers") {
+ sources = [
+ "internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java",
+ "java/src/org/chromium/chrome/browser/touch_to_fill/data/Credential.java",
+ ]
+}
+
+android_library("public_java") {
+ deps = [
+ # TODO(crbug.com/1004415): Remove dependency on chrome_java and depend on
+ # bottomsheet directly. Add public_java to chrome_java target instead.
+ "//chrome/android:chrome_java",
+ "//chrome/android:chrome_public_java",
+ "//ui/android:ui_java",
+ ]
+
+ java_files = [
+ "java/src/org/chromium/chrome/browser/touch_to_fill/data/Credential.java",
+ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillComponent.java",
+ ]
+}
+
+junit_binary("touch_to_fill_junit_tests") {
+ testonly = true
+
+ java_files = [ "junit/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillControllerTest.java" ]
+
+ deps = [
+ "//base:base_java_test_support",
+ "//base:base_junit_test_support",
+ "//chrome/android:chrome_junit_test_support",
+ "//chrome/android:chrome_test_util_java",
+ "//chrome/browser/touch_to_fill/android/internal:java",
+ "//components/module_installer/android:module_installer_java",
+ "//third_party/junit",
+ "//third_party/mockito:mockito_java",
+ ]
+}
+
+android_library("test_java") {
+ testonly = true
+
+ java_files = [
+ "javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillIntegrationTest.java",
+ "javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewTest.java",
+ ]
+
+ deps = [
+ ":public_java",
+ "//base:base_java",
+ "//base:base_java_test_support",
+ "//chrome/android:chrome_java",
+ "//chrome/android:chrome_test_java",
+ "//chrome/android:chrome_test_util_java",
+ "//chrome/browser/touch_to_fill/android/internal:java",
+ "//chrome/test/android:chrome_java_test_support",
+ "//content/public/test/android:content_java_test_support",
+ "//third_party/android_deps:com_android_support_recyclerview_v7_java",
+ "//third_party/espresso:espresso_all_java",
+ "//third_party/hamcrest:hamcrest_java",
+ "//third_party/junit",
+ "//third_party/mockito:mockito_java",
+ "//ui/android:ui_full_java",
+ "//ui/android:ui_utils_java",
+ ]
+}
diff --git a/chromium/chrome/browser/touch_to_fill/android/internal/BUILD.gn b/chromium/chrome/browser/touch_to_fill/android/internal/BUILD.gn
new file mode 100644
index 00000000000..07c543c8209
--- /dev/null
+++ b/chromium/chrome/browser/touch_to_fill/android/internal/BUILD.gn
@@ -0,0 +1,93 @@
+# 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/config/android/rules.gni")
+import("//chrome/common/features.gni")
+
+android_library("java") {
+ deps = [
+ ":java_resources",
+ "//base:base_java",
+ "//base:jni_java",
+ "//chrome/android:chrome_java",
+ "//chrome/browser/touch_to_fill/android:public_java",
+ "//chrome/browser/util/android:java",
+ "//components/url_formatter/android:url_formatter_java",
+ "//third_party/android_deps:com_android_support_recyclerview_v7_java",
+ "//ui/android:ui_java",
+ ]
+
+ java_files = [
+ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java",
+ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillCoordinator.java",
+ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillMediator.java",
+ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillProperties.java",
+ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillView.java",
+ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java",
+ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewHolder.java",
+ ]
+
+ annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
+}
+
+android_resources("java_resources") {
+ deps = [
+ ":java_strings_grd",
+ "//third_party/android_deps:android_support_v7_appcompat_java",
+ "//ui/android:ui_java_resources",
+ ]
+ resource_dirs = [ "java/res" ]
+ custom_package = "org.chromium.chrome.browser.touch_to_fill"
+}
+
+java_strings_grd("java_strings_grd") {
+ defines = chrome_grit_defines
+ grd_file = "java/strings/android_touch_to_fill_strings.grd"
+ outputs = [
+ "values-am/android_touch_to_fill_strings.xml",
+ "values-ar/android_touch_to_fill_strings.xml",
+ "values-bg/android_touch_to_fill_strings.xml",
+ "values-ca/android_touch_to_fill_strings.xml",
+ "values-cs/android_touch_to_fill_strings.xml",
+ "values-da/android_touch_to_fill_strings.xml",
+ "values-de/android_touch_to_fill_strings.xml",
+ "values-el/android_touch_to_fill_strings.xml",
+ "values/android_touch_to_fill_strings.xml",
+ "values-en-rGB/android_touch_to_fill_strings.xml",
+ "values-es/android_touch_to_fill_strings.xml",
+ "values-es-rUS/android_touch_to_fill_strings.xml",
+ "values-fa/android_touch_to_fill_strings.xml",
+ "values-fi/android_touch_to_fill_strings.xml",
+ "values-tl/android_touch_to_fill_strings.xml",
+ "values-fr/android_touch_to_fill_strings.xml",
+ "values-hi/android_touch_to_fill_strings.xml",
+ "values-hr/android_touch_to_fill_strings.xml",
+ "values-hu/android_touch_to_fill_strings.xml",
+ "values-in/android_touch_to_fill_strings.xml",
+ "values-it/android_touch_to_fill_strings.xml",
+ "values-iw/android_touch_to_fill_strings.xml",
+ "values-ja/android_touch_to_fill_strings.xml",
+ "values-ko/android_touch_to_fill_strings.xml",
+ "values-lt/android_touch_to_fill_strings.xml",
+ "values-lv/android_touch_to_fill_strings.xml",
+ "values-nl/android_touch_to_fill_strings.xml",
+ "values-nb/android_touch_to_fill_strings.xml",
+ "values-pl/android_touch_to_fill_strings.xml",
+ "values-pt-rBR/android_touch_to_fill_strings.xml",
+ "values-pt-rPT/android_touch_to_fill_strings.xml",
+ "values-ro/android_touch_to_fill_strings.xml",
+ "values-ru/android_touch_to_fill_strings.xml",
+ "values-sk/android_touch_to_fill_strings.xml",
+ "values-sl/android_touch_to_fill_strings.xml",
+ "values-sr/android_touch_to_fill_strings.xml",
+ "values-sv/android_touch_to_fill_strings.xml",
+ "values-sw/android_touch_to_fill_strings.xml",
+ "values-th/android_touch_to_fill_strings.xml",
+ "values-tr/android_touch_to_fill_strings.xml",
+ "values-uk/android_touch_to_fill_strings.xml",
+ "values-vi/android_touch_to_fill_strings.xml",
+ "values-zh-rCN/android_touch_to_fill_strings.xml",
+ "values-zh-rTW/android_touch_to_fill_strings.xml",
+ ]
+}
diff --git a/chromium/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd b/chromium/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd
new file mode 100644
index 00000000000..d2e9ba28188
--- /dev/null
+++ b/chromium/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+
+<grit current_release="1" latest_public_release="0" output_all_resource_defines="false">
+ <outputs>
+ <output filename="values-am/android_touch_to_fill_strings.xml" lang="am" type="android" />
+ <output filename="values-ar/android_touch_to_fill_strings.xml" lang="ar" type="android" />
+ <output filename="values-bg/android_touch_to_fill_strings.xml" lang="bg" type="android" />
+ <output filename="values-ca/android_touch_to_fill_strings.xml" lang="ca" type="android" />
+ <output filename="values-cs/android_touch_to_fill_strings.xml" lang="cs" type="android" />
+ <output filename="values-da/android_touch_to_fill_strings.xml" lang="da" type="android" />
+ <output filename="values-de/android_touch_to_fill_strings.xml" lang="de" type="android" />
+ <output filename="values-el/android_touch_to_fill_strings.xml" lang="el" type="android" />
+ <output filename="values/android_touch_to_fill_strings.xml" lang="en" type="android" />
+ <output filename="values-en-rGB/android_touch_to_fill_strings.xml" lang="en-GB" type="android" />
+ <output filename="values-es/android_touch_to_fill_strings.xml" lang="es" type="android" />
+ <output filename="values-es-rUS/android_touch_to_fill_strings.xml" lang="es-419" type="android" />
+ <output filename="values-fa/android_touch_to_fill_strings.xml" lang="fa" type="android" />
+ <output filename="values-fi/android_touch_to_fill_strings.xml" lang="fi" type="android" />
+ <output filename="values-tl/android_touch_to_fill_strings.xml" lang="fil" type="android" />
+ <output filename="values-fr/android_touch_to_fill_strings.xml" lang="fr" type="android" />
+ <output filename="values-hi/android_touch_to_fill_strings.xml" lang="hi" type="android" />
+ <output filename="values-hr/android_touch_to_fill_strings.xml" lang="hr" type="android" />
+ <output filename="values-hu/android_touch_to_fill_strings.xml" lang="hu" type="android" />
+ <output filename="values-in/android_touch_to_fill_strings.xml" lang="id" type="android" />
+ <output filename="values-it/android_touch_to_fill_strings.xml" lang="it" type="android" />
+ <output filename="values-iw/android_touch_to_fill_strings.xml" lang="iw" type="android" />
+ <output filename="values-ja/android_touch_to_fill_strings.xml" lang="ja" type="android" />
+ <output filename="values-ko/android_touch_to_fill_strings.xml" lang="ko" type="android" />
+ <output filename="values-lt/android_touch_to_fill_strings.xml" lang="lt" type="android" />
+ <output filename="values-lv/android_touch_to_fill_strings.xml" lang="lv" type="android" />
+ <output filename="values-nl/android_touch_to_fill_strings.xml" lang="nl" type="android" />
+ <output filename="values-nb/android_touch_to_fill_strings.xml" lang="no" type="android" />
+ <output filename="values-pl/android_touch_to_fill_strings.xml" lang="pl" type="android" />
+ <output filename="values-pt-rBR/android_touch_to_fill_strings.xml" lang="pt-BR" type="android" />
+ <output filename="values-pt-rPT/android_touch_to_fill_strings.xml" lang="pt-PT" type="android" />
+ <output filename="values-ro/android_touch_to_fill_strings.xml" lang="ro" type="android" />
+ <output filename="values-ru/android_touch_to_fill_strings.xml" lang="ru" type="android" />
+ <output filename="values-sk/android_touch_to_fill_strings.xml" lang="sk" type="android" />
+ <output filename="values-sl/android_touch_to_fill_strings.xml" lang="sl" type="android" />
+ <output filename="values-sr/android_touch_to_fill_strings.xml" lang="sr" type="android" />
+ <output filename="values-sv/android_touch_to_fill_strings.xml" lang="sv" type="android" />
+ <output filename="values-sw/android_touch_to_fill_strings.xml" lang="sw" type="android" />
+ <output filename="values-th/android_touch_to_fill_strings.xml" lang="th" type="android" />
+ <output filename="values-tr/android_touch_to_fill_strings.xml" lang="tr" type="android" />
+ <output filename="values-uk/android_touch_to_fill_strings.xml" lang="uk" type="android" />
+ <output filename="values-vi/android_touch_to_fill_strings.xml" lang="vi" type="android" />
+ <output filename="values-zh-rCN/android_touch_to_fill_strings.xml" lang="zh-CN" type="android" />
+ <output filename="values-zh-rTW/android_touch_to_fill_strings.xml" lang="zh-TW" type="android" />
+ </outputs>
+ <translations>
+ <file lang="am" path="translations/android_touch_to_fill_strings_am.xtb" />
+ <file lang="ar" path="translations/android_touch_to_fill_strings_ar.xtb" />
+ <file lang="bg" path="translations/android_touch_to_fill_strings_bg.xtb" />
+ <file lang="bn" path="translations/android_touch_to_fill_strings_bn.xtb" />
+ <file lang="ca" path="translations/android_touch_to_fill_strings_ca.xtb" />
+ <file lang="cs" path="translations/android_touch_to_fill_strings_cs.xtb" />
+ <file lang="da" path="translations/android_touch_to_fill_strings_da.xtb" />
+ <file lang="de" path="translations/android_touch_to_fill_strings_de.xtb" />
+ <file lang="el" path="translations/android_touch_to_fill_strings_el.xtb" />
+ <file lang="en-GB" path="translations/android_touch_to_fill_strings_en-GB.xtb" />
+ <file lang="es" path="translations/android_touch_to_fill_strings_es.xtb" />
+ <file lang="es-419" path="translations/android_touch_to_fill_strings_es-419.xtb" />
+ <file lang="et" path="translations/android_touch_to_fill_strings_et.xtb" />
+ <file lang="fa" path="translations/android_touch_to_fill_strings_fa.xtb" />
+ <file lang="fi" path="translations/android_touch_to_fill_strings_fi.xtb" />
+ <file lang="fil" path="translations/android_touch_to_fill_strings_fil.xtb" />
+ <file lang="fr" path="translations/android_touch_to_fill_strings_fr.xtb" />
+ <file lang="gu" path="translations/android_touch_to_fill_strings_gu.xtb" />
+ <file lang="hi" path="translations/android_touch_to_fill_strings_hi.xtb" />
+ <file lang="hr" path="translations/android_touch_to_fill_strings_hr.xtb" />
+ <file lang="hu" path="translations/android_touch_to_fill_strings_hu.xtb" />
+ <file lang="id" path="translations/android_touch_to_fill_strings_id.xtb" />
+ <file lang="it" path="translations/android_touch_to_fill_strings_it.xtb" />
+ <file lang="iw" path="translations/android_touch_to_fill_strings_iw.xtb" />
+ <file lang="ja" path="translations/android_touch_to_fill_strings_ja.xtb" />
+ <file lang="ko" path="translations/android_touch_to_fill_strings_ko.xtb" />
+ <file lang="kn" path="translations/android_touch_to_fill_strings_kn.xtb" />
+ <file lang="lt" path="translations/android_touch_to_fill_strings_lt.xtb" />
+ <file lang="lv" path="translations/android_touch_to_fill_strings_lv.xtb" />
+ <file lang="ml" path="translations/android_touch_to_fill_strings_ml.xtb" />
+ <file lang="mr" path="translations/android_touch_to_fill_strings_mr.xtb" />
+ <file lang="ms" path="translations/android_touch_to_fill_strings_ms.xtb" />
+ <file lang="nl" path="translations/android_touch_to_fill_strings_nl.xtb" />
+ <file lang="no" path="translations/android_touch_to_fill_strings_no.xtb" />
+ <file lang="pl" path="translations/android_touch_to_fill_strings_pl.xtb" />
+ <file lang="pt-BR" path="translations/android_touch_to_fill_strings_pt-BR.xtb" />
+ <file lang="pt-PT" path="translations/android_touch_to_fill_strings_pt-PT.xtb" />
+ <file lang="ro" path="translations/android_touch_to_fill_strings_ro.xtb" />
+ <file lang="ru" path="translations/android_touch_to_fill_strings_ru.xtb" />
+ <file lang="sk" path="translations/android_touch_to_fill_strings_sk.xtb" />
+ <file lang="sl" path="translations/android_touch_to_fill_strings_sl.xtb" />
+ <file lang="sr" path="translations/android_touch_to_fill_strings_sr.xtb" />
+ <file lang="sv" path="translations/android_touch_to_fill_strings_sv.xtb" />
+ <file lang="sw" path="translations/android_touch_to_fill_strings_sw.xtb" />
+ <file lang="ta" path="translations/android_touch_to_fill_strings_ta.xtb" />
+ <file lang="te" path="translations/android_touch_to_fill_strings_te.xtb" />
+ <file lang="th" path="translations/android_touch_to_fill_strings_th.xtb" />
+ <file lang="tr" path="translations/android_touch_to_fill_strings_tr.xtb" />
+ <file lang="uk" path="translations/android_touch_to_fill_strings_uk.xtb" />
+ <file lang="vi" path="translations/android_touch_to_fill_strings_vi.xtb" />
+ <file lang="zh-CN" path="translations/android_touch_to_fill_strings_zh-CN.xtb" />
+ <file lang="zh-TW" path="translations/android_touch_to_fill_strings_zh-TW.xtb" />
+ </translations>
+ <release allow_pseudo="false" seq="1">
+ <messages fallback_to_english="true">
+ <!-- Touch To Fill -->
+ <message name="IDS_TOUCH_TO_FILL_SHEET_TITLE" desc="Header for Touch To Fill sheet where users can pick a credential to fill into a form to.">
+ Choose an account
+ </message>
+ <message name="IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_NOT_SECURE" desc="Subtitle for Touch To Fill sheet when the website is not secure. Note that similarly to the omnibox 'not secure' in this case primarily refers to HTTPS connection security. So prefer translations with a connotation of 'not private' (someone can intercept your communication with the site) rather than 'not trustworthy' (which would be a judgment of site reputation).">
+ <ph name="SITE_NAME">%1$s<ex>airbnb.com</ex> (not secure)</ph>
+ </message>
+ <message name="IDS_TOUCH_TO_FILL_CONTENT_DESCRIPTION" desc="Accessibility string read when the Touch To Fill bottom sheet is opened. It describes the bottom sheet where a user can pick a credential to fill into a password form.">
+ List of credentials to be filled on touch.
+ </message>
+ <message name="IDS_TOUCH_TO_FILL_SHEET_HALF_HEIGHT" desc="Accessibility string read when the Touch To Fill bottom sheet showing a list of the user's credentials is opened at half height. The sheet will occupy the bottom half the screen.">
+ List of credentials to be filled on touch opened at half height.
+ </message>
+ <message name="IDS_TOUCH_TO_FILL_SHEET_FULL_HEIGHT" desc="Accessibility string read when the Touch To Fill bottom sheet showing a list of the user's credentials is opened at full height. The sheet will occupy the entire screen.">
+ List of credentials to be filled on touch opened at full height.
+ </message>
+ <message name="IDS_TOUCH_TO_FILL_SHEET_CLOSED" desc="Accessibility string read when the Touch To Fill bottom sheet showing a list of the user's credentials is closed.">
+ List of credentials to be filled on touch is closed.
+ </message>
+ <message name="IDS_MANAGE_PASSWORDS" desc="Title of the button at the end of a touch to fill sheet that will open the password preferences when tapped.">
+ Manage passwords
+ </message>
+ <message name="IDS_TOUCH_TO_FILL_CONFIRM" desc="Title of the button that confirms filling the only available set of credentials.">
+ Use password
+ </message>
+ </messages>
+ </release>
+</grit>
diff --git a/chromium/chrome/browser/ui/BUILD.gn b/chromium/chrome/browser/ui/BUILD.gn
index 1826b714b2e..b0ff168a4ec 100644
--- a/chromium/chrome/browser/ui/BUILD.gn
+++ b/chromium/chrome/browser/ui/BUILD.gn
@@ -9,7 +9,6 @@ import("//build/config/features.gni")
import("//build/config/jumbo.gni")
import("//build/config/linux/gtk/gtk.gni")
import("//build/config/ui.gni")
-import("//build/split_static_library.gni")
import("//chrome/common/features.gni")
import("//chromeos/assistant/assistant.gni")
import("//components/feature_engagement/features.gni")
@@ -28,23 +27,14 @@ import("//ui/views/features.gni")
# Use a static library here because many test binaries depend on this but don't
# require many files from it. This makes linking more efficient.
-jumbo_split_static_library("ui") {
- # Split into multiple static libraries on Windows builds. We have hit size
- # limits on Windows official builds and on goma builds when symbol_level = 2
- # is selected. Always splitting on Windows builds is simpler than trying to
- # perfectly calculate the scenarios where it is required.
- if (is_win) {
- split_count = 5
- } else {
- split_count = 1
- }
-
+jumbo_static_library("ui") {
sources = [
"accelerator_utils.h",
"app_list/app_list_util.cc",
"app_list/app_list_util.h",
# All other browser/ui/app_list files go under enable_app_list below.
+ "autofill/autofill_bubble_handler.h",
"autofill/autofill_popup_controller.h",
"autofill/autofill_popup_controller_impl.cc",
"autofill/autofill_popup_controller_impl.h",
@@ -58,8 +48,6 @@ jumbo_split_static_library("ui") {
"autofill/chrome_autofill_client.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",
@@ -72,6 +60,8 @@ jumbo_split_static_library("ui") {
"autofill/popup_controller_common.h",
"autofill/popup_view_common.cc",
"autofill/popup_view_common.h",
+ "autofill/test/test_autofill_bubble_handler.cc",
+ "autofill/test/test_autofill_bubble_handler.h",
"blocked_content/blocked_window_params.cc",
"blocked_content/blocked_window_params.h",
"blocked_content/list_item_position.cc",
@@ -137,8 +127,6 @@ jumbo_split_static_library("ui") {
"page_info/page_info_ui.h",
"passwords/account_avatar_fetcher.cc",
"passwords/account_avatar_fetcher.h",
- "passwords/credential_leak_dialog_utils.cc",
- "passwords/credential_leak_dialog_utils.h",
"passwords/manage_passwords_state.cc",
"passwords/manage_passwords_state.h",
"passwords/manage_passwords_view_utils.cc",
@@ -382,11 +370,13 @@ jumbo_split_static_library("ui") {
"//components/sync_user_events",
"//components/translate/content/browser",
"//content/public/browser",
+ "//mojo/public/cpp/bindings",
]
deps = [
"//base",
"//base:i18n",
"//base/allocator:buildflags",
+ "//build:branding_buildflags",
"//cc/paint",
"//chrome:extra_resources",
"//chrome:resources",
@@ -403,6 +393,8 @@ jumbo_split_static_library("ui") {
"//chrome/browser/media:mojo_bindings",
"//chrome/browser/notifications/scheduler/public",
"//chrome/browser/profiling_host",
+ "//chrome/browser/resources/omnibox:resources",
+ "//chrome/browser/resources/usb_internals:resources",
"//chrome/browser/safe_browsing",
"//chrome/browser/ssl:proto",
"//chrome/browser/ui/webui/bluetooth_internals",
@@ -430,7 +422,6 @@ jumbo_split_static_library("ui") {
"//components/data_reduction_proxy/core/browser",
"//components/device_event_log",
"//components/dom_distiller/content/browser",
- "//components/dom_distiller/webui",
"//components/domain_reliability",
"//components/download/content/factory",
"//components/download/content/public",
@@ -473,6 +464,7 @@ jumbo_split_static_library("ui") {
"//components/payments/content/icon",
"//components/payments/core:error_strings",
"//components/pdf/browser",
+ "//components/performance_manager",
"//components/policy/core/browser",
"//components/pref_registry",
"//components/previews/content",
@@ -511,6 +503,7 @@ jumbo_split_static_library("ui") {
"//components/subresource_filter/content/browser",
"//components/subresource_filter/core/browser",
"//components/sync",
+ "//components/sync/driver:resources",
"//components/sync_preferences",
"//components/sync_sessions",
"//components/tracing:startup_tracing",
@@ -615,10 +608,17 @@ jumbo_split_static_library("ui") {
]
}
- if (is_android || is_linux) {
+ if (is_win || is_android || is_linux) {
+ sources += [
+ "webui/sandbox/sandbox_internals_ui.cc",
+ "webui/sandbox/sandbox_internals_ui.h",
+ ]
+ }
+
+ if (is_win) {
sources += [
- "webui/sandbox_internals_ui.cc",
- "webui/sandbox_internals_ui.h",
+ "webui/sandbox/sandbox_handler.cc",
+ "webui/sandbox/sandbox_handler.h",
]
}
@@ -930,10 +930,13 @@ jumbo_split_static_library("ui") {
"global_error/global_error_service_factory.h",
"global_media_controls/media_dialog_delegate.cc",
"global_media_controls/media_dialog_delegate.h",
+ "global_media_controls/media_notification_container_impl.h",
+ "global_media_controls/media_notification_container_observer.h",
"global_media_controls/media_toolbar_button_controller.cc",
"global_media_controls/media_toolbar_button_controller.h",
"global_media_controls/media_toolbar_button_controller_delegate.cc",
"global_media_controls/media_toolbar_button_controller_delegate.h",
+ "global_media_controls/media_toolbar_button_observer.h",
"hats/hats_helper.cc",
"hats/hats_helper.h",
"hats/hats_service.cc",
@@ -963,7 +966,6 @@ jumbo_split_static_library("ui") {
"intent_picker_tab_helper.h",
"layout_constants.cc",
"layout_constants.h",
- "location_bar/location_bar.cc",
"location_bar/location_bar.h",
"managed_ui.cc",
"managed_ui.h",
@@ -1006,7 +1008,7 @@ jumbo_split_static_library("ui") {
"omnibox/clipboard_utils.h",
"omnibox/omnibox_theme.cc",
"omnibox/omnibox_theme.h",
- "page_action/page_action_icon_container.h",
+ "page_action/page_action_icon_type.h",
"page_info/page_info_dialog.cc",
"page_info/page_info_dialog.h",
"page_info/page_info_infobar_delegate.cc",
@@ -1119,6 +1121,8 @@ jumbo_split_static_library("ui") {
"tabs/tab_menu_model.h",
"tabs/tab_network_state.cc",
"tabs/tab_network_state.h",
+ "tabs/tab_renderer_data.cc",
+ "tabs/tab_renderer_data.h",
"tabs/tab_strip_model.cc",
"tabs/tab_strip_model.h",
"tabs/tab_strip_model_delegate.cc",
@@ -1187,8 +1191,6 @@ jumbo_split_static_library("ui") {
"webui/app_management/app_management_page_handler.h",
"webui/app_management/app_management_shelf_delegate_chromeos.cc",
"webui/app_management/app_management_shelf_delegate_chromeos.h",
- "webui/app_management/app_management_ui.cc",
- "webui/app_management/app_management_ui.h",
"webui/bookmarks/bookmarks_message_handler.cc",
"webui/bookmarks/bookmarks_message_handler.h",
"webui/bookmarks/bookmarks_ui.cc",
@@ -1245,6 +1247,8 @@ jumbo_split_static_library("ui") {
"webui/ntp/app_launcher_handler.h",
"webui/ntp/app_resource_cache_factory.cc",
"webui/ntp/app_resource_cache_factory.h",
+ "webui/ntp/cookie_controls_handler.cc",
+ "webui/ntp/cookie_controls_handler.h",
"webui/ntp/core_app_launcher_handler.cc",
"webui/ntp/core_app_launcher_handler.h",
"webui/ntp/new_tab_ui.cc",
@@ -1352,7 +1356,6 @@ jumbo_split_static_library("ui") {
]
deps += [
"//base/util/values:values_util",
- "//build:branding_buildflags",
"//chrome/app/vector_icons",
"//chrome/browser:theme_properties",
"//chrome/browser/media/router",
@@ -1368,6 +1371,7 @@ jumbo_split_static_library("ui") {
"//components/feedback/proto",
"//components/keep_alive_registry",
"//components/network_session_configurator/common",
+ "//components/page_load_metrics/browser",
"//components/profile_metrics",
"//components/ui_metrics",
"//components/url_formatter",
@@ -1602,6 +1606,8 @@ jumbo_split_static_library("ui") {
"views/touch_selection_menu_chromeos.h",
"views/touch_selection_menu_runner_chromeos.cc",
"views/touch_selection_menu_runner_chromeos.h",
+ "webui/chromeos/account_manager_error_ui.cc",
+ "webui/chromeos/account_manager_error_ui.h",
"webui/chromeos/account_manager_welcome_dialog.cc",
"webui/chromeos/account_manager_welcome_dialog.h",
"webui/chromeos/account_manager_welcome_ui.cc",
@@ -1646,6 +1652,12 @@ jumbo_split_static_library("ui") {
"webui/chromeos/cellular_setup/mobile_setup_ui.h",
"webui/chromeos/certificate_manager_dialog_ui.cc",
"webui/chromeos/certificate_manager_dialog_ui.h",
+ "webui/chromeos/crostini_installer/crostini_installer_dialog.cc",
+ "webui/chromeos/crostini_installer/crostini_installer_dialog.h",
+ "webui/chromeos/crostini_installer/crostini_installer_page_handler.cc",
+ "webui/chromeos/crostini_installer/crostini_installer_page_handler.h",
+ "webui/chromeos/crostini_installer/crostini_installer_ui.cc",
+ "webui/chromeos/crostini_installer/crostini_installer_ui.h",
"webui/chromeos/cryptohome_ui.cc",
"webui/chromeos/cryptohome_ui.h",
"webui/chromeos/cryptohome_web_ui_handler.cc",
@@ -1890,6 +1902,7 @@ jumbo_split_static_library("ui") {
"webui/version_handler_chromeos.h",
"window_sizer/window_sizer_ash.cc",
]
+
deps += [
"//ash",
"//ash/components/shortcut_viewer",
@@ -1902,12 +1915,14 @@ jumbo_split_static_library("ui") {
"//chrome/browser/resources/chromeos:camera_resources",
"//chrome/browser/ui/webui/app_management:mojo_bindings",
"//chrome/browser/ui/webui/chromeos/add_supervision:mojo_bindings",
+ "//chrome/browser/ui/webui/chromeos/crostini_installer:mojo_bindings",
"//chrome/browser/ui/webui/chromeos/machine_learning:mojo_bindings",
"//chrome/services/file_util/public/cpp",
"//chromeos",
"//chromeos/assistant:buildflags",
"//chromeos/audio",
"//chromeos/components/account_manager",
+ "//chromeos/components/media_app_ui",
"//chromeos/components/multidevice",
"//chromeos/components/multidevice/debug_webui",
"//chromeos/components/multidevice/logging",
@@ -1947,7 +1962,6 @@ jumbo_split_static_library("ui") {
"//components/arc",
"//components/captive_portal",
"//components/consent_auditor:consent_auditor",
- "//components/drive:drive_chromeos",
"//components/exo",
"//components/login",
"//components/session_manager/core",
@@ -1980,13 +1994,25 @@ jumbo_split_static_library("ui") {
if (is_win || is_mac || is_desktop_linux || is_chromeos) {
sources += [
- "autofill/payments/webauthn_offer_dialog.h",
- "autofill/payments/webauthn_offer_dialog_controller.cc",
+ "autofill/payments/verify_pending_dialog_controller.h",
+ "autofill/payments/verify_pending_dialog_controller_impl.cc",
+ "autofill/payments/verify_pending_dialog_controller_impl.h",
+ "autofill/payments/verify_pending_dialog_view.h",
"autofill/payments/webauthn_offer_dialog_controller.h",
+ "autofill/payments/webauthn_offer_dialog_controller_impl.cc",
+ "autofill/payments/webauthn_offer_dialog_controller_impl.h",
+ "autofill/payments/webauthn_offer_dialog_model.cc",
+ "autofill/payments/webauthn_offer_dialog_model.h",
+ "autofill/payments/webauthn_offer_dialog_model_observer.h",
+ "autofill/payments/webauthn_offer_dialog_view.h",
"frame/window_frame_util.cc",
"frame/window_frame_util.h",
- "views/autofill/payments/webauthn_offer_dialog_view.cc",
- "views/autofill/payments/webauthn_offer_dialog_view.h",
+ "tab_contents/chrome_web_contents_view_handle_drop.cc",
+ "tab_contents/chrome_web_contents_view_handle_drop.h",
+ "views/autofill/payments/verify_pending_dialog_view_impl.cc",
+ "views/autofill/payments/verify_pending_dialog_view_impl.h",
+ "views/autofill/payments/webauthn_offer_dialog_view_impl.cc",
+ "views/autofill/payments/webauthn_offer_dialog_view_impl.h",
"views/close_bubble_on_tab_activation_helper.cc",
"views/close_bubble_on_tab_activation_helper.h",
"views/hats/hats_bubble_view.cc",
@@ -1999,6 +2025,8 @@ jumbo_split_static_library("ui") {
"views/profiles/profile_menu_view_base.h",
"webui/discards/discards_ui.cc",
"webui/discards/discards_ui.h",
+ "webui/discards/graph_dump_impl.cc",
+ "webui/discards/graph_dump_impl.h",
"webui/signin/inline_login_handler.cc",
"webui/signin/inline_login_handler.h",
"webui/signin/inline_login_ui.cc",
@@ -2268,6 +2296,8 @@ jumbo_split_static_library("ui") {
"cocoa/touchbar/web_textfield_touch_bar_controller.mm",
"cocoa/window_size_autosaver.h",
"cocoa/window_size_autosaver.mm",
+ "content_settings/media_authorization_wrapper_test.h",
+ "content_settings/media_authorization_wrapper_test.mm",
"views/apps/chrome_app_window_client_views_mac.mm",
"views/certificate_viewer_mac_views.mm",
"views/dropdown_bar_host_mac.mm",
@@ -2455,8 +2485,6 @@ jumbo_split_static_library("ui") {
if (use_x11) {
sources += [
- "views/frame/browser_desktop_window_tree_host_x11.cc",
- "views/frame/browser_desktop_window_tree_host_x11.h",
"views/frame/global_menu_bar_registrar_x11.cc",
"views/frame/global_menu_bar_registrar_x11.h",
"views/frame/global_menu_bar_x11.cc",
@@ -2478,12 +2506,20 @@ jumbo_split_static_library("ui") {
]
}
if (use_ozone) {
+ if (!is_desktop_linux) {
+ sources += [
+ "views/frame/browser_desktop_window_tree_host_platform.cc",
+ "views/frame/browser_desktop_window_tree_host_platform.h",
+ ]
+ }
+ sources += [ "views/frame/native_browser_frame_factory_ozone.cc" ]
+ deps += [ "//ui/platform_window" ]
+ }
+ if (is_desktop_linux) {
sources += [
- "views/frame/browser_desktop_window_tree_host_platform.cc",
- "views/frame/browser_desktop_window_tree_host_platform.h",
- "views/frame/native_browser_frame_factory_ozone.cc",
+ "views/frame/browser_desktop_window_tree_host_linux.cc",
+ "views/frame/browser_desktop_window_tree_host_linux.h",
]
- deps += [ "//ui/platform_window" ]
}
if (use_gtk) {
# This is the only component that can interact with gtk.
@@ -2541,6 +2577,9 @@ jumbo_split_static_library("ui") {
"cookie_controls/cookie_controls_view.h",
"manifest_web_app_browser_controller.cc",
"manifest_web_app_browser_controller.h",
+ "qrcode_generator/qrcode_generator_bubble_controller.cc",
+ "qrcode_generator/qrcode_generator_bubble_controller.h",
+ "qrcode_generator/qrcode_generator_bubble_view.h",
"send_tab_to_self/send_tab_to_self_bubble_controller.cc",
"send_tab_to_self/send_tab_to_self_bubble_controller.h",
"send_tab_to_self/send_tab_to_self_bubble_view.h",
@@ -2566,8 +2605,12 @@ jumbo_split_static_library("ui") {
"views/apps/app_info_dialog/app_info_permissions_panel.h",
"views/apps/app_info_dialog/app_info_summary_panel.cc",
"views/apps/app_info_dialog/app_info_summary_panel.h",
+ "views/apps/app_uninstall_dialog_view.cc",
+ "views/apps/app_uninstall_dialog_view.h",
"views/apps/chrome_native_app_window_views.cc",
"views/apps/chrome_native_app_window_views.h",
+ "views/autofill/autofill_bubble_handler_impl.cc",
+ "views/autofill/autofill_bubble_handler_impl.h",
"views/autofill/autofill_popup_base_view.cc",
"views/autofill/autofill_popup_base_view.h",
"views/autofill/autofill_popup_view_native_views.cc",
@@ -2616,6 +2659,7 @@ jumbo_split_static_library("ui") {
"views/bookmarks/bookmark_menu_controller_views.h",
"views/bookmarks/bookmark_menu_delegate.cc",
"views/bookmarks/bookmark_menu_delegate.h",
+ "views/browser_commands_views.cc",
"views/browser_dialogs_views.cc",
"views/bubble_anchor_util_views.cc",
"views/bubble_anchor_util_views.h",
@@ -2742,12 +2786,6 @@ jumbo_split_static_library("ui") {
"views/frame/contents_layout_manager.h",
"views/frame/contents_web_view.cc",
"views/frame/contents_web_view.h",
- "views/frame/hosted_app_button_container.cc",
- "views/frame/hosted_app_button_container.h",
- "views/frame/hosted_app_menu_button.cc",
- "views/frame/hosted_app_menu_button.h",
- "views/frame/hosted_app_origin_text.cc",
- "views/frame/hosted_app_origin_text.h",
"views/frame/immersive_mode_controller.cc",
"views/frame/immersive_mode_controller.h",
"views/frame/immersive_mode_controller_factory_views.cc",
@@ -2765,6 +2803,8 @@ jumbo_split_static_library("ui") {
"views/frame/terminal_system_app_menu_button_chromeos.cc",
"views/frame/terminal_system_app_menu_button_chromeos.h",
"views/frame/toolbar_button_provider.h",
+ "views/frame/top_container_background.cc",
+ "views/frame/top_container_background.h",
"views/frame/top_container_view.cc",
"views/frame/top_container_view.h",
"views/frame/top_controls_slide_controller.h",
@@ -2785,8 +2825,9 @@ jumbo_split_static_library("ui") {
"views/global_error_bubble_view.h",
"views/global_media_controls/media_dialog_view.cc",
"views/global_media_controls/media_dialog_view.h",
- "views/global_media_controls/media_notification_container_impl.cc",
- "views/global_media_controls/media_notification_container_impl.h",
+ "views/global_media_controls/media_dialog_view_observer.h",
+ "views/global_media_controls/media_notification_container_impl_view.cc",
+ "views/global_media_controls/media_notification_container_impl_view.h",
"views/global_media_controls/media_notification_list_view.cc",
"views/global_media_controls/media_notification_list_view.h",
"views/global_media_controls/media_toolbar_button_view.cc",
@@ -2811,8 +2852,6 @@ jumbo_split_static_library("ui") {
"views/infobars/infobar_view.h",
"views/javascript_dialog_views.cc",
"views/javascript_dialog_views.h",
- "views/layout/animating_layout_manager.cc",
- "views/layout/animating_layout_manager.h",
"views/layout/interpolating_layout_manager.cc",
"views/layout/interpolating_layout_manager.h",
"views/load_complete_listener.cc",
@@ -2919,8 +2958,10 @@ 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/omnibox_page_action_icon_container_view.cc",
- "views/page_action/omnibox_page_action_icon_container_view.h",
+ "views/page_action/page_action_icon_container_view.cc",
+ "views/page_action/page_action_icon_container_view.h",
+ "views/page_action/page_action_icon_loading_indicator_view.cc",
+ "views/page_action/page_action_icon_loading_indicator_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",
@@ -3018,6 +3059,10 @@ jumbo_split_static_library("ui") {
"views/permission_bubble/permission_prompt_impl_views.cc",
"views/profiles/avatar_toolbar_button.cc",
"views/profiles/avatar_toolbar_button.h",
+ "views/qrcode_generator/qrcode_generator_bubble.cc",
+ "views/qrcode_generator/qrcode_generator_bubble.h",
+ "views/qrcode_generator/qrcode_generator_icon_view.cc",
+ "views/qrcode_generator/qrcode_generator_icon_view.h",
"views/reader_mode/reader_mode_icon_view.cc",
"views/reader_mode/reader_mode_icon_view.h",
"views/relaunch_notification/relaunch_notification_controller.cc",
@@ -3032,6 +3077,8 @@ jumbo_split_static_library("ui") {
"views/relaunch_notification/wall_clock_timer.h",
"views/sad_tab_view.cc",
"views/sad_tab_view.h",
+ "views/safe_browsing/deep_scanning_modal_dialog.cc",
+ "views/safe_browsing/deep_scanning_modal_dialog.h",
"views/safe_browsing/password_reuse_modal_warning_dialog.cc",
"views/safe_browsing/password_reuse_modal_warning_dialog.h",
"views/send_tab_to_self/send_tab_to_self_bubble_device_button.cc",
@@ -3092,12 +3139,12 @@ jumbo_split_static_library("ui") {
"views/tabs/tab_group_editor_bubble_view.h",
"views/tabs/tab_group_header.cc",
"views/tabs/tab_group_header.h",
+ "views/tabs/tab_group_underline.cc",
+ "views/tabs/tab_group_underline.h",
"views/tabs/tab_hover_card_bubble_view.cc",
"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_slot_view.h",
"views/tabs/tab_strip.cc",
"views/tabs/tab_strip.h",
@@ -3130,6 +3177,8 @@ jumbo_split_static_library("ui") {
"views/toolbar/home_button.h",
"views/toolbar/reload_button.cc",
"views/toolbar/reload_button.h",
+ "views/toolbar/toolbar_account_icon_container_view.cc",
+ "views/toolbar/toolbar_account_icon_container_view.h",
"views/toolbar/toolbar_action_view.cc",
"views/toolbar/toolbar_action_view.h",
"views/toolbar/toolbar_action_view_delegate_views.h",
@@ -3141,8 +3190,6 @@ jumbo_split_static_library("ui") {
"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",
@@ -3153,6 +3200,12 @@ jumbo_split_static_library("ui") {
"views/translate/translate_icon_view.h",
"views/update_recommended_message_box.cc",
"views/update_recommended_message_box.h",
+ "views/web_apps/web_app_frame_toolbar_view.cc",
+ "views/web_apps/web_app_frame_toolbar_view.h",
+ "views/web_apps/web_app_menu_button.cc",
+ "views/web_apps/web_app_menu_button.h",
+ "views/web_apps/web_app_origin_text.cc",
+ "views/web_apps/web_app_origin_text.h",
"views/webauthn/authenticator_ble_pin_entry_sheet_view.cc",
"views/webauthn/authenticator_ble_pin_entry_sheet_view.h",
"views/webauthn/authenticator_client_pin_entry_sheet_view.cc",
@@ -3197,7 +3250,6 @@ jumbo_split_static_library("ui") {
"webauthn/transport_utils.h",
]
deps += [
- "//build:branding_buildflags",
"//chrome/browser/ui/views",
"//components/constrained_window",
"//components/media_message_center",
@@ -3465,14 +3517,14 @@ jumbo_split_static_library("ui") {
"app_list/search/common/file_icon_util.h",
"app_list/search/common/url_icon_source.cc",
"app_list/search/common/url_icon_source.h",
+ "app_list/search/cros_action_history/cros_action_recorder.cc",
+ "app_list/search/cros_action_history/cros_action_recorder.h",
"app_list/search/drive_quick_access_provider.cc",
"app_list/search/drive_quick_access_provider.h",
"app_list/search/drive_quick_access_result.cc",
"app_list/search/drive_quick_access_result.h",
"app_list/search/extension_app_result.cc",
"app_list/search/extension_app_result.h",
- "app_list/search/logging/search_ranking_event_logger.cc",
- "app_list/search/logging/search_ranking_event_logger.h",
"app_list/search/mixer.cc",
"app_list/search/mixer.h",
"app_list/search/omnibox_provider.cc",
@@ -3517,8 +3569,12 @@ jumbo_split_static_library("ui") {
"app_list/search/search_result_ranker/recurrence_ranker.h",
"app_list/search/search_result_ranker/recurrence_ranker_util.cc",
"app_list/search/search_result_ranker/recurrence_ranker_util.h",
+ "app_list/search/search_result_ranker/search_ranking_event_logger.cc",
+ "app_list/search/search_result_ranker/search_ranking_event_logger.h",
"app_list/search/search_result_ranker/search_result_ranker.cc",
"app_list/search/search_result_ranker/search_result_ranker.h",
+ "app_list/search/search_utils/fuzzy_tokenized_string_match.cc",
+ "app_list/search/search_utils/fuzzy_tokenized_string_match.h",
"app_list/search/search_utils/sequence_matcher.cc",
"app_list/search/search_utils/sequence_matcher.h",
"app_list/search/settings_shortcut/settings_shortcut_metadata.cc",
@@ -3538,11 +3594,12 @@ jumbo_split_static_library("ui") {
"//ash/app_list",
"//ash/public/cpp/app_list/vector_icons",
"//ash/resources/vector_icons",
- "//chrome/browser/ui/app_list/search/logging:search_ranking_event_proto",
+ "//chrome/browser/ui/app_list/search/cros_action_history:cros_action_proto",
"//chrome/browser/ui/app_list/search/search_result_ranker:app_launch_event_logger_proto",
"//chrome/browser/ui/app_list/search/search_result_ranker:app_launch_predictor_proto",
"//chrome/browser/ui/app_list/search/search_result_ranker:app_list_launch_recorder_proto",
"//chrome/browser/ui/app_list/search/search_result_ranker:recurrence_ranker_proto",
+ "//chrome/browser/ui/app_list/search/search_result_ranker:search_ranking_event_proto",
"//components/assist_ranker",
"//components/assist_ranker/proto",
"//ui/file_manager:file_manager",
@@ -3551,12 +3608,12 @@ jumbo_split_static_library("ui") {
if (is_chromeos) {
sources += [
"app_icon_loader_delegate.h",
- "app_list/app_service_app_icon_loader.cc",
- "app_list/app_service_app_icon_loader.h",
- "app_list/app_service_app_item.cc",
- "app_list/app_service_app_item.h",
- "app_list/app_service_app_model_builder.cc",
- "app_list/app_service_app_model_builder.h",
+ "app_list/app_service/app_service_app_icon_loader.cc",
+ "app_list/app_service/app_service_app_icon_loader.h",
+ "app_list/app_service/app_service_app_item.cc",
+ "app_list/app_service/app_service_app_item.h",
+ "app_list/app_service/app_service_app_model_builder.cc",
+ "app_list/app_service/app_service_app_model_builder.h",
"app_list/arc/arc_app_context_menu.cc",
"app_list/arc/arc_app_context_menu.h",
"app_list/arc/arc_app_dialog.h",
@@ -3633,8 +3690,6 @@ jumbo_split_static_library("ui") {
"app_list/search/arc_app_result.h",
"app_list/search/crostini_app_result.cc",
"app_list/search/crostini_app_result.h",
- "app_list/search/internal_app_result.cc",
- "app_list/search/internal_app_result.h",
"ash/launcher/app_window_base.cc",
"ash/launcher/app_window_base.h",
"ash/launcher/arc_app_shelf_id.cc",
@@ -3671,10 +3726,14 @@ jumbo_split_static_library("ui") {
"ash/launcher/shelf_spinner_item_controller.h",
"views/arc_app_dialog_view.cc",
"views/arc_data_removal_dialog_view.cc",
+ "views/crostini/crostini_ansible_software_config_view.cc",
+ "views/crostini/crostini_ansible_software_config_view.h",
"views/crostini/crostini_app_restart_view.cc",
"views/crostini/crostini_app_restart_view.h",
"views/crostini/crostini_app_uninstaller_view.cc",
"views/crostini/crostini_app_uninstaller_view.h",
+ "views/crostini/crostini_force_close_view.cc",
+ "views/crostini/crostini_force_close_view.h",
"views/crostini/crostini_installer_view.cc",
"views/crostini/crostini_installer_view.h",
"views/crostini/crostini_uninstaller_view.cc",
@@ -3687,6 +3746,7 @@ jumbo_split_static_library("ui") {
"views/plugin_vm/plugin_vm_launcher_view.h",
]
deps += [
+ "//chrome/browser/chromeos/crostini:crostini_installer_types_mojom",
"//chrome/services/app_service/public/cpp:app_update",
"//chrome/services/app_service/public/cpp:icon_loader",
"//components/services/app_service/public/cpp:app_file_handling",
@@ -3694,7 +3754,7 @@ jumbo_split_static_library("ui") {
}
}
- if (enable_cros_assistant) {
+ if (is_chromeos) {
deps += [
"//ash/public/cpp",
"//chromeos/services/assistant:lib",
@@ -3718,6 +3778,8 @@ jumbo_split_static_library("ui") {
"ash/assistant/assistant_service_connection.h",
"ash/assistant/assistant_setup.cc",
"ash/assistant/assistant_setup.h",
+ "ash/assistant/assistant_state_client.cc",
+ "ash/assistant/assistant_state_client.h",
"ash/assistant/device_actions.cc",
"ash/assistant/device_actions.h",
"ash/assistant/proactive_suggestions_client_impl.cc",
diff --git a/chromium/chrome/browser/ui/android/widget/BUILD.gn b/chromium/chrome/browser/ui/android/widget/BUILD.gn
index 13fa251ecb6..eb23453f841 100644
--- a/chromium/chrome/browser/ui/android/widget/BUILD.gn
+++ b/chromium/chrome/browser/ui/android/widget/BUILD.gn
@@ -3,21 +3,64 @@
# found in the LICENSE file.
import("//build/config/android/rules.gni")
+import("//ui/android/features.gni")
android_library("java") {
java_files = [
+ "java/src/org/chromium/chrome/browser/ui/widget/AlwaysDismissedDialog.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/BoundedLinearLayout.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/ClipDrawableProgressBar.java",
"java/src/org/chromium/chrome/browser/ui/widget/CompositeTouchDelegate.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/ContextMenuDialog.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/DualControlLayout.java",
"java/src/org/chromium/chrome/browser/ui/widget/FadingShadow.java",
"java/src/org/chromium/chrome/browser/ui/widget/FadingShadowView.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/FadingEdgeScrollView.java",
"java/src/org/chromium/chrome/browser/ui/widget/ListMenuButton.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/LoadingView.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/PaddedFrameLayout.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/PromoDialog.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/PromoDialogLayout.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/MaterialProgressBar.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/RadioButtonLayout.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/RadioButtonWithDescription.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/RoundedCornerImageView.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/RoundedIconGenerator.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/TintedDrawable.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/ViewResourceFrameLayout.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/animation/AnimatorProperties.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/animation/CancelAwareAnimatorListener.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/animation/FocusAnimator.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/animation/Interpolators.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/displaystyle/DisplayStyleObserver.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/displaystyle/DisplayStyleObserverAdapter.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/displaystyle/HorizontalDisplayStyle.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/displaystyle/UiConfig.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/displaystyle/VerticalDisplayStyle.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/displaystyle/ViewResizer.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/dragreorder/DragReorderableListAdapter.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/dragreorder/DragStateDelegate.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/highlight/PulseDrawable.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/highlight/PulseInterpolator.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/highlight/ViewHighlighter.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/text/AccessibleTextView.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/text/AlertDialogEditText.java",
"java/src/org/chromium/chrome/browser/ui/widget/text/TextViewWithCompoundDrawables.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/text/VerticallyFixedEditText.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/textbubble/ArrowBubbleDrawable.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/textbubble/ImageTextBubble.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/textbubble/TextBubble.java",
]
deps = [
":ui_widget_java_resources",
"//base:base_java",
+ "//chrome/browser/util/android:java",
+ "//third_party/android_deps:android_support_v4_java",
"//third_party/android_deps:android_support_v7_appcompat_java",
"//third_party/android_deps:com_android_support_design_java",
+ "//third_party/android_deps:com_android_support_interpolator_java",
+ "//third_party/android_deps:com_android_support_recyclerview_v7_java",
"//ui/android:ui_java",
]
}
@@ -27,8 +70,13 @@ android_resources("ui_widget_java_resources") {
resource_dirs = [ "java/res" ]
deps = [
":ui_widget_strings_grd",
+ "//third_party/android_deps:com_android_support_design_java",
"//ui/android:ui_java_resources",
]
+
+ if (enable_android_night_mode) {
+ resource_dirs += [ "java/res_night" ]
+ }
}
java_strings_grd("ui_widget_strings_grd") {
@@ -90,8 +138,53 @@ java_strings_grd("ui_widget_strings_grd") {
]
}
+android_library("test_support_java") {
+ testonly = true
+
+ java_files = [ "test/java/src/org/chromium/chrome/browser/ui/widget/highlight/ViewHighlighterTestUtils.java" ]
+ deps = [
+ ":java",
+ "//content/public/test/android:content_java_test_support",
+ ]
+}
+
+android_library("ui_widget_java_tests") {
+ testonly = true
+
+ java_files = [
+ "java/src/org/chromium/chrome/browser/ui/widget/DualControlLayoutTest.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/PromoDialogTest.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/RadioButtonLayoutTest.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/RoundedIconGeneratorTest.java",
+ "java/src/org/chromium/chrome/browser/ui/widget/highlight/ViewHighlighterTest.java",
+ ]
+ deps = [
+ ":java",
+ ":test_support_java",
+ ":ui_widget_java_resources",
+ ":ui_widget_java_test_resources",
+ "//base:base_java_test_support",
+ "//chrome/test/android:chrome_java_test_support",
+ "//content/public/test/android:content_java_test_support",
+ "//third_party/android_deps:com_android_support_support_compat_java",
+ "//third_party/android_support_test_runner:rules_java",
+ "//third_party/android_support_test_runner:runner_java",
+ "//third_party/junit",
+ ]
+}
+
+android_resources("ui_widget_java_test_resources") {
+ custom_package = "org.chromium.chrome.browser.ui.widget.test"
+ resource_dirs = [ "test/java/res" ]
+ deps = [
+ ":ui_widget_java_resources",
+ ":ui_widget_strings_grd",
+ "//ui/android:ui_java_resources",
+ ]
+}
+
junit_binary("ui_widget_junit_tests") {
- java_files = [ "junit/src/org/chromium/chrome//browser/ui/widget/CompositeTouchDelegateTest.java" ]
+ java_files = [ "java/src/org/chromium/chrome/browser/ui/widget/CompositeTouchDelegateUnitTest.java" ]
deps = [
":java",
"//base:base_java",
diff --git a/chromium/chrome/browser/ui/app_list/search/cros_action_history/BUILD.gn b/chromium/chrome/browser/ui/app_list/search/cros_action_history/BUILD.gn
new file mode 100644
index 00000000000..19d6c05846e
--- /dev/null
+++ b/chromium/chrome/browser/ui/app_list/search/cros_action_history/BUILD.gn
@@ -0,0 +1,11 @@
+# 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/protobuf/proto_library.gni")
+
+proto_library("cros_action_proto") {
+ sources = [
+ "cros_action.proto",
+ ]
+}
diff --git a/chromium/chrome/browser/ui/app_list/search/search_result_ranker/BUILD.gn b/chromium/chrome/browser/ui/app_list/search/search_result_ranker/BUILD.gn
index d23cd7bca16..f3737af729b 100644
--- a/chromium/chrome/browser/ui/app_list/search/search_result_ranker/BUILD.gn
+++ b/chromium/chrome/browser/ui/app_list/search/search_result_ranker/BUILD.gn
@@ -30,3 +30,9 @@ proto_library("recurrence_ranker_proto") {
"recurrence_ranker_config.proto",
]
}
+
+proto_library("search_ranking_event_proto") {
+ sources = [
+ "search_ranking_event.proto",
+ ]
+}
diff --git a/chromium/chrome/browser/ui/libgtkui/BUILD.gn b/chromium/chrome/browser/ui/libgtkui/BUILD.gn
index 7895f25952d..b1b8e33e8b3 100644
--- a/chromium/chrome/browser/ui/libgtkui/BUILD.gn
+++ b/chromium/chrome/browser/ui/libgtkui/BUILD.gn
@@ -8,24 +8,18 @@ import("//build/config/features.gni")
import("//build/config/jumbo.gni")
import("//build/config/linux/gtk/gtk.gni")
import("//printing/buildflags/buildflags.gni")
+import("//ui/ozone/ozone.gni")
jumbo_component("libgtkui") {
sources = [
- "app_indicator_icon.cc",
- "app_indicator_icon.h",
- "app_indicator_icon_menu.cc",
- "app_indicator_icon_menu.h",
- "gtk_background_painter.cc",
- "gtk_background_painter.h",
"gtk_key_bindings_handler.cc",
"gtk_key_bindings_handler.h",
"gtk_ui.cc",
"gtk_ui.h",
"gtk_util.cc",
"gtk_util.h",
- "libgtkui_export.h",
- "menu_util.cc",
- "menu_util.h",
+ "input_method_context_impl_gtk.cc",
+ "input_method_context_impl_gtk.h",
"native_theme_gtk.cc",
"native_theme_gtk.h",
"nav_button_provider_gtk.cc",
@@ -42,23 +36,9 @@ jumbo_component("libgtkui") {
"settings_provider.h",
"settings_provider_gtk.cc",
"settings_provider_gtk.h",
- "skia_utils_gtk.cc",
- "skia_utils_gtk.h",
- "unity_service.cc",
- "unity_service.h",
]
- if (gtk_version <= 3) {
- sources += [
- "gtk_status_icon.cc",
- "gtk_status_icon.h",
- ]
- }
-
- configs += [
- "//build/config/linux/pangocairo",
- "//build/config/linux:x11",
- ]
+ configs += [ "//build/config/linux/pangocairo" ]
if (use_gio) {
sources += [
@@ -72,25 +52,15 @@ jumbo_component("libgtkui") {
configs += [ "//printing:cups" ]
}
- defines = [ "LIBGTKUI_IMPLEMENTATION" ]
+ defines = [ "IS_LIBGTKUI_IMPL" ]
deps = [
"//base",
- "//base:i18n",
- "//base/third_party/dynamic_annotations",
"//build/config/linux/gtk",
"//build/config/linux/gtk:gtkprint",
- "//cc/paint",
- "//chrome:extra_resources",
- "//chrome:resources",
- "//chrome:strings",
- "//chrome/app:command_ids",
- "//chrome/app/theme:theme_resources",
"//chrome/browser/ui/views",
- "//chrome/common:buildflags",
"//chrome/common:constants",
"//components/prefs",
- "//components/resources",
"//content/public/browser",
"//printing",
"//skia",
@@ -107,11 +77,9 @@ jumbo_component("libgtkui") {
"//ui/events",
"//ui/events:dom_keyboard_layout",
"//ui/events:dom_keycode_converter",
- "//ui/events:events_base",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/native_theme",
- "//ui/resources",
"//ui/shell_dialogs",
"//ui/strings",
"//ui/views",
@@ -120,17 +88,23 @@ jumbo_component("libgtkui") {
"//chrome/browser:theme_properties",
]
- if (use_x11) {
+ if (use_x11 || ozone_platform_x11) {
sources += [
"gtk_event_loop_x11.cc",
"gtk_event_loop_x11.h",
- "x11_input_method_context_impl_gtk.cc",
- "x11_input_method_context_impl_gtk.h",
]
+ configs += [ "//build/config/linux:x11" ]
+
+ defines += [ "USE_GTK_EVENT_LOOP_X11" ]
+
deps += [
"//ui/events/platform/x11",
"//ui/gfx/x",
]
}
+
+ if (use_ozone) {
+ deps += [ "//ui/ozone" ]
+ }
}
diff --git a/chromium/chrome/browser/ui/webui/about_ui.cc b/chromium/chrome/browser/ui/webui/about_ui.cc
index 8637fe302a0..560b170d090 100644
--- a/chromium/chrome/browser/ui/webui/about_ui.cc
+++ b/chromium/chrome/browser/ui/webui/about_ui.cc
@@ -613,9 +613,8 @@ void AboutUIHTMLSource::StartDataRequest(
if (idr == IDR_ABOUT_UI_CREDITS_HTML) {
response = about_ui::GetCredits(true /*include_scripts*/);
} else {
- response = ui::ResourceBundle::GetSharedInstance()
- .GetRawDataResource(idr)
- .as_string();
+ response =
+ ui::ResourceBundle::GetSharedInstance().DecompressDataResource(idr);
}
#if defined(OS_LINUX) || defined(OS_OPENBSD)
} else if (source_name_ == chrome::kChromeUILinuxProxyConfigHost) {
diff --git a/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.cc b/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.cc
deleted file mode 100644
index 9fd69a5ea1e..00000000000
--- a/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.cc
+++ /dev/null
@@ -1,85 +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.
-
-#include "chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.h"
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/values.h"
-#include "chrome/browser/android/dev_ui/dev_ui_module_provider.h"
-
-DevUiLoaderMessageHandler::DevUiLoaderMessageHandler() = default;
-
-DevUiLoaderMessageHandler::~DevUiLoaderMessageHandler() = default;
-
-void DevUiLoaderMessageHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "getDevUiDfmState",
- base::BindRepeating(&DevUiLoaderMessageHandler::HandleGetDevUiDfmState,
- weak_ptr_factory_.GetWeakPtr()));
- web_ui()->RegisterMessageCallback(
- "installAndLoadDevUiDfm",
- base::BindRepeating(
- &DevUiLoaderMessageHandler::HandleInstallAndLoadDevUiDfm,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-void DevUiLoaderMessageHandler::HandleGetDevUiDfmState(
- const base::ListValue* args) {
- const base::Value* callback_id = nullptr;
- CHECK(args->Get(0, &callback_id));
- const char* response = "ready";
- if (!dev_ui::DevUiModuleProvider::GetInstance().ModuleInstalled())
- response = "not-installed";
- else if (!dev_ui::DevUiModuleProvider::GetInstance().ModuleLoaded())
- response = "not-loaded";
- AllowJavascript();
- ResolveJavascriptCallback(*callback_id, base::Value(response));
-}
-
-void DevUiLoaderMessageHandler::ReplyToJavaScript(
- const base::Value& callback_id,
- const char* return_value) {
- AllowJavascript();
- base::ListValue response;
- response.GetList().emplace_back(base::Value(return_value));
- ResolveJavascriptCallback(callback_id, response);
-}
-
-void DevUiLoaderMessageHandler::HandleInstallAndLoadDevUiDfm(
- const base::ListValue* args) {
- const base::Value* callback_id = nullptr;
- CHECK(args->Get(0, &callback_id));
-
- if (!dev_ui::DevUiModuleProvider::GetInstance().ModuleInstalled()) {
- dev_ui::DevUiModuleProvider::GetInstance().InstallModule(base::BindOnce(
- &DevUiLoaderMessageHandler::OnDevUiDfmInstallWithStatus,
- weak_ptr_factory_.GetWeakPtr(), callback_id->GetString()));
-
- } else if (!dev_ui::DevUiModuleProvider::GetInstance().ModuleLoaded()) {
- dev_ui::DevUiModuleProvider::GetInstance().LoadModule(base::BindOnce(
- &DevUiLoaderMessageHandler::OnDevUiResourceLoaded,
- weak_ptr_factory_.GetWeakPtr(), callback_id->GetString()));
-
- } else {
- ReplyToJavaScript(*callback_id, "noop");
- }
-}
-
-void DevUiLoaderMessageHandler::OnDevUiDfmInstallWithStatus(
- std::string callback_id_string,
- bool success) {
- if (success) {
- dev_ui::DevUiModuleProvider::GetInstance().LoadModule(
- base::BindOnce(&DevUiLoaderMessageHandler::OnDevUiResourceLoaded,
- weak_ptr_factory_.GetWeakPtr(), callback_id_string));
- } else {
- ReplyToJavaScript(base::Value(callback_id_string), "failure");
- }
-}
-
-void DevUiLoaderMessageHandler::OnDevUiResourceLoaded(
- std::string callback_id_string) {
- ReplyToJavaScript(base::Value(callback_id_string), "success");
-}
diff --git a/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.h b/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.h
deleted file mode 100644
index 04921022d9a..00000000000
--- a/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.h
+++ /dev/null
@@ -1,65 +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.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_ANDROID_DEV_UI_LOADER_DEV_UI_LOADER_MESSAGE_HANDLER_H_
-#define CHROME_BROWSER_UI_WEBUI_ANDROID_DEV_UI_LOADER_DEV_UI_LOADER_MESSAGE_HANDLER_H_
-
-#include <string>
-
-#include "base/memory/weak_ptr.h"
-#include "build/build_config.h"
-#include "chrome/android/features/dev_ui/buildflags.h"
-#include "content/public/browser/web_ui_message_handler.h"
-
-#if !defined(OS_ANDROID) || !BUILDFLAG(DFMIFY_DEV_UI)
-#error Unsupported platform.
-#endif
-
-namespace base {
-class ListValue;
-class Value;
-} // namespace base
-
-class DevUiLoaderMessageHandler : public content::WebUIMessageHandler {
- public:
- DevUiLoaderMessageHandler();
- ~DevUiLoaderMessageHandler() override;
-
- private:
- DevUiLoaderMessageHandler(const DevUiLoaderMessageHandler&) = delete;
- void operator=(const DevUiLoaderMessageHandler&) = delete;
-
- // WebUIMessageHandler
- void RegisterMessages() override;
-
- // Called from JavaScript. |args| specifies id for callback, which receives
- // one of the following responses:
- // * "not-installed" if the DevUI DFM is not installed.
- // * "not-loaded" if the DevUI DFM is installed, but not loaded.
- // * "ready" if the DevUI DFM is installed and loaded.
- void HandleGetDevUiDfmState(const base::ListValue* args);
-
- // Helper for HandleInstallAndLoadDevUiDfm().
- void ReplyToJavaScript(const base::Value& callback_id,
- const char* return_value);
-
- // Called from JavaScript. |args| specifies id for callback, which receives
- // one of the following responses:
- // * "noop" if the DevUI DFM is already installed and loaded.
- // * "success" if DevUI DFM install / load takes place, and succeeds.
- // * "failure" if DevUI DFM install / load takes place, but fails.
- void HandleInstallAndLoadDevUiDfm(const base::ListValue* args);
-
- // Callback for dev_ui::DevUiModuleProvider::InstallModule().
- void OnDevUiDfmInstallWithStatus(std::string callback_id_string,
- bool success);
-
- // Callback for dev_ui::DevUiModuleProvider::LoadModule().
- void OnDevUiResourceLoaded(std::string callback_id_string);
-
- // Factory for creating references in callbacks.
- base::WeakPtrFactory<DevUiLoaderMessageHandler> weak_ptr_factory_{this};
-};
-
-#endif // CHROME_BROWSER_UI_WEBUI_ANDROID_DEV_UI_LOADER_DEV_UI_LOADER_MESSAGE_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.cc b/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.cc
deleted file mode 100644
index 52622ee0b68..00000000000
--- a/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.cc
+++ /dev/null
@@ -1,30 +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.
-
-#include "chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.h"
-
-#include <memory>
-#include <utility>
-
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_message_handler.h"
-#include "chrome/grit/browser_resources.h"
-#include "content/public/browser/web_ui_data_source.h"
-#include "url/gurl.h"
-
-DevUiLoaderUI::DevUiLoaderUI(content::WebUI* web_ui_in, const GURL& url)
- : WebUIController(web_ui_in) {
- std::unique_ptr<content::WebUIDataSource> html_source;
- html_source.reset(content::WebUIDataSource::Create(url.host()));
- html_source->SetDefaultResource(IDR_DEV_UI_LOADER_HTML);
- html_source->AddResourcePath("dev_ui_loader.html", IDR_DEV_UI_LOADER_HTML);
- html_source->AddResourcePath("dev_ui_loader.js", IDR_DEV_UI_LOADER_JS);
- html_source->AddResourcePath("dev_ui_loader.css", IDR_DEV_UI_LOADER_CSS);
-
- Profile* profile = Profile::FromWebUI(web_ui());
- content::WebUIDataSource::Add(profile, html_source.release());
- web_ui()->AddMessageHandler(std::make_unique<DevUiLoaderMessageHandler>());
-}
-
-DevUiLoaderUI::~DevUiLoaderUI() = default;
diff --git a/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.h b/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.h
deleted file mode 100644
index d8b70e71615..00000000000
--- a/chromium/chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.h
+++ /dev/null
@@ -1,32 +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.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_ANDROID_DEV_UI_LOADER_DEV_UI_LOADER_UI_H_
-#define CHROME_BROWSER_UI_WEBUI_ANDROID_DEV_UI_LOADER_DEV_UI_LOADER_UI_H_
-
-#include "base/memory/weak_ptr.h"
-#include "build/build_config.h"
-#include "chrome/android/features/dev_ui/buildflags.h"
-#include "content/public/browser/web_ui_controller.h"
-
-#if !defined(OS_ANDROID) || !BUILDFLAG(DFMIFY_DEV_UI)
-#error Unsupported platform.
-#endif
-
-class GURL;
-
-class DevUiLoaderUI : public content::WebUIController {
- public:
- DevUiLoaderUI(content::WebUI* web_ui_in, const GURL& url);
- ~DevUiLoaderUI() override;
-
- private:
- DevUiLoaderUI(const DevUiLoaderUI&) = delete;
- void operator=(const DevUiLoaderUI&) = delete;
-
- // Factory for creating references in callbacks.
- base::WeakPtrFactory<DevUiLoaderUI> weak_ptr_factory_{this};
-};
-
-#endif // CHROME_BROWSER_UI_WEBUI_ANDROID_DEV_UI_LOADER_DEV_UI_LOADER_UI_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 c62180bf2b0..512730e3142 100644
--- a/chromium/chrome/browser/ui/webui/app_management/app_management.mojom
+++ b/chromium/chrome/browser/ui/webui/app_management/app_management.mojom
@@ -35,7 +35,8 @@ struct ExtensionAppPermissionMessage {
};
interface PageHandlerFactory {
- CreatePageHandler(Page page, PageHandler& handler);
+ CreatePageHandler(pending_remote<Page> page,
+ pending_receiver<PageHandler> handler);
};
// Browser interface.
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 35c327bb3b8..227c34962ac 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
@@ -14,6 +14,7 @@
#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/browser/ui/webui/app_management/app_management.mojom.h"
#include "chrome/services/app_service/public/cpp/app_registry_cache.h"
#include "chrome/services/app_service/public/mojom/types.mojom.h"
#include "extensions/browser/extension_registry.h"
@@ -21,9 +22,14 @@
#include "extensions/common/extension.h"
#include "extensions/common/permissions/permission_message.h"
#include "extensions/common/permissions/permissions_data.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/arc/arc_util.h"
+#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "components/arc/arc_prefs.h"
#endif
@@ -37,14 +43,21 @@ constexpr int kMinAndroidFrameworkVersion = 28; // Android P
#endif
constexpr char const* kAppIdsWithHiddenMoreSettings[] = {
- extension_misc::kFilesManagerAppId,
extensions::kWebStoreAppId,
+ extension_misc::kFilesManagerAppId,
+ extension_misc::kGeniusAppId,
};
constexpr char const* kAppIdsWithHiddenPinToShelf[] = {
extension_misc::kChromeAppId,
};
+#if defined(OS_CHROMEOS)
+constexpr char const* kAppIdsWithHiddenStoragePermission[] = {
+ arc::kPlayStoreAppId,
+};
+#endif // OS_CHROMEOS
+
app_management::mojom::ExtensionAppPermissionMessagePtr
CreateExtensionAppPermissionMessage(
const extensions::PermissionMessage& message) {
@@ -64,22 +77,23 @@ bool ShouldHidePinToShelf(const std::string app_id) {
return base::Contains(kAppIdsWithHiddenPinToShelf, app_id);
}
+bool ShouldHideStoragePermission(const std::string app_id) {
+#if defined(OS_CHROMEOS)
+ return base::Contains(kAppIdsWithHiddenStoragePermission, app_id);
+#else
+ return false;
+#endif
+}
} // namespace
AppManagementPageHandler::AppManagementPageHandler(
- app_management::mojom::PageHandlerRequest request,
- app_management::mojom::PagePtr page,
+ mojo::PendingReceiver<app_management::mojom::PageHandler> receiver,
+ mojo::PendingRemote<app_management::mojom::Page> page,
Profile* profile)
- : binding_(this, std::move(request)),
+ : receiver_(this, std::move(receiver)),
page_(std::move(page)),
- profile_(profile)
-#if defined(OS_CHROMEOS)
- ,
- arc_app_list_prefs_observer_(this),
- shelf_delegate_(this)
-#endif
-{
+ profile_(profile) {
apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(profile_);
@@ -138,7 +152,8 @@ void AppManagementPageHandler::GetApps(GetAppsCallback callback) {
std::vector<app_management::mojom::AppPtr> apps;
proxy->AppRegistryCache().ForEachApp(
[this, &apps](const apps::AppUpdate& update) {
- if (update.ShowInManagement() == apps::mojom::OptionalBool::kTrue) {
+ if (update.ShowInManagement() == apps::mojom::OptionalBool::kTrue &&
+ update.Readiness() != apps::mojom::Readiness::kUninstalledByUser) {
apps.push_back(CreateUIAppPtr(update));
}
});
@@ -216,6 +231,12 @@ app_management::mojom::AppPtr AppManagementPageHandler::CreateUIAppPtr(
const apps::AppUpdate& update) {
base::flat_map<uint32_t, apps::mojom::PermissionPtr> permissions;
for (const auto& permission : update.Permissions()) {
+ if (static_cast<app_management::mojom::ArcPermissionType>(
+ permission->permission_id) ==
+ app_management::mojom::ArcPermissionType::STORAGE &&
+ ShouldHideStoragePermission(update.AppId())) {
+ continue;
+ }
permissions[permission->permission_id] = permission->Clone();
}
@@ -246,19 +267,16 @@ app_management::mojom::AppPtr AppManagementPageHandler::CreateUIAppPtr(
}
void AppManagementPageHandler::OnAppUpdate(const apps::AppUpdate& update) {
- if (update.ReadinessChanged() &&
- update.Readiness() == apps::mojom::Readiness::kUninstalledByUser) {
- page_->OnAppRemoved(update.AppId());
- return;
- }
-
- if (update.ShowInManagement() != apps::mojom::OptionalBool::kTrue) {
- return;
- }
+ if (update.ShowInManagementChanged() || update.ReadinessChanged()) {
+ if (update.ShowInManagement() == apps::mojom::OptionalBool::kTrue &&
+ update.Readiness() == apps::mojom::Readiness::kReady) {
+ page_->OnAppAdded(CreateUIAppPtr(update));
+ }
- if (update.ReadinessChanged() &&
- update.Readiness() == apps::mojom::Readiness::kReady) {
- page_->OnAppAdded(CreateUIAppPtr(update));
+ if (update.ShowInManagement() == apps::mojom::OptionalBool::kFalse ||
+ update.Readiness() == apps::mojom::Readiness::kUninstalledByUser) {
+ page_->OnAppRemoved(update.AppId());
+ }
} else {
page_->OnAppChanged(CreateUIAppPtr(update));
}
diff --git a/chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.h b/chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.h
index baeef297ebd..6bc45d49536 100644
--- a/chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.h
+++ b/chromium/chrome/browser/ui/webui/app_management/app_management_page_handler.h
@@ -10,7 +10,10 @@
#include "chrome/browser/ui/webui/app_management/app_management.mojom.h"
#include "chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.h"
#include "chrome/services/app_service/public/cpp/app_registry_cache.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
@@ -19,16 +22,15 @@
class Profile;
class AppManagementPageHandler : public app_management::mojom::PageHandler,
- public apps::AppRegistryCache::Observer
#if defined(OS_CHROMEOS)
- ,
- public ArcAppListPrefs::Observer
+ public ArcAppListPrefs::Observer,
#endif // OS_CHROMEOS
-{
+ public apps::AppRegistryCache::Observer {
public:
- AppManagementPageHandler(app_management::mojom::PageHandlerRequest request,
- app_management::mojom::PagePtr page,
- Profile* profile);
+ AppManagementPageHandler(
+ mojo::PendingReceiver<app_management::mojom::PageHandler> receiver,
+ mojo::PendingRemote<app_management::mojom::Page> page,
+ Profile* profile);
~AppManagementPageHandler() override;
#if defined(OS_CHROMEOS)
@@ -68,16 +70,16 @@ class AppManagementPageHandler : public app_management::mojom::PageHandler,
const arc::mojom::ArcPackageInfo& package_info) override;
#endif // OS_CHROMEOS
- mojo::Binding<app_management::mojom::PageHandler> binding_;
+ mojo::Receiver<app_management::mojom::PageHandler> receiver_;
- app_management::mojom::PagePtr page_;
+ mojo::Remote<app_management::mojom::Page> page_;
Profile* profile_;
#if defined(OS_CHROMEOS)
- ScopedObserver<ArcAppListPrefs, AppManagementPageHandler>
- arc_app_list_prefs_observer_;
- AppManagementShelfDelegate shelf_delegate_;
+ ScopedObserver<ArcAppListPrefs, ArcAppListPrefs::Observer>
+ arc_app_list_prefs_observer_{this};
+ AppManagementShelfDelegate shelf_delegate_{this};
#endif // OS_CHROMEOS
DISALLOW_COPY_AND_ASSIGN(AppManagementPageHandler);
diff --git a/chromium/chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.cc b/chromium/chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.cc
index 0a3d90a6dfd..5ea8f88ffef 100644
--- a/chromium/chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.cc
+++ b/chromium/chrome/browser/ui/webui/app_management/app_management_shelf_delegate_chromeos.cc
@@ -17,21 +17,51 @@ using apps::mojom::OptionalBool;
AppManagementShelfDelegate::AppManagementShelfDelegate(
AppManagementPageHandler* page_handler)
: page_handler_(page_handler) {
- ChromeLauncherController::instance()->shelf_model()->AddObserver(this);
+ auto* launcher_controller = ChromeLauncherController::instance();
+ if (!launcher_controller) {
+ return;
+ }
+
+ auto* shelf_model = launcher_controller->shelf_model();
+ if (!shelf_model) {
+ return;
+ }
+
+ shelf_model->AddObserver(this);
}
AppManagementShelfDelegate::~AppManagementShelfDelegate() {
- ChromeLauncherController::instance()->shelf_model()->RemoveObserver(this);
+ auto* launcher_controller = ChromeLauncherController::instance();
+ if (!launcher_controller) {
+ return;
+ }
+
+ auto* shelf_model = launcher_controller->shelf_model();
+ if (!shelf_model) {
+ return;
+ }
+
+ shelf_model->RemoveObserver(this);
}
bool AppManagementShelfDelegate::IsPinned(const std::string& app_id) {
- return ChromeLauncherController::instance()->IsAppPinned(app_id);
+ auto* launcher_controller = ChromeLauncherController::instance();
+ if (!launcher_controller) {
+ return false;
+ }
+ return launcher_controller->IsAppPinned(app_id);
}
bool AppManagementShelfDelegate::IsPolicyPinned(
const std::string& app_id) const {
- auto* shelf_item =
- ChromeLauncherController::instance()->GetItem(ash::ShelfID(app_id));
+ auto* launcher_controller = ChromeLauncherController::instance();
+
+ if (!launcher_controller) {
+ return false;
+ }
+
+ auto* shelf_item = launcher_controller->GetItem(ash::ShelfID(app_id));
+
// If the app does not exist on the launcher, it has not been pinned by
// policy.
return shelf_item && shelf_item->pinned_by_policy;
@@ -39,21 +69,39 @@ bool AppManagementShelfDelegate::IsPolicyPinned(
void AppManagementShelfDelegate::SetPinned(const std::string& app_id,
OptionalBool pinned) {
+ auto* launcher_controller = ChromeLauncherController::instance();
+
+ if (!launcher_controller) {
+ return;
+ }
+
if (pinned == OptionalBool::kTrue) {
- ChromeLauncherController::instance()->PinAppWithID(app_id);
+ launcher_controller->PinAppWithID(app_id);
} else if (pinned == OptionalBool::kFalse) {
- ChromeLauncherController::instance()->UnpinAppWithID(app_id);
+ launcher_controller->UnpinAppWithID(app_id);
} else {
NOTREACHED();
}
}
void AppManagementShelfDelegate::ShelfItemAdded(int index) {
- const std::string& app_id = ChromeLauncherController::instance()
- ->shelf_model()
- ->items()[index]
- .id.app_id;
- bool is_pinned = ChromeLauncherController::instance()->IsAppPinned(app_id);
+ auto* launcher_controller = ChromeLauncherController::instance();
+ if (!launcher_controller) {
+ return;
+ }
+
+ auto* shelf_model = launcher_controller->shelf_model();
+ if (!shelf_model) {
+ return;
+ }
+
+ if (index >= shelf_model->item_count()) {
+ // index out of bounds.
+ return;
+ }
+
+ const std::string& app_id = shelf_model->items()[index].id.app_id;
+ bool is_pinned = launcher_controller->IsAppPinned(app_id);
page_handler_->OnPinnedChanged(app_id, is_pinned);
}
@@ -68,11 +116,23 @@ void AppManagementShelfDelegate::ShelfItemRemoved(
void AppManagementShelfDelegate::ShelfItemChanged(
int index,
const ash::ShelfItem& old_item) {
- const std::string& app_id = ChromeLauncherController::instance()
- ->shelf_model()
- ->items()[index]
- .id.app_id;
- bool is_pinned = ChromeLauncherController::instance()->IsAppPinned(app_id);
+ auto* launcher_controller = ChromeLauncherController::instance();
+ if (!launcher_controller) {
+ return;
+ }
+
+ auto* shelf_model = launcher_controller->shelf_model();
+ if (!shelf_model) {
+ return;
+ }
+
+ if (index >= shelf_model->item_count()) {
+ // index out of bounds.
+ return;
+ }
+
+ const std::string& app_id = shelf_model->items()[index].id.app_id;
+ bool is_pinned = launcher_controller->IsAppPinned(app_id);
page_handler_->OnPinnedChanged(app_id, is_pinned);
}
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
deleted file mode 100644
index 5d3ce3e4657..00000000000
--- a/chromium/chrome/browser/ui/webui/app_management/app_management_ui.cc
+++ /dev/null
@@ -1,140 +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/app_management/app_management_ui.h"
-
-#include <memory>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/feature_list.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/app_management/app_management_page_handler.h"
-#include "chrome/browser/ui/webui/localized_string.h"
-#include "chrome/browser/ui/webui/plural_string_handler.h"
-#include "chrome/common/chrome_features.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/grit/browser_resources.h"
-#include "chrome/grit/chromium_strings.h"
-#include "chrome/grit/generated_resources.h"
-#include "components/prefs/pref_service.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 {
-
-content::WebUIDataSource* CreateAppManagementUIHTMLSource(Profile* profile) {
- content::WebUIDataSource* source =
- content::WebUIDataSource::Create(chrome::kChromeUIAppManagementHost);
-
- static constexpr LocalizedString kStrings[] = {
- {"appListTitle", IDS_APP_MANAGEMENT_APP_LIST_TITLE},
- {"appNoPermission", IDS_APPLICATION_INFO_APP_NO_PERMISSIONS_TEXT},
- {"back", IDS_APP_MANAGEMENT_BACK},
- {"camera", IDS_APP_MANAGEMENT_CAMERA},
- {"contacts", IDS_APP_MANAGEMENT_CONTACTS},
- {"controlledByPolicy", IDS_CONTROLLED_SETTING_POLICY},
- {"lessApps", IDS_APP_MANAGEMENT_LESS_APPS},
- {"location", IDS_APP_MANAGEMENT_LOCATION},
- {"microphone", IDS_APP_MANAGEMENT_MICROPHONE},
- {"moreApps", IDS_APP_MANAGEMENT_MORE_APPS},
- {"moreSettings", IDS_APP_MANAGEMENT_MORE_SETTINGS},
- {"noSearchResults", IDS_APP_MANAGEMENT_NO_RESULTS},
- {"notifications", IDS_APP_MANAGEMENT_NOTIFICATIONS},
- {"notificationSublabel", IDS_APP_MANAGEMENT_NOTIFICATIONS_SUBLABEL},
- {"openAndroidSettings", IDS_APP_MANAGEMENT_ANDROID_SETTINGS},
- {"openExtensionsSettings", IDS_APP_MANAGEMENT_EXTENSIONS_SETTINGS},
- {"openSiteSettings", IDS_APP_MANAGEMENT_SITE_SETTING},
- {"permissions", IDS_APP_MANAGEMENT_PERMISSIONS},
- {"pinControlledByPolicy", IDS_APP_MANAGEMENT_PIN_ENFORCED_BY_POLICY},
- {"pinToShelf", IDS_APP_MANAGEMENT_PIN_TO_SHELF},
- {"searchPrompt", IDS_APP_MANAGEMENT_SEARCH_PROMPT},
- {"size", IDS_APP_MANAGEMENT_SIZE},
- {"storage", IDS_APP_MANAGEMENT_STORAGE},
- {"thisAppCan", IDS_APP_MANAGEMENT_THIS_APP_CAN},
- {"title", IDS_APP_MANAGEMENT_TITLE},
- {"uninstall", IDS_APP_MANAGEMENT_UNINSTALL_APP},
- {"version", IDS_APP_MANAGEMENT_VERSION},
- };
- AddLocalizedStringsBulk(source, kStrings, base::size(kStrings));
-
-#if defined(OS_CHROMEOS)
- source->AddBoolean(
- "isSupportedArcVersion",
- AppManagementPageHandler::IsCurrentArcVersionSupported(profile));
-#endif // OS_CHROMEOS
-
- source->AddResourcePath("app_management.mojom-lite.js",
- IDR_APP_MANAGEMENT_MOJO_LITE_JS);
- source->AddResourcePath("types.mojom-lite.js",
- IDR_APP_MANAGEMENT_TYPES_MOJO_LITE_JS);
- source->AddResourcePath("bitmap.mojom-lite.js",
- IDR_APP_MANAGEMENT_BITMAP_MOJO_LITE_JS);
- source->AddResourcePath("image.mojom-lite.js",
- IDR_APP_MANAGEMENT_IMAGE_MOJO_LITE_JS);
- source->AddResourcePath("image_info.mojom-lite.js",
- IDR_APP_MANAGEMENT_IMAGE_INFO_MOJO_LITE_JS);
-
- source->AddResourcePath("app.html", IDR_APP_MANAGEMENT_APP_HTML);
- source->AddResourcePath("app.js", IDR_APP_MANAGEMENT_APP_JS);
- source->AddResourcePath("expandable_app_list.html",
- IDR_APP_MANAGEMENT_EXPANDABLE_APP_LIST_HTML);
- source->AddResourcePath("expandable_app_list.js",
- IDR_APP_MANAGEMENT_EXPANDABLE_APP_LIST_JS);
-
- source->SetDefaultResource(IDR_APP_MANAGEMENT_INDEX_HTML);
- source->UseStringsJs();
-
- return source;
-}
-
-} // namespace
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// AppManagementUI
-//
-///////////////////////////////////////////////////////////////////////////////
-
-AppManagementUI::AppManagementUI(content::WebUI* web_ui)
- : ui::MojoWebUIController(web_ui, true), page_factory_binding_(this) {
- Profile* profile = Profile::FromWebUI(web_ui);
-
- // Set up the data source.
- content::WebUIDataSource* source = CreateAppManagementUIHTMLSource(profile);
- content::WebUIDataSource::Add(profile, source);
-
- AddHandlerToRegistry(base::BindRepeating(
- &AppManagementUI::BindPageHandlerFactory, base::Unretained(this)));
-
- auto plural_string_handler = std::make_unique<PluralStringHandler>();
- plural_string_handler->AddLocalizedString(
- "appListPreview", IDS_APP_MANAGEMENT_APP_LIST_PREVIEW);
- web_ui->AddMessageHandler(std::move(plural_string_handler));
-}
-
-AppManagementUI::~AppManagementUI() = default;
-
-bool AppManagementUI::IsEnabled() {
- return base::FeatureList::IsEnabled(features::kAppManagement);
-}
-
-void AppManagementUI::BindPageHandlerFactory(
- app_management::mojom::PageHandlerFactoryRequest request) {
- if (page_factory_binding_.is_bound()) {
- page_factory_binding_.Unbind();
- }
-
- page_factory_binding_.Bind(std::move(request));
-}
-
-void AppManagementUI::CreatePageHandler(
- app_management::mojom::PagePtr page,
- app_management::mojom::PageHandlerRequest request) {
- DCHECK(page);
-
- page_handler_ = std::make_unique<AppManagementPageHandler>(
- std::move(request), std::move(page), Profile::FromWebUI(web_ui()));
-}
diff --git a/chromium/chrome/browser/ui/webui/app_management/app_management_ui.h b/chromium/chrome/browser/ui/webui/app_management/app_management_ui.h
deleted file mode 100644
index a0187ee104e..00000000000
--- a/chromium/chrome/browser/ui/webui/app_management/app_management_ui.h
+++ /dev/null
@@ -1,41 +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_APP_MANAGEMENT_APP_MANAGEMENT_UI_H_
-#define CHROME_BROWSER_UI_WEBUI_APP_MANAGEMENT_APP_MANAGEMENT_UI_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "chrome/browser/ui/webui/app_management/app_management.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "ui/webui/mojo_web_ui_controller.h"
-
-class AppManagementPageHandler;
-
-class AppManagementUI : public ui::MojoWebUIController,
- public app_management::mojom::PageHandlerFactory {
- public:
- explicit AppManagementUI(content::WebUI* web_ui);
- ~AppManagementUI() override;
-
- static bool IsEnabled();
-
- private:
- void BindPageHandlerFactory(
- app_management::mojom::PageHandlerFactoryRequest request);
-
- // app_management::mojom::PageHandlerFactory:
- void CreatePageHandler(
- app_management::mojom::PagePtr page,
- app_management::mojom::PageHandlerRequest request) override;
-
- std::unique_ptr<AppManagementPageHandler> page_handler_;
- mojo::Binding<app_management::mojom::PageHandlerFactory>
- page_factory_binding_;
-
- DISALLOW_COPY_AND_ASSIGN(AppManagementUI);
-};
-
-#endif // CHROME_BROWSER_UI_WEBUI_APP_MANAGEMENT_APP_MANAGEMENT_UI_H_
diff --git a/chromium/chrome/browser/ui/webui/bluetooth_internals/BUILD.gn b/chromium/chrome/browser/ui/webui/bluetooth_internals/BUILD.gn
index 0f0f0aaad80..210d8f365ed 100644
--- a/chromium/chrome/browser/ui/webui/bluetooth_internals/BUILD.gn
+++ b/chromium/chrome/browser/ui/webui/bluetooth_internals/BUILD.gn
@@ -24,6 +24,10 @@ source_set("bluetooth_internals") {
"//device/bluetooth",
"//ui/webui",
]
+
+ if (is_chromeos) {
+ deps += [ "//chrome/browser/chromeos" ]
+ }
}
mojom("mojo_bindings") {
diff --git a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom
index e5b8e22777b..ed3c332629c 100644
--- a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom
+++ b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom
@@ -6,7 +6,24 @@ module mojom;
import "device/bluetooth/public/mojom/adapter.mojom";
+// Handles requests from chrome://bluetooth-internals to enable or disable the
+// usage of Bluetooth debug logs. The debug logs to be enabled reside in the
+// kernel as well within BlueZ/NewBlue. Note that these logs are text-only and
+// do not include captured packets from btmon.
+interface DebugLogsChangeHandler {
+ // Enables or disables debug logs, depending on the value of
+ // |should_debug_logs_be_enabled|.
+ ChangeDebugLogsState(bool should_debug_logs_be_enabled);
+};
+
interface BluetoothInternalsHandler {
// Gets an Adapter interface. Returns null if Bluetooth is not supported.
- GetAdapter() => (bluetooth.mojom.Adapter? adapter);
+ GetAdapter() => (pending_remote<bluetooth.mojom.Adapter>? adapter);
+
+ // Retrieves a handler for changing the state of debug logs. If debug logs are
+ // not supported (e.g., the required flags are disabled or the logged-in user
+ // is not eligible), null is returned. When a valid handler is returned, an
+ // extra boolean is provided which represents the initial state of the toggle.
+ GetDebugLogsChangeHandler() => (DebugLogsChangeHandler? handler,
+ bool initial_toggle_value);
};
diff --git a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.cc b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.cc
index a65ef86a115..b88be86ef08 100644
--- a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.cc
+++ b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.cc
@@ -7,17 +7,25 @@
#include "base/bind.h"
#include "base/macros.h"
#include "base/strings/string16.h"
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/chromeos/bluetooth/debug_logs_manager.h"
#include "device/bluetooth/adapter.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "url/gurl.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/bluetooth/debug_logs_manager.h"
+#endif
+
BluetoothInternalsHandler::BluetoothInternalsHandler(
- mojom::BluetoothInternalsHandlerRequest request)
- : binding_(this, std::move(request)) {}
+ mojo::PendingReceiver<mojom::BluetoothInternalsHandler> receiver)
+ : receiver_(this, std::move(receiver)) {}
-BluetoothInternalsHandler::~BluetoothInternalsHandler() {}
+BluetoothInternalsHandler::~BluetoothInternalsHandler() = default;
void BluetoothInternalsHandler::GetAdapter(GetAdapterCallback callback) {
if (device::BluetoothAdapterFactory::IsBluetoothSupported()) {
@@ -25,15 +33,44 @@ void BluetoothInternalsHandler::GetAdapter(GetAdapterCallback callback) {
base::BindOnce(&BluetoothInternalsHandler::OnGetAdapter,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
} else {
- std::move(callback).Run(nullptr /* AdapterPtr */);
+ std::move(callback).Run(mojo::NullRemote() /* adapter */);
+ }
+}
+
+void BluetoothInternalsHandler::GetDebugLogsChangeHandler(
+ GetDebugLogsChangeHandlerCallback callback) {
+ mojom::DebugLogsChangeHandlerPtr handler_ptr;
+ bool initial_toggle_value = false;
+
+#if defined(OS_CHROMEOS)
+ using chromeos::bluetooth::DebugLogsManager;
+
+ // If no logs manager exists for this user, debug logs are not supported.
+ DebugLogsManager::DebugLogsState state =
+ debug_logs_manager_ ? debug_logs_manager_->GetDebugLogsState()
+ : DebugLogsManager::DebugLogsState::kNotSupported;
+
+ switch (state) {
+ case DebugLogsManager::DebugLogsState::kNotSupported:
+ // Leave |handler_ptr| null and |initial_toggle_value| false.
+ break;
+ case DebugLogsManager::DebugLogsState::kSupportedAndEnabled:
+ initial_toggle_value = true;
+ FALLTHROUGH;
+ case DebugLogsManager::DebugLogsState::kSupportedButDisabled:
+ handler_ptr = debug_logs_manager_->GenerateInterfacePtr();
+ break;
}
+#endif
+
+ std::move(callback).Run(std::move(handler_ptr), initial_toggle_value);
}
void BluetoothInternalsHandler::OnGetAdapter(
GetAdapterCallback callback,
scoped_refptr<device::BluetoothAdapter> adapter) {
- bluetooth::mojom::AdapterPtr adapter_ptr;
- mojo::MakeStrongBinding(std::make_unique<bluetooth::Adapter>(adapter),
- mojo::MakeRequest(&adapter_ptr));
- std::move(callback).Run(std::move(adapter_ptr));
+ mojo::PendingRemote<bluetooth::mojom::Adapter> pending_adapter;
+ mojo::MakeSelfOwnedReceiver(std::make_unique<bluetooth::Adapter>(adapter),
+ pending_adapter.InitWithNewPipeAndPassReceiver());
+ std::move(callback).Run(std::move(pending_adapter));
}
diff --git a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.h b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.h
index 3de443d2c5b..5c1cd3544e2 100644
--- a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.h
+++ b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.h
@@ -8,24 +8,48 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom.h"
#include "device/bluetooth/bluetooth_adapter.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+
+#if defined(OS_CHROMEOS)
+namespace chromeos {
+namespace bluetooth {
+class DebugLogsManager;
+} // namespace bluetooth
+} // namespace chromeos
+#endif
// Handles API requests from chrome://bluetooth-internals page by implementing
// mojom::BluetoothInternalsHandler.
class BluetoothInternalsHandler : public mojom::BluetoothInternalsHandler {
public:
explicit BluetoothInternalsHandler(
- mojom::BluetoothInternalsHandlerRequest request);
+ mojo::PendingReceiver<mojom::BluetoothInternalsHandler> receiver);
~BluetoothInternalsHandler() override;
- // mojom::BluetoothInternalsHandler overrides:
+#if defined(OS_CHROMEOS)
+ void set_debug_logs_manager(
+ chromeos::bluetooth::DebugLogsManager* debug_logs_manager) {
+ debug_logs_manager_ = debug_logs_manager;
+ }
+#endif
+
+ // mojom::BluetoothInternalsHandler:
void GetAdapter(GetAdapterCallback callback) override;
+ void GetDebugLogsChangeHandler(
+ GetDebugLogsChangeHandlerCallback callback) override;
private:
void OnGetAdapter(GetAdapterCallback callback,
scoped_refptr<device::BluetoothAdapter> adapter);
- mojo::Binding<mojom::BluetoothInternalsHandler> binding_;
+ mojo::Receiver<mojom::BluetoothInternalsHandler> receiver_;
+
+#if defined(OS_CHROMEOS)
+ chromeos::bluetooth::DebugLogsManager* debug_logs_manager_ = nullptr;
+#endif
+
base::WeakPtrFactory<BluetoothInternalsHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BluetoothInternalsHandler);
diff --git a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc
index d51387baaee..6f8ab24a1e9 100644
--- a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc
@@ -12,6 +12,10 @@
#include "chrome/grit/bluetooth_internals_resources_map.h"
#include "content/public/browser/web_ui_data_source.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/bluetooth/debug_logs_manager_factory.h"
+#endif
+
BluetoothInternalsUI::BluetoothInternalsUI(content::WebUI* web_ui)
: ui::MojoWebUIController(web_ui) {
// Set up the chrome://bluetooth-internals source.
@@ -43,7 +47,12 @@ BluetoothInternalsUI::BluetoothInternalsUI(content::WebUI* web_ui)
BluetoothInternalsUI::~BluetoothInternalsUI() {}
void BluetoothInternalsUI::BindBluetoothInternalsHandler(
- mojom::BluetoothInternalsHandlerRequest request) {
+ mojo::PendingReceiver<mojom::BluetoothInternalsHandler> receiver) {
page_handler_ =
- std::make_unique<BluetoothInternalsHandler>(std::move(request));
+ std::make_unique<BluetoothInternalsHandler>(std::move(receiver));
+#if defined(OS_CHROMEOS)
+ page_handler_->set_debug_logs_manager(
+ chromeos::bluetooth::DebugLogsManagerFactory::GetForProfile(
+ Profile::FromWebUI(web_ui())));
+#endif
}
diff --git a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h
index 628df1f6ab7..2a69c29cc58 100644
--- a/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h
+++ b/chromium/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h
@@ -7,6 +7,7 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
class BluetoothInternalsHandler;
@@ -19,7 +20,7 @@ class BluetoothInternalsUI : public ui::MojoWebUIController {
private:
void BindBluetoothInternalsHandler(
- mojom::BluetoothInternalsHandlerRequest request);
+ mojo::PendingReceiver<mojom::BluetoothInternalsHandler> receiver);
std::unique_ptr<BluetoothInternalsHandler> page_handler_;
diff --git a/chromium/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc b/chromium/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc
index f21dc8923c5..f7db04bc6d5 100644
--- a/chromium/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc
+++ b/chromium/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc
@@ -68,11 +68,11 @@ std::unique_ptr<base::Value> RuleSetToDict(
const browser_switcher::RuleSet& ruleset) {
auto sitelist = std::make_unique<base::ListValue>();
for (const std::string& rule : ruleset.sitelist)
- sitelist->GetList().emplace_back(rule);
+ sitelist->Append(rule);
auto greylist = std::make_unique<base::ListValue>();
for (const std::string& rule : ruleset.greylist)
- greylist->GetList().emplace_back(rule);
+ greylist->Append(rule);
auto dict = std::make_unique<base::DictionaryValue>();
dict->Set("sitelist", std::move(sitelist));
@@ -131,11 +131,8 @@ content::WebUIDataSource* CreateBrowserSwitchUIHTMLSource(
IDS_ABOUT_BROWSER_SWITCH_PROTOCOL_ERROR);
source->AddLocalizedString("title", IDS_ABOUT_BROWSER_SWITCH_TITLE);
- source->AddResourcePath("app.html", IDR_BROWSER_SWITCH_APP_HTML);
source->AddResourcePath("app.js", IDR_BROWSER_SWITCH_APP_JS);
source->AddResourcePath("browser_switch.html", IDR_BROWSER_SWITCH_HTML);
- source->AddResourcePath("browser_switch_proxy.html",
- IDR_BROWSER_SWITCH_PROXY_HTML);
source->AddResourcePath("browser_switch_proxy.js",
IDR_BROWSER_SWITCH_PROXY_JS);
source->SetDefaultResource(IDR_BROWSER_SWITCH_HTML);
diff --git a/chromium/chrome/browser/ui/webui/certificate_viewer_webui.cc b/chromium/chrome/browser/ui/webui/certificate_viewer_webui.cc
index 923fa172e43..7f7d4392278 100644
--- a/chromium/chrome/browser/ui/webui/certificate_viewer_webui.cc
+++ b/chromium/chrome/browser/ui/webui/certificate_viewer_webui.cc
@@ -267,7 +267,7 @@ std::string CertificateViewerDialog::GetDialogArgs() const {
// Add this node to the children list for the next iteration.
children = base::Value(base::Value::Type::LIST);
- children.GetList().push_back(std::move(cert_node));
+ children.Append(std::move(cert_node));
++index;
}
// Set the last node as the top of the certificate hierarchy.
diff --git a/chromium/chrome/browser/ui/webui/certificates_handler.cc b/chromium/chrome/browser/ui/webui/certificates_handler.cc
index 02077494954..8342599150d 100644
--- a/chromium/chrome/browser/ui/webui/certificates_handler.cc
+++ b/chromium/chrome/browser/ui/webui/certificates_handler.cc
@@ -1054,7 +1054,7 @@ void CertificatesHandler::PopulateTree(const std::string& tab_name,
cert_dict.SetKey(kCertificatesHandlerExtractableField,
base::Value(!cert_info->hardware_backed()));
// TODO(mattm): Other columns.
- subnodes.GetList().push_back(std::move(cert_dict));
+ subnodes.Append(std::move(cert_dict));
contains_policy_certs |=
cert_info->source() ==
@@ -1065,7 +1065,7 @@ void CertificatesHandler::PopulateTree(const std::string& tab_name,
org_dict.SetKey(kCertificatesHandlerContainsPolicyCertsField,
base::Value(contains_policy_certs));
org_dict.SetKey(kCertificatesHandlerSubnodesField, std::move(subnodes));
- nodes.GetList().push_back(std::move(org_dict));
+ nodes.Append(std::move(org_dict));
}
std::sort(nodes.GetList().begin(), nodes.GetList().end(), comparator);
diff --git a/chromium/chrome/browser/ui/webui/chrome_web_contents_handler.cc b/chromium/chrome/browser/ui/webui/chrome_web_contents_handler.cc
index 1b97ae66d5b..73aa8494ac6 100644
--- a/chromium/chrome/browser/ui/webui/chrome_web_contents_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chrome_web_contents_handler.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
+#include <utility>
+
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -46,7 +48,7 @@ WebContents* ChromeWebContentsHandler::OpenURLFromTab(
new Browser(Browser::CreateParams(Browser::TYPE_NORMAL, profile, true));
}
NavigateParams nav_params(browser, params.url, params.transition);
- nav_params.referrer = params.referrer;
+ nav_params.FillNavigateParamsFromOpenURLParams(params);
if (source && source->IsCrashed() &&
params.disposition == WindowOpenDisposition::CURRENT_TAB &&
ui::PageTransitionCoreTypeIs(params.transition,
@@ -56,7 +58,6 @@ WebContents* ChromeWebContentsHandler::OpenURLFromTab(
nav_params.disposition = params.disposition;
}
nav_params.window_action = NavigateParams::SHOW_WINDOW;
- nav_params.user_gesture = true;
Navigate(&nav_params);
// Close the browser if chrome::Navigate created a new one.
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 afb648955a1..49a65a4d7ab 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
@@ -16,7 +16,6 @@
#include "chrome/browser/about_flags.h"
#include "chrome/browser/accessibility/accessibility_ui.h"
#include "chrome/browser/devtools/devtools_ui_bindings.h"
-#include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
#include "chrome/browser/engagement/site_engagement_service.h"
#include "chrome/browser/media/media_engagement_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -26,6 +25,7 @@
#include "chrome/browser/ui/webui/autofill_and_password_manager_internals/autofill_internals_ui.h"
#include "chrome/browser/ui/webui/autofill_and_password_manager_internals/password_manager_internals_ui.h"
#include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h"
+#include "chrome/browser/ui/webui/chromeos/account_manager_error_ui.h"
#include "chrome/browser/ui/webui/chromeos/account_manager_welcome_ui.h"
#include "chrome/browser/ui/webui/chromeos/account_migration_welcome_ui.h"
#include "chrome/browser/ui/webui/chromeos/camera/camera_ui.h"
@@ -70,11 +70,6 @@
#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"
-#include "components/dom_distiller/core/url_constants.h"
-#include "components/dom_distiller/webui/dom_distiller_ui.h"
#include "components/favicon/core/favicon_service.h"
#include "components/favicon_base/favicon_util.h"
#include "components/favicon_base/select_favicon_frames.h"
@@ -114,7 +109,6 @@
#if !defined(OS_ANDROID)
#include "chrome/browser/media/router/media_router_feature.h"
-#include "chrome/browser/ui/webui/app_management/app_management_ui.h"
#include "chrome/browser/ui/webui/management_ui.h"
#include "chrome/browser/ui/webui/media_router/media_router_internals_ui.h"
#include "chrome/browser/ui/webui/web_footer_experiment_ui.h"
@@ -124,7 +118,6 @@
#endif
#if defined(OS_ANDROID)
-#include "chrome/android/features/dev_ui/buildflags.h"
#include "chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.h"
#include "chrome/browser/ui/webui/offline/offline_internals_ui.h"
#include "chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.h"
@@ -134,9 +127,6 @@
#if BUILDFLAG(ENABLE_FEED_IN_CHROME)
#include "chrome/browser/ui/webui/feed_internals/feed_internals_ui.h"
#endif // BUILDFLAG(ENABLE_FEED_IN_CHROME)
-#if BUILDFLAG(DFMIFY_DEV_UI)
-#include "chrome/browser/ui/webui/android/dev_ui_loader/dev_ui_loader_ui.h"
-#endif // BUILDFLAG(DFMIFY_DEV_UI)
#else // defined(OS_ANDROID)
#include "chrome/browser/ui/webui/bookmarks/bookmarks_ui.h"
#include "chrome/browser/ui/webui/devtools_ui.h"
@@ -163,6 +153,7 @@
#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/crostini_installer/crostini_installer_ui.h"
#include "chrome/browser/ui/webui/chromeos/cryptohome_ui.h"
#include "chrome/browser/ui/webui/chromeos/drive_internals_ui.h"
#include "chrome/browser/ui/webui/chromeos/first_run/first_run_ui.h"
@@ -182,6 +173,9 @@
#include "chrome/browser/ui/webui/chromeos/terminal/terminal_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/media_app_ui/media_app_guest_ui.h"
+#include "chromeos/components/media_app_ui/media_app_ui.h"
+#include "chromeos/components/media_app_ui/url_constants.h"
#include "chromeos/components/multidevice/debug_webui/proximity_auth_ui.h"
#include "chromeos/components/multidevice/debug_webui/url_constants.h"
#include "chromeos/constants/chromeos_features.h"
@@ -216,8 +210,8 @@
#include "chrome/browser/ui/webui/discards/discards_ui.h"
#endif
-#if defined(OS_LINUX) || defined(OS_ANDROID)
-#include "chrome/browser/ui/webui/sandbox_internals_ui.h"
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)
+#include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h"
#endif
#if defined(USE_NSS_CERTS) && defined(USE_AURA)
@@ -265,15 +259,6 @@ WebUIController* NewWebUI(WebUI* web_ui, const GURL& url) {
return new T(web_ui);
}
-#if defined(OS_ANDROID)
-#if BUILDFLAG(DFMIFY_DEV_UI)
-template <>
-WebUIController* NewWebUI<DevUiLoaderUI>(WebUI* web_ui, const GURL& url) {
- return new DevUiLoaderUI(web_ui, url);
-}
-#endif // BUILDFLAG(DFMIFY_DEV_UI)
-#endif // defined(OS_ANDROID)
-
#if !defined(OS_ANDROID)
template <>
WebUIController* NewWebUI<PageNotAvailableForGuestUI>(WebUI* web_ui,
@@ -310,21 +295,6 @@ WebUIController* NewWebUI<chromeos::multidevice::ProximityAuthUI>(
}
#endif
-// Special cases for DOM distiller.
-template <>
-WebUIController* NewWebUI<dom_distiller::DomDistillerUi>(WebUI* web_ui,
- const GURL& url) {
- // The DomDistillerUi can not depend on components/dom_distiller/content,
- // so inject the correct DomDistillerService from chrome/.
- content::BrowserContext* browser_context =
- web_ui->GetWebContents()->GetBrowserContext();
- dom_distiller::DomDistillerService* service =
- dom_distiller::DomDistillerServiceFactory::GetForBrowserContext(
- browser_context);
- return new dom_distiller::DomDistillerUi(web_ui, service,
- dom_distiller::kDomDistillerScheme);
-}
-
#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
template <>
WebUIController* NewWebUI<WelcomeUI>(WebUI* web_ui, const GURL& url) {
@@ -361,13 +331,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return nullptr;
}
-#if defined(OS_ANDROID)
-#if BUILDFLAG(DFMIFY_DEV_UI)
- if (url.host_piece() == chrome::kChromeUIDevUiLoaderHost)
- return &NewWebUI<DevUiLoaderUI>;
-#endif // BUILDFLAG(DFMIFY_DEV_UI)
-#endif // defined(OS_ANDROID)
-
// Please keep this in alphabetical order. If #ifs or special logics are
// required, add it below in the appropriate section.
//
@@ -449,12 +412,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<VersionUI>;
#if !defined(OS_ANDROID)
- if (AppManagementUI::IsEnabled() &&
- url.host_piece() == chrome::kChromeUIAppManagementHost && profile &&
- !profile->IsGuestSession()) {
- return &NewWebUI<AppManagementUI>;
- }
-
#if !defined(OS_CHROMEOS)
// AppLauncherPage is not needed on Android or ChromeOS.
if (url.host_piece() == chrome::kChromeUIAppLauncherPageHost && profile &&
@@ -465,7 +422,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
#endif // !defined(OS_CHROMEOS)
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)) {
@@ -526,6 +482,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
}
return &NewWebUI<chromeos::UrgentPasswordExpiryNotificationUI>;
}
+ if (url.host_piece() == chrome::kChromeUIAccountManagerErrorHost)
+ return &NewWebUI<chromeos::AccountManagerErrorUI>;
if (url.host_piece() == chrome::kChromeUIAccountManagerWelcomeHost)
return &NewWebUI<chromeos::AccountManagerWelcomeUI>;
if (url.host_piece() == chrome::kChromeUIAccountMigrationWelcomeHost)
@@ -540,6 +498,9 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<chromeos::cellular_setup::CellularSetupDialogUI>;
if (url.host_piece() == chrome::kChromeUICertificateManagerHost)
return &NewWebUI<chromeos::CertificateManagerDialogUI>;
+ if (chromeos::CrostiniInstallerUI::IsEnabled() &&
+ url.host_piece() == chrome::kChromeUICrostiniInstallerHost)
+ return &NewWebUI<chromeos::CrostiniInstallerUI>;
if (url.host_piece() == chrome::kChromeUICryptohomeHost)
return &NewWebUI<chromeos::CryptohomeUI>;
if (url.host_piece() == chrome::kChromeUIDriveInternalsHost)
@@ -560,6 +521,12 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<chromeos::settings::OSSettingsUI>;
if (url.host_piece() == chrome::kChromeUIPowerHost)
return &NewWebUI<chromeos::PowerUI>;
+ if (base::FeatureList::IsEnabled(chromeos::features::kMediaApp)) {
+ if (url.host_piece() == chromeos::kChromeUIMediaAppHost)
+ return &NewWebUI<chromeos::MediaAppUI>;
+ if (url.host_piece() == chromeos::kChromeUIMediaAppGuestHost)
+ return &NewWebUI<chromeos::MediaAppGuestUI>;
+ }
if (url.host_piece() == chromeos::multidevice::kChromeUIProximityAuthHost)
return &NewWebUI<chromeos::multidevice::ProximityAuthUI>;
if (url.host_piece() == chrome::kChromeUIInternetConfigDialogHost)
@@ -702,7 +669,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<CastUI>;
}
#endif
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)
if (url.host_piece() == chrome::kChromeUISandboxHost) {
return &NewWebUI<SandboxInternalsUI>;
}
@@ -724,11 +691,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<security_interstitials::ConnectionHelpUI>;
}
- if (dom_distiller::IsDomDistillerEnabled() &&
- url.host_piece() == dom_distiller::kChromeUIDomDistillerHost) {
- return &NewWebUI<dom_distiller::DomDistillerUi>;
- }
-
if (SiteEngagementService::IsEnabled() &&
url.host_piece() == chrome::kChromeUISiteEngagementHost) {
return &NewWebUI<SiteEngagementUI>;
@@ -936,10 +898,6 @@ 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/account_manager_error_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/account_manager_error_ui.cc
new file mode 100644
index 00000000000..ed686a24eec
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_manager_error_ui.cc
@@ -0,0 +1,54 @@
+// 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/account_manager_error_ui.h"
+
+#include "base/bind.h"
+#include "build/branding_buildflags.h"
+#include "chrome/browser/profiles/profile.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 "content/public/browser/web_ui_data_source.h"
+#include "ui/strings/grit/ui_strings.h"
+
+namespace chromeos {
+
+AccountManagerErrorUI::AccountManagerErrorUI(content::WebUI* web_ui)
+ : ui::WebDialogUI(web_ui), weak_factory_(this) {
+ content::WebUIDataSource* html_source = content::WebUIDataSource::Create(
+ chrome::kChromeUIAccountManagerErrorHost);
+
+ web_ui->RegisterMessageCallback(
+ "closeDialog", base::BindRepeating(&WebDialogUI::CloseDialog,
+ weak_factory_.GetWeakPtr()));
+
+ html_source->UseStringsJs();
+
+ html_source->AddLocalizedString(
+ "errorTitle", IDS_ACCOUNT_MANAGER_SECONDARY_ACCOUNTS_DISABLED_TITLE);
+ html_source->AddLocalizedString(
+ "errorMessage", IDS_ACCOUNT_MANAGER_SECONDARY_ACCOUNTS_DISABLED_TEXT);
+ html_source->AddLocalizedString("okButton", IDS_APP_OK);
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ html_source->AddResourcePath("googleg.svg",
+ IDR_ACCOUNT_MANAGER_WELCOME_GOOGLE_LOGO_SVG);
+#endif
+
+ // Add required resources.
+ html_source->AddResourcePath("account_manager_shared.css",
+ IDR_ACCOUNT_MANAGER_SHARED_CSS);
+ html_source->AddResourcePath("account_manager_error.js",
+ IDR_ACCOUNT_MANAGER_ERROR_JS);
+
+ html_source->SetDefaultResource(IDR_ACCOUNT_MANAGER_ERROR_HTML);
+
+ Profile* profile = Profile::FromWebUI(web_ui);
+ content::WebUIDataSource::Add(profile, html_source);
+}
+
+AccountManagerErrorUI::~AccountManagerErrorUI() = default;
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/account_manager_error_ui.h b/chromium/chrome/browser/ui/webui/chromeos/account_manager_error_ui.h
new file mode 100644
index 00000000000..60396df2316
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/account_manager_error_ui.h
@@ -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.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_ACCOUNT_MANAGER_ERROR_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_ACCOUNT_MANAGER_ERROR_UI_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "ui/web_dialogs/web_dialog_ui.h"
+
+namespace chromeos {
+
+// For chrome:://account-manager-error
+class AccountManagerErrorUI : public ui::WebDialogUI {
+ public:
+ explicit AccountManagerErrorUI(content::WebUI* web_ui);
+ ~AccountManagerErrorUI() override;
+
+ private:
+ base::WeakPtrFactory<AccountManagerErrorUI> weak_factory_;
+ DISALLOW_COPY_AND_ASSIGN(AccountManagerErrorUI);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_ACCOUNT_MANAGER_ERROR_UI_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc
index e418a046414..626b2d4cc9a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.cc
@@ -11,12 +11,13 @@
#include "base/stl_util.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/chromeos/arc/arc_session_manager.h"
+#include "chrome/browser/chromeos/arc/session/arc_session_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/supervised_user/supervised_user_service.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision.mojom.h"
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h"
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h"
#include "chrome/services/app_service/public/cpp/app_registry_cache.h"
@@ -26,17 +27,20 @@
#include "components/user_manager/user_manager.h"
#include "content/public/browser/web_ui.h"
#include "google_apis/gaia/gaia_constants.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
namespace chromeos {
AddSupervisionHandler::AddSupervisionHandler(
- add_supervision::mojom::AddSupervisionHandlerRequest request,
+ mojo::PendingReceiver<add_supervision::mojom::AddSupervisionHandler>
+ receiver,
content::WebUI* web_ui,
+ signin::IdentityManager* identity_manager,
Delegate* delegate)
: web_ui_(web_ui),
- identity_manager_(
- IdentityManagerFactory::GetForProfile(Profile::FromWebUI(web_ui))),
- binding_(this, std::move(request)),
+ identity_manager_(identity_manager),
+ receiver_(this, std::move(receiver)),
delegate_(delegate) {}
AddSupervisionHandler::~AddSupervisionHandler() = default;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.h b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.h
index 63db8d65ecd..8310d5bda98 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.h
@@ -9,7 +9,8 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
namespace content {
class WebUI;
@@ -39,8 +40,10 @@ class AddSupervisionHandler
// |delegate| is owned by the caller and its lifetime must outlive |this|.
AddSupervisionHandler(
- add_supervision::mojom::AddSupervisionHandlerRequest request,
+ mojo::PendingReceiver<add_supervision::mojom::AddSupervisionHandler>
+ receiver,
content::WebUI* web_ui,
+ signin::IdentityManager* identity_manager,
Delegate* delegate);
~AddSupervisionHandler() override;
@@ -63,7 +66,7 @@ class AddSupervisionHandler
signin::IdentityManager* identity_manager_;
std::unique_ptr<signin::AccessTokenFetcher> oauth2_access_token_fetcher_;
- mojo::Binding<add_supervision::mojom::AddSupervisionHandler> binding_;
+ mojo::Receiver<add_supervision::mojom::AddSupervisionHandler> receiver_;
Delegate* delegate_;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder_browsertest.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder_browsertest.cc
index 3071dacac19..72e41559d58 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder_browsertest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chromeos/constants/chromeos_features.h"
+#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "content/public/test/test_web_ui.h"
namespace chromeos {
@@ -55,10 +56,12 @@ class AddSupervisionMetricsRecorderTest : public InProcessBrowserTest {
}
void NotifySupervisionEnabled() {
+ signin::IdentityTestEnvironment identity_test_env;
add_supervision::mojom::AddSupervisionHandlerRequest request;
AddSupervisionUI add_supervision_ui(&test_web_ui_);
AddSupervisionHandler add_supervision_handler(
- std::move(request), &test_web_ui_, &add_supervision_ui);
+ std::move(request), &test_web_ui_, identity_test_env.identity_manager(),
+ &add_supervision_ui);
add_supervision_handler.NotifySupervisionEnabled();
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc
index c0c3fb9b98f..6579db46102 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.cc
@@ -12,7 +12,10 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/identity_manager_factory.h"
+#include "chrome/browser/supervised_user/supervised_user_service.h"
+#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/browser/ui/views/chrome_web_dialog_view.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision.mojom.h"
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.h"
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h"
#include "chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.h"
@@ -22,7 +25,7 @@
#include "components/google/core/common/google_util.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/resources/grit/ui_resources.h"
#include "ui/web_dialogs/web_dialog_delegate.h"
@@ -50,22 +53,6 @@ const char kAddSupervisionDefaultURL[] =
const char kAddSupervisionFlowType[] = "1";
const char kAddSupervisionSwitch[] = "add-supervision-url";
-// Returns the URL of the Add Supervision flow from the command-line switch,
-// or the default value if it's not defined.
-GURL GetAddSupervisionURL() {
- std::string url;
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(kAddSupervisionSwitch)) {
- url = command_line->GetSwitchValueASCII(kAddSupervisionSwitch);
- } else {
- url = kAddSupervisionDefaultURL;
- }
- const GURL result(url);
- DCHECK(result.is_valid()) << "Invalid URL \"" << url << "\" for switch \""
- << kAddSupervisionSwitch << "\"";
- return result;
-}
-
} // namespace
// AddSupervisionDialog implementations.
@@ -144,6 +131,9 @@ AddSupervisionDialog::~AddSupervisionDialog() = default;
// AddSupervisionUI implementations.
+// static
+signin::IdentityManager* AddSupervisionUI::test_identity_manager_ = nullptr;
+
AddSupervisionUI::AddSupervisionUI(content::WebUI* web_ui)
: ui::MojoWebUIController(web_ui) {
// Register the Mojo API handler.
@@ -151,17 +141,47 @@ AddSupervisionUI::AddSupervisionUI(content::WebUI* web_ui)
&AddSupervisionUI::BindAddSupervisionHandler, base::Unretained(this)));
// Set up the basic page framework.
- SetupResources();
+ SetUpResources();
+}
+
+AddSupervisionUI::~AddSupervisionUI() = default;
+
+bool AddSupervisionUI::CloseDialog() {
+ bool showing_confirm_dialog = MaybeShowConfirmSignoutDialog();
+ if (!showing_confirm_dialog) {
+ // We aren't showing the confirm dialog, so close the AddSupervisionDialog.
+ AddSupervisionDialog::Close();
+ }
+ return !showing_confirm_dialog;
+}
+
+// static
+void AddSupervisionUI::SetUpForTest(signin::IdentityManager* identity_manager) {
+ test_identity_manager_ = identity_manager;
}
-void AddSupervisionUI::SetupResources() {
+void AddSupervisionUI::BindAddSupervisionHandler(
+ mojo::PendingReceiver<add_supervision::mojom::AddSupervisionHandler>
+ receiver) {
+ signin::IdentityManager* identity_manager =
+ test_identity_manager_
+ ? test_identity_manager_
+ : IdentityManagerFactory::GetForProfile(Profile::FromWebUI(web_ui()));
+
+ mojo_api_handler_ = std::make_unique<AddSupervisionHandler>(
+ std::move(receiver), web_ui(), identity_manager, this);
+}
+
+void AddSupervisionUI::SetUpResources() {
Profile* profile = Profile::FromWebUI(web_ui());
std::unique_ptr<content::WebUIDataSource> source(
content::WebUIDataSource::Create(chrome::kChromeUIAddSupervisionHost));
// Initialize supervision URL from the command-line arguments (if provided).
supervision_url_ = GetAddSupervisionURL();
- DCHECK(supervision_url_.DomainIs("google.com"));
+ if (!allow_non_google_url_for_tests_) {
+ DCHECK(supervision_url_.DomainIs("google.com"));
+ }
// Forward data to the WebUI.
source->AddResourcePath("post_message_api.js",
@@ -201,21 +221,24 @@ void AddSupervisionUI::SetupResources() {
content::WebUIDataSource::Add(profile, source.release());
}
-AddSupervisionUI::~AddSupervisionUI() = default;
-
-bool AddSupervisionUI::CloseDialog() {
- bool showing_confirm_dialog = MaybeShowConfirmSignoutDialog();
- if (!showing_confirm_dialog) {
- // We aren't showing the confirm dialog, so close the AddSupervisionDialog.
- AddSupervisionDialog::Close();
+// Returns the URL of the Add Supervision flow from the command-line switch,
+// or the default value if it's not defined.
+GURL AddSupervisionUI::GetAddSupervisionURL() {
+ std::string url;
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(kAddSupervisionSwitch)) {
+ url = command_line->GetSwitchValueASCII(kAddSupervisionSwitch);
+ // The URL should only be set on the command line for testing purposes,
+ // which may include pointing to a non-google URL (i.e. http://localhost/).
+ // Therefore, we allow non-Google URLs in this instance.
+ allow_non_google_url_for_tests_ = true;
+ } else {
+ url = kAddSupervisionDefaultURL;
}
- return !showing_confirm_dialog;
-}
-
-void AddSupervisionUI::BindAddSupervisionHandler(
- add_supervision::mojom::AddSupervisionHandlerRequest request) {
- mojo_api_handler_ = std::make_unique<AddSupervisionHandler>(
- std::move(request), web_ui(), this);
+ const GURL result(url);
+ DCHECK(result.is_valid()) << "Invalid URL \"" << url << "\" for switch \""
+ << kAddSupervisionSwitch << "\"";
+ return result;
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h
index 02afc8e1d8e..a05b13f8b31 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h
@@ -11,6 +11,7 @@
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision.mojom.h"
#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/controls/label.h"
@@ -64,16 +65,23 @@ class AddSupervisionUI : public ui::MojoWebUIController,
// AddSupervisionHandler::Delegate:
bool CloseDialog() override;
+ static void SetUpForTest(signin::IdentityManager* identity_manager);
+
private:
void BindAddSupervisionHandler(
- add_supervision::mojom::AddSupervisionHandlerRequest request);
- void SetupResources();
+ mojo::PendingReceiver<add_supervision::mojom::AddSupervisionHandler>
+ receiver);
+ void SetUpResources();
+ GURL GetAddSupervisionURL();
std::unique_ptr<add_supervision::mojom::AddSupervisionHandler>
mojo_api_handler_;
GURL supervision_url_;
+ static signin::IdentityManager* test_identity_manager_;
+ bool allow_non_google_url_for_tests_ = false;
+
DISALLOW_COPY_AND_ASSIGN(AddSupervisionUI);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui_browsertest.cc
new file mode 100644
index 00000000000..f0995d1b6d7
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui_browsertest.cc
@@ -0,0 +1,242 @@
+// 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 <string>
+
+#include "base/macros.h"
+#include "base/test/metrics/histogram_tester.h"
+#include "base/test/metrics/user_action_tester.h"
+#include "base/test/scoped_feature_list.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_metrics_recorder.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_ui.h"
+#include "chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.h"
+#include "chrome/common/webui_url_constants.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "chromeos/constants/chromeos_features.h"
+#include "components/signin/public/identity_manager/identity_test_environment.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/test/browser_test_utils.h"
+#include "content/public/test/network_connection_change_simulator.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
+
+namespace chromeos {
+
+// NOTE: This test is flaky and therefore disabled under MSAN:
+// https://crbug.com/1002560
+#if !defined(MEMORY_SANITIZER)
+
+namespace {
+
+const char kGetAddSupervisionUIElementJS[] =
+ "document.querySelector('add-supervision-ui')";
+}
+
+// Base class for AddSupervision tests.
+class AddSupervisionBrowserTest : public InProcessBrowserTest {
+ public:
+ AddSupervisionBrowserTest() {
+ scoped_feature_list_.InitWithFeatures(
+ {chromeos::features::kParentalControlsSettings}, {});
+ }
+ ~AddSupervisionBrowserTest() override = default;
+
+ void SetUpOnMainThread() override {
+ // TODO(danan): See if this is possible to do this instead using
+ // FakeGaia.IssueOAuthToken().
+ identity_test_env_ = std::make_unique<signin::IdentityTestEnvironment>();
+ identity_test_env_->MakePrimaryAccountAvailable("example@gmail.com");
+ // This makes the identity manager return the string "access_token" for the
+ // access token.
+ identity_test_env_->SetAutomaticIssueOfAccessTokens(true);
+ AddSupervisionUI::SetUpForTest(identity_test_env_->identity_manager());
+
+ // Set start_time_ so that the DCHECK(!start_time_.is_null()) in
+ // AddSupervisionMetricsRecorder::RecordUserTime() doesn't throw.
+ AddSupervisionMetricsRecorder::GetInstance()
+ ->RecordAddSupervisionEnrollment(
+ AddSupervisionMetricsRecorder::EnrollmentState::kInitiated);
+ }
+
+ chromeos::AddSupervisionUI* GetAddSupervisionUI() {
+ return static_cast<chromeos::AddSupervisionUI*>(
+ contents()->GetWebUI()->GetController());
+ }
+
+ content::WebContents* contents() {
+ return browser()->tab_strip_model()->GetActiveWebContents();
+ }
+
+ GURL settings_webui_url() { return GURL(chrome::kChromeUISettingsURL); }
+
+ GURL add_supervision_webui_url() {
+ return GURL(chrome::kChromeUIAddSupervisionURL);
+ }
+
+ bool IsElementVisible(const std::string& element_selector) {
+ bool found;
+ bool hidden;
+ std::string script = std::string("domAutomationController.send(") +
+ element_selector + ".hidden);";
+ LOG(ERROR) << "Script: " << script;
+ found = content::ExecuteScriptAndExtractBool(contents(), script, &hidden);
+ return found && !hidden;
+ }
+
+ private:
+ base::test::ScopedFeatureList scoped_feature_list_;
+ std::unique_ptr<signin::IdentityTestEnvironment> identity_test_env_;
+
+ DISALLOW_COPY_AND_ASSIGN(AddSupervisionBrowserTest);
+};
+
+// Disabled on ASan and LSAn builds, because it's very flaky. See
+// crbug.com/1004237
+#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER)
+#define MAYBE_URLParameters DISABLED_URLParameters
+#else
+#define MAYBE_URLParameters URLParameters
+#endif
+IN_PROC_BROWSER_TEST_F(AddSupervisionBrowserTest, MAYBE_URLParameters) {
+ // Open the Add Supervision URL.
+ ui_test_utils::NavigateToURL(browser(), add_supervision_webui_url());
+ content::WaitForLoadStop(contents());
+
+ // Get the URL from the embedded webview.
+ std::string webview_url;
+ ASSERT_TRUE(content::ExecuteScriptAndExtractString(
+ contents(),
+ std::string("domAutomationController.send(") +
+ std::string(kGetAddSupervisionUIElementJS) +
+ ".shadowRoot.querySelector('#webview').getAttribute('src')" +
+ std::string(");"),
+ &webview_url));
+
+ GURL webview_gurl(webview_url);
+ ASSERT_TRUE(webview_gurl.has_query());
+
+ // Split the query string into a map of keys to values.
+ std::string query_str = webview_gurl.query();
+ url::Component query(0, query_str.length());
+ url::Component key;
+ url::Component value;
+ std::map<std::string, std::string> query_parts;
+ while (url::ExtractQueryKeyValue(query_str.c_str(), &query, &key, &value)) {
+ query_parts[query_str.substr(key.begin, key.len)] =
+ query_str.substr(value.begin, value.len);
+ }
+
+ // Validate the query parameters.
+ ASSERT_EQ(query_parts.at("flow_type"), "1");
+ ASSERT_EQ(query_parts.at("platform_version"),
+ base::SysInfo::OperatingSystemVersion());
+ ASSERT_EQ(query_parts.at("access_token"), "access_token");
+ ASSERT_EQ(query_parts.at("hl"), "en-US");
+}
+
+IN_PROC_BROWSER_TEST_F(AddSupervisionBrowserTest, ShowOfflineScreen) {
+ // Open the Add Supervision URL.
+ ui_test_utils::NavigateToURL(browser(), add_supervision_webui_url());
+ content::WaitForLoadStop(contents());
+
+ // Webview div should be initially visible.
+ ASSERT_TRUE(IsElementVisible(std::string(kGetAddSupervisionUIElementJS) +
+ std::string(".webviewDiv")));
+
+ // Simulate going offline.
+ ASSERT_TRUE(content::ExecuteScript(
+ contents(), "window.dispatchEvent(new CustomEvent('offline'));"));
+
+ // Ensure the offline content view is shown.
+ ASSERT_TRUE(IsElementVisible(std::string(kGetAddSupervisionUIElementJS) +
+ std::string(".offlineContentDiv")));
+
+ // Ensure the online webview content content is hidden.
+ ASSERT_FALSE(IsElementVisible(std::string(kGetAddSupervisionUIElementJS) +
+ std::string(".webviewDiv")));
+
+ // Simulate going online.
+ ASSERT_TRUE(content::ExecuteScript(
+ contents(), "window.dispatchEvent(new CustomEvent('online'));"));
+
+ // Offline div should be hidden.
+ ASSERT_FALSE(IsElementVisible(std::string(kGetAddSupervisionUIElementJS) +
+ std::string(".offlineContentDiv")));
+
+ // Webview div should be shown.
+ ASSERT_TRUE(IsElementVisible(std::string(kGetAddSupervisionUIElementJS) +
+ std::string(".webviewDiv")));
+}
+
+// Disabled on ASan and LSAn builds, because it's very flaky. See
+// crbug.com/1004237
+#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER)
+#define MAYBE_ShowConfirmSignoutDialog DISABLED_ShowConfirmSignoutDialog
+#else
+#define MAYBE_ShowConfirmSignoutDialog ShowConfirmSignoutDialog
+#endif
+IN_PROC_BROWSER_TEST_F(AddSupervisionBrowserTest,
+ MAYBE_ShowConfirmSignoutDialog) {
+ // Open the Add Supervision URL.
+ ui_test_utils::NavigateToURL(browser(), add_supervision_webui_url());
+ content::WaitForLoadStop(contents());
+
+ // Request that the dialog close before supervision has been enabled.
+ ASSERT_TRUE(content::ExecuteScript(
+ contents(), std::string(kGetAddSupervisionUIElementJS) +
+ std::string(".server.requestClose()")));
+ // Confirm that the signout dialog isn't showing
+ ASSERT_FALSE(ConfirmSignoutDialog::IsShowing());
+
+ // Simulate supervision being enabled.
+ ASSERT_TRUE(content::ExecuteScript(
+ contents(), std::string(kGetAddSupervisionUIElementJS) +
+ std::string(".server.notifySupervisionEnabled()")));
+
+ // Request that the dialog is closed again.
+ ASSERT_TRUE(content::ExecuteScript(
+ contents(), std::string(kGetAddSupervisionUIElementJS) +
+ std::string(".server.requestClose()")));
+
+ // Confirm that the dialog is showing.
+ ASSERT_TRUE(ConfirmSignoutDialog::IsShowing());
+}
+
+IN_PROC_BROWSER_TEST_F(AddSupervisionBrowserTest, UMATest) {
+ base::HistogramTester histogram_tester;
+ base::UserActionTester user_action_tester;
+
+ // Should see 0 Add Supervision enrollment metrics at first.
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 0);
+
+ // Should see 0 user actions at first.
+ EXPECT_EQ(user_action_tester.GetActionCount(
+ "AddSupervisionDialog_AttemptedSignoutAfterEnrollment"),
+ 0);
+
+ // Open the Add Supervision URL.
+ ui_test_utils::NavigateToURL(browser(), add_supervision_webui_url());
+ content::WaitForLoadStop(contents());
+
+ // Simulate supervision being enabled.
+ ASSERT_TRUE(content::ExecuteScript(
+ contents(), std::string(kGetAddSupervisionUIElementJS) +
+ std::string(".server.notifySupervisionEnabled()")));
+
+ // Should see 1 Add Supervision process completed.
+ histogram_tester.ExpectUniqueSample(
+ "AddSupervisionDialog.Enrollment",
+ AddSupervisionMetricsRecorder::EnrollmentState::kCompleted, 1);
+ histogram_tester.ExpectTotalCount("AddSupervisionDialog.Enrollment", 1);
+
+ // Should see 1 EnrollmentCompleted action.
+ EXPECT_EQ(user_action_tester.GetActionCount(
+ "AddSupervisionDialog_EnrollmentCompleted"),
+ 1);
+}
+
+#endif // !defined(MEMORY_SANITIZER)
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc
index b0754f4a57b..f9594134ec5 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.cc
@@ -29,6 +29,14 @@ const int kDialogBodyTextWidth = 250;
} // namespace
ConfirmSignoutDialog::ConfirmSignoutDialog() {
+ DialogDelegate::set_button_label(
+ ui::DIALOG_BUTTON_OK,
+ l10n_util::GetStringUTF16(
+ IDS_ADD_SUPERVISION_EXIT_DIALOG_SIGNOUT_BUTTON_LABEL));
+ DialogDelegate::set_button_label(
+ ui::DIALOG_BUTTON_CANCEL,
+ l10n_util::GetStringUTF16(
+ IDS_ADD_SUPERVISION_EXIT_DIALOG_CANCEL_BUTTON_LABEL));
SetLayoutManager(std::make_unique<views::FillLayout>());
SetBorder(views::CreateEmptyBorder(
views::LayoutProvider::Get()->GetDialogInsetsForContentType(
@@ -44,7 +52,9 @@ ConfirmSignoutDialog::ConfirmSignoutDialog() {
AddChildView(body);
}
-ConfirmSignoutDialog::~ConfirmSignoutDialog() = default;
+ConfirmSignoutDialog::~ConfirmSignoutDialog() {
+ ConfirmSignoutDialog::current_instance_ = nullptr;
+}
ui::ModalType ConfirmSignoutDialog::GetModalType() const {
return ui::ModalType::MODAL_TYPE_SYSTEM;
@@ -64,23 +74,22 @@ int ConfirmSignoutDialog::GetDialogButtons() const {
ui::DialogButton::DIALOG_BUTTON_CANCEL;
}
-base::string16 ConfirmSignoutDialog::GetDialogButtonLabel(
- ui::DialogButton button) const {
- if (button == ui::DialogButton::DIALOG_BUTTON_OK) {
- return l10n_util::GetStringUTF16(
- IDS_ADD_SUPERVISION_EXIT_DIALOG_SIGNOUT_BUTTON_LABEL);
- }
- return l10n_util::GetStringUTF16(
- IDS_ADD_SUPERVISION_EXIT_DIALOG_CANCEL_BUTTON_LABEL);
-}
+// static
+views::Widget* ConfirmSignoutDialog::current_instance_ = nullptr;
// static
void ConfirmSignoutDialog::Show() {
// Ownership of the ConfirmSignoutDialog is passed to the views system.
// Dialog is system-modal, so no parent window is needed.
- constrained_window::CreateBrowserModalDialogViews(new ConfirmSignoutDialog(),
- nullptr /* parent window */)
- ->Show();
+ ConfirmSignoutDialog::current_instance_ =
+ constrained_window::CreateBrowserModalDialogViews(
+ new ConfirmSignoutDialog(), nullptr /* parent window */);
+ current_instance_->Show();
+}
+
+// static
+bool ConfirmSignoutDialog::IsShowing() {
+ return ConfirmSignoutDialog::current_instance_ != nullptr;
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.h b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.h
index 6e7bff69d73..c8d7a820a6b 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/add_supervision/confirm_signout_dialog.h
@@ -9,6 +9,10 @@
#include "ui/base/ui_base_types.h"
#include "ui/views/window/dialog_delegate.h"
+namespace views {
+class Widget;
+}
+
namespace chromeos {
// Dialog shown when the user tries to close the flow when account has already
@@ -25,12 +29,13 @@ class ConfirmSignoutDialog : public views::DialogDelegateView {
// views::DialogDelegate:
bool Accept() override;
int GetDialogButtons() const override;
- base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
static void Show();
+ static bool IsShowing();
private:
ConfirmSignoutDialog();
+ static views::Widget* current_instance_;
DISALLOW_COPY_AND_ASSIGN(ConfirmSignoutDialog);
};
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 3c918789930..56515216033 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
@@ -404,9 +404,16 @@ void ArcGraphicsTracingHandler::StartTracing() {
base::trace_event::TraceConfig config(
"-*,exo,viz,toplevel,gpu,cc,blink,disabled-by-default-android "
- "gfx,disabled-by-default-android hal,disabled-by-default-android view",
+ "gfx,disabled-by-default-android view",
base::trace_event::RECORD_CONTINUOUSLY);
config.EnableSystrace();
+ // By default, systracing starts pre-defined set of categories with predefined
+ // set of events in each category. Limit events to what we actually analyze in
+ // ArcTracingModel.
+ config.EnableSystraceEvent("i915:intel_gpu_freq_change");
+ config.EnableSystraceEvent("power:cpu_idle");
+ config.EnableSystraceEvent("sched:sched_wakeup");
+ config.EnableSystraceEvent("sched:sched_switch");
tracing_active_ = true;
if (jank_detector_)
jank_detector_->Reset();
@@ -434,8 +441,8 @@ void ArcGraphicsTracingHandler::StopTracing() {
return;
controller->StopTracing(content::TracingController::CreateStringEndpoint(
- base::BindRepeating(&ArcGraphicsTracingHandler::OnTracingStopped,
- weak_ptr_factory_.GetWeakPtr())));
+ base::BindOnce(&ArcGraphicsTracingHandler::OnTracingStopped,
+ weak_ptr_factory_.GetWeakPtr())));
}
void ArcGraphicsTracingHandler::SetStatus(const std::string& status) {
@@ -452,10 +459,9 @@ void ArcGraphicsTracingHandler::OnTracingStarted() {
}
void ArcGraphicsTracingHandler::OnTracingStopped(
- std::unique_ptr<const base::DictionaryValue> metadata,
- base::RefCountedString* trace_data) {
+ std::unique_ptr<std::string> trace_data) {
std::string string_data;
- string_data.swap(trace_data->data());
+ string_data.swap(*trace_data);
base::PostTaskAndReplyWithResult(
FROM_HERE,
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT},
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 bd774e39149..63849de5602 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
@@ -24,7 +24,6 @@ class ArcSystemStatCollector;
namespace base {
class ListValue;
-class RefCountedString;
} // namespace base
namespace exo {
@@ -71,8 +70,7 @@ class ArcGraphicsTracingHandler : public content::WebUIMessageHandler,
void SetStatus(const std::string& status);
void OnTracingStarted();
- void OnTracingStopped(std::unique_ptr<const base::DictionaryValue> metadata,
- base::RefCountedString* trace_data);
+ void OnTracingStopped(std::unique_ptr<std::string> trace_data);
// Called when graphics model is built or load. Extra string parameter
// contains a status. In case model cannot be built/load empty |base::Value|
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 03a052c6863..72e6a511441 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
@@ -8,10 +8,11 @@
#include <string>
#include <utility>
-#include "ash/public/mojom/voice_interaction_controller.mojom.h"
#include "base/bind.h"
#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
+#include "build/buildflag.h"
+#include "chrome/browser/chromeos/assistant/assistant_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/ash_util.h"
@@ -19,7 +20,9 @@
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
+#include "chromeos/assistant/buildflags.h"
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
+#include "chromeos/services/assistant/public/features.h"
#include "components/prefs/pref_service.h"
#include "components/session_manager/core/session_manager.h"
#include "content/public/browser/host_zoom_map.h"
@@ -80,7 +83,6 @@ AssistantOptInUI::AssistantOptInUI(content::WebUI* web_ui)
source->UseStringsJs();
source->AddResourcePath("assistant_optin.js", IDR_ASSISTANT_OPTIN_JS);
source->AddResourcePath("assistant_logo.png", IDR_ASSISTANT_LOGO_PNG);
- source->AddBoolean("hotwordDspAvailable", chromeos::IsHotwordDspAvailable());
source->SetDefaultResource(IDR_ASSISTANT_OPTIN_HTML);
source->AddResourcePath("voice_match_animation.json",
IDR_ASSISTANT_VOICE_MATCH_ANIMATION);
@@ -123,10 +125,24 @@ void AssistantOptInUI::Initialize() {
void AssistantOptInDialog::Show(
ash::FlowType type,
ash::AssistantSetup::StartAssistantOptInFlowCallback callback) {
+#if !BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
+ std::move(callback).Run(false);
+ return;
+#endif
+
+ // Check Assistant allowed state.
+ if (::assistant::IsAssistantAllowedForProfile(
+ ProfileManager::GetActiveUserProfile()) !=
+ ash::mojom::AssistantAllowedState::ALLOWED) {
+ std::move(callback).Run(false);
+ return;
+ }
+
// Check session state here to prevent timing issue -- session state might
// have changed during the mojom calls to launch the opt-in dalog.
if (session_manager::SessionManager::Get()->session_state() !=
session_manager::SessionState::ACTIVE) {
+ std::move(callback).Run(false);
return;
}
if (g_dialog) {
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 96f8106a00d..802664295d6 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
@@ -111,7 +111,7 @@ base::Value CreateZippyData(const SettingZippyList& zippy_list) {
data.SetKey("iconUri", base::Value(setting_zippy.icon_uri()));
data.SetKey("popupLink", base::Value(l10n_util::GetStringUTF16(
IDS_ASSISTANT_ACTIVITY_CONTROL_POPUP_LINK)));
- zippy_data.GetList().push_back(std::move(data));
+ zippy_data.Append(std::move(data));
}
return zippy_data;
}
@@ -131,7 +131,7 @@ base::Value CreateDisclosureData(const SettingZippyList& disclosure_list) {
base::Value(disclosure.additional_info_paragraph(0)));
}
data.SetKey("iconUri", base::Value(disclosure.icon_uri()));
- disclosure_data.GetList().push_back(std::move(data));
+ disclosure_data.Append(std::move(data));
}
return disclosure_data;
}
@@ -157,7 +157,7 @@ base::Value CreateGetMoreData(bool email_optin_needed,
"iconUri",
base::Value("https://www.gstatic.com/images/icons/material/system/"
"2x/screen_search_desktop_grey600_24dp.png"));
- get_more_data.GetList().push_back(std::move(context_data));
+ get_more_data.Append(std::move(context_data));
// Process email optin data.
if (email_optin_needed) {
@@ -169,7 +169,7 @@ base::Value CreateGetMoreData(bool email_optin_needed,
base::Value(email_optin_ui.default_enabled()));
data.SetKey("iconUri", base::Value(email_optin_ui.icon_uri()));
data.SetKey("legalText", base::Value(email_optin_ui.legal_text()));
- get_more_data.GetList().push_back(std::move(data));
+ get_more_data.Append(std::move(data));
}
return get_more_data;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc
index 8a40f0cbdba..7a9dfa6bb52 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/camera/camera_ui.cc
@@ -37,6 +37,8 @@ content::WebUIDataSource* CreateCameraUIHTMLSource() {
IDR_CAMERA_WEBUI_BROWSER_PROXY);
// Add mojom-lite files under expected paths.
+ source->AddResourcePath("src/js/mojo/camera_intent.mojom-lite.js",
+ IDR_CAMERA_CAMERA_INTENT_MOJOM_LITE_JS);
source->AddResourcePath("src/js/mojo/image_capture.mojom-lite.js",
IDR_CAMERA_IMAGE_CAPTURE_MOJOM_LITE_JS);
source->AddResourcePath("src/js/mojo/camera_common.mojom-lite.js",
diff --git a/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/BUILD.gn b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/BUILD.gn
new file mode 100644
index 00000000000..998e86183ac
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/BUILD.gn
@@ -0,0 +1,11 @@
+# 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("mojo_bindings") {
+ sources = [
+ "crostini_installer.mojom",
+ ]
+}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/OWNERS b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/OWNERS
new file mode 100644
index 00000000000..08850f42120
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/OWNERS
@@ -0,0 +1,2 @@
+per-file *.mojom=set noparent
+per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom
new file mode 100644
index 00000000000..0091ecbc389
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom
@@ -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.
+
+module chromeos.crostini_installer.mojom;
+
+// Lives in the browser process. A renderer uses this to create a page handler
+// for controlling Crostini installation.
+interface PageHandlerFactory {
+ // Create a page handler to control Crostini installation.
+ CreatePageHandler(pending_remote<Page> page,
+ pending_receiver<PageHandler> handler);
+};
+
+// Lives in the browser process. A renderer use this to control Crostini
+// installation.
+interface PageHandler {
+ // Start installation
+ Install();
+ // Cancel an on-going installation
+ Cancel();
+ // If a user cancels the installation without starting it at all, this should
+ // be called so that metrics can be recorded.
+ CancelBeforeStart();
+ // The page normally is displayed in a dialog. Call this to close the dialog.
+ // chrome.send('dialogClose') should not be used, which could kill the page
+ // handler before previous mojom calls have been run.
+ Close();
+};
+
+// Lives in the renderer process. The browser uses this to sends installation
+// updates to the web page in the render.
+interface Page {
+};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc
new file mode 100644
index 00000000000..77020c743d1
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc
@@ -0,0 +1,44 @@
+// 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/crostini_installer/crostini_installer_dialog.h"
+
+#include "chrome/browser/chromeos/crostini/crostini_manager.h"
+#include "chrome/common/webui_url_constants.h"
+
+namespace {
+GURL GetUrl() {
+ return GURL{chrome::kChromeUICrostiniInstallerUrl};
+}
+} // namespace
+
+namespace chromeos {
+
+void CrostiniInstallerDialog::Show(Profile* profile) {
+ DCHECK(crostini::IsCrostiniUIAllowedForProfile(profile));
+ auto* instance = SystemWebDialogDelegate::FindInstance(GetUrl().spec());
+ if (instance) {
+ instance->Focus();
+ return;
+ }
+
+ // TODO(lxj): Move installer status tracking into the CrostiniInstaller.
+ DCHECK(!crostini::CrostiniManager::GetForProfile(profile)
+ ->GetInstallerViewStatus());
+ crostini::CrostiniManager::GetForProfile(profile)->SetInstallerViewStatus(
+ true);
+
+ instance = new CrostiniInstallerDialog(profile);
+ instance->ShowSystemDialog();
+}
+
+CrostiniInstallerDialog::CrostiniInstallerDialog(Profile* profile)
+ : SystemWebDialogDelegate{GetUrl(), /*title=*/{}}, profile_{profile} {}
+
+CrostiniInstallerDialog::~CrostiniInstallerDialog() {
+ crostini::CrostiniManager::GetForProfile(profile_)->SetInstallerViewStatus(
+ false);
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.h b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.h
new file mode 100644
index 00000000000..5c56ffaba34
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.h
@@ -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.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CROSTINI_INSTALLER_CROSTINI_INSTALLER_DIALOG_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CROSTINI_INSTALLER_CROSTINI_INSTALLER_DIALOG_H_
+
+#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
+
+class Profile;
+
+namespace chromeos {
+
+class CrostiniInstallerDialog : public SystemWebDialogDelegate {
+ public:
+ static void Show(Profile* profile);
+
+ private:
+ explicit CrostiniInstallerDialog(Profile* profile);
+ ~CrostiniInstallerDialog() override;
+
+ Profile* profile_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CROSTINI_INSTALLER_CROSTINI_INSTALLER_DIALOG_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc
new file mode 100644
index 00000000000..8b971423ec4
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc
@@ -0,0 +1,64 @@
+// 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/crostini_installer/crostini_installer_page_handler.h"
+
+#include <utility>
+
+#include "base/bind.h"
+#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h"
+
+namespace chromeos {
+
+CrostiniInstallerPageHandler::CrostiniInstallerPageHandler(
+ crostini::CrostiniInstallerUIDelegate* installer_ui_delegate,
+ mojo::PendingReceiver<chromeos::crostini_installer::mojom::PageHandler>
+ pending_page_handler,
+ mojo::PendingRemote<chromeos::crostini_installer::mojom::Page> pending_page,
+ base::OnceClosure close_dialog_callback)
+ : installer_ui_delegate_{installer_ui_delegate},
+ receiver_{this, std::move(pending_page_handler)},
+ page_{std::move(pending_page)},
+ close_dialog_callback_{std::move(close_dialog_callback)} {}
+
+CrostiniInstallerPageHandler::~CrostiniInstallerPageHandler() = default;
+
+void CrostiniInstallerPageHandler::Install() {
+ installer_ui_delegate_->Install(
+ base::BindRepeating(&CrostiniInstallerPageHandler::OnProgressUpdate,
+ weak_ptr_factory_.GetWeakPtr()),
+ base::BindOnce(&CrostiniInstallerPageHandler::OnInstallFinished,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void CrostiniInstallerPageHandler::Cancel() {
+ installer_ui_delegate_->Cancel(
+ base::BindOnce(&CrostiniInstallerPageHandler::OnCanceled,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void CrostiniInstallerPageHandler::CancelBeforeStart() {
+ installer_ui_delegate_->CancelBeforeStart();
+}
+
+void CrostiniInstallerPageHandler::Close() {
+ std::move(close_dialog_callback_).Run();
+}
+
+void CrostiniInstallerPageHandler::OnProgressUpdate(
+ crostini::mojom::InstallerState installer_state,
+ double progress_fraction) {
+ // TODO(lxj)
+}
+
+void CrostiniInstallerPageHandler::OnInstallFinished(
+ crostini::mojom::InstallerError error) {
+ // TODO(lxj)
+}
+
+void CrostiniInstallerPageHandler::OnCanceled() {
+ // TODO(lxj)
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.h b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.h
new file mode 100644
index 00000000000..9060a95057b
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.h
@@ -0,0 +1,60 @@
+// 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_CROSTINI_INSTALLER_CROSTINI_INSTALLER_PAGE_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CROSTINI_INSTALLER_CROSTINI_INSTALLER_PAGE_HANDLER_H_
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/crostini/crostini_installer_types.mojom-forward.h"
+#include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
+
+namespace crostini {
+class CrostiniInstallerUIDelegate;
+} // namespace crostini
+
+namespace chromeos {
+
+class CrostiniInstallerPageHandler
+ : public chromeos::crostini_installer::mojom::PageHandler {
+ public:
+ CrostiniInstallerPageHandler(
+ crostini::CrostiniInstallerUIDelegate* installer_ui_delegate,
+ mojo::PendingReceiver<chromeos::crostini_installer::mojom::PageHandler>
+ pending_page_handler,
+ mojo::PendingRemote<chromeos::crostini_installer::mojom::Page>
+ pending_page,
+ base::OnceClosure close_dialog_callback);
+ ~CrostiniInstallerPageHandler() override;
+
+ // chromeos::crostini_installer::mojom::PageHandler:
+ void Install() override;
+ void Cancel() override;
+ void CancelBeforeStart() override;
+ void Close() override;
+
+ private:
+ void OnProgressUpdate(crostini::mojom::InstallerState installer_state,
+ double progress_fraction);
+ void OnInstallFinished(crostini::mojom::InstallerError error);
+ void OnCanceled();
+
+ crostini::CrostiniInstallerUIDelegate* installer_ui_delegate_;
+ mojo::Receiver<chromeos::crostini_installer::mojom::PageHandler> receiver_;
+ mojo::Remote<chromeos::crostini_installer::mojom::Page> page_;
+ base::OnceClosure close_dialog_callback_;
+
+ base::WeakPtrFactory<CrostiniInstallerPageHandler> weak_ptr_factory_{this};
+
+ DISALLOW_COPY_AND_ASSIGN(CrostiniInstallerPageHandler);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CROSTINI_INSTALLER_CROSTINI_INSTALLER_PAGE_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc
new file mode 100644
index 00000000000..02fe92c3d9a
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc
@@ -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.
+
+#include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.h"
+
+#include <utility>
+
+#include "base/bind.h"
+#include "chrome/browser/chromeos/crostini/crostini_installer.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.h"
+#include "chrome/common/webui_url_constants.h"
+#include "chrome/grit/browser_resources.h"
+#include "chromeos/constants/chromeos_features.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "ui/web_dialogs/web_dialog_ui.h"
+#include "ui/webui/mojo_web_ui_controller.h"
+
+namespace chromeos {
+
+bool CrostiniInstallerUI::IsEnabled() {
+ return base::FeatureList::IsEnabled(
+ chromeos::features::kCrostiniWebUIInstaller);
+}
+
+CrostiniInstallerUI::CrostiniInstallerUI(content::WebUI* web_ui)
+ : ui::MojoWebDialogUI{web_ui} {
+ // TODO(lxj): We might want to make sure there is only one instance of this
+ // class.
+
+ content::WebUIDataSource* source =
+ content::WebUIDataSource::Create(chrome::kChromeUICrostiniInstallerHost);
+
+ source->AddResourcePath("app.js", IDR_CROSTINI_INSTALLER_APP_JS);
+ source->AddResourcePath("browser_proxy.js",
+ IDR_CROSTINI_INSTALLER_BROWSER_PROXY_JS);
+ source->AddResourcePath("crostini_installer.mojom-lite.js",
+ IDR_CROSTINI_INSTALLER_MOJO_LITE_JS);
+ source->SetDefaultResource(IDR_CROSTINI_INSTALLER_INDEX_HTML);
+ content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
+
+ AddHandlerToRegistry(base::BindRepeating(
+ &CrostiniInstallerUI::BindPageHandlerFactory, base::Unretained(this)));
+}
+
+CrostiniInstallerUI::~CrostiniInstallerUI() = default;
+
+void CrostiniInstallerUI::BindPageHandlerFactory(
+ mojo::PendingReceiver<
+ chromeos::crostini_installer::mojom::PageHandlerFactory>
+ pending_receiver) {
+ if (page_factory_receiver_.is_bound()) {
+ page_factory_receiver_.reset();
+ }
+
+ page_factory_receiver_.Bind(std::move(pending_receiver));
+}
+
+void CrostiniInstallerUI::CreatePageHandler(
+ mojo::PendingRemote<chromeos::crostini_installer::mojom::Page> pending_page,
+ mojo::PendingReceiver<chromeos::crostini_installer::mojom::PageHandler>
+ pending_page_handler) {
+ DCHECK(pending_page.is_valid());
+
+ page_handler_ = std::make_unique<CrostiniInstallerPageHandler>(
+ crostini::CrostiniInstaller::GetForProfile(Profile::FromWebUI(web_ui())),
+ std::move(pending_page_handler), std::move(pending_page),
+ // Using Unretained(this) because |page_handler_| will not out-live
+ // |this|.
+ //
+ // CloseDialog() is a no-op if we are not in a dialog (e.g. user
+ // access the page using the URL directly, which is not supported).
+ base::BindOnce(&CrostiniInstallerUI::CloseDialog, base::Unretained(this),
+ nullptr));
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.h b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.h
new file mode 100644
index 00000000000..2e5d81d5dd9
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.h
@@ -0,0 +1,51 @@
+// 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_CROSTINI_INSTALLER_CROSTINI_INSTALLER_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CROSTINI_INSTALLER_CROSTINI_INSTALLER_UI_H_
+
+#include "base/macros.h"
+#include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "ui/web_dialogs/web_dialog_ui.h"
+
+namespace chromeos {
+
+class CrostiniInstallerPageHandler;
+
+// The WebUI for chrome://crostini-installer
+class CrostiniInstallerUI
+ : public ui::MojoWebDialogUI,
+ public chromeos::crostini_installer::mojom::PageHandlerFactory {
+ public:
+ static bool IsEnabled();
+
+ explicit CrostiniInstallerUI(content::WebUI* web_ui);
+ ~CrostiniInstallerUI() override;
+
+ private:
+ void BindPageHandlerFactory(
+ mojo::PendingReceiver<
+ chromeos::crostini_installer::mojom::PageHandlerFactory>
+ pending_receiver);
+
+ // chromeos::crostini_installer::mojom::PageHandlerFactory:
+ void CreatePageHandler(
+ mojo::PendingRemote<chromeos::crostini_installer::mojom::Page>
+ pending_page,
+ mojo::PendingReceiver<chromeos::crostini_installer::mojom::PageHandler>
+ pending_page_handler) override;
+
+ std::unique_ptr<CrostiniInstallerPageHandler> page_handler_;
+ mojo::Receiver<chromeos::crostini_installer::mojom::PageHandlerFactory>
+ page_factory_receiver_{this};
+
+ DISALLOW_COPY_AND_ASSIGN(CrostiniInstallerUI);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CROSTINI_INSTALLER_CROSTINI_INSTALLER_UI_H_
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 686d55faf55..857d5816fdf 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
@@ -29,7 +29,6 @@
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/threading/sequenced_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/debug_info_collector.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
@@ -43,13 +42,9 @@
#include "chromeos/constants/chromeos_features.h"
#include "components/download/content/public/all_download_item_notifier.h"
#include "components/download/public/common/download_item.h"
-#include "components/drive/drive.pb.h"
-#include "components/drive/drive_api_util.h"
#include "components/drive/drive_notification_manager.h"
#include "components/drive/drive_pref_names.h"
#include "components/drive/event_logger.h"
-#include "components/drive/job_list.h"
-#include "components/drive/service/drive_service_interface.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@@ -152,74 +147,6 @@ std::pair<base::ListValue, base::DictionaryValue> GetGCacheContents(
return result;
}
-// Formats |entry| into text.
-std::string FormatEntry(const base::FilePath& path,
- const drive::ResourceEntry& entry) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- using base::StringAppendF;
-
- std::string out;
- StringAppendF(&out, "%s\n", path.AsUTF8Unsafe().c_str());
- StringAppendF(&out, " title: %s\n", entry.title().c_str());
- StringAppendF(&out, " local_id: %s\n", entry.local_id().c_str());
- StringAppendF(&out, " resource_id: %s\n", entry.resource_id().c_str());
- StringAppendF(&out, " parent_local_id: %s\n",
- entry.parent_local_id().c_str());
- StringAppendF(&out, " shared: %s\n", entry.shared() ? "true" : "false");
- StringAppendF(&out, " shared_with_me: %s\n",
- entry.shared_with_me() ? "true" : "false");
- StringAppendF(&out, " alternate_url: %s\n", entry.alternate_url().c_str());
-
- const drive::PlatformFileInfoProto& file_info = entry.file_info();
- StringAppendF(&out, " file_info\n");
- StringAppendF(&out, " size: %" PRId64 "\n", file_info.size());
- StringAppendF(&out, " is_directory: %d\n", file_info.is_directory());
- StringAppendF(&out, " is_symbolic_link: %d\n",
- file_info.is_symbolic_link());
-
- const base::Time last_modified = base::Time::FromInternalValue(
- file_info.last_modified());
- const base::Time last_modified_by_me =
- base::Time::FromInternalValue(entry.last_modified_by_me());
- const base::Time last_accessed = base::Time::FromInternalValue(
- file_info.last_accessed());
- const base::Time creation_time = base::Time::FromInternalValue(
- file_info.creation_time());
- StringAppendF(&out, " last_modified: %s\n",
- google_apis::util::FormatTimeAsString(last_modified).c_str());
- StringAppendF(
- &out, " last_modified_by_me: %s\n",
- google_apis::util::FormatTimeAsString(last_modified_by_me).c_str());
- StringAppendF(&out, " last_accessed: %s\n",
- google_apis::util::FormatTimeAsString(last_accessed).c_str());
- StringAppendF(&out, " creation_time: %s\n",
- google_apis::util::FormatTimeAsString(creation_time).c_str());
-
- if (entry.has_file_specific_info()) {
- const drive::FileSpecificInfo& file_specific_info =
- entry.file_specific_info();
- StringAppendF(&out, " content_mime_type: %s\n",
- file_specific_info.content_mime_type().c_str());
- StringAppendF(&out, " file_md5: %s\n",
- file_specific_info.md5().c_str());
- StringAppendF(&out, " document_extension: %s\n",
- file_specific_info.document_extension().c_str());
- StringAppendF(&out, " is_hosted_document: %d\n",
- file_specific_info.is_hosted_document());
- }
-
- if (entry.has_directory_specific_info()) {
- StringAppendF(&out, " directory_info\n");
- const drive::DirectorySpecificInfo& directory_specific_info =
- entry.directory_specific_info();
- StringAppendF(&out, " changestamp: %" PRId64 "\n",
- directory_specific_info.changestamp());
- }
-
- return out;
-}
-
// Appends {'key': key, 'value': value, 'class': clazz} dictionary to the
// |list|.
void AppendKeyValue(base::ListValue* list,
@@ -231,7 +158,7 @@ void AppendKeyValue(base::ListValue* list,
dict->SetKey(kValue, base::Value(std::move(value)));
if (!clazz.empty())
dict->SetKey(kClass, base::Value(std::move(clazz)));
- list->GetList().push_back(std::move(*dict));
+ list->Append(std::move(*dict));
}
ino_t GetInodeValue(const base::FilePath& path) {
@@ -335,22 +262,10 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
base::BindRepeating(&DriveInternalsWebUIHandler::OnPeriodicUpdate,
weak_ptr_factory_.GetWeakPtr()));
web_ui()->RegisterMessageCallback(
- "clearAccessToken",
- base::BindRepeating(&DriveInternalsWebUIHandler::ClearAccessToken,
- weak_ptr_factory_.GetWeakPtr()));
- web_ui()->RegisterMessageCallback(
- "clearRefreshToken",
- base::BindRepeating(&DriveInternalsWebUIHandler::ClearRefreshToken,
- weak_ptr_factory_.GetWeakPtr()));
- web_ui()->RegisterMessageCallback(
"resetDriveFileSystem",
base::BindRepeating(&DriveInternalsWebUIHandler::ResetDriveFileSystem,
weak_ptr_factory_.GetWeakPtr()));
web_ui()->RegisterMessageCallback(
- "listFileEntries",
- base::BindRepeating(&DriveInternalsWebUIHandler::ListFileEntries,
- weak_ptr_factory_.GetWeakPtr()));
- web_ui()->RegisterMessageCallback(
"zipLogs",
base::BindRepeating(&DriveInternalsWebUIHandler::ZipDriveFsLogs,
weak_ptr_factory_.GetWeakPtr()));
@@ -441,224 +356,23 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
drive_notification_manager
? drive_notification_manager->push_notification_enabled()
: false);
- auto* drive_service = GetDriveService();
- if (drive_service) {
- connection_status.SetBoolean("has-refresh-token",
- drive_service->HasRefreshToken());
- connection_status.SetBoolean("has-access-token",
- drive_service->HasAccessToken());
- }
MaybeCallJavascript("updateConnectionStatus", std::move(connection_status));
}
void UpdateAboutResourceSection() {
- if (IsDriveFsEnabled()) {
- // TODO(crbug.com/896123): Maybe worth implementing.
- SetSectionEnabled("account-information-section", false);
- return;
- }
-
- SetSectionEnabled("account-information-section", true);
- auto* drive_service = GetDriveService();
- if (drive_service) {
- drive_service->GetAboutResource(
- base::Bind(&DriveInternalsWebUIHandler::OnGetAboutResource,
- weak_ptr_factory_.GetWeakPtr()));
- }
- }
-
- // Called when GetAboutResource() call to DriveService is complete.
- void OnGetAboutResource(
- google_apis::DriveApiErrorCode status,
- std::unique_ptr<google_apis::AboutResource> about_resource) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- if (status != google_apis::HTTP_SUCCESS) {
- LOG(ERROR) << "Failed to get about resource";
- return;
- }
- DCHECK(about_resource);
-
- base::DictionaryValue data;
- data.SetDouble("account-quota-total", about_resource->quota_bytes_total());
- data.SetDouble("account-quota-used",
- about_resource->quota_bytes_used_aggregate());
- data.SetDouble("account-largest-changestamp-remote",
- about_resource->largest_change_id());
- data.SetString("root-resource-id", about_resource->root_folder_id());
-
- MaybeCallJavascript("updateAboutResource", std::move(data));
+ // TODO(crbug.com/896123): Maybe worth implementing.
+ SetSectionEnabled("account-information-section", false);
}
void UpdateDeltaUpdateStatusSection() {
- if (IsDriveFsEnabled()) {
- // TODO(crbug.com/896123): Maybe worth implementing.
- SetSectionEnabled("delta-update-status-section", false);
- return;
- }
-
- SetSectionEnabled("delta-update-status-section", true);
- auto* debug_info_collector = GetDebugInfoCollector();
- if (debug_info_collector) {
- debug_info_collector->GetMetadata(base::Bind(
- &DriveInternalsWebUIHandler::OnGetFilesystemMetadataForDeltaUpdate,
- weak_ptr_factory_.GetWeakPtr()));
- }
- }
-
- // Callback for DebugInfoCollector::GetMetadata for delta update.
- void OnGetFilesystemMetadataForDeltaUpdate(
- const drive::FileSystemMetadata& metadata,
- const std::map<std::string, drive::FileSystemMetadata>&
- team_drive_metadata) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- auto items = std::make_unique<base::ListValue>();
- // Users default corpus first.
- auto app_data = std::make_unique<base::DictionaryValue>();
- app_data->SetString("id", "default corpus");
- app_data->SetString("root_entry_path", metadata.path);
- app_data->SetString("start_page_token", metadata.start_page_token);
- app_data->SetString("last_check_time",
- google_apis::util::FormatTimeAsStringLocaltime(
- metadata.last_update_check_time));
- app_data->SetString(
- "last_check_result",
- drive::FileErrorToString(metadata.last_update_check_error));
- app_data->SetString("refreshing", metadata.refreshing ? "Yes" : "No");
-
- items->Append(std::move(app_data));
-
- for (const auto& team_drive : team_drive_metadata) {
- app_data = std::make_unique<base::DictionaryValue>();
- app_data->SetString("id", team_drive.first);
- app_data->SetString("root_entry_path", team_drive.second.path);
- app_data->SetString("start_page_token",
- team_drive.second.start_page_token);
- app_data->SetString("last_check_time",
- google_apis::util::FormatTimeAsStringLocaltime(
- team_drive.second.last_update_check_time));
- app_data->SetString(
- "last_check_result",
- drive::FileErrorToString(team_drive.second.last_update_check_error));
- app_data->SetString("refreshing",
- team_drive.second.refreshing ? "Yes" : "No");
- items->Append(std::move(app_data));
- }
-
- base::DictionaryValue delta_update_status;
- delta_update_status.Set("items", std::move(items));
-
- MaybeCallJavascript("updateDeltaUpdateStatus",
- std::move(delta_update_status));
+ // TODO(crbug.com/896123): Maybe worth implementing.
+ SetSectionEnabled("delta-update-status-section", false);
}
void UpdateInFlightOperationsSection() {
- if (IsDriveFsEnabled()) {
- // TODO(crbug.com/896123): Maybe worth implementing.
- SetSectionEnabled("in-flight-operations-section", false);
- return;
- }
-
- SetSectionEnabled("in-flight-operations-section", true);
- auto* integration_service = GetIntegrationService();
- if (!integration_service)
- return;
- drive::JobListInterface* job_list = integration_service->job_list();
- if (!job_list)
- return;
- std::vector<drive::JobInfo> info_list = job_list->GetJobInfoList();
-
- base::ListValue in_flight_operations;
- for (size_t i = 0; i < info_list.size(); ++i) {
- const drive::JobInfo& info = info_list[i];
-
- auto dict = std::make_unique<base::DictionaryValue>();
- dict->SetInteger("id", info.job_id);
- dict->SetString("type", drive::JobTypeToString(info.job_type));
- dict->SetString("file_path", info.file_path.AsUTF8Unsafe());
- dict->SetString("state", drive::JobStateToString(info.state));
- dict->SetDouble("progress_current", info.num_completed_bytes);
- dict->SetDouble("progress_total", info.num_total_bytes);
- in_flight_operations.Append(std::move(dict));
- }
-
- MaybeCallJavascript("updateInFlightOperations",
- std::move(in_flight_operations));
- }
-
- void UpdateFileSystemContentsSection() {
- if (IsDriveFsEnabled()) {
- SetSectionEnabled("file-system-contents-section", false);
- return;
- }
-
- SetSectionEnabled("file-system-contents-section", true);
- drive::DebugInfoCollector* debug_info_collector = GetDebugInfoCollector();
- if (!debug_info_collector)
- return;
-
- // Start rendering the file system tree as text.
- const base::FilePath root_path = drive::util::GetDriveGrandRootPath();
-
- debug_info_collector->GetResourceEntry(
- root_path,
- base::BindOnce(&DriveInternalsWebUIHandler::OnGetResourceEntryByPath,
- weak_ptr_factory_.GetWeakPtr(), root_path));
-
- debug_info_collector->ReadDirectory(
- root_path,
- base::Bind(&DriveInternalsWebUIHandler::OnReadDirectoryByPath,
- weak_ptr_factory_.GetWeakPtr(), root_path));
- }
-
- // Called when GetResourceEntryByPath() is complete.
- void OnGetResourceEntryByPath(const base::FilePath& path,
- drive::FileError error,
- std::unique_ptr<drive::ResourceEntry> entry) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- if (error == drive::FILE_ERROR_OK) {
- DCHECK(entry.get());
- MaybeCallJavascript("updateFileSystemContents",
- base::Value(FormatEntry(path, *entry) + "\n"));
- }
- }
-
- // Called when ReadDirectoryByPath() is complete.
- void OnReadDirectoryByPath(
- const base::FilePath& parent_path,
- drive::FileError error,
- std::unique_ptr<drive::ResourceEntryVector> entries) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- if (error == drive::FILE_ERROR_OK) {
- DCHECK(entries.get());
-
- drive::DebugInfoCollector* debug_info_collector = GetDebugInfoCollector();
- std::string file_system_as_text;
- for (size_t i = 0; i < entries->size(); ++i) {
- const drive::ResourceEntry& entry = (*entries)[i];
- const base::FilePath current_path = parent_path.Append(
- base::FilePath::FromUTF8Unsafe(entry.base_name()));
-
- file_system_as_text.append(FormatEntry(current_path, entry) + "\n");
-
- if (entry.file_info().is_directory()) {
- debug_info_collector->ReadDirectory(
- current_path,
- base::Bind(&DriveInternalsWebUIHandler::OnReadDirectoryByPath,
- weak_ptr_factory_.GetWeakPtr(), current_path));
- }
- }
-
- // There may be pending ReadDirectoryByPath() calls, but we can update
- // the page with what we have now. This results in progressive
- // updates, which is good for a large file system.
- MaybeCallJavascript("updateFileSystemContents",
- base::Value(file_system_as_text));
- }
+ // TODO(crbug.com/896123): Maybe worth implementing.
+ SetSectionEnabled("in-flight-operations-section", false);
}
void UpdatePathConfigurationsSection() {
@@ -727,8 +441,6 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
PrefService* pref_service = profile()->GetPrefs();
base::ListValue preferences;
- AppendKeyValue(&preferences, "DriveFS",
- IsDriveFsEnabled() ? "true" : "false");
for (size_t i = 0; i < base::size(kDriveRelatedPreferences); ++i) {
const std::string key = kDriveRelatedPreferences[i];
// As of now, all preferences are boolean.
@@ -772,10 +484,6 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
}
void UpdateServiceLogSection() {
- if (!IsDriveFsEnabled()) {
- SetSectionEnabled("service-log-section", false);
- return;
- }
SetSectionEnabled("service-log-section", true);
if (service_log_file_is_processing_)
@@ -818,36 +526,8 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
}
void UpdateCacheContentsSection() {
- if (IsDriveFsEnabled()) {
- // TODO(crbug.com/896123): Maybe worth implementing.
- SetSectionEnabled("cache-contents-section", false);
- return;
- }
- SetSectionEnabled("cache-contents-section", true);
-
- auto* debug_info_collector = GetDebugInfoCollector();
- if (debug_info_collector) {
- debug_info_collector->IterateFileCache(
- base::Bind(&DriveInternalsWebUIHandler::OnUpdateCacheEntry,
- weak_ptr_factory_.GetWeakPtr()),
- base::DoNothing());
- }
- }
-
- // Called as the iterator for DebugInfoCollector::IterateFileCache().
- void OnUpdateCacheEntry(const std::string& local_id,
- const drive::FileCacheEntry& cache_entry) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- // Convert |cache_entry| into a dictionary.
- base::DictionaryValue value;
- value.SetString("local_id", local_id);
- value.SetString("md5", cache_entry.md5());
- value.SetBoolean("is_present", cache_entry.is_present());
- value.SetBoolean("is_pinned", cache_entry.is_pinned());
- value.SetBoolean("is_dirty", cache_entry.is_dirty());
-
- MaybeCallJavascript("updateCacheContents", std::move(value));
+ // TODO(crbug.com/896123): Maybe worth implementing.
+ SetSectionEnabled("cache-contents-section", false);
}
void UpdateGCacheContentsSection() {
@@ -873,24 +553,6 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
}
// Called when the corresponding button on the page is pressed.
- void ClearAccessToken(const base::ListValue* args) {
- AllowJavascript();
-
- drive::DriveServiceInterface* drive_service = GetDriveService();
- if (drive_service)
- drive_service->ClearAccessToken();
- }
-
- // Called when the corresponding button on the page is pressed.
- void ClearRefreshToken(const base::ListValue* args) {
- AllowJavascript();
-
- drive::DriveServiceInterface* drive_service = GetDriveService();
- if (drive_service)
- drive_service->ClearRefreshToken();
- }
-
- // Called when the corresponding button on the page is pressed.
void ResetDriveFileSystem(const base::ListValue* args) {
AllowJavascript();
@@ -903,13 +565,6 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
}
}
- // Called when the corresponding button on the page is pressed.
- void ListFileEntries(const base::ListValue* args) {
- AllowJavascript();
-
- UpdateFileSystemContentsSection();
- }
-
void ZipDriveFsLogs(const base::ListValue* args) {
AllowJavascript();
@@ -941,24 +596,6 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
return service;
}
- // Returns a DriveService instance.
- drive::DriveServiceInterface* GetDriveService() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- return drive::util::GetDriveServiceByProfile(profile());
- }
-
- // Returns a DebugInfoCollector instance.
- drive::DebugInfoCollector* GetDebugInfoCollector() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- drive::DriveIntegrationService* service = GetIntegrationService();
- return service ? service->debug_info_collector() : NULL;
- }
-
- // Whether DriveFS is enabled.
- bool IsDriveFsEnabled() {
- return base::FeatureList::IsEnabled(chromeos::features::kDriveFs);
- }
-
// The last event sent to the JavaScript side.
int last_sent_event_id_;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc
index 46afde2fa0d..92020cd21ff 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/first_run/first_run_handler.cc
@@ -6,7 +6,6 @@
#include <utility>
-#include "ash/public/mojom/voice_interaction_controller.mojom.h"
#include "base/bind.h"
#include "base/values.h"
#include "chrome/browser/chromeos/assistant/assistant_util.h"
diff --git a/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc
index 4d8cca34874..d341aac11e6 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/chromeos/internet_config_dialog.h"
+#include "ash/public/cpp/network_config_service.h"
#include "base/json/json_writer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.h"
@@ -14,6 +15,7 @@
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_util.h"
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
@@ -136,7 +138,7 @@ std::string InternetConfigDialog::GetDialogArgs() const {
// InternetConfigDialogUI
InternetConfigDialogUI::InternetConfigDialogUI(content::WebUI* web_ui)
- : ui::WebDialogUI(web_ui) {
+ : ui::MojoWebDialogUI(web_ui) {
content::WebUIDataSource* source = content::WebUIDataSource::Create(
chrome::kChromeUIInternetConfigDialogHost);
@@ -153,8 +155,18 @@ InternetConfigDialogUI::InternetConfigDialogUI(content::WebUI* web_ui)
#endif
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
+
+ // Add Mojo bindings to this WebUI so that Mojo calls can occur in JavaScript.
+ AddHandlerToRegistry(base::BindRepeating(
+ &InternetConfigDialogUI::BindCrosNetworkConfig, base::Unretained(this)));
}
InternetConfigDialogUI::~InternetConfigDialogUI() {}
+void InternetConfigDialogUI::BindCrosNetworkConfig(
+ mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig>
+ receiver) {
+ ash::GetNetworkConfigService(std::move(receiver));
+}
+
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.h b/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.h
index 848254eba3c..a95f0f75897 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/internet_config_dialog.h
@@ -8,8 +8,9 @@
#include <string>
#include "base/macros.h"
-#include "base/strings/string16.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h" // nogncheck
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/web_dialogs/web_dialog_ui.h"
namespace chromeos {
@@ -49,12 +50,16 @@ class InternetConfigDialog : public SystemWebDialogDelegate {
// A WebUI to host the network configuration UI in a dialog, used in the
// login screen and when a new network is configured from the system tray.
-class InternetConfigDialogUI : public ui::WebDialogUI {
+class InternetConfigDialogUI : public ui::MojoWebDialogUI {
public:
explicit InternetConfigDialogUI(content::WebUI* web_ui);
~InternetConfigDialogUI() override;
private:
+ void BindCrosNetworkConfig(
+ mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig>
+ receiver);
+
DISALLOW_COPY_AND_ASSIGN(InternetConfigDialogUI);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc
index 2489cb2e124..02ea2ac9977 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.cc
@@ -17,6 +17,7 @@
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_util.h"
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
@@ -45,6 +46,7 @@ void AddInternetStrings(content::WebUIDataSource* html_source) {
{"close", IDS_CLOSE},
{"networkButtonConnect", IDS_SETTINGS_INTERNET_BUTTON_CONNECT},
{"networkButtonDisconnect", IDS_SETTINGS_INTERNET_BUTTON_DISCONNECT},
+ {"networkButtonForget", IDS_SETTINGS_INTERNET_BUTTON_FORGET},
{"networkIPAddress", IDS_SETTINGS_INTERNET_NETWORK_IP_ADDRESS},
{"networkSectionNetwork", IDS_SETTINGS_INTERNET_NETWORK_SECTION_NETWORK},
{"networkSectionProxy", IDS_SETTINGS_INTERNET_NETWORK_SECTION_PROXY},
@@ -160,8 +162,9 @@ InternetDetailDialogUI::InternetDetailDialogUI(content::WebUI* web_ui)
InternetDetailDialogUI::~InternetDetailDialogUI() {}
void InternetDetailDialogUI::BindCrosNetworkConfig(
- chromeos::network_config::mojom::CrosNetworkConfigRequest request) {
- ash::GetNetworkConfigService(std::move(request));
+ mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig>
+ receiver) {
+ ash::GetNetworkConfigService(std::move(receiver));
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.h b/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.h
index eec6c4d9a98..fe91980b879 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/internet_detail_dialog.h
@@ -7,7 +7,8 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
-#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h" // nogncheck
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/web_dialogs/web_dialog_ui.h"
namespace chromeos {
@@ -51,7 +52,8 @@ class InternetDetailDialogUI : public ui::MojoWebDialogUI {
private:
void BindCrosNetworkConfig(
- chromeos::network_config::mojom::CrosNetworkConfigRequest request);
+ mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig>
+ receiver);
DISALLOW_COPY_AND_ASSIGN(InternetDetailDialogUI);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS b/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS
index a18954dc038..5dbb46f035d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/OWNERS
@@ -1,10 +1,10 @@
-# (in PST)
+# primary (in CET)
+antrim@chromium.org
+rsorokin@chromium.org
+
+# secondary (in PST)
achuith@chromium.org
alemate@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/assistant_optin_flow_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc
index f53cede13a4..6979bd6f555 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
@@ -56,28 +56,25 @@ AssistantOptInFlowScreenHandler::AssistantOptInFlowScreenHandler(
AssistantOptInFlowScreenHandler::~AssistantOptInFlowScreenHandler() {
if (client_binding_)
StopSpeakerIdEnrollment();
- if (arc::VoiceInteractionControllerClient::Get()) {
- arc::VoiceInteractionControllerClient::Get()->RemoveObserver(this);
- }
- if (screen_) {
+ if (ash::AssistantState::Get())
+ ash::AssistantState::Get()->RemoveObserver(this);
+ if (screen_)
screen_->OnViewDestroyed(this);
- }
}
void AssistantOptInFlowScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
builder->Add("locale", g_browser_process->GetApplicationLocale());
- builder->Add("assistantLogo", IDS_VOICE_INTERACTION_LOGO);
- builder->Add("assistantOptinLoading",
- IDS_VOICE_INTERACTION_VALUE_PROP_LOADING);
+ builder->Add("assistantLogo", IDS_ASSISTANT_LOGO);
+ builder->Add("assistantOptinLoading", IDS_ASSISTANT_VALUE_PROP_LOADING);
builder->Add("assistantOptinLoadErrorTitle",
- IDS_VOICE_INTERACTION_VALUE_PROP_LOAD_ERROR_TITLE);
+ IDS_ASSISTANT_VALUE_PROP_LOAD_ERROR_TITLE);
builder->Add("assistantOptinLoadErrorMessage",
- IDS_VOICE_INTERACTION_VALUE_PROP_LOAD_ERROR_MESSAGE);
+ IDS_ASSISTANT_VALUE_PROP_LOAD_ERROR_MESSAGE);
builder->Add("assistantOptinSkipButton",
- IDS_VOICE_INTERACTION_VALUE_PROP_SKIP_BUTTON);
+ IDS_ASSISTANT_VALUE_PROP_SKIP_BUTTON);
builder->Add("assistantOptinRetryButton",
- IDS_VOICE_INTERACTION_VALUE_PROP_RETRY_BUTTON);
+ IDS_ASSISTANT_VALUE_PROP_RETRY_BUTTON);
builder->Add("assistantVoiceMatchTitle", IDS_ASSISTANT_VOICE_MATCH_TITLE);
builder->Add("assistantVoiceMatchMessage", IDS_ASSISTANT_VOICE_MATCH_MESSAGE);
builder->Add("assistantVoiceMatchNoDspMessage",
@@ -149,6 +146,14 @@ void AssistantOptInFlowScreenHandler::RegisterMessages() {
&AssistantOptInFlowScreenHandler::HandleFlowInitialized);
}
+void AssistantOptInFlowScreenHandler::GetAdditionalParameters(
+ base::DictionaryValue* dict) {
+ dict->SetBoolean("hotwordDspAvailable", chromeos::IsHotwordDspAvailable());
+ dict->SetBoolean("voiceMatchDisabled",
+ chromeos::assistant::features::IsVoiceMatchDisabled());
+ BaseScreenHandler::GetAdditionalParameters(dict);
+}
+
void AssistantOptInFlowScreenHandler::Bind(AssistantOptInFlowScreen* screen) {
BaseScreenHandler::SetBaseScreen(screen);
screen_ = screen;
@@ -218,9 +223,9 @@ void AssistantOptInFlowScreenHandler::SetupAssistantConnection() {
// Make sure enable Assistant service since we need it during the flow.
prefs->SetBoolean(chromeos::assistant::prefs::kAssistantEnabled, true);
- if (arc::VoiceInteractionControllerClient::Get()->voice_interaction_state() ==
- ash::mojom::VoiceInteractionState::NOT_READY) {
- arc::VoiceInteractionControllerClient::Get()->AddObserver(this);
+ if (ash::AssistantState::Get()->assistant_state() ==
+ ash::mojom::AssistantState::NOT_READY) {
+ ash::AssistantState::Get()->AddObserver(this);
} else {
BindAssistantSettingsManager();
}
@@ -272,11 +277,11 @@ void AssistantOptInFlowScreenHandler::OnDialogClosed() {
}
}
-void AssistantOptInFlowScreenHandler::OnStateChanged(
- ash::mojom::VoiceInteractionState state) {
- if (state != ash::mojom::VoiceInteractionState::NOT_READY) {
+void AssistantOptInFlowScreenHandler::OnAssistantStatusChanged(
+ ash::mojom::AssistantState state) {
+ if (state != ash::mojom::AssistantState::NOT_READY) {
BindAssistantSettingsManager();
- arc::VoiceInteractionControllerClient::Get()->RemoveObserver(this);
+ ash::AssistantState::Get()->RemoveObserver(this);
}
}
@@ -326,6 +331,14 @@ void AssistantOptInFlowScreenHandler::OnGetSettingsResponse(
UMA_HISTOGRAM_TIMES("Assistant.OptInFlow.GetSettingsRequestTime",
time_since_request_sent);
+ if (ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean(
+ assistant::prefs::kAssistantDisabledByPolicy)) {
+ DVLOG(1) << "Assistant is disabled by domain policy. Skip Assistant "
+ "opt-in flow.";
+ HandleFlowFinished();
+ return;
+ }
+
assistant::SettingsUi settings_ui;
if (!settings_ui.ParseFromString(settings)) {
LOG(ERROR) << "Failed to parse get settings response.";
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h
index 9810c088aea..a04c19835e1 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.h
@@ -9,8 +9,8 @@
#include <string>
#include "ash/public/cpp/assistant/assistant_setup.h"
+#include "ash/public/cpp/assistant/assistant_state.h"
#include "base/macros.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chromeos/services/assistant/public/mojom/settings.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
@@ -43,7 +43,7 @@ class AssistantOptInFlowScreenView {
class AssistantOptInFlowScreenHandler
: public BaseScreenHandler,
public AssistantOptInFlowScreenView,
- public arc::VoiceInteractionControllerClient::Observer,
+ public ash::AssistantStateObserver,
assistant::mojom::SpeakerIdEnrollmentClient {
public:
using TView = AssistantOptInFlowScreenView;
@@ -63,6 +63,7 @@ class AssistantOptInFlowScreenHandler
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
void RegisterMessages() override;
+ void GetAdditionalParameters(base::DictionaryValue* dict) override;
// AssistantOptInFlowScreenView:
void Bind(AssistantOptInFlowScreen* screen) override;
@@ -93,8 +94,8 @@ class AssistantOptInFlowScreenHandler
// BaseScreenHandler:
void Initialize() override;
- // arc::VoiceInteractionControllerClient::Observer overrides
- void OnStateChanged(ash::mojom::VoiceInteractionState state) override;
+ // ash::AssistantStateObserver:
+ void OnAssistantStatusChanged(ash::mojom::AssistantState state) override;
// Connect to assistant settings manager.
void BindAssistantSettingsManager();
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 5474107730b..63c4d1cc21c 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
@@ -8,6 +8,7 @@
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/event_rewriter_controller.h"
+#include "ash/public/cpp/shelf_config.h"
#include "ash/public/cpp/tablet_mode.h"
#include "ash/public/mojom/constants.mojom.h"
#include "ash/shell.h"
@@ -16,6 +17,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/chromeos/login/configuration_keys.h"
@@ -44,6 +46,7 @@
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/constants/chromeos_constants.h"
+#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h"
#include "components/login/base_screen_handler_utils.h"
#include "components/login/localized_values_builder.h"
@@ -101,8 +104,8 @@ CoreOobeHandler::CoreOobeHandler(JSCallsContainer* js_calls_container)
// |connector| may be null in tests.
auto* connector = content::GetSystemConnector();
if (connector) {
- connector->BindInterface(ash::mojom::kServiceName,
- &cros_display_config_ptr_);
+ connector->Connect(ash::mojom::kServiceName,
+ cros_display_config_.BindNewPipeAndPassReceiver());
}
OobeConfiguration::Get()->AddAndFireObserver(this);
}
@@ -305,6 +308,10 @@ void CoreOobeHandler::SetClientAreaSize(int width, int height) {
CallJS("cr.ui.Oobe.setClientAreaSize", width, height);
}
+void CoreOobeHandler::SetShelfHeight(int height) {
+ CallJS("cr.ui.Oobe.setShelfHeight", height);
+}
+
void CoreOobeHandler::HandleInitialized() {
GetOobeUI()->InitializeHandlers();
AllowJavascript();
@@ -546,6 +553,26 @@ void CoreOobeHandler::UpdateClientAreaSize() {
const gfx::Size size =
display::Screen::GetScreen()->GetPrimaryDisplay().size();
SetClientAreaSize(size.width(), size.height());
+ SetShelfHeight(ash::ShelfConfig::Get()->shelf_size());
+}
+
+void CoreOobeHandler::SetDialogPaddingMode(
+ CoreOobeView::DialogPaddingMode mode) {
+ std::string padding;
+ switch (mode) {
+ case CoreOobeView::DialogPaddingMode::MODE_AUTO:
+ padding = "auto";
+ break;
+ case CoreOobeView::DialogPaddingMode::MODE_NARROW:
+ padding = "narrow";
+ break;
+ case CoreOobeView::DialogPaddingMode::MODE_WIDE:
+ padding = "wide";
+ break;
+ default:
+ NOTREACHED();
+ }
+ CallJS("cr.ui.Oobe.setDialogPaddingMode", padding);
}
void CoreOobeHandler::OnOobeConfigurationChanged() {
@@ -586,7 +613,7 @@ void CoreOobeHandler::HandleGetPrimaryDisplayNameForTesting(
const base::Value* callback_id;
CHECK(args->Get(0, &callback_id));
- cros_display_config_ptr_->GetDisplayUnitInfoList(
+ cros_display_config_->GetDisplayUnitInfoList(
false /* single_unified */,
base::BindOnce(&CoreOobeHandler::GetPrimaryDisplayNameCallback,
weak_ptr_factory_.GetWeakPtr(), callback_id->Clone()));
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 8e30d2b5363..0687932d4c3 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
@@ -23,6 +23,7 @@
#include "chrome/browser/chromeos/login/version_info_updater.h"
#include "chrome/browser/chromeos/tpm_firmware_update.h"
#include "chrome/browser/ui/webui/chromeos/login/base_webui_handler.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "ui/events/event_source.h"
namespace base {
@@ -38,6 +39,17 @@ namespace chromeos {
class CoreOobeView {
public:
+ // Enum that specifies how inner padding of OOBE dialog should be calculated.
+ enum class DialogPaddingMode {
+ // Oobe dialog is displayed full screen, padding will be calculated
+ // via css depending on media size.
+ MODE_AUTO,
+ // Oobe dialog have enough free space around and should use wide padding.
+ MODE_WIDE,
+ // Oobe dialog is positioned in limited space and should use narrow padding.
+ MODE_NARROW,
+ };
+
virtual ~CoreOobeView() {}
virtual void ShowSignInError(int login_attempts,
@@ -58,6 +70,8 @@ class CoreOobeView {
virtual void ReloadEulaContent(const base::DictionaryValue& dictionary) = 0;
virtual void SetVirtualKeyboardShown(bool shown) = 0;
virtual void SetClientAreaSize(int width, int height) = 0;
+ virtual void SetShelfHeight(int height) = 0;
+ virtual void SetDialogPaddingMode(DialogPaddingMode mode) = 0;
virtual void ShowDeviceResetScreen() = 0;
virtual void ShowEnableDebuggingScreen() = 0;
virtual void InitDemoModeDetection() = 0;
@@ -137,6 +151,8 @@ class CoreOobeHandler : public BaseWebUIHandler,
void ReloadEulaContent(const base::DictionaryValue& dictionary) override;
void SetVirtualKeyboardShown(bool displayed) override;
void SetClientAreaSize(int width, int height) override;
+ void SetShelfHeight(int height) override;
+ void SetDialogPaddingMode(CoreOobeView::DialogPaddingMode mode) override;
void ShowDeviceResetScreen() override;
void ShowEnableDebuggingScreen() override;
void ShowActiveDirectoryPasswordChangeScreen(
@@ -222,7 +238,7 @@ class CoreOobeHandler : public BaseWebUIHandler,
DemoModeDetector demo_mode_detector_;
- ash::mojom::CrosDisplayConfigControllerPtr cros_display_config_ptr_;
+ mojo::Remote<ash::mojom::CrosDisplayConfigController> cros_display_config_;
base::WeakPtrFactory<CoreOobeHandler> weak_ptr_factory_{this};
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 35e15951f2a..49edf06dc4d 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
@@ -21,7 +21,7 @@
#include "chromeos/constants/chromeos_switches.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/debug_daemon/debug_daemon_client.h"
#include "chromeos/dbus/power/power_manager_client.h"
#include "components/login/localized_values_builder.h"
#include "components/prefs/pref_registry_simple.h"
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 d0fa17ef808..6d632c707cf 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
@@ -42,6 +42,7 @@
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_urls.h"
#include "google_apis/gaia/google_service_auth_error.h"
+#include "services/network/public/mojom/cookie_manager.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/chromeos/devicetype_utils.h"
@@ -154,7 +155,7 @@ base::ListValue GetEncryptionTypesList() {
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));
+ encryption_list.Append(std::move(enc_option));
}
return encryption_list;
}
@@ -649,7 +650,7 @@ void EnrollmentScreenHandler::OnAdConfigurationUnlocked(
custom.SetKey(
"name",
base::Value(l10n_util::GetStringUTF8(IDS_AD_CONFIG_SELECTION_CUSTOM)));
- options->GetList().push_back(std::move(custom));
+ options->Append(std::move(custom));
active_directory_join_type_ =
ActiveDirectoryDomainJoinType::USING_CONFIGURATION;
CallJS("login.OAuthEnrollmentScreen.setAdJoinConfiguration", *options);
@@ -788,11 +789,10 @@ void EnrollmentScreenHandler::HandleCompleteLogin(const std::string& user) {
Profile::FromWebUI(web_ui()));
content::StoragePartition* partition =
signin_partition_manager->GetCurrentStoragePartition();
- net::CookieOptions cookie_options;
- cookie_options.set_include_httponly();
partition->GetCookieManagerForBrowserProcess()->GetCookieList(
- GaiaUrls::GetInstance()->gaia_url(), cookie_options,
+ GaiaUrls::GetInstance()->gaia_url(),
+ net::CookieOptions::MakeAllInclusive(),
base::BindOnce(&EnrollmentScreenHandler::OnGetCookiesForCompleteLogin,
weak_ptr_factory_.GetWeakPtr(), user));
}
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 e15b2103638..bb367ef3de4 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
@@ -80,6 +80,10 @@ void ErrorScreenHandler::SetShowConnectingIndicator(bool value) {
CallJS("login.ErrorMessageScreen.showConnectingIndicator", value);
}
+void ErrorScreenHandler::SetIsPersistentError(bool is_persistent) {
+ CallJS("login.ErrorMessageScreen.setIsPersistentError", is_persistent);
+}
+
void ErrorScreenHandler::SetUIState(NetworkError::UIState ui_state) {
CallJS("login.ErrorMessageScreen.setUIState", static_cast<int>(ui_state));
}
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 67a26958e75..acc425a0bf8 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
@@ -51,6 +51,9 @@ class ErrorScreenView {
// Updates visibility of the label indicating we're reconnecting.
virtual void SetShowConnectingIndicator(bool value) = 0;
+ // Makes error persistent (e.g. non-closable).
+ virtual void SetIsPersistentError(bool is_persistent) = 0;
+
// Sets current UI state of the screen.
virtual void SetUIState(NetworkError::UIState ui_state) = 0;
};
@@ -75,6 +78,7 @@ class ErrorScreenHandler : public BaseScreenHandler, public ErrorScreenView {
void SetGuestSigninAllowed(bool value) override;
void SetOfflineSigninAllowed(bool value) override;
void SetShowConnectingIndicator(bool value) override;
+ void SetIsPersistentError(bool is_persistent) override;
void SetUIState(NetworkError::UIState ui_state) override;
// WebUIMessageHandler:
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.cc
new file mode 100644
index 00000000000..ffbed8d3645
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.cc
@@ -0,0 +1,14 @@
+// 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/fake_update_required_screen_handler.h"
+
+namespace chromeos {
+
+void FakeUpdateRequiredScreenHandler::SetUIState(
+ UpdateRequiredView::UIState ui_state) {
+ ui_state_ = ui_state;
+}
+
+} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_handler.h
new file mode 100644
index 00000000000..7a36649adf7
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/fake_update_required_screen_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_CHROMEOS_LOGIN_FAKE_UPDATE_REQUIRED_SCREEN_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_FAKE_UPDATE_REQUIRED_SCREEN_HANDLER_H_
+
+#include <string>
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "chrome/browser/chromeos/login/screens/update_required_screen.h"
+#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
+#include "chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h"
+
+namespace chromeos {
+
+class UpdateRequiredScreen;
+
+class FakeUpdateRequiredScreenHandler : public UpdateRequiredView {
+ public:
+ FakeUpdateRequiredScreenHandler() = default;
+ ~FakeUpdateRequiredScreenHandler() override {}
+
+ UpdateRequiredView::UIState ui_state() { return ui_state_; }
+
+ private:
+ void Show() override {}
+ void Hide() override {}
+ void Bind(UpdateRequiredScreen* screen) override {}
+ void Unbind() override {}
+
+ void SetIsConnected(bool connected) override {}
+ void SetUpdateProgressUnavailable(bool unavailable) override {}
+ void SetUpdateProgressValue(int progress) override {}
+ void SetUpdateProgressMessage(const base::string16& message) override {}
+ void SetEstimatedTimeLeftVisible(bool visible) override {}
+ void SetEstimatedTimeLeft(int seconds_left) override {}
+ void SetUIState(UpdateRequiredView::UIState ui_state) override;
+
+ UpdateRequiredView::UIState ui_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeUpdateRequiredScreenHandler);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_FAKE_UPDATE_REQUIRED_SCREEN_HANDLER_H_
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 bf674ae60fb..4d4380b17b7 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
@@ -55,11 +55,9 @@ FingerprintSetupScreenHandler::FingerprintSetupScreenHandler(
: BaseScreenHandler(kScreenId, js_calls_container) {
set_user_acted_method_path("login.FingerprintSetupScreen.userActed");
- content::GetSystemConnector()->BindInterface(device::mojom::kServiceName,
- &fp_service_);
- device::mojom::FingerprintObserverPtr observer;
- binding_.Bind(mojo::MakeRequest(&observer));
- fp_service_->AddFingerprintObserver(std::move(observer));
+ content::GetSystemConnector()->Connect(
+ device::mojom::kServiceName, fp_service_.BindNewPipeAndPassReceiver());
+ fp_service_->AddFingerprintObserver(receiver_.BindNewPipeAndPassRemote());
}
FingerprintSetupScreenHandler::~FingerprintSetupScreenHandler() = default;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h
index 8eef6b9764e..8e752278477 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h
@@ -7,7 +7,8 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/mojom/fingerprint.mojom.h"
namespace chromeos {
@@ -75,8 +76,8 @@ class FingerprintSetupScreenHandler
FingerprintSetupScreen* screen_ = nullptr;
- device::mojom::FingerprintPtr fp_service_;
- mojo::Binding<device::mojom::FingerprintObserver> binding_{this};
+ mojo::Remote<device::mojom::Fingerprint> fp_service_;
+ mojo::Receiver<device::mojom::FingerprintObserver> receiver_{this};
int enrolled_finger_count_ = 0;
bool enroll_session_started_ = false;
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 ee389c1f193..da7467ea754 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
@@ -17,6 +17,7 @@
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
+#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/optional.h"
#include "base/stl_util.h"
@@ -26,6 +27,7 @@
#include "base/task/post_task.h"
#include "base/values.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/certificate_provider/certificate_provider_service.h"
#include "chrome/browser/chromeos/certificate_provider/certificate_provider_service_factory.h"
@@ -33,6 +35,7 @@
#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/chromeos/login/lock_screen_utils.h"
#include "chrome/browser/chromeos/login/reauth_stats.h"
+#include "chrome/browser/chromeos/login/saml/public_saml_url_fetcher.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"
@@ -108,6 +111,28 @@ const char kEndpointGen[] = "1.0";
const char kOAUTHCodeCookie[] = "oauth_code";
const char kGAPSCookie[] = "GAPS";
+// Must be kept consistent with ChromeOSSamlApiUsed in enums.xml
+// These values are persisted to logs. Entries should not be renumbered and
+// numeric values should never be reused
+enum class ChromeOSSamlApiUsed {
+ kNotSamlLogin = 0,
+ kSamlApiUsed = 1,
+ kSamlApiNotUsed = 2,
+ kMaxValue = kSamlApiNotUsed,
+};
+
+void RecordAPILogin(bool is_third_party_idp, bool is_api_used) {
+ ChromeOSSamlApiUsed login_type;
+ if (!is_third_party_idp) {
+ login_type = ChromeOSSamlApiUsed::kNotSamlLogin;
+ } else if (is_api_used) {
+ login_type = ChromeOSSamlApiUsed::kSamlApiUsed;
+ } else {
+ login_type = ChromeOSSamlApiUsed::kSamlApiNotUsed;
+ }
+ base::UmaHistogramEnumeration("ChromeOS.SAML.APILogin", login_type);
+}
+
policy::DeviceMode GetDeviceMode() {
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
@@ -365,10 +390,29 @@ void GaiaScreenHandler::LoadGaia(const GaiaContext& context) {
login::SigninPartitionManager* signin_partition_manager =
login::SigninPartitionManager::Factory::GetForBrowserContext(
Profile::FromWebUI(web_ui()));
- signin_partition_manager->StartSigninSession(
- web_ui()->GetWebContents(),
+
+ auto partition_call = base::BindOnce(
+ &login::SigninPartitionManager::StartSigninSession,
+ base::Unretained(signin_partition_manager), web_ui()->GetWebContents(),
base::BindOnce(&GaiaScreenHandler::LoadGaiaWithPartition,
weak_factory_.GetWeakPtr(), context));
+
+ if (!context.email.empty()) {
+ const AccountId account_id = GetAccountId(
+ context.email, std::string() /* id */, AccountType::UNKNOWN);
+ const user_manager::User* const user =
+ user_manager::UserManager::Get()->FindUser(account_id);
+
+ if (user && user->using_saml() &&
+ user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) {
+ public_saml_url_fetcher_ =
+ std::make_unique<chromeos::PublicSamlUrlFetcher>(account_id);
+ public_saml_url_fetcher_->Fetch(std::move(partition_call));
+ return;
+ }
+ }
+ public_saml_url_fetcher_.reset();
+ std::move(partition_call).Run();
}
void GaiaScreenHandler::LoadGaiaWithPartition(
@@ -399,11 +443,7 @@ void GaiaScreenHandler::LoadGaiaWithPartition(
GaiaUrls::GetInstance()->gaia_url(), gaps_cookie_value, base::Time::Now(),
base::nullopt /* server_time */));
- 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);
+ const net::CookieOptions options = net::CookieOptions::MakeAllInclusive();
partition->GetCookieManagerForBrowserProcess()->SetCanonicalCookie(
*cc.get(), "https", options, std::move(callback));
}
@@ -444,30 +484,6 @@ void GaiaScreenHandler::LoadGaiaWithPartitionAndVersionAndConsent(
screen_mode_ = GetGaiaScreenMode(context.email, context.use_offline);
params.SetInteger("screenMode", screen_mode_);
- if (!context.email.empty()) {
- const AccountId account_id = GetAccountId(
- context.email, std::string() /* id */, AccountType::UNKNOWN);
- const user_manager::User* const user =
- user_manager::UserManager::Get()->FindUser(account_id);
- if (user && user->using_saml() &&
- user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT &&
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kPublicAccountsSamlUrl)) {
- std::string saml_url =
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kPublicAccountsSamlUrl);
- params.SetBoolean("startsOnSamlPage", true);
- params.SetString("frameUrl", saml_url);
- params.SetString("email", account_id.GetUserEmail());
- CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kPublicAccountsSamlAclUrl));
- std::string saml_acl_url =
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kPublicAccountsSamlAclUrl);
- params.SetString("samlAclUrl", saml_acl_url);
- }
- }
-
if (screen_mode_ == GAIA_SCREEN_MODE_AD && !authpolicy_login_helper_)
authpolicy_login_helper_ = std::make_unique<AuthPolicyHelper>();
@@ -538,6 +554,26 @@ void GaiaScreenHandler::LoadGaiaWithPartitionAndVersionAndConsent(
ExtractSamlPasswordAttributesEnabled());
params.SetBoolean("enableGaiaActionButtons", GaiaActionButtonsEnabled());
+ if (public_saml_url_fetcher_) {
+ params.SetBoolean("startsOnSamlPage", true);
+ DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kPublicAccountsSamlAclUrl));
+ std::string saml_acl_url =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kPublicAccountsSamlAclUrl);
+ params.SetString("samlAclUrl", saml_acl_url);
+ if (public_saml_url_fetcher_->FetchSucceeded()) {
+ params.SetString("frameUrl", public_saml_url_fetcher_->GetRedirectUrl());
+ } else {
+ // TODO: make the string localized.
+ std::string msg = "Failed to fetch the SAML redirect URL from the server";
+ core_oobe_view_->ShowSignInError(
+ 0, msg, std::string(), HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT);
+ return;
+ }
+ }
+ public_saml_url_fetcher_.reset();
+
frame_state_ = FRAME_STATE_LOADING;
CallJS("login.GaiaSigninScreen.loadAuthExtension", params);
}
@@ -676,8 +712,6 @@ void GaiaScreenHandler::RegisterMessages() {
AddRawCallback("showAddUser", &GaiaScreenHandler::HandleShowAddUser);
AddCallback("getIsSamlUserPasswordless",
&GaiaScreenHandler::HandleGetIsSamlUserPasswordless);
- AddCallback("updateOobeDialogSize",
- &GaiaScreenHandler::HandleUpdateOobeDialogSize);
AddCallback("hideOobeDialog", &GaiaScreenHandler::HandleHideOobeDialog);
AddCallback("updateSigninUIState",
&GaiaScreenHandler::HandleUpdateSigninUIState);
@@ -732,6 +766,14 @@ void GaiaScreenHandler::HandleWebviewLoadAborted(int error_code) {
<< net::ErrorToShortString(error_code);
return;
}
+ if (error_code == net::ERR_TIMED_OUT &&
+ is_security_token_pin_dialog_running()) {
+ // Timeout errors are expected when the security token PIN is not entered by
+ // the user on time. In that case, return the user back to the first sign-in
+ // step instead of showing the network error screen.
+ ReloadGaia(/*force_reload=*/true);
+ return;
+ }
frame_error_ = static_cast<net::Error>(error_code);
LOG(ERROR) << "Gaia webview error: " << net::ErrorToShortString(error_code);
@@ -848,9 +890,8 @@ void GaiaScreenHandler::HandleCompleteAuthentication(
if (!partition)
return;
- net::CookieOptions cookie_options;
- cookie_options.set_include_httponly();
-
+ const net::CookieOptions cookie_options =
+ net::CookieOptions::MakeAllInclusive();
partition->GetCookieManagerForBrowserProcess()->GetCookieList(
GaiaUrls::GetInstance()->gaia_url(), cookie_options,
base::BindOnce(&GaiaScreenHandler::OnGetCookiesForCompleteAuthentication,
@@ -911,15 +952,17 @@ void GaiaScreenHandler::HandleCompleteLogin(const std::string& gaia_id,
SamlPasswordAttributes());
}
-void GaiaScreenHandler::HandleUsingSAMLAPI() {
- SetSAMLPrincipalsAPIUsed(true);
+void GaiaScreenHandler::HandleUsingSAMLAPI(bool is_third_party_idp) {
+ SetSAMLPrincipalsAPIUsed(is_third_party_idp, /*is_api_used=*/true);
}
void GaiaScreenHandler::HandleScrapedPasswordCount(int password_count) {
- SetSAMLPrincipalsAPIUsed(false);
+ // We are handling scraped passwords here so this is SAML flow without
+ // Chrome Credentials Passing API
+ SetSAMLPrincipalsAPIUsed(/*is_third_party_idp=*/true, /*is_api_used=*/false);
// Use a histogram that has 11 buckets, one for each of the values in [0, 9]
// and an overflow bucket at the end.
- UMA_HISTOGRAM_ENUMERATION("ChromeOS.SAML.Scraping.PasswordCount",
+ UMA_HISTOGRAM_ENUMERATION("ChromeOS.SAML.Scraping.PasswordCountAll",
std::min(password_count, 10), 11);
if (password_count == 0)
HandleScrapedPasswordVerificationFailed();
@@ -954,11 +997,6 @@ void GaiaScreenHandler::HandleGaiaUIReady() {
}
}
-void GaiaScreenHandler::HandleUpdateOobeDialogSize(int width, int height) {
- if (LoginDisplayHost::default_host())
- LoginDisplayHost::default_host()->UpdateOobeDialogSize(width, height);
-}
-
void GaiaScreenHandler::HandleHideOobeDialog() {
if (LoginDisplayHost::default_host())
LoginDisplayHost::default_host()->HideOobeDialog();
@@ -1028,7 +1066,7 @@ void GaiaScreenHandler::HandleSecurityTokenPinEntered(
DCHECK(!security_token_pin_entered_callback_ ||
security_token_pin_dialog_closed_callback_);
- if (!security_token_pin_dialog_closed_callback_) {
+ if (!is_security_token_pin_dialog_running()) {
// The PIN request has already been canceled on the handler side.
return;
}
@@ -1178,9 +1216,12 @@ void GaiaScreenHandler::SubmitLoginFormForTest() {
// if they are cleared here.
}
-void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool api_used) {
- using_saml_api_ = api_used;
- UMA_HISTOGRAM_BOOLEAN("ChromeOS.SAML.APIUsed", api_used);
+void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool is_third_party_idp,
+ bool is_api_used) {
+ using_saml_api_ = is_api_used;
+ // This correctly records the standard GAIA login and SAML flow
+ // with Chrome Credentials Passing API used/not used
+ RecordAPILogin(is_third_party_idp, is_api_used);
}
void GaiaScreenHandler::ShowGaiaAsync(const AccountId& account_id) {
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 9cba09d99ff..a1e7df1b651 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
@@ -39,6 +39,7 @@ class Key;
class SamlPasswordAttributes;
class SigninScreenHandler;
class UserContext;
+class PublicSamlUrlFetcher;
class GaiaView {
public:
@@ -212,7 +213,9 @@ class GaiaScreenHandler : public BaseScreenHandler,
void HandleCancelActiveDirectoryAuth();
- void HandleUsingSAMLAPI();
+ // Handles SAML/GAIA login flow metrics
+ // is_third_party_idp == false means GAIA-based authentication
+ void HandleUsingSAMLAPI(bool is_third_party_idp);
void HandleScrapedPasswordCount(int password_count);
void HandleScrapedPasswordVerificationFailed();
@@ -221,7 +224,6 @@ class GaiaScreenHandler : public BaseScreenHandler,
void HandleIdentifierEntered(const std::string& account_identifier);
void HandleAuthExtensionLoaded();
- void HandleUpdateOobeDialogSize(int width, int height);
void HandleHideOobeDialog();
void HandleShowAddUser(const base::ListValue* args);
void HandleGetIsSamlUserPasswordless(const std::string& callback_id,
@@ -271,8 +273,8 @@ class GaiaScreenHandler : public BaseScreenHandler,
void SubmitLoginFormForTest();
// Updates the member variable and UMA histogram indicating whether the
- // principals API was used during SAML login.
- void SetSAMLPrincipalsAPIUsed(bool api_used);
+ // Chrome Credentials Passing API was used during SAML login.
+ void SetSAMLPrincipalsAPIUsed(bool is_third_party_idp, bool is_api_used);
// Cancels the request to show the sign-in screen while the asynchronous
// clean-up process that precedes the screen showing is in progress.
@@ -326,6 +328,10 @@ class GaiaScreenHandler : public BaseScreenHandler,
UserContext* user_context,
std::string* error_message);
+ bool is_security_token_pin_dialog_running() const {
+ return !security_token_pin_dialog_closed_callback_.is_null();
+ }
+
// Current state of Gaia frame.
FrameState frame_state_ = FRAME_STATE_UNKNOWN;
@@ -365,12 +371,9 @@ class GaiaScreenHandler : public BaseScreenHandler,
// The active network at the moment when Gaia page was preloaded.
std::string gaia_silent_load_network_;
- // If the user authenticated via SAML, this indicates whether the principals
- // API was used.
- // TODO(emaxx): This is also currently set when the user authenticated via
- // Gaia, since Gaia uses the same API for passing the password to Chrome.
- // Either fix this behavior, or change the naming and the comments to reflect
- // it.
+ // This flag is set when user authenticated using the Chrome Credentials
+ // Passing API (the login could happen via SAML or, with the current
+ // server-side implementation, via Gaia).
bool using_saml_api_ = false;
// Test credentials.
@@ -414,6 +417,8 @@ class GaiaScreenHandler : public BaseScreenHandler,
std::unique_ptr<LoginClientCertUsageObserver>
extension_provided_client_cert_usage_observer_;
+ std::unique_ptr<chromeos::PublicSamlUrlFetcher> public_saml_url_fetcher_;
+
// State of the security token PIN dialogs:
// Whether this instance is currently registered as a host for showing the
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc b/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc
index e990f0f0868..d26b46a9c28 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/login/screens/network_error.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chromeos/network/network_state.h"
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 0b45e2d2f8f..818c818751e 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
@@ -18,7 +18,6 @@
#include "services/service_manager/public/cpp/connector.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
-#include "ui/events/devices/device_data_manager.h"
#include "ui/events/devices/touchscreen_device.h"
using content::BrowserThread;
@@ -42,12 +41,12 @@ bool IsWhiteListedVendorId(uint16_t vendor_id) {
} // namespace
-OobeDisplayChooser::OobeDisplayChooser() : scoped_observer_(this) {
+OobeDisplayChooser::OobeDisplayChooser() {
// |connector| may be null in tests.
auto* connector = content::GetSystemConnector();
if (connector) {
- connector->BindInterface(ash::mojom::kServiceName,
- &cros_display_config_ptr_);
+ connector->Connect(ash::mojom::kServiceName,
+ cros_display_config_.BindNewPipeAndPassReceiver());
}
}
@@ -95,7 +94,7 @@ void OobeDisplayChooser::MoveToTouchDisplay() {
device.target_display_id != display::kInvalidDisplayId) {
auto config_properties = ash::mojom::DisplayConfigProperties::New();
config_properties->set_primary = true;
- cros_display_config_ptr_->SetDisplayProperties(
+ cros_display_config_->SetDisplayProperties(
base::NumberToString(device.target_display_id),
std::move(config_properties), ash::mojom::DisplayConfigSource::kUser,
base::DoNothing());
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h
index 555050c7f87..fc9cf2a9e22 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h
@@ -9,6 +9,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
+#include "ui/events/devices/device_data_manager.h"
#include "ui/events/devices/input_device_event_observer.h"
namespace ui {
@@ -26,9 +29,10 @@ class OobeDisplayChooser : public ui::InputDeviceEventObserver {
// Must be called on the BrowserThread::UI thread.
void TryToPlaceUiOnTouchDisplay();
- void set_cros_display_config_ptr_for_test(
- ash::mojom::CrosDisplayConfigControllerPtr cros_display_config_ptr) {
- cros_display_config_ptr_ = std::move(cros_display_config_ptr);
+ void set_cros_display_config_for_test(
+ mojo::PendingRemote<ash::mojom::CrosDisplayConfigController>
+ cros_display_config) {
+ cros_display_config_.Bind(std::move(cros_display_config));
}
private:
@@ -44,8 +48,8 @@ class OobeDisplayChooser : public ui::InputDeviceEventObserver {
void OnDeviceListsComplete() override;
ScopedObserver<ui::DeviceDataManager, ui::InputDeviceEventObserver>
- scoped_observer_;
- ash::mojom::CrosDisplayConfigControllerPtr cros_display_config_ptr_;
+ scoped_observer_{this};
+ mojo::Remote<ash::mojom::CrosDisplayConfigController> cros_display_config_;
base::WeakPtrFactory<OobeDisplayChooser> weak_ptr_factory_{this};
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 2fd04181e8a..407ca745758 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
@@ -8,11 +8,14 @@
#include <vector>
#include "ash/display/display_configuration_controller.h"
+#include "ash/public/mojom/cros_display_config.mojom.h"
#include "ash/shell.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/test/base/chrome_ash_test_base.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/display/display.h"
#include "ui/display/display_observer.h"
@@ -29,17 +32,17 @@ namespace {
class TestCrosDisplayConfig : public ash::mojom::CrosDisplayConfigController {
public:
- TestCrosDisplayConfig() : binding_(this) {}
+ TestCrosDisplayConfig() = default;
- ash::mojom::CrosDisplayConfigControllerPtr CreateInterfacePtrAndBind() {
- ash::mojom::CrosDisplayConfigControllerPtr ptr;
- binding_.Bind(mojo::MakeRequest(&ptr));
- return ptr;
+ mojo::PendingRemote<ash::mojom::CrosDisplayConfigController>
+ CreateRemoteAndBind() {
+ return receiver_.BindNewPipeAndPassRemote();
}
// ash::mojom::CrosDisplayConfigController:
- void AddObserver(ash::mojom::CrosDisplayConfigObserverAssociatedPtrInfo
- observer) override {}
+ void AddObserver(
+ mojo::PendingAssociatedRemote<ash::mojom::CrosDisplayConfigObserver>
+ observer) override {}
void GetDisplayLayoutInfo(GetDisplayLayoutInfoCallback callback) override {}
void SetDisplayLayoutInfo(ash::mojom::DisplayLayoutInfoPtr info,
SetDisplayLayoutInfoCallback callback) override {}
@@ -69,7 +72,7 @@ class TestCrosDisplayConfig : public ash::mojom::CrosDisplayConfigController {
TouchCalibrationCallback callback) override {}
private:
- mojo::Binding<ash::mojom::CrosDisplayConfigController> binding_;
+ mojo::Receiver<ash::mojom::CrosDisplayConfigController> receiver_{this};
DISALLOW_COPY_AND_ASSIGN(TestCrosDisplayConfig);
};
@@ -88,8 +91,8 @@ class OobeDisplayChooserTest : public ChromeAshTestBase {
cros_display_config_ = std::make_unique<TestCrosDisplayConfig>();
display_chooser_ = std::make_unique<OobeDisplayChooser>();
- display_chooser_->set_cros_display_config_ptr_for_test(
- cros_display_config_->CreateInterfacePtrAndBind());
+ display_chooser_->set_cros_display_config_for_test(
+ cros_display_config_->CreateRemoteAndBind());
ui::DeviceDataManagerTestApi().OnDeviceListsComplete();
}
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 67f444cbacd..6d8e7ade583 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -90,6 +90,7 @@
#include "chrome/grit/component_extension_resources.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/services/multidevice_setup/public/mojom/constants.mojom.h"
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_context.h"
@@ -490,20 +491,23 @@ service_manager::Connector* OobeUI::GetLoggedInUserMojoConnector() {
}
void OobeUI::BindMultiDeviceSetup(
- multidevice_setup::mojom::MultiDeviceSetupRequest request) {
- GetLoggedInUserMojoConnector()->BindInterface(
- multidevice_setup::mojom::kServiceName, std::move(request));
+ mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>
+ receiver) {
+ GetLoggedInUserMojoConnector()->Connect(
+ multidevice_setup::mojom::kServiceName, std::move(receiver));
}
void OobeUI::BindPrivilegedHostDeviceSetter(
- multidevice_setup::mojom::PrivilegedHostDeviceSetterRequest request) {
- GetLoggedInUserMojoConnector()->BindInterface(
- multidevice_setup::mojom::kServiceName, std::move(request));
+ mojo::PendingReceiver<multidevice_setup::mojom::PrivilegedHostDeviceSetter>
+ receiver) {
+ GetLoggedInUserMojoConnector()->Connect(
+ multidevice_setup::mojom::kServiceName, std::move(receiver));
}
void OobeUI::BindCrosNetworkConfig(
- chromeos::network_config::mojom::CrosNetworkConfigRequest request) {
- ash::GetNetworkConfigService(std::move(request));
+ mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig>
+ receiver) {
+ ash::GetNetworkConfigService(std::move(receiver));
}
OobeUI::OobeUI(content::WebUI* web_ui, const GURL& url)
@@ -622,7 +626,7 @@ void OobeUI::CurrentScreenChanged(OobeScreenId new_screen) {
current_screen_ = new_screen;
for (Observer& observer : observer_list_)
- observer.OnCurrentScreenChanged(current_screen_, new_screen);
+ observer.OnCurrentScreenChanged(previous_screen_, new_screen);
}
bool OobeUI::IsScreenInitialized(OobeScreenId screen) {
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 84dc0d2d4ca..cb1f0565315 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
@@ -18,7 +18,8 @@
#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"
-#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h" // nogncheck
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
namespace base {
@@ -156,14 +157,17 @@ class OobeUI : public ui::MojoWebUIController {
// display type.
void ConfigureOobeDisplay();
- // Adds Mojo bindings for this WebUIController.
+ // Adds Mojo receivers for this WebUIController.
service_manager::Connector* GetLoggedInUserMojoConnector();
void BindMultiDeviceSetup(
- multidevice_setup::mojom::MultiDeviceSetupRequest request);
+ mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>
+ receiver);
void BindPrivilegedHostDeviceSetter(
- multidevice_setup::mojom::PrivilegedHostDeviceSetterRequest request);
+ mojo::PendingReceiver<
+ multidevice_setup::mojom::PrivilegedHostDeviceSetter> receiver);
void BindCrosNetworkConfig(
- chromeos::network_config::mojom::CrosNetworkConfigRequest request);
+ mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig>
+ receiver);
// Type of UI.
std::string display_type_;
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 d8a5fa15e43..c88297b01a0 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
@@ -5,7 +5,7 @@
#include "chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.h"
#include "base/metrics/histogram_macros.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
+#include "chrome/browser/chromeos/arc/session/arc_session_manager.h"
#include "chrome/browser/chromeos/login/screens/recommend_apps_screen.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
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 aa0e6206df5..2e34b2bb0c8 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
@@ -101,6 +101,8 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
+#include "extensions/browser/api/extensions_api_client.h"
+#include "extensions/browser/api/feedback_private/feedback_private_delegate.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/base/ime/chromeos/ime_keyboard.h"
@@ -296,6 +298,13 @@ SigninScreenHandler::~SigninScreenHandler() {
network_state_informer_->RemoveObserver(this);
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(nullptr);
proximity_auth::ScreenlockBridge::Get()->SetFocusedUser(EmptyAccountId());
+ // TODO(https://crbug.com/1033572) Quick fix to close feedback form when login
+ // was performed.
+ login_feedback_.reset();
+ extensions::FeedbackPrivateDelegate* feedback_private_delegate =
+ extensions::ExtensionsAPIClient::Get()->GetFeedbackPrivateDelegate();
+ feedback_private_delegate->UnloadFeedbackExtension(
+ Profile::FromWebUI(web_ui()));
}
void SigninScreenHandler::DeclareLocalizedValues(
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 3542f432e78..311bd578880 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
@@ -9,8 +9,8 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
+#include "chrome/browser/chromeos/arc/session/arc_session_manager.h"
#include "chrome/browser/chromeos/login/oobe_screen.h"
#include "chrome/browser/chromeos/login/screens/supervision_transition_screen.h"
#include "chrome/browser/profiles/profile_manager.h"
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 1a557a318c5..d02af35140b 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
@@ -12,6 +12,9 @@
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/login/localized_values_builder.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/chromeos/devicetype_utils.h"
+#include "ui/strings/grit/ui_strings.h"
namespace chromeos {
@@ -20,6 +23,7 @@ constexpr StaticOobeScreenId UpdateRequiredView::kScreenId;
UpdateRequiredScreenHandler::UpdateRequiredScreenHandler(
JSCallsContainer* js_calls_container)
: BaseScreenHandler(kScreenId, js_calls_container) {
+ set_user_acted_method_path("login.UpdateRequiredScreen.userActed");
}
UpdateRequiredScreenHandler::~UpdateRequiredScreenHandler() {
@@ -31,6 +35,35 @@ void UpdateRequiredScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
builder->Add("updateRequiredMessage",
IDS_UPDATE_REQUIRED_LOGIN_SCREEN_MESSAGE);
+ builder->Add("errorMessage",
+ IDS_BROWSER_SHARING_ERROR_DIALOG_TEXT_INTERNAL_ERROR);
+ builder->Add("eolMessage",
+ ui::SubstituteChromeOSDeviceType(IDS_EOL_NOTIFICATION_EOL));
+ builder->Add("selectNetworkButtonCaption", IDS_APP_START_CONFIGURE_NETWORK);
+ builder->Add("updateButtonCaption",
+ IDS_SETTINGS_ABOUT_PAGE_CHECK_FOR_UPDATES);
+ builder->Add("rebootNeededMessage", IDS_UPDATE_COMPLETED);
+
+ builder->Add("checkingForUpdatesTitle", IDS_CHECKING_FOR_UPDATES);
+ builder->Add("updatingTitle", IDS_UPDATING_SCREEN_TITLE);
+
+ builder->Add("downloading", IDS_DOWNLOADING);
+ builder->Add("downloadingTimeLeftLong", IDS_DOWNLOADING_TIME_LEFT_LONG);
+ builder->Add("downloadingTimeLeftStatusOneHour",
+ IDS_DOWNLOADING_TIME_LEFT_STATUS_ONE_HOUR);
+ builder->Add("downloadingTimeLeftStatusMinutes",
+ IDS_DOWNLOADING_TIME_LEFT_STATUS_MINUTES);
+ builder->Add("downloadingTimeLeftSmall", IDS_DOWNLOADING_TIME_LEFT_SMALL);
+
+ builder->Add(
+ "updateOverCellularPromptTitle",
+ ui::SubstituteChromeOSDeviceType(IDS_UPDATE_OVER_CELLULAR_PROMPT_TITLE));
+ builder->Add("updateOverCellularPromptMessage",
+ IDS_UPDATE_OVER_CELLULAR_PROMPT_MESSAGE);
+ builder->Add("AcceptUpdateOverCellularButton",
+ IDS_OFFERS_CONSENT_INFOBAR_ENABLE_BUTTON);
+ builder->Add("RejectUpdateOverCellularButton",
+ IDS_OFFERS_CONSENT_INFOBAR_DISABLE_BUTTON);
}
void UpdateRequiredScreenHandler::Initialize() {
@@ -60,4 +93,36 @@ void UpdateRequiredScreenHandler::Unbind() {
BaseScreenHandler::SetBaseScreen(nullptr);
}
+void UpdateRequiredScreenHandler::SetIsConnected(bool connected) {
+ CallJS("login.UpdateRequiredScreen.setIsConnected", connected);
+}
+
+void UpdateRequiredScreenHandler::SetUpdateProgressUnavailable(
+ bool unavailable) {
+ CallJS("login.UpdateRequiredScreen.setUpdateProgressUnavailable",
+ unavailable);
+}
+
+void UpdateRequiredScreenHandler::SetUpdateProgressValue(int progress) {
+ CallJS("login.UpdateRequiredScreen.setUpdateProgressValue", progress);
+}
+
+void UpdateRequiredScreenHandler::SetUpdateProgressMessage(
+ const base::string16& message) {
+ CallJS("login.UpdateRequiredScreen.setUpdateProgressMessage", message);
+}
+
+void UpdateRequiredScreenHandler::SetEstimatedTimeLeftVisible(bool visible) {
+ CallJS("login.UpdateRequiredScreen.setEstimatedTimeLeftVisible", visible);
+}
+
+void UpdateRequiredScreenHandler::SetEstimatedTimeLeft(int seconds_left) {
+ CallJS("login.UpdateRequiredScreen.setEstimatedTimeLeft", seconds_left);
+}
+
+void UpdateRequiredScreenHandler::SetUIState(
+ UpdateRequiredView::UIState ui_state) {
+ CallJS("login.UpdateRequiredScreen.setUIState", static_cast<int>(ui_state));
+}
+
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h b/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h
index 7a194338521..cd52e9f012d 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h
@@ -21,6 +21,16 @@ class UpdateRequiredScreen;
class UpdateRequiredView {
public:
+ enum UIState {
+ UPDATE_REQUIRED_MESSAGE = 0, // 'System update required' message.
+ UPDATE_PROCESS, // Update is going on.
+ UPDATE_NEED_PERMISSION, // Need user's permission to proceed.
+ UPDATE_COMPLETED_NEED_REBOOT, // Update successful, manual reboot is
+ // needed.
+ UPDATE_ERROR, // An error has occurred.
+ EOL // End of Life message.
+ };
+
constexpr static StaticOobeScreenId kScreenId{"update-required"};
virtual ~UpdateRequiredView() {}
@@ -36,6 +46,21 @@ class UpdateRequiredView {
// Unbinds the screen from the view.
virtual void Unbind() = 0;
+
+ // Is device connected to some network?
+ virtual void SetIsConnected(bool connected) = 0;
+ // Is progress unavailable (e.g. we are checking for updates)?
+ virtual void SetUpdateProgressUnavailable(bool unavailable) = 0;
+ // Set progress percentage.
+ virtual void SetUpdateProgressValue(int progress) = 0;
+ // Set progress message (like "Verifying").
+ virtual void SetUpdateProgressMessage(const base::string16& message) = 0;
+ // Set the visibility of the estimated time left.
+ virtual void SetEstimatedTimeLeftVisible(bool visible) = 0;
+ // Set the estimated time left, in seconds.
+ virtual void SetEstimatedTimeLeft(int seconds_left) = 0;
+ // Set the UI state of the screen.
+ virtual void SetUIState(UpdateRequiredView::UIState ui_state) = 0;
};
class UpdateRequiredScreenHandler : public UpdateRequiredView,
@@ -52,6 +77,14 @@ class UpdateRequiredScreenHandler : public UpdateRequiredView,
void Bind(UpdateRequiredScreen* screen) override;
void Unbind() override;
+ void SetIsConnected(bool connected) override;
+ void SetUpdateProgressUnavailable(bool unavailable) override;
+ void SetUpdateProgressValue(int progress) override;
+ void SetUpdateProgressMessage(const base::string16& message) override;
+ void SetEstimatedTimeLeftVisible(bool visible) override;
+ void SetEstimatedTimeLeft(int seconds_left) override;
+ void SetUIState(UpdateRequiredView::UIState ui_state) override;
+
// BaseScreenHandler:
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.cc
index f648d2f70a1..673d8f6352a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.cc
@@ -14,18 +14,18 @@ namespace chromeos {
namespace machine_learning {
MachineLearningInternalsPageHandler::MachineLearningInternalsPageHandler(
- mojom::PageHandlerRequest request)
- : binding_(this, std::move(request)) {}
+ mojo::PendingReceiver<mojom::PageHandler> receiver)
+ : receiver_(this, std::move(receiver)) {}
MachineLearningInternalsPageHandler::~MachineLearningInternalsPageHandler() =
default;
-void MachineLearningInternalsPageHandler::LoadModel(
- mojom::ModelSpecPtr spec,
- mojom::ModelRequest request,
- LoadModelCallback callback) {
- ServiceConnection::GetInstance()->LoadModel(
- std::move(spec), std::move(request), std::move(callback));
+void MachineLearningInternalsPageHandler::LoadBuiltinModel(
+ mojom::BuiltinModelSpecPtr spec,
+ mojo::PendingReceiver<mojom::Model> receiver,
+ LoadBuiltinModelCallback callback) {
+ ServiceConnection::GetInstance()->LoadBuiltinModel(
+ std::move(spec), std::move(receiver), std::move(callback));
}
} // namespace machine_learning
diff --git a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.h b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.h
index afa6d61da03..70c4e963839 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.h
@@ -9,7 +9,8 @@
#include "chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.mojom.h"
#include "chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom.h"
#include "chromeos/services/machine_learning/public/mojom/model.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
namespace chromeos {
namespace machine_learning {
@@ -19,16 +20,16 @@ namespace machine_learning {
class MachineLearningInternalsPageHandler : public mojom::PageHandler {
public:
explicit MachineLearningInternalsPageHandler(
- mojom::PageHandlerRequest request);
+ mojo::PendingReceiver<mojom::PageHandler> receiver);
~MachineLearningInternalsPageHandler() override;
private:
// mojom::PageHandler:
- void LoadModel(mojom::ModelSpecPtr spec,
- mojom::ModelRequest request,
- LoadModelCallback callback) override;
+ void LoadBuiltinModel(mojom::BuiltinModelSpecPtr spec,
+ mojo::PendingReceiver<mojom::Model> receiver,
+ LoadBuiltinModelCallback callback) override;
- mojo::Binding<mojom::PageHandler> binding_;
+ mojo::Receiver<mojom::PageHandler> receiver_;
DISALLOW_COPY_AND_ASSIGN(MachineLearningInternalsPageHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.mojom b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.mojom
index 3e56bc185cf..84a76d05dc2 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.mojom
+++ b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.mojom
@@ -9,7 +9,8 @@ import "chromeos/services/machine_learning/public/mojom/model.mojom";
import "chromeos/services/machine_learning/public/mojom/graph_executor.mojom";
interface PageHandler {
- // Loads the specified model by forwarding it to Chrome OS ML Service.
- LoadModel(ModelSpec spec, Model& request) => (LoadModelResult result);
+ // Loads the specified builtin model by forwarding it to Chrome OS ML
+ // Service.
+ LoadBuiltinModel(BuiltinModelSpec spec, pending_receiver<Model> receiver)
+ => (LoadModelResult result);
};
-
diff --git a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.cc
index 09f00e14b09..18ff22fb323 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.h"
+#include <memory>
#include <utility>
#include "chrome/browser/profiles/profile.h"
@@ -56,9 +57,9 @@ MachineLearningInternalsUI::MachineLearningInternalsUI(
MachineLearningInternalsUI::~MachineLearningInternalsUI() = default;
void MachineLearningInternalsUI::BindMachineLearningInternalsPageHandler(
- mojom::PageHandlerRequest request) {
- page_handler_.reset(
- new MachineLearningInternalsPageHandler(std::move(request)));
+ mojo::PendingReceiver<mojom::PageHandler> receiver) {
+ page_handler_ = std::make_unique<MachineLearningInternalsPageHandler>(
+ std::move(receiver));
}
} // namespace machine_learning
diff --git a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.h b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.h
index 38517641176..da44a735e5f 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_ui.h
@@ -9,6 +9,7 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/chromeos/machine_learning/machine_learning_internals_page_handler.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
namespace chromeos {
@@ -24,7 +25,7 @@ class MachineLearningInternalsUI : public ui::MojoWebUIController {
private:
void BindMachineLearningInternalsPageHandler(
- mojom::PageHandlerRequest request);
+ mojo::PendingReceiver<mojom::PageHandler> receiver);
std::unique_ptr<MachineLearningInternalsPageHandler> page_handler_;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc
index dc4915027ca..b01dc8a5e36 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.cc
@@ -59,6 +59,12 @@ MultiDeviceSetupDialog* MultiDeviceSetupDialog::Get() {
return current_instance_;
}
+// static
+void MultiDeviceSetupDialog::SetInstanceForTesting(
+ MultiDeviceSetupDialog* instance) {
+ current_instance_ = instance;
+}
+
void MultiDeviceSetupDialog::AddOnCloseCallback(base::OnceClosure callback) {
on_close_callbacks_.push_back(std::move(callback));
}
@@ -115,14 +121,15 @@ MultiDeviceSetupDialogUI::MultiDeviceSetupDialogUI(content::WebUI* web_ui)
MultiDeviceSetupDialogUI::~MultiDeviceSetupDialogUI() = default;
void MultiDeviceSetupDialogUI::BindMultiDeviceSetup(
- chromeos::multidevice_setup::mojom::MultiDeviceSetupRequest request) {
+ mojo::PendingReceiver<chromeos::multidevice_setup::mojom::MultiDeviceSetup>
+ receiver) {
service_manager::Connector* connector =
content::BrowserContext::GetConnectorFor(
web_ui()->GetWebContents()->GetBrowserContext());
DCHECK(connector);
- connector->BindInterface(chromeos::multidevice_setup::mojom::kServiceName,
- std::move(request));
+ connector->Connect(chromeos::multidevice_setup::mojom::kServiceName,
+ std::move(receiver));
}
} // namespace multidevice_setup
diff --git a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.h b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.h
index 422b8feeeac..e4671891542 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.h
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
#include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/web_dialogs/web_dialog_ui.h"
namespace chromeos {
@@ -31,6 +32,8 @@ class MultiDeviceSetupDialog : public SystemWebDialogDelegate {
// nullptr.
static MultiDeviceSetupDialog* Get();
+ static void SetInstanceForTesting(MultiDeviceSetupDialog* instance);
+
// Registers a callback which will be called when the dialog is closed.
void AddOnCloseCallback(base::OnceClosure callback);
@@ -59,7 +62,8 @@ class MultiDeviceSetupDialogUI : public ui::MojoWebDialogUI {
private:
void BindMultiDeviceSetup(
- chromeos::multidevice_setup::mojom::MultiDeviceSetupRequest request);
+ mojo::PendingReceiver<
+ chromeos::multidevice_setup::mojom::MultiDeviceSetup> receiver);
DISALLOW_COPY_AND_ASSIGN(MultiDeviceSetupDialogUI);
};
diff --git a/chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc
index 2bea1501801..99c9df466f6 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc
@@ -36,7 +36,9 @@ constexpr LocalizedString kElementLocalizedStrings[] = {
{"networkListItemConnecting", IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING},
{"networkListItemConnectingTo", IDS_NETWORK_LIST_CONNECTING_TO},
{"networkListItemInitializing", IDS_NETWORK_LIST_INITIALIZING},
+ {"networkListItemNotAvailable", IDS_NETWORK_LIST_NOT_AVAILABLE},
{"networkListItemScanning", IDS_SETTINGS_INTERNET_MOBILE_SEARCH},
+ {"networkListItemSimCardLocked", IDS_NETWORK_LIST_SIM_CARD_LOCKED},
{"networkListItemNotConnected", IDS_NETWORK_LIST_NOT_CONNECTED},
{"networkListItemNoNetwork", IDS_NETWORK_LIST_NO_NETWORK},
{"vpnNameTemplate", IDS_NETWORK_LIST_THIRD_PARTY_VPN_NAME_TEMPLATE},
diff --git a/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc b/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc
index 6e1c9d1f886..53c1cfdcb95 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/network_ui.cc
@@ -28,6 +28,7 @@
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/onc/onc_utils.h"
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h"
#include "components/device_event_log/device_event_log.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
@@ -44,6 +45,7 @@ namespace {
constexpr char kAddNetwork[] = "addNetwork";
constexpr char kGetNetworkProperties[] = "getShillNetworkProperties";
constexpr char kGetDeviceProperties[] = "getShillDeviceProperties";
+constexpr char kGetEthernetEAP[] = "getShillEthernetEAP";
constexpr char kOpenCellularActivationUi[] = "openCellularActivationUi";
constexpr char kShowNetworkDetails[] = "showNetworkDetails";
constexpr char kShowNetworkConfig[] = "showNetworkConfig";
@@ -107,6 +109,10 @@ class NetworkConfigMessageHandler : public content::WebUIMessageHandler {
&NetworkConfigMessageHandler::GetShillDeviceProperties,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
+ kGetEthernetEAP,
+ base::BindRepeating(&NetworkConfigMessageHandler::GetShillEthernetEAP,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
kOpenCellularActivationUi,
base::BindRepeating(
&NetworkConfigMessageHandler::OpenCellularActivationUi,
@@ -191,6 +197,28 @@ class NetworkConfigMessageHandler : public content::WebUIMessageHandler {
weak_ptr_factory_.GetWeakPtr(), type, kGetDeviceProperties));
}
+ void GetShillEthernetEAP(const base::ListValue* arg_list) {
+ NetworkStateHandler::NetworkStateList list;
+ NetworkHandler::Get()->network_state_handler()->GetNetworkListByType(
+ NetworkTypePattern::Primitive(shill::kTypeEthernetEap),
+ true /* configured_only */, false /* visible_only */, 1 /* limit */,
+ &list);
+
+ AllowJavascript();
+ if (list.empty()) {
+ CallJavascriptFunction(
+ base::StringPrintf("NetworkUI.%sResult", kGetEthernetEAP));
+ return;
+ }
+ const NetworkState* eap = list.front();
+ base::Value properties(base::Value::Type::DICTIONARY);
+ properties.SetStringKey("guid", eap->guid());
+ properties.SetStringKey("name", eap->name());
+ properties.SetStringKey("type", eap->type());
+ CallJavascriptFunction(
+ base::StringPrintf("NetworkUI.%sResult", kGetEthernetEAP), properties);
+ }
+
void OpenCellularActivationUi(const base::ListValue* arg_list) {
const NetworkState* cellular_network =
NetworkHandler::Get()->network_state_handler()->FirstNetworkByType(
@@ -252,12 +280,12 @@ class NetworkConfigMessageHandler : public content::WebUIMessageHandler {
std::unique_ptr<base::DictionaryValue> /* error_data */) {
NET_LOG(ERROR) << "Shill Error: " << error_name << " id=" << guid_or_type;
base::ListValue return_arg_list;
- std::unique_ptr<base::DictionaryValue> dictionary;
+ base::Value dictionary(base::Value::Type::DICTIONARY);
std::string key = function_name == kGetDeviceProperties
? shill::kTypeProperty
: shill::kGuidProperty;
- dictionary->SetKey(key, base::Value(guid_or_type));
- dictionary->SetKey("ShillError", base::Value(error_name));
+ dictionary.SetKey(key, base::Value(guid_or_type));
+ dictionary.SetKey("ShillError", base::Value(error_name));
return_arg_list.Append(std::move(dictionary));
AllowJavascript();
@@ -325,6 +353,9 @@ void NetworkUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
"favoriteNetworksLabel",
l10n_util::GetStringUTF16(IDS_NETWORK_UI_FAVORITE_NETWORKS));
localized_strings->SetString(
+ "ethernetEapNetworkLabel",
+ l10n_util::GetStringUTF16(IDS_NETWORK_UI_ETHERNET_EAP));
+ localized_strings->SetString(
"devicesLabel", l10n_util::GetStringUTF16(IDS_NETWORK_UI_DEVICES));
localized_strings->SetString(
@@ -376,8 +407,8 @@ NetworkUI::NetworkUI(content::WebUI* web_ui)
NetworkUI::~NetworkUI() {}
void NetworkUI::BindCrosNetworkConfig(
- network_config::mojom::CrosNetworkConfigRequest request) {
- ash::GetNetworkConfigService(std::move(request));
+ mojo::PendingReceiver<network_config::mojom::CrosNetworkConfig> receiver) {
+ ash::GetNetworkConfigService(std::move(receiver));
}
} // namespace chromeos
diff --git a/chromium/chrome/browser/ui/webui/chromeos/network_ui.h b/chromium/chrome/browser/ui/webui/chromeos/network_ui.h
index 4ed87901d96..a9eb0ab1919 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/network_ui.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/network_ui.h
@@ -6,7 +6,8 @@
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_NETWORK_UI_H_
#include "base/macros.h"
-#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h"
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
namespace base {
@@ -25,7 +26,7 @@ class NetworkUI : public ui::MojoWebUIController {
private:
void BindCrosNetworkConfig(
- network_config::mojom::CrosNetworkConfigRequest request);
+ mojo::PendingReceiver<network_config::mojom::CrosNetworkConfig> receiver);
DISALLOW_COPY_AND_ASSIGN(NetworkUI);
};
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 1376878c1d8..f5ec12c71a5 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/set_time_ui.cc
@@ -33,6 +33,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/resources/grit/webui_resources.h"
namespace chromeos {
@@ -171,6 +172,8 @@ SetTimeUI::SetTimeUI(content::WebUI* web_ui) : WebDialogUI(web_ui) {
// Set up the chrome://set-time source.
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUISetTimeHost);
+ source->OverrideContentSecurityPolicyScriptSrc(
+ "script-src chrome://resources chrome://test 'self';");
static constexpr LocalizedString kStrings[] = {
{"setTimeTitle", IDS_SET_TIME_TITLE},
@@ -196,13 +199,15 @@ SetTimeUI::SetTimeUI(content::WebUI* web_ui) : WebDialogUI(web_ui) {
source->AddLocalizedStrings(values);
source->UseStringsJs();
+ source->EnableReplaceI18nInJS();
- 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);
+ source->SetDefaultResource(IDR_SET_TIME_HTML);
+
+ source->AddResourcePath("test_loader.js", IDR_WEBUI_JS_TEST_LOADER);
+ source->AddResourcePath("test_loader.html", IDR_WEBUI_HTML_TEST_LOADER);
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc
index 819e4fb6cf7..791c7954a88 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.cc
@@ -25,7 +25,7 @@ smb_client::SmbService* GetSmbService(Profile* profile) {
base::Value BuildShareList(const std::vector<smb_client::SmbUrl>& shares) {
base::Value shares_list(base::Value::Type::LIST);
for (const auto& share : shares) {
- shares_list.GetList().push_back(base::Value(share.GetWindowsUNCString()));
+ shares_list.Append(base::Value(share.GetWindowsUNCString()));
}
return shares_list;
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_shares_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_shares_localized_strings_provider.cc
index 4a50ff51a44..7270b116329 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_shares_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/smb_shares/smb_shares_localized_strings_provider.cc
@@ -44,6 +44,8 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_DOWNLOADS_SHARE_ADDED_MOUNT_INVALID_URL_MESSAGE},
{"smbShareAddedInvalidSSOURLMessage",
IDS_SETTINGS_DOWNLOADS_SHARE_ADDED_MOUNT_INVALID_SSO_URL_MESSAGE},
+ {"smbShareDiscoveryMessage",
+ IDS_SETTINGS_DOWNLOADS_ADD_SHARE_DISCOVERY_MESSAGE},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings,
base::size(kLocalizedStrings));
diff --git a/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc b/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc
index 23d28d7e47f..a5376d48f85 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/sys_internals/sys_internals_message_handler.cc
@@ -115,7 +115,7 @@ void SetCpusValue(const std::vector<CpuInfo>& infos, base::Value* result) {
cpu_result.SetKey("kernel", base::Value(cpu.kernel));
cpu_result.SetKey("idle", base::Value(cpu.idle));
cpu_result.SetKey("total", base::Value(cpu.total));
- cpu_results.GetList().push_back(std::move(cpu_result));
+ cpu_results.Append(std::move(cpu_result));
}
result->SetKey("cpus", std::move(cpu_results));
}
@@ -214,7 +214,7 @@ void SysInternalsMessageHandler::HandleGetSysInfo(const base::ListValue* args) {
DCHECK(args);
AllowJavascript();
- const base::Value::ListStorage& list = args->GetList();
+ base::span<const base::Value> list = args->GetList();
if (list.size() != 1 || !list[0].is_string()) {
NOTREACHED();
return;
diff --git a/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_browsertest.cc b/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_browsertest.cc
index ce3b17a3858..c23cac4ef3a 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/system_web_dialog_browsertest.cc
@@ -18,10 +18,10 @@
#include "components/account_id/account_id.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/render_view_host.h"
-#include "content/public/common/page_zoom.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/common/web_preferences.h"
#include "services/service_manager/public/cpp/connector.h"
+#include "third_party/blink/public/common/page/page_zoom.h"
#include "ui/aura/client/aura_constants.h"
#include "url/gurl.h"
@@ -99,14 +99,21 @@ IN_PROC_BROWSER_TEST_F(SystemWebDialogTest, InstanceTest) {
// https://crbug.com/855344.
}
-IN_PROC_BROWSER_TEST_F(SystemWebDialogTest, FontSize) {
+class SystemWebDialogTestWithSplitSettings : public SystemWebDialogTest {
+ public:
+ SystemWebDialogTestWithSplitSettings() {
+ feature_list_.InitAndEnableFeature(chromeos::features::kSplitSettings);
+ }
+
+ private:
+ base::test::ScopedFeatureList feature_list_;
+};
+
+IN_PROC_BROWSER_TEST_F(SystemWebDialogTestWithSplitSettings, FontSize) {
const content::WebPreferences kDefaultPrefs;
const int kDefaultFontSize = kDefaultPrefs.default_font_size;
const int kDefaultFixedFontSize = kDefaultPrefs.default_fixed_font_size;
- base::test::ScopedFeatureList features;
- features.InitAndEnableFeature(features::kSplitSettings);
-
// Set the browser font sizes to non-default values.
PrefService* profile_prefs = browser()->profile()->GetPrefs();
profile_prefs->SetInteger(prefs::kWebKitDefaultFontSize,
@@ -127,12 +134,9 @@ IN_PROC_BROWSER_TEST_F(SystemWebDialogTest, FontSize) {
EXPECT_EQ(kDefaultFixedFontSize, dialog_prefs.default_fixed_font_size);
}
-IN_PROC_BROWSER_TEST_F(SystemWebDialogTest, PageZoom) {
- base::test::ScopedFeatureList features;
- features.InitAndEnableFeature(features::kSplitSettings);
-
+IN_PROC_BROWSER_TEST_F(SystemWebDialogTestWithSplitSettings, PageZoom) {
// Set the default browser page zoom to 150%.
- double level = content::ZoomFactorToZoomLevel(1.5);
+ double level = blink::PageZoomFactorToZoomLevel(1.5);
browser()->profile()->GetZoomLevelPrefs()->SetDefaultZoomLevelPref(level);
// Open a system dialog.
@@ -142,8 +146,8 @@ IN_PROC_BROWSER_TEST_F(SystemWebDialogTest, PageZoom) {
// Dialog page zoom is still 100%.
auto* web_contents = dialog->GetWebUIForTest()->GetWebContents();
double dialog_level = content::HostZoomMap::GetZoomLevel(web_contents);
- EXPECT_TRUE(content::ZoomValuesEqual(dialog_level,
- content::ZoomFactorToZoomLevel(1.0)))
+ EXPECT_TRUE(blink::PageZoomValuesEqual(dialog_level,
+ blink::PageZoomFactorToZoomLevel(1.0)))
<< dialog_level;
}
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 ce6790a8ec3..23267bce02b 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
@@ -19,7 +19,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
-#include "content/public/common/page_zoom.h"
+#include "third_party/blink/public/common/page/page_zoom.h"
#include "ui/aura/window.h"
namespace chromeos {
@@ -137,7 +137,7 @@ void SystemWebDialogDelegate::OnDialogShown(
// Temporary means the lifetime of the WebContents.
zoom_map->SetTemporaryZoomLevel(rvh->GetProcess()->GetID(),
rvh->GetRoutingID(),
- content::ZoomFactorToZoomLevel(1.0));
+ blink::PageZoomFactorToZoomLevel(1.0));
}
}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc b/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc
index 2609acbbbde..1bc97a1d760 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc
+++ b/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.cc
@@ -27,7 +27,11 @@ void ReadFile(const base::FilePath& path,
const content::URLDataSource::GotDataCallback& callback) {
std::string content;
bool result = base::ReadFileToString(path, &content);
- DCHECK(result) << path;
+ // Allow missing files in <root>/_locales only.
+ DCHECK(result || base::FilePath(kTerminalRoot)
+ .Append("_locales")
+ .AppendRelativePath(path, nullptr))
+ << path;
scoped_refptr<base::RefCountedString> response =
base::RefCountedString::TakeString(&content);
callback.Run(response.get());
@@ -38,6 +42,12 @@ std::string TerminalSource::GetSource() {
return chrome::kChromeUITerminalHost;
}
+#if !BUILDFLAG(OPTIMIZE_WEBUI)
+bool TerminalSource::AllowCaching() {
+ return false;
+}
+#endif
+
void TerminalSource::StartDataRequest(
const std::string& path,
const content::WebContents::Getter& wc_getter,
@@ -61,3 +71,8 @@ std::string TerminalSource::GetMimeType(const std::string& path) {
net::GetWellKnownMimeTypeFromExtension(ext.substr(1), &mime_type);
return mime_type;
}
+
+bool TerminalSource::ShouldServeMimeTypeAsContentTypeHeader() {
+ // TerminalSource pages include js modules which require an explicit MimeType.
+ return true;
+}
diff --git a/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h b/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h
index b5acfdeb435..28e1fb9a1fc 100644
--- a/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h
+++ b/chromium/chrome/browser/ui/webui/chromeos/terminal/terminal_source.h
@@ -8,6 +8,8 @@
#include <string>
#include "base/macros.h"
+#include "build/buildflag.h"
+#include "chrome/common/buildflags.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
@@ -18,6 +20,9 @@ class TerminalSource : public content::URLDataSource {
private:
std::string GetSource() override;
+#if !BUILDFLAG(OPTIMIZE_WEBUI)
+ bool AllowCaching() override;
+#endif
void StartDataRequest(
const std::string& path,
@@ -26,6 +31,8 @@ class TerminalSource : public content::URLDataSource {
std::string GetMimeType(const std::string& path) override;
+ bool ShouldServeMimeTypeAsContentTypeHeader() override;
+
DISALLOW_COPY_AND_ASSIGN(TerminalSource);
};
diff --git a/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc b/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
index caf0202c54d..fdf7d29f1cb 100644
--- a/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
+++ b/chromium/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
@@ -8,6 +8,7 @@
#include <utility>
#include "base/task/post_task.h"
+#include "base/values.h"
#include "base/win/windows_version.h"
#include "chrome/browser/win/conflicts/module_database.h"
#include "content/public/browser/browser_task_traits.h"
diff --git a/chromium/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc b/chromium/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
index d38705dac04..0fd891b5ef1 100644
--- a/chromium/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
+++ b/chromium/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
@@ -49,7 +49,7 @@ ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase(
renderer_preferences_util::UpdateFromSystemSettings(
prefs, Profile::FromBrowserContext(browser_context));
- web_contents_->GetRenderViewHost()->SyncRendererPrefs();
+ web_contents_->SyncRendererPrefs();
// Set |this| as a delegate so the ConstrainedWebDialogUI can retrieve it.
ConstrainedWebDialogUI::SetConstrainedDelegate(web_contents_, this);
diff --git a/chromium/chrome/browser/ui/webui/crashes_ui.cc b/chromium/chrome/browser/ui/webui/crashes_ui.cc
index d150c2cc8d5..08075f51e4d 100644
--- a/chromium/chrome/browser/ui/webui/crashes_ui.cc
+++ b/chromium/chrome/browser/ui/webui/crashes_ui.cc
@@ -34,7 +34,11 @@
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/debug_daemon_client.h"
+#include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
+#endif
+
+#if defined(OS_LINUX)
+#include "components/crash/content/app/crashpad.h"
#endif
using content::WebContents;
@@ -168,20 +172,25 @@ void CrashesDOMHandler::UpdateUI() {
system_crash_reporter = true;
#endif
- bool upload_list = crash_reporting_enabled;
- bool support_manual_uploads = false;
-
+ bool using_crashpad = false;
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID)
- // Maunal uploads currently are supported only for Crashpad-using platforms
- // and Android, and only if crash uploads are not disabled by policy.
- support_manual_uploads =
- crash_reporting_enabled || !IsMetricsReportingPolicyManaged();
-
- // Show crash reports regardless of |crash_reporting_enabled| so that users
- // can manually upload those reports.
- upload_list = true;
+ using_crashpad = true;
+#elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ // ChromeOS uses crash_sender instead of Crashpad for uploads even when
+ // Crashpad is enabled for dump generation.
+ using_crashpad = crash_reporter::IsCrashpadEnabled();
#endif
+ // Manual uploads currently are supported only for Crashpad-using platforms
+ // and only if crash uploads are not disabled by policy.
+ bool support_manual_uploads =
+ using_crashpad &&
+ (crash_reporting_enabled || !IsMetricsReportingPolicyManaged());
+
+ // Show crash reports regardless of |crash_reporting_enabled| when using
+ // Crashpad so that users can manually upload those reports.
+ bool upload_list = using_crashpad || crash_reporting_enabled;
+
base::ListValue crash_list;
if (upload_list)
crash_reporter::UploadListToValue(upload_list_.get(), &crash_list);
diff --git a/chromium/chrome/browser/ui/webui/devtools_ui_data_source.cc b/chromium/chrome/browser/ui/webui/devtools_ui_data_source.cc
index 95e73c57300..53b632a539a 100644
--- a/chromium/chrome/browser/ui/webui/devtools_ui_data_source.cc
+++ b/chromium/chrome/browser/ui/webui/devtools_ui_data_source.cc
@@ -84,11 +84,21 @@ std::string DevToolsDataSource::GetSource() {
return chrome::kChromeUIDevToolsHost;
}
+// static
+GURL GetCustomDevToolsFrontendURL() {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kCustomDevtoolsFrontend)) {
+ return GURL(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kCustomDevtoolsFrontend));
+ }
+ return GURL();
+}
+
void DevToolsDataSource::StartDataRequest(
const std::string& path,
const content::WebContents::Getter& wc_getter,
const GotDataCallback& callback) {
- // Serve request from local bundle.
+ // Serve request to devtools://bundled/ from local bundle.
std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath);
bundled_path_prefix += "/";
if (base::StartsWith(path, bundled_path_prefix,
@@ -99,15 +109,19 @@ void DevToolsDataSource::StartDataRequest(
base::CompareCase::INSENSITIVE_ASCII));
std::string path_under_bundled =
path_without_params.substr(bundled_path_prefix.length());
-#if BUILDFLAG(DEBUG_DEVTOOLS)
- StartFileRequestForDebugDevtools(path_under_bundled, callback);
-#else
- StartBundledDataRequest(path_under_bundled, callback);
+#if !BUILDFLAG(DEBUG_DEVTOOLS)
+ if (!GetCustomDevToolsFrontendURL().SchemeIsFile()) {
+ // Fetch from packaged resources.
+ StartBundledDataRequest(path_under_bundled, callback);
+ return;
+ }
#endif
+ // Fetch from file system.
+ StartFileRequest(path_under_bundled, callback);
return;
}
- // Serve empty page.
+ // Serve request to devtools://blank as empty page.
std::string empty_path_prefix(chrome::kChromeUIDevToolsBlankPath);
if (base::StartsWith(path, empty_path_prefix,
base::CompareCase::INSENSITIVE_ASCII)) {
@@ -115,7 +129,7 @@ void DevToolsDataSource::StartDataRequest(
return;
}
- // Serve request from remote location.
+ // Serve request to devtools://remote from remote location.
std::string remote_path_prefix(chrome::kChromeUIDevToolsRemotePath);
remote_path_prefix += "/";
if (base::StartsWith(path, remote_path_prefix,
@@ -132,29 +146,22 @@ void DevToolsDataSource::StartDataRequest(
return;
}
- std::string custom_frontend_url =
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kCustomDevtoolsFrontend);
-
- if (custom_frontend_url.empty()) {
- callback.Run(nullptr);
- return;
- }
-
- // Serve request from custom location.
+ // Serve request to devtools://custom from custom URL.
std::string custom_path_prefix(chrome::kChromeUIDevToolsCustomPath);
custom_path_prefix += "/";
-
if (base::StartsWith(path, custom_path_prefix,
base::CompareCase::INSENSITIVE_ASCII)) {
- GURL url =
- GURL(custom_frontend_url + path.substr(custom_path_prefix.length()));
- DCHECK(url.is_valid());
- StartCustomDataRequest(url, callback);
- return;
+ GURL custom_devtools_frontend = GetCustomDevToolsFrontendURL();
+ if (!custom_devtools_frontend.is_empty()) {
+ GURL url = GURL(custom_devtools_frontend.spec() +
+ path.substr(custom_path_prefix.length()));
+ DCHECK(url.is_valid());
+ StartCustomDataRequest(url, callback);
+ return;
+ }
}
- callback.Run(nullptr);
+ callback.Run(CreateNotFoundResponse());
}
std::string DevToolsDataSource::GetMimeType(const std::string& path) {
@@ -279,8 +286,7 @@ void DevToolsDataSource::StartNetworkRequest(
base::Unretained(this), request_iter));
}
-#if BUILDFLAG(DEBUG_DEVTOOLS)
-scoped_refptr<base::RefCountedMemory> ReadFileForDebugDevTools(
+scoped_refptr<base::RefCountedMemory> ReadFileForDevTools(
const base::FilePath& path) {
std::string buffer;
if (!base::ReadFileToString(path, &buffer)) {
@@ -290,29 +296,26 @@ scoped_refptr<base::RefCountedMemory> ReadFileForDebugDevTools(
return base::RefCountedString::TakeString(&buffer);
}
-void DevToolsDataSource::StartFileRequestForDebugDevtools(
- const std::string& path,
- const GotDataCallback& callback) {
- base::FilePath inspector_debug_dir;
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kCustomDevtoolsFrontend)) {
- inspector_debug_dir =
- command_line->GetSwitchValuePath(switches::kCustomDevtoolsFrontend);
- // --custom-devtools-frontend may already be used to specify an URL.
- // In that case, fall back to the default debug-devtools bundle.
- if (!base::PathExists(inspector_debug_dir))
- inspector_debug_dir.clear();
- }
- if (inspector_debug_dir.empty() &&
- !base::PathService::Get(chrome::DIR_INSPECTOR_DEBUG,
- &inspector_debug_dir)) {
- callback.Run(CreateNotFoundResponse());
- return;
+void DevToolsDataSource::StartFileRequest(const std::string& path,
+ const GotDataCallback& callback) {
+ base::FilePath base_path;
+ GURL custom_devtools_frontend = GetCustomDevToolsFrontendURL();
+ if (custom_devtools_frontend.SchemeIsFile()) {
+ base_path = base_path.AppendASCII(custom_devtools_frontend.GetContent());
+ } else {
+#if BUILDFLAG(DEBUG_DEVTOOLS)
+ // Use default path for unbundled files when debug_devtools=true
+ if (!base::PathService::Get(chrome::DIR_INSPECTOR_DEBUG, &base_path)) {
+ callback.Run(CreateNotFoundResponse());
+ return;
+ }
+#else
+ NOTREACHED();
+#endif
}
- DCHECK(!inspector_debug_dir.empty());
-
- base::FilePath full_path = inspector_debug_dir.AppendASCII(path);
+ base::FilePath full_path = base_path.AppendASCII(path);
+ CHECK(base_path.IsParent(full_path));
base::PostTaskAndReplyWithResult(
FROM_HERE,
@@ -322,10 +325,8 @@ void DevToolsDataSource::StartFileRequestForDebugDevtools(
// The usage of BindRepeating below is only because the type of
// task callback needs to match that of response callback, which
// is currently a repeating callback.
- base::BindRepeating(ReadFileForDebugDevTools, std::move(full_path)),
- callback);
+ base::BindRepeating(ReadFileForDevTools, std::move(full_path)), callback);
}
-#endif // BUILDFLAG(DEBUG_DEVTOOLS)
void DevToolsDataSource::OnLoadComplete(
std::list<PendingRequest>::iterator request_iter,
diff --git a/chromium/chrome/browser/ui/webui/devtools_ui_data_source.h b/chromium/chrome/browser/ui/webui/devtools_ui_data_source.h
index dddecbcd1ba..6ee0377aa0d 100644
--- a/chromium/chrome/browser/ui/webui/devtools_ui_data_source.h
+++ b/chromium/chrome/browser/ui/webui/devtools_ui_data_source.h
@@ -23,12 +23,11 @@ struct NetworkTrafficAnnotationTag;
// An URLDataSource implementation that handles devtools://devtools/
// requests. Three types of requests could be handled based on the URL path:
-// 1. /bundled/: bundled DevTools frontend is served.
-// when built with debug_devtools=true, the path can be provided via
-// --custom-devtools-frontend.
+// 1. /bundled/: bundled DevTools frontend is served. The path can be provided
+// via --custom-devtools-frontend as file:// URL.
// 2. /remote/: remote DevTools frontend is served from App Engine.
// 3. /custom/: custom DevTools frontend is served from the server as specified
-// by the --custom-devtools-frontend flag.
+// via --custom-devtools-frontend as http:// URL.
class DevToolsDataSource : public content::URLDataSource {
public:
using GotDataCallback = content::URLDataSource::GotDataCallback;
@@ -75,10 +74,8 @@ class DevToolsDataSource : public content::URLDataSource {
int load_flags,
const GotDataCallback& callback);
-#if BUILDFLAG(DEBUG_DEVTOOLS)
- void StartFileRequestForDebugDevtools(const std::string& path,
- const GotDataCallback& callback);
-#endif
+ virtual void StartFileRequest(const std::string& path,
+ const GotDataCallback& callback);
struct PendingRequest {
PendingRequest();
diff --git a/chromium/chrome/browser/ui/webui/devtools_ui_data_source_unittest.cc b/chromium/chrome/browser/ui/webui/devtools_ui_data_source_unittest.cc
index 323ce84efc3..f756944b477 100644
--- a/chromium/chrome/browser/ui/webui/devtools_ui_data_source_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/devtools_ui_data_source_unittest.cc
@@ -50,8 +50,14 @@ class TestDevToolsDataSource : public DevToolsDataSource {
const net::NetworkTrafficAnnotationTag& traffic_annotation,
int load_flags,
const GotDataCallback& callback) override {
- std::string copy_of_url = url.spec();
- callback.Run(base::RefCountedString::TakeString(&copy_of_url));
+ std::string result = "url: " + url.spec();
+ callback.Run(base::RefCountedString::TakeString(&result));
+ }
+
+ void StartFileRequest(const std::string& path,
+ const GotDataCallback& callback) override {
+ std::string result = "file: " + path;
+ callback.Run(base::RefCountedString::TakeString(&result));
}
};
@@ -120,12 +126,23 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsBundledURLWithQueryParam) {
EXPECT_FALSE(data().empty());
}
+TEST_F(DevToolsUIDataSourceTest, TestDevToolsBundledURLWithSwitch) {
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kCustomDevtoolsFrontend, "file://tmp/");
+ const GURL path =
+ DevToolsUrl().Resolve(DevToolsBundledPath(kDevToolsUITestFrontEndUrl));
+ StartRequest(path.path());
+ EXPECT_TRUE(data_received());
+ EXPECT_EQ(data(), "file: devtools_app.html");
+}
+
TEST_F(DevToolsUIDataSourceTest, TestDevToolsInvalidBundledURL) {
const GURL path =
DevToolsUrl().Resolve(DevToolsBundledPath("invalid_devtools_app.html"));
StartRequest(path.path());
EXPECT_TRUE(data_received());
- EXPECT_TRUE(data().empty());
+ ASSERT_TRUE(base::StartsWith(data(), kDevToolsUITest404Response,
+ base::CompareCase::SENSITIVE));
}
TEST_F(DevToolsUIDataSourceTest, TestDevToolsInvalidBundledURLWithQueryParam) {
@@ -133,7 +150,8 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsInvalidBundledURLWithQueryParam) {
DevToolsUrl().Resolve(DevToolsBundledPath("invalid_devtools_app.html"));
StartRequest(path.path() + "?foo");
EXPECT_TRUE(data_received());
- EXPECT_TRUE(data().empty());
+ ASSERT_TRUE(base::StartsWith(data(), kDevToolsUITest404Response,
+ base::CompareCase::SENSITIVE));
}
// devtools/blank path
@@ -159,8 +177,9 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsRemoteURL) {
DevToolsUrl().Resolve(DevToolsRemotePath(kDevToolsUITestFrontEndUrl));
StartRequest(path.path());
EXPECT_TRUE(data_received());
- EXPECT_EQ(data(),
- "https://chrome-devtools-frontend.appspot.com/devtools_app.html");
+ EXPECT_EQ(
+ data(),
+ "url: https://chrome-devtools-frontend.appspot.com/devtools_app.html");
}
TEST_F(DevToolsUIDataSourceTest, TestDevToolsRemoteURLWithQueryParam) {
@@ -179,7 +198,8 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsCustomURLWithNoSwitch) {
DevToolsUrl().Resolve(DevToolsCustomPath(kDevToolsUITestFrontEndUrl));
StartRequest(path.path());
EXPECT_TRUE(data_received());
- EXPECT_TRUE(data().empty());
+ ASSERT_TRUE(base::StartsWith(data(), kDevToolsUITest404Response,
+ base::CompareCase::SENSITIVE));
}
TEST_F(DevToolsUIDataSourceTest, TestDevToolsCustomURLWithSwitch) {
@@ -189,7 +209,7 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsCustomURLWithSwitch) {
DevToolsUrl().Resolve(DevToolsCustomPath(kDevToolsUITestFrontEndUrl));
StartRequest(path.path());
EXPECT_TRUE(data_received());
- EXPECT_EQ(data(), "http://localhost:8090/front_end/devtools_app.html");
+ EXPECT_EQ(data(), "url: http://localhost:8090/front_end/devtools_app.html");
}
TEST_F(DevToolsUIDataSourceTest, TestDevToolsCustomURLWithSwitchAndQueryParam) {
@@ -199,7 +219,8 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsCustomURLWithSwitchAndQueryParam) {
DevToolsUrl().Resolve(DevToolsCustomPath(kDevToolsUITestFrontEndUrl));
StartRequest(path.path() + "?foo");
EXPECT_TRUE(data_received());
- EXPECT_EQ(data(), "http://localhost:8090/front_end/devtools_app.html?foo");
+ EXPECT_EQ(data(),
+ "url: http://localhost:8090/front_end/devtools_app.html?foo");
}
#if !DCHECK_IS_ON()
@@ -222,7 +243,8 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsNoRoute) {
const GURL path = DevToolsUrl().Resolve(kDevToolsUITestFrontEndUrl);
StartRequest(path.path());
EXPECT_TRUE(data_received());
- EXPECT_TRUE(data().empty());
+ ASSERT_TRUE(base::StartsWith(data(), kDevToolsUITest404Response,
+ base::CompareCase::SENSITIVE));
}
TEST_F(DevToolsUIDataSourceTest, TestDevToolsNoRouteWithSwitch) {
@@ -231,5 +253,6 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsNoRouteWithSwitch) {
const GURL path = DevToolsUrl().Resolve(kDevToolsUITestFrontEndUrl);
StartRequest(path.path());
EXPECT_TRUE(data_received());
- EXPECT_TRUE(data().empty());
+ ASSERT_TRUE(base::StartsWith(data(), kDevToolsUITest404Response,
+ base::CompareCase::SENSITIVE));
}
diff --git a/chromium/chrome/browser/ui/webui/discards/BUILD.gn b/chromium/chrome/browser/ui/webui/discards/BUILD.gn
index 83e8fb4a145..cf71fc8ea10 100644
--- a/chromium/chrome/browser/ui/webui/discards/BUILD.gn
+++ b/chromium/chrome/browser/ui/webui/discards/BUILD.gn
@@ -11,8 +11,9 @@ if (is_win || is_mac || is_desktop_linux || is_chromeos) {
]
public_deps = [
- "//chrome/browser/performance_manager:mojo_bindings",
"//chrome/browser/resource_coordinator:mojo_bindings",
+ "//mojo/public/mojom/base",
+ "//url/mojom:url_mojom_gurl",
]
}
}
diff --git a/chromium/chrome/browser/ui/webui/discards/DEPS b/chromium/chrome/browser/ui/webui/discards/DEPS
deleted file mode 100644
index b6e5e564456..00000000000
--- a/chromium/chrome/browser/ui/webui/discards/DEPS
+++ /dev/null
@@ -1,10 +0,0 @@
-specific_include_rules = {
- # TODO(siggi): Move WebUIGraphDumpImpl into this directory and kill these
- # include rules.
- "discards_ui.h": [
- "+chrome/browser/performance_manager/webui_graph_dump.mojom.h",
- ],
- "discards_ui.cc": [
- "+chrome/browser/performance_manager/webui_graph_dump_impl.h",
- ],
-}
diff --git a/chromium/chrome/browser/ui/webui/discards/discards.mojom b/chromium/chrome/browser/ui/webui/discards/discards.mojom
index 61d5f81d1cc..ca07b071130 100644
--- a/chromium/chrome/browser/ui/webui/discards/discards.mojom
+++ b/chromium/chrome/browser/ui/webui/discards/discards.mojom
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-module mojom;
+module discards.mojom;
import "chrome/browser/resource_coordinator/lifecycle_unit_state.mojom";
+import "mojo/public/mojom/base/process_id.mojom";
import "mojo/public/mojom/base/time.mojom";
+import "url/mojom/url.mojom";
// Identical to content::Visibility.
enum LifecycleUnitVisibility {
@@ -91,9 +93,9 @@ struct TabDiscardsInfo {
// The visibility of the LifecycleUnit.
LifecycleUnitVisibility visibility;
// The loading state of the LifecycleUnit.
- LifecycleUnitLoadingState loading_state;
+ mojom.LifecycleUnitLoadingState loading_state;
// The state of the LifecycleUnit.
- LifecycleUnitState state;
+ mojom.LifecycleUnitState state;
// Whether the tab can be frozen.
bool can_freeze;
// List of human-readable reasons why a tab can't be frozen.
@@ -106,7 +108,7 @@ struct TabDiscardsInfo {
// session.
int32 discard_count;
// If the tab is currently discarded, the discard reason.
- LifecycleUnitDiscardReason discard_reason;
+ mojom.LifecycleUnitDiscardReason discard_reason;
// The rank of the tab in the "importance to user" list. The tab with 1 is the
// most important, the tab with N is the least important.
int32 utility_rank;
@@ -135,7 +137,7 @@ struct TabDiscardsInfo {
// Interface for providing information about discards. Lives in the browser
// process and is invoked in the renderer process via Javascript code running in
// the chrome://discards WebUI.
-interface DiscardsDetailsProvider {
+interface DetailsProvider {
// Returns an array of TabDiscardsInfo containing discard information about
// each tab currently open in the browser, across all profiles.
GetTabDiscardsInfo() => (array<TabDiscardsInfo> infos);
@@ -177,3 +179,72 @@ interface DiscardsDetailsProvider {
// if the decision was made not to discard.
Discard(bool urgent) => ();
};
+
+// Represents the momentary state of a Page CU.
+struct PageInfo {
+ int64 id;
+
+ url.mojom.Url main_frame_url;
+
+ // TODO(siggi): Estimate data.
+};
+
+// Represents the momentary state of a Frame CU.
+struct FrameInfo {
+ int64 id;
+
+ url.mojom.Url url;
+ int64 page_id;
+ int64 parent_frame_id;
+ int64 process_id;
+};
+
+// Represents the momentary state of a Process CU.
+struct ProcessInfo {
+ int64 id;
+
+ mojo_base.mojom.ProcessId pid;
+ mojo_base.mojom.TimeDelta cumulative_cpu_usage;
+ uint64 private_footprint_kb;
+};
+
+// Used to transport favicon data.
+struct FavIconInfo {
+ int64 node_id;
+
+ // Contains the base64-encoded icon data, suitable for inclusion in a
+ // data URL.
+ string icon_data;
+};
+
+// Implement to receive a stream of notifications when performance manager
+// graph nodes are created, changed or deleted.
+interface GraphChangeStream {
+ // The |frame| was created.
+ FrameCreated(FrameInfo frame);
+ // The |page| was created.
+ PageCreated(PageInfo pages);
+ // The |process| was created.
+ ProcessCreated(ProcessInfo process);
+
+ // The |frame| changed.
+ FrameChanged(FrameInfo frame);
+ // The |page| changed.
+ PageChanged(PageInfo page);
+ // The |process| changed.
+ ProcessChanged(ProcessInfo process);
+
+ // A |favicon| became available, whether because the associated page changed
+ // its favicon, or because an initial lookup completed.
+ FavIconDataAvailable(FavIconInfo favicon);
+
+ // The node with |node_id| was deleted.
+ NodeDeleted(int64 node_id);
+};
+
+// This interface allows subscribing to a stream of events that track the state
+// of the performance manager graph.
+interface GraphDump {
+ // Subscribes |change_subscriber| to a graph change stream.
+ SubscribeToChanges(pending_remote<GraphChangeStream> change_subscriber);
+};
diff --git a/chromium/chrome/browser/ui/webui/discards/discards_ui.cc b/chromium/chrome/browser/ui/webui/discards/discards_ui.cc
index 04bc887b3d3..e37e9dfd219 100644
--- a/chromium/chrome/browser/ui/webui/discards/discards_ui.cc
+++ b/chromium/chrome/browser/ui/webui/discards/discards_ui.cc
@@ -14,8 +14,6 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/engagement/site_engagement_service.h"
-#include "chrome/browser/performance_manager/performance_manager.h"
-#include "chrome/browser/performance_manager/webui_graph_dump_impl.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/resource_coordinator/lifecycle_unit.h"
#include "chrome/browser/resource_coordinator/lifecycle_unit_state.mojom.h"
@@ -27,10 +25,12 @@
#include "chrome/browser/resource_coordinator/tab_manager.h"
#include "chrome/browser/resource_coordinator/time.h"
#include "chrome/browser/ui/webui/discards/discards.mojom.h"
+#include "chrome/browser/ui/webui/discards/graph_dump_impl.h"
#include "chrome/browser/ui/webui/favicon_source.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "components/favicon_base/favicon_url_parser.h"
+#include "components/performance_manager/public/performance_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/url_data_source.h"
@@ -38,8 +38,8 @@
#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 "mojo/public/cpp/bindings/binding.h"
-#include "services/resource_coordinator/public/mojom/service_constants.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "ui/resources/grit/ui_resources.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -51,19 +51,19 @@ mojom::LifecycleUnitDiscardReason GetDiscardReason(bool urgent) {
: mojom::LifecycleUnitDiscardReason::PROACTIVE;
}
-mojom::LifecycleUnitVisibility GetLifecycleUnitVisibility(
+discards::mojom::LifecycleUnitVisibility GetLifecycleUnitVisibility(
content::Visibility visibility) {
switch (visibility) {
case content::Visibility::HIDDEN:
- return mojom::LifecycleUnitVisibility::HIDDEN;
+ return discards::mojom::LifecycleUnitVisibility::HIDDEN;
case content::Visibility::OCCLUDED:
- return mojom::LifecycleUnitVisibility::OCCLUDED;
+ return discards::mojom::LifecycleUnitVisibility::OCCLUDED;
case content::Visibility::VISIBLE:
- return mojom::LifecycleUnitVisibility::VISIBLE;
+ return discards::mojom::LifecycleUnitVisibility::VISIBLE;
}
#if defined(COMPILER_MSVC)
NOTREACHED();
- return mojom::LifecycleUnitVisibility::VISIBLE;
+ return discards::mojom::LifecycleUnitVisibility::VISIBLE;
#endif
}
@@ -93,10 +93,10 @@ double GetSiteEngagementScore(content::WebContents* contents) {
return engagement_svc->GetDetails(nav_entry->GetURL()).total_score;
}
-mojom::SiteCharacteristicsFeaturePtr ConvertFeatureFromProto(
+discards::mojom::SiteCharacteristicsFeaturePtr ConvertFeatureFromProto(
const SiteDataFeatureProto& proto) {
- mojom::SiteCharacteristicsFeaturePtr feature =
- mojom::SiteCharacteristicsFeature::New();
+ discards::mojom::SiteCharacteristicsFeaturePtr feature =
+ discards::mojom::SiteCharacteristicsFeature::New();
if (proto.has_observation_duration()) {
feature->observation_duration = proto.observation_duration();
@@ -113,10 +113,10 @@ mojom::SiteCharacteristicsFeaturePtr ConvertFeatureFromProto(
return feature;
}
-mojom::SiteCharacteristicsDatabaseEntryPtr ConvertEntryFromProto(
+discards::mojom::SiteCharacteristicsDatabaseEntryPtr ConvertEntryFromProto(
SiteDataProto* proto) {
- mojom::SiteCharacteristicsDatabaseValuePtr value =
- mojom::SiteCharacteristicsDatabaseValue::New();
+ discards::mojom::SiteCharacteristicsDatabaseValuePtr value =
+ discards::mojom::SiteCharacteristicsDatabaseValue::New();
if (proto->has_last_loaded()) {
value->last_loaded = proto->last_loaded();
@@ -137,8 +137,9 @@ mojom::SiteCharacteristicsDatabaseEntryPtr ConvertEntryFromProto(
DCHECK(load_time_estimates_proto.has_avg_cpu_usage_us());
DCHECK(load_time_estimates_proto.has_avg_footprint_kb());
- mojom::SiteCharacteristicsPerformanceMeasurementPtr load_time_estimates =
- mojom::SiteCharacteristicsPerformanceMeasurement::New();
+ discards::mojom::SiteCharacteristicsPerformanceMeasurementPtr
+ load_time_estimates =
+ discards::mojom::SiteCharacteristicsPerformanceMeasurement::New();
if (load_time_estimates_proto.has_avg_cpu_usage_us()) {
load_time_estimates->avg_cpu_usage_us =
load_time_estimates_proto.avg_cpu_usage_us();
@@ -155,32 +156,32 @@ mojom::SiteCharacteristicsDatabaseEntryPtr ConvertEntryFromProto(
value->load_time_estimates = std::move(load_time_estimates);
}
- mojom::SiteCharacteristicsDatabaseEntryPtr entry =
- mojom::SiteCharacteristicsDatabaseEntry::New();
+ discards::mojom::SiteCharacteristicsDatabaseEntryPtr entry =
+ discards::mojom::SiteCharacteristicsDatabaseEntry::New();
entry->value = std::move(value);
return entry;
}
-class DiscardsDetailsProviderImpl : public mojom::DiscardsDetailsProvider {
+class DiscardsDetailsProviderImpl : public discards::mojom::DetailsProvider {
public:
// This instance is deleted when the supplied pipe is destroyed.
DiscardsDetailsProviderImpl(
resource_coordinator::LocalSiteCharacteristicsDataStoreInspector*
data_store_inspector,
- mojo::InterfaceRequest<mojom::DiscardsDetailsProvider> request)
+ mojo::PendingReceiver<discards::mojom::DetailsProvider> receiver)
: data_store_inspector_(data_store_inspector),
- binding_(this, std::move(request)) {}
+ receiver_(this, std::move(receiver)) {}
~DiscardsDetailsProviderImpl() override {}
- // mojom::DiscardsDetailsProvider overrides:
+ // discards::mojom::DetailsProvider overrides:
void GetTabDiscardsInfo(GetTabDiscardsInfoCallback callback) override {
resource_coordinator::TabManager* tab_manager =
g_browser_process->GetTabManager();
const resource_coordinator::LifecycleUnitVector lifecycle_units =
tab_manager->GetSortedLifecycleUnits();
- std::vector<mojom::TabDiscardsInfoPtr> infos;
+ std::vector<discards::mojom::TabDiscardsInfoPtr> infos;
infos.reserve(lifecycle_units.size());
const base::TimeTicks now = resource_coordinator::NowTicks();
@@ -188,7 +189,8 @@ class DiscardsDetailsProviderImpl : public mojom::DiscardsDetailsProvider {
// Convert the LifecycleUnits to a vector of TabDiscardsInfos.
size_t rank = 1;
for (auto* lifecycle_unit : lifecycle_units) {
- mojom::TabDiscardsInfoPtr info(mojom::TabDiscardsInfo::New());
+ discards::mojom::TabDiscardsInfoPtr info(
+ discards::mojom::TabDiscardsInfo::New());
resource_coordinator::TabLifecycleUnitExternal*
tab_lifecycle_unit_external =
@@ -308,7 +310,7 @@ class DiscardsDetailsProviderImpl : public mojom::DiscardsDetailsProvider {
OriginToReaderMap requested_origins_;
LocalSiteCharacteristicsDataStoreInspector* data_store_inspector_;
- mojo::Binding<mojom::DiscardsDetailsProvider> binding_;
+ mojo::Receiver<discards::mojom::DetailsProvider> receiver_;
DISALLOW_COPY_AND_ASSIGN(DiscardsDetailsProviderImpl);
};
@@ -344,8 +346,8 @@ void DiscardsDetailsProviderImpl::GetSiteCharacteristicsDatabase(
}
}
- mojom::SiteCharacteristicsDatabasePtr result =
- mojom::SiteCharacteristicsDatabase::New();
+ discards::mojom::SiteCharacteristicsDatabasePtr result =
+ discards::mojom::SiteCharacteristicsDatabase::New();
std::vector<url::Origin> in_memory_origins =
data_store_inspector_->GetAllInMemoryOrigins();
for (const url::Origin& origin : in_memory_origins) {
@@ -378,8 +380,8 @@ void DiscardsDetailsProviderImpl::GetSiteCharacteristicsDatabaseSize(
[](GetSiteCharacteristicsDatabaseSizeCallback callback,
base::Optional<int64_t> num_rows,
base::Optional<int64_t> on_disk_size_kb) {
- mojom::SiteCharacteristicsDatabaseSizePtr result =
- mojom::SiteCharacteristicsDatabaseSize::New();
+ discards::mojom::SiteCharacteristicsDatabaseSizePtr result =
+ discards::mojom::SiteCharacteristicsDatabaseSize::New();
result->num_rows = num_rows.has_value() ? num_rows.value() : -1;
result->on_disk_size_kb =
on_disk_size_kb.has_value() ? on_disk_size_kb.value() : -1;
@@ -425,8 +427,6 @@ DiscardsUI::DiscardsUI(content::WebUI* web_ui)
source->AddResourcePath(
"chrome/browser/resource_coordinator/lifecycle_unit_state.mojom-lite.js",
IDR_DISCARDS_LIFECYCLE_UNIT_STATE_MOJOM_LITE_JS);
- source->AddResourcePath("mojom/webui_graph_dump.mojom-lite.js",
- IDR_DISCARDS_WEBUI_GRAPH_DUMP_MOJOM_LITE_JS);
// Add the mojo base dependency for the WebUI Graph Dump.
source->AddResourcePath(
@@ -445,7 +445,7 @@ DiscardsUI::DiscardsUI(content::WebUI* web_ui)
AddHandlerToRegistry(base::BindRepeating(
&DiscardsUI::BindDiscardsDetailsProvider, base::Unretained(this)));
AddHandlerToRegistry(base::BindRepeating(
- &DiscardsUI::BindWebUIGraphDumpProvider, base::Unretained(this)));
+ &DiscardsUI::BindDiscardsGraphDumpProvider, base::Unretained(this)));
data_store_inspector_ = resource_coordinator::
LocalSiteCharacteristicsDataStoreInspector::GetForProfile(profile);
@@ -454,20 +454,17 @@ DiscardsUI::DiscardsUI(content::WebUI* web_ui)
DiscardsUI::~DiscardsUI() {}
void DiscardsUI::BindDiscardsDetailsProvider(
- mojom::DiscardsDetailsProviderRequest request) {
+ mojo::PendingReceiver<discards::mojom::DetailsProvider> receiver) {
ui_handler_ = std::make_unique<DiscardsDetailsProviderImpl>(
- data_store_inspector_, std::move(request));
+ data_store_inspector_, std::move(receiver));
}
-void DiscardsUI::BindWebUIGraphDumpProvider(
- performance_manager::mojom::WebUIGraphDumpRequest request) {
- performance_manager::PerformanceManager* performance_manager =
- performance_manager::PerformanceManager::GetInstance();
- if (performance_manager) {
- // Forward the interface request directly to the service.
- performance_manager->CallOnGraph(
- FROM_HERE,
- base::BindOnce(&performance_manager::WebUIGraphDumpImpl::CreateAndBind,
- std::move(request)));
+void DiscardsUI::BindDiscardsGraphDumpProvider(
+ mojo::PendingReceiver<discards::mojom::GraphDump> receiver) {
+ if (performance_manager::PerformanceManager::IsAvailable()) {
+ // Forward the interface receiver directly to the service.
+ performance_manager::PerformanceManager::CallOnGraph(
+ FROM_HERE, base::BindOnce(&DiscardsGraphDumpImpl::CreateAndBind,
+ std::move(receiver)));
}
}
diff --git a/chromium/chrome/browser/ui/webui/discards/discards_ui.h b/chromium/chrome/browser/ui/webui/discards/discards_ui.h
index 1ec8c1c6657..fa360e2f090 100644
--- a/chromium/chrome/browser/ui/webui/discards/discards_ui.h
+++ b/chromium/chrome/browser/ui/webui/discards/discards_ui.h
@@ -8,8 +8,8 @@
#include <memory>
#include "base/macros.h"
-#include "chrome/browser/performance_manager/webui_graph_dump.mojom.h"
#include "chrome/browser/ui/webui/discards/discards.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
namespace resource_coordinator {
@@ -25,11 +25,11 @@ class DiscardsUI : public ui::MojoWebUIController {
private:
void BindDiscardsDetailsProvider(
- mojom::DiscardsDetailsProviderRequest request);
- void BindWebUIGraphDumpProvider(
- performance_manager::mojom::WebUIGraphDumpRequest request);
+ mojo::PendingReceiver<discards::mojom::DetailsProvider> receiver);
+ void BindDiscardsGraphDumpProvider(
+ mojo::PendingReceiver<discards::mojom::GraphDump> receiver);
- std::unique_ptr<mojom::DiscardsDetailsProvider> ui_handler_;
+ std::unique_ptr<discards::mojom::DetailsProvider> ui_handler_;
resource_coordinator::LocalSiteCharacteristicsDataStoreInspector*
data_store_inspector_;
diff --git a/chromium/chrome/browser/ui/webui/discards/graph_dump_impl.cc b/chromium/chrome/browser/ui/webui/discards/graph_dump_impl.cc
new file mode 100644
index 00000000000..76662a2a199
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/discards/graph_dump_impl.cc
@@ -0,0 +1,396 @@
+// 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/ui/webui/discards/graph_dump_impl.h"
+
+#include <memory>
+#include <utility>
+
+#include "base/base64.h"
+#include "base/bind.h"
+#include "base/macros.h"
+#include "base/task/cancelable_task_tracker.h"
+#include "base/task/post_task.h"
+#include "base/threading/sequenced_task_runner_handle.h"
+#include "chrome/browser/favicon/favicon_service_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/discards/discards.mojom.h"
+#include "components/favicon/core/favicon_service.h"
+#include "components/favicon_base/favicon_callback.h"
+#include "components/performance_manager/public/graph/graph.h"
+#include "components/performance_manager/public/performance_manager.h"
+#include "components/performance_manager/public/web_contents_proxy.h"
+#include "content/public/browser/browser_task_traits.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/web_contents.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
+
+namespace {
+
+int64_t GetSerializationId(const performance_manager::Node* node) {
+ return performance_manager::Node::GetSerializationId(node);
+}
+
+} // namespace
+
+class DiscardsGraphDumpImpl::FaviconRequestHelper {
+ public:
+ FaviconRequestHelper(base::WeakPtr<DiscardsGraphDumpImpl> graph_dump,
+ scoped_refptr<base::SequencedTaskRunner> task_runner);
+
+ void RequestFavicon(GURL page_url,
+ performance_manager::WebContentsProxy contents_proxy,
+ int64_t serialization_id);
+ void FaviconDataAvailable(int64_t serialization_id,
+ const favicon_base::FaviconRawBitmapResult& result);
+
+ private:
+ std::unique_ptr<base::CancelableTaskTracker> cancelable_task_tracker_;
+
+ base::WeakPtr<DiscardsGraphDumpImpl> graph_dump_;
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
+
+ SEQUENCE_CHECKER(sequence_checker_);
+
+ DISALLOW_COPY_AND_ASSIGN(FaviconRequestHelper);
+};
+
+DiscardsGraphDumpImpl::FaviconRequestHelper::FaviconRequestHelper(
+ base::WeakPtr<DiscardsGraphDumpImpl> graph_dump,
+ scoped_refptr<base::SequencedTaskRunner> task_runner)
+ : graph_dump_(graph_dump), task_runner_(task_runner) {
+ DETACH_FROM_SEQUENCE(sequence_checker_);
+}
+
+void DiscardsGraphDumpImpl::FaviconRequestHelper::RequestFavicon(
+ GURL page_url,
+ performance_manager::WebContentsProxy contents_proxy,
+ int64_t serialization_id) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ content::WebContents* web_contents = contents_proxy.Get();
+ if (!web_contents)
+ return;
+
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ if (!profile)
+ return;
+
+ favicon::FaviconService* favicon_service =
+ FaviconServiceFactory::GetForProfile(profile,
+ ServiceAccessType::EXPLICIT_ACCESS);
+ if (!favicon_service)
+ return;
+
+ if (!cancelable_task_tracker_)
+ cancelable_task_tracker_ = std::make_unique<base::CancelableTaskTracker>();
+
+ constexpr size_t kIconSize = 16;
+ constexpr bool kFallbackToHost = true;
+ // It's safe to pass this unretained here, as the tasks are cancelled
+ // on deletion of the cancelable task tracker.
+ favicon_service->GetRawFaviconForPageURL(
+ page_url, {favicon_base::IconType::kFavicon}, kIconSize, kFallbackToHost,
+ base::BindRepeating(&FaviconRequestHelper::FaviconDataAvailable,
+ base::Unretained(this), serialization_id),
+ cancelable_task_tracker_.get());
+}
+
+void DiscardsGraphDumpImpl::FaviconRequestHelper::FaviconDataAvailable(
+ int64_t serialization_id,
+ const favicon_base::FaviconRawBitmapResult& result) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ if (!result.is_valid())
+ return;
+
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(&DiscardsGraphDumpImpl::SendFaviconNotification,
+ graph_dump_, serialization_id, result.bitmap_data));
+}
+
+DiscardsGraphDumpImpl::DiscardsGraphDumpImpl() {}
+
+DiscardsGraphDumpImpl::~DiscardsGraphDumpImpl() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(!graph_);
+ DCHECK(!change_subscriber_);
+ DCHECK(!favicon_request_helper_);
+}
+
+// static
+void DiscardsGraphDumpImpl::CreateAndBind(
+ mojo::PendingReceiver<discards::mojom::GraphDump> receiver,
+ performance_manager::Graph* graph) {
+ std::unique_ptr<DiscardsGraphDumpImpl> dump =
+ std::make_unique<DiscardsGraphDumpImpl>();
+
+ dump->BindWithGraph(graph, std::move(receiver));
+ graph->PassToGraph(std::move(dump));
+}
+
+void DiscardsGraphDumpImpl::BindWithGraph(
+ performance_manager::Graph* graph,
+ mojo::PendingReceiver<discards::mojom::GraphDump> receiver) {
+ receiver_.Bind(std::move(receiver));
+ receiver_.set_disconnect_handler(base::BindOnce(
+ &DiscardsGraphDumpImpl::OnConnectionError, base::Unretained(this)));
+}
+
+namespace {
+
+template <typename FunctionType>
+void ForFrameAndOffspring(const performance_manager::FrameNode* parent_frame,
+ FunctionType on_frame) {
+ on_frame(parent_frame);
+
+ for (const performance_manager::FrameNode* child_frame :
+ parent_frame->GetChildFrameNodes())
+ ForFrameAndOffspring(child_frame, on_frame);
+}
+
+} // namespace
+
+void DiscardsGraphDumpImpl::SubscribeToChanges(
+ mojo::PendingRemote<discards::mojom::GraphChangeStream> change_subscriber) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ change_subscriber_.Bind(std::move(change_subscriber));
+
+ // Send creation notifications for all existing nodes.
+ for (const performance_manager::ProcessNode* process_node :
+ graph_->GetAllProcessNodes())
+ SendProcessNotification(process_node, true);
+
+ for (const performance_manager::PageNode* page_node :
+ graph_->GetAllPageNodes()) {
+ SendPageNotification(page_node, true);
+ StartPageFaviconRequest(page_node);
+
+ // Dispatch preorder frame notifications.
+ for (const performance_manager::FrameNode* main_frame_node :
+ page_node->GetMainFrameNodes()) {
+ ForFrameAndOffspring(
+ main_frame_node,
+ [this](const performance_manager::FrameNode* frame_node) {
+ this->SendFrameNotification(frame_node, true);
+ this->StartFrameFaviconRequest(frame_node);
+ });
+ }
+ }
+
+ // Subscribe to subsequent notifications.
+ graph_->AddFrameNodeObserver(this);
+ graph_->AddPageNodeObserver(this);
+ graph_->AddProcessNodeObserver(this);
+}
+
+void DiscardsGraphDumpImpl::OnPassedToGraph(performance_manager::Graph* graph) {
+ DCHECK(!graph_);
+ graph_ = graph;
+}
+
+void DiscardsGraphDumpImpl::OnTakenFromGraph(
+ performance_manager::Graph* graph) {
+ DCHECK_EQ(graph_, graph);
+
+ if (change_subscriber_) {
+ graph_->RemoveFrameNodeObserver(this);
+ graph_->RemovePageNodeObserver(this);
+ graph_->RemoveProcessNodeObserver(this);
+ }
+
+ change_subscriber_.reset();
+
+ // The favicon helper must be deleted on the UI thread.
+ if (favicon_request_helper_) {
+ content::BrowserThread::DeleteSoon(content::BrowserThread::UI, FROM_HERE,
+ std::move(favicon_request_helper_));
+ }
+
+ graph_ = nullptr;
+}
+
+void DiscardsGraphDumpImpl::OnFrameNodeAdded(
+ const performance_manager::FrameNode* frame_node) {
+ SendFrameNotification(frame_node, true);
+ StartFrameFaviconRequest(frame_node);
+}
+
+void DiscardsGraphDumpImpl::OnBeforeFrameNodeRemoved(
+ const performance_manager::FrameNode* frame_node) {
+ SendDeletionNotification(frame_node);
+}
+
+void DiscardsGraphDumpImpl::OnURLChanged(
+ const performance_manager::FrameNode* frame_node,
+ const GURL& previous_value) {
+ SendFrameNotification(frame_node, false);
+ StartFrameFaviconRequest(frame_node);
+}
+
+void DiscardsGraphDumpImpl::OnPageNodeAdded(
+ const performance_manager::PageNode* page_node) {
+ SendPageNotification(page_node, true);
+ StartPageFaviconRequest(page_node);
+}
+
+void DiscardsGraphDumpImpl::OnBeforePageNodeRemoved(
+ const performance_manager::PageNode* page_node) {
+ SendDeletionNotification(page_node);
+}
+
+void DiscardsGraphDumpImpl::OnFaviconUpdated(
+ const performance_manager::PageNode* page_node) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ StartPageFaviconRequest(page_node);
+}
+
+void DiscardsGraphDumpImpl::OnMainFrameUrlChanged(
+ const performance_manager::PageNode* page_node) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ SendPageNotification(page_node, false);
+}
+
+void DiscardsGraphDumpImpl::OnProcessNodeAdded(
+ const performance_manager::ProcessNode* process_node) {
+ SendProcessNotification(process_node, true);
+}
+
+void DiscardsGraphDumpImpl::OnProcessLifetimeChange(
+ const performance_manager::ProcessNode* process_node) {
+ SendProcessNotification(process_node, false);
+}
+
+void DiscardsGraphDumpImpl::OnBeforeProcessNodeRemoved(
+ const performance_manager::ProcessNode* process_node) {
+ SendDeletionNotification(process_node);
+}
+
+DiscardsGraphDumpImpl::FaviconRequestHelper*
+DiscardsGraphDumpImpl::EnsureFaviconRequestHelper() {
+ if (!favicon_request_helper_) {
+ favicon_request_helper_ = std::make_unique<FaviconRequestHelper>(
+ weak_factory_.GetWeakPtr(), base::SequencedTaskRunnerHandle::Get());
+ }
+
+ return favicon_request_helper_.get();
+}
+
+void DiscardsGraphDumpImpl::StartPageFaviconRequest(
+ const performance_manager::PageNode* page_node) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ if (!page_node->GetMainFrameUrl().is_valid())
+ return;
+
+ base::PostTask(FROM_HERE, {content::BrowserThread::UI},
+ base::BindOnce(&FaviconRequestHelper::RequestFavicon,
+ base::Unretained(EnsureFaviconRequestHelper()),
+ page_node->GetMainFrameUrl(),
+ page_node->GetContentsProxy(),
+ GetSerializationId(page_node)));
+}
+
+void DiscardsGraphDumpImpl::StartFrameFaviconRequest(
+ const performance_manager::FrameNode* frame_node) {
+ if (!frame_node->GetURL().is_valid())
+ return;
+
+ base::PostTask(FROM_HERE, {content::BrowserThread::UI},
+ base::BindOnce(&FaviconRequestHelper::RequestFavicon,
+ base::Unretained(EnsureFaviconRequestHelper()),
+ frame_node->GetURL(),
+ frame_node->GetPageNode()->GetContentsProxy(),
+ GetSerializationId(frame_node)));
+}
+
+void DiscardsGraphDumpImpl::SendFrameNotification(
+ const performance_manager::FrameNode* frame,
+ bool created) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ // TODO(https://crbug.com/961785): Add more frame properties.
+ discards::mojom::FrameInfoPtr frame_info = discards::mojom::FrameInfo::New();
+
+ frame_info->id = GetSerializationId(frame);
+
+ auto* parent_frame = frame->GetParentFrameNode();
+ frame_info->parent_frame_id = GetSerializationId(parent_frame);
+
+ auto* process = frame->GetProcessNode();
+ frame_info->process_id = GetSerializationId(process);
+
+ auto* page = frame->GetPageNode();
+ frame_info->page_id = GetSerializationId(page);
+
+ frame_info->url = frame->GetURL();
+
+ if (created)
+ change_subscriber_->FrameCreated(std::move(frame_info));
+ else
+ change_subscriber_->FrameChanged(std::move(frame_info));
+}
+
+void DiscardsGraphDumpImpl::SendPageNotification(
+ const performance_manager::PageNode* page_node,
+ bool created) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ // TODO(https://crbug.com/961785): Add more page_node properties.
+ discards::mojom::PageInfoPtr page_info = discards::mojom::PageInfo::New();
+
+ page_info->id = GetSerializationId(page_node);
+ page_info->main_frame_url = page_node->GetMainFrameUrl();
+ if (created)
+ change_subscriber_->PageCreated(std::move(page_info));
+ else
+ change_subscriber_->PageChanged(std::move(page_info));
+}
+
+void DiscardsGraphDumpImpl::SendProcessNotification(
+ const performance_manager::ProcessNode* process,
+ bool created) {
+ // TODO(https://crbug.com/961785): Add more process properties.
+ discards::mojom::ProcessInfoPtr process_info =
+ discards::mojom::ProcessInfo::New();
+
+ process_info->id = GetSerializationId(process);
+ process_info->pid = process->GetProcessId();
+ process_info->cumulative_cpu_usage = process->GetCumulativeCpuUsage();
+ process_info->private_footprint_kb = process->GetPrivateFootprintKb();
+
+ if (created)
+ change_subscriber_->ProcessCreated(std::move(process_info));
+ else
+ change_subscriber_->ProcessChanged(std::move(process_info));
+}
+
+void DiscardsGraphDumpImpl::SendDeletionNotification(
+ const performance_manager::Node* node) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ change_subscriber_->NodeDeleted(GetSerializationId(node));
+}
+
+void DiscardsGraphDumpImpl::SendFaviconNotification(
+ int64_t serialization_id,
+ scoped_refptr<base::RefCountedMemory> bitmap_data) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK_NE(0u, bitmap_data->size());
+
+ discards::mojom::FavIconInfoPtr icon_info =
+ discards::mojom::FavIconInfo::New();
+ icon_info->node_id = serialization_id;
+
+ base::Base64Encode(
+ base::StringPiece(reinterpret_cast<const char*>(bitmap_data->front()),
+ bitmap_data->size()),
+ &icon_info->icon_data);
+
+ change_subscriber_->FavIconDataAvailable(std::move(icon_info));
+}
+
+// static
+void DiscardsGraphDumpImpl::OnConnectionError(DiscardsGraphDumpImpl* impl) {
+ std::unique_ptr<GraphOwned> owned_impl = impl->graph_->TakeFromGraph(impl);
+}
diff --git a/chromium/chrome/browser/ui/webui/discards/graph_dump_impl.h b/chromium/chrome/browser/ui/webui/discards/graph_dump_impl.h
new file mode 100644
index 00000000000..b973761978a
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/discards/graph_dump_impl.h
@@ -0,0 +1,187 @@
+// 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.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_DISCARDS_GRAPH_DUMP_IMPL_H_
+#define CHROME_BROWSER_UI_WEBUI_DISCARDS_GRAPH_DUMP_IMPL_H_
+
+#include <memory>
+
+#include "base/memory/ref_counted_memory.h"
+#include "base/memory/weak_ptr.h"
+#include "base/sequence_checker.h"
+#include "chrome/browser/ui/webui/discards/discards.mojom.h"
+#include "components/performance_manager/public/graph/frame_node.h"
+#include "components/performance_manager/public/graph/graph.h"
+#include "components/performance_manager/public/graph/page_node.h"
+#include "components/performance_manager/public/graph/process_node.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
+
+// TODO(siggi): Add workers to the WebUI graph.
+class DiscardsGraphDumpImpl : public discards::mojom::GraphDump,
+ public performance_manager::GraphOwned,
+ public performance_manager::FrameNodeObserver,
+ public performance_manager::PageNodeObserver,
+ public performance_manager::ProcessNodeObserver {
+ public:
+ DiscardsGraphDumpImpl();
+ ~DiscardsGraphDumpImpl() override;
+
+ // Creates a new DiscardsGraphDumpImpl to service |receiver| and passes its
+ // ownership to |graph|.
+ static void CreateAndBind(
+ mojo::PendingReceiver<discards::mojom::GraphDump> receiver,
+ performance_manager::Graph* graph);
+
+ // Exposed for testing.
+ void BindWithGraph(
+ performance_manager::Graph* graph,
+ mojo::PendingReceiver<discards::mojom::GraphDump> receiver);
+
+ protected:
+ // WebUIGraphDump implementation.
+ void SubscribeToChanges(
+ mojo::PendingRemote<discards::mojom::GraphChangeStream> change_subscriber)
+ override;
+
+ // GraphOwned implementation.
+ void OnPassedToGraph(performance_manager::Graph* graph) override;
+ void OnTakenFromGraph(performance_manager::Graph* graph) override;
+
+ // FrameNodeObserver implementation:
+ void OnFrameNodeAdded(
+ const performance_manager::FrameNode* frame_node) override;
+ void OnBeforeFrameNodeRemoved(
+ const performance_manager::FrameNode* frame_node) override;
+ // Ignored.
+ void OnIsCurrentChanged(
+ const performance_manager::FrameNode* frame_node) override {}
+ // Ignored.
+ void OnNetworkAlmostIdleChanged(
+ const performance_manager::FrameNode* frame_node) override {}
+ // Ignored.
+ void OnFrameLifecycleStateChanged(
+ const performance_manager::FrameNode* frame_node) override {}
+ // Ignored.
+ void OnOriginTrialFreezePolicyChanged(
+ const performance_manager::FrameNode* frame_node,
+ const InterventionPolicy& previous_value) override {}
+ void OnURLChanged(const performance_manager::FrameNode* frame_node,
+ const GURL& previous_value) override;
+ // Ignored.
+ void OnIsAdFrameChanged(
+ const performance_manager::FrameNode* frame_node) override {}
+ // Ignored.
+ void OnFrameIsHoldingWebLockChanged(
+ const performance_manager::FrameNode* frame_node) override {}
+ // Ignored.
+ void OnFrameIsHoldingIndexedDBLockChanged(
+ const performance_manager::FrameNode* frame_node) override {}
+ // Ignored.
+ void OnNonPersistentNotificationCreated(
+ const performance_manager::FrameNode* frame_node) override {}
+ // Ignored.
+ void OnPriorityAndReasonChanged(
+ const performance_manager::FrameNode* frame_node) override {}
+
+ // PageNodeObserver implementation:
+ void OnPageNodeAdded(const performance_manager::PageNode* page_node) override;
+ void OnBeforePageNodeRemoved(
+ const performance_manager::PageNode* page_node) override;
+ void OnIsVisibleChanged(
+ const performance_manager::PageNode* page_node) override {} // Ignored.
+ void OnIsAudibleChanged(
+ const performance_manager::PageNode* page_node) override {} // Ignored.
+ void OnIsLoadingChanged(
+ const performance_manager::PageNode* page_node) override {} // Ignored.
+ void OnUkmSourceIdChanged(
+ const performance_manager::PageNode* page_node) override {} // Ignored.
+ // Ignored.
+ void OnPageLifecycleStateChanged(
+ const performance_manager::PageNode* page_node) override {}
+ // Ignored.
+ void OnPageOriginTrialFreezePolicyChanged(
+ const performance_manager::PageNode* page_node) override {}
+ // Ignored.
+ void OnPageIsHoldingWebLockChanged(
+ const performance_manager::PageNode* page_node) override {}
+ // Ignored.
+ void OnPageIsHoldingIndexedDBLockChanged(
+ const performance_manager::PageNode* page_node) override {}
+ void OnMainFrameUrlChanged(
+ const performance_manager::PageNode* page_node) override;
+ // Ignored.
+ void OnPageAlmostIdleChanged(
+ const performance_manager::PageNode* page_node) override {}
+ void OnMainFrameDocumentChanged(
+ const performance_manager::PageNode* page_node) override {}
+ void OnTitleUpdated(const performance_manager::PageNode* page_node) override {
+ } // Ignored.
+ void OnFaviconUpdated(
+ const performance_manager::PageNode* page_node) override;
+
+ // ProcessNodeObserver implementation:
+ void OnProcessNodeAdded(
+ const performance_manager::ProcessNode* process_node) override;
+ void OnProcessLifetimeChange(
+ const performance_manager::ProcessNode* process_node) override;
+ void OnBeforeProcessNodeRemoved(
+ const performance_manager::ProcessNode* process_node) override;
+ void OnExpectedTaskQueueingDurationSample(
+ const performance_manager::ProcessNode* process_node) override {
+ } // Ignored.
+ // Ignored.
+ void OnMainThreadTaskLoadIsLow(
+ const performance_manager::ProcessNode* process_node) override {}
+ // Ignored.
+ void OnAllFramesInProcessFrozen(
+ const performance_manager::ProcessNode* process_node) override {}
+
+ private:
+ // The favicon requests happen on the UI thread. This helper class
+ // maintains the state required to do that.
+ class FaviconRequestHelper;
+
+ FaviconRequestHelper* EnsureFaviconRequestHelper();
+
+ void StartPageFaviconRequest(const performance_manager::PageNode* page_node);
+ void StartFrameFaviconRequest(
+ const performance_manager::FrameNode* frame_node);
+
+ void SendFrameNotification(const performance_manager::FrameNode* frame,
+ bool created);
+ void SendPageNotification(const performance_manager::PageNode* page,
+ bool created);
+ void SendProcessNotification(const performance_manager::ProcessNode* process,
+ bool created);
+ void SendDeletionNotification(const performance_manager::Node* node);
+ void SendFaviconNotification(
+ int64_t serialization_id,
+ scoped_refptr<base::RefCountedMemory> bitmap_data);
+
+ static void BindOnPMSequence(
+ mojo::PendingReceiver<discards::mojom::GraphDump> receiver,
+ performance_manager::Graph* graph);
+ static void OnConnectionError(DiscardsGraphDumpImpl* impl);
+
+ performance_manager::Graph* graph_ = nullptr;
+
+ std::unique_ptr<FaviconRequestHelper> favicon_request_helper_;
+
+ // The current change subscriber to this dumper. This instance is subscribed
+ // to every node in |graph_| save for the system node, so long as there is a
+ // subscriber.
+ mojo::Remote<discards::mojom::GraphChangeStream> change_subscriber_;
+ mojo::Receiver<discards::mojom::GraphDump> receiver_{this};
+
+ SEQUENCE_CHECKER(sequence_checker_);
+
+ base::WeakPtrFactory<DiscardsGraphDumpImpl> weak_factory_{this};
+
+ DISALLOW_COPY_AND_ASSIGN(DiscardsGraphDumpImpl);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_DISCARDS_GRAPH_DUMP_IMPL_H_
diff --git a/chromium/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc b/chromium/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc
new file mode 100644
index 00000000000..8cdbbdd70a9
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc
@@ -0,0 +1,224 @@
+// 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/discards/graph_dump_impl.h"
+
+#include <map>
+#include <set>
+#include <utility>
+
+#include "base/run_loop.h"
+#include "base/stl_util.h"
+#include "base/test/bind_test_util.h"
+#include "base/time/time.h"
+#include "chrome/browser/ui/webui/discards/discards.mojom.h"
+#include "components/performance_manager/test_support/graph_impl.h"
+#include "components/performance_manager/test_support/mock_graphs.h"
+#include "content/public/test/browser_task_environment.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+using performance_manager::NodeBase;
+
+class TestChangeStream : public discards::mojom::GraphChangeStream {
+ public:
+ using FrameMap = std::map<int64_t, discards::mojom::FrameInfoPtr>;
+ using PageMap = std::map<int64_t, discards::mojom::PageInfoPtr>;
+ using ProcessMap = std::map<int64_t, discards::mojom::ProcessInfoPtr>;
+ using IdSet = std::set<int64_t>;
+
+ TestChangeStream() {}
+
+ mojo::PendingRemote<discards::mojom::GraphChangeStream> GetRemote() {
+ mojo::PendingRemote<discards::mojom::GraphChangeStream> remote;
+
+ receiver_.Bind(remote.InitWithNewPipeAndPassReceiver());
+
+ return remote;
+ }
+
+ // discards::mojom::GraphChangeStream implementation
+ void FrameCreated(discards::mojom::FrameInfoPtr frame) override {
+ EXPECT_FALSE(HasId(frame->id));
+ // If the node has a parent frame, we must have heard of it.
+ EXPECT_TRUE(HasIdIfValid(frame->parent_frame_id));
+ EXPECT_TRUE(HasId(frame->page_id));
+ EXPECT_TRUE(HasId(frame->process_id));
+
+ id_set_.insert(frame->id);
+ frame_map_.insert(std::make_pair(frame->id, std::move(frame)));
+ }
+
+ void PageCreated(discards::mojom::PageInfoPtr page) override {
+ EXPECT_FALSE(HasId(page->id));
+ id_set_.insert(page->id);
+ page_map_.insert(std::make_pair(page->id, std::move(page)));
+ }
+
+ void ProcessCreated(discards::mojom::ProcessInfoPtr process) override {
+ EXPECT_FALSE(HasId(process->id));
+ id_set_.insert(process->id);
+ process_map_.insert(std::make_pair(process->id, std::move(process)));
+ }
+
+ void FrameChanged(discards::mojom::FrameInfoPtr frame) override {
+ EXPECT_TRUE(HasId(frame->id));
+ frame_map_[frame->id] = std::move(frame);
+ ++num_changes_;
+ }
+
+ void PageChanged(discards::mojom::PageInfoPtr page) override {
+ EXPECT_TRUE(HasId(page->id));
+ page_map_[page->id] = std::move(page);
+ ++num_changes_;
+ }
+
+ void ProcessChanged(discards::mojom::ProcessInfoPtr process) override {
+ EXPECT_TRUE(HasId(process->id));
+ process_map_[process->id] = std::move(process);
+ ++num_changes_;
+ }
+
+ void FavIconDataAvailable(discards::mojom::FavIconInfoPtr favicon) override {}
+
+ void NodeDeleted(int64_t node_id) override {
+ EXPECT_EQ(1u, id_set_.erase(node_id));
+
+ size_t erased = frame_map_.erase(node_id) + page_map_.erase(node_id) +
+ process_map_.erase(node_id);
+ EXPECT_EQ(1u, erased);
+ }
+
+ const FrameMap& frame_map() const { return frame_map_; }
+ const PageMap& page_map() const { return page_map_; }
+ const ProcessMap& process_map() const { return process_map_; }
+ const IdSet& id_set() const { return id_set_; }
+ size_t num_changes() const { return num_changes_; }
+
+ private:
+ bool HasId(int64_t id) { return base::Contains(id_set_, id); }
+ bool HasIdIfValid(int64_t id) { return id == 0u || HasId(id); }
+
+ FrameMap frame_map_;
+ PageMap page_map_;
+ ProcessMap process_map_;
+ IdSet id_set_;
+ size_t num_changes_ = 0;
+
+ mojo::Receiver<discards::mojom::GraphChangeStream> receiver_{this};
+};
+
+class DiscardsGraphDumpImplTest : public testing::Test {
+ public:
+ void TearDown() override { graph_.TearDown(); }
+
+ protected:
+ performance_manager::TestGraphImpl graph_;
+};
+
+} // namespace
+
+TEST_F(DiscardsGraphDumpImplTest, ChangeStream) {
+ content::BrowserTaskEnvironment task_environment;
+
+ performance_manager::MockMultiplePagesWithMultipleProcessesGraph mock_graph(
+ &graph_);
+
+ base::TimeTicks now = base::TimeTicks::Now();
+
+ const GURL kExampleUrl("http://www.example.org");
+ int64_t next_navigation_id = 1;
+ mock_graph.page->OnMainFrameNavigationCommitted(
+ false, now, next_navigation_id++, kExampleUrl);
+ mock_graph.other_page->OnMainFrameNavigationCommitted(
+ false, now, next_navigation_id++, kExampleUrl);
+
+ auto* main_frame = mock_graph.page->GetMainFrameNodeImpl();
+ main_frame->OnNavigationCommitted(kExampleUrl, /* same_document */ false);
+
+ std::unique_ptr<DiscardsGraphDumpImpl> impl =
+ std::make_unique<DiscardsGraphDumpImpl>();
+ DiscardsGraphDumpImpl* impl_raw = impl.get();
+ // Create a mojo remote to the impl.
+ mojo::Remote<discards::mojom::GraphDump> graph_dump_remote;
+ impl->BindWithGraph(&graph_, graph_dump_remote.BindNewPipeAndPassReceiver());
+ graph_.PassToGraph(std::move(impl));
+
+ TestChangeStream change_stream;
+ graph_dump_remote->SubscribeToChanges(change_stream.GetRemote());
+
+ task_environment.RunUntilIdle();
+
+ // Validate that the initial graph state dump is complete.
+ EXPECT_EQ(0u, change_stream.num_changes());
+ EXPECT_EQ(7u, change_stream.id_set().size());
+
+ EXPECT_EQ(2u, change_stream.process_map().size());
+ for (const auto& kv : change_stream.process_map()) {
+ EXPECT_NE(0u, kv.second->id);
+ }
+
+ EXPECT_EQ(3u, change_stream.frame_map().size());
+
+ // Count the top-level frames as we go.
+ size_t top_level_frames = 0;
+ for (const auto& kv : change_stream.frame_map()) {
+ const auto& frame = kv.second;
+ if (frame->parent_frame_id == 0) {
+ ++top_level_frames;
+
+ // Top level frames should have a page ID.
+ EXPECT_NE(0u, frame->page_id);
+
+ // The page's main frame should have an URL.
+ if (frame->id == NodeBase::GetSerializationId(main_frame))
+ EXPECT_EQ(kExampleUrl, frame->url);
+ }
+ EXPECT_NE(0u, frame->id);
+ EXPECT_NE(0u, frame->process_id);
+ }
+
+ // Make sure we have one top-level frame per page.
+ EXPECT_EQ(change_stream.page_map().size(), top_level_frames);
+
+ EXPECT_EQ(2u, change_stream.page_map().size());
+ for (const auto& kv : change_stream.page_map()) {
+ const auto& page = kv.second;
+ EXPECT_NE(0u, page->id);
+ EXPECT_EQ(kExampleUrl, page->main_frame_url);
+ }
+
+ // Test change notifications.
+ const GURL kAnotherURL("http://www.google.com/");
+ mock_graph.page->OnMainFrameNavigationCommitted(
+ false, now, next_navigation_id++, kAnotherURL);
+
+ size_t child_frame_id =
+ NodeBase::GetSerializationId(mock_graph.child_frame.get());
+ mock_graph.child_frame.reset();
+
+ task_environment.RunUntilIdle();
+
+ // Main frame navigation results in a notification for the url.
+ EXPECT_EQ(1u, change_stream.num_changes());
+ EXPECT_FALSE(base::Contains(change_stream.id_set(), child_frame_id));
+
+ const auto main_page_it = change_stream.page_map().find(
+ NodeBase::GetSerializationId(mock_graph.page.get()));
+ ASSERT_TRUE(main_page_it != change_stream.page_map().end());
+ EXPECT_EQ(kAnotherURL, main_page_it->second->main_frame_url);
+
+ task_environment.RunUntilIdle();
+
+ // Make sure the Dump impl is torn down when the proxy closes.
+ graph_dump_remote.reset();
+ task_environment.RunUntilIdle();
+
+ EXPECT_EQ(nullptr, graph_.TakeFromGraph(impl_raw));
+}
diff --git a/chromium/chrome/browser/ui/webui/domain_reliability_internals_ui.cc b/chromium/chrome/browser/ui/webui/domain_reliability_internals_ui.cc
index 148a71455e2..ad01bdc9b11 100644
--- a/chromium/chrome/browser/ui/webui/domain_reliability_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/domain_reliability_internals_ui.cc
@@ -13,6 +13,7 @@
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "services/network/public/mojom/network_context.mojom.h"
DomainReliabilityInternalsUI::DomainReliabilityInternalsUI(
content::WebUI* web_ui)
diff --git a/chromium/chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc b/chromium/chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc
index eb6d5d61bf2..042cc501ff5 100644
--- a/chromium/chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc
@@ -9,6 +9,7 @@
#include "base/values.h"
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_key.h"
#include "components/download/public/background_service/download_params.h"
#include "components/download/public/background_service/download_service.h"
#include "content/public/browser/web_ui.h"
diff --git a/chromium/chrome/browser/ui/webui/downloads/OWNERS b/chromium/chrome/browser/ui/webui/downloads/OWNERS
index e7f7501b22d..23fd391d6d7 100644
--- a/chromium/chrome/browser/ui/webui/downloads/OWNERS
+++ b/chromium/chrome/browser/ui/webui/downloads/OWNERS
@@ -1,6 +1,5 @@
file://components/download/OWNERS
-asanka@chromium.org
dbeam@chromium.org
per-file *.mojom=set noparent
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads.mojom b/chromium/chrome/browser/ui/webui/downloads/downloads.mojom
index 07926b97e6c..4aa8113bce1 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads.mojom
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads.mojom
@@ -28,7 +28,8 @@ struct Data {
};
interface PageHandlerFactory {
- CreatePageHandler(Page page, PageHandler& handler);
+ CreatePageHandler(pending_remote<Page> page,
+ pending_receiver<PageHandler> handler);
};
interface PageHandler {
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc b/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
index 6031ead5cc1..b2a05371724 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
@@ -8,6 +8,7 @@
#include <functional>
#include <memory>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -30,6 +31,7 @@
#include "chrome/browser/download/drag_download_item.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
#include "chrome/browser/ui/webui/fileicon_source.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -44,6 +46,9 @@
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/filename_util.h"
#include "ui/base/l10n/time_format.h"
#include "ui/gfx/image/image.h"
@@ -78,13 +83,13 @@ void CountDownloadsDOMEvents(DownloadsDOMEvent event) {
} // namespace
DownloadsDOMHandler::DownloadsDOMHandler(
- downloads::mojom::PageHandlerRequest request,
- downloads::mojom::PagePtr page,
+ mojo::PendingReceiver<downloads::mojom::PageHandler> receiver,
+ mojo::PendingRemote<downloads::mojom::Page> page,
content::DownloadManager* download_manager,
content::WebUI* web_ui)
: list_tracker_(download_manager, std::move(page)),
web_ui_(web_ui),
- binding_(this, std::move(request)) {
+ receiver_(this, std::move(receiver)) {
// Create our fileicon data source.
content::URLDataSource::Add(
Profile::FromBrowserContext(download_manager->GetBrowserContext()),
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.h b/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
index 554d69b5316..a66442d2c00 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
@@ -13,10 +13,12 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/download/download_danger_prompt.h"
-#include "chrome/browser/ui/webui/downloads/downloads_list_tracker.h"
#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
+#include "chrome/browser/ui/webui/downloads/downloads_list_tracker.h"
#include "content/public/browser/web_contents_observer.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
namespace content {
class DownloadManager;
@@ -34,10 +36,11 @@ class DownloadItem;
class DownloadsDOMHandler : public content::WebContentsObserver,
public downloads::mojom::PageHandler {
public:
- DownloadsDOMHandler(downloads::mojom::PageHandlerRequest request,
- downloads::mojom::PagePtr page,
- content::DownloadManager* download_manager,
- content::WebUI* web_ui);
+ DownloadsDOMHandler(
+ mojo::PendingReceiver<downloads::mojom::PageHandler> receiver,
+ mojo::PendingRemote<downloads::mojom::Page> page,
+ content::DownloadManager* download_manager,
+ content::WebUI* web_ui);
~DownloadsDOMHandler() override;
// WebContentsObserver implementation.
@@ -123,7 +126,7 @@ class DownloadsDOMHandler : public content::WebContentsObserver,
content::WebUI* web_ui_;
- mojo::Binding<downloads::mojom::PageHandler> binding_;
+ mojo::Receiver<downloads::mojom::PageHandler> receiver_;
base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_{this};
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler_unittest.cc b/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler_unittest.cc
index c4935b9397d..8b9d499e094 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads_dom_handler_unittest.cc
@@ -16,6 +16,8 @@
#include "content/public/test/mock_download_manager.h"
#include "content/public/test/test_web_ui.h"
#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -23,13 +25,14 @@ namespace {
class TestDownloadsDOMHandler : public DownloadsDOMHandler {
public:
- TestDownloadsDOMHandler(downloads::mojom::PagePtr page,
+ TestDownloadsDOMHandler(mojo::PendingRemote<downloads::mojom::Page> page,
content::DownloadManager* download_manager,
content::WebUI* web_ui)
- : DownloadsDOMHandler(downloads::mojom::PageHandlerRequest(),
- std::move(page),
- download_manager,
- web_ui) {}
+ : DownloadsDOMHandler(
+ mojo::PendingReceiver<downloads::mojom::PageHandler>(),
+ std::move(page),
+ download_manager,
+ web_ui) {}
using DownloadsDOMHandler::FinalizeRemovals;
using DownloadsDOMHandler::RemoveDownloads;
@@ -66,7 +69,8 @@ class DownloadsDOMHandlerTest : public testing::Test {
TEST_F(DownloadsDOMHandlerTest, ChecksForRemovedFiles) {
EXPECT_CALL(*manager(), CheckForHistoryFilesRemoval());
- TestDownloadsDOMHandler handler(page_.BindAndGetPtr(), manager(), web_ui());
+ TestDownloadsDOMHandler handler(page_.BindAndGetRemote(), manager(),
+ web_ui());
testing::Mock::VerifyAndClear(manager());
@@ -74,7 +78,8 @@ TEST_F(DownloadsDOMHandlerTest, ChecksForRemovedFiles) {
}
TEST_F(DownloadsDOMHandlerTest, HandleGetDownloads) {
- TestDownloadsDOMHandler handler(page_.BindAndGetPtr(), manager(), web_ui());
+ TestDownloadsDOMHandler handler(page_.BindAndGetRemote(), manager(),
+ web_ui());
handler.GetDownloads(std::vector<std::string>());
@@ -110,7 +115,8 @@ TEST_F(DownloadsDOMHandlerTest, ClearAll) {
ASSERT_TRUE(DownloadItemModel(&completed).ShouldShowInShelf());
- TestDownloadsDOMHandler handler(page_.BindAndGetPtr(), manager(), web_ui());
+ TestDownloadsDOMHandler handler(page_.BindAndGetRemote(), manager(),
+ web_ui());
handler.RemoveDownloads(downloads);
// Ensure |completed| has been "soft removed" (i.e. can be revived).
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc b/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
index 4c9e7443170..becddefb813 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/webui/downloads/downloads_list_tracker.h"
#include <iterator>
+#include <utility>
#include <vector>
#include "base/bind.h"
@@ -22,12 +23,15 @@
#include "chrome/browser/download/download_query.h"
#include "chrome/browser/extensions/api/downloads/downloads_api.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/download/public/common/download_item.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/download_item_utils.h"
#include "content/public/browser/download_manager.h"
#include "extensions/browser/extension_registry.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/filename_util.h"
#include "third_party/icu/source/i18n/unicode/datefmt.h"
#include "ui/base/l10n/time_format.h"
@@ -62,6 +66,11 @@ const char* GetDangerTypeString(download::DownloadDangerType danger_type) {
return "ASYNC_SCANNING";
case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED:
return "BLOCKED_PASSWORD_PROTECTED";
+ case download::DOWNLOAD_DANGER_TYPE_BLOCKED_TOO_LARGE:
+ case download::DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_WARNING:
+ case download::DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_BLOCK:
+ case download::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_SAFE:
+ case download::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_OPENED_DANGEROUS:
case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS:
case download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT:
case download::DOWNLOAD_DANGER_TYPE_USER_VALIDATED:
@@ -86,8 +95,9 @@ std::string TimeFormatLongDate(const base::Time& time) {
} // namespace
-DownloadsListTracker::DownloadsListTracker(DownloadManager* download_manager,
- downloads::mojom::PagePtr page)
+DownloadsListTracker::DownloadsListTracker(
+ DownloadManager* download_manager,
+ mojo::PendingRemote<downloads::mojom::Page> page)
: main_notifier_(download_manager, this),
page_(std::move(page)),
should_show_(base::BindRepeating(&DownloadsListTracker::ShouldShow,
@@ -181,7 +191,7 @@ void DownloadsListTracker::OnDownloadRemoved(DownloadManager* manager,
DownloadsListTracker::DownloadsListTracker(
DownloadManager* download_manager,
- downloads::mojom::PagePtr page,
+ mojo::PendingRemote<downloads::mojom::Page> page,
base::Callback<bool(const DownloadItem&)> should_show)
: main_notifier_(download_manager, this),
page_(std::move(page)),
@@ -227,7 +237,7 @@ downloads::mojom::DataPtr DownloadsListTracker::CreateDownloadData(
content::DownloadItemUtils::GetBrowserContext(download_item));
auto* registry = extensions::ExtensionRegistry::Get(profile);
const extensions::Extension* extension = registry->GetExtensionById(
- by_ext->id(), extensions::ExtensionRegistry::COMPATIBILITY);
+ by_ext->id(), extensions::ExtensionRegistry::EVERYTHING);
if (extension)
by_ext_name = extension->name();
}
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.h b/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.h
index 14e515b98ea..a54c75f995c 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.h
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker.h
@@ -18,6 +18,8 @@
#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
#include "components/download/content/public/all_download_item_notifier.h"
#include "components/download/public/common/download_item.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
namespace content {
class DownloadManager;
@@ -29,7 +31,7 @@ class DownloadsListTracker
: public download::AllDownloadItemNotifier::Observer {
public:
DownloadsListTracker(content::DownloadManager* download_manager,
- downloads::mojom::PagePtr page);
+ mojo::PendingRemote<downloads::mojom::Page> page);
~DownloadsListTracker() override;
// Clears all downloads on the page if currently sending updates and resets
@@ -62,7 +64,7 @@ class DownloadsListTracker
protected:
// Testing constructor.
DownloadsListTracker(content::DownloadManager* download_manager,
- downloads::mojom::PagePtr page,
+ mojo::PendingRemote<downloads::mojom::Page> page,
base::Callback<bool(const download::DownloadItem&)>);
// Creates a dictionary value that's sent to the page as JSON.
@@ -108,7 +110,7 @@ class DownloadsListTracker
download::AllDownloadItemNotifier main_notifier_;
std::unique_ptr<download::AllDownloadItemNotifier> original_notifier_;
- downloads::mojom::PagePtr page_;
+ mojo::Remote<downloads::mojom::Page> page_;
// Callback used to determine if an item should show on the page. Set to
// |ShouldShow()| in default constructor, passed in while testing.
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc b/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc
index 00ab6f9573c..d7e35feb888 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <utility>
#include <vector>
#include "base/bind.h"
@@ -16,12 +17,14 @@
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "chrome/browser/download/download_item_model.h"
+#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
#include "chrome/browser/ui/webui/downloads/mock_downloads_page.h"
#include "chrome/test/base/testing_profile.h"
#include "components/download/public/common/mock_download_item.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/mock_download_manager.h"
#include "content/public/test/test_web_ui.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -44,7 +47,7 @@ bool ShouldShowItem(const DownloadItem& item) {
class TestDownloadsListTracker : public DownloadsListTracker {
public:
TestDownloadsListTracker(content::DownloadManager* manager,
- downloads::mojom::PagePtr page)
+ mojo::PendingRemote<downloads::mojom::Page> page)
: DownloadsListTracker(manager,
std::move(page),
base::BindRepeating(&ShouldShowItem)) {}
@@ -98,7 +101,7 @@ class DownloadsListTrackerTest : public testing::Test {
void CreateTracker() {
tracker_.reset(
- new TestDownloadsListTracker(manager(), page_.BindAndGetPtr()));
+ new TestDownloadsListTracker(manager(), page_.BindAndGetRemote()));
}
TestingProfile* profile() { return &profile_; }
@@ -241,7 +244,7 @@ TEST_F(DownloadsListTrackerTest, Incognito) {
ON_CALL(incognito_manager, GetDownload(0)).WillByDefault(Return(&item));
testing::StrictMock<MockPage> page;
- TestDownloadsListTracker tracker(&incognito_manager, page.BindAndGetPtr());
+ TestDownloadsListTracker tracker(&incognito_manager, page.BindAndGetRemote());
EXPECT_TRUE(tracker.IsIncognito(item));
}
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc b/chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc
index e1c53488cb0..9fe51881e90 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads_ui.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/advanced_protection_status_manager.h"
#include "chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h"
+#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
#include "chrome/browser/ui/webui/downloads/downloads_dom_handler.h"
#include "chrome/browser/ui/webui/localized_string.h"
#include "chrome/browser/ui/webui/managed_ui_handler.h"
@@ -37,6 +38,9 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -163,7 +167,7 @@ content::WebUIDataSource* CreateDownloadsUIHTMLSource(Profile* profile) {
///////////////////////////////////////////////////////////////////////////////
DownloadsUI::DownloadsUI(content::WebUI* web_ui)
- : ui::MojoWebUIController(web_ui, true), page_factory_binding_(this) {
+ : ui::MojoWebUIController(web_ui, true) {
Profile* profile = Profile::FromWebUI(web_ui);
web_ui->AddMessageHandler(std::make_unique<MetricsHandler>());
@@ -187,20 +191,19 @@ base::RefCountedMemory* DownloadsUI::GetFaviconResourceBytes(
}
void DownloadsUI::BindPageHandlerFactory(
- downloads::mojom::PageHandlerFactoryRequest request) {
- if (page_factory_binding_.is_bound())
- page_factory_binding_.Unbind();
+ mojo::PendingReceiver<downloads::mojom::PageHandlerFactory> receiver) {
+ page_factory_receiver_.reset();
- page_factory_binding_.Bind(std::move(request));
+ page_factory_receiver_.Bind(std::move(receiver));
}
void DownloadsUI::CreatePageHandler(
- downloads::mojom::PagePtr page,
- downloads::mojom::PageHandlerRequest request) {
+ mojo::PendingRemote<downloads::mojom::Page> page,
+ mojo::PendingReceiver<downloads::mojom::PageHandler> receiver) {
DCHECK(page);
Profile* profile = Profile::FromWebUI(web_ui());
DownloadManager* dlm = BrowserContext::GetDownloadManager(profile);
page_handler_ = std::make_unique<DownloadsDOMHandler>(
- std::move(request), std::move(page), dlm, web_ui());
+ std::move(receiver), std::move(page), dlm, web_ui());
}
diff --git a/chromium/chrome/browser/ui/webui/downloads/downloads_ui.h b/chromium/chrome/browser/ui/webui/downloads/downloads_ui.h
index 82f7dafc86b..ccb71d19076 100644
--- a/chromium/chrome/browser/ui/webui/downloads/downloads_ui.h
+++ b/chromium/chrome/browser/ui/webui/downloads/downloads_ui.h
@@ -9,7 +9,9 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "ui/base/layout.h"
#include "ui/webui/mojo_web_ui_controller.h"
@@ -30,15 +32,17 @@ class DownloadsUI : public ui::MojoWebUIController,
private:
void BindPageHandlerFactory(
- downloads::mojom::PageHandlerFactoryRequest request);
+ mojo::PendingReceiver<downloads::mojom::PageHandlerFactory> receiver);
// downloads::mojom::PageHandlerFactory:
- void CreatePageHandler(downloads::mojom::PagePtr page,
- downloads::mojom::PageHandlerRequest request) override;
+ void CreatePageHandler(
+ mojo::PendingRemote<downloads::mojom::Page> page,
+ mojo::PendingReceiver<downloads::mojom::PageHandler> receiver) override;
std::unique_ptr<DownloadsDOMHandler> page_handler_;
- mojo::Binding<downloads::mojom::PageHandlerFactory> page_factory_binding_;
+ mojo::Receiver<downloads::mojom::PageHandlerFactory> page_factory_receiver_{
+ this};
DISALLOW_COPY_AND_ASSIGN(DownloadsUI);
};
diff --git a/chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.cc b/chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.cc
index e6f21212dd1..986778fc2c1 100644
--- a/chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.cc
+++ b/chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.cc
@@ -4,12 +4,15 @@
#include "chrome/browser/ui/webui/downloads/mock_downloads_page.h"
-MockPage::MockPage() : binding_(this) {}
+#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+
+MockPage::MockPage() = default;
+
MockPage::~MockPage() = default;
-downloads::mojom::PagePtr MockPage::BindAndGetPtr() {
- DCHECK(!binding_.is_bound());
- downloads::mojom::PagePtr page;
- binding_.Bind(mojo::MakeRequest(&page));
- return page;
+mojo::PendingRemote<downloads::mojom::Page> MockPage::BindAndGetRemote() {
+ DCHECK(!receiver_.is_bound());
+ return receiver_.BindNewPipeAndPassRemote();
}
diff --git a/chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.h b/chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.h
index 0fdaccde260..119680ea139 100644
--- a/chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.h
+++ b/chromium/chrome/browser/ui/webui/downloads/mock_downloads_page.h
@@ -8,8 +8,8 @@
#include <vector>
#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
-
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
class MockPage : public downloads::mojom::Page {
@@ -17,14 +17,14 @@ class MockPage : public downloads::mojom::Page {
MockPage();
~MockPage() override;
- downloads::mojom::PagePtr BindAndGetPtr();
+ mojo::PendingRemote<downloads::mojom::Page> BindAndGetRemote();
MOCK_METHOD1(RemoveItem, void(int));
MOCK_METHOD2(UpdateItem, void(int, downloads::mojom::DataPtr));
MOCK_METHOD2(InsertItems, void(int, std::vector<downloads::mojom::DataPtr>));
MOCK_METHOD0(ClearAll, void());
- mojo::Binding<downloads::mojom::Page> binding_;
+ mojo::Receiver<downloads::mojom::Page> receiver_{this};
};
#endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_MOCK_DOWNLOADS_PAGE_H_
diff --git a/chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.cc b/chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
index 2c97430d0dc..03603cd5bfe 100644
--- a/chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
+++ b/chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
@@ -5,12 +5,14 @@
#include "chrome/browser/ui/webui/engagement/site_engagement_ui.h"
#include <cmath>
+#include <memory>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/callback.h"
#include "base/macros.h"
+#include "chrome/browser/engagement/site_engagement_details.mojom.h"
#include "chrome/browser/engagement/site_engagement_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
@@ -18,7 +20,8 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
namespace {
@@ -30,8 +33,8 @@ class SiteEngagementDetailsProviderImpl
// Instance is deleted when the supplied pipe is destroyed.
SiteEngagementDetailsProviderImpl(
Profile* profile,
- mojo::InterfaceRequest<mojom::SiteEngagementDetailsProvider> request)
- : profile_(profile), binding_(this, std::move(request)) {
+ mojo::PendingReceiver<mojom::SiteEngagementDetailsProvider> receiver)
+ : profile_(profile), receiver_(this, std::move(receiver)) {
DCHECK(profile_);
}
@@ -70,7 +73,7 @@ class SiteEngagementDetailsProviderImpl
// The Profile* handed to us in our constructor.
Profile* profile_;
- mojo::Binding<mojom::SiteEngagementDetailsProvider> binding_;
+ mojo::Receiver<mojom::SiteEngagementDetailsProvider> receiver_;
DISALLOW_COPY_AND_ASSIGN(SiteEngagementDetailsProviderImpl);
};
@@ -97,7 +100,7 @@ SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui)
SiteEngagementUI::~SiteEngagementUI() {}
void SiteEngagementUI::BindSiteEngagementDetailsProvider(
- mojom::SiteEngagementDetailsProviderRequest request) {
+ mojo::PendingReceiver<mojom::SiteEngagementDetailsProvider> receiver) {
ui_handler_ = std::make_unique<SiteEngagementDetailsProviderImpl>(
- Profile::FromWebUI(web_ui()), std::move(request));
+ Profile::FromWebUI(web_ui()), std::move(receiver));
}
diff --git a/chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.h b/chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.h
index 1d84444e369..119a1229665 100644
--- a/chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.h
+++ b/chromium/chrome/browser/ui/webui/engagement/site_engagement_ui.h
@@ -7,6 +7,7 @@
#include "base/macros.h"
#include "chrome/browser/engagement/site_engagement_details.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
// The UI for chrome://site-engagement/.
@@ -17,7 +18,7 @@ class SiteEngagementUI : public ui::MojoWebUIController {
private:
void BindSiteEngagementDetailsProvider(
- mojom::SiteEngagementDetailsProviderRequest request);
+ mojo::PendingReceiver<mojom::SiteEngagementDetailsProvider> receiver);
std::unique_ptr<mojom::SiteEngagementDetailsProvider> ui_handler_;
diff --git a/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.cc b/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.cc
index b336e92d1f8..b9a460ddfb3 100644
--- a/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.cc
+++ b/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.h"
#include <string>
+#include <utility>
#include <vector>
#include "base/containers/flat_map.h"
@@ -11,8 +12,11 @@
#include "chrome/browser/android/explore_sites/explore_sites_feature.h"
#include "chrome/browser/android/explore_sites/url_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals.mojom.h"
#include "components/language/core/browser/pref_names.h"
#include "components/prefs/pref_service.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
namespace explore_sites {
using chrome::android::explore_sites::ExploreSitesVariation;
@@ -37,10 +41,10 @@ std::string GetChromeFlagsSetupString() {
} // namespace
ExploreSitesInternalsPageHandler::ExploreSitesInternalsPageHandler(
- explore_sites_internals::mojom::PageHandlerRequest request,
+ mojo::PendingReceiver<explore_sites_internals::mojom::PageHandler> receiver,
ExploreSitesService* explore_sites_service,
Profile* profile)
- : binding_(this, std::move(request)),
+ : receiver_(this, std::move(receiver)),
explore_sites_service_(explore_sites_service),
profile_(profile) {}
diff --git a/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.h b/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.h
index 4a95f5e741d..8b1218bcf51 100644
--- a/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.h
+++ b/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.h
@@ -8,7 +8,8 @@
#include "base/macros.h"
#include "chrome/browser/android/explore_sites/explore_sites_service.h"
#include "chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
class Profile;
@@ -19,7 +20,8 @@ class ExploreSitesInternalsPageHandler
: public explore_sites_internals::mojom::PageHandler {
public:
ExploreSitesInternalsPageHandler(
- explore_sites_internals::mojom::PageHandlerRequest request,
+ mojo::PendingReceiver<explore_sites_internals::mojom::PageHandler>
+ receiver,
ExploreSitesService* explore_sites_service,
Profile* profile);
~ExploreSitesInternalsPageHandler() override;
@@ -33,7 +35,7 @@ class ExploreSitesInternalsPageHandler
OverrideCountryCodeCallback) override;
void ForceNetworkRequest(ForceNetworkRequestCallback) override;
- mojo::Binding<explore_sites_internals::mojom::PageHandler> binding_;
+ mojo::Receiver<explore_sites_internals::mojom::PageHandler> receiver_;
ExploreSitesService* explore_sites_service_;
Profile* profile_;
diff --git a/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.cc b/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.cc
index 661ba823499..803dc70251a 100644
--- a/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.cc
@@ -9,10 +9,12 @@
#include "chrome/browser/android/chrome_feature_list.h"
#include "chrome/browser/android/explore_sites/explore_sites_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals.mojom.h"
#include "chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
namespace explore_sites {
@@ -44,9 +46,11 @@ ExploreSitesInternalsUI::ExploreSitesInternalsUI(content::WebUI* web_ui)
ExploreSitesInternalsUI::~ExploreSitesInternalsUI() {}
void ExploreSitesInternalsUI::BindExploreSitesInternalsPageHandler(
- explore_sites_internals::mojom::PageHandlerRequest request) {
+ mojo::PendingReceiver<explore_sites_internals::mojom::PageHandler>
+ receiver) {
page_handler_ = std::make_unique<ExploreSitesInternalsPageHandler>(
- std::move(request), explore_sites_service_, Profile::FromWebUI(web_ui()));
+ std::move(receiver), explore_sites_service_,
+ Profile::FromWebUI(web_ui()));
}
} // namespace explore_sites
diff --git a/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.h b/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.h
index f0b3da06ad4..87fa86d06ec 100644
--- a/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.h
+++ b/chromium/chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals.mojom.h"
#include "chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_page_handler.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
namespace explore_sites {
@@ -24,7 +25,8 @@ class ExploreSitesInternalsUI : public ui::MojoWebUIController {
private:
void BindExploreSitesInternalsPageHandler(
- explore_sites_internals::mojom::PageHandlerRequest request);
+ mojo::PendingReceiver<explore_sites_internals::mojom::PageHandler>
+ receiver);
std::unique_ptr<ExploreSitesInternalsPageHandler> page_handler_;
ExploreSitesService* explore_sites_service_;
diff --git a/chromium/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chromium/chrome/browser/ui/webui/extensions/extension_icon_source.cc
index 76e1be57c95..ea745a1b618 100644
--- a/chromium/chrome/browser/ui/webui/extensions/extension_icon_source.cc
+++ b/chromium/chrome/browser/ui/webui/extensions/extension_icon_source.cc
@@ -17,7 +17,6 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread.h"
-#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -25,7 +24,7 @@
#include "chrome/common/url_constants.h"
#include "chrome/grit/component_extension_resources_map.h"
#include "extensions/browser/extension_prefs.h"
-#include "extensions/browser/extension_system.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/image_loader.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_resource.h"
@@ -302,8 +301,8 @@ bool ExtensionIconSource::ParseData(
match_type = ExtensionIconSet::MATCH_EXACTLY;
std::string extension_id = path_parts.at(0);
- const Extension* extension = ExtensionSystem::Get(profile_)->
- extension_service()->GetInstalledExtension(extension_id);
+ const Extension* extension =
+ ExtensionRegistry::Get(profile_)->GetInstalledExtension(extension_id);
if (!extension)
return false;
diff --git a/chromium/chrome/browser/ui/webui/extensions/extensions_internals_source.cc b/chromium/chrome/browser/ui/webui/extensions/extensions_internals_source.cc
index 69157d3f489..835595a56dc 100644
--- a/chromium/chrome/browser/ui/webui/extensions/extensions_internals_source.cc
+++ b/chromium/chrome/browser/ui/webui/extensions/extensions_internals_source.cc
@@ -91,31 +91,33 @@ const char* LocationToString(extensions::Manifest::Location loc) {
base::Value CreationFlagsToList(int creation_flags) {
base::Value flags_value(base::Value::Type::LIST);
if (creation_flags & extensions::Extension::NO_FLAGS)
- flags_value.GetList().emplace_back("NO_FLAGS");
+ flags_value.Append("NO_FLAGS");
if (creation_flags & extensions::Extension::REQUIRE_KEY)
- flags_value.GetList().emplace_back("REQUIRE_KEY");
+ flags_value.Append("REQUIRE_KEY");
if (creation_flags & extensions::Extension::REQUIRE_MODERN_MANIFEST_VERSION)
- flags_value.GetList().emplace_back("REQUIRE_MODERN_MANIFEST_VERSION");
+ flags_value.Append("REQUIRE_MODERN_MANIFEST_VERSION");
if (creation_flags & extensions::Extension::ALLOW_FILE_ACCESS)
- flags_value.GetList().emplace_back("ALLOW_FILE_ACCESS");
+ flags_value.Append("ALLOW_FILE_ACCESS");
if (creation_flags & extensions::Extension::FROM_WEBSTORE)
- flags_value.GetList().emplace_back("FROM_WEBSTORE");
+ flags_value.Append("FROM_WEBSTORE");
if (creation_flags & extensions::Extension::FROM_BOOKMARK)
- flags_value.GetList().emplace_back("FROM_BOOKMARK");
+ flags_value.Append("FROM_BOOKMARK");
if (creation_flags & extensions::Extension::FOLLOW_SYMLINKS_ANYWHERE)
- flags_value.GetList().emplace_back("FOLLOW_SYMLINKS_ANYWHERE");
+ flags_value.Append("FOLLOW_SYMLINKS_ANYWHERE");
if (creation_flags & extensions::Extension::ERROR_ON_PRIVATE_KEY)
- flags_value.GetList().emplace_back("ERROR_ON_PRIVATE_KEY");
+ flags_value.Append("ERROR_ON_PRIVATE_KEY");
if (creation_flags & extensions::Extension::WAS_INSTALLED_BY_DEFAULT)
- flags_value.GetList().emplace_back("WAS_INSTALLED_BY_DEFAULT");
+ flags_value.Append("WAS_INSTALLED_BY_DEFAULT");
if (creation_flags & extensions::Extension::REQUIRE_PERMISSIONS_CONSENT)
- flags_value.GetList().emplace_back("REQUIRE_PERMISSIONS_CONSENT");
+ flags_value.Append("REQUIRE_PERMISSIONS_CONSENT");
if (creation_flags & extensions::Extension::IS_EPHEMERAL)
- flags_value.GetList().emplace_back("IS_EPHEMERAL");
+ flags_value.Append("IS_EPHEMERAL");
if (creation_flags & extensions::Extension::WAS_INSTALLED_BY_OEM)
- flags_value.GetList().emplace_back("WAS_INSTALLED_BY_OEM");
+ flags_value.Append("WAS_INSTALLED_BY_OEM");
if (creation_flags & extensions::Extension::MAY_BE_UNTRUSTED)
- flags_value.GetList().emplace_back("MAY_BE_UNTRUSTED");
+ flags_value.Append("MAY_BE_UNTRUSTED");
+ if (creation_flags & extensions::Extension::WITHHOLD_PERMISSIONS)
+ flags_value.Append("WITHHOLD_PERMISSIONS");
return flags_value;
}
@@ -286,7 +288,7 @@ base::Value FormatKeepaliveData(extensions::ProcessManager* process_manager,
activities_entry.SetKey(
kTypeKey, base::Value(extensions::Activity::ToString(activity.first)));
activities_entry.SetKey(kExtraDataKey, base::Value(activity.second));
- activities_data.GetList().push_back(std::move(activities_entry));
+ activities_data.Append(std::move(activities_entry));
}
keepalive_data.SetKey(kActivitesKey, std::move(activities_data));
return keepalive_data;
@@ -304,9 +306,9 @@ base::Value FormatDetailedPermissionSet(const T& permissions) {
base::Value tmp(base::Value::Type::DICTIONARY);
tmp.SetKey(permission->name(),
base::Value::FromUniquePtrValue(std::move(detail)));
- value_list.GetList().push_back(std::move(tmp));
+ value_list.Append(std::move(tmp));
} else {
- value_list.GetList().push_back(base::Value(permission->name()));
+ value_list.Append(base::Value(permission->name()));
}
}
return value_list;
@@ -392,7 +394,7 @@ void AddEventListenerData(extensions::EventRouter* event_router,
if (filter != nullptr) {
listener_data.SetKey(kFilterKey, filter->Clone());
}
- listeners_list.GetList().push_back(std::move(listener_data));
+ listeners_list.Append(std::move(listener_data));
}
}
@@ -468,7 +470,7 @@ std::string ExtensionsInternalsSource::WriteToString() const {
extension_data.SetKey(kInternalsVersionKey,
base::Value(extension->GetVersionForDisplay()));
extension_data.SetKey(kPermissionsKey, FormatPermissionsData(*extension));
- data.GetList().push_back(std::move(extension_data));
+ data.Append(std::move(extension_data));
}
// Aggregate and add the data for the registered event listeners.
diff --git a/chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc
index 645cf9d7c67..18b00d539f7 100644
--- a/chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc
+++ b/chromium/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -69,6 +69,8 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
{"close", IDS_CLOSE},
{"clear", IDS_CLEAR},
{"confirm", IDS_CONFIRM},
+ {"controlledSettingChildRestriction",
+ IDS_CONTROLLED_SETTING_CHILD_RESTRICTION},
{"controlledSettingPolicy", IDS_CONTROLLED_SETTING_POLICY},
{"done", IDS_DONE},
{"learnMore", IDS_LEARN_MORE},
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 cbc85825f30..799b7214a10 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
@@ -12,6 +12,7 @@
#include "base/time/time.h"
#include "chrome/browser/android/feed/feed_debugging_bridge.h"
#include "chrome/browser/android/feed/feed_lifecycle_bridge.h"
+#include "chrome/browser/ui/webui/feed_internals/feed_internals.mojom.h"
#include "components/feed/content/feed_host_service.h"
#include "components/feed/content/feed_offline_host.h"
#include "components/feed/core/feed_scheduler_host.h"
@@ -21,6 +22,8 @@
#include "components/offline_pages/core/prefetch/prefetch_prefs.h"
#include "components/offline_pages/core/prefetch/suggestions_provider.h"
#include "components/prefs/pref_service.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
namespace {
@@ -47,10 +50,10 @@ std::string TriggerTypeToString(feed::FeedSchedulerHost::TriggerType* trigger) {
} // namespace
FeedInternalsPageHandler::FeedInternalsPageHandler(
- feed_internals::mojom::PageHandlerRequest request,
+ mojo::PendingReceiver<feed_internals::mojom::PageHandler> receiver,
feed::FeedHostService* feed_host_service,
PrefService* pref_service)
- : binding_(this, std::move(request)),
+ : receiver_(this, std::move(receiver)),
feed_scheduler_host_(feed_host_service->GetSchedulerHost()),
feed_offline_host_(feed_host_service->GetOfflineHost()),
pref_service_(pref_service) {}
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 2d0352747a4..ab3a646da19 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
@@ -10,7 +10,8 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/webui/feed_internals/feed_internals.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
class PrefService;
@@ -27,9 +28,10 @@ struct PrefetchSuggestion;
// Concrete implementation of feed_internals::mojom::PageHandler.
class FeedInternalsPageHandler : public feed_internals::mojom::PageHandler {
public:
- FeedInternalsPageHandler(feed_internals::mojom::PageHandlerRequest request,
- feed::FeedHostService* feed_host_service,
- PrefService* pref_service);
+ FeedInternalsPageHandler(
+ mojo::PendingReceiver<feed_internals::mojom::PageHandler> receiver,
+ feed::FeedHostService* feed_host_service,
+ PrefService* pref_service);
~FeedInternalsPageHandler() override;
// feed_internals::mojom::PageHandler
@@ -45,8 +47,7 @@ class FeedInternalsPageHandler : public feed_internals::mojom::PageHandler {
void GetFeedHistograms(GetFeedHistogramsCallback) override;
private:
- // Binding from the mojo interface to concrete implementation.
- mojo::Binding<feed_internals::mojom::PageHandler> binding_;
+ mojo::Receiver<feed_internals::mojom::PageHandler> receiver_;
void OnGetCurrentArticleSuggestionsDone(
GetCurrentContentCallback callback,
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 de2a7c2ab9a..051f6fe93d7 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
@@ -9,10 +9,12 @@
#include "base/bind.h"
#include "chrome/browser/android/feed/feed_host_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/feed_internals/feed_internals.mojom.h"
#include "chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
FeedInternalsUI::FeedInternalsUI(content::WebUI* web_ui)
: ui::MojoWebUIController(web_ui), profile_(Profile::FromWebUI(web_ui)) {
@@ -35,9 +37,9 @@ FeedInternalsUI::FeedInternalsUI(content::WebUI* web_ui)
FeedInternalsUI::~FeedInternalsUI() = default;
void FeedInternalsUI::BindFeedInternalsPageHandler(
- feed_internals::mojom::PageHandlerRequest request) {
+ mojo::PendingReceiver<feed_internals::mojom::PageHandler> receiver) {
page_handler_ = std::make_unique<FeedInternalsPageHandler>(
- std::move(request),
+ std::move(receiver),
feed::FeedHostServiceFactory::GetForBrowserContext(profile_),
profile_->GetPrefs());
}
diff --git a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.h b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.h
index 8d6077fb073..662b9bb65bd 100644
--- a/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.h
+++ b/chromium/chrome/browser/ui/webui/feed_internals/feed_internals_ui.h
@@ -8,7 +8,9 @@
#include <memory>
#include "base/macros.h"
+#include "chrome/browser/ui/webui/feed_internals/feed_internals.mojom.h"
#include "chrome/browser/ui/webui/feed_internals/feed_internals_page_handler.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
class Profile;
@@ -27,7 +29,7 @@ class FeedInternalsUI : public ui::MojoWebUIController {
private:
void BindFeedInternalsPageHandler(
- feed_internals::mojom::PageHandlerRequest request);
+ mojo::PendingReceiver<feed_internals::mojom::PageHandler> receiver);
Profile* profile_;
diff --git a/chromium/chrome/browser/ui/webui/fileicon_source_unittest.cc b/chromium/chrome/browser/ui/webui/fileicon_source_unittest.cc
index 549f17167eb..b4da3776f40 100644
--- a/chromium/chrome/browser/ui/webui/fileicon_source_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/fileicon_source_unittest.cc
@@ -13,6 +13,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/layout.h"
namespace {
diff --git a/chromium/chrome/browser/ui/webui/flags_ui.cc b/chromium/chrome/browser/ui/webui/flags_ui.cc
index 70df1a343d1..55b6c62ebe9 100644
--- a/chromium/chrome/browser/ui/webui/flags_ui.cc
+++ b/chromium/chrome/browser/ui/webui/flags_ui.cc
@@ -76,6 +76,7 @@ content::WebUIDataSource* CreateFlagsUIHTMLSource() {
source->AddResourcePath(flags_ui::kFlagsJS, IDR_FLAGS_UI_FLAGS_JS);
source->SetDefaultResource(IDR_FLAGS_UI_FLAGS_HTML);
+ source->UseStringsJs();
return source;
}
@@ -127,6 +128,7 @@ void FlagsUI::AddStrings(content::WebUIDataSource* source) {
source->AddLocalizedString("enabled", IDS_FLAGS_UI_ENABLED_FEATURE);
source->AddLocalizedString("experiment-enabled",
IDS_FLAGS_UI_EXPERIMENT_ENABLED);
+ source->AddLocalizedString("heading", IDS_FLAGS_UI_TITLE);
source->AddLocalizedString("no-results", IDS_FLAGS_UI_NO_RESULTS);
source->AddLocalizedString("not-available-platform",
IDS_FLAGS_UI_NOT_AVAILABLE_ON_PLATFORM);
@@ -141,6 +143,10 @@ void FlagsUI::AddStrings(content::WebUIDataSource* source) {
IDS_FLAGS_UI_SEARCH_PLACEHOLDER);
source->AddLocalizedString("title", IDS_FLAGS_UI_TITLE);
source->AddLocalizedString("unavailable", IDS_FLAGS_UI_UNAVAILABLE_FEATURE);
+ source->AddLocalizedString("searchResultsSingular",
+ IDS_FLAGS_UI_SEARCH_RESULTS_SINGULAR);
+ source->AddLocalizedString("searchResultsPlural",
+ IDS_FLAGS_UI_SEARCH_RESULTS_PLURAL);
}
// static
@@ -156,11 +162,11 @@ void FlagsDeprecatedUI::AddStrings(content::WebUIDataSource* source) {
IDS_DEPRECATED_FEATURES_ENABLED_FEATURE);
source->AddLocalizedString("experiment-enabled",
IDS_DEPRECATED_UI_EXPERIMENT_ENABLED);
+ source->AddLocalizedString("heading", IDS_DEPRECATED_FEATURES_HEADING);
source->AddLocalizedString("no-results", IDS_DEPRECATED_FEATURES_NO_RESULTS);
source->AddLocalizedString("not-available-platform",
IDS_DEPRECATED_FEATURES_NOT_AVAILABLE_ON_PLATFORM);
- source->AddLocalizedString("page-warning",
- IDS_DEPRECATED_FEATURES_PAGE_WARNING);
+ source->AddString("page-warning", std::string());
source->AddLocalizedString("page-warning-explanation",
IDS_DEPRECATED_FEATURES_PAGE_WARNING_EXPLANATION);
source->AddLocalizedString("relaunch", IDS_DEPRECATED_FEATURES_RELAUNCH);
@@ -172,6 +178,10 @@ void FlagsDeprecatedUI::AddStrings(content::WebUIDataSource* source) {
source->AddLocalizedString("title", IDS_DEPRECATED_FEATURES_TITLE);
source->AddLocalizedString("unavailable",
IDS_DEPRECATED_FEATURES_UNAVAILABLE_FEATURE);
+ source->AddLocalizedString("searchResultsSingular",
+ IDS_ENTERPRISE_UI_SEARCH_RESULTS_SINGULAR);
+ source->AddLocalizedString("searchResultsPlural",
+ IDS_ENTERPRISE_UI_SEARCH_RESULTS_PLURAL);
}
template <class T>
diff --git a/chromium/chrome/browser/ui/webui/flags_ui_unittest.cc b/chromium/chrome/browser/ui/webui/flags_ui_unittest.cc
index e5f5a49a5ad..59c33e0e212 100644
--- a/chromium/chrome/browser/ui/webui/flags_ui_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/flags_ui_unittest.cc
@@ -16,7 +16,7 @@ class FlagsUITest : public testing::Test {
FlagsUITest() = default;
private:
- content::TestBrowserThreadBundle bundle_;
+ content::BrowserTaskEnvironment task_environment_;
};
TEST_F(FlagsUITest, IsDeprecatedUrl) {
diff --git a/chromium/chrome/browser/ui/webui/help/version_updater.h b/chromium/chrome/browser/ui/webui/help/version_updater.h
index ad34cb0c53f..de48fe833ee 100644
--- a/chromium/chrome/browser/ui/webui/help/version_updater.h
+++ b/chromium/chrome/browser/ui/webui/help/version_updater.h
@@ -12,6 +12,7 @@
#include "build/build_config.h"
#if defined(OS_CHROMEOS)
+#include "chromeos/dbus/update_engine_client.h"
#include "third_party/cros_system_api/dbus/update_engine/dbus-constants.h"
#endif // defined(OS_CHROMEOS)
@@ -48,8 +49,8 @@ class VersionUpdater {
// types.
#if defined(OS_CHROMEOS)
typedef base::Callback<void(const std::string&)> ChannelCallback;
- typedef base::OnceCallback<void(update_engine::EndOfLifeStatus status)>
- EolStatusCallback;
+ using EolInfoCallback =
+ base::OnceCallback<void(chromeos::UpdateEngineClient::EolInfo eol_info)>;
#endif
// Used to update the client of status changes.
@@ -98,7 +99,8 @@ class VersionUpdater {
bool is_powerwash_allowed) = 0;
virtual void GetChannel(bool get_current_channel,
const ChannelCallback& callback) = 0;
- virtual void GetEolStatus(EolStatusCallback callback) = 0;
+ // Get the End of Life (Auto Update Expiration) Date.
+ virtual void GetEolInfo(EolInfoCallback callback) = 0;
// Sets a one time permission on a certain update in Update Engine.
// - update_version: the Chrome OS version we want to update to.
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 55b745814a2..c93b9b199b2 100644
--- a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc
+++ b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc
@@ -165,8 +165,8 @@ void VersionUpdaterCros::CheckForUpdate(const StatusCallback& callback,
if (!update_engine_client->HasObserver(this))
update_engine_client->AddObserver(this);
- if (update_engine_client->GetLastStatus().status !=
- UpdateEngineClient::UPDATE_STATUS_IDLE) {
+ if (update_engine_client->GetLastStatus().current_operation() !=
+ update_engine::Operation::IDLE) {
check_for_update_when_idle_ = true;
return;
}
@@ -239,27 +239,26 @@ void VersionUpdaterCros::OnGetChannel(const ChannelCallback& cb,
cb.Run(current_channel);
}
-void VersionUpdaterCros::GetEolStatus(EolStatusCallback cb) {
+void VersionUpdaterCros::GetEolInfo(EolInfoCallback cb) {
UpdateEngineClient* update_engine_client =
DBusThreadManager::Get()->GetUpdateEngineClient();
- // Request the Eol Status. Bind to a weak_ptr bound method rather than passing
+ // Request the EolInfo. Bind to a weak_ptr bound method rather than passing
// |cb| directly so that |cb| does not outlive |this|.
- update_engine_client->GetEolStatus(
- base::BindOnce(&VersionUpdaterCros::OnGetEolStatus,
+ update_engine_client->GetEolInfo(
+ base::BindOnce(&VersionUpdaterCros::OnGetEolInfo,
weak_ptr_factory_.GetWeakPtr(), std::move(cb)));
}
-void VersionUpdaterCros::OnGetEolStatus(
- EolStatusCallback cb,
- update_engine::EndOfLifeStatus status,
- base::Optional<int32_t> number_of_milestones) {
- std::move(cb).Run(status);
+void VersionUpdaterCros::OnGetEolInfo(
+ EolInfoCallback cb,
+ chromeos::UpdateEngineClient::EolInfo eol_info) {
+ std::move(cb).Run(std::move(eol_info));
}
VersionUpdaterCros::VersionUpdaterCros(content::WebContents* web_contents)
: context_(web_contents ? web_contents->GetBrowserContext() : nullptr),
- last_operation_(UpdateEngineClient::UPDATE_STATUS_IDLE),
+ last_operation_(update_engine::Operation::IDLE),
check_for_update_when_idle_(false) {}
VersionUpdaterCros::~VersionUpdaterCros() {
@@ -269,64 +268,65 @@ VersionUpdaterCros::~VersionUpdaterCros() {
}
void VersionUpdaterCros::UpdateStatusChanged(
- const UpdateEngineClient::Status& status) {
+ const update_engine::StatusResult& status) {
Status my_status = UPDATED;
int progress = 0;
- std::string version = status.new_version;
- int64_t size = status.new_size;
+ std::string version = status.new_version();
+ int64_t size = status.new_size();
base::string16 message;
// If the updater is currently idle, just show the last operation (unless it
// was previously checking for an update -- in that case, the system is
// up to date now). See http://crbug.com/120063 for details.
- UpdateEngineClient::UpdateStatusOperation operation_to_show = status.status;
- if (status.status == UpdateEngineClient::UPDATE_STATUS_IDLE &&
- last_operation_ !=
- UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE) {
+ update_engine::Operation operation_to_show = status.current_operation();
+ if (status.current_operation() == update_engine::Operation::IDLE &&
+ last_operation_ != update_engine::Operation::CHECKING_FOR_UPDATE) {
operation_to_show = last_operation_;
}
switch (operation_to_show) {
- case UpdateEngineClient::UPDATE_STATUS_ERROR:
- case UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT:
- case UpdateEngineClient::UPDATE_STATUS_ATTEMPTING_ROLLBACK:
+ case update_engine::Operation::IDLE:
+ case update_engine::Operation::DISABLED:
+ case update_engine::Operation::ERROR:
+ case update_engine::Operation::REPORTING_ERROR_EVENT:
+ case update_engine::Operation::ATTEMPTING_ROLLBACK:
// This path previously used the FAILED status and IDS_UPGRADE_ERROR, but
// the update engine reports errors for some conditions that shouldn't
// actually be displayed as errors to users: http://crbug.com/146919.
// Just use the UPDATED status instead.
break;
- case UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE:
+ case update_engine::Operation::CHECKING_FOR_UPDATE:
my_status = CHECKING;
break;
- case UpdateEngineClient::UPDATE_STATUS_DOWNLOADING:
- progress = static_cast<int>(round(status.download_progress * 100));
+ case update_engine::Operation::DOWNLOADING:
+ progress = static_cast<int>(round(status.progress() * 100));
FALLTHROUGH;
- case UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE:
+ case update_engine::Operation::UPDATE_AVAILABLE:
my_status = UPDATING;
break;
- case UpdateEngineClient::UPDATE_STATUS_NEED_PERMISSION_TO_UPDATE:
+ case update_engine::Operation::NEED_PERMISSION_TO_UPDATE:
my_status = NEED_PERMISSION_TO_UPDATE;
break;
- case UpdateEngineClient::UPDATE_STATUS_VERIFYING:
- case UpdateEngineClient::UPDATE_STATUS_FINALIZING:
+ case update_engine::Operation::VERIFYING:
+ case update_engine::Operation::FINALIZING:
// Once the download is finished, keep the progress at 100; it shouldn't
// go down while the status is the same.
progress = 100;
my_status = UPDATING;
break;
- case UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT:
+ case update_engine::Operation::UPDATED_NEED_REBOOT:
my_status = NEARLY_UPDATED;
break;
default:
- break;
+ NOTREACHED();
}
- callback_.Run(my_status, progress, status.is_rollback, version, size,
- message);
- last_operation_ = status.status;
+ callback_.Run(my_status, progress, status.is_enterprise_rollback(), version,
+ size, message);
+ last_operation_ = status.current_operation();
if (check_for_update_when_idle_ &&
- status.status == UpdateEngineClient::UPDATE_STATUS_IDLE) {
+ status.current_operation() == update_engine::Operation::IDLE) {
CheckForUpdate(callback_, VersionUpdater::PromoteCallback());
}
}
diff --git a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.h b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.h
index 3ec09168b97..057881513d2 100644
--- a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.h
+++ b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.h
@@ -9,7 +9,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/webui/help/version_updater.h"
-#include "chromeos/dbus/update_engine_client.h"
namespace content {
class BrowserContext;
@@ -26,6 +25,7 @@ class VersionUpdaterCros : public VersionUpdater,
bool is_powerwash_allowed) override;
void GetChannel(bool get_current_channel,
const ChannelCallback& callback) override;
+ void GetEolInfo(EolInfoCallback callback) override;
void SetUpdateOverCellularOneTimePermission(const StatusCallback& callback,
const std::string& update_version,
int64_t update_size) override;
@@ -33,8 +33,6 @@ class VersionUpdaterCros : public VersionUpdater,
// Gets the last update status, without triggering a new check or download.
void GetUpdateStatus(const StatusCallback& callback);
- void GetEolStatus(EolStatusCallback callback) override;
-
protected:
friend class VersionUpdater;
@@ -44,8 +42,7 @@ class VersionUpdaterCros : public VersionUpdater,
private:
// UpdateEngineClient::Observer implementation.
- void UpdateStatusChanged(
- const chromeos::UpdateEngineClient::Status& status) override;
+ void UpdateStatusChanged(const update_engine::StatusResult& status) override;
// Callback from UpdateEngineClient::RequestUpdateCheck().
void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result);
@@ -57,10 +54,9 @@ class VersionUpdaterCros : public VersionUpdater,
void OnGetChannel(const ChannelCallback& cb,
const std::string& current_channel);
- // Callback from UpdateEngineClient::GetEolStatus().
- void OnGetEolStatus(EolStatusCallback cb,
- update_engine::EndOfLifeStatus status,
- base::Optional<int32_t> number_of_milestones);
+ // Callback from UpdateEngineClient::GetEolInfo().
+ void OnGetEolInfo(EolInfoCallback cb,
+ chromeos::UpdateEngineClient::EolInfo eol_info);
// BrowserContext in which the class was instantiated.
content::BrowserContext* context_;
@@ -69,7 +65,7 @@ class VersionUpdaterCros : public VersionUpdater,
StatusCallback callback_;
// Last state received via UpdateStatusChanged().
- chromeos::UpdateEngineClient::UpdateStatusOperation last_operation_;
+ update_engine::Operation last_operation_;
// True if an update check should be scheduled when the update engine is idle.
bool check_for_update_when_idle_;
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 850f225d3e7..5115ce9c60a 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
@@ -116,8 +116,8 @@ TEST_F(VersionUpdaterCrosTest, TwoOverlappingSetChannelRequests) {
version_updater_->SetChannel("beta-channel", true);
{
- UpdateEngineClient::Status status;
- status.status = UpdateEngineClient::UPDATE_STATUS_IDLE;
+ update_engine::StatusResult status;
+ status.set_current_operation(update_engine::Operation::IDLE);
fake_update_engine_client_->set_default_status(status);
fake_update_engine_client_->NotifyObserversThatStatusChanged(status);
}
@@ -130,9 +130,9 @@ TEST_F(VersionUpdaterCrosTest, TwoOverlappingSetChannelRequests) {
EXPECT_EQ(1, fake_update_engine_client_->request_update_check_call_count());
{
- UpdateEngineClient::Status status;
- status.status = UpdateEngineClient::UPDATE_STATUS_DOWNLOADING;
- status.download_progress = 0.1;
+ update_engine::StatusResult status;
+ status.set_current_operation(update_engine::Operation::DOWNLOADING);
+ status.set_progress(0.1);
fake_update_engine_client_->set_default_status(status);
fake_update_engine_client_->NotifyObserversThatStatusChanged(status);
}
@@ -142,8 +142,9 @@ TEST_F(VersionUpdaterCrosTest, TwoOverlappingSetChannelRequests) {
// DOWNLOADING -> REPORTING_ERROR_EVENT transition since target channel is not
// equal to downloading channel now.
{
- UpdateEngineClient::Status status;
- status.status = UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT;
+ update_engine::StatusResult status;
+ status.set_current_operation(
+ update_engine::Operation::REPORTING_ERROR_EVENT);
fake_update_engine_client_->set_default_status(status);
fake_update_engine_client_->NotifyObserversThatStatusChanged(status);
}
@@ -155,8 +156,8 @@ TEST_F(VersionUpdaterCrosTest, TwoOverlappingSetChannelRequests) {
// REPORTING_ERROR_EVENT -> IDLE transition, update check should be
// automatically scheduled.
{
- UpdateEngineClient::Status status;
- status.status = UpdateEngineClient::UPDATE_STATUS_IDLE;
+ update_engine::StatusResult status;
+ status.set_current_operation(update_engine::Operation::IDLE);
fake_update_engine_client_->set_default_status(status);
fake_update_engine_client_->NotifyObserversThatStatusChanged(status);
}
diff --git a/chromium/chrome/browser/ui/webui/history_ui.cc b/chromium/chrome/browser/ui/webui/history_ui.cc
index 5f900c0829b..4826cb8ecee 100644
--- a/chromium/chrome/browser/ui/webui/history_ui.cc
+++ b/chromium/chrome/browser/ui/webui/history_ui.cc
@@ -58,6 +58,7 @@ content::WebUIDataSource* CreateHistoryUIHTMLSource(Profile* profile) {
static constexpr LocalizedString kStrings[] = {
// Localized strings (alphabetical order).
{"actionMenuDescription", IDS_HISTORY_ACTION_MENU_DESCRIPTION},
+ {"ariaRoleDescription", IDS_HISTORY_ARIA_ROLE_DESCRIPTION},
{"bookmarked", IDS_HISTORY_ENTRY_BOOKMARKED},
{"cancel", IDS_CANCEL},
{"clearBrowsingData", IDS_CLEAR_BROWSING_DATA_TITLE},
diff --git a/chromium/chrome/browser/ui/webui/inspect_ui.cc b/chromium/chrome/browser/ui/webui/inspect_ui.cc
index 031cc220f5f..059c4d8bcb6 100644
--- a/chromium/chrome/browser/ui/webui/inspect_ui.cc
+++ b/chromium/chrome/browser/ui/webui/inspect_ui.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/webui/inspect_ui.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/macros.h"
#include "base/metrics/user_metrics.h"
@@ -69,14 +71,14 @@ const char kInspectUiNameField[] = "name";
const char kInspectUiUrlField[] = "url";
const char kInspectUiIsAdditionalField[] = "isAdditional";
-base::ListValue GetUiDevToolsTargets() {
- base::ListValue targets;
+base::Value GetUiDevToolsTargets() {
+ base::Value targets(base::Value::Type::LIST);
for (const auto& client_pair :
ui_devtools::UiDevToolsServer::GetClientNamesAndUrls()) {
- auto target_data = std::make_unique<base::DictionaryValue>();
- target_data->SetString(kInspectUiNameField, client_pair.first);
- target_data->SetString(kInspectUiUrlField, client_pair.second);
- target_data->SetBoolean(kInspectUiIsAdditionalField, true);
+ base::Value target_data(base::Value::Type::DICTIONARY);
+ target_data.SetStringKey(kInspectUiNameField, client_pair.first);
+ target_data.SetStringKey(kInspectUiUrlField, client_pair.second);
+ target_data.SetBoolKey(kInspectUiIsAdditionalField, true);
targets.Append(std::move(target_data));
}
return targets;
@@ -513,8 +515,7 @@ void InspectUI::StartListeningNotifications() {
DevToolsTargetsUIHandler::Callback callback =
base::Bind(&InspectUI::PopulateTargets, base::Unretained(this));
- base::ListValue additional_targets = GetUiDevToolsTargets();
- PopulateAdditionalTargets(additional_targets);
+ PopulateAdditionalTargets(GetUiDevToolsTargets());
AddTargetUIHandler(
DevToolsTargetsUIHandler::CreateForLocal(callback, profile));
@@ -666,7 +667,7 @@ void InspectUI::PopulateTargets(const std::string& source,
targets);
}
-void InspectUI::PopulateAdditionalTargets(const base::ListValue& targets) {
+void InspectUI::PopulateAdditionalTargets(const base::Value& targets) {
web_ui()->CallJavascriptFunctionUnsafe("populateAdditionalTargets", targets);
}
diff --git a/chromium/chrome/browser/ui/webui/inspect_ui.h b/chromium/chrome/browser/ui/webui/inspect_ui.h
index 6c491beeb30..e5fc1596fc1 100644
--- a/chromium/chrome/browser/ui/webui/inspect_ui.h
+++ b/chromium/chrome/browser/ui/webui/inspect_ui.h
@@ -7,6 +7,7 @@
#include <map>
#include <memory>
+#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
@@ -86,7 +87,7 @@ class InspectUI : public content::WebUIController,
void PopulateTargets(const std::string& source_id,
const base::ListValue& targets);
- void PopulateAdditionalTargets(const base::ListValue& targets);
+ void PopulateAdditionalTargets(const base::Value& targets);
void PopulatePortStatus(const base::Value& status);
diff --git a/chromium/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chromium/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
index 51016ebb1a9..96408e5feab 100644
--- a/chromium/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
+++ b/chromium/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -26,6 +26,7 @@
#include "components/grit/components_resources.h"
#include "components/safe_browsing/db/database_manager.h"
#include "components/security_interstitials/content/origin_policy_ui.h"
+#include "components/security_interstitials/core/ssl_error_options_mask.h"
#include "components/security_interstitials/core/ssl_error_ui.h"
#include "content/public/browser/interstitial_page_delegate.h"
#include "content/public/browser/render_frame_host.h"
@@ -41,6 +42,7 @@
#include "net/cert/x509_util.h"
#include "net/ssl/ssl_info.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "services/network/public/cpp/origin_policy.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/web_ui_util.h"
@@ -180,9 +182,11 @@ SSLBlockingPage* CreateSSLBlockingPage(content::WebContents* web_contents) {
// This delegate doesn't create an interstitial.
int options_mask = 0;
if (overridable)
- options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED;
+ options_mask |=
+ security_interstitials::SSLErrorOptionsMask::SOFT_OVERRIDE_ENABLED;
if (strict_enforcement)
- options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT;
+ options_mask |=
+ security_interstitials::SSLErrorOptionsMask::STRICT_ENFORCEMENT;
return SSLBlockingPage::Create(
web_contents, cert_error, ssl_info, request_url, options_mask,
time_triggered_, GURL(), nullptr,
@@ -250,9 +254,11 @@ BadClockBlockingPage* CreateBadClockBlockingPage(
// This delegate doesn't create an interstitial.
int options_mask = 0;
if (overridable)
- options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED;
+ options_mask |=
+ security_interstitials::SSLErrorOptionsMask::SOFT_OVERRIDE_ENABLED;
if (strict_enforcement)
- options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT;
+ options_mask |=
+ security_interstitials::SSLErrorOptionsMask::STRICT_ENFORCEMENT;
return new BadClockBlockingPage(
web_contents, cert_error, ssl_info, request_url, base::Time::Now(),
clock_state, nullptr,
diff --git a/chromium/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
index 867c83d78ca..acd49406748 100644
--- a/chromium/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/interstitials/interstitial_ui_browsertest.cc
@@ -183,7 +183,7 @@ IN_PROC_BROWSER_TEST_F(InterstitialUITest, CaptivePortalInterstitialWifi) {
IN_PROC_BROWSER_TEST_F(InterstitialUITest, OriginPolicyErrorInterstitial) {
TestInterstitial(GURL("chrome://interstitials/origin_policy"),
"Origin Policy Error",
- base::ASCIIToUTF16("has requested that a security policy"));
+ base::ASCIIToUTF16("has requested that an origin policy"));
}
// Tests that back button works after opening an interstitial from
diff --git a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals.mojom b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals.mojom
index 7e5201566a6..061c1e82179 100644
--- a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals.mojom
+++ b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals.mojom
@@ -58,7 +58,7 @@ interface InterventionsInternalsPageHandler {
GetPreviewsFlagsDetails() => (array<PreviewsFlag> flags);
// Inject the client side page object.
- SetClientPage(InterventionsInternalsPage page);
+ SetClientPage(pending_remote<InterventionsInternalsPage> page);
// Change the status of ignoring blacklist to |ignored|. |ignored| will
// indicate whether the blacklist decision would be ignored when deciding if a
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 2becb485ab2..f6bce1c0ea4 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
@@ -14,10 +14,15 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/flag_descriptions.h"
+#include "chrome/browser/ui/webui/interventions_internals/interventions_internals.mojom.h"
#include "chrome/common/chrome_switches.h"
#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 "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/features.h"
#include "net/nqe/network_quality_estimator_params.h"
#include "services/network/public/cpp/network_quality_tracker.h"
@@ -123,10 +128,10 @@ std::string GetEnabledStateForSwitch(const std::string& switch_name) {
} // namespace
InterventionsInternalsPageHandler::InterventionsInternalsPageHandler(
- mojom::InterventionsInternalsPageHandlerRequest request,
+ mojo::PendingReceiver<mojom::InterventionsInternalsPageHandler> receiver,
previews::PreviewsUIService* previews_ui_service,
network::NetworkQualityTracker* network_quality_tracker)
- : binding_(this, std::move(request)),
+ : receiver_(this, std::move(receiver)),
previews_ui_service_(previews_ui_service),
network_quality_tracker_(network_quality_tracker),
current_estimated_ect_(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN) {
@@ -143,8 +148,8 @@ InterventionsInternalsPageHandler::~InterventionsInternalsPageHandler() {
}
void InterventionsInternalsPageHandler::SetClientPage(
- mojom::InterventionsInternalsPagePtr page) {
- page_ = std::move(page);
+ mojo::PendingRemote<mojom::InterventionsInternalsPage> page) {
+ page_.Bind(std::move(page));
DCHECK(page_);
logger_->AddAndNotifyObserver(this);
(network_quality_tracker_ ? network_quality_tracker_
diff --git a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.h b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.h
index 87a45b749cc..b892a1efe74 100644
--- a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.h
+++ b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.h
@@ -13,7 +13,10 @@
#include "components/previews/content/previews_ui_service.h"
#include "components/previews/core/previews_logger.h"
#include "components/previews/core/previews_logger_observer.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "net/nqe/effective_connection_type.h"
#include "services/network/public/cpp/network_quality_tracker.h"
@@ -23,7 +26,7 @@ class InterventionsInternalsPageHandler
public mojom::InterventionsInternalsPageHandler {
public:
InterventionsInternalsPageHandler(
- mojom::InterventionsInternalsPageHandlerRequest request,
+ mojo::PendingReceiver<mojom::InterventionsInternalsPageHandler> receiver,
previews::PreviewsUIService* previews_ui_service,
network::NetworkQualityTracker* network_quality_tracker);
~InterventionsInternalsPageHandler() override;
@@ -32,7 +35,8 @@ class InterventionsInternalsPageHandler
void GetPreviewsEnabled(GetPreviewsEnabledCallback callback) override;
void GetPreviewsFlagsDetails(
GetPreviewsFlagsDetailsCallback callback) override;
- void SetClientPage(mojom::InterventionsInternalsPagePtr page) override;
+ void SetClientPage(
+ mojo::PendingRemote<mojom::InterventionsInternalsPage> page) override;
void SetIgnorePreviewsBlacklistDecision(bool ignore) override;
// previews::PreviewsLoggerObserver:
@@ -49,7 +53,7 @@ class InterventionsInternalsPageHandler
void OnEffectiveConnectionTypeChanged(
net::EffectiveConnectionType type) override;
- mojo::Binding<mojom::InterventionsInternalsPageHandler> binding_;
+ mojo::Receiver<mojom::InterventionsInternalsPageHandler> receiver_;
// The PreviewsLogger that this handler is listening to, and guaranteed to
// outlive |this|.
@@ -67,7 +71,7 @@ class InterventionsInternalsPageHandler
net::EffectiveConnectionType current_estimated_ect_;
// Handle back to the page by which we can pass in new log messages.
- mojom::InterventionsInternalsPagePtr page_;
+ mojo::Remote<mojom::InterventionsInternalsPage> page_;
DISALLOW_COPY_AND_ASSIGN(InterventionsInternalsPageHandler);
};
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 c4b5994f991..ec9be763c15 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
@@ -39,7 +39,9 @@
#include "components/previews/core/previews_logger_observer.h"
#include "components/previews/core/previews_switches.h"
#include "content/public/test/browser_task_environment.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/features.h"
#include "net/nqe/effective_connection_type.h"
#include "net/nqe/network_quality_estimator_params.h"
@@ -145,8 +147,8 @@ class TestInterventionsInternalsPage
: public mojom::InterventionsInternalsPage {
public:
TestInterventionsInternalsPage(
- mojom::InterventionsInternalsPageRequest request)
- : binding_(this, std::move(request)), blacklist_ignored_(false) {}
+ mojo::PendingReceiver<mojom::InterventionsInternalsPage> receiver)
+ : receiver_(this, std::move(receiver)), blacklist_ignored_(false) {}
~TestInterventionsInternalsPage() override {}
@@ -188,7 +190,7 @@ class TestInterventionsInternalsPage
bool blacklist_ignored() const { return blacklist_ignored_; }
private:
- mojo::Binding<mojom::InterventionsInternalsPage> binding_;
+ mojo::Receiver<mojom::InterventionsInternalsPage> receiver_;
// The MessageLogPtr passed in LogNewMessage method.
std::unique_ptr<mojom::MessageLogPtr> message_;
@@ -285,21 +287,21 @@ class InterventionsInternalsPageHandlerTest : public testing::Test {
ASSERT_TRUE(profile_manager_.SetUp());
- mojom::InterventionsInternalsPageHandlerPtr page_handler_ptr;
-
- mojom::InterventionsInternalsPageHandlerRequest handler_request =
- mojo::MakeRequest(&page_handler_ptr);
+ mojo::PendingReceiver<mojom::InterventionsInternalsPageHandler>
+ handler_receiver =
+ mojo::PendingRemote<mojom::InterventionsInternalsPageHandler>()
+ .InitWithNewPipeAndPassReceiver();
page_handler_ = std::make_unique<InterventionsInternalsPageHandler>(
- std::move(handler_request), previews_ui_service_.get(),
+ std::move(handler_receiver), previews_ui_service_.get(),
&test_network_quality_tracker_);
- mojom::InterventionsInternalsPagePtr page_ptr;
- mojom::InterventionsInternalsPageRequest page_request =
- mojo::MakeRequest(&page_ptr);
+ mojo::PendingRemote<mojom::InterventionsInternalsPage> page;
+ mojo::PendingReceiver<mojom::InterventionsInternalsPage> page_receiver =
+ page.InitWithNewPipeAndPassReceiver();
page_ = std::make_unique<TestInterventionsInternalsPage>(
- std::move(page_request));
+ std::move(page_receiver));
- page_handler_->SetClientPage(std::move(page_ptr));
+ page_handler_->SetClientPage(std::move(page));
scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>();
}
diff --git a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.cc b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.cc
index 2bd0e34b7cd..7a6d49bbd45 100644
--- a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h"
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -12,10 +13,12 @@
#include "chrome/browser/previews/previews_service.h"
#include "chrome/browser/previews/previews_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/interventions_internals/interventions_internals.mojom.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "components/previews/content/previews_ui_service.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
namespace {
@@ -62,8 +65,8 @@ InterventionsInternalsUI::InterventionsInternalsUI(content::WebUI* web_ui)
InterventionsInternalsUI::~InterventionsInternalsUI() {}
void InterventionsInternalsUI::BindInterventionsInternalsPageHandler(
- mojom::InterventionsInternalsPageHandlerRequest request) {
+ mojo::PendingReceiver<mojom::InterventionsInternalsPageHandler> receiver) {
DCHECK(previews_ui_service_);
page_handler_ = std::make_unique<InterventionsInternalsPageHandler>(
- std::move(request), previews_ui_service_, nullptr);
+ std::move(receiver), previews_ui_service_, nullptr);
}
diff --git a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h
index b284a9d8131..97143b00575 100644
--- a/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h
+++ b/chromium/chrome/browser/ui/webui/interventions_internals/interventions_internals_ui.h
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/interventions_internals/interventions_internals.mojom.h"
#include "chrome/browser/ui/webui/interventions_internals/interventions_internals_page_handler.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
namespace previews {
@@ -22,7 +23,7 @@ class InterventionsInternalsUI : public ui::MojoWebUIController {
private:
void BindInterventionsInternalsPageHandler(
- mojom::InterventionsInternalsPageHandlerRequest request);
+ mojo::PendingReceiver<mojom::InterventionsInternalsPageHandler> receiver);
// The PreviewsUIService associated with this UI.
previews::PreviewsUIService* previews_ui_service_;
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 94f7f790bb2..711b68fa7c0 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
@@ -43,6 +43,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/printing/cups_printers_manager_factory.h"
#include "chrome/common/pref_names.h"
#include "chromeos/components/account_manager/account_manager.h"
diff --git a/chromium/chrome/browser/ui/webui/management_ui.cc b/chromium/chrome/browser/ui/webui/management_ui.cc
index cf98a0cd441..2d50de52824 100644
--- a/chromium/chrome/browser/ui/webui/management_ui.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui.cc
@@ -25,6 +25,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/grit/chromium_strings.h"
#include "ui/chromeos/devicetype_utils.h"
@@ -115,14 +116,12 @@ content::WebUIDataSource* CreateManagementUIHtmlSource(Profile* profile) {
#endif // defined(OS_CHROMEOS)
source->UseStringsJs();
+ source->EnableReplaceI18nInJS();
// Add required resources.
- source->AddResourcePath("management_browser_proxy.html",
- IDR_MANAGEMENT_BROWSER_PROXY_HTML);
source->AddResourcePath("management_browser_proxy.js",
IDR_MANAGEMENT_BROWSER_PROXY_JS);
- source->AddResourcePath("management_ui.html", IDR_MANAGEMENT_UI_HTML);
source->AddResourcePath("management_ui.js", IDR_MANAGEMENT_UI_JS);
- source->AddResourcePath("icons.html", IDR_MANAGEMENT_ICONS_HTML);
+ source->AddResourcePath("icons.js", IDR_MANAGEMENT_ICONS_JS);
source->SetDefaultResource(IDR_MANAGEMENT_HTML);
return source;
}
diff --git a/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc
index 8cd3f96a813..e358945c1b8 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui_browsertest.cc
@@ -59,7 +59,7 @@ IN_PROC_BROWSER_TEST_F(ManagementUITest, ManagementStateChange) {
// The browser is not managed.
const std::string javascript =
- "management.ManagementBrowserProxyImpl.getInstance()"
+ "window.ManagementBrowserProxyImpl.getInstance()"
" .getContextualManagedData()"
" .then(managed_result => "
" domAutomationController.send(JSON.stringify(managed_result)));";
diff --git a/chromium/chrome/browser/ui/webui/management_ui_handler.cc b/chromium/chrome/browser/ui/webui/management_ui_handler.cc
index 6b9e20b4ac9..6442a49973f 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_handler.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui_handler.cc
@@ -203,7 +203,7 @@ void AddDeviceReportingElement(base::Value* report_sources,
base::Value data(base::Value::Type::DICTIONARY);
data.SetKey("messageId", base::Value(message_id));
data.SetKey("reportingType", base::Value(ToJSDeviceReportingType(type)));
- report_sources->GetList().push_back(std::move(data));
+ report_sources->Append(std::move(data));
}
void AddDeviceReportingInfo(base::Value* report_sources, Profile* profile) {
@@ -297,7 +297,7 @@ base::Value GetPowerfulExtensions(const extensions::ExtensionSet& extensions) {
extensions::util::GetExtensionInfo(extension.get());
extension_to_add->SetKey("permissions",
base::Value(std::move(permission_messages)));
- powerful_extensions.GetList().push_back(std::move(*extension_to_add));
+ powerful_extensions.Append(std::move(*extension_to_add));
}
}
@@ -336,11 +336,8 @@ std::string ManagementUIHandler::GetAccountDomain(Profile* profile) {
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();
+ return (domain == "gmail.com" || domain == "googlemail.com") ? std::string()
+ : domain;
}
ManagementUIHandler::ManagementUIHandler() {
@@ -410,8 +407,7 @@ void ManagementUIHandler::OnJavascriptDisallowed() {
RemoveObservers();
}
-void ManagementUIHandler::AddExtensionReportingInfo(
- base::Value* report_sources) {
+void ManagementUIHandler::AddReportingInfo(base::Value* report_sources) {
const extensions::Extension* cloud_reporting_extension =
GetEnabledExtension(kCloudReportingExtensionId);
@@ -439,6 +435,15 @@ void ManagementUIHandler::AddExtensionReportingInfo(
const bool cloud_reporting_extension_installed =
cloud_reporting_extension != nullptr;
+ const auto* cloud_reporting_policy_value =
+ GetPolicyService()
+ ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME,
+ std::string()))
+ .GetValue(policy::key::kCloudReportingEnabled);
+ const bool cloud_reporting_policy_enabled =
+ cloud_reporting_policy_value && cloud_reporting_policy_value->is_bool() &&
+ cloud_reporting_policy_value->GetBool();
+
const struct {
const char* policy_key;
const char* message;
@@ -446,22 +451,25 @@ void ManagementUIHandler::AddExtensionReportingInfo(
const bool enabled_by_default;
} report_definitions[] = {
{kPolicyKeyReportMachineIdData, kManagementExtensionReportMachineName,
- ReportingType::kDevice, cloud_reporting_extension_installed},
+ ReportingType::kDevice,
+ cloud_reporting_extension_installed || cloud_reporting_policy_enabled},
{kPolicyKeyReportMachineIdData,
kManagementExtensionReportMachineNameAddress, ReportingType::kDevice,
false},
{kPolicyKeyReportVersionData, kManagementExtensionReportVersion,
- ReportingType::kDevice, cloud_reporting_extension_installed},
+ ReportingType::kDevice,
+ cloud_reporting_extension_installed || cloud_reporting_policy_enabled},
{kPolicyKeyReportSystemTelemetryData, kManagementExtensionReportPerfCrash,
ReportingType::kDevice, false},
{kPolicyKeyReportUserIdData, kManagementExtensionReportUsername,
- ReportingType::kUser, cloud_reporting_extension_installed},
+ ReportingType::kUser,
+ cloud_reporting_extension_installed || cloud_reporting_policy_enabled},
{kPolicyKeyReportSafeBrowsingData,
kManagementExtensionReportSafeBrowsingWarnings, ReportingType::kSecurity,
cloud_reporting_extension_installed},
{kPolicyKeyReportExtensionsData,
kManagementExtensionReportExtensionsPlugin, ReportingType::kExtensions,
- cloud_reporting_extension_installed},
+ cloud_reporting_extension_installed || cloud_reporting_policy_enabled},
{kPolicyKeyReportUserBrowsingData,
kManagementExtensionReportUserBrowsingData, ReportingType::kUserActivity,
false},
@@ -503,7 +511,7 @@ void ManagementUIHandler::AddExtensionReportingInfo(
data.SetKey(
"reportingType",
base::Value(GetReportingTypeValue(report_definition.reporting_type)));
- report_sources->GetList().push_back(std::move(data));
+ report_sources->Append(std::move(data));
}
}
@@ -597,7 +605,7 @@ base::Value ManagementUIHandler::GetThreatProtectionInfo(
base::Value value(base::Value::Type::DICTIONARY);
value.SetStringKey("title", kManagementDataLossPreventionName);
value.SetStringKey("permission", kManagementDataLossPreventionPermissions);
- info.GetList().push_back(std::move(value));
+ info.Append(std::move(value));
}
// SendFilesForMalwareCheck is a int-enum policy. The accepted values are
@@ -606,13 +614,13 @@ base::Value ManagementUIHandler::GetThreatProtectionInfo(
chrome_policies.GetValue(policy::key::kSendFilesForMalwareCheck);
if (send_files_for_malware_check_value &&
send_files_for_malware_check_value->GetInt() >
- safe_browsing::SEND_FILES_DISABLED &&
+ safe_browsing::DO_NOT_SCAN &&
send_files_for_malware_check_value->GetInt() <=
safe_browsing::SEND_FILES_FOR_MALWARE_CHECK_MAX) {
base::Value value(base::Value::Type::DICTIONARY);
value.SetStringKey("title", kManagementMalwareScanningName);
value.SetStringKey("permission", kManagementMalwareScanningPermissions);
- info.GetList().push_back(std::move(value));
+ info.Append(std::move(value));
}
auto* unsafe_event_reporting_value =
@@ -621,7 +629,7 @@ base::Value ManagementUIHandler::GetThreatProtectionInfo(
base::Value value(base::Value::Type::DICTIONARY);
value.SetStringKey("title", kManagementEnterpriseReportingName);
value.SetStringKey("permission", kManagementEnterpriseReportingPermissions);
- info.GetList().push_back(std::move(value));
+ info.Append(std::move(value));
}
#if defined(OS_CHROMEOS)
@@ -825,14 +833,14 @@ void ManagementUIHandler::HandleInitBrowserReportingInfo(
const base::ListValue* args) {
base::Value report_sources(base::Value::Type::LIST);
AllowJavascript();
- AddExtensionReportingInfo(&report_sources);
+ AddReportingInfo(&report_sources);
ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
report_sources);
}
void ManagementUIHandler::NotifyBrowserReportingInfoUpdated() {
base::Value report_sources(base::Value::Type::LIST);
- AddExtensionReportingInfo(&report_sources);
+ AddReportingInfo(&report_sources);
FireWebUIListener("browser-reporting-info-updated", report_sources);
}
diff --git a/chromium/chrome/browser/ui/webui/management_ui_handler.h b/chromium/chrome/browser/ui/webui/management_ui_handler.h
index f06e8d6e58a..78fc6f597fe 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_handler.h
+++ b/chromium/chrome/browser/ui/webui/management_ui_handler.h
@@ -113,7 +113,7 @@ class ManagementUIHandler : public content::WebUIMessageHandler,
static void InitializeInternal(content::WebUI* web_ui,
content::WebUIDataSource* source,
Profile* profile);
- void AddExtensionReportingInfo(base::Value* report_sources);
+ void AddReportingInfo(base::Value* report_sources);
base::DictionaryValue GetContextualManagedData(Profile* profile);
base::Value GetThreatProtectionInfo(Profile* profile) const;
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 8541fce2c79..5eb74d5c0a7 100644
--- a/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/management_ui_handler_unittest.cc
@@ -61,7 +61,7 @@ class TestManagementUIHandler : public ManagementUIHandler {
base::Value GetExtensionReportingInfo() {
base::Value report_sources(base::Value::Type::LIST);
- AddExtensionReportingInfo(&report_sources);
+ AddReportingInfo(&report_sources);
return report_sources;
}
@@ -304,7 +304,7 @@ TEST_F(ManagementUIHandlerTests,
TEST_F(ManagementUIHandlerTests,
ManagementContextualSourceUpdateManagedKnownDomain) {
TestingProfile::Builder builder;
- builder.SetProfileName("managed@manager.com");
+ builder.SetProfileName("managed@gmail.com.manager.com.gmail.com");
auto profile = builder.Build();
base::string16 extension_reporting_title;
@@ -324,15 +324,17 @@ TEST_F(ManagementUIHandlerTests,
EXPECT_EQ(data.DictSize(), 4u);
EXPECT_EQ(extension_reporting_title,
- l10n_util::GetStringFUTF16(IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
- base::UTF8ToUTF16("manager.com")));
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_EXTENSIONS_INSTALLED_BY,
+ base::UTF8ToUTF16("gmail.com.manager.com.gmail.com")));
EXPECT_EQ(browser_management_notice,
l10n_util::GetStringFUTF16(
IDS_MANAGEMENT_BROWSER_NOTICE,
base::UTF8ToUTF16(chrome::kManagedUiLearnMoreUrl)));
EXPECT_EQ(subtitle,
- l10n_util::GetStringFUTF16(IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
- base::UTF8ToUTF16("manager.com")));
+ l10n_util::GetStringFUTF16(
+ IDS_MANAGEMENT_SUBTITLE_MANAGED_BY,
+ base::UTF8ToUTF16("gmail.com.manager.com.gmail.com")));
EXPECT_TRUE(managed);
}
@@ -565,6 +567,31 @@ TEST_F(ManagementUIHandlerTests,
EXPECT_EQ(reporting_info.GetList().size(), expected_messages.size());
}
+TEST_F(ManagementUIHandlerTests, CloudReportingPolicy) {
+ handler_.EnableCloudReportingExtension(false);
+
+ policy::PolicyMap chrome_policies;
+ const policy::PolicyNamespace chrome_policies_namespace =
+ policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string());
+ EXPECT_CALL(policy_service_, GetPolicies(_))
+ .WillRepeatedly(ReturnRef(chrome_policies));
+ SetPolicyValue(policy::key::kCloudReportingEnabled, chrome_policies, true);
+
+ std::set<std::string> expected_messages = {
+ kManagementExtensionReportMachineName, kManagementExtensionReportUsername,
+ kManagementExtensionReportVersion,
+ kManagementExtensionReportExtensionsPlugin};
+
+ auto reporting_info = handler_.GetExtensionReportingInfo();
+ const auto& reporting_info_list = reporting_info.GetList();
+
+ for (const base::Value& info : reporting_info_list) {
+ const std::string* messageId = info.FindStringKey("messageId");
+ EXPECT_TRUE(expected_messages.find(*messageId) != expected_messages.end());
+ }
+ EXPECT_EQ(reporting_info.GetList().size(), expected_messages.size());
+}
+
TEST_F(ManagementUIHandlerTests, ExtensionReportingInfoPoliciesMerge) {
policy::PolicyMap on_prem_reporting_extension_beta_policies;
policy::PolicyMap on_prem_reporting_extension_stable_policies;
@@ -603,6 +630,11 @@ TEST_F(ManagementUIHandlerTests, ExtensionReportingInfoPoliciesMerge) {
EXPECT_CALL(policy_service_,
GetPolicies(on_prem_reporting_extension_beta_policy_namespace))
.WillOnce(ReturnRef(on_prem_reporting_extension_beta_policies));
+ policy::PolicyMap empty_policy_map;
+ EXPECT_CALL(policy_service_,
+ GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME,
+ std::string())))
+ .WillOnce(ReturnRef(empty_policy_map));
handler_.EnableCloudReportingExtension(true);
@@ -686,19 +718,19 @@ TEST_F(ManagementUIHandlerTests, ThreatReportingInfo) {
base::Value value(base::Value::Type::DICTIONARY);
value.SetStringKey("title", kManagementDataLossPreventionName);
value.SetStringKey("permission", kManagementDataLossPreventionPermissions);
- expected_info.GetList().push_back(std::move(value));
+ expected_info.Append(std::move(value));
}
{
base::Value value(base::Value::Type::DICTIONARY);
value.SetStringKey("title", kManagementMalwareScanningName);
value.SetStringKey("permission", kManagementMalwareScanningPermissions);
- expected_info.GetList().push_back(std::move(value));
+ expected_info.Append(std::move(value));
}
{
base::Value value(base::Value::Type::DICTIONARY);
value.SetStringKey("title", kManagementEnterpriseReportingName);
value.SetStringKey("permission", kManagementEnterpriseReportingPermissions);
- expected_info.GetList().push_back(std::move(value));
+ expected_info.Append(std::move(value));
}
EXPECT_EQ(expected_info, *threat_protection_info->FindListKey("info"));
diff --git a/chromium/chrome/browser/ui/webui/media/media_engagement_ui.cc b/chromium/chrome/browser/ui/webui/media/media_engagement_ui.cc
index e69a536ae5c..66a07e5567e 100644
--- a/chromium/chrome/browser/ui/webui/media/media_engagement_ui.cc
+++ b/chromium/chrome/browser/ui/webui/media/media_engagement_ui.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/webui/media/media_engagement_ui.h"
#include <memory>
+#include <utility>
#include "base/bind.h"
#include "base/command_line.h"
@@ -13,6 +14,7 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/media/media_engagement_score.h"
+#include "chrome/browser/media/media_engagement_score_details.mojom.h"
#include "chrome/browser/media/media_engagement_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
@@ -25,7 +27,8 @@
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/web_preferences.h"
#include "media/base/media_switches.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#if !defined(OS_ANDROID)
#include "chrome/common/pref_names.h"
@@ -48,11 +51,11 @@ class MediaEngagementScoreDetailsProviderImpl
public:
MediaEngagementScoreDetailsProviderImpl(
content::WebUI* web_ui,
- mojo::InterfaceRequest<media::mojom::MediaEngagementScoreDetailsProvider>
- request)
+ mojo::PendingReceiver<media::mojom::MediaEngagementScoreDetailsProvider>
+ receiver)
: web_ui_(web_ui),
profile_(Profile::FromWebUI(web_ui)),
- binding_(this, std::move(request)) {
+ receiver_(this, std::move(receiver)) {
DCHECK(web_ui_);
DCHECK(profile_);
service_ = MediaEngagementService::Get(profile_);
@@ -130,7 +133,7 @@ class MediaEngagementScoreDetailsProviderImpl
MediaEngagementService* service_;
- mojo::Binding<media::mojom::MediaEngagementScoreDetailsProvider> binding_;
+ mojo::Receiver<media::mojom::MediaEngagementScoreDetailsProvider> receiver_;
DISALLOW_COPY_AND_ASSIGN(MediaEngagementScoreDetailsProviderImpl);
};
@@ -156,7 +159,8 @@ MediaEngagementUI::MediaEngagementUI(content::WebUI* web_ui)
MediaEngagementUI::~MediaEngagementUI() = default;
void MediaEngagementUI::BindMediaEngagementScoreDetailsProvider(
- media::mojom::MediaEngagementScoreDetailsProviderRequest request) {
+ mojo::PendingReceiver<media::mojom::MediaEngagementScoreDetailsProvider>
+ receiver) {
ui_handler_ = std::make_unique<MediaEngagementScoreDetailsProviderImpl>(
- web_ui(), std::move(request));
+ web_ui(), std::move(receiver));
}
diff --git a/chromium/chrome/browser/ui/webui/media/media_engagement_ui.h b/chromium/chrome/browser/ui/webui/media/media_engagement_ui.h
index a6d311226fb..51d367b598b 100644
--- a/chromium/chrome/browser/ui/webui/media/media_engagement_ui.h
+++ b/chromium/chrome/browser/ui/webui/media/media_engagement_ui.h
@@ -5,8 +5,11 @@
#ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_MEDIA_ENGAGEMENT_UI_H_
#define CHROME_BROWSER_UI_WEBUI_MEDIA_MEDIA_ENGAGEMENT_UI_H_
+#include <memory>
+
#include "base/macros.h"
#include "chrome/browser/media/media_engagement_score_details.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
// The UI for chrome://media-engagement/.
@@ -17,7 +20,8 @@ class MediaEngagementUI : public ui::MojoWebUIController {
private:
void BindMediaEngagementScoreDetailsProvider(
- media::mojom::MediaEngagementScoreDetailsProviderRequest request);
+ mojo::PendingReceiver<media::mojom::MediaEngagementScoreDetailsProvider>
+ receiver);
std::unique_ptr<media::mojom::MediaEngagementScoreDetailsProvider>
ui_handler_;
diff --git a/chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.cc b/chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.cc
index f986d70ad5e..f3390a9b16f 100644
--- a/chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.cc
@@ -18,17 +18,17 @@ MediaRouterInternalsWebUIMessageHandler::
void MediaRouterInternalsWebUIMessageHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
- "initialized",
+ "getStatus",
base::BindRepeating(
- &MediaRouterInternalsWebUIMessageHandler::HandleInitialized,
+ &MediaRouterInternalsWebUIMessageHandler::HandleGetStatus,
base::Unretained(this)));
}
-void MediaRouterInternalsWebUIMessageHandler::HandleInitialized(
+void MediaRouterInternalsWebUIMessageHandler::HandleGetStatus(
const base::ListValue* args) {
AllowJavascript();
- CallJavascriptFunction("media_router_internals.setStatus",
- router_->GetState());
+ const base::Value& callback_id = args->GetList()[0];
+ ResolveJavascriptCallback(callback_id, router_->GetState());
}
} // namespace media_router
diff --git a/chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.h b/chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.h
index 0f9c6fb49a8..b893c1e370b 100644
--- a/chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.h
+++ b/chromium/chrome/browser/ui/webui/media_router/media_router_internals_webui_message_handler.h
@@ -25,7 +25,7 @@ class MediaRouterInternalsWebUIMessageHandler
void RegisterMessages() override;
// Handlers for JavaScript messages.
- void HandleInitialized(const base::ListValue* args);
+ void HandleGetStatus(const base::ListValue* args);
// Pointer to the MediaRouter.
const MediaRouter* router_;
diff --git a/chromium/chrome/browser/ui/webui/memory_internals_ui.cc b/chromium/chrome/browser/ui/webui/memory_internals_ui.cc
index 6ce8d49549e..35f89024c7d 100644
--- a/chromium/chrome/browser/ui/webui/memory_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/memory_internals_ui.cc
@@ -33,14 +33,12 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/system_connector.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 "content/public/browser/web_ui_message_handler.h"
#include "content/public/common/process_type.h"
#include "mojo/public/cpp/system/platform_handle.h"
-#include "services/service_manager/public/cpp/connector.h"
#include "ui/shell_dialogs/select_file_dialog.h"
#include "ui/shell_dialogs/select_file_policy.h"
@@ -105,8 +103,8 @@ std::string GetMessageString() {
// Generates one row of the returned process info.
base::Value MakeProcessInfo(int pid, std::string description) {
base::Value result(base::Value::Type::LIST);
- result.GetList().push_back(base::Value(pid));
- result.GetList().push_back(base::Value(std::move(description)));
+ result.Append(base::Value(pid));
+ result.Append(base::Value(std::move(description)));
return result;
}
@@ -269,7 +267,6 @@ void MemoryInternalsDOMHandler::HandleStartProfiling(
supervisor->StartManualProfiling(pid);
} else {
supervisor->Start(
- content::GetSystemConnector(),
base::BindOnce(&heap_profiling::Supervisor::StartManualProfiling,
base::Unretained(supervisor), pid));
}
diff --git a/chromium/chrome/browser/ui/webui/net_export_ui.cc b/chromium/chrome/browser/ui/webui/net_export_ui.cc
index 081ef17bf0d..7b7cf106ad3 100644
--- a/chromium/chrome/browser/ui/webui/net_export_ui.cc
+++ b/chromium/chrome/browser/ui/webui/net_export_ui.cc
@@ -212,7 +212,7 @@ void NetExportMessageHandler::OnEnableNotifyUIWithState(
void NetExportMessageHandler::OnStartNetLog(const base::ListValue* list) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- const base::Value::ListStorage& params = list->GetList();
+ base::span<const base::Value> params = list->GetList();
// Determine the capture mode.
capture_mode_ = net::NetLogCaptureMode::kDefault;
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 8c5bfd5d3fc..3d53fdef64c 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
@@ -35,6 +35,7 @@
#include "content/public/browser/web_ui_message_handler.h"
#include "net/log/net_log_util.h"
#include "services/network/expect_ct_reporter.h"
+#include "services/network/public/mojom/network_context.mojom.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/file_manager/filesystem_api_util.h"
@@ -44,7 +45,7 @@
#include "chrome/browser/policy/policy_conversions.h"
#include "chrome/common/logging_chrome.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/debug_daemon_client.h"
+#include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
#include "chromeos/network/onc/onc_certificate_importer_impl.h"
#include "chromeos/network/onc/onc_parsed_certificates.h"
#include "chromeos/network/onc/onc_utils.h"
diff --git a/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc
index eab07796c00..9ca268af073 100644
--- a/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc
@@ -14,6 +14,7 @@
#include "base/files/scoped_file.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/message_loop/message_loop_current.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -35,6 +36,9 @@
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/address_list.h"
#include "net/base/net_errors.h"
#include "net/dns/host_resolver_source.h"
@@ -66,10 +70,11 @@ class DnsLookupClient : public network::mojom::ResolveHostClient {
public:
using Callback = base::OnceCallback<void(base::Value*)>;
- DnsLookupClient(network::mojom::ResolveHostClientRequest request,
- Callback callback)
- : binding_(this, std::move(request)), callback_(std::move(callback)) {
- binding_.set_connection_error_handler(
+ DnsLookupClient(
+ mojo::PendingReceiver<network::mojom::ResolveHostClient> receiver,
+ Callback callback)
+ : receiver_(this, std::move(receiver)), callback_(std::move(callback)) {
+ receiver_.set_disconnect_handler(
base::BindOnce(&DnsLookupClient::OnComplete, base::Unretained(this),
net::ERR_FAILED, base::nullopt));
}
@@ -95,7 +100,7 @@ class DnsLookupClient : public network::mojom::ResolveHostClient {
}
private:
- mojo::Binding<network::mojom::ResolveHostClient> binding_;
+ mojo::Receiver<network::mojom::ResolveHostClient> receiver_;
Callback callback_;
};
@@ -214,15 +219,15 @@ void NetInternalsTest::MessageHandler::DnsLookup(
auto resolve_host_parameters = network::mojom::ResolveHostParameters::New();
if (local)
resolve_host_parameters->source = net::HostResolverSource::LOCAL_ONLY;
- network::mojom::ResolveHostClientPtr client_ptr;
+ mojo::PendingRemote<network::mojom::ResolveHostClient> client;
// DnsLookupClient owns itself.
- new DnsLookupClient(mojo::MakeRequest(&client_ptr),
+ new DnsLookupClient(client.InitWithNewPipeAndPassReceiver(),
base::BindOnce(&MessageHandler::RunJavascriptCallback,
weak_factory_.GetWeakPtr()));
content::BrowserContext::GetDefaultStoragePartition(browser()->profile())
->GetNetworkContext()
->ResolveHost(net::HostPortPair(hostname, 80),
- std::move(resolve_host_parameters), std::move(client_ptr));
+ std::move(resolve_host_parameters), std::move(client));
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chromium/chrome/browser/ui/webui/notifications_internals/notifications_internals_ui_message_handler.cc b/chromium/chrome/browser/ui/webui/notifications_internals/notifications_internals_ui_message_handler.cc
index cd4c3f51c07..a9753fabdf2 100644
--- a/chromium/chrome/browser/ui/webui/notifications_internals/notifications_internals_ui_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/notifications_internals/notifications_internals_ui_message_handler.cc
@@ -41,6 +41,7 @@ void NotificationsInternalsUIMessageHandler::HandleScheduleNotification(
schedule_params.deliver_time_end =
base::Time::Now() + base::TimeDelta::FromMinutes(5);
notifications::NotificationData data;
+ // TOOD(hesen): Enable adding icons from notifications-internals HTML.
data.custom_data.emplace("url", args->GetList()[1].GetString());
data.title = base::UTF8ToUTF16(args->GetList()[2].GetString());
data.message = base::UTF8ToUTF16(args->GetList()[3].GetString());
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 abeeef88687..36c8b28c89f 100644
--- a/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chromium/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -145,8 +145,8 @@ void AppLauncherHandler::CreateAppInfo(const Extension* extension,
bool enabled =
service->IsExtensionEnabled(extension->id()) &&
!extensions::ExtensionRegistry::Get(service->GetBrowserContext())
- ->GetExtensionById(extension->id(),
- extensions::ExtensionRegistry::TERMINATED);
+ ->terminated_extensions()
+ .GetByID(extension->id());
extensions::GetExtensionBasicInfo(extension, enabled, value);
value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get(
@@ -303,7 +303,8 @@ void AppLauncherHandler::Observe(int type,
content::Details<const std::string>(details).ptr();
if (id) {
const Extension* extension =
- extension_service_->GetInstalledExtension(*id);
+ ExtensionRegistry::Get(extension_service_->profile())
+ ->GetInstalledExtension(*id);
if (!extension) {
// Extension could still be downloading or installing.
return;
@@ -376,8 +377,10 @@ void AppLauncherHandler::FillAppDictionary(base::DictionaryValue* dictionary) {
Profile* profile = Profile::FromWebUI(web_ui());
PrefService* prefs = profile->GetPrefs();
+ ExtensionRegistry* registry =
+ ExtensionRegistry::Get(extension_service_->profile());
for (auto it = visible_apps_.begin(); it != visible_apps_.end(); ++it) {
- const Extension* extension = extension_service_->GetInstalledExtension(*it);
+ const Extension* extension = registry->GetInstalledExtension(*it);
if (extension && extensions::ui_util::ShouldDisplayInNewTabPage(
extension, profile)) {
installed_extensions->Append(GetAppInfo(extension));
@@ -491,8 +494,8 @@ void AppLauncherHandler::HandleLaunchApp(const base::ListValue* args) {
Profile* profile = extension_service_->profile();
const Extension* extension =
- extensions::ExtensionRegistry::Get(profile)->GetExtensionById(
- extension_id, extensions::ExtensionRegistry::ENABLED);
+ extensions::ExtensionRegistry::Get(profile)->enabled_extensions().GetByID(
+ extension_id);
// Prompt the user to re-enable the application if disabled.
if (!extension) {
@@ -524,8 +527,8 @@ void AppLauncherHandler::HandleLaunchApp(const base::ListValue* args) {
disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB ||
disposition == WindowOpenDisposition::NEW_WINDOW) {
// TODO(jamescook): Proper support for background tabs.
- AppLaunchParams params(
- profile, extension_id,
+ apps::AppLaunchParams params(
+ extension_id,
disposition == WindowOpenDisposition::NEW_WINDOW
? apps::mojom::LaunchContainer::kLaunchContainerWindow
: apps::mojom::LaunchContainer::kLaunchContainerTab,
@@ -541,7 +544,7 @@ void AppLauncherHandler::HandleLaunchApp(const base::ListValue* args) {
if (browser)
old_contents = browser->tab_strip_model()->GetActiveWebContents();
- AppLaunchParams params = CreateAppLaunchParamsUserContainer(
+ apps::AppLaunchParams params = CreateAppLaunchParamsUserContainer(
profile, extension,
old_contents ? WindowOpenDisposition::CURRENT_TAB
: WindowOpenDisposition::NEW_FOREGROUND_TAB,
@@ -567,7 +570,9 @@ void AppLauncherHandler::HandleSetLaunchType(const base::ListValue* args) {
const Extension* extension =
extensions::ExtensionRegistry::Get(extension_service_->profile())
->GetExtensionById(extension_id,
- extensions::ExtensionRegistry::COMPATIBILITY);
+ extensions::ExtensionRegistry::ENABLED |
+ extensions::ExtensionRegistry::DISABLED |
+ extensions::ExtensionRegistry::TERMINATED);
if (!extension)
return;
@@ -583,8 +588,9 @@ void AppLauncherHandler::HandleUninstallApp(const base::ListValue* args) {
std::string extension_id;
CHECK(args->GetString(0, &extension_id));
- const Extension* extension = extension_service_->GetInstalledExtension(
- extension_id);
+ const Extension* extension =
+ ExtensionRegistry::Get(extension_service_->profile())
+ ->GetInstalledExtension(extension_id);
if (!extension)
return;
@@ -621,7 +627,9 @@ void AppLauncherHandler::HandleCreateAppShortcut(const base::ListValue* args) {
const Extension* extension =
extensions::ExtensionRegistry::Get(extension_service_->profile())
->GetExtensionById(extension_id,
- extensions::ExtensionRegistry::COMPATIBILITY);
+ extensions::ExtensionRegistry::ENABLED |
+ extensions::ExtensionRegistry::DISABLED |
+ extensions::ExtensionRegistry::TERMINATED);
if (!extension)
return;
@@ -639,7 +647,9 @@ void AppLauncherHandler::HandleInstallAppLocally(const base::ListValue* args) {
const Extension* extension =
extensions::ExtensionRegistry::Get(extension_service_->profile())
->GetExtensionById(extension_id,
- extensions::ExtensionRegistry::COMPATIBILITY);
+ extensions::ExtensionRegistry::ENABLED |
+ extensions::ExtensionRegistry::DISABLED |
+ extensions::ExtensionRegistry::TERMINATED);
if (!extension)
return;
@@ -664,7 +674,9 @@ void AppLauncherHandler::HandleShowAppInfo(const base::ListValue* args) {
const Extension* extension =
extensions::ExtensionRegistry::Get(extension_service_->profile())
->GetExtensionById(extension_id,
- extensions::ExtensionRegistry::COMPATIBILITY);
+ extensions::ExtensionRegistry::ENABLED |
+ extensions::ExtensionRegistry::DISABLED |
+ extensions::ExtensionRegistry::TERMINATED);
if (!extension)
return;
@@ -707,9 +719,6 @@ void AppLauncherHandler::HandleReorderApps(const base::ListValue* args) {
// Don't update the page; it already knows the apps have been reordered.
base::AutoReset<bool> auto_reset(&ignore_changes_, true);
- ExtensionPrefs* extension_prefs =
- ExtensionPrefs::Get(extension_service_->GetBrowserContext());
- extension_prefs->SetAppDraggedByUser(dragged_app_id);
ExtensionSystem::Get(extension_service_->GetBrowserContext())
->app_sorting()
->OnExtensionMoved(dragged_app_id, predecessor_to_moved_ext,
@@ -801,7 +810,7 @@ void AppLauncherHandler::OnFaviconForApp(
web_app->app_url = install_info->app_url;
if (!image_result.image.IsEmpty()) {
- WebApplicationInfo::IconInfo icon;
+ WebApplicationIconInfo icon;
icon.data = image_result.image.AsBitmap();
icon.width = icon.data.width();
icon.height = icon.data.height();
@@ -874,7 +883,9 @@ void AppLauncherHandler::ExtensionEnableFlowAborted(bool user_initiated) {
const Extension* extension =
extensions::ExtensionRegistry::Get(extension_service_->profile())
->GetExtensionById(extension_id_prompting_,
- extensions::ExtensionRegistry::COMPATIBILITY);
+ extensions::ExtensionRegistry::ENABLED |
+ extensions::ExtensionRegistry::DISABLED |
+ extensions::ExtensionRegistry::TERMINATED);
std::string histogram_name = user_initiated ? "ReEnableCancel"
: "ReEnableAbort";
extensions::ExtensionService::RecordPermissionMessagesHistogram(
diff --git a/chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler.cc b/chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler.cc
new file mode 100644
index 00000000000..3a7b7005675
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler.cc
@@ -0,0 +1,117 @@
+// 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/ntp/cookie_controls_handler.h"
+
+#include <utility>
+
+#include "base/bind.h"
+#include "base/feature_list.h"
+#include "base/metrics/user_metrics.h"
+#include "base/metrics/user_metrics_action.h"
+#include "base/values.h"
+#include "chrome/browser/policy/profile_policy_connector.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/content_settings/core/browser/cookie_settings.h"
+#include "components/content_settings/core/common/features.h"
+#include "components/content_settings/core/common/pref_names.h"
+#include "components/policy/core/common/policy_service.h"
+#include "components/policy/policy_constants.h"
+#include "components/prefs/pref_service.h"
+
+CookieControlsHandler::CookieControlsHandler() {}
+
+CookieControlsHandler::~CookieControlsHandler() {}
+
+void CookieControlsHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "cookieControlsToggleChanged",
+ base::BindRepeating(
+ &CookieControlsHandler::HandleCookieControlsToggleChanged,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "observeCookieControlsSettingsChanges",
+ base::BindRepeating(
+ &CookieControlsHandler::HandleObserveCookieControlsSettingsChanges,
+ base::Unretained(this)));
+}
+
+void CookieControlsHandler::OnJavascriptAllowed() {
+ Profile* profile = Profile::FromWebUI(web_ui());
+ pref_change_registrar_.Init(profile->GetPrefs());
+ pref_change_registrar_.Add(
+ prefs::kCookieControlsMode,
+ base::Bind(&CookieControlsHandler::OnCookieControlsChanged,
+ base::Unretained(this)));
+ pref_change_registrar_.Add(
+ prefs::kBlockThirdPartyCookies,
+ base::Bind(&CookieControlsHandler::OnThirdPartyCookieBlockingChanged,
+ base::Unretained(this)));
+ policy_registrar_ = std::make_unique<policy::PolicyChangeRegistrar>(
+ profile->GetProfilePolicyConnector()->policy_service(),
+ policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string()));
+ policy_registrar_->Observe(
+ policy::key::kBlockThirdPartyCookies,
+ base::BindRepeating(
+ &CookieControlsHandler::OnThirdPartyCookieBlockingPolicyChanged,
+ base::Unretained(this)));
+}
+
+void CookieControlsHandler::OnJavascriptDisallowed() {
+ pref_change_registrar_.RemoveAll();
+ policy_registrar_.reset();
+}
+
+void CookieControlsHandler::HandleCookieControlsToggleChanged(
+ const base::ListValue* args) {
+ bool checked;
+ CHECK(args->GetBoolean(0, &checked));
+ Profile* profile = Profile::FromWebUI(web_ui());
+ profile->GetPrefs()->SetInteger(
+ prefs::kCookieControlsMode,
+ static_cast<int>(
+ checked ? content_settings::CookieControlsMode::kIncognitoOnly
+ : content_settings::CookieControlsMode::kOff));
+ base::RecordAction(
+ checked ? base::UserMetricsAction("CookieControls.NTP.Enabled")
+ : base::UserMetricsAction("CookieControls.NTP.Disabled"));
+}
+
+void CookieControlsHandler::HandleObserveCookieControlsSettingsChanges(
+ const base::ListValue* args) {
+ AllowJavascript();
+ OnCookieControlsChanged();
+ OnThirdPartyCookieBlockingChanged();
+}
+
+void CookieControlsHandler::OnCookieControlsChanged() {
+ Profile* profile = Profile::FromWebUI(web_ui());
+ FireWebUIListener("cookie-controls-changed",
+ base::Value(GetToggleCheckedValue(profile)));
+}
+
+bool CookieControlsHandler::GetToggleCheckedValue(const Profile* profile) {
+ int mode = profile->GetPrefs()->GetInteger(prefs::kCookieControlsMode);
+ return mode != static_cast<int>(content_settings::CookieControlsMode::kOff);
+}
+
+void CookieControlsHandler::OnThirdPartyCookieBlockingChanged() {
+ Profile* profile = Profile::FromWebUI(web_ui());
+ FireWebUIListener("third-party-cookie-blocking-changed",
+ base::Value(ShouldHideCookieControlsUI(profile)));
+}
+
+void CookieControlsHandler::OnThirdPartyCookieBlockingPolicyChanged(
+ const base::Value* previous,
+ const base::Value* current) {
+ OnThirdPartyCookieBlockingChanged();
+}
+
+bool CookieControlsHandler::ShouldHideCookieControlsUI(const Profile* profile) {
+ return !base::FeatureList::IsEnabled(
+ content_settings::kImprovedCookieControls) ||
+ profile->GetPrefs()->IsManagedPreference(
+ prefs::kBlockThirdPartyCookies) ||
+ profile->GetPrefs()->GetBoolean(prefs::kBlockThirdPartyCookies);
+}
diff --git a/chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler.h b/chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler.h
new file mode 100644
index 00000000000..a0fd7bfa7a9
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler.h
@@ -0,0 +1,65 @@
+// 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_NTP_COOKIE_CONTROLS_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_NTP_COOKIE_CONTROLS_HANDLER_H_
+
+#include <memory>
+
+#include "components/prefs/pref_change_registrar.h"
+#include "content/public/browser/web_ui_message_handler.h"
+
+class CookieControlsHandlerTest;
+class Profile;
+
+namespace base {
+class ListValue;
+class Value;
+} // namespace base
+
+namespace policy {
+class PolicyChangeRegistrar;
+}
+
+// Handles requests for prefs::kCookieControlsMode retrival/update.
+class CookieControlsHandler : public content::WebUIMessageHandler {
+ public:
+ CookieControlsHandler();
+ ~CookieControlsHandler() override;
+
+ // WebUIMessageHandler
+ void RegisterMessages() override;
+ void OnJavascriptAllowed() override;
+ void OnJavascriptDisallowed() override;
+
+ void HandleCookieControlsToggleChanged(const base::ListValue* args);
+
+ void HandleObserveCookieControlsSettingsChanges(const base::ListValue* args);
+
+ // Whether cookie controls UI should be hidden in incognito ntp.
+ static bool ShouldHideCookieControlsUI(const Profile* profile);
+
+ static bool GetToggleCheckedValue(const Profile* profile);
+
+ private:
+ friend class CookieControlsHandlerTest;
+
+ // Updates cookie controls UI when underlying setting has changed.
+ void OnCookieControlsChanged();
+
+ // Updates cookie controls UI when third-party cookie blocking setting has
+ // changed.
+ void OnThirdPartyCookieBlockingChanged();
+
+ void OnThirdPartyCookieBlockingPolicyChanged(const base::Value* previous,
+ const base::Value* current);
+
+ PrefChangeRegistrar pref_change_registrar_;
+
+ std::unique_ptr<policy::PolicyChangeRegistrar> policy_registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(CookieControlsHandler);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_NTP_COOKIE_CONTROLS_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler_unittest.cc b/chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler_unittest.cc
new file mode 100644
index 00000000000..e269fef1122
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/ntp/cookie_controls_handler_unittest.cc
@@ -0,0 +1,51 @@
+// 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/ntp/cookie_controls_handler.h"
+
+#include "base/values.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
+#include "components/content_settings/core/browser/cookie_settings.h"
+#include "components/content_settings/core/common/pref_names.h"
+#include "components/prefs/pref_service.h"
+#include "content/public/test/test_web_ui.h"
+
+class CookieControlsHandlerTest : public ChromeRenderViewHostTestHarness {
+ public:
+ void SetUp() override {
+ ChromeRenderViewHostTestHarness::SetUp();
+ web_ui_.set_web_contents(web_contents());
+ handler_ = std::make_unique<CookieControlsHandler>();
+ handler_->set_web_ui(&web_ui_);
+ }
+
+ void TearDown() override {
+ handler_->set_web_ui(nullptr);
+ ChromeRenderViewHostTestHarness::TearDown();
+ }
+
+ protected:
+ content::TestWebUI web_ui_;
+ std::unique_ptr<CookieControlsHandler> handler_;
+};
+
+TEST_F(CookieControlsHandlerTest, HandleCookieControlsToggleChanged) {
+ EXPECT_EQ(
+ static_cast<int>(content_settings::CookieControlsMode::kIncognitoOnly),
+ Profile::FromWebUI(&web_ui_)->GetPrefs()->GetInteger(
+ prefs::kCookieControlsMode));
+ base::ListValue args_false;
+ args_false.AppendBoolean(false);
+ handler_->HandleCookieControlsToggleChanged(&args_false);
+ EXPECT_EQ(static_cast<int>(content_settings::CookieControlsMode::kOff),
+ Profile::FromWebUI(&web_ui_)->GetPrefs()->GetInteger(
+ prefs::kCookieControlsMode));
+ base::ListValue args_true;
+ args_true.AppendBoolean(true);
+ handler_->HandleCookieControlsToggleChanged(&args_true);
+ EXPECT_EQ(
+ static_cast<int>(content_settings::CookieControlsMode::kIncognitoOnly),
+ Profile::FromWebUI(&web_ui_)->GetPrefs()->GetInteger(
+ prefs::kCookieControlsMode));
+}
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 48f2a16a42c..1743ef945fe 100644
--- a/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chromium/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -15,6 +15,7 @@
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
+#include "chrome/browser/ui/webui/ntp/cookie_controls_handler.h"
#include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
#include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
#include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h"
@@ -56,8 +57,10 @@ NewTabUI::NewTabUI(content::WebUI* web_ui) : content::WebUIController(web_ui) {
Profile* profile = GetProfile();
- if (!profile->IsGuestSession())
+ if (!profile->IsGuestSession()) {
web_ui->AddMessageHandler(std::make_unique<ThemeHandler>());
+ web_ui->AddMessageHandler(std::make_unique<CookieControlsHandler>());
+ }
// content::URLDataSource assumes the ownership of the html source.
content::URLDataSource::Add(profile, std::make_unique<NewTabHTMLSource>(
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 2dcf1f8771c..3614c8d9757 100644
--- a/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -15,6 +15,7 @@
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
@@ -25,6 +26,7 @@
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/webui/app_launcher_login_handler.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
+#include "chrome/browser/ui/webui/ntp/cookie_controls_handler.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
@@ -34,6 +36,8 @@
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
+#include "components/content_settings/core/common/features.h"
+#include "components/content_settings/core/common/pref_names.h"
#include "components/google/core/common/google_util.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/identity_manager.h"
@@ -135,9 +139,7 @@ std::string GetNewTabBackgroundTilingCSS(
} // namespace
NTPResourceCache::NTPResourceCache(Profile* profile)
- : profile_(profile),
- is_swipe_tracking_from_scroll_events_enabled_(false),
- theme_observer_(this) {
+ : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(
ThemeServiceFactory::GetForProfile(profile)));
@@ -276,6 +278,15 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() {
l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_NOT_SAVED);
replacements["learnMoreLink"] = kLearnMoreIncognitoUrl;
replacements["title"] = l10n_util::GetStringUTF8(IDS_NEW_TAB_TITLE);
+ replacements["hideCookieControls"] =
+ CookieControlsHandler::ShouldHideCookieControlsUI(profile_) ? "hidden"
+ : "";
+ replacements["cookieControlsTitle"] =
+ l10n_util::GetStringUTF8(IDS_SETTINGS_SITE_SETTINGS_THIRD_PARTY_COOKIE);
+ replacements["cookieControlsDescription"] = l10n_util::GetStringUTF8(
+ IDS_SETTINGS_SITE_SETTINGS_THIRD_PARTY_COOKIE_SUBLABEL);
+ replacements["cookieControlsToggleChecked"] =
+ CookieControlsHandler::GetToggleCheckedValue(profile_) ? "checked" : "";
const ui::ThemeProvider& tp =
ThemeService::GetThemeProviderForProfile(profile_);
@@ -451,7 +462,7 @@ void NTPResourceCache::CreateNewTabHTML() {
!prefs->GetBoolean(prefs::kHideWebStoreIcon));
load_time_data.SetBoolean("canShowAppInfoDialog",
- CanShowAppInfoDialog());
+ CanPlatformShowAppInfoDialog());
AppLauncherHandler::GetLocalizedValues(profile_, &load_time_data);
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 354de3c3e10..d6f96e8b7bb 100644
--- a/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
+++ b/chromium/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
@@ -13,6 +13,7 @@
#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.h"
#include "ui/native_theme/native_theme_observer.h"
class Profile;
@@ -26,10 +27,6 @@ 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
@@ -97,7 +94,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_;
+ ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> theme_observer_{
+ this};
DISALLOW_COPY_AND_ASSIGN(NTPResourceCache);
};
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 b1ad92cf59c..27a6e11e0d3 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
@@ -25,6 +25,7 @@
#include "chrome/browser/offline_pages/prefetch/prefetched_pages_notifier.h"
#include "chrome/browser/offline_pages/request_coordinator_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_key.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_content_client.h"
#include "components/offline_pages/core/client_namespace_constants.h"
@@ -345,7 +346,7 @@ void OfflineInternalsUIMessageHandler::HandleGeneratePageBundle(
// serialize it into JSON, instead of doing direct string manipulation.
base::ListValue urls;
for (const auto& prefetch_url : prefetch_urls) {
- urls.GetList().emplace_back(prefetch_url.url.spec());
+ urls.Append(prefetch_url.url.spec());
}
std::string json;
base::JSONWriter::Write(urls, &json);
diff --git a/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom b/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
index 7ffa3971673..e113fded051 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
@@ -52,9 +52,10 @@ struct AutocompleteResultsForProvider {
};
struct OmniboxResponse {
- bool done;
+ int32 cursor_position;
// Time delta since the request was started, in milliseconds.
int32 time_since_omnibox_started_ms;
+ bool done;
// The inferred metrics::OmniboxInputType of the request represented as a
// string.
string type;
@@ -67,7 +68,7 @@ struct OmniboxResponse {
interface OmniboxPageHandler {
// Registers the webui page.
- SetClientPage(OmniboxPage page);
+ SetClientPage(pending_remote<OmniboxPage> page);
// Prompts a autocopmlete controller to process an omnibox query.
StartOmniboxQuery(string input_string,
bool reset_autocomplete_controller,
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 3c90ef1508e..c8dc602ed4d 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
@@ -222,8 +222,8 @@ struct TypeConverter<mojom::AutocompleteResultsForProviderPtr,
OmniboxPageHandler::OmniboxPageHandler(
Profile* profile,
- mojo::InterfaceRequest<mojom::OmniboxPageHandler> request)
- : profile_(profile), binding_(this, std::move(request)), observer_(this) {
+ mojo::PendingReceiver<mojom::OmniboxPageHandler> receiver)
+ : profile_(profile), receiver_(this, std::move(receiver)), observer_(this) {
observer_.Add(OmniboxControllerEmitter::GetForBrowserContext(profile_));
ResetController();
}
@@ -235,22 +235,25 @@ void OmniboxPageHandler::OnResultChanged(bool default_match_changed) {
}
void OmniboxPageHandler::OnOmniboxQuery(AutocompleteController* controller,
- const base::string16& input_text) {
+ const AutocompleteInput& input) {
+ time_omnibox_started_ = base::Time::Now();
+ input_ = input;
page_->HandleNewAutocompleteQuery(controller == controller_.get(),
- base::UTF16ToUTF8(input_text));
+ base::UTF16ToUTF8(input.text()));
}
void OmniboxPageHandler::OnOmniboxResultChanged(
bool default_match_changed,
AutocompleteController* controller) {
mojom::OmniboxResponsePtr response(mojom::OmniboxResponse::New());
- response->done = controller->done();
+ response->cursor_position = input_.cursor_position();
response->time_since_omnibox_started_ms =
(base::Time::Now() - time_omnibox_started_).InMilliseconds();
+ response->done = controller->done();
+ response->type = AutocompleteInput::TypeToString(input_.type());
const base::string16 host =
input_.text().substr(input_.parts().host.begin, input_.parts().host.len);
response->host = base::UTF16ToUTF8(host);
- response->type = AutocompleteInput::TypeToString(input_.type());
bool is_typed_host;
if (!LookupIsTypedHost(host, &is_typed_host))
is_typed_host = false;
@@ -372,8 +375,9 @@ bool OmniboxPageHandler::LookupIsTypedHost(const base::string16& host,
return true;
}
-void OmniboxPageHandler::SetClientPage(mojom::OmniboxPagePtr page) {
- page_ = std::move(page);
+void OmniboxPageHandler::SetClientPage(
+ mojo::PendingRemote<mojom::OmniboxPage> page) {
+ page_.Bind(std::move(page));
}
void OmniboxPageHandler::StartOmniboxQuery(const std::string& input_string,
@@ -391,30 +395,22 @@ void OmniboxPageHandler::StartOmniboxQuery(const std::string& input_string,
// actual results to not depend on the state of the previous request.
if (reset_autocomplete_controller)
ResetController();
- // TODO (manukh): OmniboxPageHandler::StartOmniboxQuery is invoked only for
- // queries from the debug page and not for queries from the browser omnibox.
- // time_omnibox_started_ and input_ are therefore not set for browser omnibox
- // queries, resulting in inaccurate time_since_omnibox_started_ms, host, type,
- // and is_typed_host values in the result object being sent to the debug page.
- // For the user, this means the 'details' section is mostly inaccurate for
- // browser omnibox queries.
- time_omnibox_started_ = base::Time::Now();
- input_ = AutocompleteInput(
+ AutocompleteInput input(
base::UTF8ToUTF16(input_string), cursor_position,
static_cast<metrics::OmniboxEventProto::PageClassification>(
page_classification),
ChromeAutocompleteSchemeClassifier(profile_));
GURL current_url_gurl{current_url};
if (current_url_gurl.is_valid())
- input_.set_current_url(current_url_gurl);
- input_.set_current_title(base::UTF8ToUTF16(current_url));
- input_.set_prevent_inline_autocomplete(prevent_inline_autocomplete);
- input_.set_prefer_keyword(prefer_keyword);
+ input.set_current_url(current_url_gurl);
+ input.set_current_title(base::UTF8ToUTF16(current_url));
+ input.set_prevent_inline_autocomplete(prevent_inline_autocomplete);
+ input.set_prefer_keyword(prefer_keyword);
if (prefer_keyword)
- input_.set_keyword_mode_entry_method(metrics::OmniboxEventProto::TAB);
- input_.set_from_omnibox_focus(zero_suggest);
+ input.set_keyword_mode_entry_method(metrics::OmniboxEventProto::TAB);
+ input.set_from_omnibox_focus(zero_suggest);
- OnOmniboxQuery(controller_.get(), input_.text());
+ OnOmniboxQuery(controller_.get(), input);
controller_->Start(input_);
}
diff --git a/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.h b/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.h
index ec2f26b4a18..c960ff022e6 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.h
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.h
@@ -17,7 +17,10 @@
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/omnibox_controller_emitter.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
class AutocompleteController;
class Profile;
@@ -32,7 +35,7 @@ class OmniboxPageHandler : public AutocompleteControllerDelegate,
public:
// OmniboxPageHandler is deleted when the supplied pipe is destroyed.
OmniboxPageHandler(Profile* profile,
- mojo::InterfaceRequest<mojom::OmniboxPageHandler> request);
+ mojo::PendingReceiver<mojom::OmniboxPageHandler> receiver);
~OmniboxPageHandler() override;
// AutocompleteControllerDelegate overrides:
@@ -40,12 +43,12 @@ class OmniboxPageHandler : public AutocompleteControllerDelegate,
// OmniboxControllerEmitter::Observer overrides:
void OnOmniboxQuery(AutocompleteController* controller,
- const base::string16& input_text) override;
+ const AutocompleteInput& input) override;
void OnOmniboxResultChanged(bool default_match_changed,
AutocompleteController* controller) override;
// mojom::OmniboxPageHandler overrides:
- void SetClientPage(mojom::OmniboxPagePtr page) override;
+ void SetClientPage(mojo::PendingRemote<mojom::OmniboxPage> page) override;
// current_url may be invalid, in which case, autocomplete input's url won't
// be set.
void StartOmniboxQuery(const std::string& input_string,
@@ -80,12 +83,12 @@ class OmniboxPageHandler : public AutocompleteControllerDelegate,
AutocompleteInput input_;
// Handle back to the page by which we can pass results.
- mojom::OmniboxPagePtr page_;
+ mojo::Remote<mojom::OmniboxPage> page_;
// The Profile* handed to us in our constructor.
Profile* profile_;
- mojo::Binding<mojom::OmniboxPageHandler> binding_;
+ mojo::Receiver<mojom::OmniboxPageHandler> receiver_;
ScopedObserver<OmniboxControllerEmitter, OmniboxControllerEmitter::Observer>
observer_;
diff --git a/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc b/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc
index 4e95206d915..0b5b49cde52 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc
@@ -12,7 +12,7 @@
#include "chrome/browser/ui/webui/version_handler.h"
#include "chrome/browser/ui/webui/version_ui.h"
#include "chrome/common/url_constants.h"
-#include "chrome/grit/browser_resources.h"
+#include "chrome/grit/omnibox_resources.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
@@ -51,7 +51,7 @@ OmniboxUI::OmniboxUI(content::WebUI* web_ui)
OmniboxUI::~OmniboxUI() {}
void OmniboxUI::BindOmniboxPageHandler(
- mojom::OmniboxPageHandlerRequest request) {
- omnibox_handler_.reset(
- new OmniboxPageHandler(Profile::FromWebUI(web_ui()), std::move(request)));
+ mojo::PendingReceiver<mojom::OmniboxPageHandler> receiver) {
+ omnibox_handler_ = std::make_unique<OmniboxPageHandler>(
+ Profile::FromWebUI(web_ui()), std::move(receiver));
}
diff --git a/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.h b/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.h
index d65e868e21b..81f3ad0e054 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.h
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.h
@@ -7,6 +7,7 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/omnibox/omnibox.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
class OmniboxPageHandler;
@@ -18,7 +19,8 @@ class OmniboxUI : public ui::MojoWebUIController {
~OmniboxUI() override;
private:
- void BindOmniboxPageHandler(mojom::OmniboxPageHandlerRequest request);
+ void BindOmniboxPageHandler(
+ mojo::PendingReceiver<mojom::OmniboxPageHandler> receiver);
std::unique_ptr<OmniboxPageHandler> omnibox_handler_;
diff --git a/chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc
index e4ac4cf3d0b..1f2578fb958 100644
--- a/chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/policy_ui_browsertest.cc
@@ -14,6 +14,7 @@
#include "base/json/json_writer.h"
#include "base/macros.h"
#include "base/run_loop.h"
+#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -692,7 +693,7 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, MAYBE_ExtensionLoadAndSendPolicy) {
auto object_value = std::make_unique<base::DictionaryValue>();
object_value->SetKey("objectProperty", base::Value(true));
auto array_value = std::make_unique<base::ListValue>();
- array_value->GetList().push_back(base::Value(true));
+ array_value->Append(base::Value(true));
policy::PolicyMap values;
values.Set(kNormalBooleanPolicy, policy::POLICY_LEVEL_MANDATORY,
diff --git a/chromium/chrome/browser/ui/webui/policy_ui_handler.cc b/chromium/chrome/browser/ui/webui/policy_ui_handler.cc
index 22075e1d920..44c529aa787 100644
--- a/chromium/chrome/browser/ui/webui/policy_ui_handler.cc
+++ b/chromium/chrome/browser/ui/webui/policy_ui_handler.cc
@@ -885,7 +885,7 @@ base::Value PolicyUIHandler::GetPolicyNames() const {
const policy::Schema* chrome_schema = schema_map->GetSchema(chrome_ns);
for (auto it = chrome_schema->GetPropertiesIterator(); !it.IsAtEnd();
it.Advance()) {
- chrome_policy_names->GetList().push_back(base::Value(it.key()));
+ chrome_policy_names->Append(base::Value(it.key()));
}
auto chrome_values = std::make_unique<base::DictionaryValue>();
chrome_values->SetString("name", "Chrome Policies");
@@ -911,7 +911,7 @@ base::Value PolicyUIHandler::GetPolicyNames() const {
// Store in a map, not an array, for faster lookup on JS side.
for (auto prop = schema->GetPropertiesIterator(); !prop.IsAtEnd();
prop.Advance()) {
- policy_names->GetList().push_back(base::Value(prop.key()));
+ policy_names->Append(base::Value(prop.key()));
}
}
extension_value->Set("policyNames", std::move(policy_names));
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 9b926a8b629..9edda51b6d3 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
@@ -25,7 +25,7 @@
#include "chrome/browser/ui/webui/print_preview/print_preview_utils.h"
#include "chrome/common/pref_names.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/debug_daemon_client.h"
+#include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
#include "chromeos/printing/printer_configuration.h"
#include "components/prefs/pref_service.h"
#include "components/printing/browser/printer_capabilities.h"
@@ -303,6 +303,9 @@ base::Value LocalPrinterHandlerChromeos::GetNativePrinterPolicies() const {
policies.SetKey(
kAllowedPinModes,
base::Value(prefs->GetInteger(prefs::kPrintingAllowedPinModes)));
+ policies.SetKey(kAllowedBackgroundGraphicsModes,
+ base::Value(prefs->GetInteger(
+ prefs::kPrintingAllowedBackgroundGraphicsModes)));
policies.SetKey(kDefaultColorMode,
base::Value(prefs->GetInteger(prefs::kPrintingColorDefault)));
policies.SetKey(
@@ -310,6 +313,9 @@ base::Value LocalPrinterHandlerChromeos::GetNativePrinterPolicies() const {
base::Value(prefs->GetInteger(prefs::kPrintingDuplexDefault)));
policies.SetKey(kDefaultPinMode,
base::Value(prefs->GetInteger(prefs::kPrintingPinDefault)));
+ policies.SetKey(kDefaultBackgroundGraphicsMode,
+ base::Value(prefs->GetInteger(
+ prefs::kPrintingBackgroundGraphicsDefault)));
return policies;
}
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
index 756f3b374ea..5329108a661 100644
--- 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
@@ -289,20 +289,26 @@ TEST_F(LocalPrinterHandlerChromeosTest, GetNativePrinterPolicies) {
std::make_unique<base::Value>(0));
prefs->SetUserPref(prefs::kPrintingAllowedPinModes,
std::make_unique<base::Value>(1));
+ prefs->SetUserPref(prefs::kPrintingAllowedBackgroundGraphicsModes,
+ std::make_unique<base::Value>(2));
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));
+ prefs->SetUserPref(prefs::kPrintingBackgroundGraphicsDefault,
+ 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(kAllowedBackgroundGraphicsModes, base::Value(2));
expected_policies.SetKey(kDefaultColorMode, base::Value(2));
expected_policies.SetKey(kDefaultDuplexMode, base::Value(4));
expected_policies.SetKey(kDefaultPinMode, base::Value(0));
+ expected_policies.SetKey(kDefaultBackgroundGraphicsMode, base::Value(0));
EXPECT_EQ(expected_policies,
local_printer_handler_->GetNativePrinterPolicies());
diff --git a/chromium/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc b/chromium/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
index 00cf10991ed..f0033a7e67b 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
@@ -72,38 +72,41 @@ gfx::Size GetDefaultPdfMediaSizeMicrons() {
}
base::Value GetPdfCapabilities(const std::string& locale) {
- cloud_devices::CloudDeviceDescription description;
- using namespace cloud_devices::printer;
+ using cloud_devices::printer::MediaType;
- OrientationCapability orientation;
+ cloud_devices::CloudDeviceDescription description;
+ cloud_devices::printer::OrientationCapability orientation;
orientation.AddOption(cloud_devices::printer::OrientationType::PORTRAIT);
orientation.AddOption(cloud_devices::printer::OrientationType::LANDSCAPE);
- orientation.AddDefaultOption(OrientationType::AUTO_ORIENTATION, true);
+ orientation.AddDefaultOption(
+ cloud_devices::printer::OrientationType::AUTO_ORIENTATION, true);
orientation.SaveTo(&description);
- ColorCapability color;
+ cloud_devices::printer::ColorCapability color;
{
- Color standard_color(ColorType::STANDARD_COLOR);
+ cloud_devices::printer::Color standard_color(
+ cloud_devices::printer::ColorType::STANDARD_COLOR);
standard_color.vendor_id = base::NumberToString(COLOR);
color.AddDefaultOption(standard_color, true);
}
color.SaveTo(&description);
- static const cloud_devices::printer::MediaType kPdfMedia[] = {
+ static const MediaType kPdfMedia[] = {
MediaType::ISO_A0, MediaType::ISO_A1, MediaType::ISO_A2,
MediaType::ISO_A3, MediaType::ISO_A4, MediaType::ISO_A5,
MediaType::NA_LEGAL, MediaType::NA_LETTER, MediaType::NA_LEDGER};
const gfx::Size default_media_size = GetDefaultPdfMediaSizeMicrons();
- Media default_media("", "", default_media_size.width(),
- default_media_size.height());
+ cloud_devices::printer::Media default_media(std::string(), std::string(),
+ default_media_size.width(),
+ default_media_size.height());
if (!default_media.MatchBySize() ||
!base::Contains(kPdfMedia, default_media.type)) {
- default_media =
- Media(locale == "en-US" ? MediaType::NA_LETTER : MediaType::ISO_A4);
+ default_media = cloud_devices::printer::Media(
+ locale == "en-US" ? MediaType::NA_LETTER : MediaType::ISO_A4);
}
- MediaCapability media;
+ cloud_devices::printer::MediaCapability media;
for (const auto& pdf_media : kPdfMedia) {
- Media media_option(pdf_media);
+ cloud_devices::printer::Media media_option(pdf_media);
media.AddDefaultOption(media_option,
default_media.type == media_option.type);
}
diff --git a/chromium/chrome/browser/ui/webui/print_preview/policy_settings.cc b/chromium/chrome/browser/ui/webui/print_preview/policy_settings.cc
index dbaa090f34c..11ab72453e8 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/policy_settings.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/policy_settings.cc
@@ -14,10 +14,13 @@ void PolicySettings::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(prefs::kPrintHeaderFooter, true);
#if defined(OS_CHROMEOS)
+ registry->RegisterIntegerPref(prefs::kPrintingAllowedBackgroundGraphicsModes,
+ 0);
registry->RegisterIntegerPref(prefs::kPrintingAllowedColorModes, 0);
registry->RegisterIntegerPref(prefs::kPrintingAllowedDuplexModes, 0);
registry->RegisterIntegerPref(prefs::kPrintingAllowedPinModes, 0);
registry->RegisterListPref(prefs::kPrintingAllowedPageSizes);
+ registry->RegisterIntegerPref(prefs::kPrintingBackgroundGraphicsDefault, 0);
registry->RegisterIntegerPref(prefs::kPrintingColorDefault, 0);
registry->RegisterIntegerPref(prefs::kPrintingDuplexDefault, 0);
registry->RegisterIntegerPref(prefs::kPrintingPinDefault, 0);
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 977fa0091ff..2ecb8cdde5a 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
@@ -147,6 +147,7 @@ enum PrintSettingsBuckets {
DEFAULT_DPI,
NON_DEFAULT_DPI,
PIN,
+ FIT_TO_PAPER,
PRINT_SETTINGS_BUCKET_BOUNDARY
};
@@ -315,9 +316,6 @@ void ReportPrintSettingsStats(const base::Value& print_settings,
if (print_settings.FindIntKey(kSettingCopies).value_or(1) > 1)
ReportPrintSettingHistogram(COPIES);
- if (preview_settings.FindIntKey(kSettingScaleFactor).value_or(100) != 100)
- ReportPrintSettingHistogram(SCALING);
-
if (preview_settings.FindIntKey(kSettingPagesPerSheet).value_or(1) != 1)
ReportPrintSettingHistogram(PAGES_PER_SHEET);
@@ -354,9 +352,18 @@ void ReportPrintSettingsStats(const base::Value& print_settings,
if (preview_settings.FindBoolKey(kSettingRasterizePdf).value_or(false))
ReportPrintSettingHistogram(PRINT_AS_IMAGE);
- if (is_pdf &&
- preview_settings.FindBoolKey(kSettingFitToPageEnabled).value_or(false)) {
- ReportPrintSettingHistogram(FIT_TO_PAGE);
+ ScalingType scaling_type =
+ static_cast<ScalingType>(preview_settings.FindIntKey(kSettingScalingType)
+ .value_or(ScalingType::DEFAULT));
+ if (scaling_type == ScalingType::CUSTOM) {
+ ReportPrintSettingHistogram(SCALING);
+ }
+
+ if (is_pdf) {
+ if (scaling_type == ScalingType::FIT_TO_PAGE)
+ ReportPrintSettingHistogram(FIT_TO_PAGE);
+ else if (scaling_type == ScalingType::FIT_TO_PAPER)
+ ReportPrintSettingHistogram(FIT_TO_PAPER);
}
if (print_settings.FindIntKey(kSettingDpiHorizontal).value_or(0) > 0 &&
@@ -377,21 +384,32 @@ void ReportPrintSettingsStats(const base::Value& print_settings,
UserActionBuckets DetermineUserAction(const base::Value& settings) {
#if defined(OS_MACOSX)
- if (settings.FindKey(kSettingOpenPDFInPreview) != nullptr)
+ if (settings.FindKey(kSettingOpenPDFInPreview))
return OPEN_IN_MAC_PREVIEW;
#endif
// This needs to be checked before checking for a cloud print ID, since a
// print ticket for printing to Drive will also contain a cloud print ID.
if (settings.FindBoolKey(kSettingPrintToGoogleDrive).value_or(false))
return PRINT_TO_GOOGLE_DRIVE;
- if (settings.FindKey(kSettingCloudPrintId) != nullptr)
+ if (settings.FindKey(kSettingCloudPrintId))
return PRINT_WITH_CLOUD_PRINT;
- if (settings.FindBoolKey(kSettingPrintWithPrivet).value_or(false))
- return PRINT_WITH_PRIVET;
- if (settings.FindBoolKey(kSettingPrintWithExtension).value_or(false))
- return PRINT_WITH_EXTENSION;
- if (settings.FindBoolKey(kSettingPrintToPDF).value_or(false))
- return PRINT_TO_PDF;
+
+ PrinterType type = static_cast<PrinterType>(
+ settings.FindIntKey(kSettingPrinterType).value());
+ switch (type) {
+ case kPrivetPrinter:
+ return PRINT_WITH_PRIVET;
+ case kExtensionPrinter:
+ return PRINT_WITH_EXTENSION;
+ case kPdfPrinter:
+ return PRINT_TO_PDF;
+ case kLocalPrinter:
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+
if (settings.FindBoolKey(kSettingShowSystemDialog).value_or(false))
return FALLBACK_TO_ADVANCED_SETTINGS_DIALOG;
return PRINT_TO_PRINTER;
@@ -965,7 +983,7 @@ void PrintPreviewHandler::GetUserAccountList(base::Value* settings) {
const std::vector<gaia::ListedAccount>& accounts =
identity_manager_->GetAccountsInCookieJar().signed_in_accounts;
for (const gaia::ListedAccount& account : accounts) {
- account_list.GetList().emplace_back(account.email);
+ account_list.Append(account.email);
}
settings->SetKey(kSyncAvailable, base::Value(true));
} else {
@@ -982,6 +1000,8 @@ void PrintPreviewHandler::SendInitialSettings(
print_preview_ui()->initiator_title());
initial_settings.SetBoolKey(kSettingPreviewModifiable,
print_preview_ui()->source_is_modifiable());
+ initial_settings.SetBoolKey(kSettingPreviewIsPdf,
+ print_preview_ui()->source_is_pdf());
initial_settings.SetStringKey(kSettingPrinterName, default_printer);
initial_settings.SetBoolKey(kDocumentHasSelection,
print_preview_ui()->source_has_selection());
@@ -1122,7 +1142,7 @@ void PrintPreviewHandler::OnAccountsInCookieUpdated(
const std::vector<gaia::ListedAccount>& accounts =
accounts_in_cookie_jar_info.signed_in_accounts;
for (const auto account : accounts) {
- account_list.GetList().emplace_back(account.email);
+ account_list.Append(account.email);
}
FireWebUIListener("user-accounts-updated", std::move(account_list));
}
@@ -1136,6 +1156,10 @@ void PrintPreviewHandler::OnPrintPreviewReady(int preview_uid, int request_id) {
}
void PrintPreviewHandler::OnPrintPreviewFailed(int request_id) {
+ WebContents* initiator = GetInitiator();
+ if (!initiator || initiator->IsBeingDestroyed())
+ return; // Drop notification if fired during destruction sequence.
+
std::string callback_id = GetCallbackId(request_id);
if (callback_id.empty())
return;
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 bdccac1a8a4..e5f5f921753 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
@@ -38,16 +38,6 @@ class PdfPrinterHandler;
class PrinterHandler;
class PrintPreviewUI;
-// Must match print_preview.PrinterType in
-// chrome/browser/resources/print_preview/native_layer.js
-enum PrinterType {
- kPrivetPrinter,
- kExtensionPrinter,
- kPdfPrinter,
- kLocalPrinter,
- kCloudPrinter
-};
-
// The handler for Javascript messages related to the print preview dialog.
class PrintPreviewHandler : public content::WebUIMessageHandler,
public signin::IdentityManager::Observer {
diff --git a/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc b/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc
index e56a96a4703..6d724094aa6 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc
@@ -48,9 +48,13 @@ namespace {
const char kDummyInitiatorName[] = "TestInitiator";
const char kTestData[] = "abc";
-// Array of all PrinterType values.
-const PrinterType kAllTypes[] = {kPrivetPrinter, kExtensionPrinter, kPdfPrinter,
- kLocalPrinter};
+// Array of all PrinterTypes.
+constexpr PrinterType kAllTypes[] = {kPrivetPrinter, kExtensionPrinter,
+ kPdfPrinter, kLocalPrinter, kCloudPrinter};
+
+// Array of all PrinterTypes that have working PrinterHandlers.
+constexpr PrinterType kAllSupportedTypes[] = {kPrivetPrinter, kExtensionPrinter,
+ kPdfPrinter, kLocalPrinter};
struct PrinterInfo {
std::string id;
@@ -90,14 +94,15 @@ PrinterInfo GetEmptyPrinterInfo() {
return empty_printer;
}
-base::Value GetPrintPreviewTicket(bool is_pdf) {
- base::Value print_ticket = GetPrintTicket(kLocalPrinter, false);
+base::Value GetPrintPreviewTicket() {
+ base::Value print_ticket = GetPrintTicket(kLocalPrinter);
// Make some modifications to match a preview print ticket.
print_ticket.SetKey(kSettingPageRange, base::Value());
- print_ticket.SetKey(kIsFirstRequest, base::Value(true));
- print_ticket.SetKey(kPreviewRequestID, base::Value(0));
- print_ticket.SetKey(kSettingPreviewModifiable, base::Value(is_pdf));
+ print_ticket.SetBoolKey(kIsFirstRequest, true);
+ print_ticket.SetIntKey(kPreviewRequestID, 0);
+ print_ticket.SetBoolKey(kSettingPreviewModifiable, false);
+ print_ticket.SetBoolKey(kSettingPreviewIsPdf, true);
print_ticket.RemoveKey(kSettingPageWidth);
print_ticket.RemoveKey(kSettingPageHeight);
print_ticket.RemoveKey(kSettingShowSystemDialog);
@@ -109,10 +114,10 @@ std::unique_ptr<base::ListValue> ConstructPreviewArgs(
base::StringPiece callback_id,
const base::Value& print_ticket) {
base::Value args(base::Value::Type::LIST);
- args.GetList().emplace_back(callback_id);
+ args.Append(callback_id);
std::string json;
base::JSONWriter::Write(print_ticket, &json);
- args.GetList().emplace_back(json);
+ args.Append(json);
return base::ListValue::From(base::Value::ToUniquePtrValue(std::move(args)));
}
@@ -292,7 +297,7 @@ class PrintPreviewHandlerTest : public testing::Test {
// Sending this message will enable javascript, so it must always be called
// before any other messages are sent.
base::Value args(base::Value::Type::LIST);
- args.GetList().emplace_back("test-callback-id-0");
+ args.Append("test-callback-id-0");
std::unique_ptr<base::ListValue> list_args =
base::ListValue::From(base::Value::ToUniquePtrValue(std::move(args)));
@@ -512,8 +517,8 @@ TEST_F(PrintPreviewHandlerTest, GetPrinters) {
base::Value args(base::Value::Type::LIST);
std::string callback_id_in =
"test-callback-id-" + base::NumberToString(i + 1);
- args.GetList().emplace_back(callback_id_in);
- args.GetList().emplace_back(type);
+ args.Append(callback_id_in);
+ args.Append(type);
std::unique_ptr<base::ListValue> list_args =
base::ListValue::From(base::Value::ToUniquePtrValue(std::move(args)));
handler()->HandleGetPrinters(list_args.get());
@@ -531,7 +536,7 @@ TEST_F(PrintPreviewHandlerTest, GetPrinters) {
ASSERT_TRUE(add_data.arg2()->GetAsInteger(&type_out));
EXPECT_EQ(type, type_out);
ASSERT_TRUE(add_data.arg3());
- const base::Value::ListStorage& printer_list = add_data.arg3()->GetList();
+ base::span<const base::Value> printer_list = add_data.arg3()->GetList();
ASSERT_EQ(printer_list.size(), 1u);
EXPECT_TRUE(printer_list[0].FindKeyOfType("printer_name",
base::Value::Type::STRING));
@@ -552,15 +557,15 @@ TEST_F(PrintPreviewHandlerTest, GetPrinterCapabilities) {
// Check all four printer types that implement
// PrinterHandler::StartGetCapability().
- for (size_t i = 0; i < base::size(kAllTypes); i++) {
- PrinterType type = kAllTypes[i];
+ for (size_t i = 0; i < base::size(kAllSupportedTypes); i++) {
+ PrinterType type = kAllSupportedTypes[i];
handler()->reset_calls();
base::Value args(base::Value::Type::LIST);
std::string callback_id_in =
"test-callback-id-" + base::NumberToString(i + 1);
- args.GetList().emplace_back(callback_id_in);
- args.GetList().emplace_back(kDummyPrinterName);
- args.GetList().emplace_back(type);
+ args.Append(callback_id_in);
+ args.Append(kDummyPrinterName);
+ args.Append(type);
std::unique_ptr<base::ListValue> list_args =
base::ListValue::From(base::Value::ToUniquePtrValue(std::move(args)));
handler()->HandleGetPrinterCapabilities(list_args.get());
@@ -581,24 +586,25 @@ TEST_F(PrintPreviewHandlerTest, GetPrinterCapabilities) {
// Run through the loop again, this time with a printer that has no
// capabilities.
- for (size_t i = 0; i < base::size(kAllTypes); i++) {
- PrinterType type = kAllTypes[i];
+ for (size_t i = 0; i < base::size(kAllSupportedTypes); i++) {
+ PrinterType type = kAllSupportedTypes[i];
handler()->reset_calls();
base::Value args(base::Value::Type::LIST);
std::string callback_id_in =
"test-callback-id-" +
- base::NumberToString(i + base::size(kAllTypes) + 1);
- args.GetList().emplace_back(callback_id_in);
- args.GetList().emplace_back("EmptyPrinter");
- args.GetList().emplace_back(type);
+ base::NumberToString(i + base::size(kAllSupportedTypes) + 1);
+ args.Append(callback_id_in);
+ args.Append("EmptyPrinter");
+ args.Append(type);
std::unique_ptr<base::ListValue> list_args =
base::ListValue::From(base::Value::ToUniquePtrValue(std::move(args)));
handler()->HandleGetPrinterCapabilities(list_args.get());
EXPECT_TRUE(handler()->CalledOnlyForType(type));
- // Start with 1 call from initial settings plus base::size(kAllTypes) from
- // first loop, then add 1 more for each loop iteration.
- ASSERT_EQ(1u + base::size(kAllTypes) + (i + 1),
+ // Start with 1 call from initial settings plus
+ // base::size(kAllSupportedTypes) from first loop, then add 1 more for each
+ // loop iteration.
+ ASSERT_EQ(1u + base::size(kAllSupportedTypes) + (i + 1),
web_ui()->call_data().size());
// Verify printer capabilities promise was rejected.
@@ -610,27 +616,25 @@ TEST_F(PrintPreviewHandlerTest, GetPrinterCapabilities) {
TEST_F(PrintPreviewHandlerTest, Print) {
Initialize();
- // All four printer types can print, as well as cloud printers.
- for (size_t i = 0; i <= base::size(kAllTypes); i++) {
- // Also check cloud print. Use dummy type value of Privet (will be ignored).
- bool cloud = i == base::size(kAllTypes);
- PrinterType type = cloud ? kPrivetPrinter : kAllTypes[i];
+ // All printer types can print.
+ for (size_t i = 0; i < base::size(kAllTypes); i++) {
+ PrinterType type = kAllTypes[i];
handler()->reset_calls();
base::Value args(base::Value::Type::LIST);
std::string callback_id_in =
"test-callback-id-" + base::NumberToString(i + 1);
- args.GetList().emplace_back(callback_id_in);
- base::Value print_ticket = GetPrintTicket(type, cloud);
+ args.Append(callback_id_in);
+ base::Value print_ticket = GetPrintTicket(type);
std::string json;
base::JSONWriter::Write(print_ticket, &json);
- args.GetList().emplace_back(json);
+ args.Append(json);
std::unique_ptr<base::ListValue> list_args =
base::ListValue::From(base::Value::ToUniquePtrValue(std::move(args)));
handler()->HandlePrint(list_args.get());
// Verify correct PrinterHandler was called or that no handler was requested
// for cloud printers.
- if (cloud) {
+ if (type == kCloudPrinter) {
EXPECT_TRUE(handler()->NotCalled());
} else {
EXPECT_TRUE(handler()->CalledOnlyForType(type));
@@ -641,7 +645,7 @@ TEST_F(PrintPreviewHandlerTest, Print) {
CheckWebUIResponse(data, callback_id_in, true);
// For cloud print, should also get the encoded data back as a string.
- if (cloud) {
+ if (type == kCloudPrinter) {
std::string print_data;
ASSERT_TRUE(data.arg3()->GetAsString(&print_data));
std::string expected_data;
@@ -654,7 +658,7 @@ TEST_F(PrintPreviewHandlerTest, Print) {
TEST_F(PrintPreviewHandlerTest, GetPreview) {
Initialize();
- base::Value print_ticket = GetPrintPreviewTicket(false);
+ base::Value print_ticket = GetPrintPreviewTicket();
std::unique_ptr<base::ListValue> list_args =
ConstructPreviewArgs("test-callback-id-1", print_ticket);
handler()->HandleGetPreview(list_args.get());
@@ -668,7 +672,7 @@ TEST_F(PrintPreviewHandlerTest, GetPreview) {
preview_id_found = true;
continue;
}
- base::Value* value_in = print_ticket.FindKey(it.first);
+ const base::Value* value_in = print_ticket.FindKey(it.first);
ASSERT_TRUE(value_in);
EXPECT_EQ(*value_in, it.second);
}
@@ -679,37 +683,38 @@ TEST_F(PrintPreviewHandlerTest, SendPreviewUpdates) {
Initialize();
const char callback_id_in[] = "test-callback-id-1";
- base::Value print_ticket = GetPrintPreviewTicket(false);
+ base::Value print_ticket = GetPrintPreviewTicket();
std::unique_ptr<base::ListValue> list_args =
ConstructPreviewArgs(callback_id_in, print_ticket);
handler()->HandleGetPreview(list_args.get());
base::DictionaryValue preview_params = VerifyPreviewMessage();
// Read the preview UI ID and request ID
- const base::Value* request_value = preview_params.FindKey(kPreviewRequestID);
- ASSERT_TRUE(request_value);
- ASSERT_TRUE(request_value->is_int());
- int preview_request_id = request_value->GetInt();
+ base::Optional<int> request_value =
+ preview_params.FindIntKey(kPreviewRequestID);
+ ASSERT_TRUE(request_value.has_value());
+ int preview_request_id = request_value.value();
- const base::Value* ui_value = preview_params.FindKey(kPreviewUIID);
- ASSERT_TRUE(ui_value);
- ASSERT_TRUE(ui_value->is_int());
- int preview_ui_id = ui_value->GetInt();
+ base::Optional<int> ui_value = preview_params.FindIntKey(kPreviewUIID);
+ ASSERT_TRUE(ui_value.has_value());
+ int preview_ui_id = ui_value.value();
// Simulate renderer responses: PageLayoutReady, PageCountReady,
// PagePreviewReady, and OnPrintPreviewReady will be called in that order.
- base::DictionaryValue layout;
- layout.SetKey(kSettingMarginTop, base::Value(34.0));
- layout.SetKey(kSettingMarginLeft, base::Value(34.0));
- layout.SetKey(kSettingMarginBottom, base::Value(34.0));
- layout.SetKey(kSettingMarginRight, base::Value(34.0));
- layout.SetKey(kSettingContentWidth, base::Value(544.0));
- layout.SetKey(kSettingContentHeight, base::Value(700.0));
- layout.SetKey(kSettingPrintableAreaX, base::Value(17));
- layout.SetKey(kSettingPrintableAreaY, base::Value(17));
- layout.SetKey(kSettingPrintableAreaWidth, base::Value(578));
- layout.SetKey(kSettingPrintableAreaHeight, base::Value(734));
- handler()->SendPageLayoutReady(layout, false, preview_request_id);
+ base::Value layout(base::Value::Type::DICTIONARY);
+ layout.SetDoubleKey(kSettingMarginTop, 34.0);
+ layout.SetDoubleKey(kSettingMarginLeft, 34.0);
+ layout.SetDoubleKey(kSettingMarginBottom, 34.0);
+ layout.SetDoubleKey(kSettingMarginRight, 34.0);
+ layout.SetDoubleKey(kSettingContentWidth, 544.0);
+ layout.SetDoubleKey(kSettingContentHeight, 700.0);
+ layout.SetIntKey(kSettingPrintableAreaX, 17);
+ layout.SetIntKey(kSettingPrintableAreaY, 17);
+ layout.SetIntKey(kSettingPrintableAreaWidth, 578);
+ layout.SetIntKey(kSettingPrintableAreaHeight, 734);
+ handler()->SendPageLayoutReady(base::Value::AsDictionaryValue(layout),
+ /*has_custom_page_size_style,=*/false,
+ preview_request_id);
// Verify that page-layout-ready webUI event was fired.
AssertWebUIEventFired(*web_ui()->call_data().back(), "page-layout-ready");
@@ -732,7 +737,8 @@ TEST_F(PrintPreviewHandlerTest, SendPreviewUpdates) {
// None of these should work since there has been no new preview request.
// Check that there are no new web UI messages sent.
size_t message_count = web_ui()->call_data().size();
- handler()->SendPageLayoutReady(base::DictionaryValue(), false,
+ handler()->SendPageLayoutReady(base::DictionaryValue(),
+ /*has_custom_page_size_style,=*/false,
preview_request_id);
EXPECT_EQ(message_count, web_ui()->call_data().size());
handler()->SendPageCountReady(1, -1, 0);
@@ -788,15 +794,15 @@ TEST_F(PrintPreviewHandlerFailingTest, GetPrinterCapabilities) {
// Check all four printer types that implement
// PrinterHandler::StartGetCapability().
- for (size_t i = 0; i < base::size(kAllTypes); i++) {
- PrinterType type = kAllTypes[i];
+ for (size_t i = 0; i < base::size(kAllSupportedTypes); i++) {
+ PrinterType type = kAllSupportedTypes[i];
handler()->reset_calls();
base::Value args(base::Value::Type::LIST);
std::string callback_id_in =
"test-callback-id-" + base::NumberToString(i + 1);
- args.GetList().emplace_back(callback_id_in);
- args.GetList().emplace_back(kDummyPrinterName);
- args.GetList().emplace_back(type);
+ args.Append(callback_id_in);
+ args.Append(kDummyPrinterName);
+ args.Append(type);
std::unique_ptr<base::ListValue> list_args =
base::ListValue::From(base::Value::ToUniquePtrValue(std::move(args)));
handler()->HandleGetPrinterCapabilities(list_args.get());
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 a855e2f1d97..820820687a5 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
@@ -26,6 +26,7 @@
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/printing/background_printing_manager.h"
#include "chrome/browser/printing/print_preview_data_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -66,6 +67,10 @@
#include "base/enterprise_util.h"
#endif
+#if !BUILDFLAG(OPTIMIZE_WEBUI)
+#include "chrome/browser/ui/webui/managed_ui_handler.h"
+#endif
+
using content::WebContents;
namespace printing {
@@ -223,6 +228,7 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
{"optionCustomScaling", IDS_PRINT_PREVIEW_OPTION_CUSTOM_SCALING},
{"optionDefaultScaling", IDS_PRINT_PREVIEW_OPTION_DEFAULT_SCALING},
{"optionFitToPage", IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAGE},
+ {"optionFitToPaper", IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAPER},
{"optionHeaderFooter", IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER},
{"optionLandscape", IDS_PRINT_PREVIEW_OPTION_LANDSCAPE},
{"optionLongEdge", IDS_PRINT_PREVIEW_OPTION_LONG_EDGE},
@@ -343,60 +349,44 @@ void SetupPrintPreviewPlugin(content::WebUIDataSource* source) {
int id;
} kPdfResources[] = {
{"pdf/browser_api.js", IDR_PDF_BROWSER_API_JS},
+ {"pdf/controller.js", IDR_PDF_CONTROLLER_JS},
{"pdf/elements/icons.html", IDR_PDF_ICONS_HTML},
{"pdf/elements/shared-vars.html", IDR_PDF_SHARED_VARS_HTML},
- {"pdf/elements/viewer-bookmark/viewer-bookmark.html",
- IDR_PDF_VIEWER_BOOKMARK_HTML},
- {"pdf/elements/viewer-bookmark/viewer-bookmark.js",
- IDR_PDF_VIEWER_BOOKMARK_JS},
- {"pdf/elements/viewer-error-screen/viewer-error-screen.html",
- IDR_PDF_VIEWER_ERROR_SCREEN_HTML},
- {"pdf/elements/viewer-error-screen/viewer-error-screen.js",
- IDR_PDF_VIEWER_ERROR_SCREEN_JS},
+ {"pdf/elements/viewer-bookmark.html", IDR_PDF_VIEWER_BOOKMARK_HTML},
+ {"pdf/elements/viewer-bookmark.js", IDR_PDF_VIEWER_BOOKMARK_JS},
+ {"pdf/elements/viewer-error-screen.html", IDR_PDF_VIEWER_ERROR_SCREEN_HTML},
+ {"pdf/elements/viewer-error-screen.js", IDR_PDF_VIEWER_ERROR_SCREEN_JS},
#if defined(OS_CHROMEOS)
- {"pdf/elements/viewer-ink-host/viewer-ink-host.html",
- IDR_PDF_VIEWER_INK_HOST_HTML},
- {"pdf/elements/viewer-ink-host/viewer-ink-host.js",
- IDR_PDF_VIEWER_INK_HOST_JS},
+ {"pdf/elements/viewer-ink-host.html", IDR_PDF_VIEWER_INK_HOST_HTML},
+ {"pdf/elements/viewer-ink-host.js", IDR_PDF_VIEWER_INK_HOST_JS},
#endif
- {"pdf/elements/viewer-page-indicator/viewer-page-indicator.html",
+ {"pdf/elements/viewer-page-indicator.html",
IDR_PDF_VIEWER_PAGE_INDICATOR_HTML},
- {"pdf/elements/viewer-page-indicator/viewer-page-indicator.js",
- IDR_PDF_VIEWER_PAGE_INDICATOR_JS},
- {"pdf/elements/viewer-page-selector/viewer-page-selector.html",
+ {"pdf/elements/viewer-page-indicator.js", IDR_PDF_VIEWER_PAGE_INDICATOR_JS},
+ {"pdf/elements/viewer-page-selector.html",
IDR_PDF_VIEWER_PAGE_SELECTOR_HTML},
- {"pdf/elements/viewer-page-selector/viewer-page-selector.js",
- IDR_PDF_VIEWER_PAGE_SELECTOR_JS},
- {"pdf/elements/viewer-password-screen/viewer-password-screen.html",
+ {"pdf/elements/viewer-page-selector.js", IDR_PDF_VIEWER_PAGE_SELECTOR_JS},
+ {"pdf/elements/viewer-password-screen.html",
IDR_PDF_VIEWER_PASSWORD_SCREEN_HTML},
- {"pdf/elements/viewer-password-screen/viewer-password-screen.js",
+ {"pdf/elements/viewer-password-screen.js",
IDR_PDF_VIEWER_PASSWORD_SCREEN_JS},
- {"pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html",
- IDR_PDF_VIEWER_PDF_TOOLBAR_HTML},
- {"pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js",
- IDR_PDF_VIEWER_PDF_TOOLBAR_JS},
+ {"pdf/elements/viewer-pdf-toolbar.html", IDR_PDF_VIEWER_PDF_TOOLBAR_HTML},
+ {"pdf/elements/viewer-pdf-toolbar.js", IDR_PDF_VIEWER_PDF_TOOLBAR_JS},
#if defined(OS_CHROMEOS)
- {"pdf/elements/viewer-form-warning/viewer-form-warning.html",
- IDR_PDF_VIEWER_FORM_WARNING_HTML},
- {"pdf/elements/viewer-form-warning/viewer-form-warning.js",
- IDR_PDF_VIEWER_FORM_WARNING_JS},
- {"pdf/elements/viewer-pen-options/viewer-pen-options.html",
- IDR_PDF_VIEWER_PEN_OPTIONS_HTML},
- {"pdf/elements/viewer-pen-options/viewer-pen-options.js",
- IDR_PDF_VIEWER_PEN_OPTIONS_JS},
+ {"pdf/elements/viewer-form-warning.html", IDR_PDF_VIEWER_FORM_WARNING_HTML},
+ {"pdf/elements/viewer-form-warning.js", IDR_PDF_VIEWER_FORM_WARNING_JS},
+ {"pdf/elements/viewer-pen-options.html", IDR_PDF_VIEWER_PEN_OPTIONS_HTML},
+ {"pdf/elements/viewer-pen-options.js", IDR_PDF_VIEWER_PEN_OPTIONS_JS},
#endif
- {"pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.html",
+ {"pdf/elements/viewer-toolbar-dropdown.html",
IDR_PDF_VIEWER_TOOLBAR_DROPDOWN_HTML},
- {"pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.js",
+ {"pdf/elements/viewer-toolbar-dropdown.js",
IDR_PDF_VIEWER_TOOLBAR_DROPDOWN_JS},
- {"pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.html",
- IDR_PDF_VIEWER_ZOOM_BUTTON_HTML},
- {"pdf/elements/viewer-zoom-toolbar/viewer-zoom-button.js",
- IDR_PDF_VIEWER_ZOOM_BUTTON_JS},
- {"pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.html",
+ {"pdf/elements/viewer-zoom-button.html", IDR_PDF_VIEWER_ZOOM_BUTTON_HTML},
+ {"pdf/elements/viewer-zoom-button.js", IDR_PDF_VIEWER_ZOOM_BUTTON_JS},
+ {"pdf/elements/viewer-zoom-toolbar.html",
IDR_PDF_VIEWER_ZOOM_SELECTOR_HTML},
- {"pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js",
- IDR_PDF_VIEWER_ZOOM_SELECTOR_JS},
+ {"pdf/elements/viewer-zoom-toolbar.js", IDR_PDF_VIEWER_ZOOM_SELECTOR_JS},
{"pdf/gesture_detector.js", IDR_PDF_GESTURE_DETECTOR_JS},
{"pdf/index.css", IDR_PDF_INDEX_CSS},
{"pdf/index.html", IDR_PDF_INDEX_HTML},
@@ -470,7 +460,12 @@ PrintPreviewUI::PrintPreviewUI(content::WebUI* web_ui)
handler_(CreatePrintPreviewHandlers(web_ui)) {
// Set up the chrome://print/ data source.
Profile* profile = Profile::FromWebUI(web_ui);
- content::WebUIDataSource::Add(profile, CreatePrintPreviewUISource(profile));
+ content::WebUIDataSource* source = CreatePrintPreviewUISource(profile);
+#if !BUILDFLAG(OPTIMIZE_WEBUI)
+ // For the Polymer 3 demo page.
+ ManagedUIHandler::Initialize(web_ui, source);
+#endif
+ content::WebUIDataSource::Add(profile, source);
// Set up the chrome://theme/ source.
content::URLDataSource::Add(profile, std::make_unique<ThemeSource>(profile));
@@ -574,6 +569,7 @@ void PrintPreviewUI::SetInitialParams(
PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
print_preview_dialog->GetWebUI()->GetController());
print_preview_ui->source_is_modifiable_ = params.is_modifiable;
+ print_preview_ui->source_is_pdf_ = params.is_pdf;
print_preview_ui->source_has_selection_ = params.has_selection;
print_preview_ui->print_selection_only_ = params.selection_only;
}
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 2aca55e7bc1..1922e87b53e 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
@@ -61,6 +61,8 @@ class PrintPreviewUI : public ConstrainedWebDialogUI {
bool source_is_modifiable() const { return source_is_modifiable_; }
+ bool source_is_pdf() const { return source_is_pdf_; }
+
bool source_has_selection() const { return source_has_selection_; }
bool print_selection_only() const { return print_selection_only_; }
@@ -257,6 +259,9 @@ class PrintPreviewUI : public ConstrainedWebDialogUI {
// Indicates whether the source document can be modified.
bool source_is_modifiable_ = true;
+ // Indicates whether the source document is a PDF.
+ bool source_is_pdf_ = false;
+
// Indicates whether the source document has selection.
bool source_has_selection_ = false;
diff --git a/chromium/chrome/browser/ui/webui/print_preview/print_preview_utils.cc b/chromium/chrome/browser/ui/webui/print_preview/print_preview_utils.cc
index e9d21dc1c15..e8af4416366 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/print_preview_utils.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/print_preview_utils.cc
@@ -212,15 +212,12 @@ bool ParseSettings(const base::Value& settings,
std::string* out_capabilities,
gfx::Size* out_page_size,
base::Value* out_ticket) {
- const std::string* destination_id_opt =
- settings.FindStringKey(kSettingDeviceName);
const std::string* ticket_opt = settings.FindStringKey(kSettingTicket);
const std::string* capabilities_opt =
settings.FindStringKey(kSettingCapabilities);
out_page_size->SetSize(settings.FindIntKey(kSettingPageWidth).value_or(0),
settings.FindIntKey(kSettingPageHeight).value_or(0));
- if (!destination_id_opt || !ticket_opt || !capabilities_opt ||
- out_page_size->IsEmpty()) {
+ if (!ticket_opt || !capabilities_opt || out_page_size->IsEmpty()) {
NOTREACHED();
return false;
}
@@ -229,7 +226,7 @@ bool ParseSettings(const base::Value& settings,
if (!ticket_value)
return false;
- *out_destination_id = *destination_id_opt;
+ *out_destination_id = *settings.FindStringKey(kSettingDeviceName);
*out_capabilities = *capabilities_opt;
*out_ticket = std::move(*ticket_value);
return true;
diff --git a/chromium/chrome/browser/ui/webui/print_preview/print_preview_utils_unittest.cc b/chromium/chrome/browser/ui/webui/print_preview/print_preview_utils_unittest.cc
index 2fed881bf5d..1d84fb3e65c 100644
--- a/chromium/chrome/browser/ui/webui/print_preview/print_preview_utils_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/print_preview/print_preview_utils_unittest.cc
@@ -163,8 +163,7 @@ void ValidateVendorCaps(const base::Value* printer_out,
ASSERT_TRUE(vendor_capability_out);
size_t index = 0;
- const base::Value::ListStorage& output_list =
- vendor_capability_out->GetList();
+ base::span<const base::Value> output_list = vendor_capability_out->GetList();
for (const auto& input_entry : input_vendor_caps->GetList()) {
if (!HasValidEntry(
input_entry
diff --git a/chromium/chrome/browser/ui/webui/profile_helper_browsertest.cc b/chromium/chrome/browser/ui/webui/profile_helper_browsertest.cc
index 5e9302e517b..c6f2e95b4a0 100644
--- a/chromium/chrome/browser/ui/webui/profile_helper_browsertest.cc
+++ b/chromium/chrome/browser/ui/webui/profile_helper_browsertest.cc
@@ -4,7 +4,7 @@
#include "base/bind.h"
#include "base/run_loop.h"
-#include "base/scoped_observer.h"
+#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -46,8 +46,12 @@ Profile* CreateProfile() {
class ExpectBrowserActivationForProfile : public BrowserListObserver {
public:
explicit ExpectBrowserActivationForProfile(Profile* profile)
- : profile_(profile), scoped_observer_(this) {
- scoped_observer_.Add(BrowserList::GetInstance());
+ : profile_(profile) {
+ BrowserList::AddObserver(this);
+ }
+
+ ~ExpectBrowserActivationForProfile() override {
+ BrowserList::RemoveObserver(this);
}
void Wait() {
@@ -63,7 +67,31 @@ class ExpectBrowserActivationForProfile : public BrowserListObserver {
private:
Profile* profile_;
base::RunLoop loop_;
- ScopedObserver<BrowserList, BrowserListObserver> scoped_observer_;
+};
+
+// An observer that returns back to test code after a new browser is added to
+// the BrowserList.
+class BrowserAddedObserver : public BrowserListObserver {
+ public:
+ BrowserAddedObserver() { BrowserList::AddObserver(this); }
+
+ ~BrowserAddedObserver() override { BrowserList::RemoveObserver(this); }
+
+ Browser* Wait() {
+ run_loop_.Run();
+ return browser_;
+ }
+
+ protected:
+ // BrowserListObserver:
+ void OnBrowserAdded(Browser* browser) override {
+ browser_ = browser;
+ run_loop_.Quit();
+ }
+
+ private:
+ Browser* browser_;
+ base::RunLoop run_loop_;
};
} // namespace
@@ -123,12 +151,15 @@ IN_PROC_BROWSER_TEST_F(ProfileHelperTest, DeleteSoleProfile) {
EXPECT_EQ(1u, storage.GetNumberOfProfiles());
// Original browser will be closed, and browser with the new profile created.
+ BrowserAddedObserver added_observer;
webui::DeleteProfileAtPath(original_browser->profile()->GetPath(),
ProfileMetrics::DELETE_PROFILE_SETTINGS);
ui_test_utils::WaitForBrowserToClose(original_browser);
+ Browser* new_browser = added_observer.Wait();
EXPECT_EQ(1u, browser_list->size());
EXPECT_FALSE(base::Contains(*browser_list, original_browser));
+ EXPECT_NE(new_browser, original_browser);
EXPECT_EQ(1u, storage.GetNumberOfProfiles());
}
diff --git a/chromium/chrome/browser/ui/webui/quota_internals/OWNERS b/chromium/chrome/browser/ui/webui/quota_internals/OWNERS
index af949556e32..84d5cb66e1c 100644
--- a/chromium/chrome/browser/ui/webui/quota_internals/OWNERS
+++ b/chromium/chrome/browser/ui/webui/quota_internals/OWNERS
@@ -1,6 +1,4 @@
-tzik@chromium.org
-jsbell@chromium.org
-pwnall@chromium.org
+file://storage/browser/quota/OWNERS
# TEAM: storage-dev@chromium.org
# COMPONENT: Blink>Storage>Quota
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 b4b7b46f2c6..e6293d9e973 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
@@ -4,10 +4,14 @@
#include "chrome/browser/ui/webui/reset_password/reset_password_ui.h"
+#include <memory>
+#include <utility>
+
#include "base/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/reset_password/reset_password.mojom.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "components/safe_browsing/common/safe_browsing_prefs.h"
@@ -21,7 +25,7 @@
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "ui/base/l10n/l10n_util.h"
using safe_browsing::LoginReputationClientResponse;
@@ -46,9 +50,8 @@ class ResetPasswordHandlerImpl : public mojom::ResetPasswordHandler {
public:
ResetPasswordHandlerImpl(
content::WebContents* web_contents,
- mojo::InterfaceRequest<mojom::ResetPasswordHandler> request)
- : web_contents_(web_contents),
- binding_(this, std::move(request)) {
+ mojo::PendingReceiver<mojom::ResetPasswordHandler> receiver)
+ : web_contents_(web_contents), receiver_(this, std::move(receiver)) {
DCHECK(web_contents);
}
@@ -73,7 +76,7 @@ class ResetPasswordHandlerImpl : public mojom::ResetPasswordHandler {
private:
content::WebContents* web_contents_;
- mojo::Binding<mojom::ResetPasswordHandler> binding_;
+ mojo::Receiver<mojom::ResetPasswordHandler> receiver_;
DISALLOW_COPY_AND_ASSIGN(ResetPasswordHandlerImpl);
};
@@ -126,9 +129,9 @@ ResetPasswordUI::ResetPasswordUI(content::WebUI* web_ui)
ResetPasswordUI::~ResetPasswordUI() {}
void ResetPasswordUI::BindResetPasswordHandler(
- mojom::ResetPasswordHandlerRequest request) {
+ mojo::PendingReceiver<mojom::ResetPasswordHandler> receiver) {
ui_handler_ = std::make_unique<ResetPasswordHandlerImpl>(
- web_ui()->GetWebContents(), std::move(request));
+ web_ui()->GetWebContents(), std::move(receiver));
}
base::DictionaryValue ResetPasswordUI::PopulateStrings() const {
diff --git a/chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.h b/chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.h
index 8712c13c91d..3bd39465b30 100644
--- a/chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.h
+++ b/chromium/chrome/browser/ui/webui/reset_password/reset_password_ui.h
@@ -9,6 +9,7 @@
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
#include "chrome/browser/ui/webui/reset_password/reset_password.mojom.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
namespace base {
@@ -24,7 +25,8 @@ class ResetPasswordUI : public ui::MojoWebUIController {
~ResetPasswordUI() override;
private:
- void BindResetPasswordHandler(mojom::ResetPasswordHandlerRequest request);
+ void BindResetPasswordHandler(
+ mojo::PendingReceiver<mojom::ResetPasswordHandler> receiver);
base::DictionaryValue PopulateStrings() const;
diff --git a/chromium/chrome/browser/ui/webui/sandbox/OWNERS b/chromium/chrome/browser/ui/webui/sandbox/OWNERS
new file mode 100644
index 00000000000..058ee25caec
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/sandbox/OWNERS
@@ -0,0 +1,3 @@
+file://sandbox/OWNERS
+# COMPONENT: Internals>Sandbox
+# TEAM: security-dev@chromium.org
diff --git a/chromium/chrome/browser/ui/webui/sandbox/sandbox_handler.cc b/chromium/chrome/browser/ui/webui/sandbox/sandbox_handler.cc
new file mode 100644
index 00000000000..a4f1c53905c
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/sandbox/sandbox_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/ui/webui/sandbox/sandbox_handler.h"
+
+#include <utility>
+
+#include "base/bind.h"
+#include "base/numerics/safe_conversions.h"
+#include "base/task/post_task.h"
+#include "base/values.h"
+#include "content/public/browser/browser_child_process_host_iterator.h"
+#include "content/public/browser/browser_task_traits.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/child_process_data.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/web_ui.h"
+#include "content/public/common/process_type.h"
+#include "services/service_manager/sandbox/win/sandbox_win.h"
+
+using content::BrowserChildProcessHostIterator;
+using content::ChildProcessData;
+using content::RenderProcessHost;
+
+namespace sandbox_handler {
+namespace {
+base::Value FetchBrowserChildProcesses() {
+ // The |BrowserChildProcessHostIterator| must only be used on the IO thread.
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ base::Value browser_processes(base::Value::Type::LIST);
+
+ for (BrowserChildProcessHostIterator itr; !itr.Done(); ++itr) {
+ const ChildProcessData& process_data = itr.GetData();
+ // Only add processes that have already started, i.e. with valid handles.
+ if (!process_data.GetProcess().IsValid())
+ continue;
+ base::Value proc(base::Value::Type::DICTIONARY);
+ proc.SetPath("processId", base::Value(base::strict_cast<double>(
+ process_data.GetProcess().Pid())));
+ proc.SetPath("processType",
+ base::Value(content::GetProcessTypeNameInEnglish(
+ process_data.process_type)));
+ proc.SetPath("name", base::Value(process_data.name));
+ proc.SetPath("metricsName", base::Value(process_data.metrics_name));
+ browser_processes.GetList().push_back(std::move(proc));
+ }
+
+ return browser_processes;
+}
+
+base::Value FetchRenderHostProcesses() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ base::Value renderer_processes(base::Value::Type::LIST);
+
+ for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
+ !it.IsAtEnd(); it.Advance()) {
+ RenderProcessHost* host = it.GetCurrentValue();
+ // Skip processes that might not have started yet.
+ if (!host->GetProcess().IsValid())
+ continue;
+
+ base::Value proc(base::Value::Type::DICTIONARY);
+ proc.SetPath(
+ "processId",
+ base::Value(base::strict_cast<double>(host->GetProcess().Pid())));
+ renderer_processes.GetList().push_back(std::move(proc));
+ }
+
+ return renderer_processes;
+}
+
+} // namespace
+
+SandboxHandler::SandboxHandler() = default;
+SandboxHandler::~SandboxHandler() = default;
+
+void SandboxHandler::RegisterMessages() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+ web_ui()->RegisterMessageCallback(
+ "requestSandboxDiagnostics",
+ base::BindRepeating(&SandboxHandler::HandleRequestSandboxDiagnostics,
+ base::Unretained(this)));
+}
+
+void SandboxHandler::HandleRequestSandboxDiagnostics(
+ const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+ CHECK_EQ(1U, args->GetList().size());
+ sandbox_diagnostics_callback_id_ = args->GetList()[0].Clone();
+
+ AllowJavascript();
+
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE, {content::BrowserThread::IO},
+ base::Bind(&FetchBrowserChildProcesses),
+ base::Bind(&SandboxHandler::FetchBrowserChildProcessesCompleted,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void SandboxHandler::FetchBrowserChildProcessesCompleted(
+ base::Value browser_processes) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ browser_processes_ = std::move(browser_processes);
+
+ service_manager::SandboxWin::GetPolicyDiagnostics(
+ base::Bind(&SandboxHandler::FetchSandboxDiagnosticsCompleted,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+// This runs nested inside SandboxWin so we get out quickly.
+void SandboxHandler::FetchSandboxDiagnosticsCompleted(
+ base::Value sandbox_policies) {
+ sandbox_policies_ = std::move(sandbox_policies);
+ base::PostTask(FROM_HERE, {content::BrowserThread::UI},
+ base::BindOnce(&SandboxHandler::GetRendererProcessesAndFinish,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void SandboxHandler::GetRendererProcessesAndFinish() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+ auto renderer_processes = FetchRenderHostProcesses();
+ base::Value results(base::Value::Type::DICTIONARY);
+ results.SetPath("browser", std::move(browser_processes_));
+ results.SetPath("policies", std::move(sandbox_policies_));
+ results.SetPath("renderer", std::move(renderer_processes));
+ ResolveJavascriptCallback(sandbox_diagnostics_callback_id_,
+ std::move(results));
+}
+
+} // namespace sandbox_handler
diff --git a/chromium/chrome/browser/ui/webui/sandbox/sandbox_handler.h b/chromium/chrome/browser/ui/webui/sandbox/sandbox_handler.h
new file mode 100644
index 00000000000..822044f28b3
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/sandbox/sandbox_handler.h
@@ -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.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_SANDBOX_SANDBOX_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_SANDBOX_SANDBOX_HANDLER_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/web_ui_message_handler.h"
+
+namespace base {
+class Value;
+class ListValue;
+} // namespace base
+
+namespace sandbox_handler {
+// This class takes care of sending the list of processes and their sandboxing
+// status to the chrome://sandbox WebUI page when it is requested.
+class SandboxHandler : public content::WebUIMessageHandler {
+ public:
+ SandboxHandler();
+ ~SandboxHandler() override;
+
+ private:
+ // content::WebUIMessageHandler:
+ void RegisterMessages() override;
+
+ // Callback for the "requestSandboxDiagnostics" message.
+ void HandleRequestSandboxDiagnostics(const base::ListValue* args);
+
+ void OnSandboxDataFetched(base::Value results);
+
+ void FetchBrowserChildProcessesCompleted(base::Value browser_processes);
+ void FetchSandboxDiagnosticsCompleted(base::Value sandbox_policies);
+ void GetRendererProcessesAndFinish();
+
+ // The ID of the callback that will get invoked with the sandbox list.
+ base::Value sandbox_diagnostics_callback_id_;
+ base::Value browser_processes_;
+ base::Value sandbox_policies_;
+
+ // Always keep this the last member of this class to make sure it's the
+ // first thing to be destructed.
+ base::WeakPtrFactory<SandboxHandler> weak_ptr_factory_{this};
+
+ DISALLOW_COPY_AND_ASSIGN(SandboxHandler);
+};
+
+} // namespace sandbox_handler
+
+#endif // CHROME_BROWSER_UI_WEBUI_SANDBOX_SANDBOX_HANDLER_H_
diff --git a/chromium/chrome/browser/ui/webui/sandbox_internals_ui.cc b/chromium/chrome/browser/ui/webui/sandbox/sandbox_internals_ui.cc
index e09f9d4a1e9..9c3783b3791 100644
--- a/chromium/chrome/browser/ui/webui/sandbox_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/sandbox/sandbox_internals_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/sandbox_internals_ui.h"
+#include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h"
#include <string>
@@ -15,6 +15,10 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
+#if defined(OS_WIN)
+#include "chrome/browser/ui/webui/sandbox/sandbox_handler.h"
+#endif
+
#if defined(OS_ANDROID)
#include "chrome/common/sandbox_status_extension_android.mojom.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
@@ -79,6 +83,10 @@ content::WebUIDataSource* CreateDataSource() {
SandboxInternalsUI::SandboxInternalsUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
+#if defined(OS_WIN)
+ web_ui->AddMessageHandler(
+ std::make_unique<sandbox_handler::SandboxHandler>());
+#endif
Profile* profile = Profile::FromWebUI(web_ui);
content::WebUIDataSource::Add(profile, CreateDataSource());
}
@@ -86,7 +94,7 @@ SandboxInternalsUI::SandboxInternalsUI(content::WebUI* web_ui)
void SandboxInternalsUI::RenderFrameCreated(
content::RenderFrameHost* render_frame_host) {
#if defined(OS_ANDROID)
- chrome::mojom::SandboxStatusExtensionAssociatedPtr sandbox_status;
+ mojo::AssociatedRemote<chrome::mojom::SandboxStatusExtension> sandbox_status;
render_frame_host->GetRemoteAssociatedInterfaces()->GetInterface(
&sandbox_status);
sandbox_status->AddSandboxStatusExtension();
diff --git a/chromium/chrome/browser/ui/webui/sandbox_internals_ui.h b/chromium/chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h
index c8c59692774..5fbd2ea41f0 100644
--- a/chromium/chrome/browser/ui/webui/sandbox_internals_ui.h
+++ b/chromium/chrome/browser/ui/webui/sandbox/sandbox_internals_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_SANDBOX_INTERNALS_UI_H_
-#define CHROME_BROWSER_UI_WEBUI_SANDBOX_INTERNALS_UI_H_
+#ifndef CHROME_BROWSER_UI_WEBUI_SANDBOX_SANDBOX_INTERNALS_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_SANDBOX_SANDBOX_INTERNALS_UI_H_
#include "base/macros.h"
#include "content/public/browser/web_ui_controller.h"
@@ -28,4 +28,4 @@ class SandboxInternalsUI : public content::WebUIController {
DISALLOW_COPY_AND_ASSIGN(SandboxInternalsUI);
};
-#endif // CHROME_BROWSER_UI_WEBUI_SANDBOX_INTERNALS_UI_H_
+#endif // CHROME_BROWSER_UI_WEBUI_SANDBOX_SANDBOX_INTERNALS_UI_H_
diff --git a/chromium/chrome/browser/ui/webui/settings/about_handler.cc b/chromium/chrome/browser/ui/webui/settings/about_handler.cc
index 7245f9a91e3..735025691f6 100644
--- a/chromium/chrome/browser/ui/webui/settings/about_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/about_handler.cc
@@ -28,6 +28,7 @@
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/obsolete_system/obsolete_system.h"
#include "chrome/browser/ui/browser.h"
@@ -55,7 +56,6 @@
#if defined(OS_CHROMEOS)
#include "base/i18n/time_formatting.h"
-#include "base/system/sys_info.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
@@ -70,7 +70,7 @@
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h"
#include "chromeos/dbus/power/power_manager_client.h"
-#include "chromeos/dbus/util/version_loader.h"
+#include "chromeos/dbus/update_engine_client.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/system/statistics_provider.h"
@@ -227,21 +227,6 @@ std::string ReadRegulatoryLabelText(const base::FilePath& label_dir_path) {
return std::string();
}
-std::unique_ptr<base::DictionaryValue> GetVersionInfo() {
- std::unique_ptr<base::DictionaryValue> version_info(
- new base::DictionaryValue);
-
- version_info->SetString("osVersion",
- chromeos::version_loader::GetVersion(
- chromeos::version_loader::VERSION_FULL));
- version_info->SetString("arcVersion",
- chromeos::version_loader::GetARCVersion());
- version_info->SetString("osFirmware",
- chromeos::version_loader::GetFirmware());
-
- return version_info;
-}
-
#endif // defined(OS_CHROMEOS)
std::string UpdateStatusToString(VersionUpdater::Status status) {
@@ -355,16 +340,6 @@ AboutHandler* AboutHandler::Create(content::WebUIDataSource* html_source,
os_with_linux_license);
html_source->AddBoolean("aboutEnterpriseManaged", IsEnterpriseManaged());
- base::Time build_time = base::SysInfo::GetLsbReleaseTime();
- base::string16 build_date = base::TimeFormatFriendlyDate(build_time);
- html_source->AddString("aboutBuildDate", build_date);
-
- base::CommandLine::StringType command_line =
- base::CommandLine::ForCurrentProcess()->GetCommandLineString();
- html_source->AddString("aboutCommandLine", command_line);
-
- html_source->AddString("aboutUserAgent", GetUserAgent());
- html_source->AddString("aboutJsEngineVersion", V8_VERSION_STRING);
html_source->AddString("endOfLifeMessage", l10n_util::GetStringFUTF16(
IDS_EOL_NOTIFICATION_EOL,
ui::GetChromeOSDeviceName()));
@@ -405,9 +380,6 @@ void AboutHandler::RegisterMessages() {
base::BindRepeating(&AboutHandler::HandleRequestUpdateOverCellular,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
- "getVersionInfo", base::BindRepeating(&AboutHandler::HandleGetVersionInfo,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
"getRegulatoryInfo",
base::BindRepeating(&AboutHandler::HandleGetRegulatoryInfo,
base::Unretained(this)));
@@ -419,8 +391,8 @@ void AboutHandler::RegisterMessages() {
base::BindRepeating(&AboutHandler::HandleRefreshTPMFirmwareUpdateStatus,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
- "getHasEndOfLife",
- base::BindRepeating(&AboutHandler::HandleGetHasEndOfLife,
+ "getEndOfLifeInfo",
+ base::BindRepeating(&AboutHandler::HandleGetEndOfLifeInfo,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"getEnabledReleaseNotes",
@@ -600,25 +572,6 @@ void AboutHandler::HandleSetChannel(const base::ListValue* args) {
}
}
-void AboutHandler::HandleGetVersionInfo(const base::ListValue* args) {
- CHECK_EQ(1U, args->GetSize());
- std::string callback_id;
- CHECK(args->GetString(0, &callback_id));
-
- base::PostTaskAndReplyWithResult(
- FROM_HERE,
- {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
- base::Bind(&GetVersionInfo),
- base::Bind(&AboutHandler::OnGetVersionInfoReady,
- weak_factory_.GetWeakPtr(), callback_id));
-}
-
-void AboutHandler::OnGetVersionInfoReady(
- std::string callback_id,
- std::unique_ptr<base::DictionaryValue> version_info) {
- ResolveJavascriptCallback(base::Value(callback_id), *version_info);
-}
-
void AboutHandler::HandleGetRegulatoryInfo(const base::ListValue* args) {
CHECK_EQ(1U, args->GetSize());
std::string callback_id;
@@ -704,22 +657,31 @@ void AboutHandler::RefreshTPMFirmwareUpdateStatus(
FireWebUIListener("tpm-firmware-update-status-changed", *event);
}
-void AboutHandler::HandleGetHasEndOfLife(const base::ListValue* args) {
+void AboutHandler::HandleGetEndOfLifeInfo(const base::ListValue* args) {
CHECK_EQ(1U, args->GetSize());
std::string callback_id;
CHECK(args->GetString(0, &callback_id));
- version_updater_->GetEolStatus(
- base::BindOnce(&AboutHandler::OnGetEndOfLifeStatus,
- weak_factory_.GetWeakPtr(), callback_id));
-}
-
-void AboutHandler::OnGetEndOfLifeStatus(std::string callback_id,
- update_engine::EndOfLifeStatus status) {
- // Check for EndOfLifeStatus::kEol only because
- // EndOfLifeStatus::kSecurityOnly state is no longer supported.
- ResolveJavascriptCallback(
- base::Value(callback_id),
- base::Value(status == update_engine::EndOfLifeStatus::kEol));
+ version_updater_->GetEolInfo(base::BindOnce(&AboutHandler::OnGetEndOfLifeInfo,
+ weak_factory_.GetWeakPtr(),
+ callback_id));
+}
+
+void AboutHandler::OnGetEndOfLifeInfo(
+ std::string callback_id,
+ chromeos::UpdateEngineClient::EolInfo eol_info) {
+ base::Value response(base::Value::Type::DICTIONARY);
+ if (!eol_info.eol_date.is_null()) {
+ response.SetBoolKey("hasEndOfLife", eol_info.eol_date <= base::Time::Now());
+ response.SetStringKey("aboutPageEndOfLifeMessage",
+ l10n_util::GetStringFUTF16(
+ IDS_SETTINGS_ABOUT_PAGE_END_OF_LIFE_MESSAGE,
+ base::TimeFormatMonthAndYear(eol_info.eol_date),
+ base::ASCIIToUTF16(chrome::kEolNotificationURL)));
+ } else {
+ response.SetBoolKey("hasEndOfLife", false);
+ response.SetStringKey("aboutPageEndOfLifeMessage", "");
+ }
+ ResolveJavascriptCallback(base::Value(callback_id), response);
}
#endif // defined(OS_CHROMEOS)
diff --git a/chromium/chrome/browser/ui/webui/settings/about_handler.h b/chromium/chrome/browser/ui/webui/settings/about_handler.h
index 0c9d0b82c4e..679bad2fa37 100644
--- a/chromium/chrome/browser/ui/webui/settings/about_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/about_handler.h
@@ -25,7 +25,6 @@
#endif // defined(OS_CHROMEOS)
namespace base {
-class DictionaryValue;
class FilePath;
class ListValue;
}
@@ -100,12 +99,6 @@ class AboutHandler : public settings::SettingsPageUIHandler,
// Sets the release track version.
void HandleSetChannel(const base::ListValue* args);
- // Retrieves OS, ARC and firmware versions.
- void HandleGetVersionInfo(const base::ListValue* args);
- void OnGetVersionInfoReady(
- std::string callback_id,
- std::unique_ptr<base::DictionaryValue> version_info);
-
// Retrieves combined channel info.
void HandleGetChannelInfo(const base::ListValue* args);
// Callbacks for version_updater_->GetChannel calls.
@@ -162,15 +155,15 @@ class AboutHandler : public settings::SettingsPageUIHandler,
const base::FilePath& label_dir_path,
const std::string& text);
- // Retrieves device end of life status.
- // Will asynchronously resolve the provided callback with a boolean
- // indicating whether the device has reached end-of-life status (will no
- // longer receive updates).
- void HandleGetHasEndOfLife(const base::ListValue* args);
+ // Retrieves device End of Life information which contains the End of Life
+ // date. Will asynchronously resolve the provided callback with an object
+ // containing a boolean indicating whether the device has reached/passed End
+ // of Life, and an End Of Life description formatted with the month and year.
+ void HandleGetEndOfLifeInfo(const base::ListValue* args);
- // Callbacks for version_updater_->GetEolStatus calls.
- void OnGetEndOfLifeStatus(std::string callback_id,
- update_engine::EndOfLifeStatus status);
+ // Callbacks for version_updater_->GetEolInfo calls.
+ void OnGetEndOfLifeInfo(std::string callback_id,
+ chromeos::UpdateEngineClient::EolInfo eol_info);
#endif
// Specialized instance of the VersionUpdater used to update the browser.
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 64e4f292e47..8589141e89d 100644
--- a/chromium/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc
@@ -102,7 +102,7 @@ void BrowserLifetimeHandler::HandleSignOutAndRestart(
void BrowserLifetimeHandler::HandleFactoryReset(
const base::ListValue* args) {
- const base::Value::ListStorage& args_list = args->GetList();
+ base::span<const base::Value> args_list = args->GetList();
CHECK_EQ(1U, args_list.size());
bool tpm_firmware_update_requested = args_list[0].GetBool();
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 3978c28d325..53cc34c898e 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
@@ -204,7 +204,7 @@ void AccountManagerUIHandler::OnGetAccounts(
if (IsSameAccount(account_key, device_account_id)) {
device_account = std::move(account);
} else {
- accounts.GetList().push_back(std::move(account));
+ accounts.Append(std::move(account));
}
}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h
index 3a7d0549e7d..db3d37534d2 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h
@@ -11,7 +11,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
+#include "chrome/browser/chromeos/arc/session/arc_session_manager.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.cc
index 8b3abcc9b50..7a9cb175f5b 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.cc
@@ -11,6 +11,7 @@
#include "base/feature_list.h"
#include "chrome/browser/apps/app_service/app_icon_source.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/app_management/app_management.mojom.h"
#include "chrome/browser/ui/webui/app_management/app_management_page_handler.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/chromium_strings.h"
@@ -19,37 +20,29 @@
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "ui/base/resource/resource_bundle.h"
AppManagementPageHandlerFactory::AppManagementPageHandlerFactory(
Profile* profile)
- : page_factory_binding_(this), profile_(profile) {}
+ : profile_(profile) {}
AppManagementPageHandlerFactory::~AppManagementPageHandlerFactory() = default;
void AppManagementPageHandlerFactory::Bind(
- app_management::mojom::PageHandlerFactoryRequest request) {
- if (page_factory_binding_.is_bound()) {
- page_factory_binding_.Unbind();
- }
+ mojo::PendingReceiver<app_management::mojom::PageHandlerFactory> receiver) {
+ page_factory_receiver_.reset();
- page_factory_binding_.Bind(std::move(request));
-}
-
-void AppManagementPageHandlerFactory::BindPageHandlerFactory(
- app_management::mojom::PageHandlerFactoryRequest request) {
- if (page_factory_binding_.is_bound()) {
- page_factory_binding_.Unbind();
- }
-
- page_factory_binding_.Bind(std::move(request));
+ page_factory_receiver_.Bind(std::move(receiver));
}
void AppManagementPageHandlerFactory::CreatePageHandler(
- app_management::mojom::PagePtr page,
- app_management::mojom::PageHandlerRequest request) {
+ mojo::PendingRemote<app_management::mojom::Page> page,
+ mojo::PendingReceiver<app_management::mojom::PageHandler> receiver) {
DCHECK(page);
page_handler_ = std::make_unique<AppManagementPageHandler>(
- std::move(request), std::move(page), profile_);
+ std::move(receiver), std::move(page), profile_);
}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h
index 3779071f093..ca3d617e7b4 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h
@@ -9,7 +9,9 @@
#include "base/macros.h"
#include "chrome/browser/ui/webui/app_management/app_management.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
class Profile;
@@ -21,21 +23,20 @@ class AppManagementPageHandlerFactory
explicit AppManagementPageHandlerFactory(Profile* profile);
~AppManagementPageHandlerFactory() override;
- void Bind(app_management::mojom::PageHandlerFactoryRequest request);
+ void Bind(mojo::PendingReceiver<app_management::mojom::PageHandlerFactory>
+ receiver);
private:
- void BindPageHandlerFactory(
- app_management::mojom::PageHandlerFactoryRequest request);
-
// app_management::mojom::PageHandlerFactory:
void CreatePageHandler(
- app_management::mojom::PagePtr page,
- app_management::mojom::PageHandlerRequest request) override;
+ mojo::PendingRemote<app_management::mojom::Page> page,
+ mojo::PendingReceiver<app_management::mojom::PageHandler> receiver)
+ override;
std::unique_ptr<AppManagementPageHandler> page_handler_;
- mojo::Binding<app_management::mojom::PageHandlerFactory>
- page_factory_binding_;
+ mojo::Receiver<app_management::mojom::PageHandlerFactory>
+ page_factory_receiver_{this};
Profile* profile_;
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_uma.h b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_uma.h
new file mode 100644
index 00000000000..31d7515612e
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/app_management/app_management_uma.h
@@ -0,0 +1,31 @@
+// 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_CHROMEOS_APP_MANAGEMENT_APP_MANAGEMENT_UMA_H_
+#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_APP_MANAGEMENT_APP_MANAGEMENT_UMA_H_
+
+// These are used in histograms, do not remove/renumber entries. If you're
+// adding to this enum with the intention that it will be logged, update the
+// AppManagementEntryPoint enum listing in
+// tools/metrics/histograms/enums.xml.
+enum class AppManagementEntryPoint {
+ kAppListContextMenuAppInfoArc = 0,
+ kAppListContextMenuAppInfoChromeApp = 1,
+ kAppListContextMenuAppInfoWebApp = 2,
+ kLauncherContextMenuAppInfoArc = 3,
+ kLauncherContextMenuAppInfoChromeApp = 4,
+ kLauncherContextMenuAppInfoWebApp = 5,
+ kAppManagementMainViewArc = 6,
+ kAppManagementMainViewChromeApp = 7,
+ kAppManagementMainViewWebApp = 8,
+ kOsSettingsMainPage = 9,
+ kMaxValue = kOsSettingsMainPage,
+};
+
+// This histogram is also declared and used at chrome/browser/resources/
+// settings/chrome_os/os_apps_page/app_management_page/constants.js.
+constexpr char kAppManagementEntryPointsHistogramName[] =
+ "AppManagement.EntryPoints";
+
+#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_APP_MANAGEMENT_APP_MANAGEMENT_UMA_H_
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 2038031a39e..1c5b605ea28 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
@@ -17,6 +17,7 @@
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task/post_task.h"
#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
@@ -84,9 +85,7 @@ const char kProfileDownloadReason[] = "Preferences";
} // namespace
ChangePictureHandler::ChangePictureHandler()
- : previous_image_index_(user_manager::User::USER_IMAGE_INVALID),
- user_manager_observer_(this),
- camera_observer_(this) {
+ : previous_image_index_(user_manager::User::USER_IMAGE_INVALID) {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
audio::SoundsManager* manager = audio::SoundsManager::Get();
manager->Initialize(SOUND_OBJECT_DELETE,
@@ -225,11 +224,17 @@ void ChangePictureHandler::SendSelectedImage() {
user->has_image_bytes()) {
previous_image_bytes_ = user->image_bytes();
SendOldImage(webui::GetPngDataUrl(previous_image_bytes_->front(),
- previous_image_bytes_->size()),
- -1);
+ previous_image_bytes_->size()));
} else {
previous_image_bytes_ = nullptr;
- SendOldImage(webui::GetBitmapDataUrl(*previous_image_.bitmap()), -1);
+ DCHECK(previous_image_.IsThreadSafe());
+ // Post a task because GetBitmapDataUrl does PNG encoding, which is
+ // slow for large images.
+ base::PostTaskAndReplyWithResult(
+ FROM_HERE, {base::ThreadPool(), base::TaskPriority::USER_BLOCKING},
+ base::BindOnce(&webui::GetBitmapDataUrl, *previous_image_.bitmap()),
+ base::BindOnce(&ChangePictureHandler::SendOldImage,
+ weak_ptr_factory_.GetWeakPtr()));
}
break;
}
@@ -250,7 +255,7 @@ void ChangePictureHandler::SendSelectedImage() {
previous_image_ = user->GetImage();
previous_image_bytes_ = nullptr;
previous_image_format_ = user_manager::UserImage::FORMAT_UNKNOWN;
- SendOldImage(
+ SendOldImageWithIndex(
default_user_image::GetDefaultImageUrl(previous_image_index_),
previous_image_index_);
}
@@ -277,11 +282,15 @@ void ChangePictureHandler::UpdateProfileImage() {
user_image_manager->DownloadProfileImage(kProfileDownloadReason);
}
-void ChangePictureHandler::SendOldImage(const std::string& image_url,
- int image_index) {
+void ChangePictureHandler::SendOldImage(std::string&& image_url) {
+ SendOldImageWithIndex(std::move(image_url), -1);
+}
+
+void ChangePictureHandler::SendOldImageWithIndex(std::string&& image_url,
+ int image_index) {
base::DictionaryValue result;
- result.SetString("url", image_url);
- result.SetInteger("index", image_index);
+ result.SetStringPath("url", std::move(image_url));
+ result.SetIntPath("index", image_index);
FireWebUIListener("old-image-changed", result);
}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h
index ab0e18342c0..a3bb95d292e 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CHANGE_PICTURE_HANDLER_H_
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "chrome/browser/chromeos/camera_presence_notifier.h"
#include "chrome/browser/image_decoder.h"
@@ -60,11 +61,14 @@ class ChangePictureHandler : public ::settings::SettingsPageUIHandler,
// if any, on the page. Shouldn't be called before |SendProfileImage|.
void UpdateProfileImage();
+ // Sends the previous user image to the page.
+ void SendOldImage(std::string&& image_url);
+
// Sends the previous user image to the page. Also sends |image_index| which
// is either the index of the previous user image (if it was from an older
// default image set) or -1 otherwise. This allows the WebUI to show credits
// for older default images.
- void SendOldImage(const std::string& image_url, int image_index);
+ void SendOldImageWithIndex(std::string&& image_url, int image_index);
// Starts camera presence check.
void CheckCameraPresence();
@@ -135,9 +139,12 @@ class ChangePictureHandler : public ::settings::SettingsPageUIHandler,
// Data for |user_photo_|.
scoped_refptr<base::RefCountedBytes> user_photo_data_;
- ScopedObserver<user_manager::UserManager, ChangePictureHandler>
- user_manager_observer_;
- ScopedObserver<CameraPresenceNotifier, ChangePictureHandler> camera_observer_;
+ ScopedObserver<user_manager::UserManager, user_manager::UserManager::Observer>
+ user_manager_observer_{this};
+ ScopedObserver<CameraPresenceNotifier, CameraPresenceNotifier::Observer>
+ camera_observer_{this};
+
+ base::WeakPtrFactory<ChangePictureHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ChangePictureHandler);
};
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 c548d8996f3..2a4d10fed51 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
@@ -154,7 +154,7 @@ base::ListValue UsbDevicesToListValue(
const bool shared_in_crostini =
device.vm_sharing_info[crostini::kCrostiniDefaultVmName].shared;
device_info.SetKey("shared", base::Value(shared_in_crostini));
- usb_devices_list.GetList().push_back(std::move(device_info));
+ usb_devices_list.Append(std::move(device_info));
}
return usb_devices_list;
}
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 2f4c1749e9a..ce238a44a78 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
@@ -36,7 +36,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/debug_daemon_client.h"
+#include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
#include "chromeos/printing/ppd_cache.h"
#include "chromeos/printing/ppd_line_reader.h"
#include "chromeos/printing/ppd_provider.h"
@@ -75,8 +75,15 @@ void OnRemovedPrinter(const Printer::PrinterProtocol& protocol, bool success) {
}
// Log if the IPP attributes request was succesful.
-void RecordIppQuerySuccess(bool success) {
- UMA_HISTOGRAM_BOOLEAN("Printing.CUPS.IppAttributesSuccess", success);
+void RecordIppQueryResult(const PrinterQueryResult& result) {
+ bool reachable = (result != PrinterQueryResult::UNREACHABLE);
+ UMA_HISTOGRAM_BOOLEAN("Printing.CUPS.IppDeviceReachable", reachable);
+
+ if (reachable) {
+ // Only record whether the query was successful if we reach the printer.
+ bool query_success = (result == PrinterQueryResult::SUCCESS);
+ UMA_HISTOGRAM_BOOLEAN("Printing.CUPS.IppAttributesSuccess", query_success);
+ }
}
// Returns true if |printer_uri| is an IPP uri.
@@ -116,7 +123,7 @@ base::Value BuildCupsPrintersList(const std::vector<Printer>& printers) {
for (const Printer& printer : printers) {
// Some of these printers could be invalid but we want to allow the user
// to edit them. crbug.com/778383
- printers_list.GetList().push_back(
+ printers_list.Append(
base::Value::FromUniquePtrValue(GetCupsPrinterInfo(printer)));
}
@@ -491,9 +498,9 @@ void CupsPrintersHandler::OnAutoconfQueriedDiscovered(
const std::string& make_and_model,
const std::vector<std::string>& document_formats,
bool ipp_everywhere) {
- const bool success = result == PrinterQueryResult::SUCCESS;
- RecordIppQuerySuccess(success);
+ RecordIppQueryResult(result);
+ const bool success = result == PrinterQueryResult::SUCCESS;
if (success) {
// If we queried a valid make and model, use it. The mDNS record isn't
// guaranteed to have it. However, don't overwrite it if the printer
@@ -537,8 +544,8 @@ void CupsPrintersHandler::OnAutoconfQueried(
const std::string& make_and_model,
const std::vector<std::string>& document_formats,
bool ipp_everywhere) {
+ RecordIppQueryResult(result);
const bool success = result == PrinterQueryResult::SUCCESS;
- RecordIppQuerySuccess(success);
if (result == PrinterQueryResult::UNREACHABLE) {
PRINTER_LOG(DEBUG) << "Could not reach printer";
@@ -966,6 +973,7 @@ void CupsPrintersHandler::VerifyPpdContents(const base::FilePath& path,
void CupsPrintersHandler::HandleStartDiscovery(const base::ListValue* args) {
PRINTER_LOG(DEBUG) << "Start printer discovery";
+ AllowJavascript();
discovery_active_ = true;
OnPrintersChanged(PrinterClass::kAutomatic,
printers_manager_->GetPrinters(PrinterClass::kAutomatic));
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
index c9c52df5e53..e861529292c 100644
--- 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
@@ -12,7 +12,7 @@
#include "chrome/browser/chromeos/printing/printing_stubs.h"
#include "chrome/test/base/testing_profile.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/debug_daemon_client.h"
+#include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_web_ui.h"
#include "testing/gtest/include/gtest/gtest.h"
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 e2de1a94c72..59656e6e848 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
@@ -12,6 +12,7 @@
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/child_accounts/parent_access_code/parent_access_service.h"
#include "chrome/browser/chromeos/set_time_dialog.h"
#include "chrome/browser/chromeos/system/timezone_resolver_manager.h"
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc
index c38687e6415..ee16a539c7b 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc
@@ -16,7 +16,6 @@
#include "services/service_manager/public/cpp/connector.h"
#include "ui/chromeos/events/event_rewriter_chromeos.h"
#include "ui/chromeos/events/keyboard_layout_util.h"
-#include "ui/events/devices/device_data_manager.h"
namespace {
@@ -59,8 +58,7 @@ void KeyboardHandler::TestAPI::Initialize() {
handler_->HandleInitialize(&args);
}
-KeyboardHandler::KeyboardHandler() : observer_(this) {}
-
+KeyboardHandler::KeyboardHandler() = default;
KeyboardHandler::~KeyboardHandler() = default;
void KeyboardHandler::RegisterMessages() {
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h
index 89e70bb56cf..ee6c480adc5 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h
@@ -8,16 +8,13 @@
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
+#include "ui/events/devices/device_data_manager.h"
#include "ui/events/devices/input_device_event_observer.h"
namespace base {
class ListValue;
}
-namespace ui {
-class DeviceDataManager;
-}
-
namespace chromeos {
namespace settings {
@@ -71,7 +68,8 @@ class KeyboardHandler
// Sends the UI a message about whether hardware keyboard are attached.
void UpdateKeyboards();
- ScopedObserver<ui::DeviceDataManager, KeyboardHandler> observer_;
+ ScopedObserver<ui::DeviceDataManager, ui::InputDeviceEventObserver> observer_{
+ this};
DISALLOW_COPY_AND_ASSIGN(KeyboardHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc
index 79feea807e9..1906a330cd5 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc
@@ -109,8 +109,7 @@ void PowerHandler::TestAPI::SetLidClosedBehavior(
handler_->HandleSetLidClosedBehavior(&args);
}
-PowerHandler::PowerHandler(PrefService* prefs)
- : prefs_(prefs), power_manager_client_observer_(this) {}
+PowerHandler::PowerHandler(PrefService* prefs) : prefs_(prefs) {}
PowerHandler::~PowerHandler() {}
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 a362dcd45be..d55a3944bd5 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
@@ -114,8 +114,8 @@ class PowerHandler : public ::settings::SettingsPageUIHandler,
// Used to watch power management prefs for changes so the UI can be notified.
std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
- ScopedObserver<PowerManagerClient, PowerHandler>
- power_manager_client_observer_;
+ ScopedObserver<PowerManagerClient, PowerManagerClient::Observer>
+ power_manager_client_observer_{this};
// Last lid state received from powerd.
PowerManagerClient::LidState lid_state_ = PowerManagerClient::LidState::OPEN;
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 b9737dc9919..0eebb3c1814 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
@@ -25,6 +25,7 @@
#include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
#include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
+#include "chrome/browser/chromeos/crostini/crostini_features.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
@@ -42,7 +43,6 @@
#include "components/arc/arc_util.h"
#include "components/arc/session/arc_bridge_service.h"
#include "components/browsing_data/content/conditional_cache_counting_helper.h"
-#include "components/drive/chromeos/file_system_interface.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
@@ -85,7 +85,6 @@ StorageHandler::StorageHandler(Profile* profile,
browser_site_data_size_(-1),
has_browser_site_data_size_(false),
updating_downloads_size_(false),
- updating_drive_cache_size_(false),
updating_browsing_data_size_(false),
updating_android_size_(false),
updating_crostini_size_(false),
@@ -128,10 +127,6 @@ void StorageHandler::RegisterMessages() {
base::BindRepeating(&StorageHandler::HandleOpenArcStorage,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
- "clearDriveCache",
- base::BindRepeating(&StorageHandler::HandleClearDriveCache,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
"updateExternalStorages",
base::BindRepeating(&StorageHandler::HandleUpdateExternalStorages,
base::Unretained(this)));
@@ -183,7 +178,6 @@ void StorageHandler::HandleUpdateStorageInfo(const base::ListValue* args) {
UpdateSizeStat();
UpdateDownloadsSize();
- UpdateDriveCacheSize();
UpdateBrowsingDataSize();
UpdateAndroidRunning();
UpdateAndroidSize();
@@ -207,25 +201,11 @@ void StorageHandler::HandleOpenArcStorage(
arc_storage_manager->OpenPrivateVolumeSettings();
}
-void StorageHandler::HandleClearDriveCache(
- const base::ListValue* unused_args) {
- drive::FileSystemInterface* const file_system =
- drive::util::GetFileSystemByProfile(profile_);
- file_system->FreeDiskSpaceIfNeededFor(
- std::numeric_limits<int64_t>::max(), // Removes as much as possible.
- base::Bind(&StorageHandler::OnClearDriveCacheDone,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
void StorageHandler::HandleUpdateExternalStorages(
const base::ListValue* unused_args) {
UpdateExternalStorages();
}
-void StorageHandler::OnClearDriveCacheDone(bool /*success*/) {
- UpdateDriveCacheSize();
-}
-
void StorageHandler::UpdateSizeStat() {
const base::FilePath downloads_path =
file_manager::util::GetDownloadsFolderForProfile(profile_);
@@ -282,28 +262,6 @@ void StorageHandler::OnGetDownloadsSize(int64_t size) {
base::Value(ui::FormatBytes(size)));
}
-void StorageHandler::UpdateDriveCacheSize() {
- drive::FileSystemInterface* const file_system =
- drive::util::GetFileSystemByProfile(profile_);
- if (!file_system)
- return;
-
- if (updating_drive_cache_size_)
- return;
- updating_drive_cache_size_ = true;
-
- // Shows the item "Offline cache" and starts calculating size.
- FireWebUIListener("storage-drive-enabled-changed", base::Value(true));
- file_system->CalculateCacheSize(base::Bind(
- &StorageHandler::OnGetDriveCacheSize, weak_ptr_factory_.GetWeakPtr()));
-}
-
-void StorageHandler::OnGetDriveCacheSize(int64_t size) {
- updating_drive_cache_size_ = false;
- FireWebUIListener("storage-drive-cache-size-changed",
- base::Value(ui::FormatBytes(size)), base::Value(size > 0));
-}
-
void StorageHandler::UpdateBrowsingDataSize() {
if (updating_browsing_data_size_)
return;
@@ -410,7 +368,7 @@ void StorageHandler::OnGetAndroidSize(bool succeeded,
}
void StorageHandler::UpdateCrostiniSize() {
- if (!crostini::IsCrostiniEnabled(profile_)) {
+ if (!crostini::CrostiniFeatures::Get()->IsEnabled(profile_)) {
return;
}
@@ -500,7 +458,7 @@ void StorageHandler::UpdateExternalStorages() {
base::Value device(base::Value::Type::DICTIONARY);
device.SetKey("uuid", base::Value(disk->fs_uuid()));
device.SetKey("label", base::Value(label));
- devices.GetList().push_back(std::move(device));
+ devices.Append(std::move(device));
}
FireWebUIListener("onExternalStoragesUpdated", devices);
}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h
index 32078b3aa56..4c901c9913a 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h
@@ -16,7 +16,7 @@
#include "base/optional.h"
#include "base/scoped_observer.h"
#include "chrome/browser/browsing_data/site_data_size_collector.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
+#include "chrome/browser/chromeos/arc/session/arc_session_manager.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "chromeos/dbus/cryptohome/rpc.pb.h"
#include "chromeos/disks/disk_mount_manager.h"
@@ -80,12 +80,8 @@ class StorageHandler
void HandleUpdateStorageInfo(const base::ListValue* unused_args);
void HandleOpenDownloads(const base::ListValue* unused_args);
void HandleOpenArcStorage(const base::ListValue* unused_args);
- void HandleClearDriveCache(const base::ListValue* unused_args);
void HandleUpdateExternalStorages(const base::ListValue* unused_args);
- // Callback called when clearing Drive cache is done.
- void OnClearDriveCacheDone(bool success);
-
// Requests updating disk space information.
void UpdateSizeStat();
@@ -98,12 +94,6 @@ class StorageHandler
// Callback to update the UI about the size of Downloads directory.
void OnGetDownloadsSize(int64_t size);
- // Requests updating the size of Drive Cache.
- void UpdateDriveCacheSize();
-
- // Callback to update the UI about the size of Drive Cache.
- void OnGetDriveCacheSize(int64_t size);
-
// Requests updating the size of browsing data.
void UpdateBrowsingDataSize();
@@ -166,7 +156,6 @@ class StorageHandler
// Flags indicating fetch operations for storage sizes are ongoing.
bool updating_downloads_size_;
- bool updating_drive_cache_size_;
bool updating_browsing_data_size_;
bool updating_android_size_;
bool updating_crostini_size_;
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.cc
index 202fcf856f8..ad7f2ee26ba 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.cc
@@ -14,7 +14,6 @@
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
-#include "ui/events/devices/device_data_manager.h"
namespace chromeos {
namespace settings {
@@ -29,8 +28,7 @@ constexpr char kAppLockScreenSupportKey[] = "lockScreenSupport";
} // namespace
-StylusHandler::StylusHandler() : note_observer_(this), input_observer_(this) {}
-
+StylusHandler::StylusHandler() = default;
StylusHandler::~StylusHandler() = default;
void StylusHandler::RegisterMessages() {
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.h
index a1be49b471f..c0e2429de10 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.h
@@ -12,16 +12,13 @@
#include "base/scoped_observer.h"
#include "chrome/browser/chromeos/note_taking_helper.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
+#include "ui/events/devices/device_data_manager.h"
#include "ui/events/devices/input_device_event_observer.h"
namespace base {
class ListValue;
}
-namespace ui {
-class DeviceDataManager;
-}
-
namespace chromeos {
namespace settings {
@@ -63,9 +60,10 @@ class StylusHandler : public ::settings::SettingsPageUIHandler,
std::set<std::string> note_taking_app_ids_;
// Observer registration.
- ScopedObserver<NoteTakingHelper, NoteTakingHelper::Observer> note_observer_;
+ ScopedObserver<NoteTakingHelper, NoteTakingHelper::Observer> note_observer_{
+ this};
ScopedObserver<ui::DeviceDataManager, ui::InputDeviceEventObserver>
- input_observer_;
+ input_observer_{this};
DISALLOW_COPY_AND_ASSIGN(StylusHandler);
};
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 577dc77a406..601eeaf2435 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.cc
@@ -20,7 +20,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
-#include "components/session_manager/core/session_manager.h"
#include "content/public/browser/system_connector.h"
#include "services/device/public/mojom/constants.mojom.h"
#include "services/service_manager/public/cpp/connector.h"
@@ -57,10 +56,9 @@ std::unique_ptr<base::DictionaryValue> GetFingerprintsInfo(
} // namespace
-FingerprintHandler::FingerprintHandler(Profile* profile)
- : profile_(profile), binding_(this), session_observer_(this) {
- content::GetSystemConnector()->BindInterface(device::mojom::kServiceName,
- &fp_service_);
+FingerprintHandler::FingerprintHandler(Profile* profile) : profile_(profile) {
+ content::GetSystemConnector()->Connect(
+ device::mojom::kServiceName, fp_service_.BindNewPipeAndPassReceiver());
user_id_ = ProfileHelper::Get()->GetUserIdHashFromProfile(profile);
}
@@ -111,14 +109,12 @@ void FingerprintHandler::OnJavascriptAllowed() {
if (SessionManager::Get())
session_observer_.Add(SessionManager::Get());
- device::mojom::FingerprintObserverPtr observer;
- binding_.Bind(mojo::MakeRequest(&observer));
- fp_service_->AddFingerprintObserver(std::move(observer));
+ fp_service_->AddFingerprintObserver(receiver_.BindNewPipeAndPassRemote());
}
void FingerprintHandler::OnJavascriptDisallowed() {
session_observer_.RemoveAll();
- binding_.Close();
+ receiver_.reset();
}
void FingerprintHandler::OnRestarted() {}
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h
index 766d8842ee6..97c85fd65d9 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h
@@ -8,8 +8,10 @@
#include "base/containers/flat_map.h"
#include "base/scoped_observer.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
+#include "components/session_manager/core/session_manager.h"
#include "components/session_manager/core/session_manager_observer.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/mojom/fingerprint.mojom.h"
class Profile;
@@ -18,10 +20,6 @@ namespace base {
class ListValue;
} // namespace base
-namespace session_manager {
-class SessionManager;
-} // namespace session_manager
-
namespace chromeos {
namespace settings {
@@ -79,11 +77,11 @@ class FingerprintHandler : public ::settings::SettingsPageUIHandler,
std::vector<std::string> fingerprints_paths_;
std::string user_id_;
- device::mojom::FingerprintPtr fp_service_;
- mojo::Binding<device::mojom::FingerprintObserver> binding_;
+ mojo::Remote<device::mojom::Fingerprint> fp_service_;
+ mojo::Receiver<device::mojom::FingerprintObserver> receiver_{this};
ScopedObserver<session_manager::SessionManager,
session_manager::SessionManagerObserver>
- session_observer_;
+ session_observer_{this};
base::WeakPtrFactory<FingerprintHandler> weak_ptr_factory_{this};
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 883457370ee..e75796ecd32 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/internet_handler.cc
@@ -213,7 +213,7 @@ void InternetHandler::SendGmsCoreNotificationsDisabledDeviceNames() {
base::ListValue device_names_value;
for (const auto& device_name : device_names_without_notifications_)
- device_names_value.GetList().push_back(device_name->Clone());
+ device_names_value.Append(device_name->Clone());
FireWebUIListener(kSendGmsCoreNotificationsDisabledDeviceNames,
device_names_value);
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc
index d6125af737b..f249f72f2ad 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.cc
@@ -21,9 +21,7 @@
namespace chromeos {
namespace settings {
-KerberosAccountsHandler::KerberosAccountsHandler()
- : credentials_manager_observer_(this) {}
-
+KerberosAccountsHandler::KerberosAccountsHandler() = default;
KerberosAccountsHandler::~KerberosAccountsHandler() = default;
void KerberosAccountsHandler::RegisterMessages() {
@@ -105,7 +103,7 @@ void KerberosAccountsHandler::OnListAccounts(
account_dict.SetBoolean("passwordWasRemembered",
account.password_was_remembered());
account_dict.SetString("pic", ticket_icon);
- accounts.GetList().push_back(std::move(account_dict));
+ accounts.Append(std::move(account_dict));
}
ResolveJavascriptCallback(base::Value(callback_id), std::move(accounts));
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h b/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h
index 296cf45bb46..00dfa0cf7bc 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/kerberos_accounts_handler.h
@@ -77,7 +77,7 @@ class KerberosAccountsHandler : public ::settings::SettingsPageUIHandler,
// This class keeps track of that and removes this instance on destruction.
ScopedObserver<KerberosCredentialsManager,
KerberosCredentialsManager::Observer>
- credentials_manager_observer_;
+ credentials_manager_observer_{this};
base::WeakPtrFactory<KerberosAccountsHandler> weak_factory_{this};
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
index a0fd1fe87ff..ca0d04c1df6 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc
@@ -16,6 +16,7 @@
#include "base/bind.h"
#include "base/feature_list.h"
#include "build/build_config.h"
+#include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h"
#include "chrome/browser/ui/webui/app_management/app_management.mojom.h"
#include "chrome/browser/ui/webui/app_management/app_management_page_handler.h"
#include "chrome/browser/ui/webui/managed_ui_handler.h"
@@ -28,6 +29,7 @@
#include "chrome/browser/ui/webui/settings/chromeos/wallpaper_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/people_handler.h"
#include "chrome/browser/ui/webui/settings/profile_info_handler.h"
@@ -49,6 +51,7 @@
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/unified_consent/feature.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
namespace chromeos {
namespace settings {
@@ -84,6 +87,7 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
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::LanguagesHandler>(web_ui));
AddSettingsPageUIHandler(
@@ -102,8 +106,8 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
html_source->AddBoolean("unifiedConsentEnabled",
unified_consent::IsUnifiedConsentFeatureEnabled());
- html_source->AddBoolean(
- "showApps", base::FeatureList::IsEnabled(features::kAppManagement));
+ html_source->AddBoolean("showAppManagement", base::FeatureList::IsEnabled(
+ features::kAppManagement));
#if defined(OS_CHROMEOS)
html_source->AddBoolean(
@@ -124,7 +128,8 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
if (web_app::SystemWebAppManager::IsEnabled()) {
html_source->AddResourcePath("icon-192.png", IDR_SETTINGS_LOGO_192);
html_source->AddResourcePath("pwa.html", IDR_PWA_HTML);
- html_source->AddResourcePath("manifest.json", IDR_OS_SETTINGS_MANIFEST);
+ web_app::SetManifestRequestFilter(html_source, IDR_OS_SETTINGS_MANIFEST,
+ IDS_SETTINGS_SETTINGS);
}
#if BUILDFLAG(OPTIMIZE_WEBUI)
@@ -154,7 +159,8 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
html_source->AddResourcePath("app-management/image_info.mojom-lite.js",
IDR_APP_MANAGEMENT_IMAGE_INFO_MOJO_LITE_JS);
- ::settings::AddLocalizedStrings(html_source, profile);
+ ::settings::AddLocalizedStrings(html_source, profile,
+ web_ui->GetWebContents());
auto plural_string_handler = std::make_unique<PluralStringHandler>();
plural_string_handler->AddLocalizedString("profileLabel",
@@ -183,18 +189,18 @@ void OSSettingsUI::AddSettingsPageUIHandler(
}
void OSSettingsUI::BindCrosNetworkConfig(
- network_config::mojom::CrosNetworkConfigRequest request) {
- ash::GetNetworkConfigService(std::move(request));
+ mojo::PendingReceiver<network_config::mojom::CrosNetworkConfig> receiver) {
+ ash::GetNetworkConfigService(std::move(receiver));
}
void OSSettingsUI::BindAppManagementPageHandlerFactory(
- app_management::mojom::PageHandlerFactoryRequest request) {
+ mojo::PendingReceiver<app_management::mojom::PageHandlerFactory> receiver) {
if (!app_management_page_handler_factory_) {
app_management_page_handler_factory_ =
std::make_unique<AppManagementPageHandlerFactory>(
Profile::FromWebUI(web_ui()));
}
- app_management_page_handler_factory_->Bind(std::move(request));
+ app_management_page_handler_factory_->Bind(std::move(receiver));
}
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h
index 63131cfb6f6..ff325c20bc3 100644
--- a/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h
+++ b/chromium/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.h
@@ -12,6 +12,7 @@
#include "chrome/browser/ui/webui/settings/chromeos/app_management/app_management_page_handler_factory.h"
#include "chrome/browser/ui/webui/webui_load_timer.h"
#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
namespace content {
@@ -31,9 +32,10 @@ class OSSettingsUI : public ui::MojoWebUIController {
void AddSettingsPageUIHandler(
std::unique_ptr<content::WebUIMessageHandler> handler);
void BindCrosNetworkConfig(
- network_config::mojom::CrosNetworkConfigRequest request);
+ mojo::PendingReceiver<network_config::mojom::CrosNetworkConfig> receiver);
void BindAppManagementPageHandlerFactory(
- app_management::mojom::PageHandlerFactoryRequest request);
+ mojo::PendingReceiver<app_management::mojom::PageHandlerFactory>
+ receiver);
WebuiLoadTimer webui_load_timer_;
diff --git a/chromium/chrome/browser/ui/webui/settings/font_handler.cc b/chromium/chrome/browser/ui/webui/settings/font_handler.cc
index 2c25ebed0da..062eb45fb0f 100644
--- a/chromium/chrome/browser/ui/webui/settings/font_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/font_handler.cc
@@ -21,7 +21,6 @@
#include "components/prefs/pref_service.h"
#include "content/public/browser/font_list_async.h"
#include "content/public/browser/web_ui.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_urls.h"
@@ -39,7 +38,7 @@ const char kAdvancedFontSettingsExtensionId[] =
namespace settings {
FontHandler::FontHandler(content::WebUI* webui)
- : extension_registry_observer_(this), profile_(Profile::FromWebUI(webui)) {
+ : profile_(Profile::FromWebUI(webui)) {
#if defined(OS_MACOSX)
// Perform validation for saved fonts.
settings_utils::ValidateSavedFonts(profile_->GetPrefs());
@@ -103,7 +102,9 @@ const extensions::Extension* FontHandler::GetAdvancedFontSettingsExtension() {
extensions::ExtensionSystem::Get(profile_)->extension_service();
if (!service->IsExtensionEnabled(kAdvancedFontSettingsExtensionId))
return nullptr;
- return service->GetInstalledExtension(kAdvancedFontSettingsExtensionId);
+ extensions::ExtensionRegistry* registry =
+ extensions::ExtensionRegistry::Get(profile_);
+ return registry->GetInstalledExtension(kAdvancedFontSettingsExtensionId);
}
void FontHandler::NotifyAdvancedFontSettingsAvailability() {
diff --git a/chromium/chrome/browser/ui/webui/settings/font_handler.h b/chromium/chrome/browser/ui/webui/settings/font_handler.h
index f88659d654a..3c0a284ca9e 100644
--- a/chromium/chrome/browser/ui/webui/settings/font_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/font_handler.h
@@ -12,6 +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 "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
namespace base {
@@ -24,7 +25,6 @@ class WebUI;
namespace extensions {
class Extension;
-class ExtensionRegistry;
}
class Profile;
@@ -71,7 +71,7 @@ class FontHandler : public SettingsPageUIHandler,
ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver>
- extension_registry_observer_;
+ extension_registry_observer_{this};
Profile* profile_; // Weak pointer.
diff --git a/chromium/chrome/browser/ui/webui/settings/incompatible_applications_handler_win.cc b/chromium/chrome/browser/ui/webui/settings/incompatible_applications_handler_win.cc
index 79d5c9c5078..d5e0e06c6ca 100644
--- a/chromium/chrome/browser/ui/webui/settings/incompatible_applications_handler_win.cc
+++ b/chromium/chrome/browser/ui/webui/settings/incompatible_applications_handler_win.cc
@@ -106,7 +106,7 @@ void IncompatibleApplicationsHandler::HandleRequestIncompatibleApplicationsList(
base::Value(application.blacklist_action->message_type()));
dict.SetKey("url",
base::Value(application.blacklist_action->message_url()));
- application_list.GetList().push_back(std::move(dict));
+ application_list.Append(std::move(dict));
}
UMA_HISTOGRAM_COUNTS_100("IncompatibleApplicationsPage.NumApplications",
diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler.cc b/chromium/chrome/browser/ui/webui/settings/people_handler.cc
index 5d7331dbf92..3ec355f0bd3 100644
--- a/chromium/chrome/browser/ui/webui/settings/people_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/people_handler.cc
@@ -44,7 +44,6 @@
#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"
#include "components/unified_consent/feature.h"
@@ -204,24 +203,23 @@ 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:
+ case syncer::PassphraseType::kFrozenImplicitPassphrase:
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:
+ case syncer::PassphraseType::kCustomPassphrase:
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::TRUSTED_VAULT_PASSPHRASE:
- case syncer::PassphraseType::PASSPHRASE_TYPE_SIZE:
+ case syncer::PassphraseType::kImplicitPassphrase:
+ case syncer::PassphraseType::kKeystorePassphrase:
+ case syncer::PassphraseType::kTrustedVaultPassphrase:
break;
}
NOTREACHED();
@@ -235,16 +233,15 @@ base::string16 GetFullEncryptionBody(syncer::PassphraseType passphrase_type,
return GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM);
}
switch (passphrase_type) {
- case syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE:
+ case syncer::PassphraseType::kFrozenImplicitPassphrase:
return GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_GOOGLE_WITH_DATE,
base::TimeFormatShortDate(passphrase_time));
- case syncer::PassphraseType::CUSTOM_PASSPHRASE:
+ case syncer::PassphraseType::kCustomPassphrase:
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::TRUSTED_VAULT_PASSPHRASE:
- case syncer::PassphraseType::PASSPHRASE_TYPE_SIZE:
+ case syncer::PassphraseType::kImplicitPassphrase:
+ case syncer::PassphraseType::kKeystorePassphrase:
+ case syncer::PassphraseType::kTrustedVaultPassphrase:
break;
}
NOTREACHED();
@@ -263,11 +260,7 @@ const char PeopleHandler::kDonePageStatus[] = "done";
const char PeopleHandler::kPassphraseFailedPageStatus[] = "passphraseFailed";
PeopleHandler::PeopleHandler(Profile* profile)
- : profile_(profile),
- configuring_sync_(false),
- identity_manager_observer_(this),
- sync_service_observer_(this) {
-}
+ : profile_(profile), configuring_sync_(false) {}
PeopleHandler::~PeopleHandler() {
// Early exit if running unit tests (no actual WebUI is attached).
@@ -626,8 +619,8 @@ void PeopleHandler::HandleSetEncryption(const base::ListValue* args) {
bool passphrase_failed = false;
if (!configuration.passphrase.empty()) {
// We call IsPassphraseRequired() here (instead of
- // IsPassphraseRequiredForDecryption()) because the user may try to enter
- // a passphrase even though no encrypted data types are enabled.
+ // IsPassphraseRequiredForPreferredDataTypes()) because the user may try to
+ // enter a passphrase even though no encrypted data types are enabled.
if (service->GetUserSettings()->IsPassphraseRequired()) {
// If we have pending keys, try to decrypt them with the provided
// passphrase. We track if this succeeds or fails because a failed
@@ -649,7 +642,7 @@ void PeopleHandler::HandleSetEncryption(const base::ListValue* args) {
}
if (passphrase_failed ||
- service->GetUserSettings()->IsPassphraseRequiredForDecryption()) {
+ service->GetUserSettings()->IsPassphraseRequiredForPreferredDataTypes()) {
// If the user doesn't enter any passphrase, we won't call
// SetDecryptionPassphrase() (passphrase_failed == false), but we still
// want to display an error message to let the user know that their blank
@@ -1104,8 +1097,8 @@ void PeopleHandler::PushSyncPrefs() {
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.
+ // IsPassphraseRequiredForPreferredDataTypes(), because we want to show the
+ // passphrase UI even if no encrypted data types are enabled.
args.SetBoolean("passphraseRequired",
sync_user_settings->IsPassphraseRequired());
@@ -1156,7 +1149,8 @@ void PeopleHandler::MarkFirstSetupComplete() {
// We're done configuring, so notify SyncService that it is OK to start
// syncing.
- service->GetUserSettings()->SetFirstSetupComplete();
+ service->GetUserSettings()->SetFirstSetupComplete(
+ syncer::SyncFirstSetupCompleteSource::ADVANCED_FLOW_CONFIRM);
FireWebUIListener("sync-settings-saved");
}
diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler.h b/chromium/chrome/browser/ui/webui/settings/people_handler.h
index 51e9195e619..e60362bf93b 100644
--- a/chromium/chrome/browser/ui/webui/settings/people_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/people_handler.h
@@ -22,6 +22,7 @@
#include "components/prefs/pref_change_registrar.h"
#include "components/signin/public/base/signin_buildflags.h"
#include "components/signin/public/identity_manager/identity_manager.h"
+#include "components/sync/driver/sync_service.h"
#include "components/sync/driver/sync_service_observer.h"
#include "content/public/browser/web_contents_observer.h"
@@ -36,7 +37,6 @@ enum class AccessPoint;
} // namespace signin_metrics
namespace syncer {
-class SyncService;
class SyncSetupInProgressHandle;
} // namespace syncer
@@ -262,9 +262,10 @@ class PeopleHandler : public SettingsPageUIHandler,
PrefChangeRegistrar profile_pref_registrar_;
// Manages observer lifetimes.
- ScopedObserver<signin::IdentityManager, PeopleHandler>
- identity_manager_observer_;
- ScopedObserver<syncer::SyncService, PeopleHandler> sync_service_observer_;
+ ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
+ identity_manager_observer_{this};
+ ScopedObserver<syncer::SyncService, syncer::SyncServiceObserver>
+ sync_service_observer_{this};
#if defined(OS_CHROMEOS)
base::WeakPtrFactory<PeopleHandler> weak_factory_{this};
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 1a327ed2a6f..833ac7b4d4a 100644
--- a/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc
@@ -240,7 +240,7 @@ class PeopleHandlerTest : public ChromeRenderViewHostTestHarness {
.WillByDefault(Return(true));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), GetPassphraseType())
- .WillByDefault(Return(syncer::PassphraseType::IMPLICIT_PASSPHRASE));
+ .WillByDefault(Return(syncer::PassphraseType::kImplicitPassphrase));
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
GetExplicitPassphraseTime())
.WillByDefault(Return(base::Time()));
@@ -816,7 +816,7 @@ TEST_F(PeopleHandlerTest, TestSyncEverything) {
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
- IsPassphraseRequiredForDecryption())
+ IsPassphraseRequiredForPreferredDataTypes())
.WillByDefault(Return(false));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
@@ -835,7 +835,7 @@ TEST_F(PeopleHandlerTest, TestPassphraseStillRequired) {
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
- IsPassphraseRequiredForDecryption())
+ IsPassphraseRequiredForPreferredDataTypes())
.WillByDefault(Return(true));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
@@ -864,7 +864,7 @@ TEST_F(PeopleHandlerTest, EnterExistingFrozenImplicitPassword) {
IsPassphraseRequired())
.WillOnce(Return(true));
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
- IsPassphraseRequiredForDecryption())
+ IsPassphraseRequiredForPreferredDataTypes())
.WillByDefault(Return(false));
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsUsingSecondaryPassphrase())
@@ -890,7 +890,7 @@ TEST_F(PeopleHandlerTest, SetNewCustomPassphrase) {
IsEncryptEverythingAllowed())
.WillByDefault(Return(true));
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
- IsPassphraseRequiredForDecryption())
+ IsPassphraseRequiredForPreferredDataTypes())
.WillByDefault(Return(false));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
@@ -914,7 +914,7 @@ TEST_F(PeopleHandlerTest, EnterWrongExistingPassphrase) {
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
- IsPassphraseRequiredForDecryption())
+ IsPassphraseRequiredForPreferredDataTypes())
.WillByDefault(Return(true));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
@@ -945,7 +945,7 @@ TEST_F(PeopleHandlerTest, EnterBlankExistingPassphrase) {
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
- IsPassphraseRequiredForDecryption())
+ IsPassphraseRequiredForPreferredDataTypes())
.WillByDefault(Return(true));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
@@ -976,7 +976,7 @@ TEST_F(PeopleHandlerTest, TestSyncIndividualTypes) {
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
- IsPassphraseRequiredForDecryption())
+ IsPassphraseRequiredForPreferredDataTypes())
.WillByDefault(Return(false));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
@@ -1001,7 +1001,7 @@ TEST_F(PeopleHandlerTest, TestSyncAllManually) {
list_args.AppendString(kTestCallbackId);
list_args.AppendString(args);
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
- IsPassphraseRequiredForDecryption())
+ IsPassphraseRequiredForPreferredDataTypes())
.WillByDefault(Return(false));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
@@ -1171,8 +1171,7 @@ TEST_F(PeopleHandlerTest, ShowSetupOldGaiaPassphraseRequired) {
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), GetPassphraseType())
- .WillByDefault(
- Return(syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE));
+ .WillByDefault(Return(syncer::PassphraseType::kFrozenImplicitPassphrase));
SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
@@ -1188,7 +1187,7 @@ TEST_F(PeopleHandlerTest, ShowSetupCustomPassphraseRequired) {
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(true));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), GetPassphraseType())
- .WillByDefault(Return(syncer::PassphraseType::CUSTOM_PASSPHRASE));
+ .WillByDefault(Return(syncer::PassphraseType::kCustomPassphrase));
SetupInitializedSyncService();
SetDefaultExpectationsForConfigPage();
@@ -1241,7 +1240,7 @@ TEST_F(PeopleHandlerTest, ShowSetupEncryptAllDisallowed) {
TEST_F(PeopleHandlerTest, TurnOnEncryptAllDisallowed) {
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
- IsPassphraseRequiredForDecryption())
+ IsPassphraseRequiredForPreferredDataTypes())
.WillByDefault(Return(false));
ON_CALL(*mock_sync_service_->GetMockUserSettings(), IsPassphraseRequired())
.WillByDefault(Return(false));
@@ -1309,8 +1308,9 @@ TEST_F(PeopleHandlerTest, DashboardClearWhileSettingsOpen_ConfirmSoon) {
NotifySyncStateChanged();
});
EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
- SetFirstSetupComplete())
- .WillOnce([&]() {
+ SetFirstSetupComplete(
+ syncer::SyncFirstSetupCompleteSource::ADVANCED_FLOW_CONFIRM))
+ .WillOnce([&](syncer::SyncFirstSetupCompleteSource) {
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsFirstSetupComplete())
.WillByDefault(Return(true));
@@ -1318,7 +1318,7 @@ TEST_F(PeopleHandlerTest, DashboardClearWhileSettingsOpen_ConfirmSoon) {
});
base::ListValue did_abort;
- did_abort.GetList().push_back(base::Value(false));
+ did_abort.Append(base::Value(false));
handler_->OnDidClosePage(&did_abort);
}
@@ -1374,9 +1374,11 @@ TEST_F(PeopleHandlerTest, DashboardClearWhileSettingsOpen_ConfirmLater) {
NotifySyncStateChanged();
});
if (!browser_defaults::kSyncAutoStarts) {
- EXPECT_CALL(*mock_sync_service_->GetMockUserSettings(),
- SetFirstSetupComplete())
- .WillOnce([&]() {
+ EXPECT_CALL(
+ *mock_sync_service_->GetMockUserSettings(),
+ SetFirstSetupComplete(
+ syncer::SyncFirstSetupCompleteSource::ADVANCED_FLOW_CONFIRM))
+ .WillOnce([&](syncer::SyncFirstSetupCompleteSource) {
ON_CALL(*mock_sync_service_->GetMockUserSettings(),
IsFirstSetupComplete())
.WillByDefault(Return(true));
@@ -1385,7 +1387,7 @@ TEST_F(PeopleHandlerTest, DashboardClearWhileSettingsOpen_ConfirmLater) {
}
base::ListValue did_abort;
- did_abort.GetList().push_back(base::Value(false));
+ did_abort.Append(base::Value(false));
handler_->OnDidClosePage(&did_abort);
}
@@ -1438,7 +1440,7 @@ TEST_P(PeopleHandlerDiceUnifiedConsentTest, StoredAccountsList) {
base::Value accounts = handler.GetStoredAccountsList();
ASSERT_TRUE(accounts.is_list());
- const base::Value::ListStorage& accounts_list = accounts.GetList();
+ base::span<const base::Value> accounts_list = accounts.GetList();
if (dice_enabled) {
ASSERT_EQ(2u, accounts_list.size());
diff --git a/chromium/chrome/browser/ui/webui/settings/profile_info_handler.cc b/chromium/chrome/browser/ui/webui/settings/profile_info_handler.cc
index f99ba773f67..6e0af7ba4fa 100644
--- a/chromium/chrome/browser/ui/webui/settings/profile_info_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/profile_info_handler.cc
@@ -35,12 +35,7 @@ const char ProfileInfoHandler::kProfileInfoChangedEventName[] =
const char ProfileInfoHandler::kProfileStatsCountReadyEventName[] =
"profile-stats-count-ready";
-ProfileInfoHandler::ProfileInfoHandler(Profile* profile)
- : profile_(profile),
-#if defined(OS_CHROMEOS)
- user_manager_observer_(this),
-#endif
- profile_observer_(this) {
+ProfileInfoHandler::ProfileInfoHandler(Profile* profile) : profile_(profile) {
#if defined(OS_CHROMEOS)
// Set up the chrome://userimage/ source.
content::URLDataSource::Add(profile,
@@ -157,7 +152,10 @@ ProfileInfoHandler::GetAccountNameAndIcon() const {
if (g_browser_process->profile_manager()
->GetProfileAttributesStorage()
.GetProfileAttributesWithPath(profile_->GetPath(), &entry)) {
- name = base::UTF16ToUTF8(entry->GetName());
+ name = base::UTF16ToUTF8(
+ ProfileAttributesEntry::ShouldConcatenateGaiaAndProfileName()
+ ? entry->GetLocalProfileName()
+ : entry->GetName());
// TODO(crbug.com/710660): return chrome://theme/IDR_PROFILE_AVATAR_*
// and update theme_source.cc to get high res avatar icons. This does less
// work here, sends less over IPC, and is more stable with returned results.
diff --git a/chromium/chrome/browser/ui/webui/settings/profile_info_handler.h b/chromium/chrome/browser/ui/webui/settings/profile_info_handler.h
index 1c40211b89a..354c27d54eb 100644
--- a/chromium/chrome/browser/ui/webui/settings/profile_info_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/profile_info_handler.h
@@ -74,12 +74,12 @@ class ProfileInfoHandler : public SettingsPageUIHandler,
Profile* profile_;
#if defined(OS_CHROMEOS)
- ScopedObserver<user_manager::UserManager, ProfileInfoHandler>
- user_manager_observer_;
+ ScopedObserver<user_manager::UserManager, user_manager::UserManager::Observer>
+ user_manager_observer_{this};
#endif
- ScopedObserver<ProfileAttributesStorage, ProfileInfoHandler>
- profile_observer_;
+ ScopedObserver<ProfileAttributesStorage, ProfileAttributesStorage::Observer>
+ profile_observer_{this};
// Used to cancel callbacks when JavaScript becomes disallowed.
base::WeakPtrFactory<ProfileInfoHandler> callback_weak_ptr_factory_{this};
diff --git a/chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc b/chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc
index 37eab4887a8..6f0374d327b 100644
--- a/chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/search_engines_handler.cc
@@ -108,8 +108,7 @@ SearchEnginesHandler::GetSearchEnginesList() {
list_controller_.table_model()->IndexOfTemplateURL(default_engine);
// Build the first list (default search engines).
- std::unique_ptr<base::ListValue> defaults =
- std::make_unique<base::ListValue>();
+ auto defaults = std::make_unique<base::ListValue>();
int last_default_engine_index =
list_controller_.table_model()->last_search_engine_index();
@@ -122,7 +121,7 @@ SearchEnginesHandler::GetSearchEnginesList() {
}
// Build the second list (other search engines).
- std::unique_ptr<base::ListValue> others = std::make_unique<base::ListValue>();
+ auto others = std::make_unique<base::ListValue>();
int last_other_engine_index =
list_controller_.table_model()->last_other_engine_index();
@@ -135,8 +134,7 @@ SearchEnginesHandler::GetSearchEnginesList() {
}
// Build the third list (omnibox extensions).
- std::unique_ptr<base::ListValue> extensions =
- std::make_unique<base::ListValue>();
+ auto extensions = std::make_unique<base::ListValue>();
int engine_count = list_controller_.table_model()->RowCount();
// Sanity check for https://crbug.com/781703.
@@ -146,8 +144,7 @@ SearchEnginesHandler::GetSearchEnginesList() {
extensions->Append(CreateDictionaryForEngine(i, i == default_index));
}
- std::unique_ptr<base::DictionaryValue> search_engines_info(
- new base::DictionaryValue);
+ auto search_engines_info = std::make_unique<base::DictionaryValue>();
search_engines_info->Set("defaults", std::move(defaults));
search_engines_info->Set("others", std::move(others));
search_engines_info->Set("extensions", std::move(extensions));
@@ -185,7 +182,7 @@ SearchEnginesHandler::CreateDictionaryForEngine(int index, bool is_default) {
// chrome/browser/resources/settings/search_engines_page/
// in @typedef for SearchEngine. Please update it whenever you add or remove
// any keys here.
- std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ auto dict = std::make_unique<base::DictionaryValue>();
dict->SetInteger("id", template_url->id());
dict->SetString("name", template_url->short_name());
dict->SetString("displayName",
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc
index 25dbe1f03e7..602c0980873 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc
@@ -132,6 +132,7 @@ void CookiesViewHandler::OnJavascriptAllowed() {
void CookiesViewHandler::OnJavascriptDisallowed() {
callback_weak_ptr_factory_.InvalidateWeakPtrs();
+ request_.Clear();
}
void CookiesViewHandler::RegisterMessages() {
@@ -231,14 +232,13 @@ void CookiesViewHandler::TreeModelBeginBatch(CookiesTreeModel* model) {
void CookiesViewHandler::TreeModelEndBatch(CookiesTreeModel* model) {
DCHECK(batch_update_);
batch_update_ = false;
- if (IsJavascriptAllowed()) {
- if (request_.should_send_list) {
- SendLocalDataList(model->GetRoot());
- } else if (!request_.callback_id_.empty()) {
- ResolveJavascriptCallback(base::Value(request_.callback_id_),
- (base::Value()));
- request_.Clear();
- }
+
+ if (request_.should_send_list) {
+ SendLocalDataList(model->GetRoot());
+ } else if (!request_.callback_id_.empty()) {
+ ResolveJavascriptCallback(base::Value(request_.callback_id_),
+ (base::Value()));
+ request_.Clear();
}
}
@@ -255,14 +255,18 @@ void CookiesViewHandler::RecreateCookiesTreeModel() {
filter_.clear();
sorted_sites_.clear();
EnsureCookiesTreeModelCreated();
+
+ CHECK(!request_.callback_id_.empty());
+ ResolveJavascriptCallback(base::Value(request_.callback_id_),
+ (base::Value()));
+ request_.Clear();
}
void CookiesViewHandler::HandleGetCookieDetails(const base::ListValue* args) {
CHECK(request_.callback_id_.empty());
- CHECK_EQ(2U, args->GetSize());
- CHECK(args->GetString(0, &request_.callback_id_));
- std::string site;
- CHECK(args->GetString(1, &site));
+ CHECK_EQ(2U, args->GetList().size());
+ request_.callback_id_ = args->GetList()[0].GetString();
+ std::string site = args->GetList()[1].GetString();
AllowJavascript();
const CookieTreeNode* node = model_util_->GetTreeNodeFromTitle(
@@ -279,11 +283,10 @@ void CookiesViewHandler::HandleGetCookieDetails(const base::ListValue* args) {
void CookiesViewHandler::HandleGetNumCookiesString(
const base::ListValue* args) {
- CHECK_EQ(2U, args->GetSize());
+ CHECK_EQ(2U, args->GetList().size());
std::string callback_id;
- CHECK(args->GetString(0, &callback_id));
- int num_cookies;
- CHECK(args->GetInteger(1, &num_cookies));
+ callback_id = args->GetList()[0].GetString();
+ int num_cookies = args->GetList()[1].GetInt();
AllowJavascript();
const base::string16 string =
@@ -296,10 +299,9 @@ void CookiesViewHandler::HandleGetNumCookiesString(
void CookiesViewHandler::HandleGetDisplayList(const base::ListValue* args) {
CHECK(request_.callback_id_.empty());
- CHECK_EQ(2U, args->GetSize());
- CHECK(args->GetString(0, &request_.callback_id_));
- base::string16 filter;
- CHECK(args->GetString(1, &filter));
+ CHECK_EQ(2U, args->GetList().size());
+ request_.callback_id_ = args->GetList()[0].GetString();
+ base::string16 filter = base::UTF8ToUTF16(args->GetList()[1].GetString());
AllowJavascript();
request_.should_send_list = true;
@@ -315,8 +317,8 @@ void CookiesViewHandler::HandleGetDisplayList(const base::ListValue* args) {
void CookiesViewHandler::HandleReloadCookies(const base::ListValue* args) {
CHECK(request_.callback_id_.empty());
- CHECK_EQ(1U, args->GetSize());
- CHECK(args->GetString(0, &request_.callback_id_));
+ CHECK_EQ(1U, args->GetList().size());
+ request_.callback_id_ = args->GetList()[0].GetString();
AllowJavascript();
RecreateCookiesTreeModel();
@@ -324,8 +326,8 @@ void CookiesViewHandler::HandleReloadCookies(const base::ListValue* args) {
void CookiesViewHandler::HandleRemoveAll(const base::ListValue* args) {
CHECK(request_.callback_id_.empty());
- CHECK_EQ(1U, args->GetSize());
- CHECK(args->GetString(0, &request_.callback_id_));
+ CHECK_EQ(1U, args->GetList().size());
+ request_.callback_id_ = args->GetList()[0].GetString();
AllowJavascript();
cookies_tree_model_->DeleteAllStoredObjects();
@@ -333,8 +335,7 @@ void CookiesViewHandler::HandleRemoveAll(const base::ListValue* args) {
}
void CookiesViewHandler::HandleRemove(const base::ListValue* args) {
- std::string node_path;
- CHECK(args->GetString(0, &node_path));
+ std::string node_path = args->GetList()[0].GetString();
AllowJavascript();
const CookieTreeNode* node = model_util_->GetTreeNodeFromPath(
@@ -347,8 +348,8 @@ void CookiesViewHandler::HandleRemove(const base::ListValue* args) {
void CookiesViewHandler::HandleRemoveThirdParty(const base::ListValue* args) {
CHECK(request_.callback_id_.empty());
- CHECK_EQ(1U, args->GetSize());
- CHECK(args->GetString(0, &request_.callback_id_));
+ CHECK_EQ(1U, args->GetList().size());
+ request_.callback_id_ = args->GetList()[0].GetString();
AllowJavascript();
Profile* profile = Profile::FromWebUI(web_ui());
@@ -360,7 +361,7 @@ void CookiesViewHandler::HandleRemoveThirdParty(const base::ListValue* args) {
}
void CookiesViewHandler::HandleRemoveShownItems(const base::ListValue* args) {
- CHECK_EQ(0U, args->GetSize());
+ CHECK_EQ(0U, args->GetList().size());
AllowJavascript();
CookieTreeNode* parent = cookies_tree_model_->GetRoot();
@@ -369,10 +370,9 @@ void CookiesViewHandler::HandleRemoveShownItems(const base::ListValue* args) {
}
void CookiesViewHandler::HandleRemoveItem(const base::ListValue* args) {
- CHECK_EQ(1U, args->GetSize());
+ CHECK_EQ(1U, args->GetList().size());
CHECK(request_.callback_id_.empty());
- base::string16 site;
- CHECK(args->GetString(0, &site));
+ base::string16 site = base::UTF8ToUTF16(args->GetList()[0].GetString());
AllowJavascript();
CookieTreeNode* parent = cookies_tree_model_->GetRoot();
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h
index d5a031bf16a..27b91d2d6c9 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler.h
@@ -46,6 +46,10 @@ class CookiesViewHandler : public SettingsPageUIHandler,
void TreeModelEndBatch(CookiesTreeModel* model) override;
private:
+ friend class CookiesViewHandlerTest;
+ FRIEND_TEST_ALL_PREFIXES(CookiesViewHandlerTest,
+ HandleReloadCookiesAndGetDisplayList);
+
// Creates the CookiesTreeModel if necessary.
void EnsureCookiesTreeModelCreated();
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler_unittest.cc
new file mode 100644
index 00000000000..05d9e3dfcfa
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/settings/settings_cookies_view_handler_unittest.cc
@@ -0,0 +1,65 @@
+// 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/settings_cookies_view_handler.h"
+
+#include <memory>
+#include <string>
+
+#include "base/values.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
+#include "content/public/test/test_web_ui.h"
+
+namespace settings {
+
+class CookiesViewHandlerTest : public ChromeRenderViewHostTestHarness {
+ public:
+ void SetUp() override {
+ ChromeRenderViewHostTestHarness::SetUp();
+
+ web_ui_ = std::make_unique<content::TestWebUI>();
+ web_ui_->set_web_contents(web_contents());
+ handler_ = std::make_unique<CookiesViewHandler>();
+ handler_->set_web_ui(web_ui());
+ handler_->AllowJavascript();
+ web_ui_->ClearTrackedCalls();
+ }
+
+ void TearDown() override {
+ handler_->set_web_ui(nullptr);
+ handler_.reset();
+ web_ui_.reset();
+
+ ChromeRenderViewHostTestHarness::TearDown();
+ }
+
+ content::TestWebUI* web_ui() { return web_ui_.get(); }
+ CookiesViewHandler* handler() { return handler_.get(); }
+
+ private:
+ std::unique_ptr<content::TestWebUI> web_ui_;
+ std::unique_ptr<CookiesViewHandler> handler_;
+};
+
+// This unit test checks that the javascript callbacks are called correctly for
+// the reloadCookies and the getDisplayList handler cases. It also makes sure
+// that CHECKs for request_.callback_id_.empty() do not fire when multiple
+// handlers are called in sequence.
+TEST_F(CookiesViewHandlerTest, HandleReloadCookiesAndGetDisplayList) {
+ const std::string reload_callback_id("localData.reload_0");
+ const std::string get_display_list_callback_id("localData.getDisplayList_1");
+
+ base::ListValue reload_args;
+ reload_args.AppendString(reload_callback_id);
+ handler()->HandleReloadCookies(&reload_args);
+ EXPECT_EQ(1U, web_ui()->call_data().size());
+
+ base::ListValue get_display_list_args;
+ get_display_list_args.AppendString(reload_callback_id);
+ get_display_list_args.AppendString(std::string());
+ handler()->HandleGetDisplayList(&get_display_list_args);
+ EXPECT_EQ(2U, web_ui()->call_data().size());
+}
+
+} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
index 3ff5f45c78b..01411db9371 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -18,6 +18,7 @@
#include "build/buildflag.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h"
@@ -33,7 +34,11 @@
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/locale_settings.h"
+#include "components/autofill/content/browser/content_autofill_driver.h"
+#include "components/autofill/content/browser/content_autofill_driver_factory.h"
#include "components/autofill/core/browser/autofill_experiments.h"
+#include "components/autofill/core/browser/autofill_manager.h"
+#include "components/autofill/core/browser/payments/credit_card_access_manager.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"
@@ -42,6 +47,7 @@
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/browsing_data/core/features.h"
+#include "components/content_settings/core/common/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"
@@ -54,6 +60,7 @@
#include "components/sync/driver/sync_service_utils.h"
#include "components/sync/driver/sync_user_settings.h"
#include "components/unified_consent/feature.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
@@ -68,11 +75,12 @@
#if defined(OS_CHROMEOS)
#include "ash/public/cpp/ash_switches.h"
-#include "ash/public/mojom/voice_interaction_controller.mojom.h"
+#include "ash/public/mojom/assistant_state_controller.mojom.h"
#include "base/system/sys_info.h"
#include "chrome/browser/chromeos/account_manager/account_manager_util.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/chromeos/assistant/assistant_util.h"
+#include "chrome/browser/chromeos/crostini/crostini_features.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/chromeos/kerberos/kerberos_credentials_manager.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h"
@@ -337,7 +345,8 @@ void AddA11yStrings(content::WebUIDataSource* html_source) {
{"mouseSettingsTitle", IDS_SETTINGS_ACCESSIBILITY_MOUSE_SETTINGS_TITLE},
{"mouseSettingsDescription",
IDS_SETTINGS_ACCESSIBILITY_MOUSE_SETTINGS_DESCRIPTION},
- {"audioHeading", IDS_SETTINGS_ACCESSIBILITY_AUDIO_HEADING},
+ {"audioAndCaptionsHeading",
+ IDS_SETTINGS_ACCESSIBILITY_AUDIO_AND_CAPTIONS_HEADING},
{"additionalFeaturesTitle",
IDS_SETTINGS_ACCESSIBILITY_ADDITIONAL_FEATURES_TITLE},
{"manageTtsSettings", IDS_SETTINGS_MANAGE_TTS_SETTINGS},
@@ -426,19 +435,16 @@ void AddAboutStrings(content::WebUIDataSource* html_source) {
{"aboutUpgradeUpdatingPercent", IDS_SETTINGS_UPGRADE_UPDATING_PERCENT},
#if defined(OS_CHROMEOS)
- {"aboutArcVersionLabel", IDS_SETTINGS_ABOUT_PAGE_ARC_VERSION},
- {"aboutBuildDateLabel", IDS_VERSION_UI_BUILD_DATE},
+ {"aboutBuildDetailsTitle", IDS_OS_SETTINGS_ABOUT_PAGE_BUILD_DETAILS},
{"aboutChannelBeta", IDS_SETTINGS_ABOUT_PAGE_CURRENT_CHANNEL_BETA},
{"aboutChannelCanary", IDS_SETTINGS_ABOUT_PAGE_CURRENT_CHANNEL_CANARY},
{"aboutChannelDev", IDS_SETTINGS_ABOUT_PAGE_CURRENT_CHANNEL_DEV},
{"aboutChannelLabel", IDS_SETTINGS_ABOUT_PAGE_CHANNEL},
{"aboutChannelStable", IDS_SETTINGS_ABOUT_PAGE_CURRENT_CHANNEL_STABLE},
{"aboutCheckForUpdates", IDS_SETTINGS_ABOUT_PAGE_CHECK_FOR_UPDATES},
- {"aboutCommandLineLabel", IDS_VERSION_UI_COMMAND_LINE},
{"aboutCurrentlyOnChannel", IDS_SETTINGS_ABOUT_PAGE_CURRENT_CHANNEL},
{"aboutDetailedBuildInfo", IDS_SETTINGS_ABOUT_PAGE_DETAILED_BUILD_INFO},
- {"aboutFirmwareLabel", IDS_SETTINGS_ABOUT_PAGE_FIRMWARE},
- {"aboutPlatformLabel", IDS_SETTINGS_ABOUT_PAGE_PLATFORM},
+ {"aboutEndOfLifeTitle", IDS_SETTINGS_ABOUT_PAGE_END_OF_LIFE_TITLE},
{"aboutRelaunchAndPowerwash",
IDS_SETTINGS_ABOUT_PAGE_RELAUNCH_AND_POWERWASH},
{"aboutRollbackInProgress", IDS_SETTINGS_UPGRADE_ROLLBACK_IN_PROGRESS},
@@ -449,7 +455,6 @@ void AddAboutStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_UPGRADE_UPDATING_CHANNEL_SWITCH},
{"aboutUpgradeSuccessChannelSwitch",
IDS_SETTINGS_UPGRADE_SUCCESSFUL_CHANNEL_SWITCH},
- {"aboutUserAgentLabel", IDS_VERSION_UI_USER_AGENT},
{"aboutTPMFirmwareUpdateTitle",
IDS_SETTINGS_ABOUT_TPM_FIRMWARE_UPDATE_TITLE},
{"aboutTPMFirmwareUpdateDescription",
@@ -580,7 +585,7 @@ void AddCrostiniStrings(content::WebUIDataSource* html_source,
crostini::ContainerChromeOSBaseDirectory().value())));
html_source->AddBoolean(
"showCrostiniExportImport",
- crostini::IsCrostiniExportImportUIAllowedForProfile(profile));
+ crostini::CrostiniFeatures::Get()->IsExportImportUIAllowed(profile));
}
void AddPluginVmStrings(content::WebUIDataSource* html_source,
@@ -613,6 +618,7 @@ void AddAndroidAppStrings(content::WebUIDataSource* html_source) {
{"androidAppsEnable", IDS_SETTINGS_TURN_ON},
{"androidAppsManageApps", IDS_SETTINGS_ANDROID_APPS_MANAGE_APPS},
{"androidAppsRemove", IDS_SETTINGS_ANDROID_APPS_REMOVE},
+ {"androidAppsRemoveButton", IDS_SETTINGS_ANDROID_APPS_REMOVE_BUTTON},
{"androidAppsDisableDialogTitle",
IDS_SETTINGS_ANDROID_APPS_DISABLE_DIALOG_TITLE},
{"androidAppsDisableDialogMessage",
@@ -642,32 +648,22 @@ void AddAppsStrings(content::WebUIDataSource* html_source) {
void AddAppManagementStrings(content::WebUIDataSource* html_source) {
static constexpr LocalizedString localized_strings[] = {
- {"appListTitle", IDS_APP_MANAGEMENT_APP_LIST_TITLE},
- {"appNoPermission", IDS_APPLICATION_INFO_APP_NO_PERMISSIONS_TEXT},
- {"camera", IDS_APP_MANAGEMENT_CAMERA},
- {"contacts", IDS_APP_MANAGEMENT_CONTACTS},
- {"controlledByPolicy", IDS_CONTROLLED_SETTING_POLICY},
- {"lessApps", IDS_APP_MANAGEMENT_LESS_APPS},
- {"location", IDS_APP_MANAGEMENT_LOCATION},
- {"microphone", IDS_APP_MANAGEMENT_MICROPHONE},
- {"moreApps", IDS_APP_MANAGEMENT_MORE_APPS},
- {"moreSettings", IDS_APP_MANAGEMENT_MORE_SETTINGS},
- {"notifications", IDS_APP_MANAGEMENT_NOTIFICATIONS},
- {"notificationSublabel", IDS_APP_MANAGEMENT_NOTIFICATIONS_SUBLABEL},
- {"openAndroidSettings", IDS_APP_MANAGEMENT_ANDROID_SETTINGS},
- {"openExtensionsSettings", IDS_APP_MANAGEMENT_EXTENSIONS_SETTINGS},
- {"openSiteSettings", IDS_APP_MANAGEMENT_SITE_SETTING},
- {"permissions", IDS_APP_MANAGEMENT_PERMISSIONS},
- {"pinControlledByPolicy", IDS_APP_MANAGEMENT_PIN_ENFORCED_BY_POLICY},
- {"pinToShelf", IDS_APP_MANAGEMENT_PIN_TO_SHELF},
- {"policyAppUninstallPolicy", IDS_APP_MANAGEMENT_POLICY_APP_POLICY_STRING},
- {"size", IDS_APP_MANAGEMENT_SIZE},
- {"storage", IDS_APP_MANAGEMENT_STORAGE},
- {"systemAppUninstallPolicy", IDS_APP_MANAGEMENT_SYSTEM_APP_POLICY_STRING},
- {"thisAppCan", IDS_APP_MANAGEMENT_THIS_APP_CAN},
- {"title", IDS_APP_MANAGEMENT_TITLE},
- {"uninstallApp", IDS_APP_MANAGEMENT_UNINSTALL_APP},
- {"version", IDS_APP_MANAGEMENT_VERSION},
+ {"appManagementAppInstalledByPolicyLabel",
+ IDS_APP_MANAGEMENT_POLICY_APP_POLICY_STRING},
+ {"appManagementCameraPermissionLabel", IDS_APP_MANAGEMENT_CAMERA},
+ {"appManagementContactsPermissionLabel", IDS_APP_MANAGEMENT_CONTACTS},
+ {"appManagementLocationPermissionLabel", IDS_APP_MANAGEMENT_LOCATION},
+ {"appManagementMicrophonePermissionLabel", IDS_APP_MANAGEMENT_MICROPHONE},
+ {"appManagementMoreSettingsLabel", IDS_APP_MANAGEMENT_MORE_SETTINGS},
+ {"appManagementNoAppsFound", IDS_APP_MANAGEMENT_NO_APPS_FOUND},
+ {"appManagementNoPermissions",
+ IDS_APPLICATION_INFO_APP_NO_PERMISSIONS_TEXT},
+ {"appManagementNotificationsLabel", IDS_APP_MANAGEMENT_NOTIFICATIONS},
+ {"appManagementPermissionsLabel", IDS_APP_MANAGEMENT_PERMISSIONS},
+ {"appManagementPinToShelfLabel", IDS_APP_MANAGEMENT_PIN_TO_SHELF},
+ {"appManagementSearchPrompt", IDS_APP_MANAGEMENT_SEARCH_PROMPT},
+ {"appManagementStoragePermissionLabel", IDS_APP_MANAGEMENT_STORAGE},
+ {"appManagementUninstallLabel", IDS_APP_MANAGEMENT_UNINSTALL_APP},
};
AddLocalizedStringsBulk(html_source, localized_strings,
base::size(localized_strings));
@@ -884,7 +880,8 @@ void AddDeviceStrings(content::WebUIDataSource* html_source) {
{"mouseSpeed", IDS_SETTINGS_MOUSE_SPEED_LABEL},
{"mouseSwapButtons", IDS_SETTINGS_MOUSE_SWAP_BUTTONS_LABEL},
{"mouseReverseScroll", IDS_SETTINGS_MOUSE_REVERSE_SCROLL_LABEL},
- {"pointerAccelerationLabel", IDS_SETTINGS_POINTER_ACCELERATION_LABEL},
+ {"mouseAccelerationLabel", IDS_SETTINGS_MOUSE_ACCELERATION_LABEL},
+ {"touchpadAccelerationLabel", IDS_SETTINGS_TOUCHPAD_ACCELERATION_LABEL},
};
AddLocalizedStringsBulk(html_source, kPointersStrings,
base::size(kPointersStrings));
@@ -1040,7 +1037,6 @@ void AddDeviceStrings(content::WebUIDataSource* html_source) {
{"storageItemInUse", IDS_SETTINGS_STORAGE_ITEM_IN_USE},
{"storageItemAvailable", IDS_SETTINGS_STORAGE_ITEM_AVAILABLE},
{"storageItemDownloads", IDS_SETTINGS_STORAGE_ITEM_DOWNLOADS},
- {"storageItemDriveCache", IDS_SETTINGS_STORAGE_ITEM_DRIVE_CACHE},
{"storageItemBrowsingData", IDS_SETTINGS_STORAGE_ITEM_BROWSING_DATA},
{"storageItemAndroid", IDS_SETTINGS_STORAGE_ITEM_ANDROID},
{"storageItemCrostini", IDS_SETTINGS_STORAGE_ITEM_CROSTINI},
@@ -1059,20 +1055,18 @@ void AddDeviceStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_STORAGE_SPACE_CRITICALLY_LOW_MESSAGE_LINE_1},
{"storageSpaceCriticallyLowMessageLine2",
IDS_SETTINGS_STORAGE_SPACE_CRITICALLY_LOW_MESSAGE_LINE_2},
- {"storageClearDriveCacheDialogTitle",
- IDS_SETTINGS_STORAGE_CLEAR_DRIVE_CACHE_DIALOG_TITLE},
- {"storageClearDriveCacheDialogDescription",
- IDS_SETTINGS_STORAGE_CLEAR_DRIVE_CACHE_DESCRIPTION},
- {"storageDeleteAllButtonTitle",
- IDS_SETTINGS_STORAGE_DELETE_ALL_BUTTON_TITLE},
{"storageExternal", IDS_SETTINGS_STORAGE_EXTERNAL},
- {"storageAndroidAppsExternalDrivesNote",
- IDS_SETTINGS_STORAGE_ANDROID_APPS_ACCESS_EXTERNAL_DRIVES_NOTE},
{"storageExternalStorageListHeader",
IDS_SETTINGS_STORAGE_EXTERNAL_STORAGE_LIST_HEADER}};
AddLocalizedStringsBulk(html_source, kStorageStrings,
base::size(kStorageStrings));
+ html_source->AddString(
+ "storageAndroidAppsExternalDrivesNote",
+ l10n_util::GetStringFUTF16(
+ IDS_SETTINGS_STORAGE_ANDROID_APPS_ACCESS_EXTERNAL_DRIVES_NOTE,
+ base::ASCIIToUTF16(chrome::kArcExternalStorageLearnMoreURL)));
+
static constexpr LocalizedString kPowerStrings[] = {
{"powerTitle", IDS_SETTINGS_POWER_TITLE},
{"powerSourceLabel", IDS_SETTINGS_POWER_SOURCE_LABEL},
@@ -1296,6 +1290,7 @@ void AddResetStrings(content::WebUIDataSource* html_source) {
{"powerwashDialogExplanation", IDS_SETTINGS_FACTORY_RESET_WARNING},
{"powerwashDialogButton", IDS_SETTINGS_RESTART},
{"powerwashLearnMoreUrl", IDS_FACTORY_RESET_HELP_URL},
+ {"powerwashButton", IDS_SETTINGS_FACTORY_RESET_BUTTON_LABEL},
#endif
// Automatic reset banner (now a dialog).
{"resetAutomatedDialogTitle", IDS_SETTINGS_RESET_AUTOMATED_DIALOG_TITLE},
@@ -1612,6 +1607,8 @@ void AddLanguagesStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_LANGUAGES_ADD_DICTIONARY_WORD_DUPLICATE_ERROR},
{"addDictionaryWordLengthError",
IDS_SETTINGS_LANGUAGES_ADD_DICTIONARY_WORD_LENGTH_ERROR},
+ {"deleteDictionaryWordButton",
+ IDS_SETTINGS_LANGUAGES_DELETE_DICTIONARY_WORD_BUTTON},
{"customDictionaryWords", IDS_SETTINGS_LANGUAGES_DICTIONARY_WORDS},
{"noCustomDictionaryWordsFound",
IDS_SETTINGS_LANGUAGES_DICTIONARY_WORDS_NONE},
@@ -1701,8 +1698,41 @@ void AddOnStartupStrings(content::WebUIDataSource* html_source) {
base::size(kLocalizedStrings));
}
+bool IsFidoAuthenticationAvailable(autofill::PersonalDataManager* personal_data,
+ content::WebContents* web_contents) {
+ // Don't show toggle switch if user is unable to downstream cards.
+ if (personal_data->GetSyncSigninState() !=
+ autofill::AutofillSyncSigninState::
+ kSignedInAndWalletSyncTransportEnabled &&
+ personal_data->GetSyncSigninState() !=
+ autofill::AutofillSyncSigninState::kSignedInAndSyncFeatureEnabled) {
+ return false;
+ }
+
+ // If |autofill_manager| is not available, then don't show toggle switch.
+ autofill::ContentAutofillDriverFactory* autofill_driver_factory =
+ autofill::ContentAutofillDriverFactory::FromWebContents(web_contents);
+ if (!autofill_driver_factory)
+ return false;
+ autofill::ContentAutofillDriver* autofill_driver =
+ autofill_driver_factory->DriverForFrame(web_contents->GetMainFrame());
+ if (!autofill_driver)
+ return false;
+ autofill::AutofillManager* autofill_manager =
+ autofill_driver->autofill_manager();
+ if (!autofill_manager)
+ return false;
+
+ // Show the toggle switch only if the flag is enabled. Once returned, this
+ // decision may be overridden (from true to false) by the caller in the
+ // payments section if no platform authenticator is found.
+ return base::FeatureList::IsEnabled(
+ autofill::features::kAutofillCreditCardAuthentication);
+}
+
void AddAutofillStrings(content::WebUIDataSource* html_source,
- Profile* profile) {
+ Profile* profile,
+ content::WebContents* web_contents) {
static constexpr LocalizedString kLocalizedStrings[] = {
{"autofillPageTitle", IDS_SETTINGS_AUTOFILL},
{"passwords", IDS_SETTINGS_PASSWORDS},
@@ -1715,6 +1745,9 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
{"enableCreditCardsLabel", IDS_AUTOFILL_ENABLE_CREDIT_CARDS_TOGGLE_LABEL},
{"enableCreditCardsSublabel",
IDS_AUTOFILL_ENABLE_CREDIT_CARDS_TOGGLE_SUBLABEL},
+ {"enableCreditCardFIDOAuthLabel", IDS_ENABLE_CREDIT_CARD_FIDO_AUTH_LABEL},
+ {"enableCreditCardFIDOAuthSublabel",
+ IDS_ENABLE_CREDIT_CARD_FIDO_AUTH_SUBLABEL},
{"addresses", IDS_AUTOFILL_ADDRESSES},
{"addressesTitle", IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE},
{"addAddressTitle", IDS_SETTINGS_AUTOFILL_ADDRESSES_ADD_TITLE},
@@ -1748,10 +1781,6 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_PASSWORDS_AUTOSIGNIN_CHECKBOX_DESC},
{"passwordsLeakDetectionLabel",
IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_LABEL},
- {"passwordsLeakDetectionSignedInDescription",
- IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_IN_DESC},
- {"passwordsLeakDetectionSignedOutDisabledDescription",
- IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_OUT_DISABLED_DESC},
{"passwordsLeakDetectionSignedOutEnabledDescription",
IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_OUT_ENABLED_DESC},
{"savedPasswordsHeading", IDS_SETTINGS_PASSWORDS_SAVED_HEADING},
@@ -1822,15 +1851,18 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
#else // !defined(OS_CHROMEOS)
is_guest_mode = profile->IsOffTheRecord();
#endif // defined(OS_CHROMEOS)
+ autofill::PersonalDataManager* personal_data =
+ autofill::PersonalDataManagerFactory::GetForProfile(profile);
html_source->AddBoolean(
"migrationEnabled",
- !is_guest_mode &&
- autofill::IsCreditCardMigrationEnabled(
- autofill::PersonalDataManagerFactory::GetForProfile(profile),
- profile->GetPrefs(),
- ProfileSyncServiceFactory::GetForProfile(profile),
- /*is_test_mode=*/false,
- /*log_manager=*/nullptr));
+ !is_guest_mode && autofill::IsCreditCardMigrationEnabled(
+ personal_data, profile->GetPrefs(),
+ ProfileSyncServiceFactory::GetForProfile(profile),
+ /*is_test_mode=*/false,
+ /*log_manager=*/nullptr));
+ html_source->AddBoolean(
+ "fidoAuthenticationAvailableForAutofill",
+ IsFidoAuthenticationAvailable(personal_data, web_contents));
html_source->AddBoolean(
"passwordsLeakDetectionEnabled",
@@ -1859,6 +1891,12 @@ void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) {
{"accountListHeader", IDS_SETTINGS_ACCOUNT_MANAGER_LIST_HEADER},
{"addAccountLabel", IDS_SETTINGS_ACCOUNT_MANAGER_ADD_ACCOUNT_LABEL},
{"removeAccountLabel", IDS_SETTINGS_ACCOUNT_MANAGER_REMOVE_ACCOUNT_LABEL},
+ {"accountManagerPrimaryAccountTooltip",
+ IDS_SETTINGS_ACCOUNT_MANAGER_PRIMARY_ACCOUNT_TOOLTIP},
+ {"accountManagerSecondaryAccountsDisabledText",
+ IDS_SETTINGS_ACCOUNT_MANAGER_SECONDARY_ACCOUNTS_DISABLED_TEXT},
+ {"accountManagerSecondaryAccountsDisabledChildText",
+ IDS_SETTINGS_ACCOUNT_MANAGER_SECONDARY_ACCOUNTS_DISABLED_CHILD_TEXT},
{"accountManagerSignedOutAccountName",
IDS_SETTINGS_ACCOUNT_MANAGER_SIGNED_OUT_ACCOUNT_PLACEHOLDER},
{"accountManagerUnmigratedAccountName",
@@ -2311,6 +2349,7 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) {
{"printerModel", IDS_SETTINGS_PRINTING_CUPS_PRINTER_DETAILS_MODEL},
{"printerQueue", IDS_SETTINGS_PRINTING_CUPS_PRINTER_DETAILS_QUEUE},
{"savedPrintersTitle", IDS_SETTINGS_PRINTING_CUPS_SAVED_PRINTERS_TITLE},
+ {"showMorePrinters", IDS_SETTINGS_PRINTING_CUPS_SHOW_MORE},
{"addPrintersNearbyTitle",
IDS_SETTINGS_PRINTING_CUPS_ADD_PRINTERS_NEARBY_TITLE},
{"addPrintersManuallyTitle",
@@ -2666,6 +2705,9 @@ void AddGoogleAssistantStrings(content::WebUIDataSource* html_source,
html_source->AddBoolean("hotwordDspAvailable",
chromeos::IsHotwordDspAvailable());
+ html_source->AddBoolean(
+ "voiceMatchDisabled",
+ chromeos::assistant::features::IsVoiceMatchDisabled());
}
#endif
@@ -2737,6 +2779,8 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
{"siteSettingsCategoryCookies", IDS_SETTINGS_SITE_SETTINGS_COOKIES},
{"siteSettingsCategoryHandlers", IDS_SETTINGS_SITE_SETTINGS_HANDLERS},
{"siteSettingsCategoryImages", IDS_SETTINGS_SITE_SETTINGS_IMAGES},
+ {"siteSettingsCategoryInsecureContent",
+ IDS_SETTINGS_SITE_SETTINGS_INSECURE_CONTENT},
{"siteSettingsCategoryLocation", IDS_SETTINGS_SITE_SETTINGS_LOCATION},
{"siteSettingsCategoryJavascript", IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT},
{"siteSettingsCategoryMicrophone", IDS_SETTINGS_SITE_SETTINGS_MIC},
@@ -2773,6 +2817,10 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
{"siteSettingsMic", IDS_SETTINGS_SITE_SETTINGS_MIC},
{"siteSettingsNotifications", IDS_SETTINGS_SITE_SETTINGS_NOTIFICATIONS},
{"siteSettingsImages", IDS_SETTINGS_SITE_SETTINGS_IMAGES},
+ {"siteSettingsInsecureContent",
+ IDS_SETTINGS_SITE_SETTINGS_INSECURE_CONTENT},
+ {"siteSettingsInsecureContentBlock",
+ IDS_SETTINGS_SITE_SETTINGS_INSECURE_CONTENT_BLOCK},
{"siteSettingsJavascript", IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT},
{"siteSettingsSound", IDS_SETTINGS_SITE_SETTINGS_SOUND},
{"siteSettingsSoundAllow", IDS_SETTINGS_SITE_SETTINGS_SOUND_ALLOW},
@@ -2947,6 +2995,8 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_SITE_SETTINGS_THIRD_PARTY_COOKIE_REMOVE_CONFIRMATION},
{"siteSettingsCookiesClearThirdParty",
IDS_SETTINGS_SITE_SETTINGS_CLEAR_THIRD_PARTY_COOKIES},
+ {"siteSettingsCookiesThirdPartyExceptionLabel",
+ IDS_SETTINGS_SITE_SETTINGS_THIRD_PARTY_COOKIES_EXCEPTION_LABEL},
{"siteSettingsCookieRemoveDialogTitle",
IDS_SETTINGS_SITE_SETTINGS_COOKIE_REMOVE_DIALOG_TITLE},
{"siteSettingsCookieRemoveMultipleConfirmation",
@@ -2986,7 +3036,6 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
{"handlerSetDefault", IDS_SETTINGS_SITE_SETTINGS_HANDLER_SET_DEFAULT},
{"handlerRemove", IDS_SETTINGS_SITE_SETTINGS_REMOVE},
{"adobeFlashStorage", IDS_SETTINGS_SITE_SETTINGS_ADOBE_FLASH_SETTINGS},
- {"learnMore", IDS_LEARN_MORE},
{"incognitoSite", IDS_SETTINGS_SITE_SETTINGS_INCOGNITO},
{"incognitoSiteOnly", IDS_SETTINGS_SITE_SETTINGS_INCOGNITO_ONLY},
{"embeddedIncognitoSite", IDS_SETTINGS_SITE_SETTINGS_INCOGNITO_EMBEDDED},
@@ -3059,10 +3108,6 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
cmd.HasSwitch(::switches::kEnableExperimentalWebPlatformFeatures));
html_source->AddBoolean(
- "enableBluetoothScanningContentSetting",
- cmd.HasSwitch(::switches::kEnableWebBluetoothScanning));
-
- html_source->AddBoolean(
"enableNativeFileSystemWriteContentSetting",
base::FeatureList::IsEnabled(::blink::features::kNativeFileSystemAPI));
@@ -3070,6 +3115,16 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
"enableRemovingAllThirdPartyCookies",
base::FeatureList::IsEnabled(
browsing_data::features::kEnableRemovingAllThirdPartyCookies));
+
+ html_source->AddBoolean(
+ "enableInsecureContentContentSetting",
+ base::FeatureList::IsEnabled(features::kMixedContentSiteSetting));
+
+ html_source->AddBoolean(
+ "showImprovedCookieControlsForThirdParties",
+ base::FeatureList::IsEnabled(
+ content_settings ::
+ kImprovedCookieControlsForThirdPartyCookieBlocking));
}
#if defined(OS_CHROMEOS)
@@ -3084,6 +3139,7 @@ void AddUsersStrings(content::WebUIDataSource* html_source) {
{"removeUserTooltip", IDS_SETTINGS_USERS_REMOVE_USER_TOOLTIP},
{"addUsers", IDS_SETTINGS_USERS_ADD_USERS},
{"addUsersEmail", IDS_SETTINGS_USERS_ADD_USERS_EMAIL},
+ {"userExistsError", IDS_SETTINGS_USER_EXISTS_ERROR},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings,
base::size(kLocalizedStrings));
@@ -3172,6 +3228,8 @@ void AddMultideviceStrings(content::WebUIDataSource* html_source) {
{"multideviceForgetDevice", IDS_SETTINGS_MULTIDEVICE_FORGET_THIS_DEVICE},
{"multideviceSmartLockOptions",
IDS_SETTINGS_PEOPLE_LOCK_SCREEN_OPTIONS_LOCK},
+ {"multideviceForgetDeviceDisconnect",
+ IDS_SETTINGS_MULTIDEVICE_FORGET_THIS_DEVICE_DISCONNECT},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings,
base::size(kLocalizedStrings));
@@ -3246,8 +3304,10 @@ void AddSecurityKeysStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_SECURITY_KEYS_BIO_ENROLLMENT_SUBPAGE_DESCRIPTION},
{"securityKeysBioEnrollmentTouch",
IDS_SETTINGS_SECURITY_KEYS_BIO_ENROLLMENT_TOUCH},
- {"securityKeysPINTooShort",
- IDS_SETTINGS_SECURITY_KEYS_PIN_ERROR_TOO_SHORT},
+ {"securityKeysBioEnrollmentChooseName",
+ IDS_SETTINGS_SECURITY_KEYS_BIO_CHOOSE_NAME},
+ {"securityKeysBioEnrollmentNameLabel",
+ IDS_SETTINGS_SECURITY_KEYS_BIO_NAME_LABEL},
{"securityKeysConfirmPIN", IDS_SETTINGS_SECURITY_KEYS_CONFIRM_PIN},
{"securityKeysCredentialWebsite",
IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_WEBSITE},
@@ -3340,10 +3400,11 @@ void AddSecurityKeysStrings(content::WebUIDataSource* html_source) {
} // namespace
void AddLocalizedStrings(content::WebUIDataSource* html_source,
- Profile* profile) {
+ Profile* profile,
+ content::WebContents* web_contents) {
AddA11yStrings(html_source);
AddAboutStrings(html_source);
- AddAutofillStrings(html_source, profile);
+ AddAutofillStrings(html_source, profile, web_contents);
AddAppearanceStrings(html_source, profile);
#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h
index 1642eb7503a..a72290f479f 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h
+++ b/chromium/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h
@@ -9,6 +9,7 @@ class Profile;
namespace content {
class WebUIDataSource;
+class WebContents;
}
namespace settings {
@@ -17,7 +18,8 @@ namespace settings {
// causes |html_source| to expose a strings.js file from its source which
// contains a mapping from string's name to its translated value.
void AddLocalizedStrings(content::WebUIDataSource* html_source,
- Profile* profile);
+ Profile* profile,
+ content::WebContents* web_contents);
} // namespace settings
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc b/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
index 40505a485bd..ce95eecb512 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
@@ -48,7 +48,7 @@ const char kProfileShortcutNotFound[] = "profileShortcutNotFound";
} // namespace
ManageProfileHandler::ManageProfileHandler(Profile* profile)
- : profile_(profile), observer_(this) {}
+ : profile_(profile) {}
ManageProfileHandler::~ManageProfileHandler() {}
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.h b/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.h
index 210f76c5bf2..fc5ebe7917b 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/settings_manage_profile_handler.h
@@ -88,7 +88,8 @@ class ManageProfileHandler : public settings::SettingsPageUIHandler,
Profile* profile_;
// Used to observe profile avatar updates.
- ScopedObserver<ProfileAttributesStorage, ManageProfileHandler> observer_;
+ ScopedObserver<ProfileAttributesStorage, ProfileAttributesStorage::Observer>
+ observer_{this};
// For generating weak pointers to itself for callbacks.
base::WeakPtrFactory<ManageProfileHandler> weak_factory_{this};
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
index 8f725e8ca0d..b949500f09a 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
@@ -43,6 +43,14 @@ void HandleClose(base::Closure close_callback, const base::ListValue* args) {
close_callback.Run();
}
+base::DictionaryValue EncodeEnrollment(const std::vector<uint8_t>& id,
+ const std::string& name) {
+ base::DictionaryValue value;
+ value.SetStringKey("name", name);
+ value.SetStringKey("id", base::HexEncode(id.data(), id.size()));
+ return value;
+}
+
} // namespace
namespace settings {
@@ -389,6 +397,7 @@ void SecurityKeysCredentialHandler::HandleDelete(const base::ListValue* args) {
base::BindOnce(&SecurityKeysCredentialHandler::OnCredentialsDeleted,
weak_factory_.GetWeakPtr()));
}
+
void SecurityKeysCredentialHandler::OnCredentialManagementReady() {
DCHECK(state_ == State::kStart || state_ == State::kPIN);
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -543,6 +552,10 @@ void SecurityKeysBioEnrollmentHandler::RegisterMessages() {
base::BindRepeating(&SecurityKeysBioEnrollmentHandler::HandleDelete,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
+ "securityKeyBioEnrollRename",
+ base::BindRepeating(&SecurityKeysBioEnrollmentHandler::HandleRename,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
"securityKeyBioEnrollCancel",
base::BindRepeating(&SecurityKeysBioEnrollmentHandler::HandleCancel,
base::Unretained(this)));
@@ -684,7 +697,7 @@ void SecurityKeysBioEnrollmentHandler::OnHaveEnumeration(
elem.SetStringKey("name", std::move(enrollment.second));
elem.SetStringKey("id", base::HexEncode(enrollment.first.data(),
enrollment.first.size()));
- list.emplace_back(std::move(elem));
+ list.emplace_back(EncodeEnrollment(enrollment.first, enrollment.second));
}
}
@@ -719,13 +732,46 @@ void SecurityKeysBioEnrollmentHandler::OnEnrollingResponse(
}
void SecurityKeysBioEnrollmentHandler::OnEnrollmentFinished(
- device::CtapDeviceResponseCode code) {
+ device::CtapDeviceResponseCode code,
+ std::vector<uint8_t> template_id) {
+ DCHECK_EQ(state_, State::kEnrolling);
+ DCHECK(!callback_id_.empty());
+ if (code == device::CtapDeviceResponseCode::kCtap2ErrKeepAliveCancel) {
+ base::DictionaryValue d;
+ d.SetIntKey("code", static_cast<int>(code));
+ d.SetIntKey("remaining", 0);
+ ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
+ std::move(d));
+ return;
+ }
+ if (code != device::CtapDeviceResponseCode::kSuccess) {
+ OnError(device::BioEnrollmentStatus::kAuthenticatorResponseInvalid);
+ return;
+ }
+ bio_->EnumerateTemplates(base::BindOnce(
+ &SecurityKeysBioEnrollmentHandler::OnHavePostEnrollmentEnumeration,
+ weak_factory_.GetWeakPtr(), std::move(template_id)));
+}
+
+void SecurityKeysBioEnrollmentHandler::OnHavePostEnrollmentEnumeration(
+ std::vector<uint8_t> enrolled_template_id,
+ device::CtapDeviceResponseCode code,
+ base::Optional<std::map<std::vector<uint8_t>, std::string>> enrollments) {
DCHECK_EQ(state_, State::kEnrolling);
DCHECK(!callback_id_.empty());
state_ = State::kReady;
+ if (code != device::CtapDeviceResponseCode::kSuccess || !enrollments ||
+ !base::Contains(*enrollments, enrolled_template_id)) {
+ OnError(device::BioEnrollmentStatus::kAuthenticatorResponseInvalid);
+ return;
+ }
+
base::DictionaryValue d;
d.SetIntKey("code", static_cast<int>(code));
d.SetIntKey("remaining", 0);
+ d.SetKey("enrollment",
+ EncodeEnrollment(enrolled_template_id,
+ (*enrollments)[enrolled_template_id]));
ResolveJavascriptCallback(base::Value(std::move(callback_id_)), std::move(d));
}
@@ -747,7 +793,7 @@ void SecurityKeysBioEnrollmentHandler::HandleDelete(
}
void SecurityKeysBioEnrollmentHandler::OnDelete(
- device::CtapDeviceResponseCode c) {
+ device::CtapDeviceResponseCode code) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK_EQ(state_, State::kDeleting);
DCHECK(!callback_id_.empty());
@@ -757,22 +803,42 @@ void SecurityKeysBioEnrollmentHandler::OnDelete(
weak_factory_.GetWeakPtr()));
}
-void SecurityKeysBioEnrollmentHandler::HandleCancel(
+void SecurityKeysBioEnrollmentHandler::HandleRename(
const base::ListValue* args) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- DCHECK_EQ(1u, args->GetSize());
- state_ = State::kCancelling;
+ DCHECK_EQ(args->GetSize(), 3u);
+ state_ = State::kRenaming;
callback_id_ = args->GetList()[0].GetString();
- bio_->Cancel(base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnEnrollCancel,
- weak_factory_.GetWeakPtr()));
+ std::vector<uint8_t> template_id;
+ if (!base::HexStringToBytes(args->GetList()[1].GetString(), &template_id)) {
+ NOTREACHED();
+ return;
+ }
+ bio_->RenameTemplate(
+ std::move(template_id), args->GetList()[2].GetString(),
+ base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnRename,
+ weak_factory_.GetWeakPtr()));
}
-void SecurityKeysBioEnrollmentHandler::OnEnrollCancel(
- device::CtapDeviceResponseCode) {
- DCHECK_EQ(state_, State::kCancelling);
- state_ = State::kReady;
- ResolveJavascriptCallback(base::Value(std::move(callback_id_)),
- base::Value());
+void SecurityKeysBioEnrollmentHandler::OnRename(
+ device::CtapDeviceResponseCode code) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(state_, State::kRenaming);
+ DCHECK(!callback_id_.empty());
+ state_ = State::kEnumerating;
+ bio_->EnumerateTemplates(
+ base::BindOnce(&SecurityKeysBioEnrollmentHandler::OnHaveEnumeration,
+ weak_factory_.GetWeakPtr()));
+}
+
+void SecurityKeysBioEnrollmentHandler::HandleCancel(
+ const base::ListValue* args) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(state_, State::kEnrolling);
+ DCHECK_EQ(0u, args->GetSize());
+ DCHECK(!callback_id_.empty());
+ // OnEnrollmentFinished() will be invoked once the cancellation is complete.
+ bio_->CancelEnrollment();
}
} // 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
index 60196df0fba..cfb3b29b42f 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/settings_security_key_handler.h
@@ -184,7 +184,7 @@ class SecurityKeysBioEnrollmentHandler : public SecurityKeysHandlerBase {
kEnumerating,
kEnrolling,
kDeleting,
- kCancelling,
+ kRenaming,
};
void RegisterMessages() override;
@@ -204,13 +204,20 @@ class SecurityKeysBioEnrollmentHandler : public SecurityKeysHandlerBase {
void HandleStartEnrolling(const base::ListValue* args);
void OnEnrollingResponse(device::BioEnrollmentSampleStatus, uint8_t);
- void OnEnrollmentFinished(device::CtapDeviceResponseCode);
+ void OnEnrollmentFinished(device::CtapDeviceResponseCode,
+ std::vector<uint8_t> template_id);
+ void OnHavePostEnrollmentEnumeration(
+ std::vector<uint8_t> enrolled_template_id,
+ device::CtapDeviceResponseCode code,
+ base::Optional<std::map<std::vector<uint8_t>, std::string>> enrollments);
void HandleDelete(const base::ListValue* args);
void OnDelete(device::CtapDeviceResponseCode);
+ void HandleRename(const base::ListValue* args);
+ void OnRename(device::CtapDeviceResponseCode);
+
void HandleCancel(const base::ListValue* args);
- void OnEnrollCancel(device::CtapDeviceResponseCode);
State state_ = State::kNone;
std::string callback_id_;
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_ui.cc b/chromium/chrome/browser/ui/webui/settings/settings_ui.cc
index 3ea47f5691e..374bc9896da 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_ui.cc
+++ b/chromium/chrome/browser/ui/webui/settings/settings_ui.cc
@@ -47,14 +47,15 @@
#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/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "chrome/grit/generated_resources.h"
#include "chrome/grit/settings_resources.h"
#include "chrome/grit/settings_resources_map.h"
#include "components/favicon_base/favicon_url_parser.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/pref_registry/pref_registry_syncable.h"
-#include "components/safe_browsing/buildflags.h"
#include "components/unified_consent/feature.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
@@ -83,6 +84,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/browser_process_platform_part.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"
@@ -93,6 +95,7 @@
#include "chrome/browser/chromeos/multidevice_setup/multidevice_setup_client_factory.h"
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
+#include "chrome/browser/ui/web_applications/system_web_app_ui_utils.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"
@@ -124,6 +127,7 @@
#include "chromeos/login/auth/password_visibility_utils.h"
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
#include "chromeos/services/network_config/public/mojom/constants.mojom.h" // nogncheck
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck
#include "components/arc/arc_util.h"
#include "components/prefs/pref_service.h"
#include "components/user_manager/user.h"
@@ -147,11 +151,6 @@
#include "chrome/browser/ui/webui/settings/printing_handler.h"
#endif
-#if BUILDFLAG(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 settings {
// static
void SettingsUI::RegisterProfilePrefs(
@@ -250,26 +249,20 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
std::make_unique<IncompatibleApplicationsHandler>());
#endif // OS_WIN && BUILDFLAG(GOOGLE_CHROME_BRANDING)
- bool password_protection_available = false;
-#if BUILDFLAG(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<ChangePasswordHandler>(profile, password_protection));
- }
-#endif
- html_source->AddBoolean("passwordProtectionAvailable",
- password_protection_available);
-
#if !defined(OS_CHROMEOS)
html_source->AddBoolean(
"diceEnabled",
AccountConsistencyModeManager::IsDiceEnabledForProfile(profile));
#endif // !defined(OS_CHROMEOS)
+ html_source->AddBoolean(
+ "a11yEnhancements",
+ base::FeatureList::IsEnabled(features::kWebUIA11yEnhancements));
+
+ html_source->AddBoolean(
+ "privacySettingsRedesignEnabled",
+ base::FeatureList::IsEnabled(features::kPrivacySettingsRedesign));
+
html_source->AddBoolean("unifiedConsentEnabled",
unified_consent::IsUnifiedConsentFeatureEnabled());
@@ -312,6 +305,8 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
if (web_app::SystemWebAppManager::IsEnabled()) {
html_source->AddResourcePath("icon-192.png", IDR_SETTINGS_LOGO_192);
html_source->AddResourcePath("pwa.html", IDR_PWA_HTML);
+ web_app::SetManifestRequestFilter(html_source, IDR_SETTINGS_MANIFEST,
+ IDS_SETTINGS_SETTINGS);
}
#endif // defined (OS_CHROMEOS)
@@ -322,9 +317,6 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
html_source->AddResourcePath("lazy_load.html",
IDR_SETTINGS_LAZY_LOAD_VULCANIZED_HTML);
html_source->SetDefaultResource(IDR_SETTINGS_VULCANIZED_HTML);
-#if defined(OS_CHROMEOS)
- html_source->AddResourcePath("manifest.json", IDR_SETTINGS_MANIFEST);
-#endif // defined (OS_CHROMEOS)
#else
// Add all settings resources.
for (size_t i = 0; i < kSettingsResourcesSize; ++i) {
@@ -334,7 +326,7 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML);
#endif
- AddLocalizedStrings(html_source, profile);
+ AddLocalizedStrings(html_source, profile, web_ui->GetWebContents());
ManagedUIHandler::Initialize(web_ui, html_source);
@@ -534,8 +526,9 @@ void SettingsUI::AddSettingsPageUIHandler(
#if defined(OS_CHROMEOS)
void SettingsUI::BindCrosNetworkConfig(
- chromeos::network_config::mojom::CrosNetworkConfigRequest request) {
- ash::GetNetworkConfigService(std::move(request));
+ mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig>
+ receiver) {
+ ash::GetNetworkConfigService(std::move(receiver));
}
#endif // defined(OS_CHROMEOS)
diff --git a/chromium/chrome/browser/ui/webui/settings/settings_ui.h b/chromium/chrome/browser/ui/webui/settings/settings_ui.h
index 16d535fe786..0353806fc15 100644
--- a/chromium/chrome/browser/ui/webui/settings/settings_ui.h
+++ b/chromium/chrome/browser/ui/webui/settings/settings_ui.h
@@ -10,7 +10,8 @@
#include "chrome/browser/ui/webui/webui_load_timer.h"
#if defined(OS_CHROMEOS)
-#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck
+#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h" // nogncheck
+#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
#else
#include "content/public/browser/web_ui_controller.h"
@@ -55,7 +56,8 @@ class SettingsUI
std::unique_ptr<content::WebUIMessageHandler> handler);
#if defined(OS_CHROMEOS)
void BindCrosNetworkConfig(
- chromeos::network_config::mojom::CrosNetworkConfigRequest request);
+ mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig>
+ receiver);
#endif
WebuiLoadTimer webui_load_timer_;
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 6318434a79a..69b90770924 100644
--- a/chromium/chrome/browser/ui/webui/settings/site_settings_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -41,7 +41,6 @@
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
-#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/browser/website_settings_registry.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/content_settings/core/common/content_settings_utils.h"
@@ -53,11 +52,11 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/origin_util.h"
-#include "content/public/common/page_zoom.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permissions_data.h"
+#include "third_party/blink/public/common/page/page_zoom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/text/bytes_formatting.h"
@@ -252,11 +251,11 @@ void ConvertSiteGroupMapToListValue(
origin_object.SetKey(
kHasPermissionSettings,
base::Value(base::Contains(origin_permission_set, origin)));
- origin_list.GetList().emplace_back(std::move(origin_object));
+ origin_list.Append(std::move(origin_object));
}
site_group.SetKey(kNumCookies, base::Value(0));
site_group.SetKey(kOriginList, std::move(origin_list));
- list_value->GetList().push_back(std::move(site_group));
+ list_value->Append(std::move(site_group));
}
}
@@ -311,8 +310,6 @@ void LogAllSitesAction(AllSitesAction action) {
SiteSettingsHandler::SiteSettingsHandler(Profile* profile)
: profile_(profile),
- observer_(this),
- chooser_observer_(this),
pref_change_registrar_(nullptr) {}
SiteSettingsHandler::~SiteSettingsHandler() {
@@ -1061,7 +1058,6 @@ void SiteSettingsHandler::HandleSetCategoryPermissionForPattern(
CHECK_EQ(5U, args->GetSize());
std::string primary_pattern_string;
CHECK(args->GetString(0, &primary_pattern_string));
- // TODO(dschuyler): Review whether |secondary_pattern_string| should be used.
std::string secondary_pattern_string;
CHECK(args->GetString(1, &secondary_pattern_string));
std::string type;
@@ -1272,7 +1268,7 @@ void SiteSettingsHandler::SendZoomLevels() {
// Calculate the zoom percent from the factor. Round up to the nearest whole
// number.
int zoom_percent = static_cast<int>(
- content::ZoomLevelToZoomFactor(zoom_level.zoom_level) * 100 + 0.5);
+ blink::PageZoomLevelToZoomFactor(zoom_level.zoom_level) * 100 + 0.5);
exception->SetString(kZoom, base::FormatPercent(zoom_percent));
exception->SetString(site_settings::kSource,
site_settings::SiteSettingSourceToString(
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 04848c7d698..ed0eafa76ae 100644
--- a/chromium/chrome/browser/ui/webui/settings/site_settings_handler.h
+++ b/chromium/chrome/browser/ui/webui/settings/site_settings_handler.h
@@ -15,12 +15,12 @@
#include "chrome/browser/permissions/chooser_context_base.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "components/content_settings/core/browser/content_settings_observer.h"
+#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ppapi/buildflags/buildflags.h"
-class HostContentSettingsMap;
class Profile;
class PrefChangeRegistrar;
@@ -254,11 +254,12 @@ class SiteSettingsHandler : public SettingsPageUIHandler,
std::string clearing_origin_;
// Change observer for content settings.
- ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_;
+ ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_{
+ this};
// Change observer for chooser permissions.
ScopedObserver<ChooserContextBase, ChooserContextBase::PermissionObserver>
- chooser_observer_;
+ chooser_observer_{this};
// Change observer for prefs.
std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
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 3d5fc205b3d..99fe6375c41 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
@@ -513,9 +513,9 @@ TEST_F(SiteSettingsHandlerTest, MAYBE_GetAllSites) {
base::ListValue get_all_sites_args;
get_all_sites_args.AppendString(kCallbackId);
base::Value category_list(base::Value::Type::LIST);
- category_list.GetList().emplace_back(kNotifications);
- category_list.GetList().emplace_back(kFlash);
- get_all_sites_args.GetList().push_back(std::move(category_list));
+ category_list.Append(kNotifications);
+ category_list.Append(kFlash);
+ get_all_sites_args.Append(std::move(category_list));
// Test all sites is empty when there are no preferences.
handler()->HandleGetAllSites(&get_all_sites_args);
@@ -527,7 +527,7 @@ TEST_F(SiteSettingsHandlerTest, MAYBE_GetAllSites) {
EXPECT_EQ(kCallbackId, data.arg1()->GetString());
ASSERT_TRUE(data.arg2()->GetBool());
- const base::Value::ListStorage& site_groups = data.arg3()->GetList();
+ base::span<const base::Value> site_groups = data.arg3()->GetList();
EXPECT_EQ(0UL, site_groups.size());
}
@@ -549,12 +549,12 @@ TEST_F(SiteSettingsHandlerTest, MAYBE_GetAllSites) {
EXPECT_EQ(kCallbackId, data.arg1()->GetString());
ASSERT_TRUE(data.arg2()->GetBool());
- const base::Value::ListStorage& site_groups = data.arg3()->GetList();
+ base::span<const base::Value> site_groups = data.arg3()->GetList();
EXPECT_EQ(1UL, site_groups.size());
for (const base::Value& site_group : site_groups) {
const std::string& etld_plus1_string =
site_group.FindKey("etldPlus1")->GetString();
- const base::Value::ListStorage& origin_list =
+ base::span<const base::Value> origin_list =
site_group.FindKey("origins")->GetList();
EXPECT_EQ("example.com", etld_plus1_string);
EXPECT_EQ(2UL, origin_list.size());
@@ -578,12 +578,12 @@ TEST_F(SiteSettingsHandlerTest, MAYBE_GetAllSites) {
EXPECT_EQ(kCallbackId, data.arg1()->GetString());
ASSERT_TRUE(data.arg2()->GetBool());
- const base::Value::ListStorage& site_groups = data.arg3()->GetList();
+ base::span<const base::Value> site_groups = data.arg3()->GetList();
EXPECT_EQ(2UL, site_groups.size());
for (const base::Value& site_group : site_groups) {
const std::string& etld_plus1_string =
site_group.FindKey("etldPlus1")->GetString();
- const base::Value::ListStorage& origin_list =
+ base::span<const base::Value> origin_list =
site_group.FindKey("origins")->GetList();
if (etld_plus1_string == "example2.net") {
EXPECT_EQ(1UL, origin_list.size());
@@ -617,7 +617,7 @@ TEST_F(SiteSettingsHandlerTest, MAYBE_GetAllSites) {
EXPECT_EQ(kCallbackId, data.arg1()->GetString());
ASSERT_TRUE(data.arg2()->GetBool());
- const base::Value::ListStorage& site_groups = data.arg3()->GetList();
+ base::span<const base::Value> site_groups = data.arg3()->GetList();
EXPECT_EQ(3UL, site_groups.size());
}
@@ -631,7 +631,7 @@ TEST_F(SiteSettingsHandlerTest, MAYBE_GetAllSites) {
EXPECT_EQ(kCallbackId, data.arg1()->GetString());
ASSERT_TRUE(data.arg2()->GetBool());
- const base::Value::ListStorage& site_groups = data.arg3()->GetList();
+ base::span<const base::Value> site_groups = data.arg3()->GetList();
EXPECT_EQ(2UL, site_groups.size());
EXPECT_EQ("example.com", site_groups[0].FindKey("etldPlus1")->GetString());
EXPECT_EQ("example2.net", site_groups[1].FindKey("etldPlus1")->GetString());
@@ -660,7 +660,7 @@ TEST_F(SiteSettingsHandlerTest, MAYBE_GetAllSites) {
EXPECT_EQ(kCallbackId, data.arg1()->GetString());
ASSERT_TRUE(data.arg2()->GetBool());
- const base::Value::ListStorage& site_groups = data.arg3()->GetList();
+ base::span<const base::Value> site_groups = data.arg3()->GetList();
EXPECT_EQ(2UL, site_groups.size());
EXPECT_EQ("example.com", site_groups[0].FindKey("etldPlus1")->GetString());
EXPECT_EQ("example2.net", site_groups[1].FindKey("etldPlus1")->GetString());
@@ -689,7 +689,7 @@ TEST_F(SiteSettingsHandlerTest, MAYBE_GetAllSites) {
EXPECT_EQ(kCallbackId, data.arg1()->GetString());
ASSERT_TRUE(data.arg2()->GetBool());
- const base::Value::ListStorage& site_groups = data.arg3()->GetList();
+ base::span<const base::Value> site_groups = data.arg3()->GetList();
EXPECT_EQ(2UL, site_groups.size());
EXPECT_EQ("example.com", site_groups[0].FindKey("etldPlus1")->GetString());
EXPECT_EQ("example2.net", site_groups[1].FindKey("etldPlus1")->GetString());
diff --git a/chromium/chrome/browser/ui/webui/settings/tts_handler.cc b/chromium/chrome/browser/ui/webui/settings/tts_handler.cc
index 605afeb6055..f17e4b3a742 100644
--- a/chromium/chrome/browser/ui/webui/settings/tts_handler.cc
+++ b/chromium/chrome/browser/ui/webui/settings/tts_handler.cc
@@ -66,7 +66,7 @@ void TtsHandler::HandleGetTtsExtensions(const base::ListValue* args) {
extensions::OptionsPageInfo::GetOptionsPage(extension).spec());
}
- responses.GetList().push_back(std::move(response));
+ responses.Append(std::move(response));
}
FireWebUIListener("tts-extensions-updated", responses);
@@ -100,7 +100,7 @@ void TtsHandler::OnVoicesChanged() {
response.SetString("fullLanguageCode", voice.lang);
response.SetInteger("languageScore", language_score);
response.SetString("extensionId", voice.engine_id);
- responses.GetList().push_back(std::move(response));
+ responses.Append(std::move(response));
}
AllowJavascript();
FireWebUIListener("all-voice-data-updated", responses);
@@ -139,7 +139,7 @@ void TtsHandler::HandlePreviewTtsVoice(const base::ListValue* args) {
json->GetString("name", &name);
json->GetString("extension", &extension_id);
- content::TtsUtterance* utterance =
+ std::unique_ptr<content::TtsUtterance> utterance =
content::TtsUtterance::Create((Profile::FromWebUI(web_ui())));
utterance->SetText(text);
utterance->SetVoiceName(name);
@@ -151,7 +151,7 @@ void TtsHandler::HandlePreviewTtsVoice(const base::ListValue* args) {
base::Value result(true /* preview started */);
FireWebUIListener("tts-preview-state-changed", result);
- content::TtsController::GetInstance()->SpeakOrEnqueue(utterance);
+ content::TtsController::GetInstance()->SpeakOrEnqueue(std::move(utterance));
}
void TtsHandler::RegisterMessages() {
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 0086f6c69f5..177391f3c3c 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
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
@@ -19,6 +20,8 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
+#include "chrome/browser/policy/policy_conversions.h"
+#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -31,6 +34,7 @@
#include "chrome/browser/unified_consent/unified_consent_service_factory.h"
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
#include "components/policy/core/browser/browser_policy_connector.h"
+#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/base/signin_metrics.h"
#include "components/signin/public/base/signin_pref_names.h"
@@ -72,7 +76,7 @@ class DiceTurnSyncOnHelperShutdownNotifierFactory
};
AccountInfo GetAccountInfo(signin::IdentityManager* identity_manager,
- const std::string& account_id) {
+ const CoreAccountId& account_id) {
auto maybe_account_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByAccountId(
@@ -104,7 +108,6 @@ class TokensLoadedCallbackRunner : public signin::IdentityManager::Observer {
KeyedServiceShutdownNotifier* shutdown_notifier,
base::OnceClosure callback)
: identity_manager_(identity_manager),
- scoped_identity_manager_observer_(this),
callback_(std::move(callback)),
shutdown_subscription_(shutdown_notifier->Subscribe(
base::Bind(&TokensLoadedCallbackRunner::OnShutdown,
@@ -122,11 +125,13 @@ class TokensLoadedCallbackRunner : public signin::IdentityManager::Observer {
void OnShutdown() { delete this; }
signin::IdentityManager* identity_manager_;
- ScopedObserver<signin::IdentityManager, TokensLoadedCallbackRunner>
- scoped_identity_manager_observer_;
+ ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
+ scoped_identity_manager_observer_{this};
base::OnceClosure callback_;
std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
shutdown_subscription_;
+
+ DISALLOW_COPY_AND_ASSIGN(TokensLoadedCallbackRunner);
};
} // namespace
@@ -136,7 +141,7 @@ DiceTurnSyncOnHelper::DiceTurnSyncOnHelper(
signin_metrics::AccessPoint signin_access_point,
signin_metrics::PromoAction signin_promo_action,
signin_metrics::Reason signin_reason,
- const std::string& account_id,
+ const CoreAccountId& account_id,
SigninAbortedMode signin_aborted_mode,
std::unique_ptr<Delegate> delegate,
base::OnceClosure callback)
@@ -199,7 +204,7 @@ DiceTurnSyncOnHelper::DiceTurnSyncOnHelper(
signin_metrics::AccessPoint signin_access_point,
signin_metrics::PromoAction signin_promo_action,
signin_metrics::Reason signin_reason,
- const std::string& account_id,
+ const CoreAccountId& account_id,
SigninAbortedMode signin_aborted_mode)
: DiceTurnSyncOnHelper(
profile,
@@ -346,17 +351,38 @@ void DiceTurnSyncOnHelper::OnPolicyFetchComplete(bool success) {
// PrimaryAccountMutator::ClearPrimaryAccount() here instead.
DLOG_IF(ERROR, !success) << "Error fetching policy for user";
DVLOG_IF(1, success) << "Policy fetch successful - completing signin";
+ if (VLOG_IS_ON(2)) {
+ // User cloud policies have been fetched from the server. Dump all policy
+ // values into log once these new policies are merged.
+ profile_->GetProfilePolicyConnector()
+ ->policy_service()
+ ->AddProviderUpdateObserver(this);
+ }
SigninAndShowSyncConfirmationUI();
}
+void DiceTurnSyncOnHelper::OnProviderUpdatePropagated(
+ policy::ConfigurationPolicyProvider* provider) {
+ if (provider != profile_->GetUserCloudPolicyManager())
+ return;
+ VLOG(2) << "Policies after sign in:";
+ VLOG(2) << policy::DictionaryPolicyConversions()
+ .WithBrowserContext(profile_)
+ .ToJSON();
+ profile_->GetProfilePolicyConnector()
+ ->policy_service()
+ ->RemoveProviderUpdateObserver(this);
+}
+
void DiceTurnSyncOnHelper::CreateNewSignedInProfile() {
// Create a new profile and have it call back when done so we can start the
// signin flow.
- size_t icon_index = g_browser_process->profile_manager()
- ->GetProfileAttributesStorage()
- .ChooseAvatarIconIndexForNewProfile();
+ ProfileAttributesStorage& storage =
+ g_browser_process->profile_manager()->GetProfileAttributesStorage();
+ size_t icon_index = storage.ChooseAvatarIconIndexForNewProfile();
+
ProfileManager::CreateMultiProfileAsync(
- base::UTF8ToUTF16(account_info_.email),
+ storage.ChooseNameForNewProfile(icon_index),
profiles::GetDefaultAvatarIconUrl(icon_index),
base::BindRepeating(&DiceTurnSyncOnHelper::OnNewProfileCreated,
weak_pointer_factory_.GetWeakPtr()));
@@ -490,7 +516,8 @@ void DiceTurnSyncOnHelper::FinishSyncSetupAndDelete(
case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: {
syncer::SyncService* sync_service = GetSyncService();
if (sync_service)
- sync_service->GetUserSettings()->SetFirstSetupComplete();
+ sync_service->GetUserSettings()->SetFirstSetupComplete(
+ syncer::SyncFirstSetupCompleteSource::BASIC_FLOW);
if (consent_service)
consent_service->SetUrlKeyedAnonymizedDataCollectionEnabled(true);
break;
diff --git a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
index 59e334ddc00..66f5dce0a9e 100644
--- a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
+++ b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
@@ -16,6 +16,7 @@
#include "chrome/browser/sync/sync_startup_tracker.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
+#include "components/policy/core/common/policy_service.h"
#include "components/signin/public/base/signin_metrics.h"
#include "components/signin/public/identity_manager/account_info.h"
@@ -32,7 +33,9 @@ class SyncSetupInProgressHandle;
// Handles details of setting the primary account with IdentityManager and
// turning on sync for an account for which there is already a refresh token.
-class DiceTurnSyncOnHelper : public SyncStartupTracker::Observer {
+class DiceTurnSyncOnHelper
+ : public SyncStartupTracker::Observer,
+ public policy::PolicyService::ProviderUpdateObserver {
public:
// Behavior when the signin is aborted (by an error or cancelled by the user).
enum class SigninAbortedMode {
@@ -99,7 +102,7 @@ class DiceTurnSyncOnHelper : public SyncStartupTracker::Observer {
signin_metrics::AccessPoint signin_access_point,
signin_metrics::PromoAction signin_promo_action,
signin_metrics::Reason signin_reason,
- const std::string& account_id,
+ const CoreAccountId& account_id,
SigninAbortedMode signin_aborted_mode,
std::unique_ptr<Delegate> delegate,
base::OnceClosure callback);
@@ -110,7 +113,7 @@ class DiceTurnSyncOnHelper : public SyncStartupTracker::Observer {
signin_metrics::AccessPoint signin_access_point,
signin_metrics::PromoAction signin_promo_action,
signin_metrics::Reason signin_reason,
- const std::string& account_id,
+ const CoreAccountId& account_id,
SigninAbortedMode signin_aborted_mode);
// SyncStartupTracker::Observer:
@@ -160,6 +163,10 @@ class DiceTurnSyncOnHelper : public SyncStartupTracker::Observer {
// true if policy was successfully fetched.
void OnPolicyFetchComplete(bool success);
+ // policy::PolicyService::ProviderUpdateObserver
+ void OnProviderUpdatePropagated(
+ policy::ConfigurationPolicyProvider* provider) override;
+
// Called to create a new profile, which is then signed in with the
// in-progress auth credentials currently stored in this object.
void CreateNewSignedInProfile();
diff --git a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.cc b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.cc
index 471ba9afc22..ab43eb03cb4 100644
--- a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.cc
+++ b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.cc
@@ -90,16 +90,15 @@ void DiceTurnSyncOnHelperDelegateImpl::SigninDialogDelegate::
DiceTurnSyncOnHelperDelegateImpl::DiceTurnSyncOnHelperDelegateImpl(
Browser* browser)
- : browser_(browser),
- profile_(browser_->profile()),
- scoped_browser_list_observer_(this),
- scoped_login_ui_service_observer_(this) {
+ : browser_(browser), profile_(browser_->profile()) {
DCHECK(browser);
DCHECK(profile_);
- scoped_browser_list_observer_.Add(BrowserList::GetInstance());
+ BrowserList::AddObserver(this);
}
-DiceTurnSyncOnHelperDelegateImpl::~DiceTurnSyncOnHelperDelegateImpl() {}
+DiceTurnSyncOnHelperDelegateImpl::~DiceTurnSyncOnHelperDelegateImpl() {
+ BrowserList::RemoveObserver(this);
+}
void DiceTurnSyncOnHelperDelegateImpl::ShowLoginError(
const std::string& email,
diff --git a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.h b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.h
index cbbce5c5e98..61406114b71 100644
--- a/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.h
+++ b/chromium/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_delegate_impl.h
@@ -14,7 +14,6 @@
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
class Browser;
-class BrowserList;
class Profile;
// Default implementation for DiceTurnSyncOnHelper::Delegate.
@@ -69,10 +68,8 @@ class DiceTurnSyncOnHelperDelegateImpl : public DiceTurnSyncOnHelper::Delegate,
Profile* profile_;
base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)>
sync_confirmation_callback_;
- ScopedObserver<BrowserList, BrowserListObserver>
- scoped_browser_list_observer_;
ScopedObserver<LoginUIService, LoginUIService::Observer>
- scoped_login_ui_service_observer_;
+ scoped_login_ui_service_observer_{this};
DISALLOW_COPY_AND_ASSIGN(DiceTurnSyncOnHelperDelegateImpl);
};
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 b3d39140ff4..c1b13af01e6 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
@@ -46,8 +46,6 @@
using ::testing::AtLeast;
using ::testing::Return;
-using namespace unified_consent;
-
class DiceTurnSyncOnHelperTestBase;
namespace {
@@ -103,10 +101,11 @@ class UnittestProfileManager : public ProfileManagerWithoutInit {
: ProfileManagerWithoutInit(user_data_dir) {}
protected:
- Profile* CreateProfileHelper(const base::FilePath& file_path) override {
- if (!base::PathExists(file_path) && !base::CreateDirectory(file_path))
+ std::unique_ptr<Profile> CreateProfileHelper(
+ const base::FilePath& path) override {
+ if (!base::PathExists(path) && !base::CreateDirectory(path))
return nullptr;
- return BuildTestingProfile(file_path, /*delegate=*/nullptr).release();
+ return BuildTestingProfile(path, /*delegate=*/nullptr);
}
std::unique_ptr<Profile> CreateProfileAsyncHelper(
@@ -140,7 +139,7 @@ class FakeUserPolicySigninService : public policy::UserPolicySigninService {
void set_dm_token(const std::string& dm_token) { dm_token_ = dm_token; }
void set_client_id(const std::string& client_id) { client_id_ = client_id; }
- void set_account(const std::string& account_id, const std::string& email) {
+ void set_account(const CoreAccountId& account_id, const std::string& email) {
account_id_ = account_id;
email_ = email;
}
@@ -148,7 +147,7 @@ class FakeUserPolicySigninService : public policy::UserPolicySigninService {
// policy::UserPolicySigninService:
void RegisterForPolicyWithAccountId(
const std::string& username,
- const std::string& account_id,
+ const CoreAccountId& account_id,
const PolicyRegistrationCallback& callback) override {
EXPECT_EQ(email_, username);
EXPECT_EQ(account_id_, account_id);
@@ -168,7 +167,7 @@ class FakeUserPolicySigninService : public policy::UserPolicySigninService {
private:
std::string dm_token_;
std::string client_id_;
- std::string account_id_;
+ CoreAccountId account_id_;
std::string email_;
};
@@ -237,7 +236,7 @@ class DiceTurnSyncOnHelperTestBase : public testing::Test {
signin::IdentityManager* identity_manager() {
return identity_test_env()->identity_manager();
}
- const std::string& account_id() { return account_id_; }
+ const CoreAccountId& account_id() { return account_id_; }
FakeUserPolicySigninService* user_policy_signin_service() {
return user_policy_signin_service_;
}
@@ -272,7 +271,7 @@ class DiceTurnSyncOnHelperTestBase : public testing::Test {
user_policy_signin_service_->set_account(account_id_, kEnterpriseEmail);
}
- void UseInvalidAccount() { account_id_ = "invalid_account"; }
+ void UseInvalidAccount() { account_id_ = CoreAccountId("invalid_account"); }
void SetExpectationsForSyncStartupCompleted() {
syncer::MockSyncService* mock_sync_service = GetMockSyncService();
@@ -408,7 +407,7 @@ class DiceTurnSyncOnHelperTestBase : public testing::Test {
content::BrowserTaskEnvironment task_environment_;
base::ScopedTempDir temp_dir_;
ScopedTestingLocalState local_state_;
- std::string account_id_;
+ CoreAccountId account_id_;
std::unique_ptr<TestingProfile> profile_;
std::unique_ptr<IdentityTestEnvironmentProfileAdaptor>
identity_test_env_profile_adaptor_;
@@ -442,12 +441,13 @@ class DiceTurnSyncOnHelperTestWithUnifiedConsent
: public DiceTurnSyncOnHelperTestBase {
public:
DiceTurnSyncOnHelperTestWithUnifiedConsent()
- : scoped_unified_consent_(UnifiedConsentFeatureState::kEnabled) {}
+ : scoped_unified_consent_(
+ unified_consent::UnifiedConsentFeatureState::kEnabled) {}
~DiceTurnSyncOnHelperTestWithUnifiedConsent() override {}
private:
ScopedAccountConsistencyDice scoped_dice_;
- ScopedUnifiedConsent scoped_unified_consent_;
+ unified_consent::ScopedUnifiedConsent scoped_unified_consent_;
};
// TestDiceTurnSyncOnHelperDelegate implementation.
@@ -654,8 +654,9 @@ TEST_F(DiceTurnSyncOnHelperTest, UndoSync) {
// Set expectations.
expected_sync_confirmation_shown_ = true;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
- SetFirstSetupComplete())
+ EXPECT_CALL(
+ *GetMockSyncService()->GetMockUserSettings(),
+ SetFirstSetupComplete(syncer::SyncFirstSetupCompleteSource::BASIC_FLOW))
.Times(0);
// Signin flow.
@@ -674,8 +675,9 @@ TEST_F(DiceTurnSyncOnHelperTest, ConfigureSync) {
expected_sync_confirmation_shown_ = true;
expected_sync_settings_shown_ = true;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
- SetFirstSetupComplete())
+ EXPECT_CALL(
+ *GetMockSyncService()->GetMockUserSettings(),
+ SetFirstSetupComplete(syncer::SyncFirstSetupCompleteSource::BASIC_FLOW))
.Times(0);
// Configure the test.
@@ -696,8 +698,9 @@ TEST_F(DiceTurnSyncOnHelperTest, StartSync) {
// Set expectations.
expected_sync_confirmation_shown_ = true;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
- SetFirstSetupComplete())
+ EXPECT_CALL(
+ *GetMockSyncService()->GetMockUserSettings(),
+ SetFirstSetupComplete(syncer::SyncFirstSetupCompleteSource::BASIC_FLOW))
.Times(1);
// Configure the test.
sync_confirmation_result_ = LoginUIService::SyncConfirmationUIClosedResult::
@@ -720,8 +723,9 @@ TEST_F(DiceTurnSyncOnHelperTest, ShowSyncDialogForEndConsumerAccount) {
sync_confirmation_result_ = LoginUIService::SyncConfirmationUIClosedResult::
SYNC_WITH_DEFAULT_SETTINGS;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
- SetFirstSetupComplete())
+ EXPECT_CALL(
+ *GetMockSyncService()->GetMockUserSettings(),
+ SetFirstSetupComplete(syncer::SyncFirstSetupCompleteSource::BASIC_FLOW))
.Times(1);
// Signin flow.
@@ -738,21 +742,23 @@ TEST_F(DiceTurnSyncOnHelperTest, ShowSyncDialogForEndConsumerAccount) {
// Tests that the user enabled unified consent,
TEST_F(DiceTurnSyncOnHelperTestWithUnifiedConsent,
ShowSyncDialogForEndConsumerAccount_UnifiedConsentEnabled) {
- ASSERT_TRUE(IsUnifiedConsentFeatureEnabled());
+ ASSERT_TRUE(unified_consent::IsUnifiedConsentFeatureEnabled());
// Set expectations.
expected_sync_confirmation_shown_ = true;
sync_confirmation_result_ = LoginUIService::SyncConfirmationUIClosedResult::
SYNC_WITH_DEFAULT_SETTINGS;
SetExpectationsForSyncStartupCompleted();
- EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
- SetFirstSetupComplete())
+ EXPECT_CALL(
+ *GetMockSyncService()->GetMockUserSettings(),
+ SetFirstSetupComplete(syncer::SyncFirstSetupCompleteSource::BASIC_FLOW))
.Times(1);
PrefService* pref_service = profile()->GetPrefs();
- std::unique_ptr<UrlKeyedDataCollectionConsentHelper>
- url_keyed_collection_helper = UrlKeyedDataCollectionConsentHelper::
- NewAnonymizedDataCollectionConsentHelper(
- pref_service,
- ProfileSyncServiceFactory::GetForProfile(profile()));
+ std::unique_ptr<unified_consent::UrlKeyedDataCollectionConsentHelper>
+ url_keyed_collection_helper =
+ unified_consent::UrlKeyedDataCollectionConsentHelper::
+ NewAnonymizedDataCollectionConsentHelper(
+ pref_service,
+ ProfileSyncServiceFactory::GetForProfile(profile()));
EXPECT_FALSE(url_keyed_collection_helper->IsEnabled());
// Signin flow.
@@ -792,8 +798,9 @@ TEST_F(DiceTurnSyncOnHelperTest,
// Simulate that sync startup has completed.
expected_sync_confirmation_shown_ = true;
- EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
- SetFirstSetupComplete())
+ EXPECT_CALL(
+ *GetMockSyncService()->GetMockUserSettings(),
+ SetFirstSetupComplete(syncer::SyncFirstSetupCompleteSource::BASIC_FLOW))
.Times(1);
sync_confirmation_result_ = LoginUIService::SyncConfirmationUIClosedResult::
SYNC_WITH_DEFAULT_SETTINGS;
@@ -826,8 +833,9 @@ TEST_F(DiceTurnSyncOnHelperTest,
// Simulate that sync startup has failed.
expected_sync_confirmation_shown_ = true;
- EXPECT_CALL(*GetMockSyncService()->GetMockUserSettings(),
- SetFirstSetupComplete())
+ EXPECT_CALL(
+ *GetMockSyncService()->GetMockUserSettings(),
+ SetFirstSetupComplete(syncer::SyncFirstSetupCompleteSource::BASIC_FLOW))
.Times(1);
sync_confirmation_result_ = LoginUIService::SyncConfirmationUIClosedResult::
SYNC_WITH_DEFAULT_SETTINGS;
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 fb483f45025..f370580c44b 100644
--- a/chromium/chrome/browser/ui/webui/signin/inline_login_handler.cc
+++ b/chromium/chrome/browser/ui/webui/signin/inline_login_handler.cc
@@ -32,6 +32,7 @@
#include "content/public/browser/web_ui.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/base/url_util.h"
+#include "services/network/public/mojom/cookie_manager.mojom.h"
const char kSignInPromoQueryKeyShowAccountManagement[] =
"showAccountManagement";
@@ -162,11 +163,9 @@ void InlineLoginHandler::HandleCompleteLoginMessage(
content::BrowserContext::GetStoragePartitionForSite(
contents->GetBrowserContext(), signin::GetSigninPartitionURL());
- net::CookieOptions cookie_options;
- cookie_options.set_include_httponly();
-
partition->GetCookieManagerForBrowserProcess()->GetCookieList(
- GaiaUrls::GetInstance()->gaia_url(), cookie_options,
+ GaiaUrls::GetInstance()->gaia_url(),
+ net::CookieOptions::MakeAllInclusive(),
base::BindOnce(&InlineLoginHandler::HandleCompleteLoginMessageWithCookies,
weak_ptr_factory_.GetWeakPtr(),
base::ListValue(args->GetList())));
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 a127593b60e..9deb43dc90f 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
@@ -11,6 +11,7 @@
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/webui/signin/inline_login_handler.h"
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 3f4e4878ee9..773b7d1a78b 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
@@ -9,9 +9,14 @@
#include "base/logging.h"
#include "base/macros.h"
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
#include "chrome/common/webui_url_constants.h"
+#include "chromeos/constants/chromeos_pref_names.h"
+#include "components/prefs/pref_service.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
+#include "google_apis/gaia/gaia_auth_util.h"
#include "net/base/url_util.h"
#include "ui/aura/window.h"
#include "ui/display/display.h"
@@ -27,6 +32,12 @@ InlineLoginHandlerDialogChromeOS* dialog = nullptr;
constexpr int kSigninDialogWidth = 768;
constexpr int kSigninDialogHeight = 640;
+bool IsDeviceAccountEmail(const std::string& email) {
+ auto* active_user = user_manager::UserManager::Get()->GetActiveUser();
+ return active_user &&
+ gaia::AreEmailsSame(active_user->GetDisplayEmail(), email);
+}
+
} // namespace
// static
@@ -36,10 +47,20 @@ void InlineLoginHandlerDialogChromeOS::Show(const std::string& email) {
return;
}
- GURL url(chrome::kChromeUIChromeSigninURL);
- if (!email.empty()) {
- url = net::AppendQueryParameter(url, "email", email);
- url = net::AppendQueryParameter(url, "readOnlyEmail", "true");
+ GURL url;
+ if (ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean(
+ chromeos::prefs::kSecondaryGoogleAccountSigninAllowed) ||
+ IsDeviceAccountEmail(email)) {
+ // Addition of secondary Google Accounts is allowed OR it's a primary
+ // account re-auth.
+ url = GURL(chrome::kChromeUIChromeSigninURL);
+ if (!email.empty()) {
+ url = net::AppendQueryParameter(url, "email", email);
+ url = net::AppendQueryParameter(url, "readOnlyEmail", "true");
+ }
+ } else {
+ // Addition of secondary Google Accounts is not allowed.
+ url = GURL(chrome::kChromeUIAccountManagerErrorURL);
}
// Will be deleted by |SystemWebDialogDelegate::OnDialogClosed|.
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 08092d21e0c..2b8e201ce88 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
@@ -448,7 +448,7 @@ void InlineSigninHelper::CreateSyncStarter(const std::string& refresh_token) {
}
Browser* browser = chrome::FindLastActiveWithProfile(profile_);
- std::string account_id =
+ CoreAccountId account_id =
identity_manager->GetAccountsMutator()->AddOrUpdateAccount(
gaia_id_, email_, refresh_token,
/*is_under_advanced_protection=*/false,
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 a32321ef2ed..ed915c86e1c 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
@@ -298,7 +298,7 @@ bool SignInWithUI(Browser* browser,
return false;
#else
SignInObserver signin_observer;
- ScopedObserver<signin::IdentityManager, SignInObserver>
+ ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
scoped_signin_observer(&signin_observer);
scoped_signin_observer.Add(
IdentityManagerFactory::GetForProfile(browser->profile()));
diff --git a/chromium/chrome/browser/ui/webui/signin/signin_email_confirmation_ui.cc b/chromium/chrome/browser/ui/webui/signin/signin_email_confirmation_ui.cc
index fbdc4b44378..b8bf3ffe9b6 100644
--- a/chromium/chrome/browser/ui/webui/signin/signin_email_confirmation_ui.cc
+++ b/chromium/chrome/browser/ui/webui/signin/signin_email_confirmation_ui.cc
@@ -27,7 +27,8 @@ SigninEmailConfirmationUI::SigninEmailConfirmationUI(content::WebUI* web_ui)
source->SetDefaultResource(IDR_SIGNIN_EMAIL_CONFIRMATION_HTML);
source->AddResourcePath("signin_email_confirmation.js",
IDR_SIGNIN_EMAIL_CONFIRMATION_JS);
- source->AddResourcePath("signin_shared_css.html", IDR_SIGNIN_SHARED_CSS_HTML);
+ source->AddResourcePath("signin_shared_old_css.html",
+ IDR_SIGNIN_SHARED_OLD_CSS_HTML);
static constexpr LocalizedString kStrings[] = {
{"signinEmailConfirmationTitle", IDS_SIGNIN_EMAIL_CONFIRMATION_TITLE},
diff --git a/chromium/chrome/browser/ui/webui/signin/signin_error_ui.cc b/chromium/chrome/browser/ui/webui/signin/signin_error_ui.cc
index 5a6f3effed4..cef433977bc 100644
--- a/chromium/chrome/browser/ui/webui/signin/signin_error_ui.cc
+++ b/chromium/chrome/browser/ui/webui/signin/signin_error_ui.cc
@@ -69,7 +69,8 @@ void SigninErrorUI::Initialize(Browser* browser, bool is_system_profile) {
source->UseStringsJs();
source->SetDefaultResource(IDR_SIGNIN_ERROR_HTML);
source->AddResourcePath("signin_error.js", IDR_SIGNIN_ERROR_JS);
- source->AddResourcePath("signin_shared_css.html", IDR_SIGNIN_SHARED_CSS_HTML);
+ source->AddResourcePath("signin_shared_old_css.html",
+ IDR_SIGNIN_SHARED_OLD_CSS_HTML);
source->AddBoolean("isSystemProfile", is_system_profile);
// Retrieve the last signin error message and email used.
@@ -132,6 +133,9 @@ void SigninErrorUI::Initialize(Browser* browser, bool is_system_profile) {
.GetAllProfilesAttributes();
DCHECK(!email.empty());
for (const ProfileAttributesEntry* entry : entries) {
+ if (!entry->IsAuthenticated())
+ continue;
+
if (gaia::AreEmailsSame(base::UTF16ToUTF8(email),
base::UTF16ToUTF8(entry->GetUserName()))) {
handler->set_duplicate_profile_path(entry->GetPath());
diff --git a/chromium/chrome/browser/ui/webui/signin/signin_utils_desktop.cc b/chromium/chrome/browser/ui/webui/signin/signin_utils_desktop.cc
index 80d414cc9a3..9352d9826af 100644
--- a/chromium/chrome/browser/ui/webui/signin/signin_utils_desktop.cc
+++ b/chromium/chrome/browser/ui/webui/signin/signin_utils_desktop.cc
@@ -85,6 +85,9 @@ bool CanOfferSignin(Profile* profile,
.GetAllProfilesAttributes();
for (const ProfileAttributesEntry* entry : entries) {
+ if (!entry->IsAuthenticated())
+ continue;
+
// For backward compatibility, need to check also the username of the
// profile, since the GAIA ID may not have been set yet in the
// ProfileAttributesStorage. It will be set once the profile
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 2ae8e584e01..841ba4a67ac 100644
--- a/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
+++ b/chromium/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
@@ -117,7 +117,7 @@ void SyncConfirmationHandler::HandleAccountImageRequest(
void SyncConfirmationHandler::RecordConsent(const base::ListValue* args) {
CHECK_EQ(2U, args->GetSize());
- const std::vector<base::Value>& consent_description =
+ base::span<const base::Value> consent_description =
args->GetList()[0].GetList();
const std::string& consent_confirmation = args->GetList()[1].GetString();
@@ -211,6 +211,8 @@ void SyncConfirmationHandler::CloseModalSigninWindow(
void SyncConfirmationHandler::HandleInitializedWithSize(
const base::ListValue* args) {
+ AllowJavascript();
+
if (!browser_)
return;
@@ -237,5 +239,5 @@ void SyncConfirmationHandler::HandleInitializedWithSize(
// TODO(anthonyvd): Figure out why this is needed on Mac and not other
// platforms and if there's a way to start unfocused while avoiding this
// workaround.
- web_ui()->CallJavascriptFunctionUnsafe("sync.confirmation.clearFocus");
+ FireWebUIListener("clear-focus");
}
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 a38f485d26e..635e26153b6 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
@@ -225,8 +225,9 @@ TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReady) {
handler()->HandleInitializedWithSize(&args);
ExpectAccountImageChanged(*web_ui()->call_data()[0]);
- EXPECT_EQ("sync.confirmation.clearFocus",
+ EXPECT_EQ("cr.webUIListenerCallback",
web_ui()->call_data()[1]->function_name());
+ EXPECT_EQ("clear-focus", web_ui()->call_data()[1]->arg1()->GetString());
}
TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReadyLater) {
@@ -236,8 +237,9 @@ TEST_F(SyncConfirmationHandlerTest, TestSetImageIfPrimaryAccountReadyLater) {
EXPECT_EQ(2U, web_ui()->call_data().size());
ExpectAccountImageChanged(*web_ui()->call_data()[0]);
- EXPECT_EQ("sync.confirmation.clearFocus",
+ EXPECT_EQ("cr.webUIListenerCallback",
web_ui()->call_data()[1]->function_name());
+ EXPECT_EQ("clear-focus", web_ui()->call_data()[1]->arg1()->GetString());
identity_test_env()->SimulateSuccessfulFetchOfAccountInfo(
account_info_.account_id, account_info_.email, account_info_.gaia, "",
@@ -293,11 +295,11 @@ TEST_F(SyncConfirmationHandlerTest, TestHandleUndo) {
TEST_F(SyncConfirmationHandlerTest, TestHandleConfirm) {
// The consent description consists of strings 1, 2, and 4.
base::ListValue consent_description;
- consent_description.GetList().push_back(
+ consent_description.Append(
base::Value(SyncConfirmationHandlerTest::kConsentText1));
- consent_description.GetList().push_back(
+ consent_description.Append(
base::Value(SyncConfirmationHandlerTest::kConsentText2));
- consent_description.GetList().push_back(
+ consent_description.Append(
base::Value(SyncConfirmationHandlerTest::kConsentText4));
// The consent confirmation contains string 5.
@@ -305,8 +307,8 @@ TEST_F(SyncConfirmationHandlerTest, TestHandleConfirm) {
// These are passed as parameters to HandleConfirm().
base::ListValue args;
- args.GetList().push_back(std::move(consent_description));
- args.GetList().push_back(std::move(consent_confirmation));
+ args.Append(std::move(consent_description));
+ args.Append(std::move(consent_confirmation));
handler()->HandleConfirm(&args);
did_user_explicitly_interact = true;
@@ -334,11 +336,11 @@ TEST_F(SyncConfirmationHandlerTest, TestHandleConfirm) {
TEST_F(SyncConfirmationHandlerTest, TestHandleConfirmWithAdvancedSyncSettings) {
// The consent description consists of strings 2, 3, and 5.
base::ListValue consent_description;
- consent_description.GetList().push_back(
+ consent_description.Append(
base::Value(SyncConfirmationHandlerTest::kConsentText2));
- consent_description.GetList().push_back(
+ consent_description.Append(
base::Value(SyncConfirmationHandlerTest::kConsentText3));
- consent_description.GetList().push_back(
+ consent_description.Append(
base::Value(SyncConfirmationHandlerTest::kConsentText5));
// The consent confirmation contains string 2.
@@ -346,8 +348,8 @@ TEST_F(SyncConfirmationHandlerTest, TestHandleConfirmWithAdvancedSyncSettings) {
// These are passed as parameters to HandleGoToSettings().
base::ListValue args;
- args.GetList().push_back(std::move(consent_description));
- args.GetList().push_back(std::move(consent_confirmation));
+ args.Append(std::move(consent_description));
+ args.Append(std::move(consent_confirmation));
handler()->HandleGoToSettings(&args);
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 233b67c2b9d..ba5d2d29219 100644
--- a/chromium/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
+++ b/chromium/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
@@ -24,6 +24,7 @@
#include "content/public/browser/web_ui_data_source.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
+#include "ui/resources/grit/webui_resources.h"
SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
: SigninWebDialogUI(web_ui) {
@@ -34,20 +35,29 @@ SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUISyncConfirmationHost);
source->UseStringsJs();
- source->AddResourcePath("signin_shared_css.html", IDR_SIGNIN_SHARED_CSS_HTML);
+ source->EnableReplaceI18nInJS();
if (is_sync_allowed) {
+ source->AddResourcePath("test_loader.js", IDR_WEBUI_JS_TEST_LOADER);
+ source->AddResourcePath("test_loader.html", IDR_WEBUI_HTML_TEST_LOADER);
+ source->OverrideContentSecurityPolicyScriptSrc(
+ "script-src chrome://resources chrome://test 'self';");
+
source->SetDefaultResource(IDR_SYNC_CONFIRMATION_HTML);
- source->AddResourcePath("sync_confirmation_browser_proxy.html",
- IDR_SYNC_CONFIRMATION_BROWSER_PROXY_HTML);
+ source->AddResourcePath("signin_shared_css.js", IDR_SIGNIN_SHARED_CSS_JS);
source->AddResourcePath("sync_confirmation_browser_proxy.js",
IDR_SYNC_CONFIRMATION_BROWSER_PROXY_JS);
- source->AddResourcePath("sync_confirmation_app.html",
- IDR_SYNC_CONFIRMATION_APP_HTML);
source->AddResourcePath("sync_confirmation_app.js",
IDR_SYNC_CONFIRMATION_APP_JS);
source->AddResourcePath("sync_confirmation.js", IDR_SYNC_CONFIRMATION_JS);
+ source->AddResourcePath(
+ "images/sync_confirmation_illustration.svg",
+ IDR_SYNC_CONFIRMATION_IMAGES_SYNC_CONFIRMATION_ILLUSTRATION_SVG);
+ source->AddResourcePath(
+ "images/sync_confirmation_illustration_dark.svg",
+ IDR_SYNC_CONFIRMATION_IMAGES_SYNC_CONFIRMATION_ILLUSTRATION_DARK_SVG);
+
AddStringResource(source, "syncConfirmationTitle",
IDS_SYNC_CONFIRMATION_TITLE);
AddStringResource(source, "syncConfirmationSyncInfoTitle",
@@ -81,6 +91,8 @@ SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
source->AddString("accountPictureUrl", custom_picture_url);
} else {
source->SetDefaultResource(IDR_SYNC_DISABLED_CONFIRMATION_HTML);
+ source->AddResourcePath("signin_shared_old_css.html",
+ IDR_SIGNIN_SHARED_OLD_CSS_HTML);
source->AddResourcePath("sync_disabled_confirmation.js",
IDR_SYNC_DISABLED_CONFIRMATION_JS);
diff --git a/chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.h b/chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.h
index 0e405c571b0..87dc7337a26 100644
--- a/chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.h
+++ b/chromium/chrome/browser/ui/webui/signin/user_manager_screen_handler.h
@@ -69,7 +69,6 @@ class UserManagerScreenHandler : public content::WebUIMessageHandler,
void HandleRemoveUser(const base::ListValue* args);
void HandleAreAllProfilesLocked(const base::ListValue* args);
void HandleRemoveUserWarningLoadStats(const base::ListValue* args);
- void HandleGetRemoveWarningDialogMessage(const base::ListValue* args);
// Function used to gather statistics from a profile.
void GatherStatistics(base::Time start_time, Profile* profile);
diff --git a/chromium/chrome/browser/ui/webui/site_settings_helper.cc b/chromium/chrome/browser/ui/webui/site_settings_helper.cc
index 3430d836de6..0cacb0bdfd0 100644
--- a/chromium/chrome/browser/ui/webui/site_settings_helper.cc
+++ b/chromium/chrome/browser/ui/webui/site_settings_helper.cc
@@ -92,13 +92,13 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
{CONTENT_SETTINGS_TYPE_HID_CHOOSER_DATA, kHidChooserDataGroupType},
{CONTENT_SETTINGS_TYPE_NATIVE_FILE_SYSTEM_WRITE_GUARD,
"native-file-system-write"},
+ {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, "mixed-script"},
// Add new content settings here if a corresponding Javascript string
// representation for it is not required. Note some exceptions do have UI in
// Content Settings but do not require a separate string.
{CONTENT_SETTINGS_TYPE_DEFAULT, nullptr},
{CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, nullptr},
- {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, nullptr},
{CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, nullptr},
{CONTENT_SETTINGS_TYPE_APP_BANNER, nullptr},
{CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, nullptr},
@@ -658,7 +658,7 @@ base::Value CreateChooserExceptionObject(
base::Value sites(base::Value::Type::LIST);
for (auto& one_provider_sites : all_provider_sites) {
for (auto& site : one_provider_sites) {
- sites.GetList().push_back(std::move(site));
+ sites.Append(std::move(site));
}
}
@@ -712,7 +712,7 @@ base::Value GetChooserExceptionListFromProfile(
const base::Value& object = all_chooser_objects_entry.first.second;
const ChooserExceptionDetails& chooser_exception_details =
all_chooser_objects_entry.second;
- exceptions.GetList().push_back(CreateChooserExceptionObject(
+ exceptions.Append(CreateChooserExceptionObject(
name, object, chooser_type.name, chooser_exception_details));
}
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 1ce7954869d..4f37896e8d9 100644
--- a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom
+++ b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom
@@ -26,7 +26,8 @@ struct SuggestionItem {
};
interface PageHandlerFactory {
- CreatePageHandler(Page page) => (PageHandler handler);
+ CreatePageHandler(pending_remote<Page> page) =>
+ (pending_remote<PageHandler> handler);
};
// Browser interface.
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 2bcda35f859..46a0bbcd778 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
@@ -15,6 +15,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom.h"
#include "chrome/common/pref_names.h"
#include "components/ntp_snippets/category_info.h"
#include "components/ntp_snippets/features.h"
@@ -106,11 +107,11 @@ snippets_internals::mojom::SuggestionItemPtr PrepareContentSuggestionItem(
// TODO: Add browser tests.
SnippetsInternalsPageHandler::SnippetsInternalsPageHandler(
- snippets_internals::mojom::PageHandlerRequest request,
- snippets_internals::mojom::PagePtr page,
+ mojo::PendingReceiver<snippets_internals::mojom::PageHandler> receiver,
+ mojo::PendingRemote<snippets_internals::mojom::Page> page,
ntp_snippets::ContentSuggestionsService* content_suggestions_service,
PrefService* pref_service)
- : binding_(this, std::move(request)),
+ : receiver_(this, std::move(receiver)),
content_suggestions_service_observer_(this),
content_suggestions_service_(content_suggestions_service),
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 7702050a60e..bf02e04c414 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
@@ -15,7 +15,10 @@
#include "components/ntp_snippets/content_suggestions_service.h"
#include "components/ntp_snippets/remote/remote_suggestions_provider.h"
#include "components/prefs/pref_service.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
// TODO: Write tests for this.
class SnippetsInternalsPageHandler
@@ -23,8 +26,8 @@ class SnippetsInternalsPageHandler
public ntp_snippets::ContentSuggestionsService::Observer {
public:
explicit SnippetsInternalsPageHandler(
- snippets_internals::mojom::PageHandlerRequest request,
- snippets_internals::mojom::PagePtr,
+ mojo::PendingReceiver<snippets_internals::mojom::PageHandler> receiver,
+ mojo::PendingRemote<snippets_internals::mojom::Page> page,
ntp_snippets::ContentSuggestionsService* content_suggestions_service,
PrefService* pref_service);
~SnippetsInternalsPageHandler() override;
@@ -67,8 +70,8 @@ class SnippetsInternalsPageHandler
GetSuggestionsByCategoryCallback callback,
std::vector<ntp_snippets::ContentSuggestion> suggestions);
- // Binding from the mojo interface to concrete impl.
- mojo::Binding<snippets_internals::mojom::PageHandler> binding_;
+ // Receiver from the mojo interface to concrete impl.
+ mojo::Receiver<snippets_internals::mojom::PageHandler> receiver_;
// Observer to notify frontend of dirty data.
ScopedObserver<ntp_snippets::ContentSuggestionsService,
@@ -90,7 +93,7 @@ class SnippetsInternalsPageHandler
base::OneShotTimer suggestion_fetch_timer_;
// Handle back to the page by which we can update.
- snippets_internals::mojom::PagePtr page_;
+ mojo::Remote<snippets_internals::mojom::Page> page_;
base::WeakPtrFactory<SnippetsInternalsPageHandler> weak_ptr_factory_{this};
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 89f723083ee..7df14607805 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
@@ -4,20 +4,25 @@
#include "chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.h"
+#include <memory>
+#include <utility>
+
#include "base/bind.h"
#include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom.h"
#include "chrome/browser/ui/webui/snippets_internals/snippets_internals_page_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#if defined(OS_ANDROID)
#include "chrome/browser/android/chrome_feature_list.h"
#endif
SnippetsInternalsUI::SnippetsInternalsUI(content::WebUI* web_ui)
- : ui::MojoWebUIController(web_ui), binding_(this) {
+ : ui::MojoWebUIController(web_ui) {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUISnippetsInternalsHost);
source->OverrideContentSecurityPolicyScriptSrc(
@@ -41,20 +46,20 @@ SnippetsInternalsUI::SnippetsInternalsUI(content::WebUI* web_ui)
SnippetsInternalsUI::~SnippetsInternalsUI() {}
void SnippetsInternalsUI::BindSnippetsInternalsPageHandlerFactory(
- snippets_internals::mojom::PageHandlerFactoryRequest request) {
- if (binding_.is_bound())
- binding_.Unbind();
+ mojo::PendingReceiver<snippets_internals::mojom::PageHandlerFactory>
+ receiver) {
+ receiver_.reset();
- binding_.Bind(std::move(request));
+ receiver_.Bind(std::move(receiver));
}
void SnippetsInternalsUI::CreatePageHandler(
- snippets_internals::mojom::PagePtr page,
+ mojo::PendingRemote<snippets_internals::mojom::Page> page,
CreatePageHandlerCallback callback) {
DCHECK(page);
- snippets_internals::mojom::PageHandlerPtr handler;
+ mojo::PendingRemote<snippets_internals::mojom::PageHandler> handler;
page_handler_ = std::make_unique<SnippetsInternalsPageHandler>(
- mojo::MakeRequest(&handler), std::move(page),
+ handler.InitWithNewPipeAndPassReceiver(), std::move(page),
content_suggestions_service_, pref_service_);
std::move(callback).Run(std::move(handler));
diff --git a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.h b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.h
index 6ed63699616..524b74fe032 100644
--- a/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.h
+++ b/chromium/chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.h
@@ -10,7 +10,9 @@
#include "chrome/browser/ui/webui/snippets_internals/snippets_internals.mojom.h"
#include "components/ntp_snippets/content_suggestions_service.h"
#include "components/prefs/pref_service.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
class SnippetsInternalsPageHandler;
@@ -23,19 +25,21 @@ class SnippetsInternalsUI
explicit SnippetsInternalsUI(content::WebUI* web_ui);
~SnippetsInternalsUI() override;
- void CreatePageHandler(snippets_internals::mojom::PagePtr page,
- CreatePageHandlerCallback callback) override;
+ void CreatePageHandler(
+ mojo::PendingRemote<snippets_internals::mojom::Page> page,
+ CreatePageHandlerCallback callback) override;
private:
void BindSnippetsInternalsPageHandlerFactory(
- snippets_internals::mojom::PageHandlerFactoryRequest request);
+ mojo::PendingReceiver<snippets_internals::mojom::PageHandlerFactory>
+ receiver);
std::unique_ptr<SnippetsInternalsPageHandler> page_handler_;
ntp_snippets::ContentSuggestionsService* content_suggestions_service_;
PrefService* pref_service_;
- // Binding from the mojo interface to concrete impl.
- mojo::Binding<snippets_internals::mojom::PageHandlerFactory> binding_;
+ // Receiver from the mojo interface to concrete impl.
+ mojo::Receiver<snippets_internals::mojom::PageHandlerFactory> receiver_{this};
DISALLOW_COPY_AND_ASSIGN(SnippetsInternalsUI);
};
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 be07aad14bc..e2f74452ace 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
@@ -15,10 +15,10 @@
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
#include "chrome/browser/supervised_user/supervised_user_error_page/supervised_user_error_page.h"
-#include "chrome/browser/supervised_user/supervised_user_service.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/browser/supervised_user/supervised_user_settings_service.h"
#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h"
@@ -117,12 +117,11 @@ std::string FilteringBehaviorReasonToString(
} // namespace
-SupervisedUserInternalsMessageHandler::SupervisedUserInternalsMessageHandler()
- : scoped_observer_(this) {}
+SupervisedUserInternalsMessageHandler::SupervisedUserInternalsMessageHandler() =
+ default;
SupervisedUserInternalsMessageHandler::
- ~SupervisedUserInternalsMessageHandler() {
-}
+ ~SupervisedUserInternalsMessageHandler() = default;
void SupervisedUserInternalsMessageHandler::RegisterMessages() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -193,8 +192,6 @@ void SupervisedUserInternalsMessageHandler::SendBasicInfo() {
std::unique_ptr<base::ListValue> section_list(new base::ListValue);
base::ListValue* section_general = AddSection(section_list.get(), "General");
- AddSectionEntry(section_general, "Chrome version",
- chrome::GetVersionString());
AddSectionEntry(section_general, "Child detection enabled",
ChildAccountService::IsChildAccountDetectionEnabled());
diff --git a/chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.h b/chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.h
index f257eaac9ec..619b580ba1d 100644
--- a/chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.h
+++ b/chromium/chrome/browser/ui/webui/supervised_user_internals_message_handler.h
@@ -10,6 +10,7 @@
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "chrome/browser/supervised_user/supervised_user_error_page/supervised_user_error_page.h"
+#include "chrome/browser/supervised_user/supervised_user_service.h"
#include "chrome/browser/supervised_user/supervised_user_service_observer.h"
#include "chrome/browser/supervised_user/supervised_user_url_filter.h"
#include "content/public/browser/web_ui_message_handler.h"
@@ -18,8 +19,6 @@ namespace base {
class ListValue;
} // namespace base
-class SupervisedUserService;
-
// The implementation for the chrome://supervised-user-internals page.
class SupervisedUserInternalsMessageHandler
: public content::WebUIMessageHandler,
@@ -63,7 +62,7 @@ class SupervisedUserInternalsMessageHandler
user_settings_subscription_;
ScopedObserver<SupervisedUserURLFilter, SupervisedUserURLFilter::Observer>
- scoped_observer_;
+ scoped_observer_{this};
base::WeakPtrFactory<SupervisedUserInternalsMessageHandler> weak_factory_{
this};
diff --git a/chromium/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc b/chromium/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc
index d21278ee6f6..678c7cf9822 100644
--- a/chromium/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc
+++ b/chromium/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc
@@ -52,7 +52,7 @@ void ConvertExtensionStatusToDictionary(
// Join with human readable extension name.
const extensions::Extension* extension =
extension_registry->GetExtensionById(
- extension_id, extensions::ExtensionRegistry::COMPATIBILITY);
+ extension_id, extensions::ExtensionRegistry::EVERYTHING);
if (!extension)
continue;
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 69dc7e8f23e..40880e73df6 100644
--- a/chromium/chrome/browser/ui/webui/sync_internals_message_handler.cc
+++ b/chromium/chrome/browser/ui/webui/sync_internals_message_handler.cc
@@ -311,7 +311,8 @@ void SyncInternalsMessageHandler::HandleRequestStart(
// If the service was previously stopped via StopAndClear(), then the
// "first-setup-complete" bit was also cleared, and now the service wouldn't
// fully start up. So set that too.
- service->GetUserSettings()->SetFirstSetupComplete();
+ service->GetUserSettings()->SetFirstSetupComplete(
+ syncer::SyncFirstSetupCompleteSource::BASIC_FLOW);
}
void SyncInternalsMessageHandler::HandleRequestStopKeepData(
diff --git a/chromium/chrome/browser/ui/webui/sync_internals_ui.cc b/chromium/chrome/browser/ui/webui/sync_internals_ui.cc
index d4d18359242..ed5f6af5ed0 100644
--- a/chromium/chrome/browser/ui/webui/sync_internals_ui.cc
+++ b/chromium/chrome/browser/ui/webui/sync_internals_ui.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/sync_internals_message_handler.h"
#include "chrome/common/url_constants.h"
-#include "components/grit/components_resources.h"
+#include "components/grit/sync_driver_resources.h"
#include "components/sync/driver/about_sync_util.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
diff --git a/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.cc b/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.cc
index f294f8d2890..98fa0fb51e5 100644
--- a/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.cc
+++ b/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.cc
@@ -10,26 +10,43 @@
#include <vector>
#include "base/base64.h"
+#include "base/bind.h"
+#include "base/strings/string_piece.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_tab_util.h"
+#include "chrome/browser/favicon/favicon_utils.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/themes/theme_properties.h"
+#include "chrome/browser/themes/theme_service.h"
+#include "chrome/browser/themes/theme_service_factory.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/tabs/tab_menu_model.h"
+#include "chrome/browser/ui/tabs/tab_network_state.h"
+#include "chrome/browser/ui/tabs/tab_renderer_data.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/webui/favicon_source.h"
+#include "chrome/browser/ui/webui/theme_handler.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/tab_strip_resources.h"
#include "chrome/grit/tab_strip_resources_map.h"
#include "components/favicon_base/favicon_url_parser.h"
+#include "content/public/browser/favicon_status.h"
+#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "third_party/skia/include/core/SkImageEncoder.h"
#include "third_party/skia/include/core/SkStream.h"
+#include "ui/base/models/simple_menu_model.h"
+#include "ui/base/theme_provider.h"
+#include "ui/gfx/color_utils.h"
+#include "ui/gfx/geometry/point_conversions.h"
namespace {
// Writes bytes to a std::vector that can be fetched. This is used to record the
// output of skia image encoding.
-//
-// TODO(crbug.com/991393): remove this when we no longer transcode images here.
class BufferWStream : public SkWStream {
public:
BufferWStream() = default;
@@ -51,25 +68,279 @@ class BufferWStream : public SkWStream {
std::vector<unsigned char> result_;
};
-class TabStripUIHandler : public content::WebUIMessageHandler {
+std::string MakeDataURIForImage(base::span<const uint8_t> image_data,
+ base::StringPiece mime_subtype) {
+ std::string result = "data:image/";
+ result.append(mime_subtype.begin(), mime_subtype.end());
+ result += ";base64,";
+ result += base::Base64Encode(image_data);
+ return result;
+}
+
+std::string EncodePNGAndMakeDataURI(gfx::ImageSkia image, float scale_factor) {
+ const SkBitmap& bitmap = image.GetRepresentation(scale_factor).GetBitmap();
+ BufferWStream stream;
+ const bool encoding_succeeded =
+ SkEncodeImage(&stream, bitmap, SkEncodedImageFormat::kPNG, 100);
+ DCHECK(encoding_succeeded);
+ return MakeDataURIForImage(
+ base::as_bytes(base::make_span(stream.GetBuffer())), "png");
+}
+
+class WebUITabContextMenu : public ui::SimpleMenuModel::Delegate,
+ public TabMenuModel {
+ public:
+ WebUITabContextMenu(TabStripModel* tab_strip_model, int tab_index)
+ : TabMenuModel(this, tab_strip_model, tab_index),
+ tab_strip_model_(tab_strip_model),
+ tab_index_(tab_index) {}
+ ~WebUITabContextMenu() override = default;
+
+ void ExecuteCommand(int command_id, int event_flags) override {
+ DCHECK_LT(tab_index_, tab_strip_model_->count());
+ tab_strip_model_->ExecuteContextMenuCommand(
+ tab_index_, static_cast<TabStripModel::ContextMenuCommand>(command_id));
+ }
+
+ private:
+ TabStripModel* const tab_strip_model_;
+ const int tab_index_;
+};
+
+class TabStripUIHandler : public content::WebUIMessageHandler,
+ public TabStripModelObserver {
public:
- explicit TabStripUIHandler(Profile* profile)
- : profile_(profile),
+ explicit TabStripUIHandler(Browser* browser, TabStripUI::Embedder* embedder)
+ : browser_(browser),
+ embedder_(embedder),
thumbnail_tracker_(base::Bind(&TabStripUIHandler::HandleThumbnailUpdate,
base::Unretained(this))) {}
~TabStripUIHandler() override = default;
+ void OnJavascriptAllowed() override {
+ browser_->tab_strip_model()->AddObserver(this);
+ }
+
+ // TabStripModelObserver:
+ void OnTabStripModelChanged(
+ TabStripModel* tab_strip_model,
+ const TabStripModelChange& change,
+ const TabStripSelectionChange& selection) override {
+ if (tab_strip_model->empty())
+ return;
+
+ switch (change.type()) {
+ case TabStripModelChange::kInserted: {
+ for (const auto& contents : change.GetInsert()->contents) {
+ FireWebUIListener("tab-created",
+ GetTabData(contents.contents, contents.index));
+ }
+ break;
+ }
+ case TabStripModelChange::kRemoved: {
+ for (const auto& contents : change.GetRemove()->contents) {
+ FireWebUIListener("tab-removed",
+ base::Value(extensions::ExtensionTabUtil::GetTabId(
+ contents.contents)));
+ }
+ break;
+ }
+ case TabStripModelChange::kMoved: {
+ auto* move = change.GetMove();
+ FireWebUIListener(
+ "tab-moved",
+ base::Value(extensions::ExtensionTabUtil::GetTabId(move->contents)),
+ base::Value(move->to_index));
+ break;
+ }
+
+ case TabStripModelChange::kReplaced:
+ case TabStripModelChange::kGroupChanged:
+ case TabStripModelChange::kSelectionOnly:
+ // Not yet implemented.
+ break;
+ }
+
+ if (selection.active_tab_changed()) {
+ content::WebContents* new_contents = selection.new_contents;
+ int index = selection.new_model.active();
+ if (new_contents && index != TabStripModel::kNoTab) {
+ FireWebUIListener(
+ "tab-active-changed",
+ base::Value(extensions::ExtensionTabUtil::GetTabId(new_contents)));
+ }
+ }
+ }
+
+ void TabChangedAt(content::WebContents* contents,
+ int index,
+ TabChangeType change_type) override {
+ FireWebUIListener("tab-updated", GetTabData(contents, index));
+ }
+
+ void TabPinnedStateChanged(TabStripModel* tab_strip_model,
+ content::WebContents* contents,
+ int index) override {
+ FireWebUIListener("tab-updated", GetTabData(contents, index));
+ }
+
+ void TabBlockedStateChanged(content::WebContents* contents,
+ int index) override {
+ FireWebUIListener("tab-updated", GetTabData(contents, index));
+ }
+
protected:
+ // content::WebUIMessageHandler:
void RegisterMessages() override {
web_ui()->RegisterMessageCallback(
+ "getTabs",
+ base::Bind(&TabStripUIHandler::HandleGetTabs, base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "getThemeColors", base::Bind(&TabStripUIHandler::HandleGetThemeColors,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
"addTrackedTab",
base::Bind(&TabStripUIHandler::AddTrackedTab, base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"removeTrackedTab", base::Bind(&TabStripUIHandler::RemoveTrackedTab,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "closeContainer", base::Bind(&TabStripUIHandler::HandleCloseContainer,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "showTabContextMenu",
+ base::Bind(&TabStripUIHandler::HandleShowTabContextMenu,
+ base::Unretained(this)));
}
private:
+ base::DictionaryValue GetTabData(content::WebContents* contents, int index) {
+ base::DictionaryValue tab_data;
+
+ tab_data.SetBoolean("active",
+ browser_->tab_strip_model()->active_index() == index);
+ tab_data.SetInteger("id", extensions::ExtensionTabUtil::GetTabId(contents));
+ tab_data.SetInteger("index", index);
+
+ TabRendererData tab_renderer_data =
+ TabRendererData::FromTabInModel(browser_->tab_strip_model(), index);
+ tab_data.SetBoolean("pinned", tab_renderer_data.pinned);
+ tab_data.SetString("title", tab_renderer_data.title);
+ tab_data.SetString("url", tab_renderer_data.visible_url.GetContent());
+
+ if (!tab_renderer_data.favicon.isNull()) {
+ tab_data.SetString("favIconUrl", EncodePNGAndMakeDataURI(
+ tab_renderer_data.favicon,
+ web_ui()->GetDeviceScaleFactor()));
+ tab_data.SetBoolean("isDefaultFavicon",
+ tab_renderer_data.favicon.BackedBySameObjectAs(
+ favicon::GetDefaultFavicon().AsImageSkia()));
+ } else {
+ tab_data.SetBoolean("isDefaultFavicon", true);
+ }
+ tab_data.SetBoolean("showIcon", tab_renderer_data.show_icon);
+ tab_data.SetInteger("networkState",
+ static_cast<int>(tab_renderer_data.network_state));
+ tab_data.SetBoolean("shouldHideThrobber",
+ tab_renderer_data.should_hide_throbber);
+ tab_data.SetBoolean("blocked", tab_renderer_data.blocked);
+ tab_data.SetBoolean("crashed", tab_renderer_data.IsCrashed());
+ // TODO(johntlee): Add the rest of TabRendererData
+
+ return tab_data;
+ }
+
+ void HandleGetTabs(const base::ListValue* args) {
+ AllowJavascript();
+ const base::Value& callback_id = args->GetList()[0];
+
+ base::ListValue tabs;
+ TabStripModel* tab_strip_model = browser_->tab_strip_model();
+ for (int i = 0; i < tab_strip_model->count(); ++i) {
+ tabs.Append(GetTabData(tab_strip_model->GetWebContentsAt(i), i));
+ }
+ ResolveJavascriptCallback(callback_id, tabs);
+ }
+
+ void HandleGetThemeColors(const base::ListValue* args) {
+ AllowJavascript();
+ const base::Value& callback_id = args->GetList()[0];
+
+ const ui::ThemeProvider& tp =
+ ThemeService::GetThemeProviderForProfile(browser_->profile());
+
+ // This should return an object of CSS variables to rgba values so that
+ // the WebUI can use the CSS variables to color the tab strip
+ base::DictionaryValue colors;
+ colors.SetString("--tabstrip-background-color",
+ color_utils::SkColorToRgbaString(
+ tp.GetColor(ThemeProperties::COLOR_FRAME)));
+ colors.SetString("--tabstrip-tab-background-color",
+ color_utils::SkColorToRgbaString(
+ tp.GetColor(ThemeProperties::COLOR_TOOLBAR)));
+ colors.SetString("--tabstrip-tab-text-color",
+ color_utils::SkColorToRgbaString(
+ tp.GetColor(ThemeProperties::COLOR_TAB_TEXT)));
+ colors.SetString("--tabstrip-tab-separator-color",
+ color_utils::SkColorToRgbaString(SkColorSetA(
+ tp.GetColor(ThemeProperties::COLOR_TAB_TEXT),
+ /* 16% opacity */ 0.16 * 255)));
+
+ colors.SetString("--tabstrip-tab-loading-spinning-color",
+ color_utils::SkColorToRgbaString(tp.GetColor(
+ ThemeProperties::COLOR_TAB_THROBBER_SPINNING)));
+ colors.SetString("--tabstrip-tab-waiting-spinning-color",
+ color_utils::SkColorToRgbaString(tp.GetColor(
+ ThemeProperties::COLOR_TAB_THROBBER_WAITING)));
+ colors.SetString("--tabstrip-indicator-recording-color",
+ color_utils::SkColorToRgbaString(tp.GetColor(
+ ThemeProperties::COLOR_TAB_ALERT_RECORDING)));
+ colors.SetString("--tabstrip-indicator-pip-color",
+ color_utils::SkColorToRgbaString(
+ tp.GetColor(ThemeProperties::COLOR_TAB_PIP_PLAYING)));
+ colors.SetString("--tabstrip-indicator-capturing-color",
+ color_utils::SkColorToRgbaString(tp.GetColor(
+ ThemeProperties::COLOR_TAB_ALERT_CAPTURING)));
+ colors.SetString("--tabstrip-tab-blocked-color",
+ color_utils::SkColorToRgbaString(
+ ui::NativeTheme::GetInstanceForWeb()->GetSystemColor(
+ ui::NativeTheme::kColorId_ProminentButtonColor)));
+
+ ResolveJavascriptCallback(callback_id, colors);
+ }
+
+ void HandleCloseContainer(const base::ListValue* args) {
+ DCHECK(embedder_);
+ embedder_->CloseContainer();
+ }
+
+ void HandleShowTabContextMenu(const base::ListValue* args) {
+ int tab_id = 0;
+ args->GetInteger(0, &tab_id);
+
+ gfx::PointF point;
+ {
+ double x = 0;
+ args->GetDouble(1, &x);
+ double y = 0;
+ args->GetDouble(2, &y);
+ point = gfx::PointF(x, y);
+ }
+
+ TabStripModel* tab_strip_model = nullptr;
+ int tab_index = -1;
+ const bool got_tab = extensions::ExtensionTabUtil::GetTabById(
+ tab_id, browser_->profile(), true /* include_incognito */, nullptr,
+ &tab_strip_model, nullptr, &tab_index);
+ DCHECK(got_tab);
+ DCHECK_EQ(tab_strip_model, browser_->tab_strip_model());
+
+ DCHECK(embedder_);
+ embedder_->ShowContextMenuAtPoint(
+ gfx::ToRoundedPoint(point),
+ std::make_unique<WebUITabContextMenu>(tab_strip_model, tab_index));
+ }
+
void AddTrackedTab(const base::ListValue* args) {
AllowJavascript();
@@ -78,8 +349,8 @@ class TabStripUIHandler : public content::WebUIMessageHandler {
return;
content::WebContents* tab = nullptr;
- if (!extensions::ExtensionTabUtil::GetTabById(tab_id, profile_, true,
- &tab)) {
+ if (!extensions::ExtensionTabUtil::GetTabById(tab_id, browser_->profile(),
+ true, &tab)) {
// ID didn't refer to a valid tab.
DVLOG(1) << "Invalid tab ID";
return;
@@ -98,36 +369,20 @@ class TabStripUIHandler : public content::WebUIMessageHandler {
// Callback passed to |thumbnail_tracker_|. Called when a tab's thumbnail
// changes, or when we start watching the tab.
- void HandleThumbnailUpdate(content::WebContents* tab, gfx::ImageSkia image) {
- const SkBitmap& bitmap =
- image.GetRepresentation(web_ui()->GetDeviceScaleFactor()).GetBitmap();
- BufferWStream stream;
- const bool encoding_succeeded =
- SkEncodeImage(&stream, bitmap, SkEncodedImageFormat::kJPEG, 100);
- DCHECK(encoding_succeeded);
- const std::vector<unsigned char> image_data = stream.GetBuffer();
-
+ void HandleThumbnailUpdate(content::WebContents* tab,
+ ThumbnailTracker::CompressedThumbnailData image) {
// Send base-64 encoded image to JS side.
- //
- // TODO(crbug.com/991393): streamline the process from tab capture to
- // sending the image. Currently, a frame is captured, sent to
- // ThumbnailImage, encoded to JPEG (w/ a copy), decoded to a raw bitmap
- // (another copy), and sent to observers. Here, we then re-encode the image
- // to a JPEG (another copy), encode to base64 (another copy), append the
- // base64 header (another copy), and send it (another copy). This is 6
- // copies of essentially the same image, and it is de-encoded and re-encoded
- // to the same format. We can reduce the number of copies and avoid the
- // redundant encoding.
- std::string encoded_image =
- base::Base64Encode(base::as_bytes(base::make_span(image_data)));
- encoded_image = "data:image/jpeg;base64," + encoded_image;
+ std::string data_uri =
+ MakeDataURIForImage(base::make_span(image->data), "jpeg");
const int tab_id = extensions::ExtensionTabUtil::GetTabId(tab);
FireWebUIListener("tab-thumbnail-updated", base::Value(tab_id),
- base::Value(encoded_image));
+ base::Value(data_uri));
}
- Profile* profile_;
+ Browser* const browser_;
+ TabStripUI::Embedder* const embedder_;
+
ThumbnailTracker thumbnail_tracker_;
DISALLOW_COPY_AND_ASSIGN(TabStripUIHandler);
@@ -154,13 +409,28 @@ TabStripUI::TabStripUI(content::WebUI* web_ui)
html_source->SetDefaultResource(IDR_TAB_STRIP_HTML);
+ // Add a load time string for the frame color to allow the tab strip to paint
+ // a background color that matches the frame before any content loads
+ const ui::ThemeProvider& tp =
+ ThemeService::GetThemeProviderForProfile(profile);
+ html_source->AddString("frameColor",
+ color_utils::SkColorToRgbaString(
+ tp.GetColor(ThemeProperties::COLOR_FRAME)));
+
content::WebUIDataSource::Add(profile, html_source);
content::URLDataSource::Add(
profile, std::make_unique<FaviconSource>(
profile, chrome::FaviconUrlFormat::kFavicon2));
- web_ui->AddMessageHandler(std::make_unique<TabStripUIHandler>(profile));
+ web_ui->AddMessageHandler(std::make_unique<ThemeHandler>());
}
TabStripUI::~TabStripUI() {}
+
+void TabStripUI::Initialize(Browser* browser, Embedder* embedder) {
+ content::WebUI* const web_ui = TabStripUI::web_ui();
+ DCHECK_EQ(Profile::FromWebUI(web_ui), browser->profile());
+ web_ui->AddMessageHandler(
+ std::make_unique<TabStripUIHandler>(browser, embedder));
+}
diff --git a/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.h b/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.h
index 8e8b31d9ddf..6f126eeb482 100644
--- a/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.h
+++ b/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui.h
@@ -5,19 +5,50 @@
#ifndef CHROME_BROWSER_UI_WEBUI_TAB_STRIP_TAB_STRIP_UI_H_
#define CHROME_BROWSER_UI_WEBUI_TAB_STRIP_TAB_STRIP_UI_H_
+#include <memory>
+
#include "base/macros.h"
#include "chrome/browser/ui/webui/tab_strip/thumbnail_tracker.h"
#include "content/public/browser/web_ui_controller.h"
+class Browser;
+
+namespace gfx {
+class Point;
+}
+
+namespace ui {
+class MenuModel;
+}
+
// The WebUI version of the tab strip in the browser. It is currently only
// supported on ChromeOS in tablet mode.
class TabStripUI : public content::WebUIController {
public:
+ // Interface to be implemented by the embedder. Provides native UI
+ // functionality such as showing context menus.
+ class Embedder {
+ public:
+ Embedder() = default;
+ virtual ~Embedder() {}
+
+ virtual void CloseContainer() = 0;
+
+ virtual void ShowContextMenuAtPoint(
+ gfx::Point point,
+ std::unique_ptr<ui::MenuModel> menu_model) = 0;
+ };
+
explicit TabStripUI(content::WebUI* web_ui);
~TabStripUI() override;
+ // Initialize TabStripUI with its embedder and the Browser it's running in.
+ // Must be called exactly once. The WebUI won't work until this is called.
+ void Initialize(Browser* browser, Embedder* embedder);
+
private:
- void HandleThumbnailUpdate(int extension_tab_id, gfx::ImageSkia image);
+ void HandleThumbnailUpdate(int extension_tab_id,
+ ThumbnailTracker::CompressedThumbnailData image);
DISALLOW_COPY_AND_ASSIGN(TabStripUI);
};
diff --git a/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui_browsertest.cc b/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui_browsertest.cc
new file mode 100644
index 00000000000..5df49d77874
--- /dev/null
+++ b/chromium/chrome/browser/ui/webui/tab_strip/tab_strip_ui_browsertest.cc
@@ -0,0 +1,118 @@
+// 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/tab_strip/tab_strip_ui.h"
+
+#include <memory>
+
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
+#include "base/strings/string_piece.h"
+#include "base/test/scoped_feature_list.h"
+#include "base/values.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/ui_features.h"
+#include "chrome/common/chrome_isolated_world_ids.h"
+#include "chrome/common/webui_url_constants.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "content/public/browser/navigation_controller.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/test/browser_test_utils.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "ui/base/models/menu_model.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/point_conversions.h"
+#include "ui/gfx/geometry/point_f.h"
+#include "ui/gfx/geometry/rect_f.h"
+
+namespace {
+
+class MockTabStripUIEmbedder : public TabStripUI::Embedder {
+ public:
+ MOCK_METHOD(void, CloseContainer, (), (override));
+ MOCK_METHOD(void,
+ ShowContextMenuAtPoint,
+ (gfx::Point point, std::unique_ptr<ui::MenuModel> menu_model),
+ (override));
+};
+
+} // namespace
+
+class TabStripUIBrowserTest : public InProcessBrowserTest {
+ public:
+ void SetUp() override {
+ // In this test, we create our own TabStripUI instance with a mock
+ // Embedder. Disable the production one to avoid conflicting with
+ // it.
+ feature_override_.InitAndDisableFeature(features::kWebUITabStrip);
+ InProcessBrowserTest::SetUp();
+ }
+
+ void TearDown() override {
+ InProcessBrowserTest::TearDown();
+ feature_override_.Reset();
+ }
+
+ void SetUpOnMainThread() override {
+ webui_contents_ = content::WebContents::Create(
+ content::WebContents::CreateParams(browser()->profile()));
+
+ // Start loading WebUI, injecting our TabStripUI::Embedder immediately
+ // after.
+ webui_contents_->GetController().LoadURLWithParams(
+ content::NavigationController::LoadURLParams(
+ GURL(chrome::kChromeUITabStripURL)));
+ TabStripUI* const tab_strip_ui =
+ static_cast<TabStripUI*>(webui_contents_->GetWebUI()->GetController());
+ tab_strip_ui->Initialize(browser(), &mock_embedder_);
+
+ // Finish loading after initializing TabStripUI.
+ ASSERT_TRUE(content::WaitForLoadStop(webui_contents_.get()));
+ }
+
+ void TearDownOnMainThread() override { webui_contents_.reset(); }
+
+ protected:
+ static const std::string tab_query_js;
+
+ ::testing::NiceMock<MockTabStripUIEmbedder> mock_embedder_;
+ std::unique_ptr<content::WebContents> webui_contents_;
+
+ private:
+ base::test::ScopedFeatureList feature_override_;
+};
+
+// static
+const std::string TabStripUIBrowserTest::tab_query_js(
+ "document.querySelector('tabstrip-tab-list')"
+ " .shadowRoot.querySelector('tabstrip-tab')");
+
+IN_PROC_BROWSER_TEST_F(TabStripUIBrowserTest, ActivatingTabClosesEmbedder) {
+ const std::string activate_tab_js = tab_query_js + ".click()";
+
+ EXPECT_CALL(mock_embedder_, CloseContainer()).Times(1);
+ ASSERT_TRUE(content::ExecJs(webui_contents_.get(), activate_tab_js,
+ content::EXECUTE_SCRIPT_DEFAULT_OPTIONS,
+ ISOLATED_WORLD_ID_CHROME_INTERNAL));
+}
+
+// Checks that the contextmenu event on a tab gets forwarded to the
+// TabStripUI::Embedder.
+IN_PROC_BROWSER_TEST_F(TabStripUIBrowserTest,
+ InvokesEmbedderContextMenuForTab) {
+ using ::testing::_;
+
+ const std::string invoke_menu_js =
+ "const event ="
+ " new MouseEvent('contextmenu', { clientX: 100, clientY: 50 });" +
+ tab_query_js + ".dispatchEvent(event)";
+
+ EXPECT_CALL(mock_embedder_, ShowContextMenuAtPoint(gfx::Point(100, 50), _))
+ .Times(1);
+ ASSERT_TRUE(content::ExecJs(webui_contents_.get(), invoke_menu_js,
+ content::EXECUTE_SCRIPT_DEFAULT_OPTIONS,
+ ISOLATED_WORLD_ID_CHROME_INTERNAL));
+}
diff --git a/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.cc b/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.cc
index 6c74dd96578..4ec05c2513a 100644
--- a/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.cc
+++ b/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.cc
@@ -7,9 +7,9 @@
#include <memory>
#include <utility>
+#include "base/macros.h"
#include "base/scoped_observer.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/thumbnails/thumbnail_image.h"
#include "chrome/browser/ui/thumbnails/thumbnail_tab_helper.h"
#include "content/public/browser/web_contents_observer.h"
@@ -19,9 +19,7 @@ class ThumbnailTracker::ContentsData : public content::WebContentsObserver,
public ThumbnailImage::Observer {
public:
ContentsData(ThumbnailTracker* parent, content::WebContents* contents)
- : content::WebContentsObserver(contents),
- parent_(parent),
- observer_(this) {
+ : content::WebContentsObserver(contents), parent_(parent) {
thumbnail_ = parent_->thumbnail_getter_.Run(contents);
if (thumbnail_)
observer_.Add(thumbnail_.get());
@@ -29,7 +27,7 @@ class ThumbnailTracker::ContentsData : public content::WebContentsObserver,
void RequestThumbnail() {
if (thumbnail_)
- thumbnail_->RequestThumbnailImage();
+ thumbnail_->RequestCompressedThumbnailData();
}
// content::WebContents:
@@ -46,14 +44,17 @@ class ThumbnailTracker::ContentsData : public content::WebContentsObserver,
}
// ThumbnailImage::Observer:
- void OnThumbnailImageAvailable(gfx::ImageSkia thumbnail_image) override {
+ void OnCompressedThumbnailDataAvailable(
+ CompressedThumbnailData thumbnail_image) override {
parent_->ThumbnailUpdated(web_contents(), thumbnail_image);
}
private:
ThumbnailTracker* parent_;
scoped_refptr<ThumbnailImage> thumbnail_;
- ScopedObserver<ThumbnailImage, ContentsData> observer_;
+ ScopedObserver<ThumbnailImage, ThumbnailImage::Observer> observer_{this};
+
+ DISALLOW_COPY_AND_ASSIGN(ContentsData);
};
ThumbnailTracker::ThumbnailTracker(ThumbnailUpdatedCallback callback)
@@ -78,7 +79,7 @@ void ThumbnailTracker::WatchTab(content::WebContents* contents) {
}
void ThumbnailTracker::ThumbnailUpdated(content::WebContents* contents,
- gfx::ImageSkia image) {
+ CompressedThumbnailData image) {
callback_.Run(contents, image);
}
diff --git a/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.h b/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.h
index 2d64d3d8ecc..feb174dcee1 100644
--- a/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.h
+++ b/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.h
@@ -9,19 +9,20 @@
#include "base/containers/flat_map.h"
#include "base/memory/scoped_refptr.h"
+#include "chrome/browser/ui/thumbnails/thumbnail_image.h"
#include "ui/gfx/image/image_skia.h"
namespace content {
class WebContents;
}
-class ThumbnailImage;
-
// Tracks the thumbnails of a set of WebContentses. This set is dynamically
// managed, and WebContents closure is handled gracefully. The user is notified
// of any thumbnail change via a callback specified on construction.
class ThumbnailTracker {
public:
+ using CompressedThumbnailData = ThumbnailImage::CompressedThumbnailData;
+
// Should return the ThumbnailImage instance for a WebContents.
using GetThumbnailCallback =
base::RepeatingCallback<scoped_refptr<ThumbnailImage>(
@@ -29,7 +30,8 @@ class ThumbnailTracker {
// Handles a thumbnail update for a tab.
using ThumbnailUpdatedCallback =
- base::RepeatingCallback<void(content::WebContents*, gfx::ImageSkia)>;
+ base::RepeatingCallback<void(content::WebContents*,
+ CompressedThumbnailData)>;
explicit ThumbnailTracker(ThumbnailUpdatedCallback callback);
// Specifies how to get a ThumbnailImage for a WebContents. This is intended
@@ -44,7 +46,8 @@ class ThumbnailTracker {
void WatchTab(content::WebContents* contents);
private:
- void ThumbnailUpdated(content::WebContents* contents, gfx::ImageSkia image);
+ void ThumbnailUpdated(content::WebContents* contents,
+ CompressedThumbnailData image);
void ContentsClosed(content::WebContents* contents);
// The default |GetThumbnailCallback| implementation.
diff --git a/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker_unittest.cc b/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker_unittest.cc
index eac65cc2104..714296013a5 100644
--- a/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/tab_strip/thumbnail_tracker_unittest.cc
@@ -99,11 +99,9 @@ TEST_F(ThumbnailTrackerTest, WatchTabGetsCurrentThumbnail) {
// Verify that WatchTab() gets the current image, waiting for the decoding to
// happen.
EXPECT_CALL(thumbnail_updated_callback_, Run(contents.get(), _)).Times(1);
- base::RunLoop notify_loop;
thumbnail->set_async_operation_finished_callback_for_testing(
- notify_loop.QuitClosure());
+ base::RepeatingClosure());
thumbnail_tracker_.WatchTab(contents.get());
- notify_loop.Run();
}
TEST_F(ThumbnailTrackerTest, PropagatesThumbnailUpdate) {
diff --git a/chromium/chrome/browser/ui/webui/test_data_source.cc b/chromium/chrome/browser/ui/webui/test_data_source.cc
index 3c2b5ac0d41..1fbe67324c0 100644
--- a/chromium/chrome/browser/ui/webui/test_data_source.cc
+++ b/chromium/chrome/browser/ui/webui/test_data_source.cc
@@ -25,6 +25,19 @@ namespace {
const char kModuleQuery[] = "module=";
} // namespace
+TestDataSource::TestDataSource(std::string root) {
+ base::FilePath test_data;
+ CHECK(base::PathService::Get(chrome::DIR_TEST_DATA, &test_data));
+ src_root_ = test_data.AppendASCII(root).NormalizePathSeparators();
+ DCHECK(test_data.IsParent(src_root_));
+
+ base::FilePath exe_dir;
+ base::PathService::Get(base::DIR_EXE, &exe_dir);
+ gen_root_ = exe_dir.AppendASCII("gen/chrome/test/data/" + root)
+ .NormalizePathSeparators();
+ DCHECK(exe_dir.IsParent(gen_root_));
+}
+
std::string TestDataSource::GetSource() {
return "test";
}
@@ -33,6 +46,15 @@ void TestDataSource::StartDataRequest(
const std::string& path,
const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) {
+ if (path == "strings.m.js") {
+ std::string output = "import {loadTimeData} from ";
+ output.append("'chrome://resources/js/load_time_data.m.js';\n");
+ output.append("loadTimeData.data = {};");
+ scoped_refptr<base::RefCountedString> response =
+ base::RefCountedString::TakeString(&output);
+ callback.Run(response.get());
+ return;
+ }
base::PostTask(
FROM_HERE,
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_BLOCKING},
@@ -48,7 +70,9 @@ std::string TestDataSource::GetMimeType(const std::string& path) {
return "text/html";
}
// The test data source currently only serves HTML and JS.
- CHECK(base::EndsWith(path, ".js", base::CompareCase::INSENSITIVE_ASCII));
+ CHECK(base::EndsWith(path, ".js", base::CompareCase::INSENSITIVE_ASCII))
+ << "Tried to read file with unexpected type from test data source: "
+ << path;
return "application/javascript";
}
@@ -72,22 +96,6 @@ GURL TestDataSource::GetURLForPath(const std::string& path) {
void TestDataSource::ReadFile(
const std::string& path,
const content::URLDataSource::GotDataCallback& callback) {
- if (src_root_.empty()) {
- base::FilePath test_data;
- CHECK(base::PathService::Get(chrome::DIR_TEST_DATA, &test_data));
- src_root_ = test_data.Append(FILE_PATH_LITERAL("webui"));
- }
-
- if (gen_root_.empty()) {
- std::string gen_path = "gen/chrome/test/data/webui/";
-#if defined(OS_WIN)
- base::ReplaceChars(gen_path, "//", "\\", &gen_path);
-#endif
- base::FilePath exe_dir;
- base::PathService::Get(base::DIR_EXE, &exe_dir);
- gen_root_ = exe_dir.AppendASCII(gen_path);
- }
-
std::string content;
GURL url = GetURLForPath(path);
diff --git a/chromium/chrome/browser/ui/webui/test_data_source.h b/chromium/chrome/browser/ui/webui/test_data_source.h
index 86816587eb2..e4c6ea6360e 100644
--- a/chromium/chrome/browser/ui/webui/test_data_source.h
+++ b/chromium/chrome/browser/ui/webui/test_data_source.h
@@ -12,10 +12,10 @@
#include "content/public/browser/url_data_source.h"
#include "url/gurl.h"
-// Serves files at chrome://test/ from //src/chrome/test/data/webui.
+// Serves files at chrome://test/ from //src/chrome/test/data/<root>.
class TestDataSource : public content::URLDataSource {
public:
- TestDataSource() = default;
+ explicit TestDataSource(std::string root);
~TestDataSource() override = default;
private:
diff --git a/chromium/chrome/browser/ui/webui/theme_handler.cc b/chromium/chrome/browser/ui/webui/theme_handler.cc
index 033a87dbafe..a1d7401a815 100644
--- a/chromium/chrome/browser/ui/webui/theme_handler.cc
+++ b/chromium/chrome/browser/ui/webui/theme_handler.cc
@@ -16,14 +16,12 @@
#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() : theme_observer_(this) {}
-
-ThemeHandler::~ThemeHandler() {}
+ThemeHandler::ThemeHandler() = default;
+ThemeHandler::~ThemeHandler() = default;
void ThemeHandler::RegisterMessages() {
// These are not actual message registrations, but can't be done in the
@@ -73,7 +71,7 @@ void ThemeHandler::SendThemeChanged() {
// TODO(dbeam): why does this need to be a dictionary?
base::DictionaryValue dictionary;
dictionary.SetBoolean("hasCustomBackground", has_custom_bg);
- CallJavascriptFunction("ntp.themeChanged", dictionary);
+ FireWebUIListener("theme-changed", 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 5e52e81d1cd..5de97849396 100644
--- a/chromium/chrome/browser/ui/webui/theme_handler.h
+++ b/chromium/chrome/browser/ui/webui/theme_handler.h
@@ -10,6 +10,7 @@
#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.h"
#include "ui/native_theme/native_theme_observer.h"
class Profile;
@@ -53,7 +54,8 @@ class ThemeHandler : public content::WebUIMessageHandler,
content::NotificationRegistrar registrar_;
- ScopedObserver<ui::NativeTheme, ThemeHandler> theme_observer_;
+ ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> theme_observer_{
+ this};
DISALLOW_COPY_AND_ASSIGN(ThemeHandler);
};
diff --git a/chromium/chrome/browser/ui/webui/theme_source.cc b/chromium/chrome/browser/ui/webui/theme_source.cc
index cc006a1e38e..80b40ae2105 100644
--- a/chromium/chrome/browser/ui/webui/theme_source.cc
+++ b/chromium/chrome/browser/ui/webui/theme_source.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
#include "base/task/post_task.h"
#include "build/branding_buildflags.h"
#include "chrome/browser/profiles/profile.h"
@@ -24,6 +25,8 @@
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/url_data_source.h"
+#include "content/public/common/url_constants.h"
#include "net/url_request/url_request.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
@@ -239,3 +242,15 @@ void ThemeSource::SendThemeImage(
base::BindOnce(callback, data));
}
}
+
+std::string ThemeSource::GetAccessControlAllowOriginForOrigin(
+ const std::string& origin) {
+ std::string allowed_origin_prefix = content::kChromeUIScheme;
+ allowed_origin_prefix += "://";
+ if (base::StartsWith(origin, allowed_origin_prefix,
+ base::CompareCase::SENSITIVE)) {
+ return origin;
+ }
+
+ return content::URLDataSource::GetAccessControlAllowOriginForOrigin(origin);
+}
diff --git a/chromium/chrome/browser/ui/webui/theme_source.h b/chromium/chrome/browser/ui/webui/theme_source.h
index 321ea0b8fbd..4ebcc707019 100644
--- a/chromium/chrome/browser/ui/webui/theme_source.h
+++ b/chromium/chrome/browser/ui/webui/theme_source.h
@@ -33,6 +33,8 @@ class ThemeSource : public content::URLDataSource {
bool ShouldServiceRequest(const GURL& url,
content::ResourceContext* resource_context,
int render_process_id) override;
+ std::string GetAccessControlAllowOriginForOrigin(
+ const std::string& origin) override;
private:
// Fetches and sends the theme bitmap.
diff --git a/chromium/chrome/browser/ui/webui/theme_source_unittest.cc b/chromium/chrome/browser/ui/webui/theme_source_unittest.cc
index 55ee176f9b1..a17b7b45fa1 100644
--- a/chromium/chrome/browser/ui/webui/theme_source_unittest.cc
+++ b/chromium/chrome/browser/ui/webui/theme_source_unittest.cc
@@ -94,3 +94,15 @@ TEST_F(WebUISourcesTest, ThemeSourceCSS) {
EXPECT_EQ(result_data_size_, empty_size);
#endif
}
+
+TEST_F(WebUISourcesTest, ThemeAllowedOrigin) {
+ EXPECT_EQ(
+ theme_source()->GetAccessControlAllowOriginForOrigin("chrome://settings"),
+ "chrome://settings");
+ EXPECT_EQ(theme_source()->GetAccessControlAllowOriginForOrigin(
+ "chrome-extensions://some-id"),
+ "");
+ EXPECT_EQ(
+ theme_source()->GetAccessControlAllowOriginForOrigin("http://google.com"),
+ "");
+}
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 7b8d5847b99..7b1e5bc4d09 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
@@ -9,6 +9,7 @@
#include "chrome/browser/ui/webui/usb_internals/usb_internals_page_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
+#include "chrome/grit/usb_internals_resources.h"
#include "content/public/browser/web_ui_data_source.h"
UsbInternalsUI::UsbInternalsUI(content::WebUI* web_ui)
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 24e7b897e06..b9787445885 100644
--- a/chromium/chrome/browser/ui/webui/web_ui_test_handler.cc
+++ b/chromium/chrome/browser/ui/webui/web_ui_test_handler.cc
@@ -19,6 +19,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/test/test_utils.h"
+#include "mojo/public/cpp/bindings/associated_remote.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
@@ -35,7 +36,7 @@ WebUITestHandler::~WebUITestHandler() {}
void WebUITestHandler::PreloadJavaScript(const base::string16& js_text,
RenderViewHost* preload_host) {
DCHECK(preload_host);
- chrome::mojom::ChromeRenderFrameAssociatedPtr chrome_render_frame;
+ mojo::AssociatedRemote<chrome::mojom::ChromeRenderFrame> chrome_render_frame;
preload_host->GetMainFrame()->GetRemoteAssociatedInterfaces()->GetInterface(
&chrome_render_frame);
chrome_render_frame->ExecuteWebUIJavaScript(js_text);
diff --git a/chromium/chrome/browser/ui/webui/webapks_handler.cc b/chromium/chrome/browser/ui/webui/webapks_handler.cc
index 58ef4180aac..e7417b006aa 100644
--- a/chromium/chrome/browser/ui/webui/webapks_handler.cc
+++ b/chromium/chrome/browser/ui/webui/webapks_handler.cc
@@ -60,7 +60,7 @@ void WebApksHandler::OnWebApkInfoRetrieved(const WebApkInfo& webapk_info) {
result.SetString("manifestUrl", webapk_info.manifest_url);
result.SetString("manifestStartUrl", webapk_info.manifest_start_url);
result.SetString("displayMode",
- blink::WebDisplayModeToString(webapk_info.display));
+ blink::DisplayModeToString(webapk_info.display));
result.SetString("orientation", blink::WebScreenOrientationLockTypeToString(
webapk_info.orientation));
result.SetString("themeColor",
@@ -78,5 +78,5 @@ void WebApksHandler::OnWebApkInfoRetrieved(const WebApkInfo& webapk_info) {
webapk_info.is_backing_browser
? webapk_info.update_status
: "Current browser doesn't own this WebAPK.");
- CallJavascriptFunction("returnWebApkInfo", result);
+ FireWebUIListener("web-apk-info", result);
}
diff --git a/chromium/chrome/browser/ui/webui/webui_load_timer.cc b/chromium/chrome/browser/ui/webui/webui_load_timer.cc
index 9bfadd5fb83..c09c69b8af4 100644
--- a/chromium/chrome/browser/ui/webui/webui_load_timer.cc
+++ b/chromium/chrome/browser/ui/webui/webui_load_timer.cc
@@ -47,7 +47,7 @@ void WebuiLoadTimer::DidStartNavigation(
timer_ = std::make_unique<base::ElapsedTimer>();
}
-void WebuiLoadTimer::DocumentLoadedInFrame(
+void WebuiLoadTimer::DOMContentLoaded(
content::RenderFrameHost* render_frame_host) {
// See comment in DocumentOnLoadCompletedInMainFrame.
if (!timer_ || render_frame_host != web_contents()->GetMainFrame())
diff --git a/chromium/chrome/browser/ui/webui/webui_load_timer.h b/chromium/chrome/browser/ui/webui/webui_load_timer.h
index 5474b646af3..83e089c370a 100644
--- a/chromium/chrome/browser/ui/webui/webui_load_timer.h
+++ b/chromium/chrome/browser/ui/webui/webui_load_timer.h
@@ -20,7 +20,7 @@ class WebuiLoadTimer : public content::WebContentsObserver {
public:
// Load times are reported to UMA using the provided strings which
// must not be empty.
- // * |document_initial_load_uma_id| - corresponds to DocumentLoadedInFrame
+ // * |document_initial_load_uma_id| - corresponds to DOMContentLoaded
// * |document_load_completed_uma_id| - corresponds to
// DocumentOnLoadCompletedInMainFrame
WebuiLoadTimer(content::WebContents* web_contents,
@@ -31,8 +31,7 @@ class WebuiLoadTimer : public content::WebContentsObserver {
// WebContentsObserver
void DidStartNavigation(
content::NavigationHandle* navigation_handle) override;
- void DocumentLoadedInFrame(
- content::RenderFrameHost* render_frame_host) override;
+ void DOMContentLoaded(content::RenderFrameHost* render_frame_host) override;
void DocumentOnLoadCompletedInMainFrame() override;
private:
diff --git a/chromium/chrome/browser/ui/webui/welcome/helpers.cc b/chromium/chrome/browser/ui/webui/welcome/helpers.cc
index 0fe4562325e..7800809ecf0 100644
--- a/chromium/chrome/browser/ui/webui/welcome/helpers.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/helpers.cc
@@ -109,7 +109,12 @@ bool CanShowSigninModule(const policy::PolicyMap& policies) {
policy::BrowserSigninMode::kDisabled;
}
-#if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
+// Welcome experiments depend on Google being the default search provider.
+static bool CanExperimentWithVariations(Profile* profile) {
+ return search::DefaultSearchProviderIsGoogle(profile);
+}
+
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
// These feature flags are used to tie our experiment to specific studies.
// go/navi-app-variation for details.
// TODO(hcarmona): find a solution that scales better.
@@ -121,21 +126,14 @@ const base::Feature kNaviNTPVariationEnabled = {
"NaviNTPVariationEnabled", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kNaviShortcutVariationEnabled = {
"NaviShortcutVariationEnabled", base::FEATURE_DISABLED_BY_DEFAULT};
-#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
-// Welcome experiments depend on Google being the default search provider.
-bool CanExperimentWithVariations(Profile* profile) {
- return search::DefaultSearchProviderIsGoogle(profile);
-}
-
-#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
// Get the group for users who onboard in this experiment.
// Groups are:
// - Specified by study
// - The same for all experiments in study
// - Incremented with each new version
// - Not reused
-std::string GetOnboardingGroup(Profile* profile) {
+static std::string GetOnboardingGroup(Profile* profile) {
if (!CanExperimentWithVariations(profile)) {
// If we cannot run any variations, we bucket the users into a separate
// synthetic group that we will ignore data for.
@@ -148,8 +146,10 @@ std::string GetOnboardingGroup(Profile* profile) {
// "NaviOnboarding" match study name in configs.
return base::GetFieldTrialParamValue("NaviOnboarding", "onboarding-group");
}
+#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
void JoinOnboardingGroup(Profile* profile) {
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
PrefService* prefs = profile->GetPrefs();
std::string group;
@@ -180,17 +180,17 @@ void JoinOnboardingGroup(Profile* profile) {
base::FeatureList::IsEnabled(kNaviNTPVariationEnabled);
else if (group.compare("ShortcutVariationSynthetic-008") == 0)
base::FeatureList::IsEnabled(kNaviShortcutVariationEnabled);
-}
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
+}
bool IsEnabled(Profile* profile) {
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return base::FeatureList::IsEnabled(welcome::kFeature) ||
base::FeatureList::IsEnabled(welcome::kForceEnabled);
#else
// Allow enabling outside official builds for testing purposes.
return base::FeatureList::IsEnabled(welcome::kForceEnabled);
-#endif // defined(GOOGLE_CHROME_BUILD)
+#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
}
bool IsAppVariationEnabled() {
diff --git a/chromium/chrome/browser/ui/webui/welcome/helpers.h b/chromium/chrome/browser/ui/webui/welcome/helpers.h
index 258c956b80c..43db2f3e477 100644
--- a/chromium/chrome/browser/ui/webui/welcome/helpers.h
+++ b/chromium/chrome/browser/ui/webui/welcome/helpers.h
@@ -23,13 +23,12 @@ class PolicyMap;
class Profile;
namespace welcome {
-#if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
+
// Onboarding groups are used for running field trials related to first run
// experience. This will make a new profile join whatever group is currently
// active. Any profile that is already part of an onboarding group will remain
// in that group.
void JoinOnboardingGroup(Profile* profile);
-#endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
bool IsEnabled(Profile* profile);
diff --git a/chromium/chrome/browser/ui/webui/welcome/ntp_background_fetcher.cc b/chromium/chrome/browser/ui/webui/welcome/ntp_background_fetcher.cc
index 33ff4884574..9a5026c9601 100644
--- a/chromium/chrome/browser/ui/webui/welcome/ntp_background_fetcher.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/ntp_background_fetcher.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ref_counted_memory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/search/background/ntp_backgrounds.h"
diff --git a/chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc b/chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc
index d0b69ca81d4..d143915f42a 100644
--- a/chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc
+++ b/chromium/chrome/browser/ui/webui/welcome/welcome_ui.cc
@@ -25,6 +25,7 @@
#include "components/signin/public/base/signin_pref_names.h"
#include "components/strings/grit/components_strings.h"
#include "net/base/url_util.h"
+#include "ui/resources/grit/webui_resources.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
@@ -127,15 +128,26 @@ WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(url.host());
+ html_source->OverrideContentSecurityPolicyScriptSrc(
+ "script-src chrome://resources chrome://test 'self';");
// Add welcome strings.
AddStrings(html_source);
// Add all welcome resources.
+ std::string generated_path =
+ "@out_folder@/gen/chrome/browser/resources/welcome/";
+
for (size_t i = 0; i < kWelcomeResourcesSize; ++i) {
- html_source->AddResourcePath(kWelcomeResources[i].name,
- kWelcomeResources[i].value);
+ std::string path = kWelcomeResources[i].name;
+ if (path.rfind(generated_path, 0) == 0) {
+ path = path.substr(generated_path.length());
+ }
+
+ html_source->AddResourcePath(path, kWelcomeResources[i].value);
}
+ html_source->AddResourcePath("test_loader.js", IDR_WEBUI_JS_TEST_LOADER);
+ html_source->AddResourcePath("test_loader.html", IDR_WEBUI_HTML_TEST_LOADER);
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Load unscaled images.
@@ -202,6 +214,7 @@ WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
base::BindRepeating(&HandleRequestCallback,
weak_ptr_factory_.GetWeakPtr()));
html_source->UseStringsJs();
+ html_source->EnableReplaceI18nInJS();
content::WebUIDataSource::Add(profile, html_source);
}
diff --git a/chromium/chrome/browser/util/android/BUILD.gn b/chromium/chrome/browser/util/android/BUILD.gn
new file mode 100644
index 00000000000..413fd2363e5
--- /dev/null
+++ b/chromium/chrome/browser/util/android/BUILD.gn
@@ -0,0 +1,42 @@
+# 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/config/android/rules.gni")
+
+android_library("java") {
+ java_files = [
+ "java/src/org/chromium/chrome/browser/util/AccessibilityUtil.java",
+ "java/src/org/chromium/chrome/browser/util/AndroidTaskUtils.java",
+ "java/src/org/chromium/chrome/browser/util/BitmapCache.java",
+ "java/src/org/chromium/chrome/browser/util/ChromeContextUtil.java",
+ "java/src/org/chromium/chrome/browser/util/ChromeFileProvider.java",
+ "java/src/org/chromium/chrome/browser/util/ConversionUtils.java",
+ "java/src/org/chromium/chrome/browser/util/FileSizeUtil.java",
+ "java/src/org/chromium/chrome/browser/util/HashUtil.java",
+ "java/src/org/chromium/chrome/browser/util/IntentUtils.java",
+ "java/src/org/chromium/chrome/browser/util/KeyNavigationUtil.java",
+ "java/src/org/chromium/chrome/browser/util/MathUtils.java",
+ "java/src/org/chromium/chrome/browser/util/PlatformUtil.java",
+ "java/src/org/chromium/chrome/browser/util/UrlConstants.java",
+ "java/src/org/chromium/chrome/browser/util/UrlUtilities.java",
+ "java/src/org/chromium/chrome/browser/util/ViewUtils.java",
+ ]
+ deps = [
+ "//base:base_java",
+ "//base:jni_java",
+ "//content/public/android:content_java",
+ "//third_party/android_deps:com_android_support_collections_java",
+ "//third_party/android_deps:com_android_support_support_compat_java",
+ "//third_party/android_deps:com_android_support_support_core_utils_java",
+ ]
+ annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
+}
+
+generate_jni("jni_headers") {
+ sources = [
+ "java/src/org/chromium/chrome/browser/util/ChromeContextUtil.java",
+ "java/src/org/chromium/chrome/browser/util/PlatformUtil.java",
+ "java/src/org/chromium/chrome/browser/util/UrlUtilities.java",
+ ]
+}
diff --git a/chromium/chrome/browser/vr/BUILD.gn b/chromium/chrome/browser/vr/BUILD.gn
index ffbf1706796..360d95de0b8 100644
--- a/chromium/chrome/browser/vr/BUILD.gn
+++ b/chromium/chrome/browser/vr/BUILD.gn
@@ -7,6 +7,7 @@ import("//chrome/android/modules/buildflags.gni")
import("//chrome/browser/vr/features.gni")
import("//chrome/common/features.gni")
import("//device/vr/buildflags/buildflags.gni")
+import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
import("//tools/grit/repack.gni")
@@ -194,7 +195,7 @@ component("vr_ui") {
"//skia",
]
- if (use_native_modules && modularize_vr_native) {
+ if (use_native_partitions) {
# Mark symbols in this library as belonging to the VR partition. Only
# exported symbols (module entrypoints) are affected.
cflags = [ "-fsymbol-partition=libvr.so" ]
@@ -243,7 +244,6 @@ component("vr_common") {
"service/browser_xr_runtime.h",
"service/gvr_consent_helper.cc",
"service/gvr_consent_helper.h",
- "service/interface_set.h",
"service/vr_service_impl.cc",
"service/vr_service_impl.h",
"service/xr_device_service.cc",
@@ -763,6 +763,7 @@ if (!is_android) {
# Tests.
sources += [
"webxr_vr_consent_dialog_browser_test.cc",
+ "webxr_vr_frame_loop_browser_test.cc",
"webxr_vr_frame_pose_browser_test.cc",
"webxr_vr_indicators_browser_test.cc",
"webxr_vr_input_browser_test.cc",
@@ -800,3 +801,14 @@ if (!is_android) {
]
}
}
+
+fuzzer_test("vr_omnibox_formatting_fuzzer") {
+ sources = [
+ "elements/omnibox_formatting_fuzzer.cc",
+ ]
+ deps = [
+ ":vr_common",
+ ":vr_ui",
+ "//ui/gfx:test_support",
+ ]
+}
diff --git a/chromium/chrome/browser/web_applications/BUILD.gn b/chromium/chrome/browser/web_applications/BUILD.gn
index a5a977d0293..33815636472 100644
--- a/chromium/chrome/browser/web_applications/BUILD.gn
+++ b/chromium/chrome/browser/web_applications/BUILD.gn
@@ -11,7 +11,6 @@ group("web_app_test_group") {
source_set("web_applications") {
sources = [
- "abstract_web_app_database.h",
"external_web_app_manager.cc",
"external_web_app_manager.h",
"file_utils_wrapper.cc",
@@ -44,10 +43,11 @@ source_set("web_applications") {
"web_app_registrar.h",
"web_app_registry_update.cc",
"web_app_registry_update.h",
+ "web_app_shortcut_manager.cc",
+ "web_app_shortcut_manager.h",
"web_app_sync_bridge.cc",
"web_app_sync_bridge.h",
- "web_app_sync_manager.cc",
- "web_app_sync_manager.h",
+ "web_app_sync_install_delegate.h",
]
deps = [
@@ -63,6 +63,7 @@ source_set("web_applications") {
if (is_chromeos) {
deps += [
"//ash/public/cpp:cpp",
+ "//chromeos/components/media_app_ui",
"//chromeos/constants",
"//components/arc:arc_base",
"//components/arc/mojom",
@@ -79,6 +80,8 @@ source_set("web_applications_test_support") {
testonly = true
sources = [
+ "test/service_worker_registration_waiter.cc",
+ "test/service_worker_registration_waiter.h",
"test/test_app_registrar.cc",
"test/test_app_registrar.h",
"test/test_data_retriever.cc",
@@ -93,10 +96,10 @@ source_set("web_applications_test_support") {
"test/test_pending_app_manager.h",
"test/test_system_web_app_manager.cc",
"test/test_system_web_app_manager.h",
- "test/test_web_app_database.cc",
- "test/test_web_app_database.h",
"test/test_web_app_database_factory.cc",
"test/test_web_app_database_factory.h",
+ "test/test_web_app_registry_controller.cc",
+ "test/test_web_app_registry_controller.h",
"test/test_web_app_ui_manager.cc",
"test/test_web_app_ui_manager.h",
"test/test_web_app_url_loader.cc",
@@ -166,6 +169,7 @@ source_set("web_applications_browser_tests") {
sources = [
"pending_app_manager_impl_browsertest.cc",
+ "web_app_icon_manager_browsertest.cc",
]
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
diff --git a/chromium/chrome/browser/web_applications/components/BUILD.gn b/chromium/chrome/browser/web_applications/components/BUILD.gn
index d8ff81bdce2..821b78f7afc 100644
--- a/chromium/chrome/browser/web_applications/components/BUILD.gn
+++ b/chromium/chrome/browser/web_applications/components/BUILD.gn
@@ -9,10 +9,15 @@ source_set("components") {
"app_registrar.cc",
"app_registrar.h",
"app_registrar_observer.h",
+ "app_registry_controller.cc",
+ "app_registry_controller.h",
+ "app_shortcut_manager.cc",
+ "app_shortcut_manager.h",
"external_install_options.cc",
"external_install_options.h",
"externally_installed_web_app_prefs.cc",
"externally_installed_web_app_prefs.h",
+ "file_handler_manager.cc",
"file_handler_manager.h",
"install_bounce_metric.cc",
"install_bounce_metric.h",
@@ -36,6 +41,9 @@ source_set("components") {
"web_app_constants.h",
"web_app_data_retriever.cc",
"web_app_data_retriever.h",
+ "web_app_file_handler_registration.cc",
+ "web_app_file_handler_registration.h",
+ "web_app_file_handler_registration_win.cc",
"web_app_helpers.cc",
"web_app_helpers.h",
"web_app_icon_generator.cc",
@@ -101,6 +109,7 @@ source_set("unit_tests") {
testonly = true
sources = [
+ "file_handler_manager_unittest.cc",
"pending_app_manager_unittest.cc",
"web_app_data_retriever_unittest.cc",
"web_app_helpers_unittest.cc",
diff --git a/chromium/chrome/browser/web_applications/extensions/BUILD.gn b/chromium/chrome/browser/web_applications/extensions/BUILD.gn
index 0f7147cf70b..7fb53aaa719 100644
--- a/chromium/chrome/browser/web_applications/extensions/BUILD.gn
+++ b/chromium/chrome/browser/web_applications/extensions/BUILD.gn
@@ -18,6 +18,10 @@ source_set("extensions") {
"bookmark_app_install_finalizer.h",
"bookmark_app_registrar.cc",
"bookmark_app_registrar.h",
+ "bookmark_app_registry_controller.cc",
+ "bookmark_app_registry_controller.h",
+ "bookmark_app_shortcut_manager.cc",
+ "bookmark_app_shortcut_manager.h",
"bookmark_app_util.cc",
"bookmark_app_util.h",
"web_app_extension_shortcut.cc",
@@ -80,6 +84,7 @@ source_set("browser_tests") {
"bookmark_app_registrar_browsertest.cc",
"system_web_app_manager_browsertest.cc",
"system_web_app_manager_browsertest.h",
+ "system_web_app_manager_browsertest_chromeos.cc",
"web_app_audio_focus_browsertest.cc",
]
@@ -91,6 +96,7 @@ source_set("browser_tests") {
"//chrome/app/theme:chrome_unscaled_resources_grit",
"//chrome/browser",
"//chrome/browser/ui",
+ "//chrome/browser/web_applications",
"//chrome/browser/web_applications:web_app_test_group",
"//chrome/browser/web_applications:web_applications_on_extensions",
"//chrome/browser/web_applications:web_applications_on_extensions_test_support",
@@ -103,4 +109,11 @@ source_set("browser_tests") {
"//extensions/common",
"//net:test_support",
]
+
+ if (is_chromeos) {
+ deps += [
+ "//chromeos/components/media_app_ui",
+ "//chromeos/constants",
+ ]
+ }
}
diff --git a/chromium/chrome/browser/web_applications/proto/BUILD.gn b/chromium/chrome/browser/web_applications/proto/BUILD.gn
index eae2f64bf34..1a555417347 100644
--- a/chromium/chrome/browser/web_applications/proto/BUILD.gn
+++ b/chromium/chrome/browser/web_applications/proto/BUILD.gn
@@ -5,7 +5,9 @@
import("//third_party/protobuf/proto_library.gni")
proto_library("proto") {
+ import_dirs = [ "//components/sync/protocol" ]
sources = [
"web_app.proto",
]
+ link_deps = [ "//components/sync/protocol" ]
}
diff --git a/chromium/chrome/browser/win/conflicts/BUILD.gn b/chromium/chrome/browser/win/conflicts/BUILD.gn
index 36ea28cbf12..b5768b88866 100644
--- a/chromium/chrome/browser/win/conflicts/BUILD.gn
+++ b/chromium/chrome/browser/win/conflicts/BUILD.gn
@@ -31,7 +31,7 @@ source_set("module_info") {
deps = [
"//base:i18n",
- "//chrome/common/safe_browsing:binary_feature_extractor",
+ "//chrome/common/safe_browsing:pe_image_reader",
]
}