From 328aadd8c9cab6972d3bc594f37fc5c0bef8c757 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Wed, 24 Jul 2019 17:50:41 -0400 Subject: [PATCH 01/55] Update patches from Chromium 76.0.3809.100 to Chromium 77.0.3865.42 --- patches/build-config-BUILDCONFIG.gn.patch | 2 +- patches/build-config-android-config.gni.patch | 2 +- patches/chrome-BUILD.gn.patch | 28 +++++------ patches/chrome-VERSION.patch | 8 ++-- patches/chrome-android-BUILD.gn.patch | 20 ++++---- ...id-java-res-layout-toolbar_phone.xml.patch | 4 +- ...d-java-res-layout-toolbar_tablet.xml.patch | 2 +- ...e-android-java-res-values-dimens.xml.patch | 4 +- ...droid-java-res-values-v17-styles.xml.patch | 8 ++-- ...me-browser-ChromeTabbedActivity.java.patch | 4 +- ...erences-ChromePreferenceManager.java.patch | 2 +- ...arch_engines-TemplateUrlService.java.patch | 30 ------------ ...-browser-toolbar-ToolbarManager.java.patch | 8 ++-- ...rowser-toolbar-top-ToolbarPhone.java.patch | 12 ++--- ...e-browser-util-FeatureUtilities.java.patch | 6 +-- patches/chrome-android-java_sources.gni.patch | 4 +- patches/chrome-app-BUILD.gn.patch | 6 +-- patches/chrome-app-chrome_dll.rc.patch | 2 +- patches/chrome-browser-BUILD.gn.patch | 6 +-- patches/chrome-browser-about_flags.cc.patch | 4 +- ...e-autocomplete_classifier_factory.cc.patch | 2 +- ...hrome-browser-browser_process_impl.h.patch | 4 +- ...wser-chrome_content_browser_client.h.patch | 6 +-- ...ngs-tab_specific_content_settings.cc.patch | 6 +-- ...wser-devtools-devtools_ui_bindings.h.patch | 2 +- ...rivate-webrtc_logging_private_api.cc.patch | 2 +- ...-chrome_extensions_browser_client.cc.patch | 4 +- ...rowser-extensions-component_loader.h.patch | 8 ++-- ...tensions-extension_install_prompt.cc.patch | 4 +- ...xtensions-extension_install_prompt.h.patch | 2 +- ...r-extensions-extension_management.cc.patch | 4 +- ...rotocol-external_protocol_handler.cc.patch | 4 +- ...-external_process_importer_client.cc.patch | 4 +- ...ter-external_process_importer_host.h.patch | 2 +- ...me-browser-importer-importer_list.cc.patch | 2 +- patches/chrome-browser-io_thread.cc.patch | 12 ----- ...-media-webrtc-webrtc_log_uploader.cc.patch | 6 +-- ...rowser-net-chrome_network_delegate.h.patch | 12 ++--- ...chrome_url_request_context_getter.cc.patch | 29 ----------- ...-browser-net-net_error_tab_helper.cc.patch | 4 +- ...et-system_network_context_manager.cc.patch | 4 +- ...otification_platform_bridge_linux.cc.patch | 4 +- ...er-permissions-permission_manager.cc.patch | 10 ++-- ...r-permissions-permission_uma_util.cc.patch | 2 +- ...gins-chrome_plugin_service_filter.cc.patch | 4 +- ...-plugins-plugins_resource_service.cc.patch | 2 +- ...hrome-browser-prefs-browser_prefs.cc.patch | 6 +-- .../chrome-browser-profiles-profile.cc.patch | 4 +- ...ome-browser-profiles-profile_impl.cc.patch | 2 +- ...-browser-profiles-profile_io_data.cc.patch | 13 +---- ...-browser-profiles-profile_manager.cc.patch | 10 ++-- ...e-browser-profiles-profile_manager.h.patch | 10 ++-- ...text_menu-render_view_context_menu.h.patch | 4 +- ...r-resources-bookmarks-bookmarks.html.patch | 4 +- ...ser-resources-bookmarks-toolbar.html.patch | 2 +- ...r-resources-downloads-downloads.html.patch | 4 +- ...ser-resources-downloads-manager.html.patch | 8 ++-- ...ser-resources-downloads-toolbar.html.patch | 2 +- ...rowser-resources-extensions-BUILD.gn.patch | 2 +- ...resources-extensions-extensions.html.patch | 4 +- ...-resources-extensions-item_list.html.patch | 4 +- ...er-resources-extensions-sidebar.html.patch | 6 +-- ...er-resources-extensions-toolbar.html.patch | 8 ++-- ...e-browser-resources-history-app.html.patch | 6 +-- ...owser-resources-history-history.html.patch | 4 +- ...-resources-history-history_item.html.patch | 2 +- ...sources-history-history_toolbar.html.patch | 2 +- ...s-local_discovery-local_discovery.js.patch | 6 +-- ...-browser-resources-settings-BUILD.gn.patch | 2 +- ...-settings-about_page-about_page.html.patch | 4 +- ...es-settings-about_page-about_page.js.patch | 4 +- ...ance_page-appearance_fonts_page.html.patch | 4 +- ...appearance_page-appearance_page.html.patch | 6 +-- ...autofill_page-passwords_section.html.patch | 4 +- ...-people_page-import_data_dialog.html.patch | 2 +- ...ettings-people_page-people_page.html.patch | 12 ++--- ...ngs-printing_page-printing_page.html.patch | 6 +-- ...cy_page-personalization_options.html.patch | 2 +- ...tings-privacy_page-privacy_page.html.patch | 2 +- ...-browser-resources-settings-route.js.patch | 6 +-- ...ser-resources-settings-settings.html.patch | 8 ++-- ...ettings-settings_ui-settings_ui.html.patch | 6 +-- ...ings-site_settings-site_details.html.patch | 4 +- ...ettings_page-site_settings_page.html.patch | 8 ++-- ..._settings_page-site_settings_page.js.patch | 4 +- ...browsing-client_side_model_loader.cc.patch | 2 +- ...e-browser-shell_integration_linux.cc.patch | 6 +-- ...-account_consistency_mode_manager.cc.patch | 4 +- ...er-spellcheck_hunspell_dictionary.cc.patch | 4 +- ...sync-profile_sync_service_factory.cc.patch | 4 +- patches/chrome-browser-ui-BUILD.gn.patch | 6 +-- ...-save_card_bubble_controller_impl.cc.patch | 4 +- patches/chrome-browser-ui-browser.h.patch | 4 +- ...rome-browser-ui-browser_navigator.cc.patch | 4 +- ...rowser-ui-cocoa-main_menu_builder.mm.patch | 2 +- ...ings-content_setting_bubble_model.cc.patch | 6 +-- ...-extension_action_view_controller.cc.patch | 8 ++-- ...s-extension_action_view_controller.h.patch | 2 +- ...ions-icon_with_badge_image_source.cc.patch | 2 +- ...rome-browser-ui-libgtkui-gtk_util.cc.patch | 4 +- ...me-browser-ui-page_info-page_info.cc.patch | 8 ++-- ...browser-ui-page_info-page_info_ui.cc.patch | 6 +-- ...r-ui-startup-startup_tab_provider.cc.patch | 4 +- .../chrome-browser-ui-tab_helpers.cc.patch | 4 +- ...chrome_location_bar_model_delegate.h.patch | 10 ++-- ...r-ui-toolbar-toolbar_actions_model.h.patch | 4 +- ...rowser-ui-views-accelerator_table.cc.patch | 4 +- ...ws-bookmarks-bookmark_bubble_view.cc.patch | 2 +- ...-views-download-download_item_view.h.patch | 2 +- ...-views-extensions-extension_popup.cc.patch | 2 +- ...ws-location_bar-location_bar_view.cc.patch | 6 +-- ...ews-location_bar-location_bar_view.h.patch | 10 ++-- ...ion_bubble-permission_prompt_impl.cc.patch | 2 +- ...ws-profiles-avatar_toolbar_button.cc.patch | 4 +- ...ews-profiles-avatar_toolbar_button.h.patch | 8 ++-- ...ews-profiles-profile_chooser_view.cc.patch | 6 +-- ...iews-profiles-profile_chooser_view.h.patch | 8 ++-- ...me-browser-ui-views-tabs-tab_icon.cc.patch | 4 +- ...ser-ui-views-tabs-tab_style_views.cc.patch | 4 +- ...-toolbar-browser_actions_container.h.patch | 4 +- ...s-toolbar-browser_app_menu_button.cc.patch | 10 ++-- ...ser-ui-views-toolbar-toolbar_view.cc.patch | 4 +- ...wser-ui-views-toolbar-toolbar_view.h.patch | 10 ++-- ...s-translate-translate_bubble_view.cc.patch | 4 +- ...ws-translate-translate_bubble_view.h.patch | 4 +- ...r-ui-webui-bookmarks-bookmarks_ui.cc.patch | 4 +- ...-chrome_web_ui_controller_factory.cc.patch | 4 +- ...rome-browser-ui-webui-devtools_ui.cc.patch | 2 +- ...r-ui-webui-downloads-downloads_ui.cc.patch | 4 +- ...ui-webui-extensions-extensions_ui.cc.patch | 4 +- ...hrome-browser-ui-webui-history_ui.cc.patch | 4 +- ...edia_router_webui_message_handler.cc.patch | 35 -------------- ...ttings_localized_strings_provider.cc.patch | 4 +- ...ome-browser-ui-webui-theme_source.cc.patch | 10 ++-- ...de_detector-upgrade_detector_impl.cc.patch | 6 +-- ...ade_detector-upgrade_detector_impl.h.patch | 2 +- ...s-components-web_app_shortcut_mac.mm.patch | 4 +- patches/chrome-common-BUILD.gn.patch | 6 +-- patches/chrome-installer-linux-BUILD.gn.patch | 14 +++--- .../chrome-installer-mac-sign_chrome.py.patch | 2 +- ...me-installer-mac-signing-pipeline.py.patch | 2 +- ...me-installer-mini_installer-BUILD.gn.patch | 4 +- ...e-installer-setup-installer_state.cc.patch | 4 +- ...aller-util-google_update_settings.cc.patch | 4 +- patches/chrome-renderer-BUILD.gn.patch | 4 +- ...er-chrome_content_renderer_client.cc.patch | 4 +- ...rer-chrome_content_renderer_client.h.patch | 4 +- patches/chrome-test-BUILD.gn.patch | 4 +- patches/chrome-utility-BUILD.gn.patch | 2 +- ...utility-importer-firefox_importer.cc.patch | 4 +- ...ntent_settings-core-browser-BUILD.gn.patch | 2 +- ...ore-browser-content_settings_pref.cc.patch | 4 +- ...ser-content_settings_pref_provider.h.patch | 4 +- ...browser-content_settings_registry.cc.patch | 4 +- ...-crash-content-app-breakpad_linux.cc.patch | 10 ++-- ...owser-distiller_page_web_contents.cc.patch | 4 +- ...nternal-common-download_item_impl.cc.patch | 6 +-- ...onents-gcm_driver-gcm_client_impl.cc.patch | 10 ++-- ...lidation-impl-fcm_network_handler.cc.patch | 4 +- .../components-omnibox-browser-BUILD.gn.patch | 4 +- ...ox-browser-autocomplete_controller.h.patch | 4 +- ...ore-browser-password_form_filling.cc.patch | 4 +- ...wsing-db-v4_protocol_manager_util.cc.patch | 2 +- ...arch_engines-TemplateUrlService.java.patch | 30 ++++++++++++ ...ch_engines-prepopulated_engines.json.patch | 2 +- patches/components-sync-base-BUILD.gn.patch | 4 +- ...c-driver-glue-sync_engine_backend.cc.patch | 4 +- ...-sync-driver-glue-sync_engine_impl.h.patch | 4 +- ...-sync-driver-profile_sync_service.cc.patch | 4 +- ...s-sync-driver-profile_sync_service.h.patch | 6 +-- ...omponents-sync-engine-sync_manager.h.patch | 4 +- ...ync-engine_impl-sync_manager_impl.cc.patch | 4 +- ...c-engine_impl-sync_scheduler_impl.cc.patch | 4 +- ...nc-engine_impl-sync_scheduler_impl.h.patch | 2 +- ...okmarks-bookmark_change_processor.cc.patch | 16 +++---- ...ookmarks-bookmark_change_processor.h.patch | 2 +- ...vice_info-device_info_sync_bridge.cc.patch | 4 +- .../components-version_info-BUILD.gn.patch | 2 +- .../content-browser-browser_main_loop.h.patch | 4 +- ...hild_process_security_policy_impl.cc.patch | 4 +- ...e_host-navigation_controller_impl.cc.patch | 4 +- ...ser-frame_host-navigation_request.cc.patch | 10 ++-- ...ssions-permission_controller_impl.cc.patch | 8 ++-- ...rmissions-permission_service_impl.cc.patch | 10 ++-- ...nt-browser-storage_partition_impl.cc.patch | 6 +-- .../content-child-child_thread_impl.cc.patch | 4 +- patches/content-common-BUILD.gn.patch | 2 +- ...-public-browser-browser_main_parts.h.patch | 4 +- ...lic-browser-content_browser_client.h.patch | 4 +- ...ent-public-browser-permission_type.h.patch | 8 ++-- ...nt-public-browser-url_data_source.cc.patch | 8 ++-- ...ntent-renderer-render_thread_impl.cc.patch | 4 +- ...ons-browser-api-socket-tcp_socket.cc.patch | 4 +- ...r-api-web_request-web_request_api.cc.patch | 4 +- ...er-extension_event_histogram_value.h.patch | 8 ++-- ...ns-browser-updater-update_service.cc.patch | 2 +- ...mmon-permissions-permissions_data.cc.patch | 4 +- patches/extensions-renderer-BUILD.gn.patch | 6 +-- .../extensions-renderer-dispatcher.cc.patch | 4 +- ...r-native_extension_bindings_system.h.patch | 2 +- patches/google_apis-gaia-gaia_urls.cc.patch | 2 +- ...-blink-key_system_config_selector.cc.patch | 4 +- ...-chromium_bindings_configuration.gni.patch | 6 +-- patches/net-BUILD.gn.patch | 4 +- patches/net-cookies-canonical_cookie.cc.patch | 2 +- ...solution-proxy_resolution_service.cc.patch | 4 +- .../net-socket-socks5_client_socket.cc.patch | 8 ++-- .../services-network-network_context.cc.patch | 6 +-- ...ervices-network-tls_client_socket.cc.patch | 2 +- ...e_manager-sandbox-win-sandbox_win.cc.patch | 4 +- patches/testing-iossim-iossim.mm.patch | 13 ----- ...c-mojom-permissions-permission.mojom.patch | 10 ++-- ...e-html-canvas-html_canvas_element.cc.patch | 6 +-- ...enderer-core-svg-svg_path_element.cc.patch | 2 +- ...core-svg-svg_text_content_element.cc.patch | 4 +- ...arty-blink-renderer-modules-BUILD.gn.patch | 4 +- ...anvas2d-base_rendering_context_2d.cc.patch | 8 ++-- ...canvas2d-base_rendering_context_2d.h.patch | 2 +- ...vas2d-canvas_rendering_context_2d.cc.patch | 10 ++-- ...as2d-canvas_rendering_context_2d.idl.patch | 2 +- ...eerconnection-rtc_peer_connection.cc.patch | 20 ++++---- ...erer-modules-webaudio-audio_buffer.h.patch | 2 +- ...er-modules-webaudio-audio_buffer.idl.patch | 4 +- ...bgl-webgl2_rendering_context_base.cc.patch | 8 ++-- ...ebgl-webgl_rendering_context_base.cc.patch | 48 +++++++++---------- patches/tools-gritsettings-resource_ids.patch | 4 +- ..._schema_compiler-feature_compiler.py.patch | 4 +- ...ls-metrics-histograms-histograms.xml.patch | 4 +- patches/ui-base-BUILD.gn.patch | 4 +- patches/ui-native_theme-native_theme.h.patch | 6 +-- .../ui-native_theme-native_theme_win.h.patch | 6 +-- ...ar-cr_toolbar_selection_overlay.html.patch | 8 ++-- ...elements-paper_button_style_css.html.patch | 12 ----- ...es-cr_elements-shared_style_css.html.patch | 2 +- ...ces-cr_elements-shared_vars_css.html.patch | 2 +- ...ui-webui-resources-css-md_colors.css.patch | 2 +- 236 files changed, 621 insertions(+), 727 deletions(-) delete mode 100644 patches/chrome-android-java-src-org-chromium-chrome-browser-search_engines-TemplateUrlService.java.patch delete mode 100644 patches/chrome-browser-io_thread.cc.patch delete mode 100644 patches/chrome-browser-net-chrome_url_request_context_getter.cc.patch delete mode 100644 patches/chrome-browser-ui-webui-media_router-media_router_webui_message_handler.cc.patch create mode 100644 patches/components-search_engines-android-java-src-org-chromium-components-search_engines-TemplateUrlService.java.patch delete mode 100644 patches/testing-iossim-iossim.mm.patch delete mode 100644 patches/ui-webui-resources-cr_elements-paper_button_style_css.html.patch diff --git a/patches/build-config-BUILDCONFIG.gn.patch b/patches/build-config-BUILDCONFIG.gn.patch index 3dc90e750b6..abdda3f3564 100644 --- a/patches/build-config-BUILDCONFIG.gn.patch +++ b/patches/build-config-BUILDCONFIG.gn.patch @@ -1,5 +1,5 @@ diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index 7063da0f26c5691f01214c2dc014128d7c8c5e09..3e18855c2a74036033999cd060a7f577925d0ee4 100644 +index db7ab0255b482d4e1fd20a31cfec86a24546602a..1cc44592d0d854f17cf3d2f5a5e0c2ed76b2d025 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -419,6 +419,7 @@ set_sources_assignment_filter(sources_assignment_filter) diff --git a/patches/build-config-android-config.gni.patch b/patches/build-config-android-config.gni.patch index c2f7ac19d1c..5c4bffb9cc2 100644 --- a/patches/build-config-android-config.gni.patch +++ b/patches/build-config-android-config.gni.patch @@ -1,5 +1,5 @@ diff --git a/build/config/android/config.gni b/build/config/android/config.gni -index 58838421c8a3cb995d3b41c59fac24523c57dafa..fb3715e80a24f7de149e7d7301e209a148c30d0f 100644 +index bed796ebe45e47af39bb3f27383cf23bc028adb3..7c0707454b7e3c435d793c1e300755f3d8bcb9c2 100644 --- a/build/config/android/config.gni +++ b/build/config/android/config.gni @@ -3,6 +3,7 @@ diff --git a/patches/chrome-BUILD.gn.patch b/patches/chrome-BUILD.gn.patch index 3b6aa634725..06def7ce625 100644 --- a/patches/chrome-BUILD.gn.patch +++ b/patches/chrome-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace21f4991c 100644 +index 0c52ff3c73580e38b2828fabdeb0e9c340428ca3..c99d78bb59960edf586b9079677dcbf0b7ea6f92 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -190,6 +190,10 @@ if (!is_android && !is_mac) { @@ -13,7 +13,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace deps += [ ":chrome_dll", -@@ -289,6 +293,7 @@ if (!is_android && !is_mac) { +@@ -297,6 +301,7 @@ if (!is_android && !is_mac) { "//headless:headless_shell_lib", "//services/service_manager/embedder", ] @@ -21,7 +21,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace public_deps = [ ":xdg_mime", # Needs to be public for installer to consume files. -@@ -435,6 +440,7 @@ if (is_win) { +@@ -431,6 +436,7 @@ if (is_win) { "//third_party/wtl", "//ui/views", ] @@ -29,7 +29,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace ldflags = [ "/DELAYLOAD:advapi32.dll", -@@ -569,6 +575,7 @@ if (is_win) { +@@ -566,6 +572,7 @@ if (is_win) { "//headless:headless_shell_child_lib", "//services/service_manager/embedder", ] @@ -37,7 +37,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace ldflags = [ "/DELAYLOAD:comctl32.dll", -@@ -680,6 +687,11 @@ if (is_win) { +@@ -677,6 +684,11 @@ if (is_win) { ] } @@ -49,7 +49,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace mac_app_bundle("chrome_app") { output_name = chrome_product_full_name -@@ -713,6 +725,7 @@ if (is_win) { +@@ -710,6 +722,7 @@ if (is_win) { rebase_path("app/app.exports", root_build_dir) ] } } @@ -57,7 +57,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace compiled_action("chrome_app_strings") { tool = "//chrome/tools/build/mac:infoplist_strings_tool" -@@ -742,7 +755,7 @@ if (is_win) { +@@ -739,7 +752,7 @@ if (is_win) { args = [ "-b", @@ -66,7 +66,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace "-v", rebase_path(chrome_version_file, root_build_dir), "-g", -@@ -823,7 +836,7 @@ if (is_win) { +@@ -820,7 +833,7 @@ if (is_win) { # framework itself, that would cause a cyclical dependency. Instead, # this dependency directly copies the file into the framework's # resources directory. @@ -75,7 +75,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace } } -@@ -1249,6 +1262,7 @@ if (is_win) { +@@ -1247,6 +1260,7 @@ if (is_win) { "//services/service_manager/embedder", "//third_party/cld_3/src/src:cld_3", ] @@ -83,7 +83,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace if (is_component_build) { libs = [ "Carbon.framework" ] -@@ -1313,6 +1327,10 @@ if (is_win) { +@@ -1311,6 +1325,10 @@ if (is_win) { if (is_chrome_branded) { deps += [ ":default_apps" ] } @@ -94,7 +94,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace ldflags = [ "-Wl,-install_name,@executable_path/../Frameworks/$chrome_framework_name.framework/Versions/$chrome_version_full/$chrome_framework_name" ] -@@ -1483,6 +1501,7 @@ if (is_win) { +@@ -1475,6 +1493,7 @@ if (is_win) { group("browser_dependencies") { public_deps = [ @@ -102,7 +102,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace "//chrome/browser", "//chrome/common", "//components/gwp_asan/buildflags", -@@ -1556,13 +1575,14 @@ group("child_dependencies") { +@@ -1547,13 +1566,14 @@ group("child_dependencies") { # this is OK because all of content is linked into one library. "//content/browser", ] @@ -118,7 +118,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace ] output = "$target_gen_dir/chrome_exe_version.rc" } -@@ -1635,6 +1655,7 @@ group("resources") { +@@ -1626,6 +1646,7 @@ group("resources") { "//chrome/browser:resources", "//chrome/common:resources", "//chrome/renderer:resources", @@ -126,7 +126,7 @@ index e06ba8ee8bcf4cc240029fc66a7c2681786217a0..a77998f9bd28b8a9965a7e10611c2ace ] } -@@ -1886,6 +1907,7 @@ if (is_android) { +@@ -1882,6 +1903,7 @@ if (is_android) { "//content/public/common:service_names", "//services/service_manager/embedder", ] diff --git a/patches/chrome-VERSION.patch b/patches/chrome-VERSION.patch index f0ff6417d58..976c1ea087c 100644 --- a/patches/chrome-VERSION.patch +++ b/patches/chrome-VERSION.patch @@ -1,11 +1,11 @@ diff --git a/chrome/VERSION b/chrome/VERSION -index 36f2781c0fca0d01ba636fc8b1f1dfa3a55f500e..34a721bdf884f3773a67db1efe07d02389ffae15 100644 +index 367e47a3fa1b5e20c76a7a6b48b45ca8a4c899da..5ac1cf4343e1cdfe680abedf1ebe7494ce4afed7 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ - MAJOR=76 + MAJOR=77 MINOR=0 --BUILD=3809 --PATCH=132 +-BUILD=3865 +-PATCH=42 +BUILD=71 +PATCH=46 diff --git a/patches/chrome-android-BUILD.gn.patch b/patches/chrome-android-BUILD.gn.patch index 5d5a5d860e0..350daf5b093 100644 --- a/patches/chrome-android-BUILD.gn.patch +++ b/patches/chrome-android-BUILD.gn.patch @@ -1,17 +1,17 @@ diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn -index 17311184c47823594b49ad07d41bd870efa7af17..8f11dbdaa0491f676a867f5e0ce134d7e32b5a1d 100644 +index 0c5467af2bce341e0b3f0835899c820f60adbc87..fa406bae2b98570995ba1331d2145723e13a9866 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn -@@ -42,7 +42,7 @@ if (dfmify_devtools) { - import("//chrome/android/features/devtools/devtools_module_tmpl.gni") - } +@@ -31,7 +31,7 @@ import("java_sources.gni") + import("static_initializers.gni") + import("trichrome.gni") --manifest_package = "org.chromium.chrome" -+declare_args() { manifest_package = "org.chromium.chrome" } - test_manifest_package = "org.chromium.chrome.tests" +-chrome_public_manifest_package = "org.chromium.chrome" ++declare_args() { chrome_public_manifest_package = "org.chromium.chrome" } + chrome_public_test_manifest_package = "org.chromium.chrome.tests" - chrome_public_jinja_variables = default_chrome_public_jinja_variables + -@@ -110,6 +110,7 @@ android_resources("chrome_app_java_resources") { + chrome_public_jinja_variables = +@@ -100,6 +100,7 @@ android_resources("chrome_app_java_resources") { deps = [ ":chrome_strings_grd", ":ui_locale_string_resources", @@ -19,7 +19,7 @@ index 17311184c47823594b49ad07d41bd870efa7af17..8f11dbdaa0491f676a867f5e0ce134d7 "//chrome/android/webapk/libs/common:splash_resources", "//chrome/app:java_strings_grd", "//components/autofill/android:autofill_java_resources", -@@ -496,6 +497,7 @@ java_group("chrome_all_java") { +@@ -524,6 +525,7 @@ java_group("chrome_all_java") { group("jni_headers") { public_deps = [ ":chrome_jni_headers", diff --git a/patches/chrome-android-java-res-layout-toolbar_phone.xml.patch b/patches/chrome-android-java-res-layout-toolbar_phone.xml.patch index fbbfb107a7b..68d2ba6213f 100644 --- a/patches/chrome-android-java-res-layout-toolbar_phone.xml.patch +++ b/patches/chrome-android-java-res-layout-toolbar_phone.xml.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/res/layout/toolbar_phone.xml b/chrome/android/java/res/layout/toolbar_phone.xml -index 62a3a3f3dc36d6417519832e987466ff26a18ea2..3c8c8cf4d83efae421571f57a5cc978dad4dab53 100644 +index fe66549d3ac660c12186e0c9c78c7ed525f2015d..9f2fad8590812ececbf1b9d04ec493c2ed7da425 100644 --- a/chrome/android/java/res/layout/toolbar_phone.xml +++ b/chrome/android/java/res/layout/toolbar_phone.xml @@ -31,6 +31,7 @@ @@ -12,7 +12,7 @@ index 62a3a3f3dc36d6417519832e987466ff26a18ea2..3c8c8cf4d83efae421571f57a5cc978d + diff --git a/patches/chrome-android-java-res-layout-toolbar_tablet.xml.patch b/patches/chrome-android-java-res-layout-toolbar_tablet.xml.patch index 4b7cd9f991a..aeeef6e3a5a 100644 --- a/patches/chrome-android-java-res-layout-toolbar_tablet.xml.patch +++ b/patches/chrome-android-java-res-layout-toolbar_tablet.xml.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/res/layout/toolbar_tablet.xml b/chrome/android/java/res/layout/toolbar_tablet.xml -index 4ead17fd19f45a22d4c13877726b58658ac82e89..1a1d924eabe7f45f3f0c4b406bbac096a2375a2d 100644 +index 12630f4cd02676d1676eaea5617bf20689192697..b7a56a2411f439d3ac476bcf33f5996d5ef047ac 100644 --- a/chrome/android/java/res/layout/toolbar_tablet.xml +++ b/chrome/android/java/res/layout/toolbar_tablet.xml @@ -75,6 +75,7 @@ diff --git a/patches/chrome-android-java-res-values-dimens.xml.patch b/patches/chrome-android-java-res-values-dimens.xml.patch index ef98172f380..81f16f0db9f 100644 --- a/patches/chrome-android-java-res-values-dimens.xml.patch +++ b/patches/chrome-android-java-res-values-dimens.xml.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml -index 2d3a1ddc2d73e0a76b7115d6e0fa1bedd0ab659c..b803e7ed86d9632dd4f97d0d5bc7356ed6656ee9 100644 +index e0a078063054229131277ff3878e6ef3ebeee61f..d93f0de960c134608342ba21c80151b9b6f80515 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml -@@ -285,7 +285,7 @@ +@@ -287,7 +287,7 @@ 40dp diff --git a/patches/chrome-android-java-res-values-v17-styles.xml.patch b/patches/chrome-android-java-res-values-v17-styles.xml.patch index 0390119101c..95f0f5ee1bc 100644 --- a/patches/chrome-android-java-res-values-v17-styles.xml.patch +++ b/patches/chrome-android-java-res-values-v17-styles.xml.patch @@ -1,10 +1,10 @@ diff --git a/chrome/android/java/res/values-v17/styles.xml b/chrome/android/java/res/values-v17/styles.xml -index c851e676d0dffd3e5a53641e3cb4f2f434d3a984..fbb0802b0f13383131fce4a19ebc74cbce1d91b4 100644 +index 5b41c992fb2b17c1b8a8a06ecc09460c4190fa86..b4a36c8d48dcc89a1dd0e9c661f4d3eedc757ed8 100644 --- a/chrome/android/java/res/values-v17/styles.xml +++ b/chrome/android/java/res/values-v17/styles.xml -@@ -930,4 +930,5 @@ - @dimen/omnibox_suggestion_edit_url_min_height - @color/default_icon_color +@@ -995,4 +995,5 @@ + viewStart + @style/TextAppearance.BlackTitle1 + diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeTabbedActivity.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeTabbedActivity.java.patch index 919d232c5fe..139aae27375 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeTabbedActivity.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeTabbedActivity.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -index 6bdd439f89a68e8b53bf077547ad04bc35414674..366524b92af5979ed4be1bac159cae6da8896a09 100644 +index a168b085348c218c2951964beb37e0a25d754836..ad5cf672b9548a4f9921c4bc3521a0c8111e998d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -@@ -182,7 +182,7 @@ import java.util.Locale; +@@ -174,7 +174,7 @@ import java.util.Locale; * are accessible via a chrome specific tab switching UI. */ public class ChromeTabbedActivity diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-preferences-ChromePreferenceManager.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-preferences-ChromePreferenceManager.java.patch index defe5bf5bc9..708bcc87765 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-preferences-ChromePreferenceManager.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-preferences-ChromePreferenceManager.java.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java -index 80072b7f7afc55c1d893416b614267edbfb7b2da..091832ed91eea9462378b30ac3ec717e648e211e 100644 +index e269ba6c0436afc362804823e557dfe38c600c3b..fc3699b450c22a9731ccce0723e69dfcf813cf3c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java @@ -21,7 +21,7 @@ import java.util.Set; diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-search_engines-TemplateUrlService.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-search_engines-TemplateUrlService.java.patch deleted file mode 100644 index 6ea203beac6..00000000000 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-search_engines-TemplateUrlService.java.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java b/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java -index 55c72cd215f525a17853cd63f79ecb8b537d4102..3bec2e2c5aedcbf631aadc058c2167c1641a626d 100644 ---- a/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java -@@ -11,6 +11,7 @@ import org.chromium.base.ThreadUtils; - import org.chromium.base.VisibleForTesting; - import org.chromium.base.annotations.CalledByNative; - import org.chromium.base.task.PostTask; -+import org.chromium.chrome.browser.search_engines.BraveTemplateUrlService; - import org.chromium.content_public.browser.UiThreadTaskTraits; - - import java.util.ArrayList; -@@ -49,7 +50,7 @@ public class TemplateUrlService { - public static TemplateUrlService getInstance() { - ThreadUtils.assertOnUiThread(); - if (sService == null) { -- sService = new TemplateUrlService(); -+ sService = new BraveTemplateUrlService(); - } - return sService; - } -@@ -59,7 +60,7 @@ public class TemplateUrlService { - private final ObserverList mObservers = - new ObserverList(); - -- private TemplateUrlService() { -+ protected TemplateUrlService() { - // Note that this technically leaks the native object, however, TemlateUrlService - // is a singleton that lives forever and there's no clean shutdown of Chrome on Android - mNativeTemplateUrlServiceAndroid = nativeInit(); diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-toolbar-ToolbarManager.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-toolbar-ToolbarManager.java.patch index 45011365879..abfffaa0a26 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-toolbar-ToolbarManager.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-toolbar-ToolbarManager.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java -index 5e062152c274c9f03aecd657ac9009705ac48db5..510e5501295785f689599c358ee4ef0112598a48 100644 +index 795a84107a8665a7795a14cba33687d5e5e9f460..5350dd06fc524bd8d64ab40d76cfee220c16f277 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java -@@ -777,6 +777,7 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF +@@ -782,6 +782,7 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF }; final OnClickListener shareButtonListener = v -> { @@ -10,7 +10,7 @@ index 5e062152c274c9f03aecd657ac9009705ac48db5..510e5501295785f689599c358ee4ef01 recordBottomToolbarUseForIPH(); RecordUserAction.record("MobileBottomToolbarShareButton"); boolean isIncognito = false; -@@ -784,6 +785,7 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF +@@ -789,6 +790,7 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF isIncognito = mTabModelSelector.getCurrentTab().isIncognito(); } mActivity.onShareMenuItemSelected(false, isIncognito); @@ -18,7 +18,7 @@ index 5e062152c274c9f03aecd657ac9009705ac48db5..510e5501295785f689599c358ee4ef01 }; mBottomControlsCoordinator = new BottomControlsCoordinator(mActivity.getFullscreenManager(), -@@ -1745,6 +1747,7 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF +@@ -1772,6 +1774,7 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF boolean editingAllowed = currentTab == null || mBookmarkBridge == null || mBookmarkBridge.isEditBookmarksEnabled(); mToolbar.updateBookmarkButton(isBookmarked, editingAllowed); diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-toolbar-top-ToolbarPhone.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-toolbar-top-ToolbarPhone.java.patch index d1e4a98b14b..42f6915daa3 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-toolbar-top-ToolbarPhone.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-toolbar-top-ToolbarPhone.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java -index a89b91492e39563c09629a6cd27dd70d685927eb..ddb6ba9ae2bb6a60b82a37d336a8d00fdb8480bc 100644 +index 6b0082fe76b27d72b5d90c7047e9e23173dd0afc..cc1ab03f9a7c149da521375cfc18b70aaa83fdd2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java -@@ -88,7 +88,7 @@ import java.util.List; +@@ -86,7 +86,7 @@ import java.util.List; /** * Phone specific toolbar implementation. */ @@ -11,7 +11,7 @@ index a89b91492e39563c09629a6cd27dd70d685927eb..ddb6ba9ae2bb6a60b82a37d336a8d00f NewTabPage.OnSearchBoxScrollListener, TabCountObserver { /** The amount of time transitioning from one theme color to another should take in ms. */ -@@ -426,10 +426,12 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O +@@ -422,10 +422,12 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O /** * Set the background color of the location bar to appropriately match the theme color. */ @@ -25,7 +25,7 @@ index a89b91492e39563c09629a6cd27dd70d685927eb..ddb6ba9ae2bb6a60b82a37d336a8d00f } /** -@@ -546,6 +548,7 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O +@@ -542,6 +544,7 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O .notifyEvent(EventConstants.PARTNER_HOME_PAGE_BUTTON_PRESSED); } } @@ -33,7 +33,7 @@ index a89b91492e39563c09629a6cd27dd70d685927eb..ddb6ba9ae2bb6a60b82a37d336a8d00f } @Override -@@ -719,7 +722,7 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O +@@ -715,7 +718,7 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O * @return The right bounds of the location bar after accounting for any visible left buttons. */ private int getBoundsAfterAccountingForRightButtons() { @@ -42,7 +42,7 @@ index a89b91492e39563c09629a6cd27dd70d685927eb..ddb6ba9ae2bb6a60b82a37d336a8d00f } private void updateToolbarBackground(int color) { -@@ -2129,6 +2132,7 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O +@@ -2130,6 +2133,7 @@ public class ToolbarPhone extends ToolbarLayout implements Invalidator.Client, O } else { populateUrlClearFocusingAnimatorSet(animators); } diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-util-FeatureUtilities.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-util-FeatureUtilities.java.patch index df6655889f9..91bd72cf1c1 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-util-FeatureUtilities.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-util-FeatureUtilities.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java b/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java -index a1fd6aced1b2dfe6eca978d1977517383913cd37..0482c54fb467960002133d7203a43e2ec6baf6d1 100644 +index e5270f604ea8b8ee9f27b2e7c89e4945e6e45d60..deb382908cfd0112b7cc0ee02282d8eabf209b5f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java -@@ -491,6 +491,7 @@ public class FeatureUtilities { +@@ -457,6 +457,7 @@ public class FeatureUtilities { * @return Whether or not the bottom toolbar is enabled. */ public static boolean isBottomToolbarEnabled() { @@ -10,7 +10,7 @@ index a1fd6aced1b2dfe6eca978d1977517383913cd37..0482c54fb467960002133d7203a43e2e if (sIsBottomToolbarEnabled == null) { ChromePreferenceManager prefManager = ChromePreferenceManager.getInstance(); -@@ -502,6 +503,7 @@ public class FeatureUtilities { +@@ -468,6 +469,7 @@ public class FeatureUtilities { && !DeviceFormFactor.isNonMultiDisplayContextOnTablet( ContextUtils.getApplicationContext()) && !isTabGroupsAndroidEnabled(); diff --git a/patches/chrome-android-java_sources.gni.patch b/patches/chrome-android-java_sources.gni.patch index 73b0b720e16..3c717850b9c 100644 --- a/patches/chrome-android-java_sources.gni.patch +++ b/patches/chrome-android-java_sources.gni.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni -index 8aedf50897e9b40ca6b9617bb1a8ac766a6da16a..3ec678a94edda05c74640dcdbf63792a12ecc3dc 100644 +index ba374328abaf898aa5dd233f12673efb558c99ae..546ee1b26bbc68ca2c2d94aa42b93c836debac4f 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni -@@ -15,6 +15,7 @@ import("//components/offline_pages/buildflags/features.gni") +@@ -17,6 +17,7 @@ import("//components/offline_pages/buildflags/features.gni") import("//device/vr/buildflags/buildflags.gni") chrome_java_sources += public_autofill_assistant_java_sources diff --git a/patches/chrome-app-BUILD.gn.patch b/patches/chrome-app-BUILD.gn.patch index 8475bb01e1f..a5f626baa26 100644 --- a/patches/chrome-app-BUILD.gn.patch +++ b/patches/chrome-app-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn -index 590c4edcededad77172ae30e85b388b91d305b8e..ff494f3afd3dfaed475c89313116a45f64ffb565 100644 +index 6e5ec5df6fb27d3e359304ed1eed873256bdd349..070bb918c76a46a8f2f8003ecf9d616e8982bbec 100644 --- a/chrome/app/BUILD.gn +++ b/chrome/app/BUILD.gn @@ -186,6 +186,8 @@ grit("generated_resources") { @@ -20,10 +20,10 @@ index 590c4edcededad77172ae30e85b388b91d305b8e..ff494f3afd3dfaed475c89313116a45f defines = chrome_grit_defines output_dir = "$root_gen_dir/chrome" outputs = [ -@@ -348,6 +350,7 @@ static_library("test_support") { +@@ -347,6 +349,7 @@ static_library("test_support") { + "//components/gwp_asan/buildflags", "//components/nacl/common:buildflags", "//components/startup_metric_utils/browser:lib", - "//components/tracing", + "//components/unified_consent", "//content/public/app:both", "//content/public/common", diff --git a/patches/chrome-app-chrome_dll.rc.patch b/patches/chrome-app-chrome_dll.rc.patch index 02b7b7e2370..2581bf123ad 100644 --- a/patches/chrome-app-chrome_dll.rc.patch +++ b/patches/chrome-app-chrome_dll.rc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/app/chrome_dll.rc b/chrome/app/chrome_dll.rc -index d994493407e6dc5c640dd16ce488818800c09d14..90846e8502e2cda2fd3a3bad4749f9977c501b12 100644 +index 80a15b55d54f55ca13d6d79b3fd75d28ae0d647f..a0aa8fa83a4e93f7689a0ece2e6dbf9d10a4c175 100644 --- a/chrome/app/chrome_dll.rc +++ b/chrome/app/chrome_dll.rc @@ -164,6 +164,16 @@ END diff --git a/patches/chrome-browser-BUILD.gn.patch b/patches/chrome-browser-BUILD.gn.patch index ab0a6ad1608..6086173f205 100644 --- a/patches/chrome-browser-BUILD.gn.patch +++ b/patches/chrome-browser-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 4f9844f6f8546efe591e679c41c7cd3b43c371a8..0e86b115bef94df9821adeffe944b0d3a63b587c 100644 +index dc27928a79181b702f34609c83e51fa0c1c31c02..02d362d9d24c25b922e2b3c895a134beaa8ca291 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -2142,6 +2142,7 @@ jumbo_split_static_library("browser") { +@@ -2180,6 +2180,7 @@ jumbo_split_static_library("browser") { "//ui/strings", "//ui/surface", "//ui/web_dialogs", @@ -10,7 +10,7 @@ index 4f9844f6f8546efe591e679c41c7cd3b43c371a8..0e86b115bef94df9821adeffe944b0d3 ] if (is_posix || is_fuchsia) { -@@ -2155,6 +2156,7 @@ jumbo_split_static_library("browser") { +@@ -2193,6 +2194,7 @@ jumbo_split_static_library("browser") { } if (is_android) { diff --git a/patches/chrome-browser-about_flags.cc.patch b/patches/chrome-browser-about_flags.cc.patch index f40702e27e6..2bc50ac014a 100644 --- a/patches/chrome-browser-about_flags.cc.patch +++ b/patches/chrome-browser-about_flags.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 61bb2977bb7c9711465a6928b45f6a69be7f4080..c8f888c1423d2e53fc94bffc9db0ab51c86e0a4d 100644 +index 810ae41fd1a53e03bbf41c81cb12ec13fa63d745..a869460695a837035fe756db38c9b19bd93009fa 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -254,14 +254,14 @@ const FeatureEntry::Choice kTouchTextSelectionStrategyChoices[] = { +@@ -266,14 +266,14 @@ const FeatureEntry::Choice kTouchTextSelectionStrategyChoices[] = { const FeatureEntry::Choice kTraceUploadURL[] = { {flags_ui::kGenericExperimentChoiceDisabled, "", ""}, {flag_descriptions::kTraceUploadUrlChoiceOther, switches::kTraceUploadURL, diff --git a/patches/chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch b/patches/chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch index d7b0aaaf610..efb80285f29 100644 --- a/patches/chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch +++ b/patches/chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/autocomplete/autocomplete_classifier_factory.cc b/chrome/browser/autocomplete/autocomplete_classifier_factory.cc -index e3159144a0b7892e5580bfa910f2db97a81179a9..8ee42d9f6f7ac50c78a03e59aa2ba34e35dae725 100644 +index 7f4dd5ffd15a0ea17fb77d712897a86370da4266..52d8469ae70f38e7a3c714f4761d4172915af138 100644 --- a/chrome/browser/autocomplete/autocomplete_classifier_factory.cc +++ b/chrome/browser/autocomplete/autocomplete_classifier_factory.cc @@ -68,7 +68,12 @@ AutocompleteClassifierFactory::~AutocompleteClassifierFactory() { diff --git a/patches/chrome-browser-browser_process_impl.h.patch b/patches/chrome-browser-browser_process_impl.h.patch index a550a06d7d8..8d2128a57a5 100644 --- a/patches/chrome-browser-browser_process_impl.h.patch +++ b/patches/chrome-browser-browser_process_impl.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h -index 95a7bd8e8b581c6addec8b33880b2c03040f713a..b7037dd80a29bbd64a8ed66d4d01e585df589eed 100644 +index c02e294f5b2e388cda053ba03974bff53a7ba5da..c7f071ba6a9f726e45c3ad4e5b637a415ea7146d 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h -@@ -206,6 +206,7 @@ class BrowserProcessImpl : public BrowserProcess, +@@ -198,6 +198,7 @@ class BrowserProcessImpl : public BrowserProcess, static void RegisterPrefs(PrefRegistrySimple* registry); private: diff --git a/patches/chrome-browser-chrome_content_browser_client.h.patch b/patches/chrome-browser-chrome_content_browser_client.h.patch index fe7f0778bd9..c6a42eb46e1 100644 --- a/patches/chrome-browser-chrome_content_browser_client.h.patch +++ b/patches/chrome-browser-chrome_content_browser_client.h.patch @@ -1,9 +1,9 @@ diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h -index 499af0b670a1060f81c2b1dda8812865aac29670..b9d5d5f72fcd3a319472cb226ec83ca4b62f0180 100644 +index 069f597633a2924e0bdacd7cb1d92f5d418e6d87..a40200ffd46ec9deb623906633f4805fb63bf8dd 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h -@@ -637,6 +637,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { - content::BrowserContext* browser_context); +@@ -634,6 +634,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { + virtual const ui::NativeTheme* GetWebTheme() const; // For testing. private: + friend class BraveContentBrowserClient; diff --git a/patches/chrome-browser-content_settings-tab_specific_content_settings.cc.patch b/patches/chrome-browser-content_settings-tab_specific_content_settings.cc.patch index 9e5c3471484..b6dee9a46cf 100644 --- a/patches/chrome-browser-content_settings-tab_specific_content_settings.cc.patch +++ b/patches/chrome-browser-content_settings-tab_specific_content_settings.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc -index f521d5f7842bcd128772a9c8b57b464ffee312f5..1a9a1b0ebb01a0db607dd88e426166e176146c75 100644 +index 34fde937fea30840585b21c0623443f7dcb6c46a..50de09977491c7961ce3fc643f175d1e1e24a7f4 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings.cc -@@ -283,6 +283,7 @@ bool TabSpecificContentSettings::IsContentBlocked( +@@ -253,6 +253,7 @@ bool TabSpecificContentSettings::IsContentBlocked( content_type == CONTENT_SETTINGS_TYPE_ADS || content_type == CONTENT_SETTINGS_TYPE_SOUND || content_type == CONTENT_SETTINGS_TYPE_CLIPBOARD_READ || @@ -10,7 +10,7 @@ index f521d5f7842bcd128772a9c8b57b464ffee312f5..1a9a1b0ebb01a0db607dd88e426166e1 content_type == CONTENT_SETTINGS_TYPE_SENSORS) { const auto& it = content_settings_status_.find(content_type); if (it != content_settings_status_.end()) -@@ -306,6 +307,7 @@ bool TabSpecificContentSettings::IsContentAllowed( +@@ -276,6 +277,7 @@ bool TabSpecificContentSettings::IsContentAllowed( content_type != CONTENT_SETTINGS_TYPE_PPAPI_BROKER && content_type != CONTENT_SETTINGS_TYPE_MIDI_SYSEX && content_type != CONTENT_SETTINGS_TYPE_CLIPBOARD_READ && diff --git a/patches/chrome-browser-devtools-devtools_ui_bindings.h.patch b/patches/chrome-browser-devtools-devtools_ui_bindings.h.patch index 8faa4ced575..e2a2330a855 100644 --- a/patches/chrome-browser-devtools-devtools_ui_bindings.h.patch +++ b/patches/chrome-browser-devtools-devtools_ui_bindings.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/devtools/devtools_ui_bindings.h b/chrome/browser/devtools/devtools_ui_bindings.h -index f832069419217412657c1279712f821e6c036132..50fb5a5f2a6a3f0c910341115839f0d64737ec4d 100644 +index cc7e57e6c2e06dded26fce90dc22953c9785aae5..c535e148ea824e45506d37932e33ecc026e08d26 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.h +++ b/chrome/browser/devtools/devtools_ui_bindings.h @@ -89,6 +89,9 @@ class DevToolsUIBindings : public DevToolsEmbedderMessageDispatcher::Delegate, diff --git a/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch b/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch index 1f81c76b514..4744357d8fc 100644 --- a/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch +++ b/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc -index 8efee8786a5e875dfcd68f262c15a47e1512ab5e..6aea38bf2b9cbcaedd2bde00fd0f11cd2544ca87 100644 +index 3896f0b9e8f764fa425e0702c6ff97ba0a4b1bcf..37c067c77588130a78318d22eb695f70e982dc70 100644 --- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc +++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc @@ -87,6 +87,7 @@ std::string HashIdWithOrigin(const std::string& security_origin, diff --git a/patches/chrome-browser-extensions-chrome_extensions_browser_client.cc.patch b/patches/chrome-browser-extensions-chrome_extensions_browser_client.cc.patch index 88d0c483ce1..f66e57e82f0 100644 --- a/patches/chrome-browser-extensions-chrome_extensions_browser_client.cc.patch +++ b/patches/chrome-browser-extensions-chrome_extensions_browser_client.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc -index 87a8ac4f1635d0f11067da7644987a2cff16aa06..4fc1deebd4ad047fa9f00efbd2d5490041b5d32e 100644 +index 37972b557b457ffd69215caf8d2616432fe7a3da..9be4fa73fe51417bc5e8ed88517089a6d6f6592c 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc @@ -9,6 +9,8 @@ @@ -11,7 +11,7 @@ index 87a8ac4f1635d0f11067da7644987a2cff16aa06..4fc1deebd4ad047fa9f00efbd2d54900 #include "build/build_config.h" #include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/browser_process.h" -@@ -91,11 +93,12 @@ bool ExtensionsDisabled(const base::CommandLine& command_line) { +@@ -92,11 +94,12 @@ bool ExtensionsDisabled(const base::CommandLine& command_line) { ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() { AddAPIProvider(std::make_unique()); AddAPIProvider(std::make_unique()); diff --git a/patches/chrome-browser-extensions-component_loader.h.patch b/patches/chrome-browser-extensions-component_loader.h.patch index 735baec7f9f..a78db28885c 100644 --- a/patches/chrome-browser-extensions-component_loader.h.patch +++ b/patches/chrome-browser-extensions-component_loader.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h -index 3f8b640092721536276e478549d8ad5940fe4964..5d7f0ba46efdf2871f333f0010e8e51ad20e6163 100644 +index 77b0a1e8952ece2cd9bb7ea511d7b90b8f8c9abf..d2585bfa2279b5c6e31110e548a0174a9981e892 100644 --- a/chrome/browser/extensions/component_loader.h +++ b/chrome/browser/extensions/component_loader.h -@@ -84,7 +84,7 @@ class ComponentLoader { +@@ -81,7 +81,7 @@ class ComponentLoader { // the loader will skip loading component extensions that weren't supposed to // be loaded unless we are in signed user session (ChromeOS). For all other // platforms this |skip_session_components| is expected to be unset. @@ -11,7 +11,7 @@ index 3f8b640092721536276e478549d8ad5940fe4964..5d7f0ba46efdf2871f333f0010e8e51a // Similar to above but adds the default component extensions for kiosk mode. void AddDefaultComponentExtensionsForKioskMode(bool skip_session_components); -@@ -119,6 +119,7 @@ class ComponentLoader { +@@ -120,6 +120,7 @@ class ComponentLoader { } private: @@ -19,7 +19,7 @@ index 3f8b640092721536276e478549d8ad5940fe4964..5d7f0ba46efdf2871f333f0010e8e51a FRIEND_TEST_ALL_PREFIXES(ComponentLoaderTest, ParseManifest); // Information about a registered component extension. -@@ -164,6 +165,7 @@ class ComponentLoader { +@@ -165,6 +166,7 @@ class ComponentLoader { void AddDefaultComponentExtensionsWithBackgroundPagesForKioskMode(); #if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) diff --git a/patches/chrome-browser-extensions-extension_install_prompt.cc.patch b/patches/chrome-browser-extensions-extension_install_prompt.cc.patch index 1a3b9f05ac8..0d9f00fcce0 100644 --- a/patches/chrome-browser-extensions-extension_install_prompt.cc.patch +++ b/patches/chrome-browser-extensions-extension_install_prompt.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc -index f1ed057b1277648c9aa2cb208f92236062f9ecd6..848481f4fef9f03f19ee744d5c77fffca79bee4e 100644 +index c84fc509e52a7abd829c3dc5c4f6b821e5c32fa9..386fdf4f001177d9a779a632568fe821cbfe94db 100644 --- a/chrome/browser/extensions/extension_install_prompt.cc +++ b/chrome/browser/extensions/extension_install_prompt.cc @@ -13,6 +13,7 @@ @@ -10,7 +10,7 @@ index f1ed057b1277648c9aa2cb208f92236062f9ecd6..848481f4fef9f03f19ee744d5c77fffc #include "chrome/browser/extensions/extension_install_prompt_show_params.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/permissions_updater.h" -@@ -512,7 +513,7 @@ void ExtensionInstallPrompt::ShowDialog( +@@ -509,7 +510,7 @@ void ExtensionInstallPrompt::ShowDialog( const SkBitmap* icon, const ShowDialogCallback& show_dialog_callback) { ShowDialog(done_callback, extension, icon, diff --git a/patches/chrome-browser-extensions-extension_install_prompt.h.patch b/patches/chrome-browser-extensions-extension_install_prompt.h.patch index 314461cc7ca..754aebcb217 100644 --- a/patches/chrome-browser-extensions-extension_install_prompt.h.patch +++ b/patches/chrome-browser-extensions-extension_install_prompt.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/extension_install_prompt.h b/chrome/browser/extensions/extension_install_prompt.h -index 44c0b01772fd3e2a1c1670eb077553e972e05e60..ddbf41e0c2a85293fe03249b9810932e02aa2c2b 100644 +index dcea843a6d7190d4e9e30d6ecce28028f18fd783..6f30d828db13b9f38f184499089d420cdbea4d4b 100644 --- a/chrome/browser/extensions/extension_install_prompt.h +++ b/chrome/browser/extensions/extension_install_prompt.h @@ -87,7 +87,7 @@ class ExtensionInstallPrompt { diff --git a/patches/chrome-browser-extensions-extension_management.cc.patch b/patches/chrome-browser-extensions-extension_management.cc.patch index 4a7bd83501d..05ab72e7987 100644 --- a/patches/chrome-browser-extensions-extension_management.cc.patch +++ b/patches/chrome-browser-extensions-extension_management.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/extension_management.cc b/chrome/browser/extensions/extension_management.cc -index ab6c99a40a84961a61eea241a9dd346f8174eb48..dcdf09c4a5748032716fbc70bad7d12a15c7c566 100644 +index 0c051349bd1a862372dc975923e7fe5cc2129233..8bc5c167f712986694063d26c0dbd5cb5f7386e6 100644 --- a/chrome/browser/extensions/extension_management.cc +++ b/chrome/browser/extensions/extension_management.cc @@ -16,6 +16,7 @@ @@ -10,7 +10,7 @@ index ab6c99a40a84961a61eea241a9dd346f8174eb48..dcdf09c4a5748032716fbc70bad7d12a #include "chrome/browser/extensions/extension_management_constants.h" #include "chrome/browser/extensions/extension_management_internal.h" #include "chrome/browser/extensions/external_policy_loader.h" -@@ -626,7 +627,7 @@ KeyedService* ExtensionManagementFactory::BuildServiceInstanceFor( +@@ -625,7 +626,7 @@ KeyedService* ExtensionManagementFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { TRACE_EVENT0("browser,startup", "ExtensionManagementFactory::BuildServiceInstanceFor"); diff --git a/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch b/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch index 5b53f95cd84..02616f6c5c8 100644 --- a/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch +++ b/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc -index a3f16ad264fd2238a1b33685bfdea4d60a091a17..1848f745ea5413beab4fe2a5504ecd572cc2874c 100644 +index 2fa76ce8dd1b1fe2d678c116aa22d3e14f7e7038..45b199048a10f6127a375d7874d3aabd5224924b 100644 --- a/chrome/browser/external_protocol/external_protocol_handler.cc +++ b/chrome/browser/external_protocol/external_protocol_handler.cc -@@ -186,7 +186,7 @@ ExternalProtocolHandler::BlockState ExternalProtocolHandler::GetBlockState( +@@ -224,7 +224,7 @@ ExternalProtocolHandler::BlockState ExternalProtocolHandler::GetBlockState( // Always allow the hard-coded allowed schemes. for (size_t i = 0; i < base::size(kAllowedSchemes); ++i) { if (kAllowedSchemes[i] == scheme) diff --git a/patches/chrome-browser-importer-external_process_importer_client.cc.patch b/patches/chrome-browser-importer-external_process_importer_client.cc.patch index ce5f8940561..2bedb5eaee0 100644 --- a/patches/chrome-browser-importer-external_process_importer_client.cc.patch +++ b/patches/chrome-browser-importer-external_process_importer_client.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/importer/external_process_importer_client.cc b/chrome/browser/importer/external_process_importer_client.cc -index 7320911bb2c1e848eafe487f9b376df2177521e8..6e7278eb8fd6fc9fd2ad339192e4eb7cf7ba3964 100644 +index d6f6de319f3662dbd1d0b4bf469c8325aea127a9..dd7e12127a6339e1eff0da8307464eb0c256d615 100644 --- a/chrome/browser/importer/external_process_importer_client.cc +++ b/chrome/browser/importer/external_process_importer_client.cc -@@ -69,6 +69,12 @@ void ExternalProcessImporterClient::Start() { +@@ -67,6 +67,12 @@ void ExternalProcessImporterClient::Start() { localized_strings.try_emplace( IDS_BOOKMARK_BAR_FOLDER_NAME, l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); diff --git a/patches/chrome-browser-importer-external_process_importer_host.h.patch b/patches/chrome-browser-importer-external_process_importer_host.h.patch index 970610fed25..ef79ef5a5e4 100644 --- a/patches/chrome-browser-importer-external_process_importer_host.h.patch +++ b/patches/chrome-browser-importer-external_process_importer_host.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/importer/external_process_importer_host.h b/chrome/browser/importer/external_process_importer_host.h -index 08c6f28746cc5f345114a942834db18f5c7a1d41..9b4ba999a26fb5600fce29eed80ad6f974e0a265 100644 +index f8bd5d50910b2a068b964a8377233bf5a25fe618..1af30b9cfc4aa7924864603ee0b10e995fb77ea7 100644 --- a/chrome/browser/importer/external_process_importer_host.h +++ b/chrome/browser/importer/external_process_importer_host.h @@ -72,10 +72,13 @@ class ExternalProcessImporterHost diff --git a/patches/chrome-browser-importer-importer_list.cc.patch b/patches/chrome-browser-importer-importer_list.cc.patch index db235f94664..8ccbcc00e61 100644 --- a/patches/chrome-browser-importer-importer_list.cc.patch +++ b/patches/chrome-browser-importer-importer_list.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc -index 71659dd4133d71a90276f364ca685e78533b8979..f33c4354a6e5f7d69ca347e737e272494d1b036e 100644 +index 57c0506feeb1318ed0ed77b47ffce4babfe0b8e1..bc7c6e04098780d12c9c55d676f587ea5b7e8937 100644 --- a/chrome/browser/importer/importer_list.cc +++ b/chrome/browser/importer/importer_list.cc @@ -29,6 +29,9 @@ diff --git a/patches/chrome-browser-io_thread.cc.patch b/patches/chrome-browser-io_thread.cc.patch deleted file mode 100644 index 26696070a93..00000000000 --- a/patches/chrome-browser-io_thread.cc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc -index 25cb1333363e32f3afe13239b40159dd3444e834..b6e8725370c9bc040b9f4b1ca3e5b61a7351144a 100644 ---- a/chrome/browser/io_thread.cc -+++ b/chrome/browser/io_thread.cc -@@ -237,6 +237,7 @@ net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { - system_url_request_context_getter_ = - base::MakeRefCounted(this); - } else { -+ if (base::FeatureList::IsEnabled(network::features::kNetworkService)) - NOTREACHED(); - } - return system_url_request_context_getter_.get(); diff --git a/patches/chrome-browser-media-webrtc-webrtc_log_uploader.cc.patch b/patches/chrome-browser-media-webrtc-webrtc_log_uploader.cc.patch index acb09012c9d..65f19af23d8 100644 --- a/patches/chrome-browser-media-webrtc-webrtc_log_uploader.cc.patch +++ b/patches/chrome-browser-media-webrtc-webrtc_log_uploader.cc.patch @@ -1,12 +1,12 @@ diff --git a/chrome/browser/media/webrtc/webrtc_log_uploader.cc b/chrome/browser/media/webrtc/webrtc_log_uploader.cc -index ff329ad9104cd0e87f376b8c1771620a771c0be1..904b50859dfb3f9289d9168b7bba8c088c5df141 100644 +index a89794d69357b7bd24853c7a7bb978cec265eb59..65546bb06a1876912fc39f1135c4b6f58c9170bc 100644 --- a/chrome/browser/media/webrtc/webrtc_log_uploader.cc +++ b/chrome/browser/media/webrtc/webrtc_log_uploader.cc -@@ -477,6 +477,7 @@ std::string WebRtcLogUploader::CompressLog(WebRtcLogBuffer* buffer) { +@@ -445,6 +445,7 @@ std::string WebRtcLogUploader::CompressLog(WebRtcLogBuffer* buffer) { void WebRtcLogUploader::UploadCompressedLog( const WebRtcLogUploadDoneData& upload_done_data, std::unique_ptr post_data) { + return; // feature disabled in Brave - DCHECK_CURRENTLY_ON(BrowserThread::IO); + DCHECK_CALLED_ON_VALID_SEQUENCE(main_sequence_checker_); DecreaseLogCount(); diff --git a/patches/chrome-browser-net-chrome_network_delegate.h.patch b/patches/chrome-browser-net-chrome_network_delegate.h.patch index ac229748afa..276e7aace49 100644 --- a/patches/chrome-browser-net-chrome_network_delegate.h.patch +++ b/patches/chrome-browser-net-chrome_network_delegate.h.patch @@ -1,12 +1,12 @@ diff --git a/chrome/browser/net/chrome_network_delegate.h b/chrome/browser/net/chrome_network_delegate.h -index 5286e342dec6199c2336622dc0f67eb11427300a..f29a144ad4e1311c3ebc38cfe1297c9113985bfe 100644 +index 12c8c497b87ba62f15e0737286467b9a492ae376..05f86e333337f795af8bc62af7c792ea0144c79b 100644 --- a/chrome/browser/net/chrome_network_delegate.h +++ b/chrome/browser/net/chrome_network_delegate.h -@@ -97,6 +97,7 @@ class ChromeNetworkDelegate : public net::NetworkDelegateImpl { +@@ -27,6 +27,7 @@ class ChromeNetworkDelegate { + // with false brings back the original (production) behaviors. static void EnableAccessToAllFilesForTesting(bool enabled); - private: + friend class BraveNetworkDelegateBase; - // NetworkDelegate implementation. - int OnBeforeURLRequest(net::URLRequest* request, - net::CompletionOnceCallback callback, + DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); + }; + diff --git a/patches/chrome-browser-net-chrome_url_request_context_getter.cc.patch b/patches/chrome-browser-net-chrome_url_request_context_getter.cc.patch deleted file mode 100644 index 6c6f0502836..00000000000 --- a/patches/chrome-browser-net-chrome_url_request_context_getter.cc.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/chrome/browser/net/chrome_url_request_context_getter.cc b/chrome/browser/net/chrome_url_request_context_getter.cc -index a931ece03ee26647686419328b9884c2726468db..90d78c0576a8f8df12649ed6dd1a34c48caa4104 100644 ---- a/chrome/browser/net/chrome_url_request_context_getter.cc -+++ b/chrome/browser/net/chrome_url_request_context_getter.cc -@@ -5,7 +5,7 @@ - #include "chrome/browser/net/chrome_url_request_context_getter.h" - - #include -- -+#include "brave/components/brave_shields/browser/adblock_interceptor.h" - #include "base/bind.h" - #include "base/compiler_specific.h" - #include "base/macros.h" -@@ -50,6 +50,7 @@ class FactoryForMain : public ChromeURLRequestContextFactory { - : profile_io_data_(profile_io_data), - request_interceptors_(std::move(request_interceptors)) { - std::swap(protocol_handlers_, *protocol_handlers); -+ request_interceptors_.emplace_back(new brave_shields::AdBlockInterceptor); - } - - net::URLRequestContext* Create() override { -@@ -84,6 +85,7 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory { - network_context_request_(std::move(network_context_request)), - network_context_params_(std::move(network_context_params)) { - std::swap(protocol_handlers_, *protocol_handlers); -+ request_interceptors_.emplace_back(new brave_shields::AdBlockInterceptor); - } - - net::URLRequestContext* Create() override { diff --git a/patches/chrome-browser-net-net_error_tab_helper.cc.patch b/patches/chrome-browser-net-net_error_tab_helper.cc.patch index 71b8de4f9c5..a595064ee59 100644 --- a/patches/chrome-browser-net-net_error_tab_helper.cc.patch +++ b/patches/chrome-browser-net-net_error_tab_helper.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/net/net_error_tab_helper.cc b/chrome/browser/net/net_error_tab_helper.cc -index d39876436dd64faa0bae445c3e0ad1c666dbae17..88eb4e98bdb5a040e26c72f7c5eed9de8ef8bcc8 100644 +index f2dd356b43f396991446ab3a59067e8a44048014..c74fea87daf5b42be11275ee259ae01dfbb773b7 100644 --- a/chrome/browser/net/net_error_tab_helper.cc +++ b/chrome/browser/net/net_error_tab_helper.cc -@@ -234,6 +234,9 @@ void NetErrorTabHelper::InitializePref(WebContents* contents) { +@@ -233,6 +233,9 @@ void NetErrorTabHelper::InitializePref(WebContents* contents) { } bool NetErrorTabHelper::ProbesAllowed() const { diff --git a/patches/chrome-browser-net-system_network_context_manager.cc.patch b/patches/chrome-browser-net-system_network_context_manager.cc.patch index b91462fe043..f2c4a233a83 100644 --- a/patches/chrome-browser-net-system_network_context_manager.cc.patch +++ b/patches/chrome-browser-net-system_network_context_manager.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc -index 2c9b6e9536749bee6c7ca4dbd3c87410e0940f64..835a1af9866f93b779ef5e5be36f0eabe505b815 100644 +index 156b022694d82b7e5b281cc8790b5ad8926a5c9b..a59601dc01c1c94dc6b4e49a62c71e6b056d6e7a 100644 --- a/chrome/browser/net/system_network_context_manager.cc +++ b/chrome/browser/net/system_network_context_manager.cc -@@ -263,7 +263,7 @@ class SystemNetworkContextManager::URLLoaderFactoryForSystem +@@ -250,7 +250,7 @@ class SystemNetworkContextManager::URLLoaderFactoryForSystem if (!manager_) return; manager_->GetURLLoaderFactory()->CreateLoaderAndStart( diff --git a/patches/chrome-browser-notifications-notification_platform_bridge_linux.cc.patch b/patches/chrome-browser-notifications-notification_platform_bridge_linux.cc.patch index 229365dace4..1a6c48cf89f 100644 --- a/patches/chrome-browser-notifications-notification_platform_bridge_linux.cc.patch +++ b/patches/chrome-browser-notifications-notification_platform_bridge_linux.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/notifications/notification_platform_bridge_linux.cc b/chrome/browser/notifications/notification_platform_bridge_linux.cc -index aa6d15f6ebbdcc6e70374a46ca9c11d4c1bff854..5c2bdec672a402edbc3602887fdad9e3cc0056a8 100644 +index 04a4ac46f01173b3a8bdb4ebab1eeea03cfd6c1b..a2a0e8a90a2a564611ffc6e8f8240a63cf597fe6 100644 --- a/chrome/browser/notifications/notification_platform_bridge_linux.cc +++ b/chrome/browser/notifications/notification_platform_bridge_linux.cc -@@ -632,6 +632,7 @@ class NotificationPlatformBridgeLinuxImpl +@@ -648,6 +648,7 @@ class NotificationPlatformBridgeLinuxImpl actions.push_back("Activate"); // Always add a settings button for web notifications. if (notification_type != NotificationHandler::Type::EXTENSION && diff --git a/patches/chrome-browser-permissions-permission_manager.cc.patch b/patches/chrome-browser-permissions-permission_manager.cc.patch index 20dddb1432a..4d4e07cb450 100644 --- a/patches/chrome-browser-permissions-permission_manager.cc.patch +++ b/patches/chrome-browser-permissions-permission_manager.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/permissions/permission_manager.cc b/chrome/browser/permissions/permission_manager.cc -index 3f612a3cf55ce07de9aa5aa29e94e2338377f90a..6f329e24de35557510651069a903853f34fbce42 100644 +index 9f535334da7e3ca1939e98a055ec93662a38b552..81f81e6d2b3dc359d262440dbd20cf995ba88c46 100644 --- a/chrome/browser/permissions/permission_manager.cc +++ b/chrome/browser/permissions/permission_manager.cc -@@ -88,7 +88,7 @@ PermissionStatus ContentSettingToPermissionStatus(ContentSetting setting) { +@@ -89,7 +89,7 @@ PermissionStatus ContentSettingToPermissionStatus(ContentSetting setting) { } // Helper method to convert PermissionType to ContentSettingType. @@ -11,9 +11,9 @@ index 3f612a3cf55ce07de9aa5aa29e94e2338377f90a..6f329e24de35557510651069a903853f switch (permission) { case PermissionType::MIDI: return CONTENT_SETTINGS_TYPE_MIDI; -@@ -132,6 +132,7 @@ ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) { - case PermissionType::PERIODIC_BACKGROUND_SYNC: - return CONTENT_SETTINGS_TYPE_PERIODIC_BACKGROUND_SYNC; +@@ -137,6 +137,7 @@ ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) { + case PermissionType::WAKE_LOCK_SYSTEM: + return CONTENT_SETTINGS_TYPE_WAKE_LOCK_SYSTEM; case PermissionType::NUM: + default: // This will hit the NOTREACHED below. diff --git a/patches/chrome-browser-permissions-permission_uma_util.cc.patch b/patches/chrome-browser-permissions-permission_uma_util.cc.patch index 625c907ed17..18bebf0040b 100644 --- a/patches/chrome-browser-permissions-permission_uma_util.cc.patch +++ b/patches/chrome-browser-permissions-permission_uma_util.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/permissions/permission_uma_util.cc b/chrome/browser/permissions/permission_uma_util.cc -index 97ae8e1ee0339d5714d3baef177a1e27ce219583..431c5256251904e83ed7c7a7245a39b4eef4f1db 100644 +index 50768c0a91bb5f29760e398ed9c6486a06334b49..18c8118777376ddd24e88ad38576be092e214ba0 100644 --- a/chrome/browser/permissions/permission_uma_util.cc +++ b/chrome/browser/permissions/permission_uma_util.cc @@ -65,7 +65,7 @@ namespace { diff --git a/patches/chrome-browser-plugins-chrome_plugin_service_filter.cc.patch b/patches/chrome-browser-plugins-chrome_plugin_service_filter.cc.patch index ca20e66cb67..02357bf63c9 100644 --- a/patches/chrome-browser-plugins-chrome_plugin_service_filter.cc.patch +++ b/patches/chrome-browser-plugins-chrome_plugin_service_filter.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/plugins/chrome_plugin_service_filter.cc b/chrome/browser/plugins/chrome_plugin_service_filter.cc -index 5c2a2d0adf1ca353d4ab8dd23475c9d6e6df3b55..dc8f62521ba5c78fcee7e79d028ee8ddc8964e7f 100644 +index 55801ac0fee766a5f46314137d4745ff8a1d7f24..9acdabbe23d440d7468cbc9ef3b1e589f74db12c 100644 --- a/chrome/browser/plugins/chrome_plugin_service_filter.cc +++ b/chrome/browser/plugins/chrome_plugin_service_filter.cc -@@ -52,7 +52,7 @@ class ProfileContentSettingObserver : public content_settings::Observer { +@@ -51,7 +51,7 @@ class ProfileContentSettingObserver : public content_settings::Observer { PluginService::GetInstance()->PurgePluginListCache(profile_, false); const GURL primary(primary_pattern.ToString()); diff --git a/patches/chrome-browser-plugins-plugins_resource_service.cc.patch b/patches/chrome-browser-plugins-plugins_resource_service.cc.patch index 407468e5925..3447f9bbea8 100644 --- a/patches/chrome-browser-plugins-plugins_resource_service.cc.patch +++ b/patches/chrome-browser-plugins-plugins_resource_service.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/plugins/plugins_resource_service.cc b/chrome/browser/plugins/plugins_resource_service.cc -index d7c3801df3e8766b2124b4c73ec3a46631aa5d3b..d6d391d47a4b4540f4177034da6ee475100c78b0 100644 +index 85003dd6cb04d27820e182c75fd76169b269a7e1..f3facf8c650cda32fa59bca6735c897f1aede5ca 100644 --- a/chrome/browser/plugins/plugins_resource_service.cc +++ b/chrome/browser/plugins/plugins_resource_service.cc @@ -55,7 +55,7 @@ const int kStartResourceFetchDelayMs = 60 * 1000; diff --git a/patches/chrome-browser-prefs-browser_prefs.cc.patch b/patches/chrome-browser-prefs-browser_prefs.cc.patch index 57f85203cf1..58858f7e63e 100644 --- a/patches/chrome-browser-prefs-browser_prefs.cc.patch +++ b/patches/chrome-browser-prefs-browser_prefs.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc -index 50312cdb0324e3dad18c77c96e5e609bfb259541..2298f9b60d2718d82e721dc8483b114931a30d0d 100644 +index b806315041d481b485a9329097b5b626ff0921b0..73e949fdb3b751b923e759c35f546c9ec38895ea 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc -@@ -658,6 +658,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { +@@ -688,6 +688,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { #if defined(TOOLKIT_VIEWS) RegisterBrowserViewLocalPrefs(registry); #endif @@ -10,7 +10,7 @@ index 50312cdb0324e3dad18c77c96e5e609bfb259541..2298f9b60d2718d82e721dc8483b1149 } // Register prefs applicable to all profiles. -@@ -908,6 +909,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, +@@ -945,6 +946,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, #endif RegisterProfilePrefsForMigration(registry); diff --git a/patches/chrome-browser-profiles-profile.cc.patch b/patches/chrome-browser-profiles-profile.cc.patch index a1fe406766b..92b1243ba5d 100644 --- a/patches/chrome-browser-profiles-profile.cc.patch +++ b/patches/chrome-browser-profiles-profile.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc -index 71d736c9eaf3503e532d72c410f4d4dadff372cd..39114245329d5767f8b51a5c9120c76038018d04 100644 +index 28d3c597acc9e58bab439badb1d1dc9baa139048..4e4a3742f9133dcba49a2ec68a1181a345c5f63b 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -140,7 +140,7 @@ const char Profile::kProfileKey[] = "__PROFILE__"; @@ -11,7 +11,7 @@ index 71d736c9eaf3503e532d72c410f4d4dadff372cd..39114245329d5767f8b51a5c9120c760 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); #if defined(OS_ANDROID) registry->RegisterStringPref( -@@ -244,7 +244,7 @@ bool Profile::IsGuestSession() const { +@@ -257,7 +257,7 @@ bool Profile::IsGuestSession() const { chromeos::switches::kGuestSession); return is_guest_session; #else diff --git a/patches/chrome-browser-profiles-profile_impl.cc.patch b/patches/chrome-browser-profiles-profile_impl.cc.patch index ad4ce212270..596d6c8df28 100644 --- a/patches/chrome-browser-profiles-profile_impl.cc.patch +++ b/patches/chrome-browser-profiles-profile_impl.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc -index 71619ca3d5271b0f813110dce0e5570b6eebdda7..97003f2bc6f1141ae49dc2a2ac58e5f861fd0615 100644 +index 084648e9606f9847ff722901fb95626677a17c1e..0bcb822c794146ceec8c52c01da8c973fa25b808 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -34,6 +34,7 @@ diff --git a/patches/chrome-browser-profiles-profile_io_data.cc.patch b/patches/chrome-browser-profiles-profile_io_data.cc.patch index 87495c2e791..4ef98067eb6 100644 --- a/patches/chrome-browser-profiles-profile_io_data.cc.patch +++ b/patches/chrome-browser-profiles-profile_io_data.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc -index a77de6f1abed2133190908db2fe3e417b05bc4f0..e67fcb11518b4d644425fe4275dd7aebb39e68a4 100644 +index 285f9e09a9020e8647fe363f7d3b0c867b1d26ea..10a247b701690ff70f1039a43d94dd164c3f18dd 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -24,6 +24,7 @@ @@ -10,7 +10,7 @@ index a77de6f1abed2133190908db2fe3e417b05bc4f0..e67fcb11518b4d644425fe4275dd7aeb #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" -@@ -639,6 +640,9 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { +@@ -417,6 +418,9 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { extensions::kExtensionScheme, #endif content::kChromeUIScheme, @@ -20,12 +20,3 @@ index a77de6f1abed2133190908db2fe3e417b05bc4f0..e67fcb11518b4d644425fe4275dd7aeb url::kDataScheme, #if defined(OS_CHROMEOS) content::kExternalFileScheme, -@@ -925,7 +929,7 @@ void ProfileIOData::Init( - std::make_unique(); - - std::unique_ptr chrome_network_delegate( -- new ChromeNetworkDelegate( -+ new BraveProfileNetworkDelegate( - #if BUILDFLAG(ENABLE_EXTENSIONS) - io_thread_globals->extension_event_router_forwarder.get())); - #else diff --git a/patches/chrome-browser-profiles-profile_manager.cc.patch b/patches/chrome-browser-profiles-profile_manager.cc.patch index 00d573f9369..7ae2c1dc431 100644 --- a/patches/chrome-browser-profiles-profile_manager.cc.patch +++ b/patches/chrome-browser-profiles-profile_manager.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc -index 4cce9ca9fbf1ded2c4b8334f8ff9be0d43e97803..7b39473be45be8530eb91c1389c96aa65625a7d1 100644 +index bd2715738d89bc9a099d3be0614f720303b98086..0cd794e5c9b6d5dea803cc00b899524ba2ac75e6 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc -@@ -1503,9 +1503,11 @@ void ProfileManager::EnsureActiveProfileExistsBeforeDeletion( +@@ -1419,9 +1419,11 @@ void ProfileManager::EnsureActiveProfileExistsBeforeDeletion( const base::FilePath last_used_profile_path = GetLastUsedProfileDir(user_data_dir_); const base::FilePath guest_profile_path = GetGuestProfilePath(); @@ -14,7 +14,7 @@ index 4cce9ca9fbf1ded2c4b8334f8ff9be0d43e97803..7b39473be45be8530eb91c1389c96aa6 last_used_profile != nullptr && !last_used_profile->IsLegacySupervised()) { FinishDeletingProfile(profile_dir, last_used_profile_path); -@@ -1518,6 +1520,7 @@ void ProfileManager::EnsureActiveProfileExistsBeforeDeletion( +@@ -1434,6 +1436,7 @@ void ProfileManager::EnsureActiveProfileExistsBeforeDeletion( base::FilePath cur_path = profile->GetPath(); if (cur_path != profile_dir && cur_path != guest_profile_path && @@ -22,7 +22,7 @@ index 4cce9ca9fbf1ded2c4b8334f8ff9be0d43e97803..7b39473be45be8530eb91c1389c96aa6 !profile->IsLegacySupervised() && !IsProfileDirectoryMarkedForDeletion(cur_path)) { OnNewActiveProfileLoaded(profile_dir, cur_path, std::move(callback), -@@ -1537,6 +1540,7 @@ void ProfileManager::EnsureActiveProfileExistsBeforeDeletion( +@@ -1453,6 +1456,7 @@ void ProfileManager::EnsureActiveProfileExistsBeforeDeletion( // legacy-supervised. if (cur_path != profile_dir && cur_path != guest_profile_path && @@ -30,7 +30,7 @@ index 4cce9ca9fbf1ded2c4b8334f8ff9be0d43e97803..7b39473be45be8530eb91c1389c96aa6 !entry->IsLegacySupervised() && !IsProfileDirectoryMarkedForDeletion(cur_path)) { fallback_profile_path = cur_path; -@@ -1894,6 +1898,7 @@ void ProfileManager::ScheduleForcedEphemeralProfileForDeletion( +@@ -1867,6 +1871,7 @@ void ProfileManager::ScheduleForcedEphemeralProfileForDeletion( base::FilePath entry_path = entry->GetPath(); if (entry_path == profile_dir || entry_path == GetGuestProfilePath() || diff --git a/patches/chrome-browser-profiles-profile_manager.h.patch b/patches/chrome-browser-profiles-profile_manager.h.patch index a2f14a3ab8c..fa4a11cd6c5 100644 --- a/patches/chrome-browser-profiles-profile_manager.h.patch +++ b/patches/chrome-browser-profiles-profile_manager.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h -index 257e27caed9f6ef1dc984d5cdbae82c3d0daa427..ab13240fbb230326ecd102fa8f60aa5eb17bc4ff 100644 +index 985c64458bdf2c547a5b9286b448aaa2513b2109..a677df807effba3589b6a067ffc940432b064839 100644 --- a/chrome/browser/profiles/profile_manager.h +++ b/chrome/browser/profiles/profile_manager.h -@@ -139,7 +139,7 @@ class ProfileManager : public content::NotificationObserver, +@@ -141,7 +141,7 @@ class ProfileManager : public content::NotificationObserver, // Get the name of the last used profile, or if that's undefined, the default // profile. @@ -11,7 +11,7 @@ index 257e27caed9f6ef1dc984d5cdbae82c3d0daa427..ab13240fbb230326ecd102fa8f60aa5e // Get the Profiles which are currently open, i.e. have open browsers or were // open the last time Chrome was running. Profiles that fail to initialize are -@@ -220,7 +220,7 @@ class ProfileManager : public content::NotificationObserver, +@@ -222,7 +222,7 @@ class ProfileManager : public content::NotificationObserver, // Initializes user prefs of |profile|. This includes profile name and // avatar values. @@ -20,12 +20,12 @@ index 257e27caed9f6ef1dc984d5cdbae82c3d0daa427..ab13240fbb230326ecd102fa8f60aa5e // Register and add testing profile to the ProfileManager. Use ONLY in tests. // This allows the creation of Profiles outside of the standard creation path -@@ -346,7 +346,7 @@ class ProfileManager : public content::NotificationObserver, +@@ -349,7 +349,7 @@ class ProfileManager : public content::NotificationObserver, // Apply settings for profiles created by the system rather than users: The // (desktop) Guest User profile and (desktop) System Profile. - void SetNonPersonalProfilePrefs(Profile* profile); + virtual void SetNonPersonalProfilePrefs(Profile* profile); - // For ChromeOS, determines if profile should be otr. + // Determines if profile should be OTR. bool ShouldGoOffTheRecord(Profile* profile); diff --git a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch index df6e978bc65..13b46e0981f 100644 --- a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch +++ b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.h b/chrome/browser/renderer_context_menu/render_view_context_menu.h -index 824741727052dfd87f8f65df8bbb5adf4a9f1e2e..3caba335f84e5126c5912451b5dbcc807b21f62a 100644 +index 7e993b49e93d4a51baa2f6f4bc7953ddc099f4c6..f21255d047bbf411ce4d0509da828c7486f7c668 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h -@@ -113,6 +113,7 @@ class RenderViewContextMenu : public RenderViewContextMenuBase { +@@ -112,6 +112,7 @@ class RenderViewContextMenu : public RenderViewContextMenuBase { // Returns true if keyboard lock is active and requires the user to press and // hold escape to exit exclusive access mode. bool IsPressAndHoldEscRequiredToExitFullscreen() const; diff --git a/patches/chrome-browser-resources-bookmarks-bookmarks.html.patch b/patches/chrome-browser-resources-bookmarks-bookmarks.html.patch index 39ff82df906..8b0bff57b51 100644 --- a/patches/chrome-browser-resources-bookmarks-bookmarks.html.patch +++ b/patches/chrome-browser-resources-bookmarks-bookmarks.html.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/bookmarks/bookmarks.html b/chrome/browser/resources/bookmarks/bookmarks.html -index b91e6202e695f7347963e1c0dbee0cea46622c62..47978779a4b4cf27b7715276fc068a6163d926df 100644 +index 077405e88cd2b5da78714c900d9d4e392981192e..0698a3fcee0f240fe9dc870292f2e4af7f4cd9d1 100644 --- a/chrome/browser/resources/bookmarks/bookmarks.html +++ b/chrome/browser/resources/bookmarks/bookmarks.html -@@ -28,6 +28,7 @@ +@@ -27,6 +27,7 @@ height: var(--md-toolbar-height); } diff --git a/patches/chrome-browser-resources-bookmarks-toolbar.html.patch b/patches/chrome-browser-resources-bookmarks-toolbar.html.patch index 520934e3907..c2a8715fe24 100644 --- a/patches/chrome-browser-resources-bookmarks-toolbar.html.patch +++ b/patches/chrome-browser-resources-bookmarks-toolbar.html.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/bookmarks/toolbar.html b/chrome/browser/resources/bookmarks/toolbar.html -index 989db07d3c1f7a2ca97044590b04b02ebd86cb1a..cc5bb8387bd51505e7ea39fb4372a7a17b7d5594 100644 +index d008a5ae9a74c9c97d61dd3ec9540baa226d75b2..c430495b1a9501c3730a3a499663b202968c88f1 100644 --- a/chrome/browser/resources/bookmarks/toolbar.html +++ b/chrome/browser/resources/bookmarks/toolbar.html @@ -1,7 +1,7 @@ diff --git a/patches/chrome-browser-resources-downloads-downloads.html.patch b/patches/chrome-browser-resources-downloads-downloads.html.patch index bcbcf36b97d..ab14a6e1ede 100644 --- a/patches/chrome-browser-resources-downloads-downloads.html.patch +++ b/patches/chrome-browser-resources-downloads-downloads.html.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/downloads/downloads.html b/chrome/browser/resources/downloads/downloads.html -index 05a625d0f349264f13bd98fff32984db56aadd2c..1ad650ef5011f79ebf6591ade055338a51a791d1 100644 +index ad88272334d24e2f60327ae30ab1d412a42a6351..43b6993c81b82d814f900d9d06baf6082ba0dd98 100644 --- a/chrome/browser/resources/downloads/downloads.html +++ b/chrome/browser/resources/downloads/downloads.html -@@ -8,6 +8,7 @@ +@@ -7,6 +7,7 @@ $i18n{title} diff --git a/patches/chrome-browser-resources-downloads-manager.html.patch b/patches/chrome-browser-resources-downloads-manager.html.patch index 1a648da2119..f337da16a1d 100644 --- a/patches/chrome-browser-resources-downloads-manager.html.patch +++ b/patches/chrome-browser-resources-downloads-manager.html.patch @@ -1,13 +1,13 @@ diff --git a/chrome/browser/resources/downloads/manager.html b/chrome/browser/resources/downloads/manager.html -index 015710be621743fbc082460a4203b67d8d76372c..8cae2e6f282e558e087a3b60f0a9a84fe9bc1ba8 100644 +index 3415eceeeb53203260a6b9c1d20e96f38dd2c55e..f05a3eabcb4e3f3ba88678880de9eb101f505d70 100644 --- a/chrome/browser/resources/downloads/manager.html +++ b/chrome/browser/resources/downloads/manager.html -@@ -20,7 +20,7 @@ +@@ -22,7 +22,7 @@ @@ -95,10 +97,12 @@ padding: 30px !important; } - :host-context([dark]) { - --settings-nav-item-color: #F4F4F4 !important; - border-color: transparent !important; - background-color: #161719; + @media (prefers-color-scheme: dark) { + :host { + --settings-nav-item-color: #F4F4F4 !important; + border-color: transparent !important; + background-color: #161719; + } } a[href] { @@ -123,8 +127,10 @@ height: 20px; } - :host-context([dark]) a[href].iron-selected iron-icon { - color: var(--settings-nav-item-color) !important; + @media (prefers-color-scheme: dark) { + a[href].iron-selected iron-icon { + color: var(--settings-nav-item-color) !important; + } } a[href], diff --git a/ui/webui/resources/br_elements/br_toolbar/br_toolbar.html b/ui/webui/resources/br_elements/br_toolbar/br_toolbar.html index 5be97f94420..36b2c1d7748 100644 --- a/ui/webui/resources/br_elements/br_toolbar/br_toolbar.html +++ b/ui/webui/resources/br_elements/br_toolbar/br_toolbar.html @@ -99,9 +99,11 @@ padding: 5px; color: #222; } - :host-context([dark]) .toolbar-extra.-slot-filled { - background: #444; - color: #dde1e2; + @media (prefers-color-scheme: dark) { + .toolbar-extra.-slot-filled { + background: #444; + color: #dde1e2; + } } diff --git a/ui/webui/resources/br_elements/shared_vars_css.html b/ui/webui/resources/br_elements/shared_vars_css.html index 36216fbd138..90ff89625a2 100644 --- a/ui/webui/resources/br_elements/shared_vars_css.html +++ b/ui/webui/resources/br_elements/shared_vars_css.html @@ -22,9 +22,11 @@ --cr-card-elevation_-_box-shadow: 0 !important; --cr-card-border-radius: 4px !important; } - html[dark] { - --cr-primary-text-color: #F4F4F4 !important; - --cr-secondary-text_-_color: #AEB1C2 !important; + @media (prefers-color-scheme: dark) { + html { + --cr-primary-text-color: #F4F4F4 !important; + --cr-secondary-text_-_color: #AEB1C2 !important; + } } diff --git a/ui/webui/resources/css/md_colors.css b/ui/webui/resources/css/md_colors.css index d343ce458ae..4f6d16e9c17 100644 --- a/ui/webui/resources/css/md_colors.css +++ b/ui/webui/resources/css/md_colors.css @@ -1,5 +1,4 @@ -html, -html[dark] { +html { --brave-toolbar-gradient: linear-gradient(-90deg, #A3278F 0%, #E52F50 100%); /* linear gradient: red500 -> magenta600 */ --md-background-color: rgb(233, 236, 239); /* neutral200 */ --md-loading-message-color: #5E6175; /* grey700 */ @@ -7,7 +6,9 @@ html[dark] { /* --md-toolbar-color: linear-gradient(to left, #b10e95, #e72f4e) !important; */ } -html[dark] { - --md-background-color: rgb(30, 32, 41); /* grey900 */ - --md-loading-message-color: #C2C4CF; /* grey400 */ +@media (prefers-color-scheme: dark) { + html { + --md-background-color: rgb(30, 32, 41); /* grey900 */ + --md-loading-message-color: #C2C4CF; /* grey400 */ + } } From ae758a9ad984087ce6b3e24b274d6bde43e00916 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Fri, 23 Aug 2019 17:00:11 -0400 Subject: [PATCH 39/55] Disable kLookalikeUrlNavigationSuggestionsUI It used to be disabled by default, but enabled by experiments, so we explicitly disabled it. When we got rid of experiments we removed the explicit disablement as it was just disabled by default. Now Chromium flipped it to be enabled by default, so we need to explicitly disable it again. Removed from being explicitly disabled by us in this commit: commit 78c8700 Author: Pranjal Jumde Date: Tue May 21 00:04:17 2019 -0700 Issue 4552: Restore features to correct state after disabling field trials Chromium change: https://chromium.googlesource.com/chromium/src/+/0a4ecf746ae7ffb2659ae2857a730ea17c68f754 commit 0a4ecf746ae7ffb2659ae2857a730ea17c68f754 Author: Mustafa Emre Acer Date: Wed Jun 26 23:29:50 2019 +0000 Enable Lookalike URLs interstitial by default This CL enables the interstitial by default for lookalike domains in user's navigation history (i.e. site engagement). Matching with top domains is controlled by the topsites parameter. --- app/brave_main_delegate.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index 4d8f64ceea5..79c2c5dd19f 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -158,6 +158,7 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { // Disabled features. const std::unordered_set disabled_features = { autofill::features::kAutofillServerCommunication.name, + features::kLookalikeUrlNavigationSuggestionsUI.name, unified_consent::kUnifiedConsent.name, }; command_line.AppendFeatures(enabled_features, disabled_features); From 8751f80ddf808c85588ba843cf7d6a66411d4280 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Mon, 26 Aug 2019 14:21:09 -0400 Subject: [PATCH 40/55] Fixes BraveRequestInfo::tab_origin. We populate this field from `network::ResourceRequest`s `top_frame_origin`, but it is being phased out in favor of `net::NetworkIsolationKey`. The transition has not fully completed yet, so in some cases `top_frame_origin` is populated while in others `trusted_network_isolation_key` is. cc: @iefremov Chromium change: https://chromium.googlesource.com/chromium/src/+/1b5366c62c02fd6edfe83703e57e4fcd14d38f64 commit 1b5366c62c02fd6edfe83703e57e4fcd14d38f64 Author: Shivani Sharma Date: Tue Jul 16 20:08:13 2019 +0000 Split cache: Network Isolation key for navigation resources Adds network isolation key in the ResourceRequest for navigations to be propagated to net::URLRequest. The key is also updated for redirects. Updates NavigationRequestInfo to have a network isolation key as a member instead of top frame origin. Also updated the corresponding intercepting browser tests in navigation_browsertest. Added browser tests to verify if the navigation resources (both main frame and sub frame) are expected to be cached including the redirect use case. Also removing the code in url_request_http_job.cc that was using top frame origin to create NIK if it was not already populated. This is because with this change we would have NIK being created in browser process for subresources, navigation resources and dedicated worker resources which were earlier using the top frame origin. (Note that sub-resources URL requests do not use this path and have their network isolation key filled up in the URLLoaderFactory). Bug: 984130 --- browser/net/url_context.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/browser/net/url_context.cc b/browser/net/url_context.cc index f9a98dd0c17..3e0cc0fe88c 100644 --- a/browser/net/url_context.cc +++ b/browser/net/url_context.cc @@ -184,7 +184,17 @@ void BraveRequestInfo::FillCTX( // ctx->tab_url = request.top_frame_origin; // TODO(iefremov): Replace with NetworkIsolationKey when it is available // in ResourceRequest - ctx->tab_origin = request.top_frame_origin.value_or(url::Origin()).GetURL(); + // TODO(iefremov): c77 - navigation doesn't populate top_frame_origin any more + // and uses NetworkIsolationKey instead. According to + // services/network/public/mojom/url_loader.mojom, this field "will most + // likely be removed at some point". + if (base::nullopt != request.top_frame_origin) { + ctx->tab_origin = request.top_frame_origin->GetURL(); + } else { + ctx->tab_origin = request.trusted_network_isolation_key.GetTopFrameOrigin() + .value_or(url::Origin()) + .GetURL(); + } // TODO(iefremov): We still need this for WebSockets, currently // |AddChannelRequest| provides only old-fashioned |site_for_cookies|. // (See |BraveProxyingWebSocket|). From ecde20fafb66308fcc3dedb04153de12afba3c1f Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Mon, 12 Aug 2019 15:22:48 -0400 Subject: [PATCH 41/55] Unit tests: Fixes MCSClient API signature changes. Chromium change: https://chromium.googlesource.com/chromium/src/+/b36394cad79024db5bff0935006b34d0fd20b6dd commit b36394cad79024db5bff0935006b34d0fd20b6dd Author: Steven Zhu Date: Tue Jun 4 16:10:46 2019 +0000 [Chromecast] Pass in |io_task_runner| to GCM components. When |io_task_runner| is power managed, delayed tasks and timers running on it can wake up the system. Bug: internal b/132993317 --- components/gcm_driver/gcm_unittest.cc | 29 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/components/gcm_driver/gcm_unittest.cc b/components/gcm_driver/gcm_unittest.cc index 1de1c636e7a..a57231c3458 100644 --- a/components/gcm_driver/gcm_unittest.cc +++ b/components/gcm_driver/gcm_unittest.cc @@ -73,6 +73,7 @@ class FakeMCSClient : public MCSClient { FakeMCSClient(base::Clock* clock, ConnectionFactory* connection_factory, GCMStore* gcm_store, + scoped_refptr io_task_runner, GCMStatsRecorder* recorder); ~FakeMCSClient() override; void Login(uint64_t android_id, uint64_t security_token) override; @@ -92,11 +93,18 @@ class FakeMCSClient : public MCSClient { mcs_proto::DataMessageStanza last_data_message_stanza_; }; -FakeMCSClient::FakeMCSClient(base::Clock* clock, - ConnectionFactory* connection_factory, - GCMStore* gcm_store, - GCMStatsRecorder* recorder) - : MCSClient("", clock, connection_factory, gcm_store, recorder), +FakeMCSClient::FakeMCSClient( + base::Clock* clock, + ConnectionFactory* connection_factory, + GCMStore* gcm_store, + scoped_refptr io_task_runner, + GCMStatsRecorder* recorder) + : MCSClient("", + clock, + connection_factory, + gcm_store, + io_task_runner, + recorder), last_android_id_(0u), last_security_token_(0u), last_message_tag_(kNumProtoTypes) { @@ -165,6 +173,7 @@ class FakeGCMInternalsBuilder : public GCMInternalsBuilder { base::Clock* clock, ConnectionFactory* connection_factory, GCMStore* gcm_store, + scoped_refptr io_task_runner, GCMStatsRecorder* recorder) override; std::unique_ptr BuildConnectionFactory( const std::vector& endpoints, @@ -172,6 +181,7 @@ class FakeGCMInternalsBuilder : public GCMInternalsBuilder { base::RepeatingCallback< void(network::mojom::ProxyResolvingSocketFactoryRequest)> get_socket_factory_callback, + scoped_refptr io_task_runner, GCMStatsRecorder* recorder, network::NetworkConnectionTracker* network_connection_tracker) override; @@ -193,9 +203,10 @@ std::unique_ptr FakeGCMInternalsBuilder::BuildMCSClient( base::Clock* clock, ConnectionFactory* connection_factory, GCMStore* gcm_store, + scoped_refptr io_task_runner, GCMStatsRecorder* recorder) { - return base::WrapUnique( - new FakeMCSClient(clock, connection_factory, gcm_store, recorder)); + return base::WrapUnique(new FakeMCSClient( + clock, connection_factory, gcm_store, io_task_runner, recorder)); } std::unique_ptr @@ -205,6 +216,7 @@ FakeGCMInternalsBuilder::BuildConnectionFactory( base::RepeatingCallback< void(network::mojom::ProxyResolvingSocketFactoryRequest)> get_socket_factory_callback, + scoped_refptr io_task_runner, GCMStatsRecorder* recorder, network::NetworkConnectionTracker* network_connection_tracker) { return base::WrapUnique(new FakeConnectionFactory()); @@ -430,7 +442,8 @@ void GCMClientImplTest::InitializeGCMClient() { chrome_build_info.version = kChromeVersion; chrome_build_info.product_category_for_subtypes = kProductCategoryForSubtypes; gcm_client_->Initialize( - chrome_build_info, gcm_store_path(), task_runner_, base::DoNothing(), + chrome_build_info, gcm_store_path(), task_runner_, + base::ThreadTaskRunnerHandle::Get(), base::DoNothing(), base::MakeRefCounted( &test_url_loader_factory_), network::TestNetworkConnectionTracker::GetInstance(), From fe6a0ef3b80008dfcb0d8933220e829dd7844620 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Mon, 12 Aug 2019 15:37:27 -0400 Subject: [PATCH 42/55] Unit tests: fixes GCMDriver c'tor signature change. Chromium change: https://chromium.googlesource.com/chromium/src/+/a76a6e39300b764f4a0e3824b9d17e6c2bf51b73 commit a76a6e39300b764f4a0e3824b9d17e6c2bf51b73 Author: Alex Chau Date: Wed Jun 26 16:20:01 2019 +0000 Create WebPushSender for sending web-push messages - Created WebPushSender for sending out web-push messages using VAPID (https://developers.google.com/web/ilt/pwa/introduction-to-push-notifications#using_vapid) - Created WebPushMessage struct to encapsulate message_id into messages to make callbacks easier - Refactored across GCMEncryptionProvider / GCMDriver to use WebPushMessage and provide callback mechanism Bug: 966037 --- components/invalidation/fcm_unittest.cc | 10 ++++++++-- test/BUILD.gn | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/invalidation/fcm_unittest.cc b/components/invalidation/fcm_unittest.cc index aeed3d918c8..4f92b000006 100644 --- a/components/invalidation/fcm_unittest.cc +++ b/components/invalidation/fcm_unittest.cc @@ -20,6 +20,8 @@ #include "components/gcm_driver/instance_id/instance_id_driver.h" #include "components/invalidation/impl/status.h" #include "google_apis/gcm/engine/account_mapping.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/test/test_url_loader_factory.h" #include "testing/gmock/include/gmock/gmock.h" using base::TestMockTimeTaskRunner; @@ -73,8 +75,11 @@ class MockInstanceID : public InstanceID { class MockGCMDriver : public gcm::GCMDriver { public: MockGCMDriver() - : GCMDriver(/*store_path=*/base::FilePath(), - /*blocking_task_runner=*/nullptr) {} + : GCMDriver( + /*store_path=*/base::FilePath(), + /*blocking_task_runner=*/nullptr, + base::MakeRefCounted( + &test_url_loader_factory_)) {} ~MockGCMDriver() override = default; MOCK_METHOD4(ValidateRegistration, @@ -128,6 +133,7 @@ class MockGCMDriver : public gcm::GCMDriver { gcm::GCMDecryptionResult result)); private: + network::TestURLLoaderFactory test_url_loader_factory_; DISALLOW_COPY_AND_ASSIGN(MockGCMDriver); }; diff --git a/test/BUILD.gn b/test/BUILD.gn index fcb8ed916e3..494a1921b24 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -247,6 +247,8 @@ test("brave_unit_tests") { "//components/sync_preferences", "//components/translate/core/browser:test_support", "//content/public/common", + "//services/network/public/cpp:cpp", + "//services/network:test_support", "//third_party/cacheinvalidation", ] From eeb46f05994d966f642ae8bf93dc35955121c875 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Mon, 12 Aug 2019 16:57:55 -0400 Subject: [PATCH 43/55] Unit tests: Fixes CreateProfileAsyncHelper signature. ProfileManagerWithoutInit::CreateProfileAsyncHelper overridden in TorUnittestProfileManager now returns unique_ptr to Profile. Chromium change: https://chromium.googlesource.com/chromium/src/+/8f0b748a630d30d0cdc08cd2e4b6dd64b139e97b commit 8f0b748a630d30d0cdc08cd2e4b6dd64b139e97b Author: Daniel Hosseinian Date: Fri Jun 7 18:21:04 2019 +0000 ProfileManager::RegisterTestingProfile() now takes a std::unique_ptr This commit clarifies previously established ownership semantics of Profiles within ProfileManager through the use of unique pointers. Changes were made to the parameters of ProfileManager::RegisterTestingProfile() and ProfileManager::RegisterProfile() to take a std::unique_ptr instead of a raw pointer. A further change was made to the return type of ProfileManager::CreateProfileAsyncHelper() from a raw pointer to a unique pointer. All callers to the aforementioned functions (including unit tests) that made calls to the two functions are updated to pass in unique pointers. Bug: 968187 --- browser/profiles/tor_unittest_profile_manager.cc | 12 ++++++------ browser/profiles/tor_unittest_profile_manager.h | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/browser/profiles/tor_unittest_profile_manager.cc b/browser/profiles/tor_unittest_profile_manager.cc index e9405cfb234..037312d6c59 100644 --- a/browser/profiles/tor_unittest_profile_manager.cc +++ b/browser/profiles/tor_unittest_profile_manager.cc @@ -24,11 +24,12 @@ Profile* TorUnittestProfileManager::CreateProfileHelper( if (!base::CreateDirectory(path)) return nullptr; } - return CreateProfile(path, nullptr); + return CreateProfile(path, nullptr).release(); } -Profile* TorUnittestProfileManager::CreateProfileAsyncHelper( - const base::FilePath& path, Delegate* delegate) { +std::unique_ptr TorUnittestProfileManager::CreateProfileAsyncHelper( + const base::FilePath& path, + Delegate* delegate) { // ThreadTaskRunnerHandle::Get() is TestingProfile's "async" IOTaskRunner // (ref. TestingProfile::GetIOTaskRunner()). base::ThreadTaskRunnerHandle::Get()->PostTask( @@ -46,7 +47,7 @@ void TorUnittestProfileManager::InitProfileUserPrefs(Profile* profile) { } } -Profile* TorUnittestProfileManager::CreateProfile( +std::unique_ptr TorUnittestProfileManager::CreateProfile( const base::FilePath& path, Delegate* delegate) { TestingProfile::Builder profile_builder; sync_preferences::PrefServiceMockFactory factory; @@ -58,6 +59,5 @@ Profile* TorUnittestProfileManager::CreateProfile( profile_builder.SetPrefService(std::move(prefs)); profile_builder.SetPath(path); profile_builder.SetDelegate(delegate); - std::unique_ptr profile = profile_builder.Build(); - return profile.release(); + return profile_builder.Build(); } diff --git a/browser/profiles/tor_unittest_profile_manager.h b/browser/profiles/tor_unittest_profile_manager.h index dfe3a1792af..b06352c03fe 100644 --- a/browser/profiles/tor_unittest_profile_manager.h +++ b/browser/profiles/tor_unittest_profile_manager.h @@ -17,13 +17,14 @@ class TorUnittestProfileManager : public ProfileManagerWithoutInit { protected: Profile* CreateProfileHelper(const base::FilePath& path) override; - Profile* CreateProfileAsyncHelper(const base::FilePath& path, - Delegate* delegate) override; + std::unique_ptr CreateProfileAsyncHelper( + const base::FilePath& path, + Delegate* delegate) override; void InitProfileUserPrefs(Profile* profile) override; private: - Profile* CreateProfile(const base::FilePath& path, Delegate* delegate); + std::unique_ptr CreateProfile(const base::FilePath& path, Delegate* delegate); }; #endif // BRAVE_BROWSER_PROFILES_TOR_UNITTEST_PROFILE_MANAGER_H_ From a2a2196ac5dca7d32901871c360d5b92e724cd04 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Wed, 21 Aug 2019 17:08:50 -0400 Subject: [PATCH 44/55] Unit test: BraveSyncServiceTest.GetDisableReasons fix. Fixes expected results. GetDisabledReasons returns a different value from Chromium because one of the sync preferences had the initial value flipped. Chromium change: https://chromium.googlesource.com/chromium/src/+/84acadd70d0ef573faf775d712ba6cd430f931e2 commit 84acadd70d0ef573faf775d712ba6cd430f931e2 Author: Marc Treib Date: Mon Jul 8 16:02:25 2019 +0000 SyncPrefs: Change default value of "IsSyncRequested" to false This is achieved by migrating the "SyncSuppressed" pref to a new "SyncRequested" pref. Before this CL, there was a pref called "sync.suppress_start", which was the inverse of the "IsSyncRequested" flag in SyncPrefs/SyncUserSettings. It was false by default, meaning Sync was considered "requested" even if the user had never even attempted to turn on Sync. This CL migrates the value over to a new "sync.requested" pref, which is the inverse of the old pref, and has the correct default value (not requested). If the old pref has an explicit value, then the migration is simply "sync.requested := !sync.suppress_start". If the old pref does not have a value, then there's generally nothing to migrate (and thus the implicit value of "IsSyncRequested" will change to false, which is the sane default state). However, as one special case of the migration, if the old pref is not explicitly set, but "IsFirstSetupComplete" is true, then that means Sync was actually enabled, but (probably through some past bug in the Sync setup flow) "SetSyncRequested(true)" was just never called. To correctly migrate users in this state, we set the new "sync.requested" pref to true. Apart from the migration edge case mentioned above, the different default value does not introduce a behavior change: All sync setup flows must anyway call SetSyncRequested(true) since they can't be sure what the previous value was. Bug: 906034 --- components/brave_sync/brave_sync_service_unittest.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/brave_sync/brave_sync_service_unittest.cc b/components/brave_sync/brave_sync_service_unittest.cc index 8ed5ebcb93d..f58204dd154 100644 --- a/components/brave_sync/brave_sync_service_unittest.cc +++ b/components/brave_sync/brave_sync_service_unittest.cc @@ -729,10 +729,12 @@ TEST_F(BraveSyncServiceTest, GetPreferredDataTypes) { TEST_F(BraveSyncServiceTest, GetDisableReasons) { sync_prefs()->SetManagedForTest(true); EXPECT_EQ(sync_service()->GetDisableReasons(), - syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY); + syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY | + syncer::SyncService::DISABLE_REASON_USER_CHOICE); sync_service()->OnSetSyncEnabled(true); EXPECT_EQ(sync_service()->GetDisableReasons(), - syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY); + syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY | + syncer::SyncService::DISABLE_REASON_USER_CHOICE); brave_sync_prefs()->SetMigratedBookmarksVersion(2); EXPECT_EQ(sync_service()->GetDisableReasons(), syncer::SyncService::DISABLE_REASON_NONE); From b72571d12fcd4426a479919113986e5c3572d1d0 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Wed, 21 Aug 2019 17:24:18 -0400 Subject: [PATCH 45/55] Browser Test: SendToOmniboxAndSubmit signature change. Now takes browser pointer instead of a location bar pointer. Chromium change: https://chromium.googlesource.com/chromium/src/+/ad9765ab97dfb00c188a331852abcbf40e818a14 commit ad9765ab97dfb00c188a331852abcbf40e818a14 Author: Evan Stade Date: Tue Jul 2 17:02:41 2019 +0000 Remove NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY This was only used in tests. Those tests can instead use OmniboxControllerEmitter::Observer. This CL also combines the OmniboxApiTests that are browser tests with the ones that are interactive ui tests. They were split rather sloppily, with a common base class declared and defined in a header file they both included (but not mentioned in any BUILD.gn). Most of the affected tests are actually disabled anyway. Now they're all interactive ui tests. Bug: 268984 --- browser/brave_content_browser_client_browsertest.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/browser/brave_content_browser_client_browsertest.cc b/browser/brave_content_browser_client_browsertest.cc index 53121d55feb..f8b7f1968cd 100644 --- a/browser/brave_content_browser_client_browsertest.cc +++ b/browser/brave_content_browser_client_browsertest.cc @@ -275,8 +275,7 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, TypedMagnetURL) { content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); content::TestNavigationObserver observer(web_contents); - LocationBar* location_bar = browser()->window()->GetLocationBar(); - ui_test_utils::SendToOmniboxAndSubmit(location_bar, magnet_url().spec()); + ui_test_utils::SendToOmniboxAndSubmit(browser(), magnet_url().spec()); observer.Wait(); EXPECT_EQ(magnet_url(), web_contents->GetLastCommittedURL().spec()); } From 94fd7868c3ad5be16deb38764d0342b474225968 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Wed, 21 Aug 2019 18:01:24 -0400 Subject: [PATCH 46/55] Browser Test: added missing overrides to BraveMockRenderViewContextMenu. Chromium change: https://chromium.googlesource.com/chromium/src/+/d6b794c59f423ead8b1f2633c7fd879710aa1382 commit d6b794c59f423ead8b1f2633c7fd879710aa1382 Author: Himanshu Jaju Date: Tue Jul 16 19:31:46 2019 +0000 Context menu for click to call Add tel scheme to list of schemes in url Screenshot for multiple devices: https://storage.cloud.google.com/chromium-translation-screenshots/d3ea7c88529dd93e5f403fa57d5df3bfadf8936a Screenshot for single device: https://storage.cloud.google.com/chromium-translation-screenshots/bc5be9872a3e0a2c30bbb9a80ac370cafa339988 Bug: 972060 --- .../brave_mock_render_view_context_menu.cc | 19 +++++++++++++++++-- .../brave_mock_render_view_context_menu.h | 9 ++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/browser/renderer_context_menu/brave_mock_render_view_context_menu.cc b/browser/renderer_context_menu/brave_mock_render_view_context_menu.cc index fdc9b237213..12c25aeb942 100644 --- a/browser/renderer_context_menu/brave_mock_render_view_context_menu.cc +++ b/browser/renderer_context_menu/brave_mock_render_view_context_menu.cc @@ -7,6 +7,7 @@ #include +#include "base/strings/string_number_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" @@ -95,6 +96,13 @@ void BraveMockRenderViewContextMenu::AddMenuItem(int command_id, items_.push_back(item); } +void BraveMockRenderViewContextMenu::AddMenuItemWithIcon( + int command_id, + const base::string16& title, + const gfx::ImageSkia& image) { + AddMenuItem(command_id, title); +} + void BraveMockRenderViewContextMenu::AddCheckItem(int command_id, const base::string16& title) { MockMenuItem item; @@ -147,6 +155,14 @@ void BraveMockRenderViewContextMenu::AddSubMenu(int command_id, } } +void BraveMockRenderViewContextMenu::AddSubMenuWithStringIdAndIcon( + int command_id, + int message_id, + ui::MenuModel* model, + const gfx::ImageSkia& image) { + AddSubMenu(command_id, base::NumberToString16(message_id), model); +} + void BraveMockRenderViewContextMenu::UpdateMenuItem( int command_id, bool enabled, @@ -203,8 +219,7 @@ void BraveMockRenderViewContextMenu::AddSpellCheckServiceItem(bool is_checked) { } void BraveMockRenderViewContextMenu::AddAccessibilityLabelsServiceItem( - bool is_checked) { -} + bool is_checked) {} content::RenderViewHost* BraveMockRenderViewContextMenu::GetRenderViewHost() const { diff --git a/browser/renderer_context_menu/brave_mock_render_view_context_menu.h b/browser/renderer_context_menu/brave_mock_render_view_context_menu.h index bb2035f6fb3..f47f69e76c6 100644 --- a/browser/renderer_context_menu/brave_mock_render_view_context_menu.h +++ b/browser/renderer_context_menu/brave_mock_render_view_context_menu.h @@ -57,11 +57,18 @@ class BraveMockRenderViewContextMenu : public ui::SimpleMenuModel::Delegate, // RenderViewContextMenuProxy implementation. void AddMenuItem(int command_id, const base::string16& title) override; + void AddMenuItemWithIcon(int command_id, + const base::string16& title, + const gfx::ImageSkia& image) override; void AddCheckItem(int command_id, const base::string16& title) override; void AddSeparator() override; void AddSubMenu(int command_id, const base::string16& label, ui::MenuModel* model) override; + void AddSubMenuWithStringIdAndIcon(int command_id, + int message_id, + ui::MenuModel* model, + const gfx::ImageSkia& image) override; void UpdateMenuItem(int command_id, bool enabled, bool hidden, @@ -72,8 +79,8 @@ class BraveMockRenderViewContextMenu : public ui::SimpleMenuModel::Delegate, void AddSpellCheckServiceItem(bool is_checked) override; void AddAccessibilityLabelsServiceItem(bool is_checked) override; content::RenderViewHost* GetRenderViewHost() const override; - content::BrowserContext* GetBrowserContext() const override; content::WebContents* GetWebContents() const override; + content::BrowserContext* GetBrowserContext() const override; // Attaches a RenderViewContextMenuObserver to be tested. void SetObserver(RenderViewContextMenuObserver* observer); From f2357d87648afc9b6acfab3635fe1956066d4bd9 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Wed, 21 Aug 2019 18:19:25 -0400 Subject: [PATCH 47/55] Browser Test: Removed SetUrlRequestMocksEnabled. This function was removed along with url_request_mock_util.h. Chromium change: https://chromium.googlesource.com/chromium/src/+/779c64cbc9bf21539fe7b712df43b79952086704 commit 779c64cbc9bf21539fe7b712df43b79952086704 Author: Clark DuVall Date: Wed Jun 12 22:31:58 2019 +0000 Cleanup unnecessary non-network service code Bug: 934009 --- browser/extensions/brave_base_local_data_files_browsertest.cc | 4 ---- browser/extensions/brave_extension_provider_browsertest.cc | 1 - .../browser/https_everywhere_service_browsertest.cc | 3 --- .../browser/tracking_protection_service_browsertest.cc | 1 - 4 files changed, 9 deletions(-) diff --git a/browser/extensions/brave_base_local_data_files_browsertest.cc b/browser/extensions/brave_base_local_data_files_browsertest.cc index fb795510662..ca830a94802 100644 --- a/browser/extensions/brave_base_local_data_files_browsertest.cc +++ b/browser/extensions/brave_base_local_data_files_browsertest.cc @@ -14,7 +14,6 @@ #include "brave/components/brave_component_updater/browser/local_data_files_observer.h" #include "brave/components/brave_component_updater/browser/local_data_files_service.h" #include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/net/url_request_mock_util.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/test/browser_test_utils.h" @@ -63,9 +62,6 @@ void BaseLocalDataFilesBrowserTest::MaybeSetUpEmbeddedTestServerOnMainThread() { if (!embedded_test_server_directory()) return; - base::PostTaskWithTraits( - FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); host_resolver()->AddRule("*", "127.0.0.1"); } diff --git a/browser/extensions/brave_extension_provider_browsertest.cc b/browser/extensions/brave_extension_provider_browsertest.cc index 41f3996932f..96ef5802f8c 100644 --- a/browser/extensions/brave_extension_provider_browsertest.cc +++ b/browser/extensions/brave_extension_provider_browsertest.cc @@ -13,7 +13,6 @@ #include "brave/components/brave_shields/browser/https_everywhere_service.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/net/url_request_mock_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/test/browser_test_utils.h" diff --git a/components/brave_shields/browser/https_everywhere_service_browsertest.cc b/components/brave_shields/browser/https_everywhere_service_browsertest.cc index 863815fbcff..f3972b806c5 100644 --- a/components/brave_shields/browser/https_everywhere_service_browsertest.cc +++ b/components/brave_shields/browser/https_everywhere_service_browsertest.cc @@ -9,7 +9,6 @@ #include "brave/common/brave_paths.h" #include "brave/components/brave_shields/browser/https_everywhere_service.h" #include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/net/url_request_mock_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_task_traits.h" @@ -41,8 +40,6 @@ class HTTPSEverywhereServiceTest : public ExtensionBrowserTest { void SetUpOnMainThread() override { ExtensionBrowserTest::SetUpOnMainThread(); - base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); host_resolver()->AddRule("*", "127.0.0.1"); } diff --git a/components/brave_shields/browser/tracking_protection_service_browsertest.cc b/components/brave_shields/browser/tracking_protection_service_browsertest.cc index 213702e54fa..f6eeaf562da 100644 --- a/components/brave_shields/browser/tracking_protection_service_browsertest.cc +++ b/components/brave_shields/browser/tracking_protection_service_browsertest.cc @@ -15,7 +15,6 @@ #include "brave/components/brave_shields/browser/buildflags/buildflags.h" // For STP #include "brave/components/brave_shields/browser/tracking_protection_service.h" #include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/net/url_request_mock_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/ui_test_utils.h" #include "components/prefs/pref_service.h" From 0a9546e99adcf87a4c2182759626ae464ee6c649 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Wed, 21 Aug 2019 18:25:11 -0400 Subject: [PATCH 48/55] Browser Test: Added a missing header include. --- browser/extensions/api/brave_wallet_api_browsertest.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/browser/extensions/api/brave_wallet_api_browsertest.cc b/browser/extensions/api/brave_wallet_api_browsertest.cc index a84179b3d9b..e468658757f 100644 --- a/browser/extensions/api/brave_wallet_api_browsertest.cc +++ b/browser/extensions/api/brave_wallet_api_browsertest.cc @@ -11,6 +11,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/test/browser_test_utils.h" +#include "extensions/common/extension.h" #include "extensions/common/extension_builder.h" #include "extensions/test/extension_test_message_listener.h" #include "net/dns/mock_host_resolver.h" From 0fcb757f68e142d359d34987d4d6b4f39d4e5941 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Wed, 21 Aug 2019 18:29:34 -0400 Subject: [PATCH 49/55] Browser Test: Rename ContextualSuggestionsService => RemoteSuggestionsService Chromium change: https://chromium.googlesource.com/chromium/src/+/06ec26ae93ec896440311c705d994d356a02897a commit 06ec26ae93ec896440311c705d994d356a02897a Author: Tommy C. Li Date: Mon Jun 10 18:01:42 2019 +0000 [omnibox] Rename ContextualSuggestionsService => RemoteSuggestionsService These suggestions requests are not always contextual, but always remote. This CL corrects a misnomer and is a followup to: https://chromium-review.googlesource.com/c/chromium/src/+/1640160 Bug: 963173 --- .../brave_autocomplete_provider_client_browsertest.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/autocomplete/brave_autocomplete_provider_client_browsertest.cc b/browser/autocomplete/brave_autocomplete_provider_client_browsertest.cc index ce2b4398f48..47b8370d1ef 100644 --- a/browser/autocomplete/brave_autocomplete_provider_client_browsertest.cc +++ b/browser/autocomplete/brave_autocomplete_provider_client_browsertest.cc @@ -36,8 +36,8 @@ IN_PROC_BROWSER_TEST_F(BraveAutocompleteProviderClientTest, incognito_client.GetAutocompleteClassifier()); EXPECT_EQ(normal_client.GetHistoryService(), incognito_client.GetHistoryService()); - EXPECT_EQ(normal_client.GetContextualSuggestionsService(true), - incognito_client.GetContextualSuggestionsService(true)); + EXPECT_EQ(normal_client.GetRemoteSuggestionsService(true), + incognito_client.GetRemoteSuggestionsService(true)); EXPECT_EQ(normal_client.GetDocumentSuggestionsService(true), incognito_client.GetDocumentSuggestionsService(true)); } From ec1a9d4f7545d44ff87a88e32ebdaf4dab0ea031 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Thu, 22 Aug 2019 14:31:58 -0400 Subject: [PATCH 50/55] Browser Test: Allow intentional crash. Chromium now enforces no renderer crashes assertion on browser tests. To allow an intentional crash test ScopedAllowRendererCrashes needs to be added. Chromium changes: https://chromium.googlesource.com/chromium/src/+/922389129506cc063b83ffddc7e27e0314ead777 commit 922389129506cc063b83ffddc7e27e0314ead777 Author: Lukasz Anforowicz Date: Mon Jun 17 20:26:46 2019 +0000 Start enforcing NoRendererCrashesAssertion in browser tests. Change-Id: Iec1b1090a675ff6af74661f5a000c41a9a8df940 Bug: 972220 https://chromium.googlesource.com/chromium/src/+/96eca2d491cd1153b0674c8e6983312a83d55dcf commit 96eca2d491cd1153b0674c8e6983312a83d55dcf Author: Lukasz Anforowicz Date: Thu Jun 13 20:46:42 2019 +0000 Prepare browser tests for NoRendererCrashesAssertion. This CL adds ScopedAllowRendererCrashes to browser tests that (expectedly or unexpectedly) might trigger a renderer crash. Right now a browser test might pass, even if a renderer process crashed during the test execution. After https://crrev.com/c/1650463 a renderer crash will trigger an explicit test failure, but before this enforcement can start, existing tests that experience renderer crashes (expectedly or unexpectedly) need to declare this via ScopedAllowRendererCrashes. This CL was uploaded by git cl split. R=bengr@chromium.org Bug: 972220 --- browser/brave_scheme_load_browsertest.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/browser/brave_scheme_load_browsertest.cc b/browser/brave_scheme_load_browsertest.cc index afd7b00b12a..89f28e9b9df 100644 --- a/browser/brave_scheme_load_browsertest.cc +++ b/browser/brave_scheme_load_browsertest.cc @@ -223,6 +223,7 @@ IN_PROC_BROWSER_TEST_F(BraveSchemeLoadBrowserTest, CrashURLTest) { content::WindowedNotificationObserver observer( content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, content::NotificationService::AllSources()); + content::ScopedAllowRendererCrashes allow_renderer_crashes(active_contents()); browser()->OpenURL( content::OpenURLParams(GURL("brave://crash/"), content::Referrer(), WindowOpenDisposition::CURRENT_TAB, From efff5dd6876498875f1be2ab6f66ff8b5557434d Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Thu, 25 Jul 2019 14:41:17 -0400 Subject: [PATCH 51/55] Update strings for 77.0.3865.19. --- app/app_management_strings.grdp | 13 +- app/brave_strings.grd | 54 +-- app/generated_resources.grd | 418 +++++++++++++---------- app/media_router_strings.grdp | 134 -------- app/onboarding_welcome_strings.grdp | 6 - app/profiles_strings.grdp | 3 + app/settings_brave_strings.grdp | 21 +- app/settings_strings.grdp | 491 ++++++++++++++++++++++------ app/vr_strings.grdp | 10 - 9 files changed, 676 insertions(+), 474 deletions(-) diff --git a/app/app_management_strings.grdp b/app/app_management_strings.grdp index cabba467e41..a174561ebf7 100644 --- a/app/app_management_strings.grdp +++ b/app/app_management_strings.grdp @@ -49,8 +49,8 @@ Permissions - - More permissions + + More settings and permissions This app can: @@ -76,4 +76,13 @@ Version: $14.0 + + Pinned by administrator + + + Contacts + + + Storage + diff --git a/app/brave_strings.grd b/app/brave_strings.grd index a46827ed9f0..c530baf42d4 100644 --- a/app/brave_strings.grd +++ b/app/brave_strings.grd @@ -589,7 +589,10 @@ Brave is unable to recover your settings. - + + About &Brave + + About &Brave OS @@ -615,9 +618,6 @@ Brave is unable to recover your settings. - - Sign in to sync and personalize Brave across your devices - Sync and personalize Brave across your devices @@ -737,6 +737,12 @@ Signing in anyway will merge Brave information like bookmarks, history, and othe Brave OS could not sync your data due to an error signing in. + + You clear cookies when you quit Brave. To keep syncing, change this $1settings. + + + settings + @@ -1149,40 +1155,6 @@ Please check your email at $2jane.doe@example.com Welcome to Brave - - Take Brave everywhere - - - Web browsing with Brave smarts - - - Not now - - - Sync and personalize Brave across your devices - - - - - - - Welcome to Brave - - - Get to Brave faster - - - Make Brave your default browser - - - Pin Brave to your taskbar - - - Select <div class="logo-small"></div> <strong>Brave</strong> - - - Click <strong>Switch anyway</strong>, if it appears - @@ -1247,6 +1219,12 @@ Please check your email at $2jane.doe@example.com Share a Brave tab + + + + Help us improve Brave + + diff --git a/app/generated_resources.grd b/app/generated_resources.grd index eb4a588171f..3874134c36b 100644 --- a/app/generated_resources.grd +++ b/app/generated_resources.grd @@ -901,8 +901,8 @@ are declared in tools/grit/grit_rule.gni. Save page &as... - - Distill page + + Toggle distilled page contents More too&ls @@ -2902,7 +2902,7 @@ are declared in tools/grit/grit_rule.gni. Sharing $1youtube.com to $2meet.google.com - Share this tab + Share this tab instead Stop @@ -3196,7 +3196,6 @@ are declared in tools/grit/grit_rule.gni. No-op Service - Installed theme "$1Snowflake Theme" @@ -3512,6 +3511,9 @@ are declared in tools/grit/grit_rule.gni. Read and change anything you type + + Launch and exit managed guest sessions + Display UI on the login screen @@ -3687,6 +3689,9 @@ are declared in tools/grit/grit_rule.gni. Replace the page you see when opening a new tab + + Run in the background when requested by a cooperating native application + @@ -4403,20 +4408,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Updated just now - - - This page will use a lot of data. - - - Page paused. - - - Continue - - - Stop using data on this page - - Lite mode now makes browsing faster on all pages, including HTTPS. @@ -4830,9 +4821,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Restore default shortcuts - - Customize this page - Brave backgrounds @@ -4932,12 +4920,27 @@ Keep your key file in a safe place. You will need it to create new versions of y Most visited sites - + Shortcuts are suggested based on websites you visit often - + Shortcuts are curated by you + + Current theme you have installed + + + Uninstall + + + Select color + + + Default + + + Hex color value + @@ -5034,8 +5037,8 @@ Keep your key file in a safe place. You will need it to create new versions of y Remember my choice - - Use app + + Open Stay in Brave @@ -5264,7 +5267,7 @@ Keep your key file in a safe place. You will need it to create new versions of y - Nope + No thanks @@ -6253,6 +6256,25 @@ Keep your key file in a safe place. You will need it to create new versions of y + + + + Call from your devices + + + Call from $1Jimmy's Pixel + + + + + + Call from Your Devices + + + Call from $1Jimmy's Pixel + + + @@ -6730,45 +6752,22 @@ Keep your key file in a safe place. You will need it to create new versions of y - - You've signed in and turned on Sync - - + Turn on sync? - + Sync your bookmarks, passwords, history, and more on all your devices - + Brave may use your history to personalize Search, ads, and other Brave services - + You can always choose what to sync in settings. - - - - Brave Sync - - - Your bookmarks, history, passwords, and other settings will be synced to your Brave Account so you can use them on all your devices - - - Personalize Brave services - - - Brave may use your browsing history to personalize Search, ads, and other Brave services - - - Brave may use your browsing history to personalize Search and other Brave services - - - Want to manage sync and personalization before they’re turned on? Visit <a id="settingsLink" href="chrome://settings">Settings</a></a>. - - + Yes, I'm in - + Settings @@ -7137,20 +7136,17 @@ Please help our engineers fix this problem. Tell us what happened right before y Sign in to $1Brave - + Sync is disabled by your administrator. - + Sync has been stopped via the Brave Dashboard. Confirm sync settings to start sync. - - Error signing in. - - - Oops, Sync has stopped working. + + Setup in progress... Sync isn’t working. Try signing in again. @@ -7201,20 +7197,12 @@ Please help our engineers fix this problem. Tell us what happened right before y Advanced settings - - - Setup in progress... - - - - - Please wait... - - - - - Sync everything - + + + + Please wait... + + @@ -7229,16 +7217,18 @@ Please help our engineers fix this problem. Tell us what happened right before y $1Sept 1, 2012. This doesn't include payment methods and addresses from Brave Pay. - - - Not signed in to $1Brave - - - (You're missing out—$1sign in) - - - sign in - + + + + Not signed in to $1Brave + + + (You're missing out—$1sign in) + + + sign in + + @@ -7258,7 +7248,6 @@ Please help our engineers fix this problem. Tell us what happened right before y This page could not be translated - Options @@ -7269,6 +7258,12 @@ Please help our engineers fix this problem. Tell us what happened right before y Change languages + + More languages... + + + Page is not in $1French ? + Translate @@ -7317,6 +7312,12 @@ Please help our engineers fix this problem. Tell us what happened right before y Language settings + + Language to translate into + + + Page language to translate + @@ -7328,6 +7329,12 @@ Please help our engineers fix this problem. Tell us what happened right before y Change Languages + + More Languages... + + + Page Is Not In $1French ? + Translate @@ -7376,10 +7383,19 @@ Please help our engineers fix this problem. Tell us what happened right before y Language Settings + + Language To Translate Into + + + Page Language To Translate + Unknown + + Reset + @@ -7598,6 +7614,22 @@ Please help our engineers fix this problem. Tell us what happened right before y Check Grammar With Spelling + + + Substitutions + + + Show Substitutions + + + Smart Quotes + + + Smart Dashes + + + Text Replacement + Always Show Bookmarks Bar @@ -8466,38 +8498,6 @@ Please help our engineers fix this problem. Tell us what happened right before y - - - Identity API Token Cache - - - Access Token - - - Extension Name - - - Extension Id - - - Token Status - - - Not Found - - - Token Present - - - Expiration Time - - - Scopes - - - Revoke - - A fast, simple, and secure web browser, built for the modern web. @@ -8757,10 +8757,10 @@ Please help our engineers fix this problem. Tell us what happened right before y Entered window overview mode - + Entered full screen - + Exited full screen @@ -8789,6 +8789,12 @@ Please help our engineers fix this problem. Tell us what happened right before y Refresh + + Clear + + + No log entries + Show: @@ -8972,16 +8978,16 @@ Please help our engineers fix this problem. Tell us what happened right before y - + No nearby devices found. - $1www.google.com wants to scan for nearby Bluetooth devices, the following devices have been found: + $1www.google.com wants to scan for nearby Bluetooth devices. The following devices have been found: - + Allow - + Block @@ -9065,6 +9071,17 @@ Please help our engineers fix this problem. Tell us what happened right before y Ads blocked on this site + + + Details + + + Ad removed. + + + This ad uses too many resources for your device, so Brave removed it. + + Windows Utilities @@ -9088,22 +9105,6 @@ Please help our engineers fix this problem. Tell us what happened right before y - - - - The web browser by Brave, for you - - - Sign in to Brave with your Brave Account to get your bookmarks, history, passwords, and other settings on all your devices. - - - Sign in - - - No thanks - - - @@ -9138,31 +9139,6 @@ Please help our engineers fix this problem. Tell us what happened right before y - - - - Open Windows Settings - - - Click <strong>Microsoft Edge</strong> under Web Browser - - - Switch anyway - - - Right click the <div class="logo-small"></div> icon in the taskbar - - - Select <strong>Pin to taskbar</strong> - - - Pin to taskbar - - - Continue - - - @@ -9243,6 +9219,101 @@ Please help our engineers fix this problem. Tell us what happened right before y Upload + + + + Save changes to $1README.md? + + + Save changes to files? + + + $1example.com will be able to save your changes directly to $2README.md. The site can save changes until you close this tab. + + + $1example.com will be able to save your changes directly to the files in $2My Project. The site can save changes until you close this tab. + + + Save changes + + + + + This page is allowed to save to files. + + + This page is allowed to view all the files in a folder on your device. + + + $1example.com can save your changes directly to $2README.md + + + $1example.com can save your changes directly to the following files + + + $1example.com can save your changes directly to the files in $2My Project + + + $1example.com can save your changes directly to the following folders + + + $1example.com can save your changes directly to the following files and folders + + + $1example.com can view all the files in $2My Project + + + $1example.com can view all the files in the following folders + + + $1example.com can view and save your changes directly to the following files and folders + + + Save changes + + + View changes + + + {0, plural, offset:2 + =1 {{1}README.md} + =2 {{1}README.md, {2}Brave.png} + other {{1}README.md, {2}Brave.png, and # more} + } + + + Expand... + + + Collapse... + + + Remove access + + + + + + Can't save to this folder + + + $1example.com can't save your changes to this folder because it contains system files. + + + Choose a different folder + + + + + Let site view files? + + + $1example.com will be able to view all files in $2My Project. The site can see any changes to the folder until you close this tab. + + + View files + + @@ -9505,6 +9576,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Allow + + Try again + @@ -9531,6 +9605,16 @@ Please help our engineers fix this problem. Tell us what happened right before y Exit Private + + + + + Take Survey + + + Your feedback is important to us. + + - + diff --git a/app/media_router_strings.grdp b/app/media_router_strings.grdp index d57bb063745..c2062a6f63c 100644 --- a/app/media_router_strings.grdp +++ b/app/media_router_strings.grdp @@ -3,43 +3,14 @@ - - Media Router - Display on another screen &Cast... - - Cast - - - - - Back - - - Close - - - Search - - - View cast mode list - - - View device list - - - Stop, $1Living Room TV, $2Casting YouTube - - - Cast to - Cast $1google.com @@ -54,15 +25,6 @@ - - Select source - - - Share your screen - - - Stream a video or audio file - Cast $1my_media.mp3 @@ -93,39 +55,7 @@ Optimize fullscreen videos - - - Enable casting to cloud-based services like Brave Hangouts. - - - - Welcome to the Cast experience in Brave! - - - You can use this feature to display content from Brave on your TV or other devices. - - - - - Welcome to the Cast experience in Brave! - - - You can use this feature to display content from Brave on your TV or other devices. - - - - Ok, got it - - - - - Dismiss - - - - Error - Unable to cast $1youtube.com. @@ -135,9 +65,6 @@ Unable to cast tab. - - Only one session can be created at a time. - Unable to cast desktop. @@ -148,59 +75,6 @@ Unable to cast $1my_media.mp3. - - - Casting: $1Video - - - Cast - - - Stop - - - Play - - - Pause - - - Mute - - - Unmute - - - Seek - - - Volume - - - Current time - - - Duration - - - Smooth Motion [beta] - - - Use high bandwidth for best video or animation. Other people with slow connections may not see your content. - - - Always use mirroring - - - Show fullscreen videos on - - - Both screens - - - Remote screen - - Looking for devices @@ -230,14 +104,6 @@ Source not supported - - - Search - - - No matches - - Audio/Video diff --git a/app/onboarding_welcome_strings.grdp b/app/onboarding_welcome_strings.grdp index a06b3485c2e..3793c632f9e 100644 --- a/app/onboarding_welcome_strings.grdp +++ b/app/onboarding_welcome_strings.grdp @@ -2,9 +2,6 @@ - - Get started - Next @@ -91,9 +88,6 @@ Get Brave Search and Brave smarts everytime you browse - - Skip - Set as default diff --git a/app/profiles_strings.grdp b/app/profiles_strings.grdp index ecc95783e00..c4e6e84db66 100644 --- a/app/profiles_strings.grdp +++ b/app/profiles_strings.grdp @@ -469,6 +469,9 @@ Add person + + Name + The new user couldn't be created. Please check your hard drive space and permissions and try again. diff --git a/app/settings_brave_strings.grdp b/app/settings_brave_strings.grdp index f52ba6a1365..2c00aace09c 100644 --- a/app/settings_brave_strings.grdp +++ b/app/settings_brave_strings.grdp @@ -3,13 +3,13 @@ + + About Brave + + + Get help with Brave + - - About Brave - - - Get help with Brave - Updating Brave @@ -24,14 +24,19 @@ - + About Brave OS - + Get help with Brave OS + + + Clear cookies and site data when you quit Brave + + Brave Pay (copied to Brave) diff --git a/app/settings_strings.grdp b/app/settings_strings.grdp index a833a66f7a1..b6a5a2494e9 100644 --- a/app/settings_strings.grdp +++ b/app/settings_strings.grdp @@ -12,6 +12,9 @@ + + Continue + More actions @@ -136,9 +139,6 @@ Download update using mobile data - - Continue - @@ -150,6 +150,12 @@ Report an issue + + Internet connection required + + + See what's new + Checking for updates @@ -163,6 +169,78 @@ + + Captions + + + Text size + + + Text font + + + Text color + + + Text opacity + + + Background opacity + + + 0 + + + 100 + + + Text shadow + + + None + + + Raised + + + Depressed + + + Uniform + + + Drop shadow + + + Background color + + + Black + + + White + + + Red + + + Green + + + Blue + + + Yellow + + + Cyan + + + Magenta + + + Default + Accessibility @@ -191,6 +269,42 @@ Select and customize text-to-speech voices + + Switch Access settings + + + Switch action assignment + + + Space + + + Enter + + + None + + + Select + + + Next + + + Previous + + + Auto-scan + + + Enable auto-scan + + + Scanning speed: $11.5s + + + $11.5s + Show large mouse cursor @@ -464,36 +578,6 @@ - - - Kiosk Next Shell (Dev) - - - Kiosk Next Shell - - - Enables the Kiosk Next Shell for the next sign in. - - - Disable the Kiosk Next Shell and return to the normal Brave OS experience. - - - Turn off - - - Turn off the Kiosk Next Shell - - - Turn on the Kiosk Next Shell - - - This will turn off the Kiosk Next Shell, sign you out and return you to the normal Brave OS experience. - - - This will sign you out and turn on the Kiosk Next Shell. - Linux (Beta) @@ -543,6 +627,12 @@ Replace your Linux apps and files with a previous backup + + Confirm Restore + + + Restoring from a backup will delete existing Linux applications and data in your Linux files folder. + USB preferences @@ -564,7 +654,7 @@ Plugin VM - Manage settings for running Plugin VM on your $1Bravebook + Set up permissions Give access to printers @@ -596,7 +686,7 @@ Brave Play Store - Install apps and games from Brave Play on your Bravebook. <a target="_blank" href="$1https://google.com/">Learn more</a> + Install apps and games from Brave Play on your $1Bravebook. <a target="_blank" href="$2https://google.com/">Learn more</a> Manage Android preferences @@ -608,6 +698,8 @@ Remove Android apps? + Apps you’ve downloaded from Brave Play will be deleted from this Bravebook. <br><br> @@ -629,6 +721,9 @@ Manage your apps + + Open App Management + @@ -1027,6 +1122,9 @@ Connected + + Connected, $1100% battery + Not connected @@ -1362,6 +1460,12 @@ Add Printer + + + Saved detected printers to your profile, or add a new printer. + + + Available printers to save Edit @@ -1369,9 +1473,15 @@ Remove + + Configure + Search printers + + Your saved printers + Add a nearby printer @@ -1513,6 +1623,14 @@ End User License Agreement + + Couldn't detect a printer. Please enter printer address again. + + + Unable to set up printer. Please check configuration and try again. + + + @@ -1552,7 +1670,7 @@ Set up or manage network file shares. - Add File Share + Add file share File share URL @@ -1566,6 +1684,9 @@ Password (optional) + + Remember sign-in info + Share mounted successfully. @@ -1591,7 +1712,7 @@ Invalid URL format. Server must be specified as a host name when SSO authentication is used. - Authentication Method + Authentication method Standard @@ -1601,67 +1722,127 @@ - + - - Kerberos Accounts + + Kerberos tickets - - Kerberos Accounts + + Kerberos tickets - - All Kerberos Accounts for single sign-on into certain apps and websites and file shares can be managed here. + + Choose a ticket to use for authentication. <a target="_blank" href="$1https://google.com/">Learn more</a> - - Accounts + + Tickets - - Add account + + Add a ticket - - Remove account from this device + + Refresh now - - Signed in + + Set as active ticket - - Sign in again + + Remove from this device - - Sign in + + Ticket removed - - Add Kerberos Account + + Valid for $17 hours 12 minutes - - Username + + Expired + + + Refresh + + + Active - + + Add a Kerberos ticket + + + Refresh a Kerberos ticket + + + To automatically refresh a ticket, check “Remember password.” Your password will be stored on your device only. + + + Kerberos username + + Password - + + Remember password + + + Refresh + + + Advanced + + + Configure Kerberos + + + Edit the configuration file + + Network problem or bad realm - - Username invalid (should be user@realm.com) + + Username invalid - + Username not known to server - + + A ticket with this username already exists + + Contacting server for realm failed - + Password invalid - + Password expired - + KDC does not support encryption type - - Oops! Something went wrong (error code $1123). + + Couldn't get Kerberos ticket. Try again, or contact your organization's device admin. (Error code $1123). + + + Section nested in group: $1[realms] (inside a block of curly braces '{ ... }) + + + Section syntax error: $1[realms + + + Expected opening curly brace: $1ticket_lifetime = 1d (in the line after 'EXAMPLE.COM = )' + + + Extra curly brace: $1} (without having a corresponding opening curly brace '{') + + + Relation syntax error: $1ticket_lifetime : 1d + + + Configuration option not supported: $1ccache_type = 1 + + + Section not supported: $1[appdefaults] + + + Failed to parse configuration @@ -1828,6 +2009,9 @@ Allow other users of this device to use this network + + Automatically connecting to a hidden network allows others to see your device and some network settings, and is not recommended. + Save identity and password @@ -1897,6 +2081,15 @@ Allow mobile data roaming + + On, not roaming + + + On, roaming + + + Roaming off + Mobile data network @@ -1984,6 +2177,8 @@ Port + + Change PIN @@ -1999,7 +2194,7 @@ Change - + Enter @@ -2032,6 +2227,22 @@ Enter PIN Unlock Key + + Incorrect PIN. Retries left: $13. + + + Incorrect PUK. Retries left: $13. + + + Invalid PIN. Retries left: $13. + + + Invalid PUK. Retries left: $13. + + + PIN values do not match. + + Prefer this network @@ -2499,16 +2710,9 @@ - - - Languages and input - - - - - Languages - - + + Languages + Language @@ -2876,12 +3080,6 @@ Brave Assistant - - Related info - - - Let the Assistant show you info related to what's on your screen - "Ok Brave" @@ -2903,9 +3101,6 @@ Voice match - - Teach your Assistant to recognize your voice - Retrain @@ -2987,8 +3182,8 @@ Do not allow sites to see text and images copied to the clipboard - - Cookies + + Cookies and site data Handlers @@ -3377,9 +3572,6 @@ Prevent third-party websites from saving and reading cookie data - - Keep local data only until you quit your browser - Adobe Flash Player Storage settings @@ -3581,9 +3773,6 @@ PINs do not match - - Continue - Show lock screen when waking from sleep @@ -3639,11 +3828,14 @@ Note: Your fingerprint may be less secure than a strong password or PIN. - delete [$1Fingerprint 1], button + delete [$1Fingerprint 1] Finger $11 + + Enable Brave media playback at lock screen + Add account @@ -3665,12 +3857,21 @@ Not updated yet + + More actions, $1abcd@google.com + Update account Sign in + + Update account, $1abcd@google.com + + + Sign in, $1abcd@google.com + Remove this account @@ -3680,15 +3881,30 @@ Primary account + + $1abcd@google.com was removed from this device + Set up your fingerprint - + + Touch the power button with your finger - + The fingerprint sensor is in the power button. Touch it lightly with any finger. + + + Touch the fingerprint sensor with your finger + + + The fingerprint sensor is the bottom right-hand key on your keyboard. Touch it lightly with any finger. + + + The fingerprint sensor is the top right-hand key on your keyboard. Touch it lightly with any finger. + + Fingerprint added. @@ -4610,8 +4826,14 @@ Use hardware acceleration when available - - Open proxy settings + + Open your computer's proxy settings + + + $1Brave is using proxy settings from an extension + + + $1Brave is using proxy settings from your administrator @@ -4624,7 +4846,7 @@ Android phone - Connect your Bravebook with your phone. <a target="_blank" href="$1https://google.com/">Learn more</a> + Connect your $1Bravebook with your phone. <a target="_blank" href="$2https://google.com/">Learn more</a> No eligible devices. <a target="_blank" href="$1https://google.com/">Learn more</a> @@ -4645,7 +4867,7 @@ Disabled - Unlock your Bravebook with your phone. <a target="_blank" href="$1https://google.com/">Learn more</a> + Unlock your $1Bravebook with your phone. <a target="_blank" href="$2https://google.com/">Learn more</a> Instant Tethering @@ -4657,16 +4879,16 @@ Messages - Send and receive text messages from your Bravebook. <a target="_blank" href="$1https://google.com/">Learn more</a> + Send and receive text messages from your $1Bravebook. <a target="_blank" href="$2https://google.com/">Learn more</a> Forget phone - Disconnect your phone from your Bravebook + Disconnect your phone from your $1Bravebook - Disconnect your phone from your Bravebook. They will no longer connect automatically. + Disconnect your phone from your $1Bravebook. They will no longer connect automatically. @@ -4929,6 +5151,9 @@ PIN must be at least 4 characters + + Too short + PIN must be at most 63 characters @@ -4953,4 +5178,52 @@ The security key is locked because the wrong PIN was entered too many times. To unlock it, remove and reinsert it. + + Show PINs + + + Hide PINs + + + Manage sign-in data + + + View and delete the sign-in data stored on your security key + + + Security key sign-in data + + + Website + + + Username + + + To view sign-in data, insert and touch your security key + + + To view sign-in data, enter the PIN for your security key. If you don’t know the PIN, you’ll need to reset the security key. + + + This security key does not have any sign-in data + + + This security key can't store any sign-in data + + + Your security key was removed. + + + Your security key is not protected with a PIN. To manage sign-in data, first create a PIN. + + + Your security key couldn't be read + + + Your sign-in data was deleted + + + Your sign-in data couldn't be deleted + diff --git a/app/vr_strings.grdp b/app/vr_strings.grdp index fabd938fef6..353e8953e0d 100644 --- a/app/vr_strings.grdp +++ b/app/vr_strings.grdp @@ -7,10 +7,6 @@ Press App button to exit - - XR Isolated Device Service - - Site is tracking your location @@ -150,18 +146,12 @@ New private tab - - New private tab - Settings Close private tabs - - Close private tabs - Tabs From 5268033261dbb1987748bb831d3babfa88648ffe Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Fri, 16 Aug 2019 15:12:11 -0400 Subject: [PATCH 52/55] TEMPORARY: commented out code affected by Chromium commit 6811de35a39128fb354f238bce350f9a4a643e9d --- utility/importer/brave_importer.cc | 13 ---- utility/importer/chrome_importer.cc | 115 +++++----------------------- 2 files changed, 19 insertions(+), 109 deletions(-) diff --git a/utility/importer/brave_importer.cc b/utility/importer/brave_importer.cc index 7bf299aa8ae..ea5f12f246c 100644 --- a/utility/importer/brave_importer.cc +++ b/utility/importer/brave_importer.cc @@ -39,19 +39,6 @@ #include "sql/statement.h" #include "url/gurl.h" -#if defined(OS_LINUX) -#include "components/os_crypt/key_storage_config_linux.h" -#endif - -#if defined(USE_X11) -#if defined(USE_LIBSECRET) -#include "chrome/browser/password_manager/native_backend_libsecret.h" -#endif -#include "chrome/browser/password_manager/native_backend_kwallet_x.h" -#include "chrome/browser/password_manager/password_store_x.h" -#include "components/os_crypt/key_storage_util_linux.h" -#endif - using base::Time; BraveImporter::BraveImporter() { diff --git a/utility/importer/chrome_importer.cc b/utility/importer/chrome_importer.cc index 2d039b709d7..0152223e167 100644 --- a/utility/importer/chrome_importer.cc +++ b/utility/importer/chrome_importer.cc @@ -41,20 +41,6 @@ #include "components/os_crypt/key_storage_config_linux.h" #endif -#if defined(USE_X11) -#if defined(USE_LIBSECRET) -#include "chrome/browser/password_manager/native_backend_libsecret.h" -#endif -#include "chrome/browser/password_manager/native_backend_kwallet_x.h" -#include "chrome/browser/password_manager/password_store_x.h" -#include "components/os_crypt/key_storage_util_linux.h" - -base::nix::DesktopEnvironment ChromeImporter::GetDesktopEnvironment() { - std::unique_ptr env(base::Environment::Create()); - return base::nix::GetDesktopEnvironment(env.get()); -} -#endif - using base::Time; ChromeImporter::ChromeImporter() { @@ -314,92 +300,29 @@ double ChromeImporter::chromeTimeToDouble(int64_t time) { } void ChromeImporter::ImportPasswords(const base::FilePath& prefs_filename) { - #if !defined(USE_X11) - base::FilePath passwords_path = - source_path_.Append( - base::FilePath::StringType(FILE_PATH_LITERAL("Login Data"))); - - password_manager::LoginDatabase database(passwords_path); - if (!database.Init()) { - LOG(ERROR) << "LoginDatabase Init() failed"; - return; - } + base::FilePath passwords_path = source_path_.Append( + base::FilePath::StringType(FILE_PATH_LITERAL("Login Data"))); - std::vector> forms; - bool success = database.GetAutofillableLogins(&forms); - if (success) { - for (size_t i = 0; i < forms.size(); ++i) { - bridge_->SetPasswordForm(*forms[i].get()); - } - } - std::vector> blacklist; - success = database.GetBlacklistLogins(&blacklist); - if (success) { - for (size_t i = 0; i < blacklist.size(); ++i) { - bridge_->SetPasswordForm(*blacklist[i].get()); - } - } - #else - base::FilePath prefs_path = source_path_.Append(prefs_filename); - const base::Value *value; - scoped_refptr prefs = new JsonPrefStore(prefs_path); - int local_profile_id; - if (prefs->ReadPrefs() != PersistentPrefStore::PREF_READ_ERROR_NONE) { - return; - } - if (!prefs->GetValue(password_manager::prefs::kLocalProfileId, &value)) { - return; - } - if (!value->GetAsInteger(&local_profile_id)) { - return; - } + password_manager::LoginDatabase database(passwords_path); + if (!database.Init()) { + LOG(ERROR) << "LoginDatabase Init() failed"; + return; + } - std::unique_ptr backend; - base::nix::DesktopEnvironment desktop_env = GetDesktopEnvironment(); - - // WIP proper kEnableEncryptionSelection - os_crypt::SelectedLinuxBackend selected_backend = - os_crypt::SelectBackend(std::string(), true, desktop_env); - if (!backend && - (selected_backend == os_crypt::SelectedLinuxBackend::KWALLET || - selected_backend == os_crypt::SelectedLinuxBackend::KWALLET5)) { - base::nix::DesktopEnvironment used_desktop_env = - selected_backend == os_crypt::SelectedLinuxBackend::KWALLET - ? base::nix::DESKTOP_ENVIRONMENT_KDE4 - : base::nix::DESKTOP_ENVIRONMENT_KDE5; - backend.reset(new NativeBackendKWallet(local_profile_id, - used_desktop_env)); - } else if (selected_backend == os_crypt::SelectedLinuxBackend::GNOME_ANY || - selected_backend == - os_crypt::SelectedLinuxBackend::GNOME_KEYRING || - selected_backend == - os_crypt::SelectedLinuxBackend::GNOME_LIBSECRET) { - #if defined(USE_LIBSECRET) - if (!backend && - (selected_backend == os_crypt::SelectedLinuxBackend::GNOME_ANY || - selected_backend == - os_crypt::SelectedLinuxBackend::GNOME_LIBSECRET)) { - backend.reset(new NativeBackendLibsecret(local_profile_id)); - } - #endif + std::vector> forms; + bool success = database.GetAutofillableLogins(&forms); + if (success) { + for (size_t i = 0; i < forms.size(); ++i) { + bridge_->SetPasswordForm(*forms[i].get()); } - if (backend && backend->Init()) { - std::vector> forms; - bool success = backend->GetAutofillableLogins(&forms); - if (success) { - for (size_t i = 0; i < forms.size(); ++i) { - bridge_->SetPasswordForm(*forms[i].get()); - } - } - std::vector> blacklist; - success = backend->GetBlacklistLogins(&blacklist); - if (success) { - for (size_t i = 0; i < blacklist.size(); ++i) { - bridge_->SetPasswordForm(*blacklist[i].get()); - } - } + } + std::vector> blacklist; + success = database.GetBlacklistLogins(&blacklist); + if (success) { + for (size_t i = 0; i < blacklist.size(); ++i) { + bridge_->SetPasswordForm(*blacklist[i].get()); } - #endif + } } void ChromeImporter::ImportCookies() { From 16c04ffede11ea539d50496d7c82964efe998a51 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Tue, 27 Aug 2019 15:09:43 -0400 Subject: [PATCH 53/55] Fixes theme swtiching. Theme switching broke due to the introduction of "preferred color scheme" into native theme. See Chromium change below. On top of SetDarkMode that we already were doing, added SetPreferredColorScheme that sets preferred color scheme to our selection. Also, had to patch ChromeContentBrowserClient to catch switching preferred color in web prefs when the system color is switched. That gets triggered by the system color change, for example via control panel on Windows. The Windows specific implementation watches a registry value and updates preferred color scheme in the native theme. Would be great to intercept it there, but in that layer we don't have access to our setting stored in profile prefs, from what I can tell. Hence, the patch to ChromeContentBrowserClient where the setting is used. Ugly. cc: @simonhong perhaps you have better ideas? Chromium change: https://chromium.googlesource.com/chromium/src/+/67fd4d9f35650a079f6a636b5d19de77856bd2cf commit 67fd4d9f35650a079f6a636b5d19de77856bd2cf Author: Alison Maher Date: Fri Jul 12 18:34:21 2019 +0000 Set preferred color scheme for high contrast This change adds logic to update the preferred color scheme based on the OS high contrast theme. If high contrast is not enabled, preferred color scheme will continue to be based on the OS dark mode state. A PreferredColorScheme enum was added to NativeTheme to keep track of the current high contrast/dark mode preferred color scheme. The updated preferred color scheme is used to evaluate the prefers-color-scheme media query. Bug: 970285 --- browser/themes/brave_theme_utils.cc | 59 +++++++++++++++++-- browser/themes/brave_theme_utils.h | 23 ++++++-- .../browser/chrome_content_browser_client.cc | 20 ++++--- chromium_src/ui/native_theme/native_theme.h | 17 ++++++ ...ser-chrome_content_browser_client.cc.patch | 13 ++++ patches/ui-native_theme-native_theme.h.patch | 10 ++-- 6 files changed, 118 insertions(+), 24 deletions(-) create mode 100644 chromium_src/ui/native_theme/native_theme.h create mode 100644 patches/chrome-browser-chrome_content_browser_client.cc.patch diff --git a/browser/themes/brave_theme_utils.cc b/browser/themes/brave_theme_utils.cc index dd6b57623dc..223509f7553 100644 --- a/browser/themes/brave_theme_utils.cc +++ b/browser/themes/brave_theme_utils.cc @@ -12,9 +12,32 @@ #endif namespace ui { -void SetDarkMode(bool dark_mode) { - ui::NativeTheme::GetInstanceForNativeUi()->set_dark_mode(dark_mode); -} // namespace ui +// static +void BraveThemeUtils::SetDarkMode(bool dark_mode) { + NativeTheme::GetInstanceForNativeUi()->set_dark_mode(dark_mode); +} + +// static +void BraveThemeUtils::SetPreferredColorScheme(BraveThemeType brave_theme_type) { + NativeTheme::PreferredColorScheme preferred_color_scheme = + NativeTheme::PreferredColorScheme::kNoPreference; + switch (brave_theme_type) { + case BraveThemeType::BRAVE_THEME_TYPE_DEFAULT: + preferred_color_scheme = NativeTheme::GetInstanceForNativeUi() + ->CalculatePreferredColorScheme(); + break; + case BraveThemeType::BRAVE_THEME_TYPE_DARK: + preferred_color_scheme = NativeTheme::PreferredColorScheme::kDark; + break; + case BraveThemeType::BRAVE_THEME_TYPE_LIGHT: + preferred_color_scheme = NativeTheme::PreferredColorScheme::kLight; + break; + default: + NOTREACHED(); + } + NativeTheme::GetInstanceForNativeUi()->set_preferred_color_scheme( + preferred_color_scheme); +} #if defined(OS_WIN) // This resets dark mode to os theme when user changes brave theme from @@ -34,6 +57,7 @@ void SetSystemTheme(BraveThemeType type) { if (type == BraveThemeType::BRAVE_THEME_TYPE_DEFAULT) { #if defined(OS_WIN) DCHECK(SystemThemeSupportDarkMode()); + // This sets preferred color scheme on its own. ui::UpdateDarkModeStatus(); return; #else @@ -43,9 +67,14 @@ void SetSystemTheme(BraveThemeType type) { #endif } - ui::SetDarkMode(type == BraveThemeType::BRAVE_THEME_TYPE_DARK); - // Have to notify to observer explicitly because |ui::SetDarkMode()| just - // set ui::NativeTheme:dark_mode_ value. + ui::BraveThemeUtils::SetDarkMode(type == + BraveThemeType::BRAVE_THEME_TYPE_DARK); + ui::BraveThemeUtils::SetPreferredColorScheme(type); + // Have to notify observers explicitly because + // |ui::BraveThemeUtils::SetDarkMode()| and + // |ui::BraveThemeUtils::SetPreferredColorScheme| just set + // ui::NativeTheme:dark_mode_ and ui::NativeTheme:preferred_color_scheme_ + // values. ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers(); } #endif @@ -56,3 +85,21 @@ bool SystemThemeSupportDarkMode() { return false; } #endif + +ui::NativeTheme::PreferredColorScheme GetBravePreferredColorScheme( + const ui::NativeTheme* native_theme, + Profile* profile) { + BraveThemeType brave_theme_type = + BraveThemeService::GetActiveBraveThemeType(profile); + switch (brave_theme_type) { + case BraveThemeType::BRAVE_THEME_TYPE_DEFAULT: + return native_theme->GetPreferredColorScheme(); + case BraveThemeType::BRAVE_THEME_TYPE_DARK: + return ui::NativeTheme::PreferredColorScheme::kDark; + case BraveThemeType::BRAVE_THEME_TYPE_LIGHT: + return ui::NativeTheme::PreferredColorScheme::kLight; + default: + NOTREACHED(); + } + return ui::NativeTheme::PreferredColorScheme::kNoPreference; +} diff --git a/browser/themes/brave_theme_utils.h b/browser/themes/brave_theme_utils.h index ee2ee1e08cb..af72da8184e 100644 --- a/browser/themes/brave_theme_utils.h +++ b/browser/themes/brave_theme_utils.h @@ -7,6 +7,14 @@ #define BRAVE_BROWSER_THEMES_BRAVE_THEME_UTILS_H_ #include "brave/browser/themes/brave_theme_service.h" +#include "ui/native_theme/native_theme.h" + +// When system theme preferred color is changed this is called from +// ChromeContentBrowserClient to see if we need to ignore the change if we are +// in one of our themes (not in "same as system" theme). +ui::NativeTheme::PreferredColorScheme GetBravePreferredColorScheme( + const ui::NativeTheme* native_theme, + Profile* profile); bool SystemThemeSupportDarkMode(); @@ -18,13 +26,16 @@ bool SystemThemeSupportDarkMode(); void SetSystemTheme(BraveThemeType type); // Inserted in the ui namespace to add into ui::NativeTheme/NativeThemeWin as a -// friend function. This function calls protected/private method of -// ui::NativeTheme::set_dark_mode(). It's a protected method that called by -// platform specific subclasses whenever system os theme is changed. -// But we want to change it for using brave theme also for webui/base ui -// modules like context menu. +// friend class. These methods call protected methods of ui::NativeTheme. They +// are protected methods that called by platform specific subclasses whenever +// system os theme is changed. But we want to change it for using brave theme +// also for webui/base ui modules like context menu. namespace ui { -void SetDarkMode(bool dark_mode); +class BraveThemeUtils { + public: + static void SetDarkMode(bool dark_mode); + static void SetPreferredColorScheme(BraveThemeType brave_theme_type); +}; } // namespace ui #endif // BRAVE_BROWSER_THEMES_BRAVE_THEME_UTILS_H_ diff --git a/chromium_src/chrome/browser/chrome_content_browser_client.cc b/chromium_src/chrome/browser/chrome_content_browser_client.cc index 8cc6efca11b..a14d7acab30 100644 --- a/chromium_src/chrome/browser/chrome_content_browser_client.cc +++ b/chromium_src/chrome/browser/chrome_content_browser_client.cc @@ -3,6 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "brave/browser/themes/brave_theme_utils.h" #include "brave/components/brave_shields/browser/buildflags/buildflags.h" // For STP #include "build/build_config.h" // For OS_MACOSX #include "chrome/browser/search/search.h" @@ -22,23 +23,28 @@ #if defined(OS_LINUX) #include "brave/browser/ui/views/brave_browser_main_extra_parts_views_linux.h" -#define ChromeBrowserMainExtraPartsViewsLinux BraveBrowserMainExtraPartsViewsLinux // NOLINT +#define ChromeBrowserMainExtraPartsViewsLinux \ + BraveBrowserMainExtraPartsViewsLinux // NOLINT #endif #define HandleNewTabURLRewrite HandleNewTabURLRewrite_ChromiumImpl #define HandleNewTabURLReverseRewrite HandleNewTabURLReverseRewrite_ChromiumImpl +#define BRAVE_CHROMECONTENTBROWSERCLIENT_OVERRIDEWEBKITPREFS \ + switch (GetBravePreferredColorScheme(native_theme, profile)) { + namespace search { - bool HandleNewTabURLRewrite(GURL * url, content::BrowserContext * bc) { - return false; - } - bool HandleNewTabURLReverseRewrite(GURL * url, content::BrowserContext * bc) { - return false; - } +bool HandleNewTabURLRewrite(GURL* url, content::BrowserContext* bc) { + return false; +} +bool HandleNewTabURLReverseRewrite(GURL* url, content::BrowserContext* bc) { + return false; +} } // namespace search #include "../../../../chrome/browser/chrome_content_browser_client.cc" // NOLINT +#undef BRAVE_CHROMECONTENTBROWSERCLIENT_OVERRIDEWEBKITPREFS #undef HandleNewTabURLRewrite #undef HandleNewTabURLReverseRewrite_ChromiumImpl diff --git a/chromium_src/ui/native_theme/native_theme.h b/chromium_src/ui/native_theme/native_theme.h new file mode 100644 index 00000000000..b77c1694327 --- /dev/null +++ b/chromium_src/ui/native_theme/native_theme.h @@ -0,0 +1,17 @@ +// Copyright (c) 2019 The Brave Authors +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// you can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_CHROMIUM_SRC_UI_NATIVE_THEME_NATIVE_THEME_H_ +#define BRAVE_CHROMIUM_SRC_UI_NATIVE_THEME_NATIVE_THEME_H_ + +namespace ui { +class BraveThemeUtils; +} // namespace ui + +#define BRAVE_UI_NATIVE_THEME_NATIVE_THEME_H_ friend class ui::BraveThemeUtils; +#include "../../../../ui/native_theme/native_theme.h" +#undef BRAVE_UI_NATIVE_THEME_NATIVE_THEME_H_ + +#endif // BRAVE_CHROMIUM_SRC_UI_NATIVE_THEME_NATIVE_THEME_H_ diff --git a/patches/chrome-browser-chrome_content_browser_client.cc.patch b/patches/chrome-browser-chrome_content_browser_client.cc.patch new file mode 100644 index 00000000000..af7c5c3265b --- /dev/null +++ b/patches/chrome-browser-chrome_content_browser_client.cc.patch @@ -0,0 +1,13 @@ +diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc +index 0b29bc11f07c95f6048c9a35150925ad16a08586..44cab1c7f2897fb0191b33653d3cae945234d79f 100644 +--- a/chrome/browser/chrome_content_browser_client.cc ++++ b/chrome/browser/chrome_content_browser_client.cc +@@ -3376,7 +3376,7 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs( + : blink::ForcedColors::kNone; + #endif // !defined(OS_MACOSX) + +- switch (native_theme->GetPreferredColorScheme()) { ++ BRAVE_CHROMECONTENTBROWSERCLIENT_OVERRIDEWEBKITPREFS + case ui::NativeTheme::PreferredColorScheme::kDark: + web_prefs->preferred_color_scheme = blink::PreferredColorScheme::kDark; + break; diff --git a/patches/ui-native_theme-native_theme.h.patch b/patches/ui-native_theme-native_theme.h.patch index f9c5e191d43..66c0d326eb0 100644 --- a/patches/ui-native_theme-native_theme.h.patch +++ b/patches/ui-native_theme-native_theme.h.patch @@ -1,12 +1,12 @@ diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h -index 97ced9d2495c33aad710d8ec5208b8107cd94ed9..c9760db651c897b6dfdaee11dc7ad44d3180c2b1 100644 +index 97ced9d2495c33aad710d8ec5208b8107cd94ed9..406189f160f7155b7348d22fd15968da8404ec81 100644 --- a/ui/native_theme/native_theme.h +++ b/ui/native_theme/native_theme.h -@@ -430,6 +430,7 @@ class NATIVE_THEME_EXPORT NativeTheme { +@@ -428,6 +428,7 @@ class NATIVE_THEME_EXPORT NativeTheme { + + // Returns the system's caption style. virtual base::Optional GetSystemCaptionStyle() const; ++ BRAVE_UI_NATIVE_THEME_NATIVE_THEME_H_ protected: -+ friend void SetDarkMode(bool dark_mode); NativeTheme(); - virtual ~NativeTheme(); - From ef4dad338e255ad8bd63da20496256d8a56b3f55 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Wed, 28 Aug 2019 17:09:48 -0400 Subject: [PATCH 54/55] Changed BraveProxyingWebSocket to align with C77 changes. Can't use it as is right now. The proxy is commented out in `BraveContentBrowserClient::CreateWebSocket`. Chromium changes: https://chromium.googlesource.com/chromium/src/+/c570adabe2a390ad16b8bbab2b9ffdd864ff7156 commit c570adabe2a390ad16b8bbab2b9ffdd864ff7156 Author: Yoichi Osato Date: Tue Jun 4 05:28:31 2019 +0000 [websocket] Reland: "Split interface mojom::WebSocketClient" This CL splits the interface to two parts so that WebRequestProxyingWebSocket or extensions proxy only handshake of WebSocket: interface WebSocketHandshakeClient { OnStartOpeningHandshake(WebSocketHandshakeRequest request); OnFinishOpeningHandshake(WebSocketHandshakeResponse response); OnAddChannelResponse(string selected_protocol, string extensions); }; interface WebSocketClient { OnDataFrame(bool fin, WebSocketMessageType type, array data); OnFlowControl(int64 quota); OnDropChannel(bool was_clean, uint16 code, string reason); OnClosingHandshake(); OnFailChannel(string reason); }; Performance gain of receive-arraybuffer-1MBx100.html: Mine: 1050 ms ToT : 1221 ms Relanding: The previous patch was reverted because of a browser test of "--disable-features=NetworkService". This patch fixes it to adapt a WebRequestAPI test to both expectations. Reverted-change: https://chromium-review.googlesource.com/c/chromium/src/+/1628497 Bug: 865001, 942989 https://chromium.googlesource.com/chromium/src/+/7ce089524dc096357034700d2e5b76ff29d50388 commit 7ce089524dc096357034700d2e5b76ff29d50388 Author: Yoichi Osato Date: Tue Jun 18 02:10:34 2019 +0000 Reland "[WebSocket] Add --websocket-renderer-receive-quota-max command line flag." Reason for reland: the culprit was not this patch. This patch was reverted because of compile failure on android: https://chromium-review.googlesource.com/c/chromium/src/+/1660391 However, relanding this don't cause compile failure. Bug: 865001 commit 04d43cf58c3473d83adfed27fb8dcb2ead6f4c3a Author: Yoichi Osato Date: Fri Jun 14 04:04:21 2019 +0000 [WebSocket] Add --websocket-renderer-receive-quota-max command line flag. This patch adds the flag that overrides default threshold value that the renderer calls AddReceiveFlowControlQuota() to the browser per receiving this amount of data so that the browser can continue sending remaining data to the renderer. Default value is 32k Bytes. The more the value is, browser tends the less stop sending packets and then consumes more memory. This flag will be used to investigate the performance issue. You can use this flag both on chrome and content_shell: $ ./chrome.exe --websocket-renderer-receive-quota-max=3000000 This flag sets the threshold 3M Bytes. Implementation detail: This patch moves the default value constant from blink to net/websockets/websocket_channel.h so that we can pass the command line flag to the renderer. This change also enables us to modify the value while considering sent buffer from a server later on for further optimization. Bug: 865001 https://chromium.googlesource.com/chromium/src/+/6894c69a9c069d2175794c8d11743298dddd65cf commit 6894c69a9c069d2175794c8d11743298dddd65cf Author: Yutaka Hirano Date: Fri Jun 28 12:54:45 2019 +0000 Rename WebSocketHandshakeClient messages In preparation to removing AddChannelRequest, rename AddChannelResponse to OnConnectionEstablished. OnFinishOpeningHandshake has been confusing because it doesn't mean successful handshake finish (i.e., connection establishment). Rename it to OnResponseReceived. Rename OnStartOpeningHandshake to OnOpeningHandshakeStarted for consistency. Bug: 967524 https://chromium.googlesource.com/chromium/src/+/8e0b4d43cebd21a0be442187fe33d325939857e1 commit 8e0b4d43cebd21a0be442187fe33d325939857e1 Author: Yutaka Hirano Date: Thu Jul 4 07:12:38 2019 +0000 Remove mojom::WebSocket::AddChannelRequest ...in order to remove the unnecessary overhead on the browser process when downloading / uploading payloads. With this CL, both mojom::WebSocket and mojom::WebSocketClient only pass though the proxy interface implemented in extensions/browser/api/web_request. With this CL, 1) NetworkContext::CreateWebSocket takes additional parameters. This makes the state transition in network::WebSocket a bit simpler. 2) blink::mojom::WebSocketConnector is introduced. mojom::WebSocketConnector::Connector corresponds to mojom::WebSocket::AddChannelRequest. 3) mojom::WebSocket is passed as a parameter of mojom::WebSocketHandshakeClient::OnConnectionEstablished. 4) Instead of mojom::WebSocket, the extensions module now receives a function to initiate a WebSocket opening handshake. 5) ContentBrowserClient::WillCreateWebSocket is split into three: WillInterceptWebSocket, GetWebSocketOptions and CreateWebSocket. This incurs an additional thread hop, but it will be fixed once the extensions module for WebSocket is moved to the UI thread. This improves [1] in my environment. Without the change: 318MB/s With the change : 389MB/s 1: third_party/blink/perf_tests/websocket/receive-arraybuffer-1MBx100.html Bug: 865001, 967524, 942989 --- browser/brave_content_browser_client.cc | 27 +++- browser/brave_content_browser_client.h | 12 +- browser/net/brave_proxying_web_socket.cc | 196 +++++++---------------- browser/net/brave_proxying_web_socket.h | 68 +++----- browser/net/resource_context_data.cc | 31 +++- browser/net/resource_context_data.h | 10 +- 6 files changed, 138 insertions(+), 206 deletions(-) diff --git a/browser/brave_content_browser_client.cc b/browser/brave_content_browser_client.cc index d97ccdb68c7..71571a0586c 100644 --- a/browser/brave_content_browser_client.cc +++ b/browser/brave_content_browser_client.cc @@ -241,15 +241,26 @@ bool BraveContentBrowserClient::WillCreateURLLoaderFactory( return use_proxy; } -void BraveContentBrowserClient::WillCreateWebSocket( +bool BraveContentBrowserClient::WillInterceptWebSocket( + content::RenderFrameHost* frame) { + //return (frame != nullptr); + return ChromeContentBrowserClient::WillInterceptWebSocket(frame); +} + +void BraveContentBrowserClient::CreateWebSocket( content::RenderFrameHost* frame, - network::mojom::WebSocketRequest* request, - network::mojom::AuthenticationHandlerPtr* auth_handler, - network::mojom::TrustedHeaderClientPtr* header_client, - uint32_t* options) { - ChromeContentBrowserClient::WillCreateWebSocket(frame, request, auth_handler, - header_client, options); - BraveProxyingWebSocket::ProxyWebSocket(frame, request, auth_handler); + content::ContentBrowserClient::WebSocketFactory factory, + const GURL& url, + const GURL& site_for_cookies, + const base::Optional& user_agent, + network::mojom::WebSocketHandshakeClientPtr handshake_client) { + ChromeContentBrowserClient::CreateWebSocket(frame, std::move(factory), url, + site_for_cookies, user_agent, + std::move(handshake_client)); + // TODO(max): can't hook in here any more. + //BraveProxyingWebSocket::ProxyWebSocket(frame, std::move(factory), url, + // site_for_cookies, user_agent, + // std::move(handshake_client)); } void BraveContentBrowserClient::MaybeHideReferrer( diff --git a/browser/brave_content_browser_client.h b/browser/brave_content_browser_client.h index 322f2b09c13..3b7b16a7f74 100644 --- a/browser/brave_content_browser_client.h +++ b/browser/brave_content_browser_client.h @@ -64,12 +64,14 @@ class BraveContentBrowserClient : public ChromeContentBrowserClient { network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client, bool* bypass_redirect_checks) override; - void WillCreateWebSocket( + bool WillInterceptWebSocket(content::RenderFrameHost* frame) override; + void CreateWebSocket( content::RenderFrameHost* frame, - network::mojom::WebSocketRequest* request, - network::mojom::AuthenticationHandlerPtr* auth_handler, - network::mojom::TrustedHeaderClientPtr* header_client, - uint32_t* options) override; + content::ContentBrowserClient::WebSocketFactory factory, + const GURL& url, + const GURL& site_for_cookies, + const base::Optional& user_agent, + network::mojom::WebSocketHandshakeClientPtr handshake_client) override; void MaybeHideReferrer(content::BrowserContext* browser_context, const GURL& request_url, diff --git a/browser/net/brave_proxying_web_socket.cc b/browser/net/brave_proxying_web_socket.cc index 770e930043a..7fc8ae923c1 100644 --- a/browser/net/brave_proxying_web_socket.cc +++ b/browser/net/brave_proxying_web_socket.cc @@ -20,31 +20,24 @@ #include "content/public/browser/render_process_host.h" BraveProxyingWebSocket::BraveProxyingWebSocket( - BraveRequestHandler* handler, - content::ResourceContext* resource_context, + WebSocketFactory factory, + const network::ResourceRequest& request, + network::mojom::WebSocketHandshakeClientPtr handshake_client, int process_id, - int frame_id, int frame_tree_node_id, - const url::Origin& origin, + content::ResourceContext* resource_context, scoped_refptr request_id_generator, - network::mojom::WebSocketPtr proxied_socket, - network::mojom::WebSocketRequest proxied_request, + BraveRequestHandler* handler, DisconnectCallback on_disconnect) : request_handler_(handler), process_id_(process_id), - frame_id_(frame_id), frame_tree_node_id_(frame_tree_node_id), - origin_(origin), + factory_(std::move(factory)), resource_context_(resource_context), request_id_generator_(std::move(request_id_generator)), - proxied_socket_(std::move(proxied_socket)), - on_disconnect_(std::move(on_disconnect)) { - binding_as_websocket_.Bind(std::move(proxied_request)); - - binding_as_websocket_.set_connection_error_handler( - base::BindRepeating(&BraveProxyingWebSocket::OnError, - base::Unretained(this), net::ERR_FAILED)); -} + forwarding_handshake_client_(std::move(handshake_client)), + request_(request), + on_disconnect_(std::move(on_disconnect)) {} BraveProxyingWebSocket::~BraveProxyingWebSocket() { if (ctx_) { @@ -55,52 +48,26 @@ BraveProxyingWebSocket::~BraveProxyingWebSocket() { // static bool BraveProxyingWebSocket::ProxyWebSocket( content::RenderFrameHost* frame, - network::mojom::WebSocketRequest* request, - network::mojom::AuthenticationHandlerPtr* auth_handler) { + content::ContentBrowserClient::WebSocketFactory factory, + const GURL& url, + const GURL& site_for_cookies, + const base::Optional& user_agent, + network::mojom::WebSocketHandshakeClientPtr handshake_client) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - network::mojom::WebSocketPtrInfo proxied_socket_ptr_info; - auto proxied_request = std::move(*request); - *request = mojo::MakeRequest(&proxied_socket_ptr_info); - base::PostTaskWithTraits( FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&ResourceContextData::StartProxyingWebSocket, - frame->GetProcess()->GetBrowserContext() - ->GetResourceContext(), - frame->GetProcess()->GetID(), - frame->GetRoutingID(), - frame->GetFrameTreeNodeId(), - frame->GetLastCommittedOrigin(), - std::move(proxied_socket_ptr_info), - std::move(proxied_request))); + base::BindOnce( + &ResourceContextData::StartProxyingWebSocket, std::move(factory), url, + site_for_cookies, user_agent, handshake_client.PassInterface(), + frame->GetProcess()->GetBrowserContext()->GetResourceContext(), + frame->GetProcess()->GetID(), frame->GetRoutingID(), + frame->GetFrameTreeNodeId(), frame->GetLastCommittedOrigin())); return true; } -void BraveProxyingWebSocket::AddChannelRequest( - const GURL& url, - const std::vector& requested_protocols, - const GURL& site_for_cookies, - std::vector additional_headers, - network::mojom::WebSocketClientPtr client) { - if (binding_as_client_.is_bound() || !client || forwarding_client_) { - // Illegal request. - proxied_socket_ = nullptr; - return; - } - - request_.url = url; - // TODO(iefremov): site_for_cookies is not enough, we should find a way - // to initialize NetworkIsolationKey. - request_.site_for_cookies = site_for_cookies; - request_.request_initiator = origin_; - request_.render_frame_id = frame_id_; - websocket_protocols_ = requested_protocols; +void BraveProxyingWebSocket::Start() { request_id_ = request_id_generator_->Generate(); - - forwarding_client_ = std::move(client); - additional_headers_ = std::move(additional_headers); - // If the header client will be used, we start the request immediately, and // OnBeforeSendHeaders and OnSendHeaders will be handled there. Otherwise, // send these events before the request starts. @@ -136,48 +103,15 @@ void BraveProxyingWebSocket::AddChannelRequest( continuation.Run(net::OK); } -void BraveProxyingWebSocket::SendFrame( - bool fin, - network::mojom::WebSocketMessageType type, - const std::vector& data) { - proxied_socket_->SendFrame(fin, type, data); -} - -void BraveProxyingWebSocket::AddReceiveFlowControlQuota(int64_t quota) { - proxied_socket_->AddReceiveFlowControlQuota(quota); -} - -void BraveProxyingWebSocket::StartClosingHandshake( - uint16_t code, - const std::string& reason) { - proxied_socket_->StartClosingHandshake(code, reason); -} - -void BraveProxyingWebSocket::OnFailChannel(const std::string& reason) { - DCHECK(forwarding_client_); - forwarding_client_->OnFailChannel(reason); - - forwarding_client_ = nullptr; - int rv = net::ERR_FAILED; - if (reason == "HTTP Authentication failed; no valid credentials available" || - reason == "Proxy authentication failed") { - // This is needed to make some tests pass. - // TODO(yhirano): Remove this hack. - rv = net::ERR_ABORTED; - } - - OnError(rv); -} - -void BraveProxyingWebSocket::OnStartOpeningHandshake( +void BraveProxyingWebSocket::OnOpeningHandshakeStarted( network::mojom::WebSocketHandshakeRequestPtr request) { - DCHECK(forwarding_client_); - forwarding_client_->OnStartOpeningHandshake(std::move(request)); + DCHECK(forwarding_handshake_client_); + forwarding_handshake_client_->OnOpeningHandshakeStarted(std::move(request)); } -void BraveProxyingWebSocket::OnFinishOpeningHandshake( +void BraveProxyingWebSocket::OnResponseReceived( network::mojom::WebSocketHandshakeResponsePtr response) { - DCHECK(forwarding_client_); + DCHECK(forwarding_handshake_client_); response_.headers = base::MakeRefCounted(base::StringPrintf( @@ -190,10 +124,10 @@ void BraveProxyingWebSocket::OnFinishOpeningHandshake( response_.remote_endpoint = response->remote_endpoint; // TODO(yhirano): with both network service enabled or disabled, - // OnFinishOpeningHandshake is called with the original response headers. + // OnResponseReceived is called with the original response headers. // That means if OnHeadersReceived modified them the renderer won't see that // modification. This is the opposite of http(s) requests. - forwarding_client_->OnFinishOpeningHandshake(std::move(response)); + forwarding_handshake_client_->OnResponseReceived(std::move(response)); ContinueToHeadersReceived(); } @@ -223,45 +157,25 @@ void BraveProxyingWebSocket::ContinueToHeadersReceived() { OnHeadersReceivedComplete(net::OK); } -void BraveProxyingWebSocket::OnAddChannelResponse( +void BraveProxyingWebSocket::OnConnectionEstablished( + network::mojom::WebSocketPtr websocket, const std::string& selected_protocol, - const std::string& extensions) { - DCHECK(forwarding_client_); + const std::string& extensions, + uint64_t receive_quota_threshold) { + DCHECK(forwarding_handshake_client_); DCHECK(!is_done_); is_done_ = true; - forwarding_client_->OnAddChannelResponse(selected_protocol, extensions); -} - -void BraveProxyingWebSocket::OnDataFrame( - bool fin, - network::mojom::WebSocketMessageType type, - const std::vector& data) { - DCHECK(forwarding_client_); - forwarding_client_->OnDataFrame(fin, type, data); -} + forwarding_handshake_client_->OnConnectionEstablished( + std::move(websocket), selected_protocol, extensions, + receive_quota_threshold); -void BraveProxyingWebSocket::OnFlowControl(int64_t quota) { - DCHECK(forwarding_client_); - forwarding_client_->OnFlowControl(quota); -} - -void BraveProxyingWebSocket::OnDropChannel(bool was_clean, - uint16_t code, - const std::string& reason) { - DCHECK(forwarding_client_); - forwarding_client_->OnDropChannel(was_clean, code, reason); - forwarding_client_ = nullptr; - OnError(net::ERR_FAILED); -} - -void BraveProxyingWebSocket::OnClosingHandshake() { - DCHECK(forwarding_client_); - forwarding_client_->OnClosingHandshake(); + // Deletes |this|. + std::move(on_disconnect_).Run(this); } void BraveProxyingWebSocket::OnBeforeRequestComplete(int error_code) { - DCHECK(!binding_as_client_.is_bound()); + DCHECK(!binding_as_handshake_client_.is_bound()); DCHECK(request_.url.SchemeIsWSOrWSS()); if (error_code != net::OK) { OnError(error_code); @@ -292,14 +206,12 @@ void BraveProxyingWebSocket::OnBeforeRequestComplete(int error_code) { } void BraveProxyingWebSocket::ContinueToStartRequest(int error_code) { - DCHECK(!binding_as_client_.is_bound()); + DCHECK(!binding_as_handshake_client_.is_bound()); if (error_code != net::OK) { OnError(error_code); return; } - network::mojom::WebSocketClientPtr proxy; - base::flat_set used_header_names; std::vector additional_headers; for (net::HttpRequestHeaders::Iterator it(request_.headers); it.GetNext();) { @@ -314,13 +226,21 @@ void BraveProxyingWebSocket::ContinueToStartRequest(int error_code) { } } - binding_as_client_.Bind(mojo::MakeRequest(&proxy)); - binding_as_client_.set_connection_error_handler( - base::BindOnce(&BraveProxyingWebSocket::OnError, - base::Unretained(this), net::ERR_FAILED)); - proxied_socket_->AddChannelRequest( - request_.url, websocket_protocols_, request_.site_for_cookies, - std::move(additional_headers), std::move(proxy)); + // Here we detect mojo connection errors on |handshake_client|. See also + // CreateWebSocket in //network/services/public/mojom/network_context.mojom. + // Here we don't have |connection_client| so using |handshake_client| is the + // best. + network::mojom::WebSocketHandshakeClientPtr handshake_client; + binding_as_handshake_client_.Bind(mojo::MakeRequest(&handshake_client)); + binding_as_handshake_client_.set_connection_error_handler( + base::BindOnce(&BraveProxyingWebSocket::OnError, base::Unretained(this), + net::ERR_FAILED)); + network::mojom::AuthenticationHandlerPtr auth_handler; + network::mojom::TrustedHeaderClientPtr trusted_header_client; + + std::move(factory_).Run(request_.url, std::move(additional_headers), + std::move(handshake_client), std::move(auth_handler), + std::move(trusted_header_client)); } void BraveProxyingWebSocket::OnHeadersReceivedComplete(int error_code) { @@ -338,19 +258,17 @@ void BraveProxyingWebSocket::OnHeadersReceivedComplete(int error_code) { } void BraveProxyingWebSocket::PauseIncomingMethodCallProcessing() { - binding_as_client_.PauseIncomingMethodCallProcessing(); + binding_as_handshake_client_.PauseIncomingMethodCallProcessing(); } void BraveProxyingWebSocket::ResumeIncomingMethodCallProcessing() { - binding_as_client_.ResumeIncomingMethodCallProcessing(); + binding_as_handshake_client_.ResumeIncomingMethodCallProcessing(); } void BraveProxyingWebSocket::OnError(int error_code) { if (!is_done_) { is_done_ = true; } - if (forwarding_client_) - forwarding_client_->OnFailChannel(net::ErrorToString(error_code)); // Deletes |this|. std::move(on_disconnect_).Run(this); diff --git a/browser/net/brave_proxying_web_socket.h b/browser/net/brave_proxying_web_socket.h index faf02db8526..826365db5af 100644 --- a/browser/net/brave_proxying_web_socket.h +++ b/browser/net/brave_proxying_web_socket.h @@ -17,6 +17,7 @@ #include "base/optional.h" #include "brave/browser/net/resource_context_data.h" #include "brave/browser/net/url_context.h" +#include "content/public/browser/content_browser_client.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "services/network/public/cpp/resource_request.h" @@ -35,59 +36,43 @@ class ResourceContext; // Ensures that all web socket requests go through Brave network request // handling framework. Cargoculted from |WebRequestProxyingWebSocket|. class BraveProxyingWebSocket - : public network::mojom::WebSocket, - public network::mojom::WebSocketClient { + : public network::mojom::WebSocketHandshakeClient { public: + using WebSocketFactory = content::ContentBrowserClient::WebSocketFactory; using DisconnectCallback = base::OnceCallback; BraveProxyingWebSocket( - BraveRequestHandler* handler, - content::ResourceContext* resource_context, + WebSocketFactory factory, + const network::ResourceRequest& request, + network::mojom::WebSocketHandshakeClientPtr handshake_client, int process_id, - int frame_id, int frame_tree_node_id, - const url::Origin& origin, + content::ResourceContext* resource_context, scoped_refptr request_id_generator, - network::mojom::WebSocketPtr proxied_socket, - network::mojom::WebSocketRequest proxied_request, + BraveRequestHandler* handler, DisconnectCallback on_disconnect); ~BraveProxyingWebSocket() override; static bool ProxyWebSocket( content::RenderFrameHost* frame, - network::mojom::WebSocketRequest* request, - network::mojom::AuthenticationHandlerPtr* auth_handler); - - // mojom::WebSocket methods: - void AddChannelRequest( + content::ContentBrowserClient::WebSocketFactory factory, const GURL& url, - const std::vector& requested_protocols, const GURL& site_for_cookies, - std::vector additional_headers, - network::mojom::WebSocketClientPtr client) override; - void SendFrame(bool fin, - network::mojom::WebSocketMessageType type, - const std::vector& data) override; - void AddReceiveFlowControlQuota(int64_t quota) override; - void StartClosingHandshake(uint16_t code, const std::string& reason) override; - - // mojom::WebSocketClient methods: - void OnFailChannel(const std::string& reason) override; - void OnStartOpeningHandshake( + const base::Optional& user_agent, + network::mojom::WebSocketHandshakeClientPtr handshake_client); + + void Start(); + + // network::mojom::WebSocketHandShakeClient methods: + void OnOpeningHandshakeStarted( network::mojom::WebSocketHandshakeRequestPtr request) override; - void OnFinishOpeningHandshake( + void OnResponseReceived( network::mojom::WebSocketHandshakeResponsePtr response) override; - void OnAddChannelResponse(const std::string& selected_protocol, - const std::string& extensions) override; - void OnDataFrame(bool fin, - network::mojom::WebSocketMessageType type, - const std::vector& data) override; - void OnFlowControl(int64_t quota) override; - void OnDropChannel(bool was_clean, - uint16_t code, - const std::string& reason) override; - void OnClosingHandshake() override; + void OnConnectionEstablished(network::mojom::WebSocketPtr websocket, + const std::string& selected_protocol, + const std::string& extensions, + uint64_t receive_quota_threshold) override; private: void OnBeforeRequestComplete(int error_code); @@ -105,20 +90,17 @@ class BraveProxyingWebSocket std::shared_ptr ctx_; const int process_id_; - const int frame_id_; const int frame_tree_node_id_; - const url::Origin origin_; + content::ContentBrowserClient::WebSocketFactory factory_; content::ResourceContext* const resource_context_; scoped_refptr request_id_generator_; - network::mojom::WebSocketPtr proxied_socket_; - network::mojom::WebSocketClientPtr forwarding_client_; - mojo::Binding binding_as_websocket_{this}; - mojo::Binding binding_as_client_{this}; + network::mojom::WebSocketHandshakeClientPtr forwarding_handshake_client_; + mojo::Binding + binding_as_handshake_client_{this}; network::ResourceRequest request_; network::ResourceResponseHead response_; scoped_refptr override_headers_; - std::vector websocket_protocols_; std::vector additional_headers_; GURL redirect_url_; diff --git a/browser/net/resource_context_data.cc b/browser/net/resource_context_data.cc index 16b577f884f..35c944babcb 100644 --- a/browser/net/resource_context_data.cc +++ b/browser/net/resource_context_data.cc @@ -54,13 +54,16 @@ void ResourceContextData::StartProxying( // static void ResourceContextData::StartProxyingWebSocket( + content::ContentBrowserClient::WebSocketFactory factory, + const GURL& url, + const GURL& site_for_cookies, + const base::Optional& user_agent, + network::mojom::WebSocketHandshakeClientPtrInfo handshake_client, content::ResourceContext* resource_context, int render_process_id, int frame_id, int frame_tree_node_id, - const url::Origin& origin, - network::mojom::WebSocketPtrInfo proxied_socket_ptr_info, - network::mojom::WebSocketRequest proxied_request) { + const url::Origin& origin) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); auto* self = static_cast( @@ -75,16 +78,28 @@ void ResourceContextData::StartProxyingWebSocket( self->request_handler_.reset(new BraveRequestHandler); } + network::ResourceRequest request; + request.url = url; + // TODO(iefremov): site_for_cookies is not enough, we should find a way + // to initialize NetworkIsolationKey. + request.site_for_cookies = site_for_cookies; + if (user_agent) { + request.headers.SetHeader(net::HttpRequestHeaders::kUserAgent, *user_agent); + } + request.request_initiator = origin; + request.render_frame_id = frame_id; + auto proxy = std::make_unique( - self->request_handler_.get(), resource_context, render_process_id, - frame_id, frame_tree_node_id, origin, - self->request_id_generator_, - network::mojom::WebSocketPtr(std::move(proxied_socket_ptr_info)), - std::move(proxied_request), + std::move(factory), request, + network::mojom::WebSocketHandshakeClientPtr(std::move(handshake_client)), + render_process_id, frame_tree_node_id, resource_context, + self->request_id_generator_, self->request_handler_.get(), base::BindOnce(&ResourceContextData::RemoveProxyWebSocket, self->weak_factory_.GetWeakPtr())); + auto* raw_proxy = proxy.get(); self->websocket_proxies_.emplace(std::move(proxy)); + raw_proxy->Start(); } diff --git a/browser/net/resource_context_data.h b/browser/net/resource_context_data.h index 8028a74e25b..bd852f1fa37 100644 --- a/browser/net/resource_context_data.h +++ b/browser/net/resource_context_data.h @@ -15,6 +15,7 @@ #include "base/memory/ref_counted.h" #include "base/supports_user_data.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/content_browser_client.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/network/public/mojom/websocket.mojom.h" @@ -61,13 +62,16 @@ class ResourceContextData : public base::SupportsUserData::Data { network::mojom::URLLoaderFactoryPtrInfo target_factory); static void StartProxyingWebSocket( + content::ContentBrowserClient::WebSocketFactory factory, + const GURL& url, + const GURL& site_for_cookies, + const base::Optional& user_agent, + network::mojom::WebSocketHandshakeClientPtrInfo handshake_client, content::ResourceContext* resource_context, int render_process_id, int frame_id, int frame_tree_node_id, - const url::Origin& origin, - network::mojom::WebSocketPtrInfo proxied_socket_ptr_info, - network::mojom::WebSocketRequest proxied_request); + const url::Origin& origin); void RemoveProxy(BraveProxyingURLLoaderFactory* proxy); void RemoveProxyWebSocket(BraveProxyingWebSocket* proxy); From a85d3c0e7dc0e4cd4624d6bce8c132b7db68c013 Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Wed, 28 Aug 2019 17:21:01 +0900 Subject: [PATCH 55/55] Fixes theme changing. This commit is a squash of 4 commits from brave/brave-core#3281. - Fix setting preferred color scheme logic for brave theme change - Fix system dark mode change affect brave theme on Win10 When brave theme is set to dark or light, system dark mode change should not affect brave theme. - CleanUp: Delete SystemThemeSupportDarkMode Upstream added ui::NativeTheme::SystemDarkModeSupported(). Replace ours with upstream one. - Add dark mode change test by modifying reg value for Windows This test can verify whether theme change notification is delivered or not. If brave theme option is not default, system dark theme change should not trigger theme change notificagtion delivery. --- browser/themes/BUILD.gn | 3 +- browser/themes/brave_theme_service.cc | 13 +++- .../themes/brave_theme_service_browsertest.cc | 78 ++++++++++++++++++- browser/themes/brave_theme_utils.cc | 65 +++------------- browser/themes/brave_theme_utils.h | 14 +--- browser/themes/brave_theme_utils_internal.cc | 28 +++++++ browser/themes/brave_theme_utils_internal.h | 18 +++++ browser/themes/brave_theme_utils_mac.mm | 14 +--- browser/themes/brave_theme_utils_win.cc | 25 ------ .../browser/chrome_content_browser_client.cc | 4 - .../ui/native_theme/native_theme_win.cc | 23 ++++++ .../ui/native_theme/native_theme_win.h | 25 ++++++ ...ser-chrome_content_browser_client.cc.patch | 13 ---- .../ui-native_theme-native_theme_win.cc.patch | 12 +++ .../ui-native_theme-native_theme_win.h.patch | 8 +- 15 files changed, 215 insertions(+), 128 deletions(-) create mode 100644 browser/themes/brave_theme_utils_internal.cc create mode 100644 browser/themes/brave_theme_utils_internal.h delete mode 100644 browser/themes/brave_theme_utils_win.cc create mode 100644 chromium_src/ui/native_theme/native_theme_win.cc create mode 100644 chromium_src/ui/native_theme/native_theme_win.h delete mode 100644 patches/chrome-browser-chrome_content_browser_client.cc.patch create mode 100644 patches/ui-native_theme-native_theme_win.cc.patch diff --git a/browser/themes/BUILD.gn b/browser/themes/BUILD.gn index 0b4289799e2..6034e5ddd3f 100644 --- a/browser/themes/BUILD.gn +++ b/browser/themes/BUILD.gn @@ -7,8 +7,9 @@ source_set("themes") { "brave_theme_service_win.h", "brave_theme_utils.cc", "brave_theme_utils.h", + "brave_theme_utils_internal.cc", + "brave_theme_utils_internal.h", "brave_theme_utils_mac.mm", - "brave_theme_utils_win.cc", "theme_properties.cc", "theme_properties.h", ] diff --git a/browser/themes/brave_theme_service.cc b/browser/themes/brave_theme_service.cc index 96da4412099..cfec15a0665 100644 --- a/browser/themes/brave_theme_service.cc +++ b/browser/themes/brave_theme_service.cc @@ -180,6 +180,11 @@ void BraveThemeService::Init(Profile* profile) { if (brave::IsTorProfile(profile) || brave::IsGuestProfile(profile)) return; +#if defined(OS_WIN) + ui::IgnoreSystemDarkModeChange( + profile->GetPrefs()->GetInteger(kBraveThemeType) != + BraveThemeType::BRAVE_THEME_TYPE_DEFAULT); +#endif // Start with proper system theme to make brave theme and // base ui components theme use same theme. SetSystemTheme(static_cast( @@ -224,6 +229,12 @@ void BraveThemeService::OnPreferenceChanged(const std::string& pref_name) { // Changing theme type means default theme is not overridden anymore. profile()->GetPrefs()->SetBoolean(kUseOverriddenBraveThemeType, false); +#if defined(OS_WIN) + ui::IgnoreSystemDarkModeChange( + profile()->GetPrefs()->GetInteger(kBraveThemeType) != + BraveThemeType::BRAVE_THEME_TYPE_DEFAULT); +#endif + SetSystemTheme(static_cast( profile()->GetPrefs()->GetInteger(kBraveThemeType))); } @@ -266,5 +277,5 @@ bool BraveThemeService::SystemThemeModeEnabled() { switches::kForceDarkMode)) return true; - return SystemThemeSupportDarkMode(); + return ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeSupported(); } diff --git a/browser/themes/brave_theme_service_browsertest.cc b/browser/themes/brave_theme_service_browsertest.cc index a7be35e92d6..ea5dab8928b 100644 --- a/browser/themes/brave_theme_service_browsertest.cc +++ b/browser/themes/brave_theme_service_browsertest.cc @@ -18,6 +18,12 @@ #include "ui/native_theme/native_theme_dark_aura.h" #include "ui/native_theme/native_theme_observer.h" +#if defined(OS_WIN) +#include "base/run_loop.h" +#include "base/time/time.h" +#include "base/win/registry.h" +#endif + using BraveThemeServiceTest = InProcessBrowserTest; using BTS = BraveThemeService; @@ -94,9 +100,9 @@ IN_PROC_BROWSER_TEST_F(BraveThemeServiceTestWithoutSystemTheme, tp_private.GetColor(test_theme_property)); } -// Test whether appropriate native theme observer is called when brave theme is -// changed. -IN_PROC_BROWSER_TEST_F(BraveThemeServiceTest, NativeThemeObserverTest) { +// Test whether appropriate native/web theme observer is called when brave theme +// is changed. +IN_PROC_BROWSER_TEST_F(BraveThemeServiceTest, ThemeObserverTest) { Profile* profile = browser()->profile(); // Initially set to light. SetBraveThemeType(profile, BraveThemeType::BRAVE_THEME_TYPE_LIGHT); @@ -107,10 +113,17 @@ IN_PROC_BROWSER_TEST_F(BraveThemeServiceTest, NativeThemeObserverTest) { EXPECT_CALL( native_theme_observer, OnNativeThemeUpdated(ui::NativeTheme::GetInstanceForNativeUi())).Times(2); - ui::NativeTheme::GetInstanceForNativeUi()->AddObserver( &native_theme_observer); + TestNativeThemeObserver web_theme_observer; + EXPECT_CALL( + web_theme_observer, + OnNativeThemeUpdated(ui::NativeTheme::GetInstanceForWeb())).Times(2); + + ui::NativeTheme::GetInstanceForWeb()->AddObserver( + &web_theme_observer); + SetBraveThemeType(profile, BraveThemeType::BRAVE_THEME_TYPE_DARK); SetBraveThemeType(profile, BraveThemeType::BRAVE_THEME_TYPE_LIGHT); } @@ -140,3 +153,60 @@ IN_PROC_BROWSER_TEST_F(BraveThemeServiceTest, SystemThemeChangeTest) { ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeEnabled()); } } + +#if defined(OS_WIN) +// Test native theme notification is called properly by changing reg value. +// This simulates dark mode setting from Windows settings. +// And Toggle it twice from initial value to go back to initial value because +// reg value changes system value. Otherwise, dark mode config could be changed +// after running this test. +IN_PROC_BROWSER_TEST_F(BraveThemeServiceTest, DarkModeChangeByRegTest) { + if (!ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeSupported()) + return; + + base::win::RegKey hkcu_themes_regkey; + bool key_open_succeeded = hkcu_themes_regkey.Open( + HKEY_CURRENT_USER, + L"Software\\Microsoft\\Windows\\CurrentVersion\\" + L"Themes\\Personalize", + KEY_WRITE) == ERROR_SUCCESS; + DCHECK(key_open_succeeded); + + DWORD apps_use_light_theme = 1; + hkcu_themes_regkey.ReadValueDW(L"AppsUseLightTheme", + &apps_use_light_theme); + const bool initial_dark_mode = apps_use_light_theme == 0; + + // Toggle dark mode and check get notification for default type (same as...). + auto* profile = browser()->profile(); + SetBraveThemeType(profile, BraveThemeType::BRAVE_THEME_TYPE_DEFAULT); + + apps_use_light_theme = !initial_dark_mode ? 0 : 1; + hkcu_themes_regkey.WriteValue(L"AppsUseLightTheme", apps_use_light_theme); + + TestNativeThemeObserver native_theme_observer_for_default; + EXPECT_CALL( + native_theme_observer_for_default, + OnNativeThemeUpdated(ui::NativeTheme::GetInstanceForNativeUi())).Times(1); + ui::NativeTheme::GetInstanceForNativeUi()->AddObserver( + &native_theme_observer_for_default); + + // Toggle dark mode and |native_theme_observer_for_light| will not get + // notification for light type. + SetBraveThemeType(profile, BraveThemeType::BRAVE_THEME_TYPE_LIGHT); + + TestNativeThemeObserver native_theme_observer_for_light; + EXPECT_CALL( + native_theme_observer_for_light, + OnNativeThemeUpdated(ui::NativeTheme::GetInstanceForNativeUi())).Times(0); + ui::NativeTheme::GetInstanceForNativeUi()->AddObserver( + &native_theme_observer_for_light); + + apps_use_light_theme = initial_dark_mode ? 0 : 1; + hkcu_themes_regkey.WriteValue(L"AppsUseLightTheme", apps_use_light_theme); + + // Timeout is used because we can't get notifiication with light theme. + base::RunLoop run_loop; + run_loop.RunWithTimeout(base::TimeDelta::FromMilliseconds(500));; +} +#endif diff --git a/browser/themes/brave_theme_utils.cc b/browser/themes/brave_theme_utils.cc index 223509f7553..585e2cf602f 100644 --- a/browser/themes/brave_theme_utils.cc +++ b/browser/themes/brave_theme_utils.cc @@ -5,6 +5,7 @@ #include "brave/browser/themes/brave_theme_utils.h" +#include "brave/browser/themes/brave_theme_utils_internal.h" #include "ui/native_theme/native_theme.h" #if defined(OS_WIN) @@ -15,28 +16,15 @@ namespace ui { // static void BraveThemeUtils::SetDarkMode(bool dark_mode) { NativeTheme::GetInstanceForNativeUi()->set_dark_mode(dark_mode); + NativeTheme::GetInstanceForWeb()->set_dark_mode(dark_mode); } // static -void BraveThemeUtils::SetPreferredColorScheme(BraveThemeType brave_theme_type) { - NativeTheme::PreferredColorScheme preferred_color_scheme = - NativeTheme::PreferredColorScheme::kNoPreference; - switch (brave_theme_type) { - case BraveThemeType::BRAVE_THEME_TYPE_DEFAULT: - preferred_color_scheme = NativeTheme::GetInstanceForNativeUi() - ->CalculatePreferredColorScheme(); - break; - case BraveThemeType::BRAVE_THEME_TYPE_DARK: - preferred_color_scheme = NativeTheme::PreferredColorScheme::kDark; - break; - case BraveThemeType::BRAVE_THEME_TYPE_LIGHT: - preferred_color_scheme = NativeTheme::PreferredColorScheme::kLight; - break; - default: - NOTREACHED(); - } - NativeTheme::GetInstanceForNativeUi()->set_preferred_color_scheme( - preferred_color_scheme); +void BraveThemeUtils::ReCalcAndSetPreferredColorScheme() { + auto scheme = + NativeTheme::GetInstanceForNativeUi()->CalculatePreferredColorScheme(); + NativeTheme::GetInstanceForNativeUi()->set_preferred_color_scheme(scheme); + NativeTheme::GetInstanceForWeb()->set_preferred_color_scheme(scheme); } #if defined(OS_WIN) @@ -56,7 +44,8 @@ void SetSystemTheme(BraveThemeType type) { // Follow os theme type for default type. if (type == BraveThemeType::BRAVE_THEME_TYPE_DEFAULT) { #if defined(OS_WIN) - DCHECK(SystemThemeSupportDarkMode()); + DCHECK( + ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeSupported()); // This sets preferred color scheme on its own. ui::UpdateDarkModeStatus(); return; @@ -66,40 +55,6 @@ void SetSystemTheme(BraveThemeType type) { NOTREACHED(); #endif } - - ui::BraveThemeUtils::SetDarkMode(type == - BraveThemeType::BRAVE_THEME_TYPE_DARK); - ui::BraveThemeUtils::SetPreferredColorScheme(type); - // Have to notify observers explicitly because - // |ui::BraveThemeUtils::SetDarkMode()| and - // |ui::BraveThemeUtils::SetPreferredColorScheme| just set - // ui::NativeTheme:dark_mode_ and ui::NativeTheme:preferred_color_scheme_ - // values. - ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers(); -} -#endif - -#if defined(OS_LINUX) -bool SystemThemeSupportDarkMode() { - // Linux doesn't support dark mode yet. - return false; + internal::SetSystemThemeForNonDarkModePlatform(type); } #endif - -ui::NativeTheme::PreferredColorScheme GetBravePreferredColorScheme( - const ui::NativeTheme* native_theme, - Profile* profile) { - BraveThemeType brave_theme_type = - BraveThemeService::GetActiveBraveThemeType(profile); - switch (brave_theme_type) { - case BraveThemeType::BRAVE_THEME_TYPE_DEFAULT: - return native_theme->GetPreferredColorScheme(); - case BraveThemeType::BRAVE_THEME_TYPE_DARK: - return ui::NativeTheme::PreferredColorScheme::kDark; - case BraveThemeType::BRAVE_THEME_TYPE_LIGHT: - return ui::NativeTheme::PreferredColorScheme::kLight; - default: - NOTREACHED(); - } - return ui::NativeTheme::PreferredColorScheme::kNoPreference; -} diff --git a/browser/themes/brave_theme_utils.h b/browser/themes/brave_theme_utils.h index af72da8184e..28f29c82ec8 100644 --- a/browser/themes/brave_theme_utils.h +++ b/browser/themes/brave_theme_utils.h @@ -7,16 +7,6 @@ #define BRAVE_BROWSER_THEMES_BRAVE_THEME_UTILS_H_ #include "brave/browser/themes/brave_theme_service.h" -#include "ui/native_theme/native_theme.h" - -// When system theme preferred color is changed this is called from -// ChromeContentBrowserClient to see if we need to ignore the change if we are -// in one of our themes (not in "same as system" theme). -ui::NativeTheme::PreferredColorScheme GetBravePreferredColorScheme( - const ui::NativeTheme* native_theme, - Profile* profile); - -bool SystemThemeSupportDarkMode(); // When system supports system per-application system theme changing, set it. // Currently, only MacOS support it. @@ -34,7 +24,9 @@ namespace ui { class BraveThemeUtils { public: static void SetDarkMode(bool dark_mode); - static void SetPreferredColorScheme(BraveThemeType brave_theme_type); + // Recalculate preferred color scheme based on current dark mode that set by + // SetDarkMode() and set it to NativeTheme. + static void ReCalcAndSetPreferredColorScheme(); }; } // namespace ui diff --git a/browser/themes/brave_theme_utils_internal.cc b/browser/themes/brave_theme_utils_internal.cc new file mode 100644 index 00000000000..5019587eab0 --- /dev/null +++ b/browser/themes/brave_theme_utils_internal.cc @@ -0,0 +1,28 @@ +/* Copyright (c) 2019 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "brave/browser/themes/brave_theme_utils.h" + +#include "ui/native_theme/native_theme.h" + +namespace internal { + +void SetSystemThemeForNonDarkModePlatform(BraveThemeType type) { + // Call SetDarkMode() first then call ReCalcPreferredColorScheme() because + // ReCalcPreferredColorScheme() calculates preferred color scheme based on dark + // mode. + ui::BraveThemeUtils::SetDarkMode(type == + BraveThemeType::BRAVE_THEME_TYPE_DARK); + ui::BraveThemeUtils::ReCalcAndSetPreferredColorScheme(); + // Have to notify observers explicitly because + // |ui::BraveThemeUtils::SetDarkMode()| and + // |ui::BraveThemeUtils::ReCalcPreferredColorScheme| just set + // ui::NativeTheme:dark_mode_ and ui::NativeTheme:preferred_color_scheme_ + // values. + ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers(); + ui::NativeTheme::GetInstanceForWeb()->NotifyObservers(); +} + +} // namespace internal diff --git a/browser/themes/brave_theme_utils_internal.h b/browser/themes/brave_theme_utils_internal.h new file mode 100644 index 00000000000..4319102f242 --- /dev/null +++ b/browser/themes/brave_theme_utils_internal.h @@ -0,0 +1,18 @@ +/* Copyright (c) 2019 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_BROWSER_THEMES_BRAVE_THEME_UTILS_INTERNAL_H_ +#define BRAVE_BROWSER_THEMES_BRAVE_THEME_UTILS_INTERNAL_H_ + +#include "brave/browser/themes/brave_theme_service.h" + +namespace internal { + +// Reset dark mode and preferred color scheme and notify. +void SetSystemThemeForNonDarkModePlatform(BraveThemeType type); + +} // namespace internal + +#endif // BRAVE_BROWSER_THEMES_BRAVE_THEME_UTILS_INTERNAL_H_ diff --git a/browser/themes/brave_theme_utils_mac.mm b/browser/themes/brave_theme_utils_mac.mm index 1f905dcd9a8..82f8f7a96cf 100644 --- a/browser/themes/brave_theme_utils_mac.mm +++ b/browser/themes/brave_theme_utils_mac.mm @@ -8,18 +8,13 @@ #import #include "base/mac/sdk_forward_declarations.h" +#include "brave/browser/themes/brave_theme_utils_internal.h" #include "ui/native_theme/native_theme.h" -bool SystemThemeSupportDarkMode() { - // Dark mode is supported since Mojave. - if (@available(macOS 10.14, *)) - return true; - return false; -} - void SetSystemTheme(BraveThemeType type) { if (type == BRAVE_THEME_TYPE_DEFAULT) { - DCHECK(SystemThemeSupportDarkMode()); + DCHECK( + ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeSupported()); [NSApp setAppearance:nil]; return; } @@ -30,7 +25,6 @@ void SetSystemTheme(BraveThemeType type) { : NSAppearanceNameAqua; [NSApp setAppearance:[NSAppearance appearanceNamed:new_appearance_name]]; } else { - ui::SetDarkMode(type == BraveThemeType::BRAVE_THEME_TYPE_DARK); - ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers(); + internal::SetSystemThemeForNonDarkModePlatform(type); } } diff --git a/browser/themes/brave_theme_utils_win.cc b/browser/themes/brave_theme_utils_win.cc deleted file mode 100644 index 37cda8d51b0..00000000000 --- a/browser/themes/brave_theme_utils_win.cc +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (c) 2019 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "brave/browser/themes/brave_theme_utils.h" - -#include - -#include "base/win/registry.h" - -// Copied from ctor of NativeThemeWin. -bool SystemThemeSupportDarkMode() { - // Dark Mode currently targets UWP apps, which means Win32 apps need to use - // alternate, less reliable means of detecting the state. The following - // can break in future Windows versions. - base::win::RegKey hkcu_themes_regkey; - bool key_open_succeeded = - hkcu_themes_regkey.Open( - HKEY_CURRENT_USER, - L"Software\\Microsoft\\Windows\\CurrentVersion\\" - L"Themes\\Personalize", - KEY_READ | KEY_NOTIFY) == ERROR_SUCCESS; - return key_open_succeeded; -} diff --git a/chromium_src/chrome/browser/chrome_content_browser_client.cc b/chromium_src/chrome/browser/chrome_content_browser_client.cc index a14d7acab30..4e9147a9214 100644 --- a/chromium_src/chrome/browser/chrome_content_browser_client.cc +++ b/chromium_src/chrome/browser/chrome_content_browser_client.cc @@ -3,7 +3,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "brave/browser/themes/brave_theme_utils.h" #include "brave/components/brave_shields/browser/buildflags/buildflags.h" // For STP #include "build/build_config.h" // For OS_MACOSX #include "chrome/browser/search/search.h" @@ -30,9 +29,6 @@ #define HandleNewTabURLRewrite HandleNewTabURLRewrite_ChromiumImpl #define HandleNewTabURLReverseRewrite HandleNewTabURLReverseRewrite_ChromiumImpl -#define BRAVE_CHROMECONTENTBROWSERCLIENT_OVERRIDEWEBKITPREFS \ - switch (GetBravePreferredColorScheme(native_theme, profile)) { - namespace search { bool HandleNewTabURLRewrite(GURL* url, content::BrowserContext* bc) { return false; diff --git a/chromium_src/ui/native_theme/native_theme_win.cc b/chromium_src/ui/native_theme/native_theme_win.cc new file mode 100644 index 00000000000..84c790e19eb --- /dev/null +++ b/chromium_src/ui/native_theme/native_theme_win.cc @@ -0,0 +1,23 @@ +// Copyright (c) 2019 The Brave Authors +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// you can obtain one at http://mozilla.org/MPL/2.0/. + +namespace { +bool s_ignore_system_dark_mode_change = false; +} // namespace + +#define RETURN_IF_BRAVE_SHOULD_IGNORE_SYSTEM_DARK_MODE_CHANGE \ + if (s_ignore_system_dark_mode_change) { \ + return; \ + } + +#include "../../../../ui/native_theme/native_theme_win.cc" // NOLINT + +namespace ui { + +void NATIVE_THEME_EXPORT IgnoreSystemDarkModeChange(bool ignore) { + s_ignore_system_dark_mode_change = ignore; +} + +} // namespace ui diff --git a/chromium_src/ui/native_theme/native_theme_win.h b/chromium_src/ui/native_theme/native_theme_win.h new file mode 100644 index 00000000000..a2f4c20e348 --- /dev/null +++ b/chromium_src/ui/native_theme/native_theme_win.h @@ -0,0 +1,25 @@ +// Copyright (c) 2019 The Brave Authors +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// you can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_CHROMIUM_SRC_UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ +#define BRAVE_CHROMIUM_SRC_UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ + +#define BRAVE_UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ \ + private: \ + friend void UpdateDarkModeStatus(); + +#include "../../../../ui/native_theme/native_theme_win.h" // NOLINT +#undef BRAVE_UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ + +namespace ui { + +// Set true when browser should not response to system theme change. +// If user set dark or light explicitly, browser should ignore system dark mode +// setting. +void NATIVE_THEME_EXPORT IgnoreSystemDarkModeChange(bool ignore); + +} // namespace ui + +#endif // BRAVE_CHROMIUM_SRC_UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ diff --git a/patches/chrome-browser-chrome_content_browser_client.cc.patch b/patches/chrome-browser-chrome_content_browser_client.cc.patch deleted file mode 100644 index af7c5c3265b..00000000000 --- a/patches/chrome-browser-chrome_content_browser_client.cc.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc -index 0b29bc11f07c95f6048c9a35150925ad16a08586..44cab1c7f2897fb0191b33653d3cae945234d79f 100644 ---- a/chrome/browser/chrome_content_browser_client.cc -+++ b/chrome/browser/chrome_content_browser_client.cc -@@ -3376,7 +3376,7 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs( - : blink::ForcedColors::kNone; - #endif // !defined(OS_MACOSX) - -- switch (native_theme->GetPreferredColorScheme()) { -+ BRAVE_CHROMECONTENTBROWSERCLIENT_OVERRIDEWEBKITPREFS - case ui::NativeTheme::PreferredColorScheme::kDark: - web_prefs->preferred_color_scheme = blink::PreferredColorScheme::kDark; - break; diff --git a/patches/ui-native_theme-native_theme_win.cc.patch b/patches/ui-native_theme-native_theme_win.cc.patch new file mode 100644 index 00000000000..9913b4820ab --- /dev/null +++ b/patches/ui-native_theme-native_theme_win.cc.patch @@ -0,0 +1,12 @@ +diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc +index c6a0c1b9775f9d7e7a9be15d6f15ce84acf68b68..ce5e456350b816bac181c148c4be3c39321c53c6 100644 +--- a/ui/native_theme/native_theme_win.cc ++++ b/ui/native_theme/native_theme_win.cc +@@ -1964,6 +1964,7 @@ void NativeThemeWin::UpdateDarkModeStatus() { + &apps_use_light_theme); + fDarkModeEnabled = (apps_use_light_theme == 0); + } ++ RETURN_IF_BRAVE_SHOULD_IGNORE_SYSTEM_DARK_MODE_CHANGE + set_dark_mode(fDarkModeEnabled); + set_preferred_color_scheme(CalculatePreferredColorScheme()); + NotifyObservers(); diff --git a/patches/ui-native_theme-native_theme_win.h.patch b/patches/ui-native_theme-native_theme_win.h.patch index 26e5d2ff706..7b589d77da6 100644 --- a/patches/ui-native_theme-native_theme_win.h.patch +++ b/patches/ui-native_theme-native_theme_win.h.patch @@ -1,12 +1,12 @@ diff --git a/ui/native_theme/native_theme_win.h b/ui/native_theme/native_theme_win.h -index 03be75f99e3da8c29a8bc856da9e6f6ceea9af20..2b6aa17d081c90eadca6976a1370d32ace3250d7 100644 +index 03be75f99e3da8c29a8bc856da9e6f6ceea9af20..96221ee7f855cbb246d6427b17b95517c6894032 100644 --- a/ui/native_theme/native_theme_win.h +++ b/ui/native_theme/native_theme_win.h -@@ -85,6 +85,7 @@ class NATIVE_THEME_EXPORT NativeThemeWin : public NativeTheme, +@@ -84,6 +84,7 @@ class NATIVE_THEME_EXPORT NativeThemeWin : public NativeTheme, + bool SystemDarkModeSupported() const override; PreferredColorScheme CalculatePreferredColorScheme() const override; ++ BRAVE_UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ protected: -+ friend void UpdateDarkModeStatus(); friend class NativeTheme; friend class base::NoDestructor; - // Gets our singleton instance.